peachsim 0.1.2209 → 0.1.2213
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/command-registry.ts +1 -0
- package/cli/commands/inspect/settling.ts +1 -1
- package/cli/commands/map.ts +576 -0
- package/cli/commands/runtime.ts +1 -1
- package/cli/main.ts +6 -0
- package/cli/outbound-endpoints.ts +11 -0
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +282 -53
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +6 -3
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +280 -51
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +1264 -856
- package/dist-lib/host/fetch-proxy-handler.cjs +21 -5
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1966 -752
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +1806 -593
- package/dist-lib/native-app-identity-project.cjs +19 -3
- package/dist-lib/native-app-identity-project.mjs +19 -3
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +25 -24
- package/dist-lib/public-origins-lib.json +83 -53
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/reap-browser.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +2 -2
- package/dist-lib/sdk.mjs +2 -2
- package/dist-lib/skills.cjs +1800 -1334
- package/dist-lib/swift-compile.cjs +58 -12
- package/dist-lib/swift-compile.mjs +57 -12
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +257 -47
- package/dist-lib/vite.cjs +1530 -303
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +1 -0
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/CoreData.apinotes +35 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/CoreData.h +8 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSAttributeDescription.h +30 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSEntityDescription.h +14 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSExpressionDescription.h +10 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSFetchIndexDescription.h +13 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSFetchIndexElementDescription.h +18 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObject.h +11 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObjectContext.h +19 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObjectID.h +2 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObjectModel.h +3 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSMergePolicy.h +17 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSPersistentStore.h +8 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSPersistentStoreCoordinator.h +6 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSPropertyDescription.h +13 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSRelationshipDescription.h +21 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CoreAnimation.h +2 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIImage.h +1 -10
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes +21 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UINibLoading.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKitTypes.framework/Headers/UIKitTypes.h +11 -0
- package/sdk/ios/usr/lib/swift/Combine.swiftmodule/arm64-apple-ios-simulator.swiftinterface +18 -0
- package/sdk/ios/usr/lib/swift/Foundation.swiftmodule/arm64-apple-ios-simulator.swiftinterface +1 -0
- package/sdk/ios/usr/lib/swift/SwiftUI.swiftmodule/arm64-apple-ios-simulator.swiftinterface +19 -0
- package/sdk/ios/usr/lib/swift/SwiftUICore.swiftmodule/arm64-apple-ios-simulator.swiftinterface +4 -0
- package/sdk/ios/usr/lib/swift/UIKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +4 -0
- package/sdk/ios/wasm/include/pthread.h +1 -0
- package/sdk/ios/wasm/include/signal.h +2 -2
- package/sdk/native-hashes.json +3 -3
- package/skills/contrast/SKILL.md +1 -0
- package/src/home-paths.ts +1 -1
- package/src/host/bridge-host.ts +101 -97
- package/src/metro-plugin.ts +4 -1
- package/src/native-static-libraries.ts +7 -0
- package/src/react-native-coverage/native-source-ranges-file.ts +1 -1
- package/src/runtime-assets.ts +0 -1
- package/src/runtime-delivery.ts +1 -1
- package/src/runtime-packs.ts +212 -0
- package/src/swift-compile.ts +48 -10
- package/src/swift-host.ts +22 -3
- package/src/swift-objc-compile.ts +1 -1
- package/src/swift-objc-import.ts +32 -2
- package/src/swift-objc-standin.ts +1 -1
- package/src/swift-packages.ts +53 -28
- package/src/swift-pdf-raster.ts +60 -4
- package/src/swift-shipped-archives.json +44 -0
- package/src/swift-shipped-binaries.ts +12 -0
- package/src/swift-standin-config.ts +4 -2
- package/src/swift-standin-emit.ts +9 -3
- package/src/swift-standins.ts +75 -8
- package/src/vite-plugin-one.ts +4 -1
package/dist-lib/metro.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2213 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -39,7 +39,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
39
39
|
var define_SWIFT_COVERAGE_SOURCE_DIGESTS_default;
|
|
40
40
|
var init_define_SWIFT_COVERAGE_SOURCE_DIGESTS = __esm({
|
|
41
41
|
"<define:__SWIFT_COVERAGE_SOURCE_DIGESTS__>"() {
|
|
42
|
-
define_SWIFT_COVERAGE_SOURCE_DIGESTS_default = { "swift-coverage/indexdump.ts": "0d82d8eeb96bf377f409ea7e33274c341a710c0e071f6b6e17571a23d8d92412", "swift-coverage/indexing.ts": "633ccf19eec1f382a8847d0ee1dca42a2792a3c60aafd43622ed5152b09b8272", "swift-coverage/types.ts": "bd8fae54ea6c53e110cd8a5d7b57c1d532dd0166e09fdaea63c4f270c3780dd1", "swift-coverage/source.ts": "c151758a9f67631bc61473c375df0dc017da6902a34533b2cf4fc4fd7d19b6ee", "swift-coverage/package.ts": "1f0068be7461fa7c5a7a891faf318f305cbed2e94c19667ba76627f7e5be260b", "swift-coverage/xcode.ts": "65a500b806ce1c3a496de27f2e0ad77287c0f6795c618342c08af647f92af1fa", "swift-coverage/xcode-assets.ts": "99e03b74c961d2449afd58c2cbc415ba91d1d469a4f89e461c137fd6c305b27c", "swift-coverage/xcode-asset-symbols.ts": "1b2a67733bc9d139b351466270205452a6172140bc25080d72619e2952c44671", "swift-coverage/xcode-bridging.ts": "33184be8c5daf6646aa5a1276a4e15531f1be27b7c26f56550e0fbb1fc678a11", "swift-coverage/xcode-packages.ts": "8e6020d17d24474150a5a50d042aca6261819ef75c79680a287a66f395909915", "swift-coverage/xcode-strings.ts": "f2dd4c7cd8ef77035184b0132909c2fa09fd20ed06b7757c2f1f960bfdde031c", "swift-coverage/reader.ts": "da559b67ecd1161dea70c980b5f98f2c55af3550f0714479100fa5e9e813625c", "swift-coverage/provenance.ts": "eb3b41ae8b58b48f6758f084800f188dfb1edb227e483abdd6b80cde66e849b9", "swift-package-manifest.ts": "4b7d4a715cdaf57468ead23f2ff9dce76d02c6a888d73d144d4baa2ae571ba3c", "swift-package.ts": "338cfef9a34a930206ac2e1a8a90b85c8d61f776d9a41e6445dc18e0c5385cdb", "swift-source-file.ts": "93fd659ed63a27b67f54a7c229a7ceb636dc9c59e68414920ba36cff1eda1f94", "swift-toolchain.ts": "25505683ca29a0b380413bf2a5026d4967eacf886e35bc11ece6e15317e5bb02", "home-paths.ts": "
|
|
42
|
+
define_SWIFT_COVERAGE_SOURCE_DIGESTS_default = { "swift-coverage/indexdump.ts": "0d82d8eeb96bf377f409ea7e33274c341a710c0e071f6b6e17571a23d8d92412", "swift-coverage/indexing.ts": "633ccf19eec1f382a8847d0ee1dca42a2792a3c60aafd43622ed5152b09b8272", "swift-coverage/types.ts": "bd8fae54ea6c53e110cd8a5d7b57c1d532dd0166e09fdaea63c4f270c3780dd1", "swift-coverage/source.ts": "c151758a9f67631bc61473c375df0dc017da6902a34533b2cf4fc4fd7d19b6ee", "swift-coverage/package.ts": "1f0068be7461fa7c5a7a891faf318f305cbed2e94c19667ba76627f7e5be260b", "swift-coverage/xcode.ts": "65a500b806ce1c3a496de27f2e0ad77287c0f6795c618342c08af647f92af1fa", "swift-coverage/xcode-assets.ts": "99e03b74c961d2449afd58c2cbc415ba91d1d469a4f89e461c137fd6c305b27c", "swift-coverage/xcode-asset-symbols.ts": "1b2a67733bc9d139b351466270205452a6172140bc25080d72619e2952c44671", "swift-coverage/xcode-bridging.ts": "33184be8c5daf6646aa5a1276a4e15531f1be27b7c26f56550e0fbb1fc678a11", "swift-coverage/xcode-packages.ts": "8e6020d17d24474150a5a50d042aca6261819ef75c79680a287a66f395909915", "swift-coverage/xcode-strings.ts": "f2dd4c7cd8ef77035184b0132909c2fa09fd20ed06b7757c2f1f960bfdde031c", "swift-coverage/reader.ts": "da559b67ecd1161dea70c980b5f98f2c55af3550f0714479100fa5e9e813625c", "swift-coverage/provenance.ts": "eb3b41ae8b58b48f6758f084800f188dfb1edb227e483abdd6b80cde66e849b9", "swift-package-manifest.ts": "4b7d4a715cdaf57468ead23f2ff9dce76d02c6a888d73d144d4baa2ae571ba3c", "swift-package.ts": "338cfef9a34a930206ac2e1a8a90b85c8d61f776d9a41e6445dc18e0c5385cdb", "swift-source-file.ts": "93fd659ed63a27b67f54a7c229a7ceb636dc9c59e68414920ba36cff1eda1f94", "swift-toolchain.ts": "25505683ca29a0b380413bf2a5026d4967eacf886e35bc11ece6e15317e5bb02", "home-paths.ts": "d1606390f0e8e50f0ff72544eadb3d49dfabf08e004c1218f2998c36fb8995dd", "xcode-header-search.ts": "f8c3d557b4eca5ddad32907545353eb7ad53b2ebd0969d9ed8f7275e109a13b1", "xcode-project.ts": "86f79e98323ec065e0e5195324c75ca608f490efbd95dcc25c53d5aa0b9aecc9", "xcode-target-members.ts": "ad7589132bffab265e8a10b64e24484fe88b4a2b1cc0ee19a97f151a002eca77", "xcode-json-project.ts": "41990ebbe4b488eef34e74c4608b4b48e5a5b299ba98ca7fbcfdfa0e77be63b6", "openstep-plist.ts": "74e6ce1dac80c9c318e0e9f5e3e8cd19a898a8820c36fc160609695bcb59dcd3" };
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
|
|
@@ -335,42 +335,64 @@ var init_version = __esm({
|
|
|
335
335
|
|
|
336
336
|
// src/home-paths.ts
|
|
337
337
|
function ambientHomeDir() {
|
|
338
|
-
return
|
|
338
|
+
return import_node_path8.default.join((0, import_node_os4.homedir)(), ".peach");
|
|
339
339
|
}
|
|
340
340
|
function rnxHomeDir() {
|
|
341
341
|
const override = process.env[PEACH_HOME_ENV];
|
|
342
|
-
return override && override.length > 0 ?
|
|
342
|
+
return override && override.length > 0 ? import_node_path8.default.resolve(override) : ambientHomeDir();
|
|
343
343
|
}
|
|
344
344
|
function runtimesDir() {
|
|
345
|
-
return
|
|
345
|
+
return import_node_path8.default.join(rnxHomeDir(), "runtimes");
|
|
346
346
|
}
|
|
347
347
|
function runtimeDir(version) {
|
|
348
|
-
return
|
|
348
|
+
return import_node_path8.default.join(runtimesDir(), version);
|
|
349
349
|
}
|
|
350
350
|
function activeRuntimeFile() {
|
|
351
|
-
return
|
|
351
|
+
return import_node_path8.default.join(runtimesDir(), ACTIVE_RUNTIME_FILE);
|
|
352
|
+
}
|
|
353
|
+
function electronDir() {
|
|
354
|
+
return import_node_path8.default.join(rnxHomeDir(), "electron");
|
|
355
|
+
}
|
|
356
|
+
function profilesDir() {
|
|
357
|
+
return import_node_path8.default.join(rnxHomeDir(), "profiles");
|
|
352
358
|
}
|
|
353
359
|
function cacheDir() {
|
|
354
|
-
return
|
|
360
|
+
return import_node_path8.default.join(rnxHomeDir(), "cache");
|
|
361
|
+
}
|
|
362
|
+
function configFilePath() {
|
|
363
|
+
return import_node_path8.default.join(rnxHomeDir(), CONFIG_FILE);
|
|
364
|
+
}
|
|
365
|
+
function ensureRnxHome() {
|
|
366
|
+
import_node_fs10.default.mkdirSync(rnxHomeDir(), { recursive: true });
|
|
367
|
+
import_node_fs10.default.mkdirSync(runtimesDir(), { recursive: true });
|
|
368
|
+
import_node_fs10.default.mkdirSync(electronDir(), { recursive: true });
|
|
369
|
+
import_node_fs10.default.mkdirSync(profilesDir(), { recursive: true });
|
|
370
|
+
import_node_fs10.default.mkdirSync(cacheDir(), { recursive: true });
|
|
355
371
|
}
|
|
356
372
|
function readActiveRuntime() {
|
|
357
373
|
try {
|
|
358
|
-
const value =
|
|
374
|
+
const value = import_node_fs10.default.readFileSync(activeRuntimeFile(), "utf8").trim();
|
|
359
375
|
return value.length > 0 ? value : null;
|
|
360
376
|
} catch {
|
|
361
377
|
return null;
|
|
362
378
|
}
|
|
363
379
|
}
|
|
364
|
-
|
|
380
|
+
function writeActiveRuntime(version) {
|
|
381
|
+
import_node_fs10.default.mkdirSync(runtimesDir(), { recursive: true });
|
|
382
|
+
import_node_fs10.default.writeFileSync(activeRuntimeFile(), `${version}
|
|
383
|
+
`, "utf8");
|
|
384
|
+
}
|
|
385
|
+
var import_node_fs10, import_node_os4, import_node_path8, PEACH_HOME_ENV, ACTIVE_RUNTIME_FILE, CONFIG_FILE, DAEMON_LOCKFILE_MAX_BYTES;
|
|
365
386
|
var init_home_paths = __esm({
|
|
366
387
|
"src/home-paths.ts"() {
|
|
367
388
|
"use strict";
|
|
368
389
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
390
|
+
import_node_fs10 = __toESM(require("node:fs"), 1);
|
|
391
|
+
import_node_os4 = require("node:os");
|
|
392
|
+
import_node_path8 = __toESM(require("node:path"), 1);
|
|
372
393
|
PEACH_HOME_ENV = "PEACH_HOME";
|
|
373
394
|
ACTIVE_RUNTIME_FILE = "active";
|
|
395
|
+
CONFIG_FILE = "config.json";
|
|
374
396
|
DAEMON_LOCKFILE_MAX_BYTES = 16 * 1024;
|
|
375
397
|
}
|
|
376
398
|
});
|
|
@@ -1544,17 +1566,17 @@ function visit(node, visitor) {
|
|
|
1544
1566
|
} else
|
|
1545
1567
|
visit_(null, node, visitor_, Object.freeze([]));
|
|
1546
1568
|
}
|
|
1547
|
-
function visit_(key, node, visitor,
|
|
1548
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
1569
|
+
function visit_(key, node, visitor, path29) {
|
|
1570
|
+
const ctrl = callVisitor(key, node, visitor, path29);
|
|
1549
1571
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
1550
|
-
replaceNode(key,
|
|
1551
|
-
return visit_(key, ctrl, visitor,
|
|
1572
|
+
replaceNode(key, path29, ctrl);
|
|
1573
|
+
return visit_(key, ctrl, visitor, path29);
|
|
1552
1574
|
}
|
|
1553
1575
|
if (typeof ctrl !== "symbol") {
|
|
1554
1576
|
if (isCollection(node)) {
|
|
1555
|
-
|
|
1577
|
+
path29 = Object.freeze(path29.concat(node));
|
|
1556
1578
|
for (let i = 0; i < node.items.length; ++i) {
|
|
1557
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
1579
|
+
const ci = visit_(i, node.items[i], visitor, path29);
|
|
1558
1580
|
if (typeof ci === "number")
|
|
1559
1581
|
i = ci - 1;
|
|
1560
1582
|
else if (ci === BREAK)
|
|
@@ -1565,13 +1587,13 @@ function visit_(key, node, visitor, path26) {
|
|
|
1565
1587
|
}
|
|
1566
1588
|
}
|
|
1567
1589
|
} else if (isPair(node)) {
|
|
1568
|
-
|
|
1569
|
-
const ck = visit_("key", node.key, visitor,
|
|
1590
|
+
path29 = Object.freeze(path29.concat(node));
|
|
1591
|
+
const ck = visit_("key", node.key, visitor, path29);
|
|
1570
1592
|
if (ck === BREAK)
|
|
1571
1593
|
return BREAK;
|
|
1572
1594
|
else if (ck === REMOVE)
|
|
1573
1595
|
node.key = null;
|
|
1574
|
-
const cv = visit_("value", node.value, visitor,
|
|
1596
|
+
const cv = visit_("value", node.value, visitor, path29);
|
|
1575
1597
|
if (cv === BREAK)
|
|
1576
1598
|
return BREAK;
|
|
1577
1599
|
else if (cv === REMOVE)
|
|
@@ -1589,17 +1611,17 @@ async function visitAsync(node, visitor) {
|
|
|
1589
1611
|
} else
|
|
1590
1612
|
await visitAsync_(null, node, visitor_, Object.freeze([]));
|
|
1591
1613
|
}
|
|
1592
|
-
async function visitAsync_(key, node, visitor,
|
|
1593
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
1614
|
+
async function visitAsync_(key, node, visitor, path29) {
|
|
1615
|
+
const ctrl = await callVisitor(key, node, visitor, path29);
|
|
1594
1616
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
1595
|
-
replaceNode(key,
|
|
1596
|
-
return visitAsync_(key, ctrl, visitor,
|
|
1617
|
+
replaceNode(key, path29, ctrl);
|
|
1618
|
+
return visitAsync_(key, ctrl, visitor, path29);
|
|
1597
1619
|
}
|
|
1598
1620
|
if (typeof ctrl !== "symbol") {
|
|
1599
1621
|
if (isCollection(node)) {
|
|
1600
|
-
|
|
1622
|
+
path29 = Object.freeze(path29.concat(node));
|
|
1601
1623
|
for (let i = 0; i < node.items.length; ++i) {
|
|
1602
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
1624
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path29);
|
|
1603
1625
|
if (typeof ci === "number")
|
|
1604
1626
|
i = ci - 1;
|
|
1605
1627
|
else if (ci === BREAK)
|
|
@@ -1610,13 +1632,13 @@ async function visitAsync_(key, node, visitor, path26) {
|
|
|
1610
1632
|
}
|
|
1611
1633
|
}
|
|
1612
1634
|
} else if (isPair(node)) {
|
|
1613
|
-
|
|
1614
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
1635
|
+
path29 = Object.freeze(path29.concat(node));
|
|
1636
|
+
const ck = await visitAsync_("key", node.key, visitor, path29);
|
|
1615
1637
|
if (ck === BREAK)
|
|
1616
1638
|
return BREAK;
|
|
1617
1639
|
else if (ck === REMOVE)
|
|
1618
1640
|
node.key = null;
|
|
1619
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
1641
|
+
const cv = await visitAsync_("value", node.value, visitor, path29);
|
|
1620
1642
|
if (cv === BREAK)
|
|
1621
1643
|
return BREAK;
|
|
1622
1644
|
else if (cv === REMOVE)
|
|
@@ -1643,23 +1665,23 @@ function initVisitor(visitor) {
|
|
|
1643
1665
|
}
|
|
1644
1666
|
return visitor;
|
|
1645
1667
|
}
|
|
1646
|
-
function callVisitor(key, node, visitor,
|
|
1668
|
+
function callVisitor(key, node, visitor, path29) {
|
|
1647
1669
|
if (typeof visitor === "function")
|
|
1648
|
-
return visitor(key, node,
|
|
1670
|
+
return visitor(key, node, path29);
|
|
1649
1671
|
if (isMap(node))
|
|
1650
|
-
return visitor.Map?.(key, node,
|
|
1672
|
+
return visitor.Map?.(key, node, path29);
|
|
1651
1673
|
if (isSeq(node))
|
|
1652
|
-
return visitor.Seq?.(key, node,
|
|
1674
|
+
return visitor.Seq?.(key, node, path29);
|
|
1653
1675
|
if (isPair(node))
|
|
1654
|
-
return visitor.Pair?.(key, node,
|
|
1676
|
+
return visitor.Pair?.(key, node, path29);
|
|
1655
1677
|
if (isScalar(node))
|
|
1656
|
-
return visitor.Scalar?.(key, node,
|
|
1678
|
+
return visitor.Scalar?.(key, node, path29);
|
|
1657
1679
|
if (isAlias(node))
|
|
1658
|
-
return visitor.Alias?.(key, node,
|
|
1680
|
+
return visitor.Alias?.(key, node, path29);
|
|
1659
1681
|
return void 0;
|
|
1660
1682
|
}
|
|
1661
|
-
function replaceNode(key,
|
|
1662
|
-
const parent =
|
|
1683
|
+
function replaceNode(key, path29, node) {
|
|
1684
|
+
const parent = path29[path29.length - 1];
|
|
1663
1685
|
if (isCollection(parent)) {
|
|
1664
1686
|
parent.items[key] = node;
|
|
1665
1687
|
} else if (isPair(parent)) {
|
|
@@ -2219,10 +2241,10 @@ var init_createNode = __esm({
|
|
|
2219
2241
|
});
|
|
2220
2242
|
|
|
2221
2243
|
// ../../node_modules/yaml/browser/dist/nodes/Collection.js
|
|
2222
|
-
function collectionFromPath(schema4,
|
|
2244
|
+
function collectionFromPath(schema4, path29, value) {
|
|
2223
2245
|
let v6 = value;
|
|
2224
|
-
for (let i =
|
|
2225
|
-
const k =
|
|
2246
|
+
for (let i = path29.length - 1; i >= 0; --i) {
|
|
2247
|
+
const k = path29[i];
|
|
2226
2248
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
2227
2249
|
const a = [];
|
|
2228
2250
|
a[k] = v6;
|
|
@@ -2248,7 +2270,7 @@ var init_Collection = __esm({
|
|
|
2248
2270
|
init_createNode();
|
|
2249
2271
|
init_identity();
|
|
2250
2272
|
init_Node();
|
|
2251
|
-
isEmptyPath = (
|
|
2273
|
+
isEmptyPath = (path29) => path29 == null || typeof path29 === "object" && !!path29[Symbol.iterator]().next().done;
|
|
2252
2274
|
Collection = class extends NodeBase {
|
|
2253
2275
|
constructor(type, schema4) {
|
|
2254
2276
|
super(type);
|
|
@@ -2278,11 +2300,11 @@ var init_Collection = __esm({
|
|
|
2278
2300
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
2279
2301
|
* that already exists in the map.
|
|
2280
2302
|
*/
|
|
2281
|
-
addIn(
|
|
2282
|
-
if (isEmptyPath(
|
|
2303
|
+
addIn(path29, value) {
|
|
2304
|
+
if (isEmptyPath(path29))
|
|
2283
2305
|
this.add(value);
|
|
2284
2306
|
else {
|
|
2285
|
-
const [key, ...rest] =
|
|
2307
|
+
const [key, ...rest] = path29;
|
|
2286
2308
|
const node = this.get(key, true);
|
|
2287
2309
|
if (isCollection(node))
|
|
2288
2310
|
node.addIn(rest, value);
|
|
@@ -2296,8 +2318,8 @@ var init_Collection = __esm({
|
|
|
2296
2318
|
* Removes a value from the collection.
|
|
2297
2319
|
* @returns `true` if the item was found and removed.
|
|
2298
2320
|
*/
|
|
2299
|
-
deleteIn(
|
|
2300
|
-
const [key, ...rest] =
|
|
2321
|
+
deleteIn(path29) {
|
|
2322
|
+
const [key, ...rest] = path29;
|
|
2301
2323
|
if (rest.length === 0)
|
|
2302
2324
|
return this.delete(key);
|
|
2303
2325
|
const node = this.get(key, true);
|
|
@@ -2311,8 +2333,8 @@ var init_Collection = __esm({
|
|
|
2311
2333
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
2312
2334
|
* `true` (collections are always returned intact).
|
|
2313
2335
|
*/
|
|
2314
|
-
getIn(
|
|
2315
|
-
const [key, ...rest] =
|
|
2336
|
+
getIn(path29, keepScalar) {
|
|
2337
|
+
const [key, ...rest] = path29;
|
|
2316
2338
|
const node = this.get(key, true);
|
|
2317
2339
|
if (rest.length === 0)
|
|
2318
2340
|
return !keepScalar && isScalar(node) ? node.value : node;
|
|
@@ -2330,8 +2352,8 @@ var init_Collection = __esm({
|
|
|
2330
2352
|
/**
|
|
2331
2353
|
* Checks if the collection includes a value with the key `key`.
|
|
2332
2354
|
*/
|
|
2333
|
-
hasIn(
|
|
2334
|
-
const [key, ...rest] =
|
|
2355
|
+
hasIn(path29) {
|
|
2356
|
+
const [key, ...rest] = path29;
|
|
2335
2357
|
if (rest.length === 0)
|
|
2336
2358
|
return this.has(key);
|
|
2337
2359
|
const node = this.get(key, true);
|
|
@@ -2341,8 +2363,8 @@ var init_Collection = __esm({
|
|
|
2341
2363
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
2342
2364
|
* boolean to add/remove the item from the set.
|
|
2343
2365
|
*/
|
|
2344
|
-
setIn(
|
|
2345
|
-
const [key, ...rest] =
|
|
2366
|
+
setIn(path29, value) {
|
|
2367
|
+
const [key, ...rest] = path29;
|
|
2346
2368
|
if (rest.length === 0) {
|
|
2347
2369
|
this.set(key, value);
|
|
2348
2370
|
} else {
|
|
@@ -4315,15 +4337,15 @@ function visit2(cst, visitor) {
|
|
|
4315
4337
|
cst = { start: cst.start, value: cst.value };
|
|
4316
4338
|
_visit(Object.freeze([]), cst, visitor);
|
|
4317
4339
|
}
|
|
4318
|
-
function _visit(
|
|
4319
|
-
let ctrl = visitor(item,
|
|
4340
|
+
function _visit(path29, item, visitor) {
|
|
4341
|
+
let ctrl = visitor(item, path29);
|
|
4320
4342
|
if (typeof ctrl === "symbol")
|
|
4321
4343
|
return ctrl;
|
|
4322
4344
|
for (const field of ["key", "value"]) {
|
|
4323
4345
|
const token = item[field];
|
|
4324
4346
|
if (token && "items" in token) {
|
|
4325
4347
|
for (let i = 0; i < token.items.length; ++i) {
|
|
4326
|
-
const ci = _visit(Object.freeze(
|
|
4348
|
+
const ci = _visit(Object.freeze(path29.concat([[field, i]])), token.items[i], visitor);
|
|
4327
4349
|
if (typeof ci === "number")
|
|
4328
4350
|
i = ci - 1;
|
|
4329
4351
|
else if (ci === BREAK2)
|
|
@@ -4334,10 +4356,10 @@ function _visit(path26, item, visitor) {
|
|
|
4334
4356
|
}
|
|
4335
4357
|
}
|
|
4336
4358
|
if (typeof ctrl === "function" && field === "key")
|
|
4337
|
-
ctrl = ctrl(item,
|
|
4359
|
+
ctrl = ctrl(item, path29);
|
|
4338
4360
|
}
|
|
4339
4361
|
}
|
|
4340
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
4362
|
+
return typeof ctrl === "function" ? ctrl(item, path29) : ctrl;
|
|
4341
4363
|
}
|
|
4342
4364
|
var BREAK2, SKIP2, REMOVE2;
|
|
4343
4365
|
var init_cst_visit = __esm({
|
|
@@ -4349,9 +4371,9 @@ var init_cst_visit = __esm({
|
|
|
4349
4371
|
visit2.BREAK = BREAK2;
|
|
4350
4372
|
visit2.SKIP = SKIP2;
|
|
4351
4373
|
visit2.REMOVE = REMOVE2;
|
|
4352
|
-
visit2.itemAtPath = (cst,
|
|
4374
|
+
visit2.itemAtPath = (cst, path29) => {
|
|
4353
4375
|
let item = cst;
|
|
4354
|
-
for (const [field, index] of
|
|
4376
|
+
for (const [field, index] of path29) {
|
|
4355
4377
|
const tok = item?.[field];
|
|
4356
4378
|
if (tok && "items" in tok) {
|
|
4357
4379
|
item = tok.items[index];
|
|
@@ -4360,9 +4382,9 @@ var init_cst_visit = __esm({
|
|
|
4360
4382
|
}
|
|
4361
4383
|
return item;
|
|
4362
4384
|
};
|
|
4363
|
-
visit2.parentCollection = (cst,
|
|
4364
|
-
const parent = visit2.itemAtPath(cst,
|
|
4365
|
-
const field =
|
|
4385
|
+
visit2.parentCollection = (cst, path29) => {
|
|
4386
|
+
const parent = visit2.itemAtPath(cst, path29.slice(0, -1));
|
|
4387
|
+
const field = path29[path29.length - 1][0];
|
|
4366
4388
|
const coll = parent?.[field];
|
|
4367
4389
|
if (coll && "items" in coll)
|
|
4368
4390
|
return coll;
|
|
@@ -4457,25 +4479,25 @@ var init_browser = __esm({
|
|
|
4457
4479
|
});
|
|
4458
4480
|
|
|
4459
4481
|
// cli/commands/nodeRepoFileReader.ts
|
|
4460
|
-
var
|
|
4482
|
+
var import_node_fs12, nodeRepoFileReader;
|
|
4461
4483
|
var init_nodeRepoFileReader = __esm({
|
|
4462
4484
|
"cli/commands/nodeRepoFileReader.ts"() {
|
|
4463
4485
|
"use strict";
|
|
4464
4486
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
4465
|
-
|
|
4487
|
+
import_node_fs12 = require("node:fs");
|
|
4466
4488
|
nodeRepoFileReader = {
|
|
4467
|
-
exists:
|
|
4468
|
-
readText: (filePath) => (0,
|
|
4469
|
-
entries: (directory) => (0,
|
|
4489
|
+
exists: import_node_fs12.existsSync,
|
|
4490
|
+
readText: (filePath) => (0, import_node_fs12.readFileSync)(filePath, "utf8"),
|
|
4491
|
+
entries: (directory) => (0, import_node_fs12.readdirSync)(directory, { withFileTypes: true }).map((entry) => ({
|
|
4470
4492
|
name: entry.name,
|
|
4471
4493
|
directory: entry.isDirectory()
|
|
4472
4494
|
})),
|
|
4473
|
-
isDirectory: (filePath) => (0,
|
|
4495
|
+
isDirectory: (filePath) => (0, import_node_fs12.statSync)(filePath).isDirectory(),
|
|
4474
4496
|
readMetadata(filePath) {
|
|
4475
4497
|
try {
|
|
4476
|
-
const info = (0,
|
|
4498
|
+
const info = (0, import_node_fs12.lstatSync)(filePath);
|
|
4477
4499
|
if (!info.isFile() || info.size > 4 * 1024 * 1024) return null;
|
|
4478
|
-
return (0,
|
|
4500
|
+
return (0, import_node_fs12.readFileSync)(filePath, "utf8");
|
|
4479
4501
|
} catch {
|
|
4480
4502
|
return null;
|
|
4481
4503
|
}
|
|
@@ -4498,7 +4520,7 @@ function scanRepository(root) {
|
|
|
4498
4520
|
directories.push(next.dir);
|
|
4499
4521
|
let handle;
|
|
4500
4522
|
try {
|
|
4501
|
-
handle = (0,
|
|
4523
|
+
handle = (0, import_node_fs13.opendirSync)(next.dir);
|
|
4502
4524
|
} catch {
|
|
4503
4525
|
unreadable++;
|
|
4504
4526
|
continue;
|
|
@@ -4513,7 +4535,7 @@ function scanRepository(root) {
|
|
|
4513
4535
|
truncated = true;
|
|
4514
4536
|
continue;
|
|
4515
4537
|
}
|
|
4516
|
-
pending.push({ dir: (0,
|
|
4538
|
+
pending.push({ dir: (0, import_node_path10.join)(next.dir, entry.name), depth: next.depth + 1 });
|
|
4517
4539
|
}
|
|
4518
4540
|
} finally {
|
|
4519
4541
|
handle.closeSync();
|
|
@@ -4532,8 +4554,8 @@ function metadataValue(value, key) {
|
|
|
4532
4554
|
if (!value || typeof value !== "object") return void 0;
|
|
4533
4555
|
return Object.getOwnPropertyDescriptor(value, key)?.value;
|
|
4534
4556
|
}
|
|
4535
|
-
function readProjectJson(
|
|
4536
|
-
const text2 = readProjectMetadata(
|
|
4557
|
+
function readProjectJson(path29, files = nodeRepoFileReader) {
|
|
4558
|
+
const text2 = readProjectMetadata(path29, files);
|
|
4537
4559
|
if (text2 === null) return null;
|
|
4538
4560
|
try {
|
|
4539
4561
|
const value = JSON.parse(text2);
|
|
@@ -4543,7 +4565,7 @@ function readProjectJson(path26, files = nodeRepoFileReader) {
|
|
|
4543
4565
|
}
|
|
4544
4566
|
}
|
|
4545
4567
|
function readProjectManifest(dir, files = nodeRepoFileReader) {
|
|
4546
|
-
const parsed = readProjectJson((0,
|
|
4568
|
+
const parsed = readProjectJson((0, import_node_path10.join)(dir, "package.json"), files);
|
|
4547
4569
|
if (!parsed || typeof parsed !== "object") return null;
|
|
4548
4570
|
const record = (value) => {
|
|
4549
4571
|
if (!value || typeof value !== "object") return {};
|
|
@@ -4560,13 +4582,13 @@ function readProjectManifest(dir, files = nodeRepoFileReader) {
|
|
|
4560
4582
|
devDependencies: record(metadataValue(parsed, "devDependencies"))
|
|
4561
4583
|
};
|
|
4562
4584
|
}
|
|
4563
|
-
var
|
|
4585
|
+
var import_node_fs13, import_node_path10, import_json5, REPORT_SKIP_DIRS, PODFILE_NEW_ARCH_MARK, PODFILE_NEW_ARCH_RUBY;
|
|
4564
4586
|
var init_detect = __esm({
|
|
4565
4587
|
"cli/commands/detect.ts"() {
|
|
4566
4588
|
"use strict";
|
|
4567
4589
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
4568
|
-
|
|
4569
|
-
|
|
4590
|
+
import_node_fs13 = require("node:fs");
|
|
4591
|
+
import_node_path10 = require("node:path");
|
|
4570
4592
|
import_json5 = __toESM(require_lib(), 1);
|
|
4571
4593
|
init_browser();
|
|
4572
4594
|
init_nodeRepoFileReader();
|
|
@@ -4631,37 +4653,37 @@ var init_swiftContract = __esm({
|
|
|
4631
4653
|
});
|
|
4632
4654
|
|
|
4633
4655
|
// src/kotlin-toolchain.ts
|
|
4634
|
-
var
|
|
4656
|
+
var import_node_child_process11, import_node_util6, run5;
|
|
4635
4657
|
var init_kotlin_toolchain = __esm({
|
|
4636
4658
|
"src/kotlin-toolchain.ts"() {
|
|
4637
4659
|
"use strict";
|
|
4638
4660
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
4639
|
-
|
|
4661
|
+
import_node_child_process11 = require("node:child_process");
|
|
4640
4662
|
import_node_util6 = require("node:util");
|
|
4641
4663
|
init_home_paths();
|
|
4642
4664
|
init_is_record();
|
|
4643
|
-
run5 = (0, import_node_util6.promisify)(
|
|
4665
|
+
run5 = (0, import_node_util6.promisify)(import_node_child_process11.execFile);
|
|
4644
4666
|
}
|
|
4645
4667
|
});
|
|
4646
4668
|
|
|
4647
4669
|
// src/swift-source-file.ts
|
|
4648
4670
|
function relativeInside(root, file) {
|
|
4649
|
-
const relative3 =
|
|
4650
|
-
return relative3 === ".." || relative3.startsWith(`..${
|
|
4671
|
+
const relative3 = import_node_path20.default.relative(root, file);
|
|
4672
|
+
return relative3 === ".." || relative3.startsWith(`..${import_node_path20.default.sep}`) || import_node_path20.default.isAbsolute(relative3) ? null : relative3;
|
|
4651
4673
|
}
|
|
4652
4674
|
function packageInputPath(canonicalRoot, file) {
|
|
4653
|
-
const canonicalFile =
|
|
4675
|
+
const canonicalFile = import_node_fs20.default.realpathSync(file);
|
|
4654
4676
|
if (relativeInside(canonicalRoot, canonicalFile) === null) {
|
|
4655
4677
|
throw new Error(`swift input escapes the selected package: ${file}`);
|
|
4656
4678
|
}
|
|
4657
4679
|
return canonicalFile;
|
|
4658
4680
|
}
|
|
4659
4681
|
function readPackageFile(root, file, maxBytes) {
|
|
4660
|
-
const canonicalFile = packageInputPath(
|
|
4661
|
-
const expected =
|
|
4662
|
-
const fd =
|
|
4682
|
+
const canonicalFile = packageInputPath(import_node_fs20.default.realpathSync(root), file);
|
|
4683
|
+
const expected = import_node_fs20.default.statSync(canonicalFile);
|
|
4684
|
+
const fd = import_node_fs20.default.openSync(canonicalFile, import_node_fs20.default.constants.O_RDONLY | import_node_fs20.default.constants.O_NOFOLLOW);
|
|
4663
4685
|
try {
|
|
4664
|
-
const stat =
|
|
4686
|
+
const stat = import_node_fs20.default.fstatSync(fd);
|
|
4665
4687
|
if (stat.dev !== expected.dev || stat.ino !== expected.ino) {
|
|
4666
4688
|
throw new Error(`swift input changed while opening: ${file}`);
|
|
4667
4689
|
}
|
|
@@ -4671,25 +4693,25 @@ function readPackageFile(root, file, maxBytes) {
|
|
|
4671
4693
|
const bytes = Buffer.alloc(stat.size + 1);
|
|
4672
4694
|
let offset = 0;
|
|
4673
4695
|
while (offset < bytes.length) {
|
|
4674
|
-
const count =
|
|
4696
|
+
const count = import_node_fs20.default.readSync(fd, bytes, offset, bytes.length - offset, null);
|
|
4675
4697
|
if (count === 0) break;
|
|
4676
4698
|
offset += count;
|
|
4677
4699
|
}
|
|
4678
|
-
if (offset !== stat.size ||
|
|
4700
|
+
if (offset !== stat.size || import_node_fs20.default.fstatSync(fd).size !== stat.size) {
|
|
4679
4701
|
throw new Error(`swift input changed while reading: ${file}`);
|
|
4680
4702
|
}
|
|
4681
4703
|
return bytes.subarray(0, offset);
|
|
4682
4704
|
} finally {
|
|
4683
|
-
|
|
4705
|
+
import_node_fs20.default.closeSync(fd);
|
|
4684
4706
|
}
|
|
4685
4707
|
}
|
|
4686
|
-
var
|
|
4708
|
+
var import_node_fs20, import_node_path20;
|
|
4687
4709
|
var init_swift_source_file = __esm({
|
|
4688
4710
|
"src/swift-source-file.ts"() {
|
|
4689
4711
|
"use strict";
|
|
4690
4712
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
4691
|
-
|
|
4692
|
-
|
|
4713
|
+
import_node_fs20 = __toESM(require("node:fs"), 1);
|
|
4714
|
+
import_node_path20 = __toESM(require("node:path"), 1);
|
|
4693
4715
|
}
|
|
4694
4716
|
});
|
|
4695
4717
|
|
|
@@ -4714,19 +4736,19 @@ var init_swift_submit = __esm({
|
|
|
4714
4736
|
});
|
|
4715
4737
|
|
|
4716
4738
|
// src/nitro-dependencies.ts
|
|
4717
|
-
var
|
|
4739
|
+
var import_node_child_process12, import_node_util7, run6, DOUBLE_CONVERSION_WASM32_BACKPORT, RN_SHARED_DEPENDENCIES, RN_FMT_11_DEPENDENCIES, RN_FAST_FLOAT_6_DEPENDENCIES, RN_FMT_12_DEPENDENCIES;
|
|
4718
4740
|
var init_nitro_dependencies = __esm({
|
|
4719
4741
|
"src/nitro-dependencies.ts"() {
|
|
4720
4742
|
"use strict";
|
|
4721
4743
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
4722
|
-
|
|
4744
|
+
import_node_child_process12 = require("node:child_process");
|
|
4723
4745
|
import_node_util7 = require("node:util");
|
|
4724
4746
|
init_home_paths();
|
|
4725
4747
|
init_is_record();
|
|
4726
4748
|
init_kotlin_toolchain();
|
|
4727
4749
|
init_swift_source_file();
|
|
4728
4750
|
init_swift_submit();
|
|
4729
|
-
run6 = (0, import_node_util7.promisify)(
|
|
4751
|
+
run6 = (0, import_node_util7.promisify)(import_node_child_process12.execFile);
|
|
4730
4752
|
DOUBLE_CONVERSION_WASM32_BACKPORT = {
|
|
4731
4753
|
upstreamCommit: "8857767d5b2f5a035321e3712e8cd0008840ba6b",
|
|
4732
4754
|
originalSha256: "b495b11f7b61693486894f747add5b454894b8b3ca41aa1610d370ba16407ab7",
|
|
@@ -4812,19 +4834,19 @@ function readJson(root, relative3) {
|
|
|
4812
4834
|
return JSON.parse(
|
|
4813
4835
|
readPackageFile(
|
|
4814
4836
|
root,
|
|
4815
|
-
|
|
4837
|
+
import_node_path21.default.join(root, relative3),
|
|
4816
4838
|
MAX_SWIFT_COMPILE_SOURCE_BYTES
|
|
4817
4839
|
).toString("utf8")
|
|
4818
4840
|
);
|
|
4819
4841
|
}
|
|
4820
4842
|
function registrations(root) {
|
|
4821
|
-
const directory =
|
|
4822
|
-
const initializers =
|
|
4843
|
+
const directory = import_node_path21.default.join(root, "nitrogen/generated/ios");
|
|
4844
|
+
const initializers = import_node_fs21.default.readdirSync(directory).filter((file) => file.endsWith("Autolinking.mm"));
|
|
4823
4845
|
if (initializers.length !== 1)
|
|
4824
4846
|
throw new Error(`${root}: expected one generated Nitro iOS initializer`);
|
|
4825
4847
|
const source = readPackageFile(
|
|
4826
4848
|
root,
|
|
4827
|
-
|
|
4849
|
+
import_node_path21.default.join(directory, initializers[0]),
|
|
4828
4850
|
MAX_SWIFT_COMPILE_SOURCE_BYTES
|
|
4829
4851
|
).toString("utf8");
|
|
4830
4852
|
const namespaces = [
|
|
@@ -4887,18 +4909,18 @@ function registrations(root) {
|
|
|
4887
4909
|
if (new Set(classes.map(({ name: name2 }) => name2)).size !== classes.length)
|
|
4888
4910
|
throw new Error(`${root}: duplicate generated Nitro iOS registration`);
|
|
4889
4911
|
classes.sort((a, b) => a.name.localeCompare(b.name));
|
|
4890
|
-
const ios =
|
|
4891
|
-
if (swiftModule === null &&
|
|
4912
|
+
const ios = import_node_path21.default.join(root, "ios");
|
|
4913
|
+
if (swiftModule === null && import_node_fs21.default.existsSync(ios) && import_node_fs21.default.readdirSync(ios, { recursive: true, encoding: "utf8" }).some((file) => file.endsWith(".swift") && !file.startsWith("Tests")))
|
|
4892
4914
|
swiftModule = initializers[0].slice(0, -"Autolinking.mm".length);
|
|
4893
4915
|
return { namespace, swiftModule, classes, views: viewNames(root, classes) };
|
|
4894
4916
|
}
|
|
4895
4917
|
function viewNames(root, classes) {
|
|
4896
|
-
const directory =
|
|
4897
|
-
if (!
|
|
4918
|
+
const directory = import_node_path21.default.join(root, "nitrogen/generated/shared/json");
|
|
4919
|
+
if (!import_node_fs21.default.existsSync(directory)) return /* @__PURE__ */ new Set();
|
|
4898
4920
|
const views = /* @__PURE__ */ new Set();
|
|
4899
|
-
for (const file of
|
|
4921
|
+
for (const file of import_node_fs21.default.readdirSync(directory)) {
|
|
4900
4922
|
if (!file.endsWith("Config.json")) continue;
|
|
4901
|
-
const config = readJson(root,
|
|
4923
|
+
const config = readJson(root, import_node_path21.default.join("nitrogen/generated/shared/json", file));
|
|
4902
4924
|
const name2 = object3(config) ? config.uiViewClassName : void 0;
|
|
4903
4925
|
if (typeof name2 === "string" && classes.some((entry) => entry.name === name2))
|
|
4904
4926
|
views.add(name2);
|
|
@@ -4906,21 +4928,21 @@ function viewNames(root, classes) {
|
|
|
4906
4928
|
return views;
|
|
4907
4929
|
}
|
|
4908
4930
|
function hasNitroIosInitializer(root) {
|
|
4909
|
-
const generated =
|
|
4910
|
-
return
|
|
4931
|
+
const generated = import_node_path21.default.join(root, "nitrogen/generated/ios");
|
|
4932
|
+
return import_node_fs21.default.existsSync(generated) && import_node_fs21.default.readdirSync(generated).some((file) => file.endsWith("Autolinking.mm"));
|
|
4911
4933
|
}
|
|
4912
4934
|
function nitroRegisteredNames(root) {
|
|
4913
4935
|
if (!hasNitroIosInitializer(root)) return null;
|
|
4914
4936
|
const { classes, views } = registrations(root);
|
|
4915
4937
|
return { names: classes.map(({ name: name2 }) => name2), views: [...views].sort() };
|
|
4916
4938
|
}
|
|
4917
|
-
var
|
|
4939
|
+
var import_node_fs21, import_node_path21;
|
|
4918
4940
|
var init_nitro_source = __esm({
|
|
4919
4941
|
"src/nitro-source.ts"() {
|
|
4920
4942
|
"use strict";
|
|
4921
4943
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
4922
|
-
|
|
4923
|
-
|
|
4944
|
+
import_node_fs21 = __toESM(require("node:fs"), 1);
|
|
4945
|
+
import_node_path21 = __toESM(require("node:path"), 1);
|
|
4924
4946
|
init_nitro_dependencies();
|
|
4925
4947
|
init_react_native_autolinking();
|
|
4926
4948
|
init_swift_source_file();
|
|
@@ -5403,13 +5425,13 @@ function nodeHttpFetch(url, init = {}, redirects = 0) {
|
|
|
5403
5425
|
if (codings.every((coding) => DECODABLE_CODINGS.has(coding))) {
|
|
5404
5426
|
for (const coding of codings.reverse()) {
|
|
5405
5427
|
let decoder;
|
|
5406
|
-
if (coding === "br") decoder =
|
|
5428
|
+
if (coding === "br") decoder = import_node_zlib3.default.createBrotliDecompress();
|
|
5407
5429
|
else if (coding === "deflate") {
|
|
5408
5430
|
let inner;
|
|
5409
|
-
decoder = new
|
|
5431
|
+
decoder = new import_node_stream3.Transform({
|
|
5410
5432
|
transform(chunk, _encoding, done) {
|
|
5411
5433
|
if (!inner) {
|
|
5412
|
-
inner = (chunk[0] & 15) === 8 ?
|
|
5434
|
+
inner = (chunk[0] & 15) === 8 ? import_node_zlib3.default.createInflate(TRUNCATION_TOLERANT) : import_node_zlib3.default.createInflateRaw(TRUNCATION_TOLERANT);
|
|
5413
5435
|
inner.on("data", (data) => decoder.push(data));
|
|
5414
5436
|
inner.on("error", (error) => decoder.destroy(error));
|
|
5415
5437
|
}
|
|
@@ -5425,8 +5447,8 @@ function nodeHttpFetch(url, init = {}, redirects = 0) {
|
|
|
5425
5447
|
done(error);
|
|
5426
5448
|
}
|
|
5427
5449
|
});
|
|
5428
|
-
} else decoder =
|
|
5429
|
-
source = (0,
|
|
5450
|
+
} else decoder = import_node_zlib3.default.createGunzip(TRUNCATION_TOLERANT);
|
|
5451
|
+
source = (0, import_node_stream3.pipeline)(source, decoder, () => {
|
|
5430
5452
|
});
|
|
5431
5453
|
}
|
|
5432
5454
|
}
|
|
@@ -5454,17 +5476,17 @@ function nodeHttpFetch(url, init = {}, redirects = 0) {
|
|
|
5454
5476
|
req.end();
|
|
5455
5477
|
});
|
|
5456
5478
|
}
|
|
5457
|
-
var import_node_http, import_node_https,
|
|
5479
|
+
var import_node_http, import_node_https, import_node_stream3, import_node_zlib3, BODYLESS_STATUS, TRUNCATION_TOLERANT, MAX_REDIRECTS, DECODABLE_CODINGS;
|
|
5458
5480
|
var init_node_http_fetch = __esm({
|
|
5459
5481
|
"src/node-http-fetch.ts"() {
|
|
5460
5482
|
"use strict";
|
|
5461
5483
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
5462
5484
|
import_node_http = __toESM(require("node:http"), 1);
|
|
5463
5485
|
import_node_https = __toESM(require("node:https"), 1);
|
|
5464
|
-
|
|
5465
|
-
|
|
5486
|
+
import_node_stream3 = require("node:stream");
|
|
5487
|
+
import_node_zlib3 = __toESM(require("node:zlib"), 1);
|
|
5466
5488
|
BODYLESS_STATUS = /* @__PURE__ */ new Set([101, 204, 205, 304]);
|
|
5467
|
-
TRUNCATION_TOLERANT = { finishFlush:
|
|
5489
|
+
TRUNCATION_TOLERANT = { finishFlush: import_node_zlib3.default.constants.Z_SYNC_FLUSH };
|
|
5468
5490
|
MAX_REDIRECTS = 5;
|
|
5469
5491
|
DECODABLE_CODINGS = /* @__PURE__ */ new Set(["gzip", "x-gzip", "deflate", "br"]);
|
|
5470
5492
|
}
|
|
@@ -5500,7 +5522,7 @@ function normalize(p) {
|
|
|
5500
5522
|
if (trailingSlash) joined += "/";
|
|
5501
5523
|
return absolute ? "/" + joined : joined;
|
|
5502
5524
|
}
|
|
5503
|
-
function
|
|
5525
|
+
function join6(...parts) {
|
|
5504
5526
|
const present = parts.filter((part) => part.length > 0);
|
|
5505
5527
|
if (present.length === 0) return ".";
|
|
5506
5528
|
return normalize(present.join("/"));
|
|
@@ -5564,7 +5586,7 @@ var init_posixPath = __esm({
|
|
|
5564
5586
|
delimiter,
|
|
5565
5587
|
isAbsolute: isAbsolute2,
|
|
5566
5588
|
normalize,
|
|
5567
|
-
join:
|
|
5589
|
+
join: join6,
|
|
5568
5590
|
resolve: resolve2,
|
|
5569
5591
|
dirname: dirname2,
|
|
5570
5592
|
basename: basename2,
|
|
@@ -5807,16 +5829,16 @@ function sendJavaScript(req, res, source) {
|
|
|
5807
5829
|
res.end(req.method === "HEAD" ? void 0 : source);
|
|
5808
5830
|
}
|
|
5809
5831
|
function resolveReplacementModuleFile(fromFile, specifier) {
|
|
5810
|
-
const base =
|
|
5832
|
+
const base = import_node_path27.default.resolve(import_node_path27.default.dirname(fromFile), specifier);
|
|
5811
5833
|
const candidates = [
|
|
5812
5834
|
...REPLACEMENT_MODULE_EXTENSIONS.some(
|
|
5813
|
-
(ext) => ext ===
|
|
5835
|
+
(ext) => ext === import_node_path27.default.extname(base).toLowerCase()
|
|
5814
5836
|
) ? [base] : [],
|
|
5815
5837
|
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => base + ext),
|
|
5816
|
-
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) =>
|
|
5838
|
+
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => import_node_path27.default.join(base, `index${ext}`))
|
|
5817
5839
|
];
|
|
5818
5840
|
const found = candidates.find(
|
|
5819
|
-
(candidate) => (0,
|
|
5841
|
+
(candidate) => (0, import_node_fs26.statSync)(candidate, { throwIfNoEntry: false })?.isFile()
|
|
5820
5842
|
);
|
|
5821
5843
|
if (!found) {
|
|
5822
5844
|
throw new Error(
|
|
@@ -5827,8 +5849,8 @@ function resolveReplacementModuleFile(fromFile, specifier) {
|
|
|
5827
5849
|
}
|
|
5828
5850
|
function isInsideAny(roots, file) {
|
|
5829
5851
|
return roots.some((root) => {
|
|
5830
|
-
const relative3 =
|
|
5831
|
-
return !relative3.startsWith("..") && !
|
|
5852
|
+
const relative3 = import_node_path27.default.relative(root, file);
|
|
5853
|
+
return !relative3.startsWith("..") && !import_node_path27.default.isAbsolute(relative3);
|
|
5832
5854
|
});
|
|
5833
5855
|
}
|
|
5834
5856
|
function isReplacementModuleRequestUrl(rawUrl) {
|
|
@@ -5877,19 +5899,19 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
5877
5899
|
res.end("missing path param");
|
|
5878
5900
|
return true;
|
|
5879
5901
|
}
|
|
5880
|
-
const extension =
|
|
5902
|
+
const extension = import_node_path27.default.extname(targetPath).toLowerCase();
|
|
5881
5903
|
if (!REPLACEMENT_MODULE_EXTENSIONS.some((allowed) => allowed === extension)) {
|
|
5882
5904
|
res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
5883
5905
|
res.end(`replacement files must be ${REPLACEMENT_MODULE_EXTENSIONS.join(", ")}`);
|
|
5884
5906
|
return true;
|
|
5885
5907
|
}
|
|
5886
|
-
if (!
|
|
5908
|
+
if (!import_node_path27.default.isAbsolute(targetPath)) {
|
|
5887
5909
|
res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
5888
5910
|
res.end("replacement file path must be absolute");
|
|
5889
5911
|
return true;
|
|
5890
5912
|
}
|
|
5891
5913
|
const runtimePackages = new Set(url.searchParams.getAll("runtimePackage"));
|
|
5892
|
-
const servedRoots = options.servedRoots?.map((root) =>
|
|
5914
|
+
const servedRoots = options.servedRoots?.map((root) => import_node_path27.default.resolve(root));
|
|
5893
5915
|
if (servedRoots && !isInsideAny(servedRoots, targetPath)) {
|
|
5894
5916
|
res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
|
|
5895
5917
|
res.end("replacement file must be inside a folder the bundler serves");
|
|
@@ -5897,7 +5919,7 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
5897
5919
|
}
|
|
5898
5920
|
let resolvedTargetPath;
|
|
5899
5921
|
try {
|
|
5900
|
-
resolvedTargetPath = await
|
|
5922
|
+
resolvedTargetPath = await import_promises7.default.realpath(targetPath);
|
|
5901
5923
|
} catch (error) {
|
|
5902
5924
|
const message = error instanceof Error ? error.message : String(error);
|
|
5903
5925
|
res.writeHead(404, { "Content-Type": "text/plain; charset=utf-8" });
|
|
@@ -5905,7 +5927,7 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
5905
5927
|
return true;
|
|
5906
5928
|
}
|
|
5907
5929
|
if (servedRoots) {
|
|
5908
|
-
const realRoots = (await Promise.all(servedRoots.map((root) =>
|
|
5930
|
+
const realRoots = (await Promise.all(servedRoots.map((root) => import_promises7.default.realpath(root).catch(() => null)))).filter((root) => root !== null);
|
|
5909
5931
|
if (!isInsideAny(realRoots, resolvedTargetPath)) {
|
|
5910
5932
|
res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
|
|
5911
5933
|
res.end("replacement file must be inside a folder the bundler serves");
|
|
@@ -5915,7 +5937,7 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
5915
5937
|
try {
|
|
5916
5938
|
const compiled = compileReplacementModule({
|
|
5917
5939
|
filePath: resolvedTargetPath,
|
|
5918
|
-
source: await
|
|
5940
|
+
source: await import_promises7.default.readFile(resolvedTargetPath, "utf8"),
|
|
5919
5941
|
runtimePackages,
|
|
5920
5942
|
// the imported file's url is this request's with only its path changed,
|
|
5921
5943
|
// so the token, cache key and runtime packages carry over.
|
|
@@ -5941,14 +5963,14 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
5941
5963
|
}
|
|
5942
5964
|
return true;
|
|
5943
5965
|
}
|
|
5944
|
-
var
|
|
5966
|
+
var import_node_fs26, import_promises7, import_node_path27, REPLACEMENT_MODULE_ROUTE;
|
|
5945
5967
|
var init_replacement_module_handler = __esm({
|
|
5946
5968
|
"src/host/replacement-module-handler.ts"() {
|
|
5947
5969
|
"use strict";
|
|
5948
5970
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
|
|
5971
|
+
import_node_fs26 = require("node:fs");
|
|
5972
|
+
import_promises7 = __toESM(require("node:fs/promises"), 1);
|
|
5973
|
+
import_node_path27 = __toESM(require("node:path"), 1);
|
|
5952
5974
|
init_replacementModule();
|
|
5953
5975
|
init_backend_origin();
|
|
5954
5976
|
REPLACEMENT_MODULE_ROUTE = "/__sootsim-replacement-module";
|
|
@@ -6090,7 +6112,7 @@ function resolveAppStubs(appDir, config, configDir) {
|
|
|
6090
6112
|
const { modules, views, hybridObjects } = expandStubs(appDir, source);
|
|
6091
6113
|
assertRegisteredHybridObjects(appDir, source, hybridObjects);
|
|
6092
6114
|
for (const [name2, answer] of Object.entries(hybridObjects))
|
|
6093
|
-
nativeHybridObjects[name2] = answer === "unsupported" ? answer : { file: (0,
|
|
6115
|
+
nativeHybridObjects[name2] = answer === "unsupported" ? answer : { file: (0, import_node_path29.resolve)(source.baseDir, answer) };
|
|
6094
6116
|
for (const [name2, stub] of Object.entries(modules))
|
|
6095
6117
|
nativeModules[name2] = lowerStub(stub, source.baseDir);
|
|
6096
6118
|
for (const [name2, stub] of Object.entries(views))
|
|
@@ -6155,10 +6177,10 @@ function assertRegisteredHybridObjects(appDir, source, hybridObjects) {
|
|
|
6155
6177
|
);
|
|
6156
6178
|
}
|
|
6157
6179
|
function lowerStub(stub, baseDir) {
|
|
6158
|
-
return stub === "noop" ? stub : { file: (0,
|
|
6180
|
+
return stub === "noop" ? stub : { file: (0, import_node_path29.resolve)(baseDir, stub) };
|
|
6159
6181
|
}
|
|
6160
6182
|
function readPackageJson(dir) {
|
|
6161
|
-
const text2 = readSmallFile((0,
|
|
6183
|
+
const text2 = readSmallFile((0, import_node_path29.join)(dir, "package.json"));
|
|
6162
6184
|
if (!text2) return null;
|
|
6163
6185
|
try {
|
|
6164
6186
|
const parsed = JSON.parse(text2);
|
|
@@ -6170,9 +6192,9 @@ function readPackageJson(dir) {
|
|
|
6170
6192
|
function installedPackageDir(appDir, name2) {
|
|
6171
6193
|
let current = appDir;
|
|
6172
6194
|
while (true) {
|
|
6173
|
-
const dir = (0,
|
|
6174
|
-
if ((0,
|
|
6175
|
-
const parent = (0,
|
|
6195
|
+
const dir = (0, import_node_path29.join)(current, "node_modules", name2);
|
|
6196
|
+
if ((0, import_node_fs28.existsSync)((0, import_node_path29.join)(dir, "package.json"))) return (0, import_node_fs28.realpathSync)(dir);
|
|
6197
|
+
const parent = (0, import_node_path29.dirname)(current);
|
|
6176
6198
|
if (parent === current) return null;
|
|
6177
6199
|
current = parent;
|
|
6178
6200
|
}
|
|
@@ -6276,7 +6298,7 @@ function mergeRequests(previous, next) {
|
|
|
6276
6298
|
function packageNativeRequests(dir) {
|
|
6277
6299
|
const found = /* @__PURE__ */ new Map();
|
|
6278
6300
|
const directories = scanRepository(dir).directories.filter((sub) => {
|
|
6279
|
-
const segments = (0,
|
|
6301
|
+
const segments = (0, import_node_path29.relative)(dir, sub).split("/");
|
|
6280
6302
|
return !NATIVE_SOURCE_DIRS.has(segments[0]) && !segments.some((segment) => PACKAGE_SKIP_DIRS.has(segment));
|
|
6281
6303
|
});
|
|
6282
6304
|
let files = 0;
|
|
@@ -6284,7 +6306,7 @@ function packageNativeRequests(dir) {
|
|
|
6284
6306
|
for (const name2 of listDir(sub)) {
|
|
6285
6307
|
if (!SOURCE_FILE.test(name2) || name2.endsWith(".d.ts") || files >= 2e3) continue;
|
|
6286
6308
|
files++;
|
|
6287
|
-
const file = (0,
|
|
6309
|
+
const file = (0, import_node_path29.join)(sub, name2);
|
|
6288
6310
|
const text2 = readSmallFile(file);
|
|
6289
6311
|
if (!text2) continue;
|
|
6290
6312
|
for (const { line: _line, ...request } of sourceNativeRequests(file, text2, true)) {
|
|
@@ -6402,27 +6424,27 @@ function wireSlotMigration(appDir, configPath, wire, kept = []) {
|
|
|
6402
6424
|
}
|
|
6403
6425
|
function listDir(dir) {
|
|
6404
6426
|
try {
|
|
6405
|
-
return (0,
|
|
6427
|
+
return (0, import_node_fs28.readdirSync)(dir);
|
|
6406
6428
|
} catch {
|
|
6407
6429
|
return [];
|
|
6408
6430
|
}
|
|
6409
6431
|
}
|
|
6410
6432
|
function readSmallFile(file) {
|
|
6411
6433
|
try {
|
|
6412
|
-
return (0,
|
|
6434
|
+
return (0, import_node_fs28.statSync)(file).size <= 1024 * 1024 ? (0, import_node_fs28.readFileSync)(file, "utf8") : null;
|
|
6413
6435
|
} catch {
|
|
6414
6436
|
return null;
|
|
6415
6437
|
}
|
|
6416
6438
|
}
|
|
6417
6439
|
function hasNativeCode(dir, platform) {
|
|
6418
|
-
const expoConfig = (0,
|
|
6440
|
+
const expoConfig = (0, import_node_path29.join)(dir, "expo-module.config.json");
|
|
6419
6441
|
const platforms = metadataValue(readProjectJson(expoConfig), "platforms");
|
|
6420
6442
|
if (Array.isArray(platforms))
|
|
6421
6443
|
return platforms.includes(platform) || platform === "ios" && platforms.includes("apple");
|
|
6422
|
-
if ([platform, "expo-module.config.json"].some((entry) => (0,
|
|
6444
|
+
if ([platform, "expo-module.config.json"].some((entry) => (0, import_node_fs28.existsSync)((0, import_node_path29.join)(dir, entry))))
|
|
6423
6445
|
return true;
|
|
6424
6446
|
if (listDir(dir).some((name2) => name2.endsWith(".podspec"))) return true;
|
|
6425
|
-
const manifest = readSmallFile((0,
|
|
6447
|
+
const manifest = readSmallFile((0, import_node_path29.join)(dir, "package.json"));
|
|
6426
6448
|
return manifest !== null && manifest.includes('"codegenConfig"');
|
|
6427
6449
|
}
|
|
6428
6450
|
function scanLocalNative(appDir, pkg, answered, platform, knownPackages = /* @__PURE__ */ new Set(), includeLegacy = false, providers) {
|
|
@@ -6435,7 +6457,7 @@ function scanLocalNative(appDir, pkg, answered, platform, knownPackages = /* @__
|
|
|
6435
6457
|
(excluded) => dir === excluded || dir.startsWith(`${excluded}/`)
|
|
6436
6458
|
))
|
|
6437
6459
|
continue;
|
|
6438
|
-
if ((0,
|
|
6460
|
+
if ((0, import_node_fs28.existsSync)((0, import_node_path29.join)(dir, "expo-module.config.json"))) {
|
|
6439
6461
|
if (platform && !hasNativeCode(dir, platform)) {
|
|
6440
6462
|
excludedModuleDirs.push(dir);
|
|
6441
6463
|
continue;
|
|
@@ -6444,7 +6466,7 @@ function scanLocalNative(appDir, pkg, answered, platform, knownPackages = /* @__
|
|
|
6444
6466
|
}
|
|
6445
6467
|
for (const name2 of listDir(dir)) {
|
|
6446
6468
|
if (SOURCE_FILE.test(name2) && !name2.endsWith(".d.ts"))
|
|
6447
|
-
sourceFiles.push((0,
|
|
6469
|
+
sourceFiles.push((0, import_node_path29.join)(dir, name2));
|
|
6448
6470
|
}
|
|
6449
6471
|
}
|
|
6450
6472
|
}
|
|
@@ -6454,7 +6476,7 @@ function scanLocalNative(appDir, pkg, answered, platform, knownPackages = /* @__
|
|
|
6454
6476
|
scanRepository(dir).directories.flatMap(
|
|
6455
6477
|
(sub) => listDir(sub).filter(
|
|
6456
6478
|
(name2) => NATIVE_SOURCE_FILE.test(name2) && (!platform || (platform === "ios" ? name2.endsWith(".swift") : name2.endsWith(".kt")))
|
|
6457
|
-
).map((name2) => (0,
|
|
6479
|
+
).map((name2) => (0, import_node_path29.join)(sub, name2))
|
|
6458
6480
|
)
|
|
6459
6481
|
])
|
|
6460
6482
|
);
|
|
@@ -6463,7 +6485,7 @@ function scanLocalNative(appDir, pkg, answered, platform, knownPackages = /* @__
|
|
|
6463
6485
|
const known = owners.get(dir);
|
|
6464
6486
|
if (known) return known;
|
|
6465
6487
|
const name2 = readPackageJson(dir)?.name;
|
|
6466
|
-
const parent = (0,
|
|
6488
|
+
const parent = (0, import_node_path29.dirname)(dir);
|
|
6467
6489
|
const result = typeof name2 === "string" ? name2 : parent === dir ? pkg.name ?? "app" : owner(parent);
|
|
6468
6490
|
owners.set(dir, result);
|
|
6469
6491
|
return result;
|
|
@@ -6477,25 +6499,25 @@ function scanLocalNative(appDir, pkg, answered, platform, knownPackages = /* @__
|
|
|
6477
6499
|
else {
|
|
6478
6500
|
const moduleDir2 = expoModuleDirs.find((dir) => file.startsWith(`${dir}/`));
|
|
6479
6501
|
if (moduleDir2 && (file.endsWith(".swift") || !known.expoModule)) {
|
|
6480
|
-
known.expoModule = (0,
|
|
6502
|
+
known.expoModule = (0, import_node_path29.relative)(appDir, moduleDir2) || ".";
|
|
6481
6503
|
known.swift = file.endsWith(".swift");
|
|
6482
6504
|
}
|
|
6483
6505
|
}
|
|
6484
6506
|
return;
|
|
6485
6507
|
}
|
|
6486
6508
|
providers ??= dependencyNativeOwners(appDir, pkg);
|
|
6487
|
-
const packageName = providers.get(key) ?? owner((0,
|
|
6509
|
+
const packageName = providers.get(key) ?? owner((0, import_node_path29.dirname)(file));
|
|
6488
6510
|
if (knownPackages.has(packageName)) return;
|
|
6489
6511
|
const moduleDir = expoModuleDirs.find((dir) => file.startsWith(`${dir}/`)) ?? null;
|
|
6490
6512
|
found.set(key, {
|
|
6491
6513
|
kind,
|
|
6492
6514
|
name: name2,
|
|
6493
6515
|
package: packageName,
|
|
6494
|
-
path: `${(0,
|
|
6495
|
-
expoModule: moduleDir ? (0,
|
|
6516
|
+
path: `${(0, import_node_path29.relative)(appDir, file)}:${line}`,
|
|
6517
|
+
expoModule: moduleDir ? (0, import_node_path29.relative)(appDir, moduleDir) || "." : null,
|
|
6496
6518
|
optional: optional3,
|
|
6497
6519
|
swift: moduleDir ? (nativeFilesByModule.get(moduleDir) ?? []).some(
|
|
6498
|
-
(
|
|
6520
|
+
(path29) => path29.endsWith(".swift") && [...(readSmallFile(path29) ?? "").matchAll(/\bName\(\s*"(\w+)"\s*\)/g)].some(
|
|
6499
6521
|
(match) => match[1] === name2
|
|
6500
6522
|
)
|
|
6501
6523
|
) : false,
|
|
@@ -6543,30 +6565,30 @@ function workspacePackageDirs(appDir, pkg) {
|
|
|
6543
6565
|
for (const name2 of Object.keys({ ...pkg.dependencies, ...pkg.devDependencies })) {
|
|
6544
6566
|
let current = appDir;
|
|
6545
6567
|
while (true) {
|
|
6546
|
-
const link = (0,
|
|
6547
|
-
if ((0,
|
|
6548
|
-
if ((0,
|
|
6549
|
-
const target = (0,
|
|
6568
|
+
const link = (0, import_node_path29.join)(current, "node_modules", name2);
|
|
6569
|
+
if ((0, import_node_fs28.existsSync)(link)) {
|
|
6570
|
+
if ((0, import_node_fs28.lstatSync)(link).isSymbolicLink()) {
|
|
6571
|
+
const target = (0, import_node_fs28.realpathSync)(link);
|
|
6550
6572
|
if (!target.split("/").includes("node_modules") && !target.startsWith(`${appDir}/`)) {
|
|
6551
6573
|
dirs.add(target);
|
|
6552
6574
|
}
|
|
6553
6575
|
}
|
|
6554
6576
|
break;
|
|
6555
6577
|
}
|
|
6556
|
-
const parent = (0,
|
|
6578
|
+
const parent = (0, import_node_path29.dirname)(current);
|
|
6557
6579
|
if (parent === current) break;
|
|
6558
6580
|
current = parent;
|
|
6559
6581
|
}
|
|
6560
6582
|
}
|
|
6561
6583
|
return [...dirs];
|
|
6562
6584
|
}
|
|
6563
|
-
var
|
|
6585
|
+
var import_node_fs28, import_node_path29, import_oxc_parser2, import_sucrase, SOURCE_FILE, NATIVE_LOOKUP, NATIVE_SOURCE_DIRS, PACKAGE_SKIP_DIRS, NATIVE_SOURCE_FILE;
|
|
6564
6586
|
var init_app_stubs = __esm({
|
|
6565
6587
|
"cli/app-stubs.ts"() {
|
|
6566
6588
|
"use strict";
|
|
6567
6589
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
6568
|
-
|
|
6569
|
-
|
|
6590
|
+
import_node_fs28 = require("node:fs");
|
|
6591
|
+
import_node_path29 = require("node:path");
|
|
6570
6592
|
init_version_range();
|
|
6571
6593
|
import_oxc_parser2 = require("oxc-parser");
|
|
6572
6594
|
import_sucrase = require("sucrase");
|
|
@@ -6602,12 +6624,12 @@ function resolveFileEntries(entries, configDir) {
|
|
|
6602
6624
|
return Object.fromEntries(
|
|
6603
6625
|
Object.entries(entries).map(([name2, resolution]) => [
|
|
6604
6626
|
name2,
|
|
6605
|
-
resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file:
|
|
6627
|
+
resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file: import_node_path30.default.resolve(configDir, resolution.file) } : resolution
|
|
6606
6628
|
])
|
|
6607
6629
|
);
|
|
6608
6630
|
}
|
|
6609
6631
|
function resolveConfigReplacementFiles(config, configPath) {
|
|
6610
|
-
const configDir =
|
|
6632
|
+
const configDir = import_node_path30.default.dirname(configPath);
|
|
6611
6633
|
return {
|
|
6612
6634
|
...config,
|
|
6613
6635
|
modules: resolveFileEntries(config.modules, configDir)
|
|
@@ -6623,7 +6645,7 @@ async function loadRNXAppStubs(project) {
|
|
|
6623
6645
|
return resolveAppStubs(
|
|
6624
6646
|
project.appDir,
|
|
6625
6647
|
config,
|
|
6626
|
-
project.configPath ?
|
|
6648
|
+
project.configPath ? import_node_path30.default.dirname(project.configPath) : project.appDir
|
|
6627
6649
|
);
|
|
6628
6650
|
} catch (error) {
|
|
6629
6651
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -6642,7 +6664,7 @@ async function loadConfigFile(project) {
|
|
|
6642
6664
|
[`${rnxPublicBrand.packageName}/config`]: config_exports
|
|
6643
6665
|
}
|
|
6644
6666
|
});
|
|
6645
|
-
const loaded3 = project.configPath.endsWith(".json") ? JSON.parse((0,
|
|
6667
|
+
const loaded3 = project.configPath.endsWith(".json") ? JSON.parse((0, import_node_fs29.readFileSync)(project.configPath, "utf8")) : await jiti.import(project.configPath, { default: true });
|
|
6646
6668
|
if (!isPeachConfig(loaded3)) {
|
|
6647
6669
|
throw new Error("the default export must be a peach config object");
|
|
6648
6670
|
}
|
|
@@ -6678,13 +6700,13 @@ async function resolveRNXAppConfig(startDir = process.cwd()) {
|
|
|
6678
6700
|
const project = resolveAppProject(startDir);
|
|
6679
6701
|
return { project, ...await loadRNXAppStubs(project) };
|
|
6680
6702
|
}
|
|
6681
|
-
var
|
|
6703
|
+
var import_node_fs29, import_node_path30, import_jiti, WIRE_SLOTS;
|
|
6682
6704
|
var init_app_config = __esm({
|
|
6683
6705
|
"cli/app-config.ts"() {
|
|
6684
6706
|
"use strict";
|
|
6685
6707
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
6686
|
-
|
|
6687
|
-
|
|
6708
|
+
import_node_fs29 = require("node:fs");
|
|
6709
|
+
import_node_path30 = __toESM(require("node:path"), 1);
|
|
6688
6710
|
import_jiti = require("jiti");
|
|
6689
6711
|
init_config();
|
|
6690
6712
|
init_config();
|
|
@@ -6784,14 +6806,14 @@ async function produceConfiguredBundle(source, config, runtimePackages) {
|
|
|
6784
6806
|
const neededPackages = /* @__PURE__ */ new Set();
|
|
6785
6807
|
const factories = [];
|
|
6786
6808
|
const visit3 = (filePath) => {
|
|
6787
|
-
const real =
|
|
6809
|
+
const real = import_node_fs30.default.realpathSync(filePath);
|
|
6788
6810
|
const previous = files.get(real);
|
|
6789
6811
|
if (previous !== void 0) return previous;
|
|
6790
6812
|
const id = "peach-config-file:" + files.size;
|
|
6791
6813
|
files.set(real, id);
|
|
6792
6814
|
const compiled = compileReplacementModule({
|
|
6793
6815
|
filePath: real,
|
|
6794
|
-
source:
|
|
6816
|
+
source: import_node_fs30.default.readFileSync(real, "utf8"),
|
|
6795
6817
|
runtimePackages,
|
|
6796
6818
|
localModuleUrl: (specifier) => visit3(resolveReplacementModuleFile(real, specifier))
|
|
6797
6819
|
});
|
|
@@ -6815,7 +6837,7 @@ async function produceConfiguredBundle(source, config, runtimePackages) {
|
|
|
6815
6837
|
if (!entries || typeof entries !== "object") continue;
|
|
6816
6838
|
for (const resolution of Object.values(entries)) {
|
|
6817
6839
|
if (resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string") {
|
|
6818
|
-
resolution.file = visit3(
|
|
6840
|
+
resolution.file = visit3(import_node_path31.default.resolve(resolution.file));
|
|
6819
6841
|
}
|
|
6820
6842
|
}
|
|
6821
6843
|
}
|
|
@@ -6839,13 +6861,13 @@ async function produceConfiguredBundle(source, config, runtimePackages) {
|
|
|
6839
6861
|
const identityStart = findBundleFooter(source, "globalThis.__sootsimModulePaths=");
|
|
6840
6862
|
return prefix2 + (identityStart < 0 ? source + footer : source.slice(0, identityStart) + footer + source.slice(identityStart));
|
|
6841
6863
|
}
|
|
6842
|
-
var
|
|
6864
|
+
var import_node_fs30, import_node_path31, import_sucrase2, import_terser, PREFIX_START, PREFIX_END;
|
|
6843
6865
|
var init_configured_bundle_producer = __esm({
|
|
6844
6866
|
"src/configured-bundle-producer.ts"() {
|
|
6845
6867
|
"use strict";
|
|
6846
6868
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
6847
|
-
|
|
6848
|
-
|
|
6869
|
+
import_node_fs30 = __toESM(require("node:fs"), 1);
|
|
6870
|
+
import_node_path31 = __toESM(require("node:path"), 1);
|
|
6849
6871
|
init_bundle_global_footer();
|
|
6850
6872
|
import_sucrase2 = require("sucrase");
|
|
6851
6873
|
import_terser = require("terser");
|
|
@@ -6870,7 +6892,7 @@ module.exports = __toCommonJS(metro_plugin_exports);
|
|
|
6870
6892
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
6871
6893
|
var import_fs4 = __toESM(require("fs"), 1);
|
|
6872
6894
|
var import_module = require("module");
|
|
6873
|
-
var
|
|
6895
|
+
var import_node_crypto8 = require("node:crypto");
|
|
6874
6896
|
var import_path4 = __toESM(require("path"), 1);
|
|
6875
6897
|
|
|
6876
6898
|
// ../peach-globals/src/package-versions.ts
|
|
@@ -7223,7 +7245,7 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
7223
7245
|
var import_http = __toESM(require("http"), 1);
|
|
7224
7246
|
var import_https = __toESM(require("https"), 1);
|
|
7225
7247
|
var import_node_http2 = require("node:http2");
|
|
7226
|
-
var
|
|
7248
|
+
var import_promises6 = require("stream/promises");
|
|
7227
7249
|
init_backend_origin();
|
|
7228
7250
|
|
|
7229
7251
|
// src/host/dev-server-package-versions.ts
|
|
@@ -7245,16 +7267,981 @@ var import_url = require("url");
|
|
|
7245
7267
|
|
|
7246
7268
|
// ../contrast-runtime-delivery/src/index.ts
|
|
7247
7269
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
7270
|
+
var import_node_child_process5 = require("node:child_process");
|
|
7271
|
+
var import_node_crypto2 = __toESM(require("node:crypto"), 1);
|
|
7272
|
+
var import_node_fs9 = __toESM(require("node:fs"), 1);
|
|
7273
|
+
var import_node_os3 = __toESM(require("node:os"), 1);
|
|
7274
|
+
var import_node_path7 = __toESM(require("node:path"), 1);
|
|
7275
|
+
var import_node_stream2 = require("node:stream");
|
|
7276
|
+
var import_promises2 = require("node:stream/promises");
|
|
7277
|
+
var import_node_zlib = __toESM(require("node:zlib"), 1);
|
|
7248
7278
|
|
|
7249
7279
|
// src/process-group.ts
|
|
7250
7280
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
7281
|
+
var import_node_child_process4 = require("node:child_process");
|
|
7282
|
+
var import_node_fs7 = require("node:fs");
|
|
7283
|
+
var import_node_os2 = require("node:os");
|
|
7284
|
+
var import_node_path5 = require("node:path");
|
|
7285
|
+
var import_node_stream = require("node:stream");
|
|
7286
|
+
var import_promises = require("node:timers/promises");
|
|
7251
7287
|
|
|
7252
7288
|
// src/process-table.ts
|
|
7253
7289
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
7290
|
+
var import_node_child_process3 = require("node:child_process");
|
|
7291
|
+
var import_node_fs6 = require("node:fs");
|
|
7292
|
+
var import_node_os = require("node:os");
|
|
7293
|
+
function linuxClockTicks() {
|
|
7294
|
+
const auxv = (0, import_node_fs6.readFileSync)("/proc/self/auxv");
|
|
7295
|
+
const word = (offset) => (0, import_node_os.endianness)() === "LE" ? auxv.readBigUInt64LE(offset) : auxv.readBigUInt64BE(offset);
|
|
7296
|
+
for (let offset = 0; offset + 16 <= auxv.length; offset += 16) {
|
|
7297
|
+
if (word(offset) !== 17n) continue;
|
|
7298
|
+
const ticks = Number(word(offset + 8));
|
|
7299
|
+
if (!Number.isSafeInteger(ticks) || ticks <= 0)
|
|
7300
|
+
throw new Error("unreadable process clock tick rate");
|
|
7301
|
+
return ticks;
|
|
7302
|
+
}
|
|
7303
|
+
throw new Error("missing process clock tick rate");
|
|
7304
|
+
}
|
|
7305
|
+
var clockTicks;
|
|
7306
|
+
function readProcessTable(timeoutMs = 1e4, pid) {
|
|
7307
|
+
if (process.platform === "linux") {
|
|
7308
|
+
clockTicks ??= linuxClockTicks();
|
|
7309
|
+
const boot = /^btime (\d+)$/m.exec((0, import_node_fs6.readFileSync)("/proc/stat", "utf8"));
|
|
7310
|
+
if (!boot) throw new Error("unreadable process boot time");
|
|
7311
|
+
const bootMs = Number(boot[1]) * 1e3;
|
|
7312
|
+
const deadline = Date.now() + timeoutMs;
|
|
7313
|
+
const rows2 = [];
|
|
7314
|
+
const names = pid === void 0 ? (0, import_node_fs6.readdirSync)("/proc") : [String(pid)];
|
|
7315
|
+
for (const name2 of names) {
|
|
7316
|
+
if (!/^\d+$/.test(name2)) continue;
|
|
7317
|
+
if (Date.now() >= deadline)
|
|
7318
|
+
throw new Error("process inspection exceeded its deadline");
|
|
7319
|
+
let stat;
|
|
7320
|
+
try {
|
|
7321
|
+
stat = (0, import_node_fs6.readFileSync)(`/proc/${name2}/stat`, "utf8");
|
|
7322
|
+
} catch (error) {
|
|
7323
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") continue;
|
|
7324
|
+
throw error;
|
|
7325
|
+
}
|
|
7326
|
+
const fields = stat.slice(stat.lastIndexOf(")") + 2).trim().split(/\s+/);
|
|
7327
|
+
const pgid = Number(fields[2]);
|
|
7328
|
+
const ticks = Number(fields[19]);
|
|
7329
|
+
if (!fields[0] || !Number.isSafeInteger(pgid) || !Number.isSafeInteger(ticks))
|
|
7330
|
+
throw new Error(`unreadable process table row for ${name2}`);
|
|
7331
|
+
rows2.push({
|
|
7332
|
+
pid: Number(name2),
|
|
7333
|
+
pgid,
|
|
7334
|
+
zombie: fields[0] === "Z" || fields[0] === "X",
|
|
7335
|
+
start: bootMs + ticks * 1e3 / clockTicks
|
|
7336
|
+
});
|
|
7337
|
+
}
|
|
7338
|
+
return rows2;
|
|
7339
|
+
}
|
|
7340
|
+
const result = (0, import_node_child_process3.spawnSync)(
|
|
7341
|
+
"ps",
|
|
7342
|
+
[
|
|
7343
|
+
...pid === void 0 ? ["-A"] : ["-p", String(pid)],
|
|
7344
|
+
"-o",
|
|
7345
|
+
"pid=,pgid=,stat=,lstart="
|
|
7346
|
+
],
|
|
7347
|
+
{
|
|
7348
|
+
encoding: "utf8",
|
|
7349
|
+
env: { ...process.env, LC_ALL: "C", TZ: "UTC" },
|
|
7350
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
7351
|
+
timeout: timeoutMs,
|
|
7352
|
+
killSignal: "SIGKILL"
|
|
7353
|
+
}
|
|
7354
|
+
);
|
|
7355
|
+
if (!result.error && pid !== void 0 && result.status === 1 && !result.stdout.trim() && !result.stderr.trim())
|
|
7356
|
+
return [];
|
|
7357
|
+
if (result.error || result.status !== 0)
|
|
7358
|
+
throw new Error(
|
|
7359
|
+
result.error?.message || result.stderr.trim() || `ps exited ${result.status}`
|
|
7360
|
+
);
|
|
7361
|
+
const rows = result.stdout.split("\n").filter((line) => line.trim()).map((line) => {
|
|
7362
|
+
const match = /^\s*(\d+)\s+(\d+)\s+(\S+)\s+(.+?)\s*$/.exec(line);
|
|
7363
|
+
if (!match) throw new Error(`unreadable process table row: ${line}`);
|
|
7364
|
+
const start = Date.parse(`${match[4]} UTC`);
|
|
7365
|
+
if (Number.isNaN(start))
|
|
7366
|
+
throw new Error(`unreadable process start time "${match[4]}"`);
|
|
7367
|
+
return {
|
|
7368
|
+
pid: Number(match[1]),
|
|
7369
|
+
pgid: Number(match[2]),
|
|
7370
|
+
zombie: match[3].startsWith("Z"),
|
|
7371
|
+
start
|
|
7372
|
+
};
|
|
7373
|
+
});
|
|
7374
|
+
return pid === void 0 ? rows : rows.filter((row) => row.pid === pid);
|
|
7375
|
+
}
|
|
7376
|
+
|
|
7377
|
+
// src/process-group.ts
|
|
7378
|
+
var GRACEFUL_TIMEOUT_MS = 3e3;
|
|
7379
|
+
var FORCED_EXIT_TIMEOUT_MS = 1e3;
|
|
7380
|
+
var FREEZE_GUARD_NAME = "process-freeze-guard";
|
|
7381
|
+
function listProcessChildren(parents, timeoutMs = 3e3) {
|
|
7382
|
+
if (parents.some((pid) => !Number.isInteger(pid) || pid <= 1))
|
|
7383
|
+
throw new Error("process inspection requires valid parent pids");
|
|
7384
|
+
if (parents.length === 0) return [];
|
|
7385
|
+
const deadline = Date.now() + timeoutMs;
|
|
7386
|
+
let children;
|
|
7387
|
+
if (process.platform === "linux") {
|
|
7388
|
+
const lists = [];
|
|
7389
|
+
for (const parent of parents) {
|
|
7390
|
+
try {
|
|
7391
|
+
const tasks = `/proc/${parent}/task`;
|
|
7392
|
+
for (const thread of (0, import_node_fs7.readdirSync)(tasks)) {
|
|
7393
|
+
if (Date.now() >= deadline)
|
|
7394
|
+
throw new Error("process descendant inspection exceeded its deadline");
|
|
7395
|
+
try {
|
|
7396
|
+
lists.push((0, import_node_fs7.readFileSync)(`${tasks}/${thread}/children`, "utf8"));
|
|
7397
|
+
} catch (error) {
|
|
7398
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT"))
|
|
7399
|
+
throw error;
|
|
7400
|
+
}
|
|
7401
|
+
}
|
|
7402
|
+
} catch (error) {
|
|
7403
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT"))
|
|
7404
|
+
throw error;
|
|
7405
|
+
}
|
|
7406
|
+
}
|
|
7407
|
+
children = lists.join(" ");
|
|
7408
|
+
} else {
|
|
7409
|
+
const result = (0, import_node_child_process4.spawnSync)("pgrep", ["-P", parents.join(",")], {
|
|
7410
|
+
encoding: "utf8",
|
|
7411
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
7412
|
+
timeout: Math.max(1, timeoutMs),
|
|
7413
|
+
killSignal: "SIGKILL"
|
|
7414
|
+
});
|
|
7415
|
+
if (result.error || result.status !== 0 && result.status !== 1) {
|
|
7416
|
+
throw new Error(
|
|
7417
|
+
`could not inspect descendants of processes ${parents.join(",")}: ${result.error?.message || result.stderr.trim() || `pgrep exited ${result.status}`}`
|
|
7418
|
+
);
|
|
7419
|
+
}
|
|
7420
|
+
children = result.stdout;
|
|
7421
|
+
}
|
|
7422
|
+
return [...new Set(children.trim().split(/\s+/).map(Number))].filter(
|
|
7423
|
+
(pid) => Number.isInteger(pid) && pid > 1 && !parents.includes(pid)
|
|
7424
|
+
);
|
|
7425
|
+
}
|
|
7426
|
+
function signalProcessGroup(child, signal) {
|
|
7427
|
+
if (!child.pid) return;
|
|
7428
|
+
try {
|
|
7429
|
+
process.kill(-child.pid, signal);
|
|
7430
|
+
} catch {
|
|
7431
|
+
try {
|
|
7432
|
+
process.kill(child.pid, signal);
|
|
7433
|
+
} catch {
|
|
7434
|
+
}
|
|
7435
|
+
}
|
|
7436
|
+
}
|
|
7437
|
+
async function protectProcessFreeze(rootPid) {
|
|
7438
|
+
const directory = (0, import_node_fs7.mkdtempSync)((0, import_node_path5.join)((0, import_node_os2.tmpdir)(), "peach-process-freeze-"));
|
|
7439
|
+
const journal = (0, import_node_path5.join)(directory, "targets");
|
|
7440
|
+
(0, import_node_fs7.writeFileSync)(journal, `group ${rootPid}
|
|
7441
|
+
pid ${rootPid}
|
|
7442
|
+
`, { mode: 384 });
|
|
7443
|
+
const guard = (0, import_node_child_process4.spawn)(
|
|
7444
|
+
"/bin/sh",
|
|
7445
|
+
[
|
|
7446
|
+
"-c",
|
|
7447
|
+
`
|
|
7448
|
+
(
|
|
7449
|
+
journal=$1
|
|
7450
|
+
cleanup() {
|
|
7451
|
+
trap '' HUP INT TERM
|
|
7452
|
+
while read -r kind pid; do
|
|
7453
|
+
case $kind in
|
|
7454
|
+
group) target=-$pid ;;
|
|
7455
|
+
pid) target=$pid ;;
|
|
7456
|
+
*) continue ;;
|
|
7457
|
+
esac
|
|
7458
|
+
kill -TERM "$target" 2>/dev/null || :
|
|
7459
|
+
kill -CONT "$target" 2>/dev/null || :
|
|
7460
|
+
done < "$journal"
|
|
7461
|
+
}
|
|
7462
|
+
trap 'cleanup; exit 0' HUP INT TERM
|
|
7463
|
+
trap 'rm -f "$journal"; rmdir "\${journal%/*}"' EXIT
|
|
7464
|
+
printf 'ready
|
|
7465
|
+
'
|
|
7466
|
+
if ! IFS= read -r command <&3 || [ "$command" != disarm ]; then cleanup; fi
|
|
7467
|
+
) &
|
|
7468
|
+
`,
|
|
7469
|
+
FREEZE_GUARD_NAME,
|
|
7470
|
+
journal
|
|
7471
|
+
],
|
|
7472
|
+
{
|
|
7473
|
+
detached: true,
|
|
7474
|
+
// the launcher exits before capture, reparenting the guard outside any
|
|
7475
|
+
// nested target tree. fd 3 survives that exit, unlike child.stdin.
|
|
7476
|
+
stdio: ["ignore", "pipe", "ignore", "pipe"]
|
|
7477
|
+
}
|
|
7478
|
+
);
|
|
7479
|
+
let guardClosed = false;
|
|
7480
|
+
const closed = new Promise(
|
|
7481
|
+
(resolveClose) => guard.once("close", () => {
|
|
7482
|
+
guardClosed = true;
|
|
7483
|
+
resolveClose();
|
|
7484
|
+
})
|
|
7485
|
+
);
|
|
7486
|
+
const control = guard.stdio[3];
|
|
7487
|
+
const output2 = guard.stdout;
|
|
7488
|
+
if (!(control instanceof import_node_stream.Duplex) || !output2) {
|
|
7489
|
+
guard.kill();
|
|
7490
|
+
await closed;
|
|
7491
|
+
(0, import_node_fs7.rmSync)(directory, { recursive: true, force: true });
|
|
7492
|
+
throw new Error("process freeze guard control pipe is unavailable");
|
|
7493
|
+
}
|
|
7494
|
+
control.on("error", () => {
|
|
7495
|
+
});
|
|
7496
|
+
try {
|
|
7497
|
+
await new Promise((resolveReady, reject) => {
|
|
7498
|
+
let readyOutput = "";
|
|
7499
|
+
let launcherExited = false;
|
|
7500
|
+
const ready = () => {
|
|
7501
|
+
if (launcherExited && readyOutput.includes("ready\n")) resolveReady();
|
|
7502
|
+
};
|
|
7503
|
+
output2.on("data", (bytes) => {
|
|
7504
|
+
readyOutput += bytes.toString();
|
|
7505
|
+
ready();
|
|
7506
|
+
});
|
|
7507
|
+
guard.once("exit", (code, signal) => {
|
|
7508
|
+
if (code !== 0 || signal !== null) {
|
|
7509
|
+
reject(new Error("process freeze guard launcher failed"));
|
|
7510
|
+
return;
|
|
7511
|
+
}
|
|
7512
|
+
launcherExited = true;
|
|
7513
|
+
ready();
|
|
7514
|
+
});
|
|
7515
|
+
guard.once("error", reject);
|
|
7516
|
+
guard.once(
|
|
7517
|
+
"close",
|
|
7518
|
+
() => reject(new Error("process freeze guard exited before readiness"))
|
|
7519
|
+
);
|
|
7520
|
+
});
|
|
7521
|
+
} catch (error) {
|
|
7522
|
+
control.destroy();
|
|
7523
|
+
await closed;
|
|
7524
|
+
(0, import_node_fs7.rmSync)(directory, { recursive: true, force: true });
|
|
7525
|
+
throw error;
|
|
7526
|
+
}
|
|
7527
|
+
return {
|
|
7528
|
+
record(pid) {
|
|
7529
|
+
if (guardClosed || control.destroyed)
|
|
7530
|
+
throw new Error("process freeze guard exited during capture");
|
|
7531
|
+
(0, import_node_fs7.appendFileSync)(journal, `pid ${pid}
|
|
7532
|
+
`);
|
|
7533
|
+
},
|
|
7534
|
+
async release(disarm) {
|
|
7535
|
+
control.end(disarm ? "disarm\n" : void 0);
|
|
7536
|
+
await closed;
|
|
7537
|
+
(0, import_node_fs7.rmSync)(directory, { recursive: true, force: true });
|
|
7538
|
+
}
|
|
7539
|
+
};
|
|
7540
|
+
}
|
|
7541
|
+
function processesHaveExited(pids, pgid) {
|
|
7542
|
+
const mayExist = [-pgid, ...pids].some((target) => {
|
|
7543
|
+
try {
|
|
7544
|
+
process.kill(target, 0);
|
|
7545
|
+
return true;
|
|
7546
|
+
} catch (error) {
|
|
7547
|
+
return !(error instanceof Error && "code" in error && error.code === "ESRCH");
|
|
7548
|
+
}
|
|
7549
|
+
});
|
|
7550
|
+
if (!mayExist) return true;
|
|
7551
|
+
const knownPids = new Set(pids);
|
|
7552
|
+
try {
|
|
7553
|
+
return !readProcessTable(FORCED_EXIT_TIMEOUT_MS).some(
|
|
7554
|
+
(row) => (row.pgid === pgid || knownPids.has(row.pid)) && !row.zombie
|
|
7555
|
+
);
|
|
7556
|
+
} catch {
|
|
7557
|
+
return false;
|
|
7558
|
+
}
|
|
7559
|
+
}
|
|
7560
|
+
function groupIsEmpty(pgid) {
|
|
7561
|
+
return processesHaveExited([], pgid);
|
|
7562
|
+
}
|
|
7563
|
+
async function waitForExit(pids, pgid, timeoutMs) {
|
|
7564
|
+
const deadline = Date.now() + timeoutMs;
|
|
7565
|
+
const gone = () => processesHaveExited(pids, pgid);
|
|
7566
|
+
while (Date.now() < deadline) {
|
|
7567
|
+
if (gone()) return true;
|
|
7568
|
+
await (0, import_promises.setTimeout)(50);
|
|
7569
|
+
}
|
|
7570
|
+
return gone();
|
|
7571
|
+
}
|
|
7572
|
+
async function terminateProcessGroup(child, signal = "SIGTERM", gracefulTimeoutMs = GRACEFUL_TIMEOUT_MS) {
|
|
7573
|
+
if (!child.pid) {
|
|
7574
|
+
try {
|
|
7575
|
+
child.kill(signal);
|
|
7576
|
+
} catch {
|
|
7577
|
+
}
|
|
7578
|
+
return;
|
|
7579
|
+
}
|
|
7580
|
+
if (child.exitCode !== null || child.signalCode !== null) {
|
|
7581
|
+
if (groupIsEmpty(child.pid)) return;
|
|
7582
|
+
}
|
|
7583
|
+
const freeze = await protectProcessFreeze(child.pid);
|
|
7584
|
+
const descendants = /* @__PURE__ */ new Set();
|
|
7585
|
+
let inspectionError = null;
|
|
7586
|
+
let signaled = false;
|
|
7587
|
+
let gracefulDeadline = 0;
|
|
7588
|
+
try {
|
|
7589
|
+
signalProcessGroup(child, "SIGSTOP");
|
|
7590
|
+
let parents = [child.pid];
|
|
7591
|
+
const inspectionDeadline = Date.now() + GRACEFUL_TIMEOUT_MS;
|
|
7592
|
+
while (parents.length > 0) {
|
|
7593
|
+
const remaining = inspectionDeadline - Date.now();
|
|
7594
|
+
if (remaining <= 0) {
|
|
7595
|
+
inspectionError = new Error("process descendant inspection exceeded its deadline");
|
|
7596
|
+
break;
|
|
7597
|
+
}
|
|
7598
|
+
let children;
|
|
7599
|
+
try {
|
|
7600
|
+
children = listProcessChildren(parents, remaining);
|
|
7601
|
+
} catch (error) {
|
|
7602
|
+
inspectionError = new Error(`could not inspect descendants: ${String(error)}`);
|
|
7603
|
+
break;
|
|
7604
|
+
}
|
|
7605
|
+
const next = [];
|
|
7606
|
+
for (const descendantPid of children) {
|
|
7607
|
+
if (!descendants.has(descendantPid)) {
|
|
7608
|
+
freeze.record(descendantPid);
|
|
7609
|
+
descendants.add(descendantPid);
|
|
7610
|
+
next.push(descendantPid);
|
|
7611
|
+
try {
|
|
7612
|
+
process.kill(descendantPid, "SIGSTOP");
|
|
7613
|
+
} catch {
|
|
7614
|
+
}
|
|
7615
|
+
}
|
|
7616
|
+
}
|
|
7617
|
+
parents = next;
|
|
7618
|
+
}
|
|
7619
|
+
gracefulDeadline = Date.now() + gracefulTimeoutMs;
|
|
7620
|
+
try {
|
|
7621
|
+
process.kill(child.pid, signal);
|
|
7622
|
+
} catch {
|
|
7623
|
+
}
|
|
7624
|
+
signaled = true;
|
|
7625
|
+
} finally {
|
|
7626
|
+
signalProcessGroup(child, "SIGCONT");
|
|
7627
|
+
for (const pid of descendants) {
|
|
7628
|
+
try {
|
|
7629
|
+
process.kill(pid, "SIGCONT");
|
|
7630
|
+
} catch {
|
|
7631
|
+
}
|
|
7632
|
+
}
|
|
7633
|
+
await freeze.release(signaled);
|
|
7634
|
+
}
|
|
7635
|
+
const pids = [child.pid, ...descendants];
|
|
7636
|
+
let rootExited = child.exitCode !== null || child.signalCode !== null;
|
|
7637
|
+
if (!rootExited) {
|
|
7638
|
+
rootExited = await new Promise((resolveExit) => {
|
|
7639
|
+
const onExit = () => {
|
|
7640
|
+
clearTimeout(deadlineTimer);
|
|
7641
|
+
resolveExit(true);
|
|
7642
|
+
};
|
|
7643
|
+
const deadlineTimer = setTimeout(
|
|
7644
|
+
() => {
|
|
7645
|
+
child.removeListener("exit", onExit);
|
|
7646
|
+
resolveExit(false);
|
|
7647
|
+
},
|
|
7648
|
+
Math.max(0, gracefulDeadline - Date.now())
|
|
7649
|
+
);
|
|
7650
|
+
child.once("exit", onExit);
|
|
7651
|
+
if (child.exitCode !== null || child.signalCode !== null) {
|
|
7652
|
+
child.removeListener("exit", onExit);
|
|
7653
|
+
onExit();
|
|
7654
|
+
}
|
|
7655
|
+
});
|
|
7656
|
+
}
|
|
7657
|
+
if (rootExited) {
|
|
7658
|
+
signalProcessGroup(child, signal);
|
|
7659
|
+
for (const pid of descendants) {
|
|
7660
|
+
try {
|
|
7661
|
+
process.kill(pid, signal);
|
|
7662
|
+
} catch {
|
|
7663
|
+
}
|
|
7664
|
+
}
|
|
7665
|
+
}
|
|
7666
|
+
if (await waitForExit(pids, child.pid, Math.max(0, gracefulDeadline - Date.now()))) {
|
|
7667
|
+
if (inspectionError) throw inspectionError;
|
|
7668
|
+
return;
|
|
7669
|
+
}
|
|
7670
|
+
for (const pid of pids) {
|
|
7671
|
+
try {
|
|
7672
|
+
process.kill(pid, "SIGKILL");
|
|
7673
|
+
} catch {
|
|
7674
|
+
}
|
|
7675
|
+
}
|
|
7676
|
+
signalProcessGroup(child, "SIGKILL");
|
|
7677
|
+
const gone = await waitForExit(pids, child.pid, FORCED_EXIT_TIMEOUT_MS);
|
|
7678
|
+
if (!gone) {
|
|
7679
|
+
const survivors = new Error(
|
|
7680
|
+
`process group ${child.pid} exit could not be confirmed after SIGKILL`
|
|
7681
|
+
);
|
|
7682
|
+
if (!inspectionError) throw survivors;
|
|
7683
|
+
throw new Error(`${inspectionError.message}; ${survivors.message}`);
|
|
7684
|
+
}
|
|
7685
|
+
if (inspectionError) throw inspectionError;
|
|
7686
|
+
}
|
|
7254
7687
|
|
|
7255
7688
|
// ../contrast-runtime-delivery/src/product.ts
|
|
7256
7689
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
7690
|
+
var import_node_fs8 = __toESM(require("node:fs"), 1);
|
|
7691
|
+
var import_node_path6 = __toESM(require("node:path"), 1);
|
|
7257
7692
|
init_version();
|
|
7693
|
+
function listInstalledRuntimes(product) {
|
|
7694
|
+
try {
|
|
7695
|
+
return import_node_fs8.default.readdirSync(product.runtimesDir(), { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name).sort(compareSemver);
|
|
7696
|
+
} catch {
|
|
7697
|
+
return [];
|
|
7698
|
+
}
|
|
7699
|
+
}
|
|
7700
|
+
function runtimeTarballCacheName(product, version) {
|
|
7701
|
+
return import_node_path6.default.posix.basename(product.tarballPath(version));
|
|
7702
|
+
}
|
|
7703
|
+
function compareSemver(a, b) {
|
|
7704
|
+
const parse8 = (v6) => {
|
|
7705
|
+
const hyphen = v6.indexOf("-");
|
|
7706
|
+
const core = hyphen >= 0 ? v6.slice(0, hyphen) : v6;
|
|
7707
|
+
const pre = hyphen >= 0 ? v6.slice(hyphen + 1) : "";
|
|
7708
|
+
const parts = core.split(".").map((n) => Number.parseInt(n, 10));
|
|
7709
|
+
if (parts.some((n) => !Number.isFinite(n))) return [[Number.POSITIVE_INFINITY], v6];
|
|
7710
|
+
return [parts, pre];
|
|
7711
|
+
};
|
|
7712
|
+
const [an, ap] = parse8(a);
|
|
7713
|
+
const [bn, bp] = parse8(b);
|
|
7714
|
+
for (let i = 0; i < Math.max(an.length, bn.length); i++) {
|
|
7715
|
+
const av = an[i] ?? 0;
|
|
7716
|
+
const bv = bn[i] ?? 0;
|
|
7717
|
+
if (av !== bv) return av - bv;
|
|
7718
|
+
}
|
|
7719
|
+
if (ap === bp) return 0;
|
|
7720
|
+
if (!ap) return 1;
|
|
7721
|
+
if (!bp) return -1;
|
|
7722
|
+
return ap < bp ? -1 : 1;
|
|
7723
|
+
}
|
|
7724
|
+
|
|
7725
|
+
// ../contrast-runtime-delivery/src/packs.ts
|
|
7726
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
7727
|
+
var RUNTIME_PACKS_FILE = "packs.json";
|
|
7728
|
+
var RUNTIME_PACK_MARKER = ".pack";
|
|
7729
|
+
var RUNTIME_PACK_PREFIXES = [
|
|
7730
|
+
"engine/fonts/emoji/",
|
|
7731
|
+
"engine/fonts/lang/",
|
|
7732
|
+
"engine/fonts/named/",
|
|
7733
|
+
"engine/fonts/vector-icons/",
|
|
7734
|
+
"engine/fonts/webview/",
|
|
7735
|
+
"engine/kotlin/",
|
|
7736
|
+
"engine/material-symbols/",
|
|
7737
|
+
"engine/pdfjs/",
|
|
7738
|
+
"three-mode/"
|
|
7739
|
+
];
|
|
7740
|
+
var RUNTIME_MERGE_PACK_DIR = "engine-tenant/";
|
|
7741
|
+
var RUNTIME_MERGE_PACK_INSTALL = ".pack-prod";
|
|
7742
|
+
var RUNTIME_MERGE_PACK_MERGED = ".merged";
|
|
7743
|
+
|
|
7744
|
+
// ../contrast-runtime-delivery/src/index.ts
|
|
7745
|
+
var DEFAULT_LOCAL_RUNTIME_RETENTION_COUNT = 2;
|
|
7746
|
+
function createRuntimeDelivery(product) {
|
|
7747
|
+
function readConfig() {
|
|
7748
|
+
try {
|
|
7749
|
+
const parsed = JSON.parse(
|
|
7750
|
+
import_node_fs9.default.readFileSync(product.configFile(), "utf8")
|
|
7751
|
+
);
|
|
7752
|
+
return parsed && typeof parsed === "object" ? parsed : {};
|
|
7753
|
+
} catch {
|
|
7754
|
+
return {};
|
|
7755
|
+
}
|
|
7756
|
+
}
|
|
7757
|
+
function resolveCdnOrigin(input) {
|
|
7758
|
+
const config = readConfig();
|
|
7759
|
+
const value = input || process.env[product.env.cdnOrigin] || config.cdnOrigin || product.defaultCdnOrigin;
|
|
7760
|
+
return value.replace(/\/+$/, "");
|
|
7761
|
+
}
|
|
7762
|
+
function resolveChannel(input) {
|
|
7763
|
+
const config = readConfig();
|
|
7764
|
+
return input || process.env[product.env.channel] || config.runtimeChannel || product.defaultChannel || "stable";
|
|
7765
|
+
}
|
|
7766
|
+
function resolvePin() {
|
|
7767
|
+
if (!product.env.pin) return null;
|
|
7768
|
+
const env = process.env[product.env.pin];
|
|
7769
|
+
if (env && env.trim()) return env.trim();
|
|
7770
|
+
const config = readConfig();
|
|
7771
|
+
return typeof config.runtimeVersion === "string" && config.runtimeVersion.trim() ? config.runtimeVersion.trim() : null;
|
|
7772
|
+
}
|
|
7773
|
+
function manifestUrl(cdnOrigin) {
|
|
7774
|
+
const url = new URL(`${resolveCdnOrigin(cdnOrigin)}${product.manifestPath}`);
|
|
7775
|
+
url.searchParams.set("t", String(Date.now()));
|
|
7776
|
+
return url.toString();
|
|
7777
|
+
}
|
|
7778
|
+
function tarballUrl(version, cdnOrigin) {
|
|
7779
|
+
return `${resolveCdnOrigin(cdnOrigin)}${product.tarballPath(version)}`;
|
|
7780
|
+
}
|
|
7781
|
+
const UP_TO_DATE_CHECK_TIMEOUT_MS = 2e3;
|
|
7782
|
+
async function fetchManifest(cdnOrigin, timeoutMs) {
|
|
7783
|
+
const url = manifestUrl(cdnOrigin);
|
|
7784
|
+
const res = await fetch(url, {
|
|
7785
|
+
headers: { Accept: "application/json" },
|
|
7786
|
+
// an install is allowed to wait; a best-effort check is not. see
|
|
7787
|
+
// UP_TO_DATE_CHECK_TIMEOUT_MS.
|
|
7788
|
+
...timeoutMs ? { signal: AbortSignal.timeout(timeoutMs) } : {}
|
|
7789
|
+
});
|
|
7790
|
+
if (!res.ok) {
|
|
7791
|
+
throw new Error(`manifest fetch failed: ${res.status} ${res.statusText} (${url})`);
|
|
7792
|
+
}
|
|
7793
|
+
return await res.json();
|
|
7794
|
+
}
|
|
7795
|
+
function resolveVersion(manifest, opts = {}) {
|
|
7796
|
+
const channel = resolveChannel(opts.channel);
|
|
7797
|
+
const version = opts.version || resolvePin() || manifest.channels[channel]?.latest;
|
|
7798
|
+
if (!version) {
|
|
7799
|
+
throw new Error(
|
|
7800
|
+
`no version specified and channel '${channel}' has no latest entry in the manifest`
|
|
7801
|
+
);
|
|
7802
|
+
}
|
|
7803
|
+
if (!isValidRuntimeVersion(version)) {
|
|
7804
|
+
throw new Error(`invalid runtime version: ${version}`);
|
|
7805
|
+
}
|
|
7806
|
+
const entry = manifest.versions[version];
|
|
7807
|
+
if (!entry) {
|
|
7808
|
+
throw new Error(
|
|
7809
|
+
`version ${version} not found in manifest; available: ${Object.keys(manifest.versions).slice(-10).join(", ") || "(none)"}`
|
|
7810
|
+
);
|
|
7811
|
+
}
|
|
7812
|
+
return { version, channel, entry };
|
|
7813
|
+
}
|
|
7814
|
+
async function isVerifiedInstall(dir) {
|
|
7815
|
+
if (!import_node_fs9.default.existsSync(import_node_path7.default.join(dir, product.installedMarker))) return false;
|
|
7816
|
+
try {
|
|
7817
|
+
await product.verifyInstall?.(dir);
|
|
7818
|
+
return true;
|
|
7819
|
+
} catch {
|
|
7820
|
+
return false;
|
|
7821
|
+
}
|
|
7822
|
+
}
|
|
7823
|
+
async function install(opts = {}) {
|
|
7824
|
+
product.ensureHome();
|
|
7825
|
+
const cdnOrigin = resolveCdnOrigin(opts.cdnOrigin);
|
|
7826
|
+
const manifest = await fetchManifest(cdnOrigin);
|
|
7827
|
+
const { version, channel, entry } = resolveVersion(manifest, opts);
|
|
7828
|
+
const destDir = product.runtimeDir(version);
|
|
7829
|
+
const setActive = opts.setActive !== false;
|
|
7830
|
+
const protectVersions = [version, ...opts.protectVersions ?? []];
|
|
7831
|
+
pruneLocalRetention({ protectVersions });
|
|
7832
|
+
if (!opts.force && await isVerifiedInstall(destDir)) {
|
|
7833
|
+
if (setActive) product.writeActiveRuntime(version);
|
|
7834
|
+
pruneLocalRetention({ protectVersions });
|
|
7835
|
+
return {
|
|
7836
|
+
version,
|
|
7837
|
+
channel,
|
|
7838
|
+
cdnOrigin,
|
|
7839
|
+
runtimeDir: destDir,
|
|
7840
|
+
installed: false,
|
|
7841
|
+
activated: setActive,
|
|
7842
|
+
manifest
|
|
7843
|
+
};
|
|
7844
|
+
}
|
|
7845
|
+
if (!opts.quiet)
|
|
7846
|
+
process.stderr.write(`${product.id}: downloading runtime ${version}\u2026
|
|
7847
|
+
`);
|
|
7848
|
+
await installVerifiedTarball({
|
|
7849
|
+
url: entry.tarball || tarballUrl(version, cdnOrigin),
|
|
7850
|
+
digest: { algorithm: "sha256", encoding: "hex", value: entry.sha256 },
|
|
7851
|
+
destDir,
|
|
7852
|
+
installedMarker: product.installedMarker,
|
|
7853
|
+
verify: product.verifyInstall,
|
|
7854
|
+
label: `runtime ${version}`
|
|
7855
|
+
});
|
|
7856
|
+
if (setActive) product.writeActiveRuntime(version);
|
|
7857
|
+
pruneLocalRetention({ protectVersions });
|
|
7858
|
+
return {
|
|
7859
|
+
version,
|
|
7860
|
+
channel,
|
|
7861
|
+
cdnOrigin,
|
|
7862
|
+
runtimeDir: destDir,
|
|
7863
|
+
installed: true,
|
|
7864
|
+
activated: setActive,
|
|
7865
|
+
manifest
|
|
7866
|
+
};
|
|
7867
|
+
}
|
|
7868
|
+
async function updateToLatest(opts = {}) {
|
|
7869
|
+
product.ensureHome();
|
|
7870
|
+
pruneLocalRetention({ protectVersions: opts.protectVersions });
|
|
7871
|
+
const cdnOrigin = resolveCdnOrigin(opts.cdnOrigin);
|
|
7872
|
+
const channel = resolveChannel(opts.channel);
|
|
7873
|
+
const pin = resolvePin();
|
|
7874
|
+
if (pin) {
|
|
7875
|
+
const activeVersion2 = product.readActiveRuntime();
|
|
7876
|
+
const pinInstalled = await isVerifiedInstall(product.runtimeDir(pin));
|
|
7877
|
+
if (activeVersion2 === pin && pinInstalled) {
|
|
7878
|
+
return {
|
|
7879
|
+
checked: true,
|
|
7880
|
+
updated: false,
|
|
7881
|
+
reason: `runtime is pinned to ${pin}`,
|
|
7882
|
+
activeVersion: activeVersion2,
|
|
7883
|
+
latestVersion: pin
|
|
7884
|
+
};
|
|
7885
|
+
}
|
|
7886
|
+
const installed2 = await install({
|
|
7887
|
+
version: pin,
|
|
7888
|
+
channel,
|
|
7889
|
+
cdnOrigin,
|
|
7890
|
+
setActive: false,
|
|
7891
|
+
protectVersions: opts.protectVersions
|
|
7892
|
+
});
|
|
7893
|
+
return {
|
|
7894
|
+
checked: true,
|
|
7895
|
+
updated: true,
|
|
7896
|
+
reason: `runtime is pinned to ${pin}`,
|
|
7897
|
+
activeVersion: pin,
|
|
7898
|
+
latestVersion: pin,
|
|
7899
|
+
install: installed2
|
|
7900
|
+
};
|
|
7901
|
+
}
|
|
7902
|
+
const manifest = await fetchManifest(cdnOrigin);
|
|
7903
|
+
const latestVersion = manifest.channels[channel]?.latest;
|
|
7904
|
+
if (!latestVersion) {
|
|
7905
|
+
return {
|
|
7906
|
+
checked: true,
|
|
7907
|
+
updated: false,
|
|
7908
|
+
reason: `channel '${channel}' has no latest runtime`,
|
|
7909
|
+
activeVersion: product.readActiveRuntime()
|
|
7910
|
+
};
|
|
7911
|
+
}
|
|
7912
|
+
const entry = manifest.versions[latestVersion];
|
|
7913
|
+
if (!entry) {
|
|
7914
|
+
return {
|
|
7915
|
+
checked: true,
|
|
7916
|
+
updated: false,
|
|
7917
|
+
reason: `manifest is missing version ${latestVersion}`,
|
|
7918
|
+
activeVersion: product.readActiveRuntime(),
|
|
7919
|
+
latestVersion
|
|
7920
|
+
};
|
|
7921
|
+
}
|
|
7922
|
+
const activeVersion = product.readActiveRuntime();
|
|
7923
|
+
const activeDir = activeVersion ? product.runtimeDir(activeVersion) : null;
|
|
7924
|
+
const activeInstalled = activeDir ? await isVerifiedInstall(activeDir) : false;
|
|
7925
|
+
const shouldInstall = !activeVersion || !activeInstalled || compareSemver(latestVersion, activeVersion) > 0;
|
|
7926
|
+
if (!shouldInstall) {
|
|
7927
|
+
return {
|
|
7928
|
+
checked: true,
|
|
7929
|
+
updated: false,
|
|
7930
|
+
reason: "active runtime is current",
|
|
7931
|
+
activeVersion,
|
|
7932
|
+
latestVersion
|
|
7933
|
+
};
|
|
7934
|
+
}
|
|
7935
|
+
const installed = await install({
|
|
7936
|
+
version: latestVersion,
|
|
7937
|
+
channel,
|
|
7938
|
+
cdnOrigin,
|
|
7939
|
+
setActive: false,
|
|
7940
|
+
protectVersions: opts.protectVersions
|
|
7941
|
+
});
|
|
7942
|
+
return {
|
|
7943
|
+
checked: true,
|
|
7944
|
+
updated: true,
|
|
7945
|
+
activeVersion: latestVersion,
|
|
7946
|
+
latestVersion,
|
|
7947
|
+
install: installed
|
|
7948
|
+
};
|
|
7949
|
+
}
|
|
7950
|
+
async function checkUpToDate(opts = {}) {
|
|
7951
|
+
const active = product.readActiveRuntime();
|
|
7952
|
+
const pinned = resolvePin();
|
|
7953
|
+
if (pinned) {
|
|
7954
|
+
return { active, latest: pinned, pinned, outdated: active !== pinned };
|
|
7955
|
+
}
|
|
7956
|
+
try {
|
|
7957
|
+
const manifest = await fetchManifest(
|
|
7958
|
+
resolveCdnOrigin(opts.cdnOrigin),
|
|
7959
|
+
UP_TO_DATE_CHECK_TIMEOUT_MS
|
|
7960
|
+
);
|
|
7961
|
+
const channel = resolveChannel(opts.channel);
|
|
7962
|
+
const latest = manifest.channels[channel]?.latest ?? null;
|
|
7963
|
+
const outdated = !!(latest && (!active || compareSemver(latest, active) > 0));
|
|
7964
|
+
return { active, latest, pinned: null, outdated };
|
|
7965
|
+
} catch {
|
|
7966
|
+
return { active, latest: null, pinned: null, outdated: false };
|
|
7967
|
+
}
|
|
7968
|
+
}
|
|
7969
|
+
function planLocalRetention(opts = {}) {
|
|
7970
|
+
product.ensureHome();
|
|
7971
|
+
const retainVersions = Math.max(
|
|
7972
|
+
1,
|
|
7973
|
+
Math.floor(opts.retainVersions ?? DEFAULT_LOCAL_RUNTIME_RETENTION_COUNT)
|
|
7974
|
+
);
|
|
7975
|
+
const installed = listInstalledRuntimes(product);
|
|
7976
|
+
const installedSet = new Set(installed);
|
|
7977
|
+
const activeVersion = product.readActiveRuntime();
|
|
7978
|
+
const pinnedVersion = resolvePin();
|
|
7979
|
+
const keep = /* @__PURE__ */ new Set();
|
|
7980
|
+
for (const version of [
|
|
7981
|
+
activeVersion,
|
|
7982
|
+
pinnedVersion,
|
|
7983
|
+
...opts.protectVersions ?? []
|
|
7984
|
+
]) {
|
|
7985
|
+
if (version && installedSet.has(version)) keep.add(version);
|
|
7986
|
+
}
|
|
7987
|
+
for (const version of [...installed].reverse()) {
|
|
7988
|
+
if (keep.size >= retainVersions) break;
|
|
7989
|
+
keep.add(version);
|
|
7990
|
+
}
|
|
7991
|
+
const cacheTemplateMarker = "__RUNTIME_VERSION__";
|
|
7992
|
+
const cacheTemplate = runtimeTarballCacheName(product, cacheTemplateMarker);
|
|
7993
|
+
const markerOffset = cacheTemplate.indexOf(cacheTemplateMarker);
|
|
7994
|
+
const cachePrefix = cacheTemplate.slice(0, markerOffset);
|
|
7995
|
+
const cacheSuffix = cacheTemplate.slice(markerOffset + cacheTemplateMarker.length);
|
|
7996
|
+
let removeCacheFiles = [];
|
|
7997
|
+
if (markerOffset >= 0) {
|
|
7998
|
+
try {
|
|
7999
|
+
removeCacheFiles = import_node_fs9.default.readdirSync(product.cacheDir(), { withFileTypes: true }).filter((entry) => {
|
|
8000
|
+
if (!entry.isFile()) return false;
|
|
8001
|
+
const complete = entry.name.startsWith(cachePrefix) && entry.name.endsWith(cacheSuffix);
|
|
8002
|
+
const partial = entry.name.startsWith(cachePrefix) && entry.name.endsWith(`${cacheSuffix}.partial`);
|
|
8003
|
+
return complete || partial;
|
|
8004
|
+
}).map((entry) => import_node_path7.default.join(product.cacheDir(), entry.name)).sort();
|
|
8005
|
+
} catch {
|
|
8006
|
+
}
|
|
8007
|
+
}
|
|
8008
|
+
return {
|
|
8009
|
+
activeVersion,
|
|
8010
|
+
pinnedVersion,
|
|
8011
|
+
keepVersions: installed.filter((version) => keep.has(version)),
|
|
8012
|
+
removeVersions: installed.filter((version) => !keep.has(version)),
|
|
8013
|
+
removeCacheFiles
|
|
8014
|
+
};
|
|
8015
|
+
}
|
|
8016
|
+
function pruneLocalRetention(opts = {}) {
|
|
8017
|
+
const plan = planLocalRetention(opts);
|
|
8018
|
+
for (const version of plan.removeVersions) {
|
|
8019
|
+
import_node_fs9.default.rmSync(product.runtimeDir(version), { recursive: true, force: true });
|
|
8020
|
+
}
|
|
8021
|
+
for (const cacheFile of plan.removeCacheFiles) {
|
|
8022
|
+
import_node_fs9.default.rmSync(cacheFile, { force: true });
|
|
8023
|
+
}
|
|
8024
|
+
return plan;
|
|
8025
|
+
}
|
|
8026
|
+
return {
|
|
8027
|
+
product,
|
|
8028
|
+
resolveCdnOrigin,
|
|
8029
|
+
resolveChannel,
|
|
8030
|
+
resolvePin,
|
|
8031
|
+
manifestUrl,
|
|
8032
|
+
tarballUrl,
|
|
8033
|
+
fetchManifest,
|
|
8034
|
+
resolveVersion,
|
|
8035
|
+
install,
|
|
8036
|
+
updateToLatest,
|
|
8037
|
+
checkUpToDate,
|
|
8038
|
+
planLocalRetention,
|
|
8039
|
+
pruneLocalRetention,
|
|
8040
|
+
listInstalled: () => listInstalledRuntimes(product)
|
|
8041
|
+
};
|
|
8042
|
+
}
|
|
8043
|
+
async function installVerifiedTarball(tarball) {
|
|
8044
|
+
const { destDir, installedMarker, signal } = tarball;
|
|
8045
|
+
import_node_fs9.default.mkdirSync(import_node_path7.default.dirname(destDir), { recursive: true });
|
|
8046
|
+
const presentAtStart = import_node_fs9.default.existsSync(import_node_path7.default.join(destDir, installedMarker));
|
|
8047
|
+
const lock = `${destDir}.lock`;
|
|
8048
|
+
for (; ; ) {
|
|
8049
|
+
signal?.throwIfAborted();
|
|
8050
|
+
try {
|
|
8051
|
+
import_node_fs9.default.writeFileSync(lock, String(process.pid), { flag: "wx" });
|
|
8052
|
+
break;
|
|
8053
|
+
} catch (err) {
|
|
8054
|
+
if (!isErrnoCode(err, "EEXIST")) throw err;
|
|
8055
|
+
if (lockOwnerGone(lock)) import_node_fs9.default.rmSync(lock, { force: true });
|
|
8056
|
+
else await new Promise((resolve4) => setTimeout(resolve4, 250));
|
|
8057
|
+
}
|
|
8058
|
+
}
|
|
8059
|
+
try {
|
|
8060
|
+
if (!presentAtStart && import_node_fs9.default.existsSync(import_node_path7.default.join(destDir, installedMarker))) {
|
|
8061
|
+
await tarball.verify?.(destDir);
|
|
8062
|
+
return;
|
|
8063
|
+
}
|
|
8064
|
+
await installVerifiedTarballLocked(tarball, presentAtStart);
|
|
8065
|
+
} finally {
|
|
8066
|
+
import_node_fs9.default.rmSync(lock, { force: true });
|
|
8067
|
+
}
|
|
8068
|
+
}
|
|
8069
|
+
function lockOwnerGone(lock) {
|
|
8070
|
+
try {
|
|
8071
|
+
process.kill(Number(import_node_fs9.default.readFileSync(lock, "utf8")), 0);
|
|
8072
|
+
return false;
|
|
8073
|
+
} catch (err) {
|
|
8074
|
+
return !isErrnoCode(err, "EPERM", "ENOENT");
|
|
8075
|
+
}
|
|
8076
|
+
}
|
|
8077
|
+
async function installVerifiedTarballLocked(tarball, presentAtStart) {
|
|
8078
|
+
const { url, digest, destDir, installedMarker, label, signal } = tarball;
|
|
8079
|
+
signal?.throwIfAborted();
|
|
8080
|
+
const downloadDir = import_node_fs9.default.mkdtempSync(import_node_path7.default.join(import_node_os3.default.tmpdir(), "runtime-delivery-download-"));
|
|
8081
|
+
const archivePath = import_node_path7.default.join(downloadDir, "archive");
|
|
8082
|
+
const tmpDir = import_node_fs9.default.mkdtempSync(
|
|
8083
|
+
import_node_path7.default.join(import_node_path7.default.dirname(destDir), `.installing-${import_node_path7.default.basename(destDir)}-`)
|
|
8084
|
+
);
|
|
8085
|
+
try {
|
|
8086
|
+
await downloadToFile(url, archivePath, signal);
|
|
8087
|
+
const actual = await digestFile(
|
|
8088
|
+
archivePath,
|
|
8089
|
+
digest.algorithm,
|
|
8090
|
+
digest.encoding,
|
|
8091
|
+
signal
|
|
8092
|
+
);
|
|
8093
|
+
if (actual !== digest.value) {
|
|
8094
|
+
throw new Error(
|
|
8095
|
+
`${digest.algorithm} mismatch for ${label}: expected ${digest.value}, actual ${actual}`
|
|
8096
|
+
);
|
|
8097
|
+
}
|
|
8098
|
+
const { pathname } = new URL(url);
|
|
8099
|
+
if (pathname.endsWith(".zip")) await extractZip(archivePath, tmpDir, signal);
|
|
8100
|
+
else
|
|
8101
|
+
await extractTarball(
|
|
8102
|
+
archivePath,
|
|
8103
|
+
pathname.endsWith(".tar.zst"),
|
|
8104
|
+
tmpDir,
|
|
8105
|
+
tarball.stripComponents ?? 0,
|
|
8106
|
+
signal
|
|
8107
|
+
);
|
|
8108
|
+
signal?.throwIfAborted();
|
|
8109
|
+
if (!import_node_fs9.default.existsSync(import_node_path7.default.join(tmpDir, installedMarker))) {
|
|
8110
|
+
throw new Error(`extracted tarball for ${label} is missing ${installedMarker}`);
|
|
8111
|
+
}
|
|
8112
|
+
await tarball.verify?.(tmpDir);
|
|
8113
|
+
signal?.throwIfAborted();
|
|
8114
|
+
try {
|
|
8115
|
+
import_node_fs9.default.renameSync(tmpDir, destDir);
|
|
8116
|
+
} catch (err) {
|
|
8117
|
+
if (!isErrnoCode(err, "ENOTEMPTY", "EEXIST")) throw err;
|
|
8118
|
+
if (!presentAtStart && import_node_fs9.default.existsSync(import_node_path7.default.join(destDir, installedMarker))) {
|
|
8119
|
+
await tarball.verify?.(destDir);
|
|
8120
|
+
return;
|
|
8121
|
+
}
|
|
8122
|
+
const aside = `${tmpDir}-replaced`;
|
|
8123
|
+
try {
|
|
8124
|
+
import_node_fs9.default.renameSync(destDir, aside);
|
|
8125
|
+
} catch (moveErr) {
|
|
8126
|
+
if (!isErrnoCode(moveErr, "ENOENT")) throw moveErr;
|
|
8127
|
+
}
|
|
8128
|
+
try {
|
|
8129
|
+
import_node_fs9.default.renameSync(tmpDir, destDir);
|
|
8130
|
+
} catch (landErr) {
|
|
8131
|
+
if (!isErrnoCode(landErr, "ENOTEMPTY", "EEXIST") || !import_node_fs9.default.existsSync(import_node_path7.default.join(destDir, installedMarker))) {
|
|
8132
|
+
throw landErr;
|
|
8133
|
+
}
|
|
8134
|
+
await tarball.verify?.(destDir);
|
|
8135
|
+
} finally {
|
|
8136
|
+
import_node_fs9.default.rmSync(aside, { recursive: true, force: true });
|
|
8137
|
+
}
|
|
8138
|
+
}
|
|
8139
|
+
} finally {
|
|
8140
|
+
import_node_fs9.default.rmSync(tmpDir, { recursive: true, force: true });
|
|
8141
|
+
import_node_fs9.default.rmSync(downloadDir, { recursive: true, force: true });
|
|
8142
|
+
}
|
|
8143
|
+
}
|
|
8144
|
+
function isErrnoCode(err, ...codes) {
|
|
8145
|
+
return err instanceof Error && "code" in err && codes.includes(String(err.code));
|
|
8146
|
+
}
|
|
8147
|
+
async function downloadToFile(url, destPath, signal) {
|
|
8148
|
+
const res = await fetch(url, { signal });
|
|
8149
|
+
if (!res.ok || !res.body) {
|
|
8150
|
+
throw new Error(`download failed: ${res.status} ${res.statusText} (${url})`);
|
|
8151
|
+
}
|
|
8152
|
+
import_node_fs9.default.mkdirSync(import_node_path7.default.dirname(destPath), { recursive: true });
|
|
8153
|
+
const tmp = `${destPath}.partial`;
|
|
8154
|
+
try {
|
|
8155
|
+
await (0, import_promises2.pipeline)(
|
|
8156
|
+
import_node_stream2.Readable.fromWeb(res.body),
|
|
8157
|
+
import_node_fs9.default.createWriteStream(tmp),
|
|
8158
|
+
{ signal }
|
|
8159
|
+
);
|
|
8160
|
+
signal?.throwIfAborted();
|
|
8161
|
+
import_node_fs9.default.renameSync(tmp, destPath);
|
|
8162
|
+
} catch (err) {
|
|
8163
|
+
try {
|
|
8164
|
+
import_node_fs9.default.unlinkSync(tmp);
|
|
8165
|
+
} catch {
|
|
8166
|
+
}
|
|
8167
|
+
throw err;
|
|
8168
|
+
}
|
|
8169
|
+
}
|
|
8170
|
+
async function digestFile(filePath, algorithm, encoding, signal) {
|
|
8171
|
+
const hash = import_node_crypto2.default.createHash(algorithm);
|
|
8172
|
+
await (0, import_promises2.pipeline)(import_node_fs9.default.createReadStream(filePath), hash, { signal });
|
|
8173
|
+
return hash.digest(encoding);
|
|
8174
|
+
}
|
|
8175
|
+
function extractZip(zipPath, destDir, signal) {
|
|
8176
|
+
return runExtractor("ditto", ["-x", "-k", zipPath, destDir], signal);
|
|
8177
|
+
}
|
|
8178
|
+
async function extractTarball(tarPath, zstd, destDir, stripComponents, signal) {
|
|
8179
|
+
const args = [zstd ? "-xf" : "-xzf", "-"];
|
|
8180
|
+
if (stripComponents > 0) args.push(`--strip-components=${stripComponents}`);
|
|
8181
|
+
if (zstd) {
|
|
8182
|
+
const decoder = import_node_zlib.default.createZstdDecompress({
|
|
8183
|
+
params: { [import_node_zlib.default.constants.ZSTD_d_windowLogMax]: 30 }
|
|
8184
|
+
});
|
|
8185
|
+
await runExtractor("tar", args, signal, {
|
|
8186
|
+
cwd: destDir,
|
|
8187
|
+
stdin: (stdin) => (0, import_promises2.pipeline)(import_node_fs9.default.createReadStream(tarPath), decoder, stdin, { signal })
|
|
8188
|
+
});
|
|
8189
|
+
return;
|
|
8190
|
+
}
|
|
8191
|
+
const archive = import_node_fs9.default.openSync(tarPath, "r");
|
|
8192
|
+
try {
|
|
8193
|
+
await runExtractor("tar", args, signal, { cwd: destDir, stdin: archive });
|
|
8194
|
+
} finally {
|
|
8195
|
+
import_node_fs9.default.closeSync(archive);
|
|
8196
|
+
}
|
|
8197
|
+
}
|
|
8198
|
+
async function runExtractor(command, args, signal, input) {
|
|
8199
|
+
signal?.throwIfAborted();
|
|
8200
|
+
const stdin = input?.stdin;
|
|
8201
|
+
const stdio = [
|
|
8202
|
+
typeof stdin === "function" ? "pipe" : stdin ?? "ignore",
|
|
8203
|
+
"inherit",
|
|
8204
|
+
"inherit"
|
|
8205
|
+
];
|
|
8206
|
+
const child = (0, import_node_child_process5.spawn)(command, args, {
|
|
8207
|
+
cwd: input?.cwd,
|
|
8208
|
+
stdio,
|
|
8209
|
+
detached: process.platform !== "win32"
|
|
8210
|
+
});
|
|
8211
|
+
const fed = typeof stdin === "function" && child.stdin ? stdin(child.stdin) : void 0;
|
|
8212
|
+
void fed?.catch(() => {
|
|
8213
|
+
});
|
|
8214
|
+
let stopping;
|
|
8215
|
+
const abort = () => {
|
|
8216
|
+
stopping ??= terminateProcessGroup(child, "SIGKILL", 0);
|
|
8217
|
+
void stopping.catch(() => {
|
|
8218
|
+
});
|
|
8219
|
+
};
|
|
8220
|
+
try {
|
|
8221
|
+
await new Promise((resolve4, reject) => {
|
|
8222
|
+
let failure;
|
|
8223
|
+
child.on("error", (error) => {
|
|
8224
|
+
failure = error;
|
|
8225
|
+
});
|
|
8226
|
+
child.on("close", (code) => {
|
|
8227
|
+
if (signal?.aborted) {
|
|
8228
|
+
const reason = signal.reason;
|
|
8229
|
+
reject(
|
|
8230
|
+
reason instanceof Error ? reason : new Error("Extraction canceled", { cause: reason })
|
|
8231
|
+
);
|
|
8232
|
+
} else if (failure) reject(failure);
|
|
8233
|
+
else if (code === 0) resolve4();
|
|
8234
|
+
else reject(new Error(`${command} exited with code ${code}`));
|
|
8235
|
+
});
|
|
8236
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
8237
|
+
if (signal?.aborted) abort();
|
|
8238
|
+
});
|
|
8239
|
+
await fed;
|
|
8240
|
+
} finally {
|
|
8241
|
+
signal?.removeEventListener("abort", abort);
|
|
8242
|
+
await stopping;
|
|
8243
|
+
}
|
|
8244
|
+
}
|
|
7258
8245
|
|
|
7259
8246
|
// src/runtime-assets.ts
|
|
7260
8247
|
init_home_paths();
|
|
@@ -7320,7 +8307,6 @@ var ROOT_RUNTIME_PATHS = [
|
|
|
7320
8307
|
"/fonts/",
|
|
7321
8308
|
"/icons/",
|
|
7322
8309
|
"/sounds/",
|
|
7323
|
-
"/spike/",
|
|
7324
8310
|
"/test-wallpaper.jpg",
|
|
7325
8311
|
"/preview-sw.js",
|
|
7326
8312
|
"/preview/guest-bridge-host.js",
|
|
@@ -7471,10 +8457,10 @@ function peachRuntimeRoot() {
|
|
|
7471
8457
|
|
|
7472
8458
|
// src/expo-autolinking.ts
|
|
7473
8459
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
7474
|
-
var
|
|
8460
|
+
var import_node_child_process6 = require("node:child_process");
|
|
7475
8461
|
var import_node_util3 = require("node:util");
|
|
7476
8462
|
init_forked_script_contract();
|
|
7477
|
-
var run3 = (0, import_node_util3.promisify)(
|
|
8463
|
+
var run3 = (0, import_node_util3.promisify)(import_node_child_process6.execFile);
|
|
7478
8464
|
|
|
7479
8465
|
// src/expo-native-prebuilt.ts
|
|
7480
8466
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -7491,21 +8477,21 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
7491
8477
|
|
|
7492
8478
|
// src/swift-objc-sdk-tree.ts
|
|
7493
8479
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
7494
|
-
var
|
|
7495
|
-
var
|
|
8480
|
+
var import_node_fs11 = require("node:fs");
|
|
8481
|
+
var import_node_path9 = __toESM(require("node:path"), 1);
|
|
7496
8482
|
function readIosSdkTree(root) {
|
|
7497
|
-
return (0,
|
|
7498
|
-
const file =
|
|
8483
|
+
return (0, import_node_fs11.readdirSync)(root, { recursive: true, withFileTypes: true }).filter((entry) => entry.isFile()).map((entry) => {
|
|
8484
|
+
const file = import_node_path9.default.join(entry.parentPath, entry.name);
|
|
7499
8485
|
return [
|
|
7500
|
-
|
|
7501
|
-
(0,
|
|
8486
|
+
import_node_path9.default.relative(root, file).split(import_node_path9.default.sep).join("/"),
|
|
8487
|
+
(0, import_node_fs11.readFileSync)(file, "utf8")
|
|
7502
8488
|
];
|
|
7503
8489
|
}).sort(([a], [b]) => a < b ? -1 : 1);
|
|
7504
8490
|
}
|
|
7505
8491
|
|
|
7506
8492
|
// src/swift-standin-digest.ts
|
|
7507
8493
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
7508
|
-
var STANDIN_SOURCE_DIGEST = true ? "
|
|
8494
|
+
var STANDIN_SOURCE_DIGEST = true ? "f077081111b09ca27482cd53be422dae6cd1bd3a5fd2b2bdef48a83a9c0d6ca8" : standinSourceDigest();
|
|
7509
8495
|
|
|
7510
8496
|
// src/expo-native-workspace.ts
|
|
7511
8497
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -7549,10 +8535,10 @@ init_is_record();
|
|
|
7549
8535
|
|
|
7550
8536
|
// src/native-firebase-config.ts
|
|
7551
8537
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
7552
|
-
var
|
|
7553
|
-
var
|
|
7554
|
-
var
|
|
7555
|
-
var
|
|
8538
|
+
var import_node_child_process10 = require("node:child_process");
|
|
8539
|
+
var import_node_fs19 = __toESM(require("node:fs"), 1);
|
|
8540
|
+
var import_node_os5 = __toESM(require("node:os"), 1);
|
|
8541
|
+
var import_node_path19 = __toESM(require("node:path"), 1);
|
|
7556
8542
|
init_is_record();
|
|
7557
8543
|
|
|
7558
8544
|
// src/plist.ts
|
|
@@ -7564,10 +8550,10 @@ function parsePlistSource(source) {
|
|
|
7564
8550
|
|
|
7565
8551
|
// src/xcode-project.ts
|
|
7566
8552
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
7567
|
-
var
|
|
7568
|
-
var
|
|
7569
|
-
var
|
|
7570
|
-
var
|
|
8553
|
+
var import_node_child_process9 = require("node:child_process");
|
|
8554
|
+
var import_node_crypto6 = require("node:crypto");
|
|
8555
|
+
var import_node_fs18 = __toESM(require("node:fs"), 1);
|
|
8556
|
+
var import_node_path18 = __toESM(require("node:path"), 1);
|
|
7571
8557
|
var import_plist2 = __toESM(require("plist"), 1);
|
|
7572
8558
|
init_is_record();
|
|
7573
8559
|
|
|
@@ -7918,7 +8904,7 @@ function parseOpenStepPlist(text2) {
|
|
|
7918
8904
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
7919
8905
|
var NEVER_MEMBER = /(?:^|\/)(?:Info\.plist|[^/]+\.entitlements|[^/]+\.xcconfig|\.DS_Store)$/;
|
|
7920
8906
|
var BUNDLE_DIR = /\.(xcassets|bundle|lproj|xcdatamodeld|scnassets|spriteatlas|rcproject|storyboardc|icon)$/;
|
|
7921
|
-
function xcodePathResolver(objects, projectDir,
|
|
8907
|
+
function xcodePathResolver(objects, projectDir, join8, sourceTreeRoot) {
|
|
7922
8908
|
const parents = /* @__PURE__ */ new Map();
|
|
7923
8909
|
for (const [id, entry] of Object.entries(objects)) {
|
|
7924
8910
|
if (!isDict(entry)) continue;
|
|
@@ -7936,14 +8922,14 @@ function xcodePathResolver(objects, projectDir, join7, sourceTreeRoot) {
|
|
|
7936
8922
|
const own = str(entry.path) ?? "";
|
|
7937
8923
|
const tree2 = str(entry.sourceTree) ?? "<group>";
|
|
7938
8924
|
if (tree2 === "<absolute>") result = own;
|
|
7939
|
-
else if (tree2 === "SOURCE_ROOT") result =
|
|
8925
|
+
else if (tree2 === "SOURCE_ROOT") result = join8(projectDir, own);
|
|
7940
8926
|
else if (tree2 === "<group>") {
|
|
7941
8927
|
const parent = parents.get(id);
|
|
7942
8928
|
const base = parent ? resolve4(parent) : projectDir;
|
|
7943
|
-
if (base !== null) result =
|
|
8929
|
+
if (base !== null) result = join8(base, own);
|
|
7944
8930
|
} else {
|
|
7945
8931
|
const base = sourceTreeRoot?.(tree2);
|
|
7946
|
-
if (base) result =
|
|
8932
|
+
if (base) result = join8(base, own);
|
|
7947
8933
|
}
|
|
7948
8934
|
}
|
|
7949
8935
|
paths.set(id, result);
|
|
@@ -7965,7 +8951,7 @@ function xcodeTargetMemberVisitor(objects) {
|
|
|
7965
8951
|
if (isDict(group) && group.isa === "PBXFileSystemSynchronizedRootGroup")
|
|
7966
8952
|
synchronizedGroups.push({ id, group });
|
|
7967
8953
|
}
|
|
7968
|
-
return (targetId, resolvePath, filesUnder,
|
|
8954
|
+
return (targetId, resolvePath, filesUnder, join8, visit3) => {
|
|
7969
8955
|
const target = objects[targetId];
|
|
7970
8956
|
if (!isDict(target)) return;
|
|
7971
8957
|
for (const phaseId of list(target.buildPhases)) {
|
|
@@ -8000,7 +8986,7 @@ function xcodeTargetMemberVisitor(objects) {
|
|
|
8000
8986
|
for (const relative3 of list(exception.membershipExceptions))
|
|
8001
8987
|
exceptions.add(relative3);
|
|
8002
8988
|
}
|
|
8003
|
-
const members = owned.has(groupId) ? filesUnder(folder) : [...exceptions].flatMap((relative3) => filesUnder(
|
|
8989
|
+
const members = owned.has(groupId) ? filesUnder(folder) : [...exceptions].flatMap((relative3) => filesUnder(join8(folder, relative3)));
|
|
8004
8990
|
for (const file of members) {
|
|
8005
8991
|
const relative3 = file.slice(prefix2.length);
|
|
8006
8992
|
const excepted = [...exceptions].some(
|
|
@@ -8170,10 +9156,10 @@ function appTargetReleaseSettings(pbxproj, targetName, infoPlistRelativePath) {
|
|
|
8170
9156
|
var APP_DELEGATE_PATH_RE = /(?:^|\/)(?:ios\/)?([^/]+)\/AppDelegate\.(?:swift|mm|m)$/;
|
|
8171
9157
|
function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri) {
|
|
8172
9158
|
const pbxprojPath = Object.keys(files).find(
|
|
8173
|
-
(
|
|
9159
|
+
(path29) => /(?:^|\/)ios\/[^/]+\.xcodeproj\/project\.pbxproj$/.test(path29)
|
|
8174
9160
|
) ?? Object.keys(files).find(
|
|
8175
|
-
(
|
|
8176
|
-
) ?? Object.keys(files).find((
|
|
9161
|
+
(path29) => /(?:^|\/)[^/]+\.xcodeproj\/project\.pbxproj$/.test(path29)
|
|
9162
|
+
) ?? Object.keys(files).find((path29) => /(?:^|\/)project\.pbxproj$/.test(path29));
|
|
8177
9163
|
if (!pbxprojPath) return null;
|
|
8178
9164
|
const pbxproj = files[pbxprojPath];
|
|
8179
9165
|
let objects = {};
|
|
@@ -8215,7 +9201,7 @@ function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri)
|
|
|
8215
9201
|
} else if (applicationTargetNames.size === 1) {
|
|
8216
9202
|
targetName = [...applicationTargetNames][0];
|
|
8217
9203
|
} else if (applicationTargetNames.size > 1) {
|
|
8218
|
-
const delegateTargets = Object.keys(files).filter((
|
|
9204
|
+
const delegateTargets = Object.keys(files).filter((path29) => !path29.includes("/Pods/")).map((path29) => path29.match(APP_DELEGATE_PATH_RE)?.[1]).filter(
|
|
8219
9205
|
(name2) => typeof name2 === "string" && applicationTargetNames.has(name2)
|
|
8220
9206
|
);
|
|
8221
9207
|
if (delegateTargets.length === 1) {
|
|
@@ -8431,7 +9417,7 @@ function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri)
|
|
|
8431
9417
|
if (resourceUri) {
|
|
8432
9418
|
if (!selectedTarget)
|
|
8433
9419
|
throw new Error("native app icon target membership is unresolved");
|
|
8434
|
-
const
|
|
9420
|
+
const join8 = (base, own) => {
|
|
8435
9421
|
const segments = [];
|
|
8436
9422
|
for (const segment of `${base}/${own}`.split("/")) {
|
|
8437
9423
|
if (segment === "" || segment === ".") continue;
|
|
@@ -8444,22 +9430,22 @@ function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri)
|
|
|
8444
9430
|
const project = Object.values(objects).find(
|
|
8445
9431
|
(object4) => isRecord(object4) && object4.isa === "PBXProject"
|
|
8446
9432
|
);
|
|
8447
|
-
const projectDir =
|
|
9433
|
+
const projectDir = join8(
|
|
8448
9434
|
pbxprojPath.replace(/(?:^|\/)[^/]+\.xcodeproj\/project\.pbxproj$/, ""),
|
|
8449
9435
|
isRecord(project) && typeof project.projectDirPath === "string" ? project.projectDirPath : ""
|
|
8450
9436
|
);
|
|
8451
9437
|
const paths = Object.keys(files);
|
|
8452
9438
|
xcodeTargetMemberVisitor(objects)(
|
|
8453
9439
|
selectedTarget.id,
|
|
8454
|
-
xcodePathResolver(objects, projectDir,
|
|
9440
|
+
xcodePathResolver(objects, projectDir, join8),
|
|
8455
9441
|
(file) => {
|
|
8456
9442
|
if (Object.hasOwn(files, file)) return [file];
|
|
8457
9443
|
const prefix2 = file === "" ? "" : `${file.replace(/\/$/, "")}/`;
|
|
8458
9444
|
return paths.filter(
|
|
8459
|
-
(
|
|
9445
|
+
(path29) => path29.startsWith(prefix2) && !/(?:^|\/)\./.test(path29.slice(prefix2.length))
|
|
8460
9446
|
);
|
|
8461
9447
|
},
|
|
8462
|
-
|
|
9448
|
+
join8,
|
|
8463
9449
|
(file, kind) => {
|
|
8464
9450
|
if (kind === "resource") resources.add(file);
|
|
8465
9451
|
}
|
|
@@ -8467,7 +9453,7 @@ function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri)
|
|
|
8467
9453
|
}
|
|
8468
9454
|
const rootModuleName = readRootModuleName(
|
|
8469
9455
|
Object.entries(files).filter(
|
|
8470
|
-
([
|
|
9456
|
+
([path29]) => !path29.includes("/Pods/") && (/(?:^|\/)(?:ios\/)?AppDelegate\.(?:swift|mm|m)$/.test(path29) || path29.match(APP_DELEGATE_PATH_RE)?.[1] === targetName)
|
|
8471
9457
|
).map(([, source]) => source)
|
|
8472
9458
|
);
|
|
8473
9459
|
return {
|
|
@@ -8560,26 +9546,26 @@ function extractNativeAppIdentityFromFiles(files, platform, parseInfoPlist, iosT
|
|
|
8560
9546
|
|
|
8561
9547
|
// src/prepared-xcode-phases.ts
|
|
8562
9548
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
8563
|
-
var
|
|
8564
|
-
var
|
|
8565
|
-
var
|
|
9549
|
+
var import_node_crypto3 = require("node:crypto");
|
|
9550
|
+
var import_node_fs14 = __toESM(require("node:fs"), 1);
|
|
9551
|
+
var import_node_path11 = __toESM(require("node:path"), 1);
|
|
8566
9552
|
var workspaces = /* @__PURE__ */ new Map();
|
|
8567
9553
|
var recording;
|
|
8568
9554
|
function relativeFile(root, file) {
|
|
8569
|
-
const relative3 =
|
|
8570
|
-
if (!relative3 || relative3 === ".." || relative3.startsWith(`..${
|
|
9555
|
+
const relative3 = import_node_path11.default.relative(root, file);
|
|
9556
|
+
if (!relative3 || relative3 === ".." || relative3.startsWith(`..${import_node_path11.default.sep}`) || import_node_path11.default.isAbsolute(relative3))
|
|
8571
9557
|
throw new Error(`prepared Xcode output is outside its workspace: ${file}`);
|
|
8572
|
-
return relative3.split(
|
|
9558
|
+
return relative3.split(import_node_path11.default.sep).join("/");
|
|
8573
9559
|
}
|
|
8574
9560
|
function output(root, file) {
|
|
8575
9561
|
const relative3 = relativeFile(root, file);
|
|
8576
|
-
const stat =
|
|
9562
|
+
const stat = import_node_fs14.default.statSync(file, { throwIfNoEntry: false });
|
|
8577
9563
|
if (!stat) return { path: relative3, sha256: null };
|
|
8578
9564
|
if (!stat.isFile()) throw new Error(`prepared Xcode output is not a file: ${file}`);
|
|
8579
|
-
relativeFile(root,
|
|
8580
|
-
const bytes =
|
|
9565
|
+
relativeFile(root, import_node_fs14.default.realpathSync(file));
|
|
9566
|
+
const bytes = import_node_fs14.default.readFileSync(file);
|
|
8581
9567
|
const prefix2 = Buffer.from(root);
|
|
8582
|
-
const hash = (0,
|
|
9568
|
+
const hash = (0, import_node_crypto3.createHash)("sha256");
|
|
8583
9569
|
let offset = 0;
|
|
8584
9570
|
for (let index = bytes.indexOf(prefix2); index !== -1; index = bytes.indexOf(prefix2, offset)) {
|
|
8585
9571
|
hash.update(bytes.subarray(offset, index)).update("\0workspace\0");
|
|
@@ -8593,8 +9579,8 @@ function output(root, file) {
|
|
|
8593
9579
|
}
|
|
8594
9580
|
function preparedXcodePhase(project, target, phase, configuration, outputs, recorded) {
|
|
8595
9581
|
const root = recording?.root ?? [...workspaces.keys()].find((root2) => {
|
|
8596
|
-
const relative3 =
|
|
8597
|
-
return relative3 !== ".." && !relative3.startsWith(`..${
|
|
9582
|
+
const relative3 = import_node_path11.default.relative(root2, project);
|
|
9583
|
+
return relative3 !== ".." && !relative3.startsWith(`..${import_node_path11.default.sep}`) && !import_node_path11.default.isAbsolute(relative3);
|
|
8598
9584
|
});
|
|
8599
9585
|
if (!root) return false;
|
|
8600
9586
|
const entry = {
|
|
@@ -8630,8 +9616,8 @@ function preparedXcodePhase(project, target, phase, configuration, outputs, reco
|
|
|
8630
9616
|
|
|
8631
9617
|
// src/swift-binary-modules.ts
|
|
8632
9618
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
8633
|
-
var
|
|
8634
|
-
var
|
|
9619
|
+
var import_node_fs15 = __toESM(require("node:fs"), 1);
|
|
9620
|
+
var import_node_path12 = __toESM(require("node:path"), 1);
|
|
8635
9621
|
init_home_paths();
|
|
8636
9622
|
|
|
8637
9623
|
// src/swift-package.ts
|
|
@@ -8676,7 +9662,7 @@ function moduleMapName(text2) {
|
|
|
8676
9662
|
}
|
|
8677
9663
|
|
|
8678
9664
|
// src/swift-binary-modules.ts
|
|
8679
|
-
var cacheDir2 =
|
|
9665
|
+
var cacheDir2 = import_node_path12.default.join(cacheDir(), "swift-binary-modules");
|
|
8680
9666
|
function frameworkModules(paths) {
|
|
8681
9667
|
const modules = /* @__PURE__ */ new Set();
|
|
8682
9668
|
for (const file of paths) {
|
|
@@ -8686,21 +9672,21 @@ function frameworkModules(paths) {
|
|
|
8686
9672
|
return [...modules].sort();
|
|
8687
9673
|
}
|
|
8688
9674
|
function localSwiftBinaryModules(dir) {
|
|
8689
|
-
if (!
|
|
8690
|
-
const slices =
|
|
9675
|
+
if (!import_node_fs15.default.existsSync(dir)) return [];
|
|
9676
|
+
const slices = import_node_fs15.default.readdirSync(dir, { withFileTypes: true }).filter((slice) => slice.isDirectory());
|
|
8691
9677
|
const frameworks = frameworkModules(
|
|
8692
9678
|
slices.flatMap(
|
|
8693
|
-
(slice) =>
|
|
9679
|
+
(slice) => import_node_fs15.default.readdirSync(import_node_path12.default.join(dir, slice.name)).map((entry) => `${slice.name}/${entry}`)
|
|
8694
9680
|
)
|
|
8695
9681
|
);
|
|
8696
9682
|
if (frameworks.length > 0) return frameworks;
|
|
8697
9683
|
const modules = /* @__PURE__ */ new Set();
|
|
8698
9684
|
for (const slice of slices) {
|
|
8699
|
-
const headers =
|
|
8700
|
-
if (!
|
|
8701
|
-
for (const file of
|
|
8702
|
-
if (
|
|
8703
|
-
const module2 = moduleMapName(
|
|
9685
|
+
const headers = import_node_path12.default.join(dir, slice.name, "Headers");
|
|
9686
|
+
if (!import_node_fs15.default.existsSync(headers)) continue;
|
|
9687
|
+
for (const file of import_node_fs15.default.readdirSync(headers, { recursive: true, encoding: "utf8" })) {
|
|
9688
|
+
if (import_node_path12.default.basename(file) !== "module.modulemap") continue;
|
|
9689
|
+
const module2 = moduleMapName(import_node_fs15.default.readFileSync(import_node_path12.default.join(headers, file), "utf8"));
|
|
8704
9690
|
if (module2) modules.add(module2);
|
|
8705
9691
|
}
|
|
8706
9692
|
}
|
|
@@ -8712,9 +9698,9 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
8712
9698
|
|
|
8713
9699
|
// src/swift-coverage/provenance.ts
|
|
8714
9700
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
8715
|
-
var
|
|
8716
|
-
var
|
|
8717
|
-
var
|
|
9701
|
+
var import_node_crypto4 = require("node:crypto");
|
|
9702
|
+
var import_node_fs16 = require("node:fs");
|
|
9703
|
+
var import_node_path13 = require("node:path");
|
|
8718
9704
|
var SWIFT_COVERAGE_DIGEST_SOURCES = [
|
|
8719
9705
|
"swift-coverage/indexdump.ts",
|
|
8720
9706
|
"swift-coverage/indexing.ts",
|
|
@@ -8744,11 +9730,11 @@ function swiftCoverageSourceDigests(srcDir) {
|
|
|
8744
9730
|
return Object.fromEntries(
|
|
8745
9731
|
SWIFT_COVERAGE_DIGEST_SOURCES.map((file) => [
|
|
8746
9732
|
file,
|
|
8747
|
-
(0,
|
|
9733
|
+
(0, import_node_crypto4.createHash)("sha256").update((0, import_node_fs16.readFileSync)((0, import_node_path13.join)(srcDir, file))).digest("hex")
|
|
8748
9734
|
])
|
|
8749
9735
|
);
|
|
8750
9736
|
}
|
|
8751
|
-
var swiftCoverageProvenance = typeof define_SWIFT_COVERAGE_SOURCE_DIGESTS_default === "object" ? define_SWIFT_COVERAGE_SOURCE_DIGESTS_default : swiftCoverageSourceDigests((0,
|
|
9737
|
+
var swiftCoverageProvenance = typeof define_SWIFT_COVERAGE_SOURCE_DIGESTS_default === "object" ? define_SWIFT_COVERAGE_SOURCE_DIGESTS_default : swiftCoverageSourceDigests((0, import_node_path13.join)(__sootsim_import_meta_dirname, ".."));
|
|
8752
9738
|
|
|
8753
9739
|
// src/swift-coverage/xcode-asset-symbols.ts
|
|
8754
9740
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -8934,8 +9920,8 @@ var assetSymbolSettingKeys = [
|
|
|
8934
9920
|
|
|
8935
9921
|
// src/swift-package-manifest.ts
|
|
8936
9922
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
8937
|
-
var
|
|
8938
|
-
var
|
|
9923
|
+
var import_node_child_process8 = require("node:child_process");
|
|
9924
|
+
var import_node_path16 = __toESM(require("node:path"), 1);
|
|
8939
9925
|
var import_node_util5 = require("node:util");
|
|
8940
9926
|
init_home_paths();
|
|
8941
9927
|
|
|
@@ -8971,12 +9957,12 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
8971
9957
|
|
|
8972
9958
|
// src/swift-toolchain.ts
|
|
8973
9959
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
8974
|
-
var
|
|
8975
|
-
var
|
|
9960
|
+
var import_node_fs17 = __toESM(require("node:fs"), 1);
|
|
9961
|
+
var import_node_path14 = __toESM(require("node:path"), 1);
|
|
8976
9962
|
function peachsimPackageRoot() {
|
|
8977
9963
|
let dir = __sootsim_import_meta_dirname;
|
|
8978
|
-
while (!
|
|
8979
|
-
dir =
|
|
9964
|
+
while (!import_node_fs17.default.existsSync(import_node_path14.default.join(dir, "package.json")) && dir !== import_node_path14.default.dirname(dir))
|
|
9965
|
+
dir = import_node_path14.default.dirname(dir);
|
|
8980
9966
|
return dir;
|
|
8981
9967
|
}
|
|
8982
9968
|
var SWIFT_HOST_COMPILER_RELEASE = "swift-6.4.0-RELEASE-custom-81b2c791c27276bf";
|
|
@@ -9205,7 +10191,7 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
9205
10191
|
|
|
9206
10192
|
// src/swift-objc-standin.ts
|
|
9207
10193
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
9208
|
-
var
|
|
10194
|
+
var import_node_crypto5 = require("node:crypto");
|
|
9209
10195
|
init_is_record();
|
|
9210
10196
|
|
|
9211
10197
|
// src/swift-interface-bodies.ts
|
|
@@ -9213,10 +10199,10 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
9213
10199
|
|
|
9214
10200
|
// src/swift-objc-sdk.ts
|
|
9215
10201
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
9216
|
-
var
|
|
10202
|
+
var import_node_path15 = __toESM(require("node:path"), 1);
|
|
9217
10203
|
var IOS_SDK_TARGET = "arm64-apple-ios16.0-simulator";
|
|
9218
10204
|
var OVERLAY_PATH = /^usr\/lib\/swift\/([^/]+)\.swiftmodule\/arm64-apple-ios-simulator\.swiftinterface$/;
|
|
9219
|
-
var tree = typeof __PEACH_BUNDLED_IOS_SDK__ === "undefined" ? readIosSdkTree(
|
|
10205
|
+
var tree = typeof __PEACH_BUNDLED_IOS_SDK__ === "undefined" ? readIosSdkTree(import_node_path15.default.join(peachsimPackageRoot(), "sdk", "ios")) : Object.entries(__PEACH_BUNDLED_IOS_SDK__).sort(([a], [b]) => a < b ? -1 : 1);
|
|
9220
10206
|
var IOS_SDK_HEADERS = {};
|
|
9221
10207
|
var IOS_SDK_OVERLAYS = {};
|
|
9222
10208
|
for (const [file, text2] of tree) {
|
|
@@ -9251,7 +10237,7 @@ var NATIVE_GRAPH_INPUTS = {
|
|
|
9251
10237
|
compiler: "Apple Swift version 6.4 (swiftlang-6.4.0.34.1 clang-2100.3.34.1)",
|
|
9252
10238
|
target: IOS_SDK_TARGET
|
|
9253
10239
|
};
|
|
9254
|
-
var NATIVE_GRAPH_ID = (0,
|
|
10240
|
+
var NATIVE_GRAPH_ID = (0, import_node_crypto5.createHash)("sha256").update(JSON.stringify(NATIVE_GRAPH_INPUTS)).digest("hex");
|
|
9255
10241
|
|
|
9256
10242
|
// src/swift-shared-sdk.ts
|
|
9257
10243
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -9502,9 +10488,9 @@ var WASM_OPTIMIZE_IDENTITY = `wasm-opt ${import_wasm_opt.BINARYEN_VERSION} -Oz $
|
|
|
9502
10488
|
|
|
9503
10489
|
// src/swift-icu.ts
|
|
9504
10490
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
9505
|
-
var
|
|
10491
|
+
var import_node_child_process7 = require("node:child_process");
|
|
9506
10492
|
var import_node_util4 = require("node:util");
|
|
9507
|
-
var
|
|
10493
|
+
var import_node_zlib2 = require("node:zlib");
|
|
9508
10494
|
|
|
9509
10495
|
// ../sootsim-swift/src/icuData.ts
|
|
9510
10496
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -9518,10 +10504,10 @@ var VERSION = 1;
|
|
|
9518
10504
|
var SWIFT_ICU_PACKED = `picu${VERSION}`;
|
|
9519
10505
|
|
|
9520
10506
|
// src/swift-icu.ts
|
|
9521
|
-
var run4 = (0, import_node_util4.promisify)(
|
|
9522
|
-
var deflate = (0, import_node_util4.promisify)(
|
|
9523
|
-
var compressBrotli = (0, import_node_util4.promisify)(
|
|
9524
|
-
var inflateGzip = (0, import_node_util4.promisify)(
|
|
10507
|
+
var run4 = (0, import_node_util4.promisify)(import_node_child_process7.execFile);
|
|
10508
|
+
var deflate = (0, import_node_util4.promisify)(import_node_zlib2.gzip);
|
|
10509
|
+
var compressBrotli = (0, import_node_util4.promisify)(import_node_zlib2.brotliCompress);
|
|
10510
|
+
var inflateGzip = (0, import_node_util4.promisify)(import_node_zlib2.gunzip);
|
|
9525
10511
|
|
|
9526
10512
|
// src/swift-link-roots.ts
|
|
9527
10513
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -9624,7 +10610,7 @@ var FOUNDATION_IMPLICIT_MODULES = [
|
|
|
9624
10610
|
var FOUNDATION_IMPLICIT_FLAGS = FOUNDATION_IMPLICIT_MODULES.map(
|
|
9625
10611
|
(module2) => `, "-Xfrontend", "-import-module", "-Xfrontend", "${module2}"`
|
|
9626
10612
|
).join("");
|
|
9627
|
-
var compilerSourceDigest = true ? "
|
|
10613
|
+
var compilerSourceDigest = true ? "4646bbe2e0cd2e48e498f51fd3d0d5ea29ecd5e6163fdf3afe8d64d4368022d7" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
|
|
9628
10614
|
var CORE_FOUNDATION_HANDLE_IMPORTS = [
|
|
9629
10615
|
"CFAllocator",
|
|
9630
10616
|
"CFArray",
|
|
@@ -9644,6 +10630,19 @@ var CORE_FOUNDATION_HANDLE_IMPORTS = [
|
|
|
9644
10630
|
"import typealias CoreFoundation.CFTypeRef",
|
|
9645
10631
|
"import CoreGraphics"
|
|
9646
10632
|
]).join("; ");
|
|
10633
|
+
var emptyMacroEnvironment = {
|
|
10634
|
+
defines: /* @__PURE__ */ new Map(),
|
|
10635
|
+
predefines: /* @__PURE__ */ new Map(),
|
|
10636
|
+
targetDefined: /* @__PURE__ */ new Set()
|
|
10637
|
+
};
|
|
10638
|
+
var wasmMacroEnvironment = {
|
|
10639
|
+
...emptyMacroEnvironment,
|
|
10640
|
+
defines: /* @__PURE__ */ new Map([
|
|
10641
|
+
["__wasm__", "1"],
|
|
10642
|
+
["__wasm32__", "1"],
|
|
10643
|
+
["__wasi__", "1"]
|
|
10644
|
+
])
|
|
10645
|
+
};
|
|
9647
10646
|
var ROOT_LOCKS = Symbol.for("peachsim.swiftCompile.rootLocks");
|
|
9648
10647
|
var host = globalThis;
|
|
9649
10648
|
var rootLocks = host[ROOT_LOCKS] ??= /* @__PURE__ */ new Map();
|
|
@@ -9661,12 +10660,12 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
9661
10660
|
init_is_record();
|
|
9662
10661
|
|
|
9663
10662
|
// src/swift-package-manifest.ts
|
|
9664
|
-
var cacheDir3 =
|
|
9665
|
-
var execFileAsync = (0, import_node_util5.promisify)(
|
|
10663
|
+
var cacheDir3 = import_node_path16.default.join(cacheDir(), "swift-manifests");
|
|
10664
|
+
var execFileAsync = (0, import_node_util5.promisify)(import_node_child_process8.execFile);
|
|
9666
10665
|
|
|
9667
10666
|
// src/xcode-json-project.ts
|
|
9668
10667
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
9669
|
-
var
|
|
10668
|
+
var import_node_path17 = __toESM(require("node:path"), 1);
|
|
9670
10669
|
var import_json52 = __toESM(require_lib(), 1);
|
|
9671
10670
|
var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9672
10671
|
var text = (value) => typeof value === "string" ? value : void 0;
|
|
@@ -9724,7 +10723,7 @@ var PHASE_ISA = {
|
|
|
9724
10723
|
function readXcodeJsonProject(xcodeproj, source) {
|
|
9725
10724
|
const json = import_json52.default.parse(source);
|
|
9726
10725
|
if (!isJsonObject(json)) throw new Error(`${xcodeproj}/project.xcproj is not an object`);
|
|
9727
|
-
const projectDir =
|
|
10726
|
+
const projectDir = import_node_path17.default.dirname(xcodeproj);
|
|
9728
10727
|
const objects = {};
|
|
9729
10728
|
let next = 0;
|
|
9730
10729
|
const add = (entry, id) => {
|
|
@@ -9737,7 +10736,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
9737
10736
|
const base = /^<([A-Z]+)>\/(.*)$/.exec(raw);
|
|
9738
10737
|
if (base) {
|
|
9739
10738
|
if (base[1] === "PROJECT")
|
|
9740
|
-
return { sourceTree: "<absolute>", path:
|
|
10739
|
+
return { sourceTree: "<absolute>", path: import_node_path17.default.join(projectDir, base[2]) };
|
|
9741
10740
|
if (base[1] === "PRODUCTS")
|
|
9742
10741
|
return { sourceTree: "BUILT_PRODUCTS_DIR", path: base[2] };
|
|
9743
10742
|
return null;
|
|
@@ -9745,7 +10744,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
9745
10744
|
const unescaped = raw.replaceAll("\\<", "<");
|
|
9746
10745
|
if (unescaped.startsWith("/")) return { sourceTree: "<absolute>", path: unescaped };
|
|
9747
10746
|
if (unescaped.startsWith("~")) return null;
|
|
9748
|
-
return groupDir === null ? null : { sourceTree: "<absolute>", path:
|
|
10747
|
+
return groupDir === null ? null : { sourceTree: "<absolute>", path: import_node_path17.default.join(groupDir, unescaped) };
|
|
9749
10748
|
};
|
|
9750
10749
|
const memberships = [];
|
|
9751
10750
|
const folders = [];
|
|
@@ -9756,7 +10755,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
9756
10755
|
const kind = text(entry.kind) ?? "file-reference";
|
|
9757
10756
|
const raw = text(entry.path) ?? "";
|
|
9758
10757
|
const located = raw === "" ? null : locate(raw, parent.dir);
|
|
9759
|
-
const name2 = text(entry.name) ??
|
|
10758
|
+
const name2 = text(entry.name) ?? import_node_path17.default.basename(raw);
|
|
9760
10759
|
const node = { id: "", name: name2, dir: null, parent, children: [] };
|
|
9761
10760
|
if (kind === "group" || kind === "variant-group" || kind === "version-group") {
|
|
9762
10761
|
node.dir = raw === "" ? parent.dir : located?.sourceTree === "<absolute>" ? located.path : null;
|
|
@@ -9877,7 +10876,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
9877
10876
|
if (!isObject(entry)) continue;
|
|
9878
10877
|
const repository = text(entry.repository);
|
|
9879
10878
|
const local = text(entry.path);
|
|
9880
|
-
const name2 = local !== void 0 ?
|
|
10879
|
+
const name2 = local !== void 0 ? import_node_path17.default.basename(import_node_path17.default.resolve(import_node_path17.default.dirname(xcodeproj), local)) : import_node_path17.default.basename(repository ?? "").replace(/\.git$/, "");
|
|
9881
10880
|
const id = text(entry.kind) === "local" && local !== void 0 ? add({ isa: "XCLocalSwiftPackageReference", relativePath: local }) : add({
|
|
9882
10881
|
isa: "XCRemoteSwiftPackageReference",
|
|
9883
10882
|
repositoryURL: repository ?? "",
|
|
@@ -10097,28 +11096,28 @@ var CONDITIONS = {
|
|
|
10097
11096
|
variant: "normal"
|
|
10098
11097
|
};
|
|
10099
11098
|
function walkFiles(dir) {
|
|
10100
|
-
if (!
|
|
11099
|
+
if (!import_node_fs18.default.existsSync(dir)) return [];
|
|
10101
11100
|
const out = [];
|
|
10102
|
-
for (const entry of
|
|
11101
|
+
for (const entry of import_node_fs18.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
|
|
10103
11102
|
if (entry.name.startsWith(".")) continue;
|
|
10104
|
-
const full =
|
|
11103
|
+
const full = import_node_path18.default.join(dir, entry.name);
|
|
10105
11104
|
if (entry.isDirectory()) out.push(...walkFiles(full));
|
|
10106
11105
|
else if (entry.isFile()) out.push(full);
|
|
10107
11106
|
}
|
|
10108
11107
|
return out;
|
|
10109
11108
|
}
|
|
10110
|
-
var isDirectory = (dir) =>
|
|
11109
|
+
var isDirectory = (dir) => import_node_fs18.default.existsSync(dir) && import_node_fs18.default.statSync(dir).isDirectory();
|
|
10111
11110
|
function readXcconfig(file, read) {
|
|
10112
|
-
if (read.includes(file) || !
|
|
11111
|
+
if (read.includes(file) || !import_node_fs18.default.existsSync(file)) return {};
|
|
10113
11112
|
read.push(file);
|
|
10114
11113
|
const settings = {};
|
|
10115
|
-
for (const raw of
|
|
11114
|
+
for (const raw of import_node_fs18.default.readFileSync(file, "utf8").split("\n")) {
|
|
10116
11115
|
const line = raw.replace(/\/\/.*$/, "").trim();
|
|
10117
11116
|
const include = /^#include\??\s+"([^"]+)"/.exec(line);
|
|
10118
11117
|
if (include) {
|
|
10119
11118
|
Object.assign(
|
|
10120
11119
|
settings,
|
|
10121
|
-
readXcconfig(
|
|
11120
|
+
readXcconfig(import_node_path18.default.resolve(import_node_path18.default.dirname(file), include[1]), read)
|
|
10122
11121
|
);
|
|
10123
11122
|
continue;
|
|
10124
11123
|
}
|
|
@@ -10168,22 +11167,22 @@ function decodeXml(text2) {
|
|
|
10168
11167
|
return text2.replaceAll(""", '"').replaceAll("'", "'").replaceAll("<", "<").replaceAll(">", ">").replaceAll("&", "&");
|
|
10169
11168
|
}
|
|
10170
11169
|
function workspaceReferences(workspace) {
|
|
10171
|
-
const data =
|
|
10172
|
-
if (!
|
|
11170
|
+
const data = import_node_path18.default.join(workspace, "contents.xcworkspacedata");
|
|
11171
|
+
if (!import_node_fs18.default.existsSync(data))
|
|
10173
11172
|
throw new Error(`${workspace} has no contents.xcworkspacedata`);
|
|
10174
|
-
const container =
|
|
11173
|
+
const container = import_node_path18.default.dirname(workspace);
|
|
10175
11174
|
const locate = (location, base) => {
|
|
10176
11175
|
const colon = location.indexOf(":");
|
|
10177
11176
|
const kind = location.slice(0, colon);
|
|
10178
11177
|
const rest = location.slice(colon + 1);
|
|
10179
|
-
if (kind === "group") return
|
|
10180
|
-
if (kind === "container" || kind === "self") return
|
|
10181
|
-
if (kind === "absolute") return
|
|
10182
|
-
throw new Error(`${
|
|
11178
|
+
if (kind === "group") return import_node_path18.default.resolve(base, rest);
|
|
11179
|
+
if (kind === "container" || kind === "self") return import_node_path18.default.resolve(container, rest);
|
|
11180
|
+
if (kind === "absolute") return import_node_path18.default.resolve(rest);
|
|
11181
|
+
throw new Error(`${import_node_path18.default.basename(workspace)} has an unsupported location ${location}`);
|
|
10183
11182
|
};
|
|
10184
11183
|
const groups = [container];
|
|
10185
11184
|
const references = [];
|
|
10186
|
-
for (const [, closing, tag, attributes, selfClosing] of
|
|
11185
|
+
for (const [, closing, tag, attributes, selfClosing] of import_node_fs18.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
|
|
10187
11186
|
if (closing) {
|
|
10188
11187
|
if (tag === "Group") groups.pop();
|
|
10189
11188
|
continue;
|
|
@@ -10234,8 +11233,8 @@ function remotePackageRequirements(projects) {
|
|
|
10234
11233
|
var loaded = /* @__PURE__ */ new Map();
|
|
10235
11234
|
function xcodeProjectFile(xcodeproj) {
|
|
10236
11235
|
for (const name2 of ["project.pbxproj", "project.xcproj"]) {
|
|
10237
|
-
const file =
|
|
10238
|
-
if (
|
|
11236
|
+
const file = import_node_path18.default.join(xcodeproj, name2);
|
|
11237
|
+
if (import_node_fs18.default.existsSync(file)) return file;
|
|
10239
11238
|
}
|
|
10240
11239
|
return null;
|
|
10241
11240
|
}
|
|
@@ -10243,8 +11242,8 @@ function loadProject(xcodeproj) {
|
|
|
10243
11242
|
const projectFile = xcodeProjectFile(xcodeproj);
|
|
10244
11243
|
if (!projectFile)
|
|
10245
11244
|
throw new Error(`${xcodeproj} has no project.pbxproj or project.xcproj`);
|
|
10246
|
-
const source =
|
|
10247
|
-
const digest = (0,
|
|
11245
|
+
const source = import_node_fs18.default.readFileSync(projectFile, "utf8");
|
|
11246
|
+
const digest = (0, import_node_crypto6.createHash)("sha256").update(source).digest("hex");
|
|
10248
11247
|
const cached = loaded.get(projectFile);
|
|
10249
11248
|
if (cached?.digest === digest) return cached.project;
|
|
10250
11249
|
const root = projectFile.endsWith(".xcproj") ? readXcodeJsonProject(xcodeproj, source) : parseOpenStepPlist(source);
|
|
@@ -10260,10 +11259,10 @@ function loadProject(xcodeproj) {
|
|
|
10260
11259
|
if (!project || project.isa !== "PBXProject") {
|
|
10261
11260
|
throw new Error(`${projectFile} has no PBXProject root`);
|
|
10262
11261
|
}
|
|
10263
|
-
const projectDir =
|
|
10264
|
-
|
|
11262
|
+
const projectDir = import_node_fs18.default.realpathSync.native(
|
|
11263
|
+
import_node_path18.default.resolve(import_node_path18.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
|
|
10265
11264
|
);
|
|
10266
|
-
const resolvePath = xcodePathResolver(objects, projectDir,
|
|
11265
|
+
const resolvePath = xcodePathResolver(objects, projectDir, import_node_path18.default.join);
|
|
10267
11266
|
const result = {
|
|
10268
11267
|
xcodeproj,
|
|
10269
11268
|
projectFile,
|
|
@@ -10300,8 +11299,8 @@ function targetSettings(ref, configuration, builtins, options = {}, overrides =
|
|
|
10300
11299
|
const relative3 = str(config.baseConfigurationReferenceRelativePath);
|
|
10301
11300
|
const own = isDict(config.buildSettings) ? config.buildSettings : {};
|
|
10302
11301
|
const directory = anchor ? project.resolvePath(anchor) : null;
|
|
10303
|
-
const baseFile = base ? project.resolvePath(base) : directory && relative3 ?
|
|
10304
|
-
if (options.requireSources !== false && (base || anchor || relative3) && (!baseFile || !
|
|
11302
|
+
const baseFile = base ? project.resolvePath(base) : directory && relative3 ? import_node_path18.default.resolve(directory, relative3) : null;
|
|
11303
|
+
if (options.requireSources !== false && (base || anchor || relative3) && (!baseFile || !import_node_fs18.default.existsSync(baseFile)))
|
|
10305
11304
|
throw new Error(
|
|
10306
11305
|
`Unable to open base configuration reference file '${baseFile ?? base ?? relative3 ?? anchor}'`
|
|
10307
11306
|
);
|
|
@@ -10347,7 +11346,7 @@ function targetSettings(ref, configuration, builtins, options = {}, overrides =
|
|
|
10347
11346
|
const derivedSettings = {
|
|
10348
11347
|
DEVELOPER_DIR: () => options.environment?.DEVELOPER_DIR ?? process.env.DEVELOPER_DIR ?? (developerDir ??= process.platform === "darwin" ? (
|
|
10349
11348
|
// runner-toolchain-platform: darwin
|
|
10350
|
-
(0,
|
|
11349
|
+
(0, import_node_child_process9.execFileSync)("xcode-select", ["-p"], {
|
|
10351
11350
|
encoding: "utf8",
|
|
10352
11351
|
stdio: ["ignore", "pipe", "pipe"]
|
|
10353
11352
|
}).trim()
|
|
@@ -10399,26 +11398,26 @@ function scriptCommand(shell, script) {
|
|
|
10399
11398
|
return [executable, ...args, "-c", script];
|
|
10400
11399
|
}
|
|
10401
11400
|
function expandSearchPath(directory, rules2) {
|
|
10402
|
-
if (
|
|
11401
|
+
if (import_node_path18.default.basename(directory) !== "**") return [directory];
|
|
10403
11402
|
const expanded = [];
|
|
10404
11403
|
const seen = /* @__PURE__ */ new Set();
|
|
10405
|
-
const queue = [
|
|
11404
|
+
const queue = [import_node_path18.default.dirname(directory)];
|
|
10406
11405
|
for (let at = 0; at < queue.length; at++) {
|
|
10407
11406
|
const current = queue[at];
|
|
10408
11407
|
let real;
|
|
10409
11408
|
try {
|
|
10410
|
-
real =
|
|
11409
|
+
real = import_node_fs18.default.realpathSync.native(current);
|
|
10411
11410
|
} catch {
|
|
10412
11411
|
continue;
|
|
10413
11412
|
}
|
|
10414
|
-
if (!
|
|
11413
|
+
if (!import_node_fs18.default.statSync(real).isDirectory() || seen.has(real)) continue;
|
|
10415
11414
|
seen.add(real);
|
|
10416
11415
|
expanded.push(current);
|
|
10417
|
-
for (const entry of
|
|
11416
|
+
for (const entry of import_node_fs18.default.readdirSync(real, { withFileTypes: true }).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0)) {
|
|
10418
11417
|
if (entry.isSymbolicLink() ? !rules2.followLinks : !entry.isDirectory()) continue;
|
|
10419
11418
|
if (rules2.excluded.some((pattern) => pattern.test(entry.name)) && !rules2.included.some((pattern) => pattern.test(entry.name)))
|
|
10420
11419
|
continue;
|
|
10421
|
-
queue.push(
|
|
11420
|
+
queue.push(import_node_path18.default.join(current, entry.name));
|
|
10422
11421
|
}
|
|
10423
11422
|
}
|
|
10424
11423
|
return expanded;
|
|
@@ -10489,7 +11488,7 @@ function shellAssetCatalogs(script, settings, projectDir) {
|
|
|
10489
11488
|
for (const token of tokens) {
|
|
10490
11489
|
if (token.startsWith("-")) break;
|
|
10491
11490
|
const file = resolve4(token);
|
|
10492
|
-
if (file?.endsWith(".xcassets")) catalogs.push(
|
|
11491
|
+
if (file?.endsWith(".xcassets")) catalogs.push(import_node_path18.default.resolve(projectDir, file));
|
|
10493
11492
|
}
|
|
10494
11493
|
}
|
|
10495
11494
|
return catalogs;
|
|
@@ -10534,14 +11533,14 @@ function shellCopies(script, settings, projectDir) {
|
|
|
10534
11533
|
if (operands.length !== 2 || operands.some((operand) => operand.startsWith("-")))
|
|
10535
11534
|
return [];
|
|
10536
11535
|
copies.push({
|
|
10537
|
-
from:
|
|
10538
|
-
to:
|
|
11536
|
+
from: import_node_path18.default.resolve(projectDir, operands[0]),
|
|
11537
|
+
to: import_node_path18.default.resolve(projectDir, operands[1])
|
|
10539
11538
|
});
|
|
10540
11539
|
}
|
|
10541
11540
|
return copies;
|
|
10542
11541
|
}
|
|
10543
11542
|
function fileListEntries(file, absolute) {
|
|
10544
|
-
return
|
|
11543
|
+
return import_node_fs18.default.readFileSync(file, "utf8").split(/\r?\n/).map((line) => line.trim()).filter((line) => line !== "" && !line.startsWith("#")).map(absolute);
|
|
10545
11544
|
}
|
|
10546
11545
|
function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
10547
11546
|
const { project, target, id: targetId } = ref;
|
|
@@ -10554,7 +11553,7 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
10554
11553
|
const copiedFiles = [];
|
|
10555
11554
|
let generatedInfoPlist = false;
|
|
10556
11555
|
const declaredInfoPlist = settings("INFOPLIST_FILE");
|
|
10557
|
-
const infoPlistOutput = declaredInfoPlist ?
|
|
11556
|
+
const infoPlistOutput = declaredInfoPlist ? import_node_path18.default.resolve(project.projectDir, declaredInfoPlist) : null;
|
|
10558
11557
|
const isPreparedOutput = (file) => file === infoPlistOutput || options.requireSources !== false && file.endsWith(".swift");
|
|
10559
11558
|
for (const phaseId of list(target.buildPhases)) {
|
|
10560
11559
|
const phase = project.object(phaseId);
|
|
@@ -10569,7 +11568,7 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
10569
11568
|
copiedFiles.push(
|
|
10570
11569
|
...shellCopies(str(phase.shellScript) ?? "", settings, project.projectDir)
|
|
10571
11570
|
);
|
|
10572
|
-
const absolute = (raw) =>
|
|
11571
|
+
const absolute = (raw) => import_node_path18.default.resolve(project.projectDir, expand(raw, settings));
|
|
10573
11572
|
const inputs = list(phase.inputPaths).map(absolute);
|
|
10574
11573
|
const outputs = list(phase.outputPaths).map(absolute);
|
|
10575
11574
|
const fileLists = /* @__PURE__ */ new Map();
|
|
@@ -10578,7 +11577,7 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
10578
11577
|
kind === "INPUT" ? phase.inputFileListPaths : phase.outputFileListPaths
|
|
10579
11578
|
).map((raw) => {
|
|
10580
11579
|
const file = absolute(raw);
|
|
10581
|
-
if (!
|
|
11580
|
+
if (!import_node_fs18.default.existsSync(file)) {
|
|
10582
11581
|
return { file, entries: [] };
|
|
10583
11582
|
}
|
|
10584
11583
|
return { file, entries: fileListEntries(file, absolute) };
|
|
@@ -10599,7 +11598,7 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
10599
11598
|
...fileLists.get("OUTPUT").map((item) => item.file)
|
|
10600
11599
|
];
|
|
10601
11600
|
if (allOutputs.some((file) => file.endsWith(".swift") || file === infoPlistOutput)) {
|
|
10602
|
-
for (const file of inputFiles) if (
|
|
11601
|
+
for (const file of inputFiles) if (import_node_fs18.default.existsSync(file)) projectInputs.add(file);
|
|
10603
11602
|
}
|
|
10604
11603
|
if (options.prepareGeneratedSources === true && allOutputs.some(isPreparedOutput)) {
|
|
10605
11604
|
const configuration = settings("CONFIGURATION");
|
|
@@ -10612,10 +11611,10 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
10612
11611
|
false
|
|
10613
11612
|
))
|
|
10614
11613
|
continue;
|
|
10615
|
-
const phaseDir =
|
|
11614
|
+
const phaseDir = import_node_path18.default.join(settings("TARGET_TEMP_DIR"), `Script-${phaseId}`);
|
|
10616
11615
|
for (const lists of fileLists.values())
|
|
10617
11616
|
for (const { file } of lists)
|
|
10618
|
-
if (!
|
|
11617
|
+
if (!import_node_fs18.default.existsSync(file))
|
|
10619
11618
|
throw new Error(
|
|
10620
11619
|
`${targetName}: Run Script "${script}" missing file list ${file}`
|
|
10621
11620
|
);
|
|
@@ -10634,25 +11633,25 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
10634
11633
|
const lists = fileLists.get(kind);
|
|
10635
11634
|
env[`SCRIPT_${kind}_FILE_LIST_COUNT`] = String(lists.length);
|
|
10636
11635
|
lists.forEach((_item, index) => {
|
|
10637
|
-
env[`SCRIPT_${kind}_FILE_LIST_${index}`] =
|
|
11636
|
+
env[`SCRIPT_${kind}_FILE_LIST_${index}`] = import_node_path18.default.join(
|
|
10638
11637
|
phaseDir,
|
|
10639
11638
|
`${kind}-${index}.xcfilelist`
|
|
10640
11639
|
);
|
|
10641
11640
|
});
|
|
10642
11641
|
}
|
|
10643
|
-
const signature = (0,
|
|
11642
|
+
const signature = (0, import_node_crypto6.createHash)("sha256").update(
|
|
10644
11643
|
JSON.stringify([phase, [...settingKeys].map((key2) => [key2, settings(key2)])])
|
|
10645
11644
|
);
|
|
10646
11645
|
for (const file of inputFiles) {
|
|
10647
11646
|
signature.update(file);
|
|
10648
|
-
if (
|
|
10649
|
-
const stat =
|
|
11647
|
+
if (import_node_fs18.default.existsSync(file)) {
|
|
11648
|
+
const stat = import_node_fs18.default.statSync(file);
|
|
10650
11649
|
signature.update(`${stat.mtimeMs}:${stat.ctimeMs}:${stat.size}`);
|
|
10651
11650
|
} else signature.update("missing");
|
|
10652
11651
|
}
|
|
10653
11652
|
const stamp = signature.digest("hex");
|
|
10654
11653
|
const key = `${project.projectFile}:${targetId}:${phaseId}:${settings("CONFIGURATION")}`;
|
|
10655
|
-
if (preparedSourcePhases.get(key) === stamp && allOutputs.every((file) =>
|
|
11654
|
+
if (preparedSourcePhases.get(key) === stamp && allOutputs.every((file) => import_node_fs18.default.existsSync(file))) {
|
|
10656
11655
|
preparedXcodePhase(
|
|
10657
11656
|
project.projectFile,
|
|
10658
11657
|
targetId,
|
|
@@ -10663,14 +11662,14 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
10663
11662
|
);
|
|
10664
11663
|
continue;
|
|
10665
11664
|
}
|
|
10666
|
-
|
|
10667
|
-
|
|
10668
|
-
|
|
11665
|
+
import_node_fs18.default.mkdirSync(phaseDir, { recursive: true });
|
|
11666
|
+
import_node_fs18.default.mkdirSync(settings("BUILT_PRODUCTS_DIR"), { recursive: true });
|
|
11667
|
+
import_node_fs18.default.mkdirSync(settings("DERIVED_FILE_DIR"), { recursive: true });
|
|
10669
11668
|
for (const output2 of allOutputs)
|
|
10670
|
-
|
|
11669
|
+
import_node_fs18.default.mkdirSync(import_node_path18.default.dirname(output2), { recursive: true });
|
|
10671
11670
|
for (const [kind, lists] of fileLists)
|
|
10672
11671
|
lists.forEach((item, index) => {
|
|
10673
|
-
|
|
11672
|
+
import_node_fs18.default.writeFileSync(
|
|
10674
11673
|
env[`SCRIPT_${kind}_FILE_LIST_${index}`],
|
|
10675
11674
|
`${item.entries.join("\n")}
|
|
10676
11675
|
`
|
|
@@ -10681,7 +11680,7 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
10681
11680
|
str(phase.shellPath) ?? "/bin/sh",
|
|
10682
11681
|
str(phase.shellScript) ?? ""
|
|
10683
11682
|
);
|
|
10684
|
-
(0,
|
|
11683
|
+
(0, import_node_child_process9.execFileSync)(shell, args, {
|
|
10685
11684
|
cwd: project.projectDir,
|
|
10686
11685
|
env,
|
|
10687
11686
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -10697,7 +11696,7 @@ ${output2}`
|
|
|
10697
11696
|
);
|
|
10698
11697
|
}
|
|
10699
11698
|
const missing2 = allOutputs.filter(
|
|
10700
|
-
(file) => file === infoPlistOutput && !
|
|
11699
|
+
(file) => file === infoPlistOutput && !import_node_fs18.default.existsSync(file)
|
|
10701
11700
|
);
|
|
10702
11701
|
if (missing2.length > 0)
|
|
10703
11702
|
throw new Error(
|
|
@@ -10716,9 +11715,9 @@ ${output2}`
|
|
|
10716
11715
|
}
|
|
10717
11716
|
project.visitMembers(
|
|
10718
11717
|
targetId,
|
|
10719
|
-
xcodePathResolver(project.objects, project.projectDir,
|
|
10720
|
-
(file) => isDirectory(file) ? walkFiles(file) :
|
|
10721
|
-
|
|
11718
|
+
xcodePathResolver(project.objects, project.projectDir, import_node_path18.default.join, settings),
|
|
11719
|
+
(file) => isDirectory(file) ? walkFiles(file) : import_node_fs18.default.existsSync(file) ? [file] : [],
|
|
11720
|
+
import_node_path18.default.join,
|
|
10722
11721
|
(file, kind) => {
|
|
10723
11722
|
if (kind === "header") {
|
|
10724
11723
|
headers.add(file);
|
|
@@ -10728,9 +11727,9 @@ ${output2}`
|
|
|
10728
11727
|
resources.add(file);
|
|
10729
11728
|
return;
|
|
10730
11729
|
}
|
|
10731
|
-
if (!
|
|
11730
|
+
if (!import_node_fs18.default.existsSync(file)) {
|
|
10732
11731
|
if (options.requireSources === false) return;
|
|
10733
|
-
const script = scriptForOutput.get(
|
|
11732
|
+
const script = scriptForOutput.get(import_node_path18.default.normalize(file));
|
|
10734
11733
|
throw new Error(
|
|
10735
11734
|
script ? `${targetName}: missing generated source ${file} (Run Script "${script}" declares it in outputPaths; run the script or check in its output)` : `${targetName}: missing source ${file}`
|
|
10736
11735
|
);
|
|
@@ -10741,17 +11740,17 @@ ${output2}`
|
|
|
10741
11740
|
);
|
|
10742
11741
|
if (options.prepareGeneratedSources && options.requireSources !== false) {
|
|
10743
11742
|
const interfaceFiles = [...resources].filter(
|
|
10744
|
-
(file) => /\.(storyboard|xib)$/.test(file) && !file.split(
|
|
11743
|
+
(file) => /\.(storyboard|xib)$/.test(file) && !file.split(import_node_path18.default.sep).some((part) => part.endsWith(".bundle"))
|
|
10745
11744
|
);
|
|
10746
11745
|
if (process.platform !== "darwin") {
|
|
10747
11746
|
let launchName = settings("INFOPLIST_KEY_UILaunchStoryboardName");
|
|
10748
|
-
if (!launchName && infoPlistOutput &&
|
|
10749
|
-
const info = import_plist2.default.parse(
|
|
11747
|
+
if (!launchName && infoPlistOutput && import_node_fs18.default.existsSync(infoPlistOutput)) {
|
|
11748
|
+
const info = import_plist2.default.parse(import_node_fs18.default.readFileSync(infoPlistOutput, "utf8"));
|
|
10750
11749
|
const declared = isRecord(info) ? info.UILaunchStoryboardName : void 0;
|
|
10751
11750
|
if (typeof declared === "string") launchName = expand(declared, settings);
|
|
10752
11751
|
}
|
|
10753
11752
|
const runtimeInterfaceFiles = interfaceFiles.filter(
|
|
10754
|
-
(file) =>
|
|
11753
|
+
(file) => import_node_path18.default.basename(file, import_node_path18.default.extname(file)) !== launchName
|
|
10755
11754
|
);
|
|
10756
11755
|
if (runtimeInterfaceFiles.length > 0)
|
|
10757
11756
|
throw new Error(
|
|
@@ -10762,19 +11761,19 @@ ${output2}`
|
|
|
10762
11761
|
}
|
|
10763
11762
|
const interfaceOutputs = /* @__PURE__ */ new Set();
|
|
10764
11763
|
for (const file of interfaceFiles) {
|
|
10765
|
-
const localization = file.split(
|
|
11764
|
+
const localization = file.split(import_node_path18.default.sep).findLast((part) => part.endsWith(".lproj")) ?? "";
|
|
10766
11765
|
const extension = file.endsWith(".storyboard") ? ".storyboardc" : ".nib";
|
|
10767
|
-
const output2 =
|
|
11766
|
+
const output2 = import_node_path18.default.join(
|
|
10768
11767
|
settings("DERIVED_FILE_DIR"),
|
|
10769
11768
|
"InterfaceBuilder",
|
|
10770
11769
|
localization,
|
|
10771
|
-
|
|
11770
|
+
import_node_path18.default.basename(file, import_node_path18.default.extname(file)) + extension
|
|
10772
11771
|
);
|
|
10773
11772
|
if (interfaceOutputs.has(output2))
|
|
10774
11773
|
throw new Error(`${targetName}: duplicate Interface Builder output ${output2}`);
|
|
10775
11774
|
interfaceOutputs.add(output2);
|
|
10776
|
-
|
|
10777
|
-
|
|
11775
|
+
import_node_fs18.default.rmSync(output2, { recursive: true, force: true });
|
|
11776
|
+
import_node_fs18.default.mkdirSync(import_node_path18.default.dirname(output2), { recursive: true });
|
|
10778
11777
|
const args = [
|
|
10779
11778
|
"ibtool",
|
|
10780
11779
|
"--compile",
|
|
@@ -10788,7 +11787,7 @@ ${output2}`
|
|
|
10788
11787
|
const families = settings("TARGETED_DEVICE_FAMILY").split(",").map((value) => value.trim());
|
|
10789
11788
|
if (families.includes("1")) args.push("--target-device", "iphone");
|
|
10790
11789
|
if (families.includes("2")) args.push("--target-device", "ipad");
|
|
10791
|
-
(0,
|
|
11790
|
+
(0, import_node_child_process9.execFileSync)("xcrun", args, {
|
|
10792
11791
|
cwd: project.projectDir,
|
|
10793
11792
|
stdio: ["ignore", "pipe", "pipe"],
|
|
10794
11793
|
timeout: runScriptTimeoutMs
|
|
@@ -10808,13 +11807,13 @@ ${output2}`
|
|
|
10808
11807
|
for (const definition of definitions) {
|
|
10809
11808
|
const configuredLanguage = settings("INTENTS_CODEGEN_LANGUAGE");
|
|
10810
11809
|
const language = !configuredLanguage || configuredLanguage === "Automatic" ? sources.size > 0 ? "Swift" : "Objective-C" : configuredLanguage;
|
|
10811
|
-
const output2 =
|
|
11810
|
+
const output2 = import_node_path18.default.join(
|
|
10812
11811
|
settings("DERIVED_FILE_DIR"),
|
|
10813
11812
|
"IntentDefinitionGenerated",
|
|
10814
|
-
|
|
11813
|
+
import_node_path18.default.basename(definition, ".intentdefinition")
|
|
10815
11814
|
);
|
|
10816
|
-
|
|
10817
|
-
|
|
11815
|
+
import_node_fs18.default.rmSync(output2, { recursive: true, force: true });
|
|
11816
|
+
import_node_fs18.default.mkdirSync(output2, { recursive: true });
|
|
10818
11817
|
const args = [
|
|
10819
11818
|
"intentbuilderc",
|
|
10820
11819
|
"generate",
|
|
@@ -10833,7 +11832,7 @@ ${output2}`
|
|
|
10833
11832
|
args.push("-swiftVersion", settings("SWIFT_VERSION") || "5.0");
|
|
10834
11833
|
if (settings("DEFINES_MODULE") === "YES")
|
|
10835
11834
|
args.push("-moduleName", settings("PRODUCT_MODULE_NAME"));
|
|
10836
|
-
(0,
|
|
11835
|
+
(0, import_node_child_process9.execFileSync)("xcrun", args, {
|
|
10837
11836
|
cwd: project.projectDir,
|
|
10838
11837
|
stdio: ["ignore", "pipe", "pipe"],
|
|
10839
11838
|
timeout: runScriptTimeoutMs
|
|
@@ -10858,37 +11857,37 @@ ${output2}`
|
|
|
10858
11857
|
function commonAncestor(dirs) {
|
|
10859
11858
|
let common = dirs[0];
|
|
10860
11859
|
for (const dir of dirs) {
|
|
10861
|
-
while (common !==
|
|
10862
|
-
common =
|
|
11860
|
+
while (common !== import_node_path18.default.dirname(common) && import_node_path18.default.relative(common, dir).startsWith(".."))
|
|
11861
|
+
common = import_node_path18.default.dirname(common);
|
|
10863
11862
|
}
|
|
10864
11863
|
return common;
|
|
10865
11864
|
}
|
|
10866
|
-
var isPodsProject = (xcodeproj) =>
|
|
11865
|
+
var isPodsProject = (xcodeproj) => import_node_path18.default.basename(xcodeproj) === "Pods.xcodeproj" && import_node_path18.default.basename(import_node_path18.default.dirname(xcodeproj)) === "Pods";
|
|
10867
11866
|
function installedPodsSandbox(pods) {
|
|
10868
|
-
const podfileLock =
|
|
10869
|
-
const manifestLock =
|
|
10870
|
-
if (!
|
|
11867
|
+
const podfileLock = import_node_path18.default.join(import_node_path18.default.dirname(pods), "Podfile.lock");
|
|
11868
|
+
const manifestLock = import_node_path18.default.join(pods, "Manifest.lock");
|
|
11869
|
+
if (!import_node_fs18.default.existsSync(podfileLock))
|
|
10871
11870
|
throw new Error(
|
|
10872
|
-
`${pods} has no ${podfileLock}: run \`pod install\` in ${
|
|
11871
|
+
`${pods} has no ${podfileLock}: run \`pod install\` in ${import_node_path18.default.dirname(pods)}`
|
|
10873
11872
|
);
|
|
10874
|
-
if (!
|
|
11873
|
+
if (!import_node_fs18.default.existsSync(manifestLock) || !import_node_fs18.default.readFileSync(manifestLock).equals(import_node_fs18.default.readFileSync(podfileLock)))
|
|
10875
11874
|
throw new Error(
|
|
10876
|
-
`The sandbox is not in sync with the Podfile.lock: ${manifestLock} differs from ${podfileLock}. Run \`pod install\` in ${
|
|
11875
|
+
`The sandbox is not in sync with the Podfile.lock: ${manifestLock} differs from ${podfileLock}. Run \`pod install\` in ${import_node_path18.default.dirname(pods)}`
|
|
10877
11876
|
);
|
|
10878
11877
|
const specChecksums = {};
|
|
10879
|
-
const lines =
|
|
11878
|
+
const lines = import_node_fs18.default.readFileSync(manifestLock, "utf8").split("\n");
|
|
10880
11879
|
const start = lines.indexOf("SPEC CHECKSUMS:");
|
|
10881
11880
|
for (const line of start === -1 ? [] : lines.slice(start + 1)) {
|
|
10882
11881
|
const entry = /^ {2}"?([^":]+)"?: ([0-9a-f]+)$/.exec(line);
|
|
10883
11882
|
if (!entry) break;
|
|
10884
11883
|
specChecksums[entry[1]] = entry[2];
|
|
10885
11884
|
}
|
|
10886
|
-
const specs =
|
|
11885
|
+
const specs = import_node_path18.default.join(pods, "Local Podspecs");
|
|
10887
11886
|
return {
|
|
10888
11887
|
podfileLock,
|
|
10889
11888
|
manifestLock,
|
|
10890
11889
|
specChecksums,
|
|
10891
|
-
localPodspecs: isDirectory(specs) ?
|
|
11890
|
+
localPodspecs: isDirectory(specs) ? import_node_fs18.default.readdirSync(specs).filter((name2) => name2.endsWith(".podspec.json")).sort().map((name2) => import_node_path18.default.join(specs, name2)) : []
|
|
10892
11891
|
};
|
|
10893
11892
|
}
|
|
10894
11893
|
function workspaceProjects(xcodeprojOrWorkspace, installedPods = false) {
|
|
@@ -10900,14 +11899,14 @@ function workspaceProjects(xcodeprojOrWorkspace, installedPods = false) {
|
|
|
10900
11899
|
if (!xcodeProjectFile(xcodeproj)) {
|
|
10901
11900
|
if (installedPods && isPodsProject(xcodeproj))
|
|
10902
11901
|
throw new Error(
|
|
10903
|
-
`${
|
|
11902
|
+
`${import_node_path18.default.basename(xcodeprojOrWorkspace)} builds ${xcodeproj}, which is not installed: run \`pod install\` in ${import_node_path18.default.dirname(import_node_path18.default.dirname(xcodeproj))}`
|
|
10904
11903
|
);
|
|
10905
11904
|
return;
|
|
10906
11905
|
}
|
|
10907
|
-
const key =
|
|
10908
|
-
if (projectAt.has(key) || !installedPods && key.split(
|
|
11906
|
+
const key = import_node_fs18.default.realpathSync.native(xcodeproj);
|
|
11907
|
+
if (projectAt.has(key) || !installedPods && key.split(import_node_path18.default.sep).includes("Pods"))
|
|
10909
11908
|
return;
|
|
10910
|
-
if (isPodsProject(key)) cocoapods = installedPodsSandbox(
|
|
11909
|
+
if (isPodsProject(key)) cocoapods = installedPodsSandbox(import_node_path18.default.dirname(key));
|
|
10911
11910
|
const project = loadProject(key);
|
|
10912
11911
|
projectAt.set(key, project);
|
|
10913
11912
|
projects.push(project);
|
|
@@ -10923,12 +11922,12 @@ function workspaceProjects(xcodeprojOrWorkspace, installedPods = false) {
|
|
|
10923
11922
|
for (const reference of listed)
|
|
10924
11923
|
if (reference.endsWith(".xcodeproj")) addProject(reference);
|
|
10925
11924
|
if (projects.length === 0) {
|
|
10926
|
-
throw new Error(`${
|
|
11925
|
+
throw new Error(`${import_node_path18.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
|
|
10927
11926
|
}
|
|
10928
|
-
const podfile =
|
|
10929
|
-
if (installedPods && !cocoapods &&
|
|
11927
|
+
const podfile = import_node_path18.default.join(import_node_path18.default.dirname(xcodeprojOrWorkspace), "Podfile");
|
|
11928
|
+
if (installedPods && !cocoapods && import_node_fs18.default.existsSync(podfile))
|
|
10930
11929
|
throw new Error(
|
|
10931
|
-
`${podfile} is not installed into ${
|
|
11930
|
+
`${podfile} is not installed into ${import_node_path18.default.basename(xcodeprojOrWorkspace)}: run \`pod install\` in ${import_node_path18.default.dirname(podfile)} and open the workspace it writes`
|
|
10932
11931
|
);
|
|
10933
11932
|
return { listed, projects, projectAt, cocoapods };
|
|
10934
11933
|
}
|
|
@@ -10966,7 +11965,7 @@ function listXcodeAppTargets(xcodeprojOrWorkspace, options = {}) {
|
|
|
10966
11965
|
return workspaceProjects(xcodeprojOrWorkspace).projects.flatMap(projectTargets).filter((ref) => isIosAppTarget(ref, options)).map((ref) => str(ref.target.name) ?? ref.id);
|
|
10967
11966
|
}
|
|
10968
11967
|
function defaultXcodeAppTarget(xcodeproj) {
|
|
10969
|
-
const project = loadProject(
|
|
11968
|
+
const project = loadProject(import_node_fs18.default.realpathSync.native(xcodeproj));
|
|
10970
11969
|
for (const [id, target] of Object.entries(project.objects)) {
|
|
10971
11970
|
if (!isDict(target) || target.isa !== "PBXNativeTarget") continue;
|
|
10972
11971
|
if (isIosAppTarget({ project, id, target }, { requireSources: false }))
|
|
@@ -10974,30 +11973,30 @@ function defaultXcodeAppTarget(xcodeproj) {
|
|
|
10974
11973
|
}
|
|
10975
11974
|
}
|
|
10976
11975
|
function readXcodeScheme(xcodeprojOrWorkspace, scheme) {
|
|
10977
|
-
const container =
|
|
11976
|
+
const container = import_node_fs18.default.realpathSync.native(xcodeprojOrWorkspace);
|
|
10978
11977
|
const { projects } = workspaceProjects(container);
|
|
10979
11978
|
const containers = [
|
|
10980
11979
|
.../* @__PURE__ */ new Set([container, ...projects.map((project2) => project2.xcodeproj)])
|
|
10981
11980
|
];
|
|
10982
11981
|
const found = containers.flatMap(
|
|
10983
11982
|
(dir) => [
|
|
10984
|
-
|
|
10985
|
-
...isDirectory(
|
|
11983
|
+
import_node_path18.default.join(dir, "xcshareddata"),
|
|
11984
|
+
...isDirectory(import_node_path18.default.join(dir, "xcuserdata")) ? import_node_fs18.default.readdirSync(import_node_path18.default.join(dir, "xcuserdata")).sort().map((user) => import_node_path18.default.join(dir, "xcuserdata", user)) : []
|
|
10986
11985
|
].map((data) => ({
|
|
10987
11986
|
dir,
|
|
10988
|
-
file:
|
|
11987
|
+
file: import_node_path18.default.join(data, "xcschemes", `${scheme}.xcscheme`)
|
|
10989
11988
|
}))
|
|
10990
|
-
).find((candidate) =>
|
|
11989
|
+
).find((candidate) => import_node_fs18.default.existsSync(candidate.file));
|
|
10991
11990
|
if (!found) {
|
|
10992
11991
|
const known = containers.flatMap(
|
|
10993
|
-
(dir) =>
|
|
11992
|
+
(dir) => import_node_fs18.default.existsSync(import_node_path18.default.join(dir, "xcshareddata", "xcschemes")) ? import_node_fs18.default.readdirSync(import_node_path18.default.join(dir, "xcshareddata", "xcschemes")).filter((name3) => name3.endsWith(".xcscheme")).map((name3) => name3.slice(0, -".xcscheme".length)).sort() : []
|
|
10994
11993
|
);
|
|
10995
11994
|
throw new Error(
|
|
10996
|
-
`${
|
|
11995
|
+
`${import_node_path18.default.basename(container)} has no scheme ${scheme}; it shares ${known.join(", ") || "none"}`
|
|
10997
11996
|
);
|
|
10998
11997
|
}
|
|
10999
11998
|
const launch = /<LaunchAction\b([^>]*)>([\s\S]*?)<\/LaunchAction>/.exec(
|
|
11000
|
-
|
|
11999
|
+
import_node_fs18.default.readFileSync(found.file, "utf8")
|
|
11001
12000
|
);
|
|
11002
12001
|
const attribute = (text2, name3) => {
|
|
11003
12002
|
const value = new RegExp(`\\b${name3}\\s*=\\s*"([^"]*)"`).exec(text2)?.[1];
|
|
@@ -11010,12 +12009,12 @@ function readXcodeScheme(xcodeprojOrWorkspace, scheme) {
|
|
|
11010
12009
|
if (!configuration || !blueprint || !referenced?.startsWith("container:")) {
|
|
11011
12010
|
throw new Error(`scheme ${scheme} runs no application target`);
|
|
11012
12011
|
}
|
|
11013
|
-
const projectPath =
|
|
11014
|
-
|
|
12012
|
+
const projectPath = import_node_path18.default.resolve(
|
|
12013
|
+
import_node_path18.default.dirname(found.dir),
|
|
11015
12014
|
referenced.slice("container:".length)
|
|
11016
12015
|
);
|
|
11017
12016
|
const project = projects.find(
|
|
11018
|
-
(candidate) =>
|
|
12017
|
+
(candidate) => import_node_fs18.default.existsSync(projectPath) && candidate.xcodeproj === import_node_fs18.default.realpathSync.native(projectPath)
|
|
11019
12018
|
);
|
|
11020
12019
|
const target = project && projectTargets(project).find((ref) => ref.id === blueprint);
|
|
11021
12020
|
const name2 = target && str(target.target.name);
|
|
@@ -11035,26 +12034,26 @@ function readXcodeScheme(xcodeprojOrWorkspace, scheme) {
|
|
|
11035
12034
|
var NativeAppTargetSelectionError = class extends Error {
|
|
11036
12035
|
};
|
|
11037
12036
|
function selectIosAppTarget(projectRoot, iosTarget) {
|
|
11038
|
-
const nested =
|
|
11039
|
-
const iosRoot =
|
|
11040
|
-
const entries =
|
|
12037
|
+
const nested = import_node_path18.default.join(projectRoot, "ios");
|
|
12038
|
+
const iosRoot = import_node_fs18.default.existsSync(nested) ? nested : projectRoot;
|
|
12039
|
+
const entries = import_node_fs18.default.readdirSync(iosRoot, { withFileTypes: true });
|
|
11041
12040
|
const projects = (entries.some((entry) => entry.isDirectory() && entry.name.endsWith(".xcodeproj")) ? entries.filter((entry) => entry.isDirectory() && entry.name.endsWith(".xcodeproj")).map((entry) => ({
|
|
11042
|
-
xcodeproj:
|
|
12041
|
+
xcodeproj: import_node_path18.default.join(iosRoot, entry.name),
|
|
11043
12042
|
workspace: null
|
|
11044
12043
|
})) : entries.filter((entry) => entry.isDirectory() && entry.name.endsWith(".xcworkspace")).flatMap((entry) => {
|
|
11045
|
-
const workspace =
|
|
12044
|
+
const workspace = import_node_path18.default.join(iosRoot, entry.name);
|
|
11046
12045
|
return workspaceReferences(workspace).map((xcodeproj2) => ({
|
|
11047
12046
|
xcodeproj: xcodeproj2,
|
|
11048
12047
|
workspace
|
|
11049
12048
|
}));
|
|
11050
12049
|
}).filter(
|
|
11051
|
-
({ xcodeproj: xcodeproj2 }) => xcodeproj2.endsWith(".xcodeproj") && !xcodeproj2.split(
|
|
12050
|
+
({ xcodeproj: xcodeproj2 }) => xcodeproj2.endsWith(".xcodeproj") && !xcodeproj2.split(import_node_path18.default.sep).includes("Pods") && import_node_fs18.default.existsSync(xcodeproj2)
|
|
11052
12051
|
).filter(
|
|
11053
12052
|
({ xcodeproj: xcodeproj2 }) => listXcodeAppTargets(xcodeproj2, { requireSources: false }).length > 0
|
|
11054
12053
|
)).map(({ xcodeproj: xcodeproj2, workspace }) => ({
|
|
11055
12054
|
xcodeproj: xcodeproj2,
|
|
11056
12055
|
workspace,
|
|
11057
|
-
name:
|
|
12056
|
+
name: import_node_path18.default.basename(xcodeproj2)
|
|
11058
12057
|
}));
|
|
11059
12058
|
if (projects.length === 0) return null;
|
|
11060
12059
|
if (projects.length > 1 && !iosTarget) {
|
|
@@ -11093,13 +12092,13 @@ function selectIosAppTarget(projectRoot, iosTarget) {
|
|
|
11093
12092
|
if (!target) throw new Error("native app identity has no iOS application target");
|
|
11094
12093
|
if (!iosTarget) {
|
|
11095
12094
|
const workspace = xcodeproj.replace(/\.xcodeproj$/, ".xcworkspace");
|
|
11096
|
-
const container =
|
|
12095
|
+
const container = import_node_fs18.default.existsSync(workspace) ? workspace : xcodeproj;
|
|
11097
12096
|
const hasScheme = [container, xcodeproj].some((dir) => {
|
|
11098
|
-
if (
|
|
12097
|
+
if (import_node_fs18.default.existsSync(import_node_path18.default.join(dir, "xcshareddata", "xcschemes", `${target}.xcscheme`)))
|
|
11099
12098
|
return true;
|
|
11100
|
-
const users =
|
|
11101
|
-
return
|
|
11102
|
-
(user) =>
|
|
12099
|
+
const users = import_node_path18.default.join(dir, "xcuserdata");
|
|
12100
|
+
return import_node_fs18.default.existsSync(users) && import_node_fs18.default.readdirSync(users).some(
|
|
12101
|
+
(user) => import_node_fs18.default.existsSync(import_node_path18.default.join(users, user, "xcschemes", `${target}.xcscheme`))
|
|
11103
12102
|
);
|
|
11104
12103
|
});
|
|
11105
12104
|
if (hasScheme) target = readXcodeScheme(container, target).target;
|
|
@@ -11110,8 +12109,8 @@ function selectIosAppTarget(projectRoot, iosTarget) {
|
|
|
11110
12109
|
);
|
|
11111
12110
|
return { xcodeproj, target, workspace: project.workspace };
|
|
11112
12111
|
}
|
|
11113
|
-
var workspaceResolvedFile = (xcodeprojOrWorkspace) =>
|
|
11114
|
-
xcodeprojOrWorkspace.endsWith(".xcworkspace") ? xcodeprojOrWorkspace :
|
|
12112
|
+
var workspaceResolvedFile = (xcodeprojOrWorkspace) => import_node_path18.default.join(
|
|
12113
|
+
xcodeprojOrWorkspace.endsWith(".xcworkspace") ? xcodeprojOrWorkspace : import_node_path18.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
|
|
11115
12114
|
"xcshareddata",
|
|
11116
12115
|
"swiftpm",
|
|
11117
12116
|
"Package.resolved"
|
|
@@ -11126,7 +12125,7 @@ var SwiftPackageResolutionRequired = class extends Error {
|
|
|
11126
12125
|
}
|
|
11127
12126
|
};
|
|
11128
12127
|
function readXcodeAppTarget(input, targetName, configurationName, options = {}) {
|
|
11129
|
-
const xcodeprojOrWorkspace =
|
|
12128
|
+
const xcodeprojOrWorkspace = import_node_fs18.default.realpathSync.native(input);
|
|
11130
12129
|
const workspace = xcodeprojOrWorkspace.endsWith(".xcworkspace") ? xcodeprojOrWorkspace : null;
|
|
11131
12130
|
const { listed, projects, projectAt, cocoapods } = workspaceProjects(
|
|
11132
12131
|
xcodeprojOrWorkspace,
|
|
@@ -11135,7 +12134,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11135
12134
|
const allTargets = projects.flatMap(projectTargets);
|
|
11136
12135
|
const appTargets = allTargets.filter((ref) => isIosAppTarget(ref, options));
|
|
11137
12136
|
const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
|
|
11138
|
-
const container =
|
|
12137
|
+
const container = import_node_path18.default.basename(xcodeprojOrWorkspace);
|
|
11139
12138
|
const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
|
|
11140
12139
|
if (named.length !== 1) {
|
|
11141
12140
|
if (appTargets.length === 0)
|
|
@@ -11156,15 +12155,15 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11156
12155
|
for (const ref of allTargets) {
|
|
11157
12156
|
const product = ref.project.object(str(ref.target.productReference));
|
|
11158
12157
|
const file = str(product?.path);
|
|
11159
|
-
if (file && !byProduct.has(
|
|
11160
|
-
byProduct.set(
|
|
12158
|
+
if (file && !byProduct.has(import_node_path18.default.basename(file)))
|
|
12159
|
+
byProduct.set(import_node_path18.default.basename(file), ref);
|
|
11161
12160
|
}
|
|
11162
12161
|
const proxied = (project, proxyId) => {
|
|
11163
12162
|
const proxy = project.object(proxyId);
|
|
11164
12163
|
if (proxy?.isa !== "PBXContainerItemProxy") return void 0;
|
|
11165
12164
|
const portal = str(proxy.containerPortal);
|
|
11166
12165
|
const portalPath = project.resolvePath(portal ?? "");
|
|
11167
|
-
const owner = project.object(portal)?.isa === "PBXProject" ? project : portalPath &&
|
|
12166
|
+
const owner = project.object(portal)?.isa === "PBXProject" ? project : portalPath && import_node_fs18.default.existsSync(portalPath) ? projectAt.get(import_node_fs18.default.realpathSync.native(portalPath)) : void 0;
|
|
11168
12167
|
const remote = str(proxy.remoteGlobalIDString);
|
|
11169
12168
|
if (!owner || !remote) return void 0;
|
|
11170
12169
|
return projectTargets(owner).find(
|
|
@@ -11181,7 +12180,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11181
12180
|
const buildFile = project.object(buildFileId);
|
|
11182
12181
|
if (!buildFile || !xcodeBuildFileBuildsForIos(buildFile)) continue;
|
|
11183
12182
|
const file = project.object(str(buildFile.fileRef));
|
|
11184
|
-
const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(
|
|
12183
|
+
const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path18.default.basename(str(file.path) ?? "")) : void 0;
|
|
11185
12184
|
if (resolved)
|
|
11186
12185
|
found.push({
|
|
11187
12186
|
target: resolved,
|
|
@@ -11265,8 +12264,8 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11265
12264
|
ref.project.visitMembers(
|
|
11266
12265
|
ref.id,
|
|
11267
12266
|
ref.project.resolvePath,
|
|
11268
|
-
(file) => isDirectory(file) ? walkFiles(file) :
|
|
11269
|
-
|
|
12267
|
+
(file) => isDirectory(file) ? walkFiles(file) : import_node_fs18.default.existsSync(file) ? [file] : [],
|
|
12268
|
+
import_node_path18.default.join,
|
|
11270
12269
|
(file, kind) => {
|
|
11271
12270
|
if (kind === "header") found.push(file);
|
|
11272
12271
|
}
|
|
@@ -11282,12 +12281,12 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11282
12281
|
for (const ref of projectTargets(project)) {
|
|
11283
12282
|
const product = productName(ref);
|
|
11284
12283
|
for (const { file, visibility } of headerPhase(ref)) {
|
|
11285
|
-
const name2 =
|
|
12284
|
+
const name2 = import_node_path18.default.basename(file);
|
|
11286
12285
|
if (!entries.has(name2))
|
|
11287
12286
|
entries.set(name2, visibility !== "Project" ? `${product}/${name2}` : file);
|
|
11288
12287
|
}
|
|
11289
12288
|
for (const file of synchronizedHeaders(ref)) {
|
|
11290
|
-
const name2 =
|
|
12289
|
+
const name2 = import_node_path18.default.basename(file);
|
|
11291
12290
|
if (!entries.has(name2)) entries.set(name2, file);
|
|
11292
12291
|
}
|
|
11293
12292
|
}
|
|
@@ -11297,7 +12296,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11297
12296
|
if (folder === null) continue;
|
|
11298
12297
|
for (const file of walkFiles(folder)) {
|
|
11299
12298
|
if (!HEADER_FILE.test(file)) continue;
|
|
11300
|
-
const name2 =
|
|
12299
|
+
const name2 = import_node_path18.default.basename(file);
|
|
11301
12300
|
if (!entries.has(name2)) entries.set(name2, file);
|
|
11302
12301
|
}
|
|
11303
12302
|
}
|
|
@@ -11305,18 +12304,18 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11305
12304
|
for (const id of Object.keys(project.objects)) {
|
|
11306
12305
|
if (project.object(id)?.isa !== "PBXFileReference") continue;
|
|
11307
12306
|
const file = project.resolvePath(id);
|
|
11308
|
-
if (file && HEADER_FILE.test(file) && !entries.has(
|
|
11309
|
-
entries.set(
|
|
12307
|
+
if (file && HEADER_FILE.test(file) && !entries.has(import_node_path18.default.basename(file)))
|
|
12308
|
+
entries.set(import_node_path18.default.basename(file), file);
|
|
11310
12309
|
}
|
|
11311
12310
|
const map2 = [...entries];
|
|
11312
12311
|
projectHeaderMaps.set(project, map2);
|
|
11313
12312
|
return map2;
|
|
11314
12313
|
};
|
|
11315
12314
|
const xcconfigs = /* @__PURE__ */ new Set();
|
|
11316
|
-
const buildDir = (project) =>
|
|
12315
|
+
const buildDir = (project) => import_node_path18.default.join(project.projectDir, ".build/peach-xcode/Build");
|
|
11317
12316
|
const workspaceBuild = {
|
|
11318
|
-
SYMROOT:
|
|
11319
|
-
OBJROOT:
|
|
12317
|
+
SYMROOT: import_node_path18.default.join(buildDir(app.project), "Products"),
|
|
12318
|
+
OBJROOT: import_node_path18.default.join(buildDir(app.project), "Intermediates.noindex")
|
|
11320
12319
|
};
|
|
11321
12320
|
const moduleTarget = (ref) => {
|
|
11322
12321
|
const name2 = str(ref.target.name) ?? ref.id;
|
|
@@ -11331,16 +12330,16 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11331
12330
|
TARGET_NAME: name2,
|
|
11332
12331
|
TARGETNAME: "$(TARGET_NAME)",
|
|
11333
12332
|
PROJECT: "$(PROJECT_NAME)",
|
|
11334
|
-
PROJECT_NAME:
|
|
12333
|
+
PROJECT_NAME: import_node_path18.default.basename(ref.project.xcodeproj, ".xcodeproj"),
|
|
11335
12334
|
PROJECT_CLASS_PREFIX: isDict(ref.project.project.attributes) ? str(ref.project.project.attributes.CLASSPREFIX) ?? "" : "",
|
|
11336
12335
|
PROJECT_FILE_PATH: ref.project.xcodeproj,
|
|
11337
12336
|
SRCROOT: ref.project.projectDir,
|
|
11338
12337
|
SOURCE_ROOT: ref.project.projectDir,
|
|
11339
12338
|
PROJECT_DIR: ref.project.projectDir,
|
|
11340
|
-
SYMROOT:
|
|
12339
|
+
SYMROOT: import_node_path18.default.join(buildDir(ref.project), "Products"),
|
|
11341
12340
|
BUILD_DIR: "$(SYMROOT)",
|
|
11342
12341
|
BUILD_ROOT: "$(SYMROOT)",
|
|
11343
|
-
OBJROOT:
|
|
12342
|
+
OBJROOT: import_node_path18.default.join(buildDir(ref.project), "Intermediates.noindex"),
|
|
11344
12343
|
CONFIGURATION_BUILD_DIR: "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)",
|
|
11345
12344
|
BUILT_PRODUCTS_DIR: "$(CONFIGURATION_BUILD_DIR)",
|
|
11346
12345
|
TARGET_BUILD_DIR: "$(CONFIGURATION_BUILD_DIR)",
|
|
@@ -11382,7 +12381,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11382
12381
|
xcconfigs
|
|
11383
12382
|
);
|
|
11384
12383
|
const searchRules = recursiveSearchRules(settings2);
|
|
11385
|
-
const absolute = (file) =>
|
|
12384
|
+
const absolute = (file) => import_node_path18.default.resolve(ref.project.projectDir, file);
|
|
11386
12385
|
const framework = FRAMEWORK_PRODUCTS.has(str(ref.target.productType) ?? "");
|
|
11387
12386
|
const product = settings2("PRODUCT_NAME");
|
|
11388
12387
|
const moduleName = applyOperator(settings2("PRODUCT_MODULE_NAME"), "c99extidentifier");
|
|
@@ -11413,7 +12412,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11413
12412
|
`${name2}: Swift compatibility header phase has no Swift producer sources`
|
|
11414
12413
|
);
|
|
11415
12414
|
const building = options.prepareGeneratedSources && options.requireSources !== false;
|
|
11416
|
-
const versioning = building && allSources.length > 0 && settings2("VERSIONING_SYSTEM") === "apple-generic" ?
|
|
12415
|
+
const versioning = building && allSources.length > 0 && settings2("VERSIONING_SYSTEM") === "apple-generic" ? import_node_path18.default.join(settings2("DERIVED_FILE_DIR"), `${product}_vers.c`) : null;
|
|
11417
12416
|
if (versioning) {
|
|
11418
12417
|
const version = settings2("CURRENT_PROJECT_VERSION");
|
|
11419
12418
|
const custom = [
|
|
@@ -11426,7 +12425,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11426
12425
|
].filter((key) => settings2(key));
|
|
11427
12426
|
if (custom.length)
|
|
11428
12427
|
throw new Error(
|
|
11429
|
-
`${name2}: Xcode generates ${
|
|
12428
|
+
`${name2}: Xcode generates ${import_node_path18.default.basename(versioning)} with ${custom.join(", ")}; peach does not model VERSION_INFO_* overrides`
|
|
11430
12429
|
);
|
|
11431
12430
|
const symbol = product.replace(/^[^A-Za-z_]/, "_").replace(/[^A-Za-z0-9_]/g, "_");
|
|
11432
12431
|
const [major, minor] = version.split(".");
|
|
@@ -11439,9 +12438,9 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11439
12438
|
` const double ${symbol}VersionNumber __attribute__ ((used)) = (double)${number2};`,
|
|
11440
12439
|
""
|
|
11441
12440
|
].join("\n");
|
|
11442
|
-
if (!
|
|
11443
|
-
|
|
11444
|
-
|
|
12441
|
+
if (!import_node_fs18.default.existsSync(versioning) || import_node_fs18.default.readFileSync(versioning, "utf8") !== unit) {
|
|
12442
|
+
import_node_fs18.default.mkdirSync(import_node_path18.default.dirname(versioning), { recursive: true });
|
|
12443
|
+
import_node_fs18.default.writeFileSync(versioning, unit);
|
|
11445
12444
|
}
|
|
11446
12445
|
allSources.push(versioning);
|
|
11447
12446
|
}
|
|
@@ -11460,7 +12459,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11460
12459
|
const headerFiles = headerPhase(ref);
|
|
11461
12460
|
const ownHeaders = /* @__PURE__ */ new Map();
|
|
11462
12461
|
for (const { file, visibility } of headerFiles) {
|
|
11463
|
-
const name3 =
|
|
12462
|
+
const name3 = import_node_path18.default.basename(file);
|
|
11464
12463
|
const published = visibility !== "Project";
|
|
11465
12464
|
if (!ownHeaders.has(name3))
|
|
11466
12465
|
ownHeaders.set(name3, published ? `${product}/${name3}` : file);
|
|
@@ -11468,7 +12467,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11468
12467
|
ownHeaders.set(`${product}/${name3}`, file);
|
|
11469
12468
|
}
|
|
11470
12469
|
for (const file of synchronizedHeaders(ref)) {
|
|
11471
|
-
const name3 =
|
|
12470
|
+
const name3 = import_node_path18.default.basename(file);
|
|
11472
12471
|
if (ownHeaders.has(name3)) continue;
|
|
11473
12472
|
ownHeaders.set(name3, file);
|
|
11474
12473
|
const qualified = `${product}/${name3}`;
|
|
@@ -11480,24 +12479,24 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11480
12479
|
const otherProduct = productName(other);
|
|
11481
12480
|
for (const { file, visibility } of headerPhase(other)) {
|
|
11482
12481
|
if (visibility === "Project") continue;
|
|
11483
|
-
const key = `${otherProduct}/${
|
|
12482
|
+
const key = `${otherProduct}/${import_node_path18.default.basename(file)}`;
|
|
11484
12483
|
if (!nonFrameworkHeaders.has(key)) nonFrameworkHeaders.set(key, file);
|
|
11485
12484
|
}
|
|
11486
12485
|
}
|
|
11487
|
-
const wrapper =
|
|
12486
|
+
const wrapper = import_node_path18.default.join(settings2("BUILT_PRODUCTS_DIR"), `${product}.framework`);
|
|
11488
12487
|
const moduleMap = (settings2("DEFINES_MODULE") === "YES" || !framework) && settings2("MODULEMAP_FILE") ? absolute(settings2("MODULEMAP_FILE")) : null;
|
|
11489
|
-
const frameworkUmbrella = !compatibility && framework && members.sources.length > 0 && moduleMap ?
|
|
11490
|
-
const frameworkCompatibility = frameworkUmbrella && moduleMap &&
|
|
12488
|
+
const frameworkUmbrella = !compatibility && framework && members.sources.length > 0 && moduleMap ? import_node_path18.default.join(import_node_path18.default.dirname(moduleMap), `${moduleName}-umbrella.h`) : null;
|
|
12489
|
+
const frameworkCompatibility = frameworkUmbrella && moduleMap && import_node_fs18.default.existsSync(moduleMap) && import_node_fs18.default.existsSync(frameworkUmbrella) ? {
|
|
11491
12490
|
framework: true,
|
|
11492
12491
|
moduleMap,
|
|
11493
12492
|
umbrella: frameworkUmbrella,
|
|
11494
|
-
outputModuleMap:
|
|
11495
|
-
outputUmbrella:
|
|
12493
|
+
outputModuleMap: import_node_path18.default.join(wrapper, "Modules", "module.modulemap"),
|
|
12494
|
+
outputUmbrella: import_node_path18.default.join(
|
|
11496
12495
|
wrapper,
|
|
11497
12496
|
"Headers",
|
|
11498
|
-
|
|
12497
|
+
import_node_path18.default.basename(frameworkUmbrella)
|
|
11499
12498
|
),
|
|
11500
|
-
outputHeader:
|
|
12499
|
+
outputHeader: import_node_path18.default.join(
|
|
11501
12500
|
wrapper,
|
|
11502
12501
|
"Headers",
|
|
11503
12502
|
settings2("SWIFT_OBJC_INTERFACE_HEADER_NAME") || `${moduleName}-Swift.h`
|
|
@@ -11511,10 +12510,10 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11511
12510
|
outputUmbrella: compatibility.outputUmbrella,
|
|
11512
12511
|
outputHeader: compatibility.outputHeader
|
|
11513
12512
|
} : frameworkCompatibility;
|
|
11514
|
-
const podHeaders = !framework && isPodsProject(ref.project.xcodeproj) && moduleMap &&
|
|
12513
|
+
const podHeaders = !framework && isPodsProject(ref.project.xcodeproj) && moduleMap && import_node_path18.default.relative(import_node_path18.default.join(ref.project.projectDir, "Headers", "Public"), moduleMap).split(import_node_path18.default.sep)[0] !== ".." && import_node_fs18.default.existsSync(moduleMap) ? import_node_fs18.default.readdirSync(import_node_path18.default.dirname(moduleMap)).flatMap((entry) => {
|
|
11515
12514
|
if (!/\.(h|hh|hpp|hxx|modulemap)$/.test(entry)) return [];
|
|
11516
|
-
const file =
|
|
11517
|
-
return
|
|
12515
|
+
const file = import_node_path18.default.join(import_node_path18.default.dirname(moduleMap), entry);
|
|
12516
|
+
return import_node_fs18.default.existsSync(file) ? [file] : [];
|
|
11518
12517
|
}) : [];
|
|
11519
12518
|
const fileFlags = {};
|
|
11520
12519
|
for (const phaseId of list(ref.target.buildPhases)) {
|
|
@@ -11589,15 +12588,15 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11589
12588
|
// xcode searches its products' include directory before
|
|
11590
12589
|
// HEADER_SEARCH_PATHS and the target's derived sources after.
|
|
11591
12590
|
headerSearchPaths: [
|
|
11592
|
-
|
|
12591
|
+
import_node_path18.default.join(settings2("BUILT_PRODUCTS_DIR"), "include"),
|
|
11593
12592
|
...settingList(settings2("HEADER_SEARCH_PATHS")).flatMap(
|
|
11594
12593
|
(raw) => expandSearchPath(absolute(raw), searchRules)
|
|
11595
12594
|
),
|
|
11596
|
-
|
|
12595
|
+
import_node_path18.default.join(
|
|
11597
12596
|
`${settings2("DERIVED_FILE_DIR")}-normal`,
|
|
11598
12597
|
settings2("CURRENT_ARCH")
|
|
11599
12598
|
),
|
|
11600
|
-
|
|
12599
|
+
import_node_path18.default.join(settings2("DERIVED_FILE_DIR"), settings2("CURRENT_ARCH")),
|
|
11601
12600
|
settings2("DERIVED_FILE_DIR")
|
|
11602
12601
|
],
|
|
11603
12602
|
userHeaderSearchPaths: settingList(
|
|
@@ -11647,10 +12646,10 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11647
12646
|
...headerFiles.flatMap(
|
|
11648
12647
|
({ file, visibility }) => visibility === "Project" ? [] : [
|
|
11649
12648
|
[
|
|
11650
|
-
|
|
12649
|
+
import_node_path18.default.join(
|
|
11651
12650
|
wrapper,
|
|
11652
12651
|
visibility === "Public" ? "Headers" : "PrivateHeaders",
|
|
11653
|
-
|
|
12652
|
+
import_node_path18.default.basename(file)
|
|
11654
12653
|
),
|
|
11655
12654
|
file
|
|
11656
12655
|
]
|
|
@@ -11664,7 +12663,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11664
12663
|
return [];
|
|
11665
12664
|
const destination = expand(
|
|
11666
12665
|
str(phase.dstPath) ?? "",
|
|
11667
|
-
(name3) => name3 === "PUBLIC_HEADERS_FOLDER_PATH" ?
|
|
12666
|
+
(name3) => name3 === "PUBLIC_HEADERS_FOLDER_PATH" ? import_node_path18.default.join(wrapper, "Headers") : name3 === "PRIVATE_HEADERS_FOLDER_PATH" ? import_node_path18.default.join(wrapper, "PrivateHeaders") : settings2(name3)
|
|
11668
12667
|
);
|
|
11669
12668
|
return list(phase.files).flatMap((id) => {
|
|
11670
12669
|
const file = ref.project.resolvePath(
|
|
@@ -11672,17 +12671,17 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11672
12671
|
);
|
|
11673
12672
|
return file && HEADER_FILE.test(file) ? [
|
|
11674
12673
|
[
|
|
11675
|
-
|
|
12674
|
+
import_node_path18.default.resolve(
|
|
11676
12675
|
settings2("BUILT_PRODUCTS_DIR"),
|
|
11677
12676
|
destination,
|
|
11678
|
-
|
|
12677
|
+
import_node_path18.default.basename(file)
|
|
11679
12678
|
),
|
|
11680
12679
|
file
|
|
11681
12680
|
]
|
|
11682
12681
|
] : [];
|
|
11683
12682
|
});
|
|
11684
12683
|
}),
|
|
11685
|
-
...moduleMap ? [[
|
|
12684
|
+
...moduleMap ? [[import_node_path18.default.join(wrapper, "Modules", "module.modulemap"), moduleMap]] : []
|
|
11686
12685
|
]) : Object.fromEntries([
|
|
11687
12686
|
...podHeaders.map((file) => [file, file]),
|
|
11688
12687
|
...moduleMap ? [[moduleMap, moduleMap]] : []
|
|
@@ -11714,7 +12713,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11714
12713
|
const frameworkTargets = selectedTargets.filter((target) => target !== builtTargets.at(-1)).filter(({ ref }) => MODULE_PRODUCTS.has(str(ref.target.productType) ?? "")).map(({ ref, module: module3 }) => ({ ref, framework: module3 }));
|
|
11715
12714
|
const frameworks = frameworkTargets.map(({ framework }) => framework);
|
|
11716
12715
|
const podSourceDirs = builtTargets.slice(0, -1).flatMap(
|
|
11717
|
-
({ ref, module: module3 }) => isPodsProject(ref.project.xcodeproj) ? [...module3.allSources, ...module3.objc?.headers ?? []].map((file) =>
|
|
12716
|
+
({ ref, module: module3 }) => isPodsProject(ref.project.xcodeproj) ? [...module3.allSources, ...module3.objc?.headers ?? []].map((file) => import_node_path18.default.dirname(file)).filter((dir) => import_node_fs18.default.existsSync(dir)) : []
|
|
11718
12717
|
);
|
|
11719
12718
|
const expandValue = (value, settings2) => {
|
|
11720
12719
|
if (typeof value === "string") return expand(value, settings2);
|
|
@@ -11735,7 +12734,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11735
12734
|
const phase = owner.ref.project.object(phaseId);
|
|
11736
12735
|
if (phase?.isa !== "PBXShellScriptBuildPhase" || str(phase.name) !== "[CP] Copy Pods Resources")
|
|
11737
12736
|
continue;
|
|
11738
|
-
const absolute = (raw) =>
|
|
12737
|
+
const absolute = (raw) => import_node_path18.default.resolve(owner.ref.project.projectDir, expand(raw, owner.settings));
|
|
11739
12738
|
const entries = (paths) => paths.flatMap((raw) => {
|
|
11740
12739
|
const file = absolute(raw);
|
|
11741
12740
|
xcconfigs.add(file);
|
|
@@ -11751,7 +12750,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11751
12750
|
].filter((file) => file.endsWith(".bundle"));
|
|
11752
12751
|
if (inputs.length !== outputs.length)
|
|
11753
12752
|
throw new Error(`${owner.module.name}: resource bundle copy lists differ`);
|
|
11754
|
-
const destinationRoot =
|
|
12753
|
+
const destinationRoot = import_node_path18.default.join(
|
|
11755
12754
|
owner.settings("TARGET_BUILD_DIR"),
|
|
11756
12755
|
owner.settings("UNLOCALIZED_RESOURCES_FOLDER_PATH")
|
|
11757
12756
|
);
|
|
@@ -11760,24 +12759,24 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11760
12759
|
const file = str(
|
|
11761
12760
|
target.ref.project.object(str(target.ref.target.productReference))?.path
|
|
11762
12761
|
);
|
|
11763
|
-
return file &&
|
|
12762
|
+
return file && import_node_path18.default.join(target.settings("TARGET_BUILD_DIR"), file) === input2;
|
|
11764
12763
|
});
|
|
11765
12764
|
if (!product && !isDirectory(input2))
|
|
11766
12765
|
throw new Error(
|
|
11767
12766
|
`${owner.module.name}: resource bundle input has no selected producer: ${input2}`
|
|
11768
12767
|
);
|
|
11769
|
-
const destination =
|
|
11770
|
-
if (destination === ".." || destination.startsWith(`..${
|
|
12768
|
+
const destination = import_node_path18.default.relative(destinationRoot, outputs[index]);
|
|
12769
|
+
if (destination === ".." || destination.startsWith(`..${import_node_path18.default.sep}`) || import_node_path18.default.isAbsolute(destination) || import_node_path18.default.basename(input2) !== import_node_path18.default.basename(destination))
|
|
11771
12770
|
throw new Error(
|
|
11772
12771
|
`${owner.module.name}: invalid resource bundle copy destination`
|
|
11773
12772
|
);
|
|
11774
|
-
const infoFile = product ?
|
|
12773
|
+
const infoFile = product ? import_node_path18.default.resolve(
|
|
11775
12774
|
product.ref.project.projectDir,
|
|
11776
12775
|
product.settings("INFOPLIST_FILE")
|
|
11777
12776
|
) : null;
|
|
11778
12777
|
if (infoFile) xcconfigs.add(infoFile);
|
|
11779
12778
|
const prefix2 = owner.ref === app ? "" : `Frameworks/${owner.module.moduleName}.framework/`;
|
|
11780
|
-
const bundlePath = prefix2 + destination.split(
|
|
12779
|
+
const bundlePath = prefix2 + destination.split(import_node_path18.default.sep).join("/");
|
|
11781
12780
|
if (resourceProducts.some((resource) => resource.path === bundlePath))
|
|
11782
12781
|
throw new Error(
|
|
11783
12782
|
`${owner.module.name}: duplicate resource bundle destination ${bundlePath}`
|
|
@@ -11788,22 +12787,22 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11788
12787
|
resources: product.module.resources,
|
|
11789
12788
|
infoPlist: import_plist2.default.build(
|
|
11790
12789
|
expandValue(
|
|
11791
|
-
import_plist2.default.parse(
|
|
12790
|
+
import_plist2.default.parse(import_node_fs18.default.readFileSync(infoFile, "utf8")),
|
|
11792
12791
|
product.settings
|
|
11793
12792
|
)
|
|
11794
12793
|
)
|
|
11795
12794
|
} : {
|
|
11796
|
-
resources:
|
|
12795
|
+
resources: import_node_fs18.default.readdirSync(input2, { recursive: true, withFileTypes: true }).filter((entry) => entry.isFile()).map((entry) => import_node_path18.default.join(entry.parentPath, entry.name)).sort(),
|
|
11797
12796
|
sourceRoot: input2
|
|
11798
12797
|
}
|
|
11799
12798
|
});
|
|
11800
12799
|
}
|
|
11801
12800
|
}
|
|
11802
12801
|
}
|
|
11803
|
-
const infoPlistFile = settings("INFOPLIST_FILE") ?
|
|
11804
|
-
const entitlementsFile = settings("CODE_SIGN_ENTITLEMENTS") ?
|
|
12802
|
+
const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path18.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
|
|
12803
|
+
const entitlementsFile = settings("CODE_SIGN_ENTITLEMENTS") ? import_node_path18.default.resolve(app.project.projectDir, settings("CODE_SIGN_ENTITLEMENTS")) : null;
|
|
11805
12804
|
const infoPlistPending = module2.generatedInfoPlist && !options.prepareGeneratedSources;
|
|
11806
|
-
const sourceInfo = infoPlistFile && !infoPlistPending ? import_plist2.default.parse(
|
|
12805
|
+
const sourceInfo = infoPlistFile && !infoPlistPending ? import_plist2.default.parse(import_node_fs18.default.readFileSync(infoPlistFile, "utf8")) : {};
|
|
11807
12806
|
if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
|
|
11808
12807
|
throw new Error(`${module2.name} Info.plist must contain a dictionary`);
|
|
11809
12808
|
}
|
|
@@ -11827,7 +12826,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11827
12826
|
}
|
|
11828
12827
|
const bundleIdentifier = settings("PRODUCT_BUNDLE_IDENTIFIER") || (typeof info.CFBundleIdentifier === "string" ? info.CFBundleIdentifier : "");
|
|
11829
12828
|
const keychainAccessGroups = entitlementsFile ? readKeychainAccessGroups(
|
|
11830
|
-
import_plist2.default.parse(
|
|
12829
|
+
import_plist2.default.parse(import_node_fs18.default.readFileSync(entitlementsFile, "utf8")),
|
|
11831
12830
|
(value) => expand(value, (key) => {
|
|
11832
12831
|
if (key === "AppIdentifierPrefix") return "FAKETEAMID.";
|
|
11833
12832
|
if (key === "TeamIdentifierPrefix") return "";
|
|
@@ -11863,7 +12862,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11863
12862
|
};
|
|
11864
12863
|
}
|
|
11865
12864
|
const localPackageDirs = [
|
|
11866
|
-
...listed.filter((reference) =>
|
|
12865
|
+
...listed.filter((reference) => import_node_fs18.default.existsSync(import_node_path18.default.join(reference, "Package.swift"))),
|
|
11867
12866
|
...projects.flatMap(
|
|
11868
12867
|
(project) => Object.entries(project.objects).flatMap(([id, entry]) => {
|
|
11869
12868
|
if (!isDict(entry)) return [];
|
|
@@ -11873,19 +12872,19 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11873
12872
|
const packages = [];
|
|
11874
12873
|
while (pending.length > 0) {
|
|
11875
12874
|
const dir = pending.pop();
|
|
11876
|
-
if (
|
|
12875
|
+
if (import_node_fs18.default.existsSync(import_node_path18.default.join(dir, "Package.swift"))) {
|
|
11877
12876
|
packages.push(dir);
|
|
11878
12877
|
continue;
|
|
11879
12878
|
}
|
|
11880
12879
|
if (!isDirectory(dir)) continue;
|
|
11881
|
-
for (const child of
|
|
12880
|
+
for (const child of import_node_fs18.default.readdirSync(dir, { withFileTypes: true }))
|
|
11882
12881
|
if (child.isDirectory() && !child.name.startsWith("."))
|
|
11883
|
-
pending.push(
|
|
12882
|
+
pending.push(import_node_path18.default.join(dir, child.name));
|
|
11884
12883
|
}
|
|
11885
12884
|
return packages;
|
|
11886
12885
|
}
|
|
11887
|
-
const candidate = entry.isa === "XCLocalSwiftPackageReference" ?
|
|
11888
|
-
return candidate &&
|
|
12886
|
+
const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path18.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
|
|
12887
|
+
return candidate && import_node_fs18.default.existsSync(import_node_path18.default.join(candidate, "Package.swift")) ? [candidate] : [];
|
|
11889
12888
|
})
|
|
11890
12889
|
)
|
|
11891
12890
|
];
|
|
@@ -11915,7 +12914,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11915
12914
|
if ((flag === "-framework" || flag === "-weak_framework") && name2)
|
|
11916
12915
|
sdkFrameworks.add(name2);
|
|
11917
12916
|
});
|
|
11918
|
-
const absolute = (raw) =>
|
|
12917
|
+
const absolute = (raw) => import_node_path18.default.resolve(ref.project.projectDir, expand(raw, settings2));
|
|
11919
12918
|
const requested = options.nativeModules;
|
|
11920
12919
|
const includeBinary = (name2, dir) => {
|
|
11921
12920
|
if (!requested || nativeTargets.has(ref) || requested.includes(name2) || dir.endsWith(".xcframework") && localSwiftBinaryModules(dir).some((module3) => requested.includes(module3)))
|
|
@@ -11927,14 +12926,14 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11927
12926
|
for (const directory of expandSearchPath(absolute(raw), searchRules)) {
|
|
11928
12927
|
if (frameworkSearchDirectories.has(directory)) continue;
|
|
11929
12928
|
frameworkSearchDirectories.add(directory);
|
|
11930
|
-
if (!
|
|
12929
|
+
if (!import_node_fs18.default.statSync(directory, { throwIfNoEntry: false })?.isDirectory() || /\.sdk\/(?:System|Developer)\/Library\/Frameworks\/?$/.test(directory))
|
|
11931
12930
|
continue;
|
|
11932
|
-
for (const entry of
|
|
12931
|
+
for (const entry of import_node_fs18.default.readdirSync(directory, { withFileTypes: true })) {
|
|
11933
12932
|
const name2 = /^(.+)\.framework$/.exec(entry.name)?.[1];
|
|
11934
12933
|
if (!name2 || byProduct.has(entry.name) || searchedFrameworks.has(name2))
|
|
11935
12934
|
continue;
|
|
11936
|
-
const file =
|
|
11937
|
-
if (
|
|
12935
|
+
const file = import_node_path18.default.join(directory, entry.name);
|
|
12936
|
+
if (import_node_fs18.default.statSync(file, { throwIfNoEntry: false })?.isDirectory())
|
|
11938
12937
|
searchedFrameworks.set(name2, file);
|
|
11939
12938
|
}
|
|
11940
12939
|
}
|
|
@@ -11942,9 +12941,9 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11942
12941
|
}
|
|
11943
12942
|
for (const raw of settingList(settings2("SWIFT_INCLUDE_PATHS"))) {
|
|
11944
12943
|
const dir = absolute(raw);
|
|
11945
|
-
const modulemap =
|
|
11946
|
-
if (!
|
|
11947
|
-
const name2 = moduleMapName(
|
|
12944
|
+
const modulemap = import_node_path18.default.join(dir, "module.modulemap");
|
|
12945
|
+
if (!import_node_fs18.default.existsSync(modulemap)) continue;
|
|
12946
|
+
const name2 = moduleMapName(import_node_fs18.default.readFileSync(modulemap, "utf8"));
|
|
11948
12947
|
if (name2 && !binaryFrameworks.has(name2)) includeBinary(name2, dir);
|
|
11949
12948
|
}
|
|
11950
12949
|
for (const phaseId of list(ref.target.buildPhases)) {
|
|
@@ -11953,7 +12952,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11953
12952
|
const inputs = list(phase.inputPaths).map(absolute);
|
|
11954
12953
|
for (const raw of list(phase.inputFileListPaths)) {
|
|
11955
12954
|
const file = absolute(raw);
|
|
11956
|
-
if (!
|
|
12955
|
+
if (!import_node_fs18.default.existsSync(file)) continue;
|
|
11957
12956
|
xcconfigs.add(file);
|
|
11958
12957
|
inputs.push(...fileListEntries(file, absolute));
|
|
11959
12958
|
}
|
|
@@ -12018,7 +13017,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
12018
13017
|
...productAttributes.get(dependencyId)?.length ? { attributes: productAttributes.get(dependencyId) } : {},
|
|
12019
13018
|
source: reference?.isa === "XCRemoteSwiftPackageReference" ? { kind: "remote", url: str(reference.repositoryURL) ?? "" } : reference?.isa === "XCLocalSwiftPackageReference" ? {
|
|
12020
13019
|
kind: "local",
|
|
12021
|
-
dir:
|
|
13020
|
+
dir: import_node_path18.default.resolve(
|
|
12022
13021
|
project.projectDir,
|
|
12023
13022
|
str(reference.relativePath) ?? ""
|
|
12024
13023
|
)
|
|
@@ -12052,10 +13051,10 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
12052
13051
|
continue;
|
|
12053
13052
|
}
|
|
12054
13053
|
if (tree2 === "BUILT_PRODUCTS_DIR" || tree2 === "DEVELOPER_DIR" || // a target in the workspace builds it, so it exists only after that build
|
|
12055
|
-
byProduct.has(
|
|
13054
|
+
byProduct.has(import_node_path18.default.basename(rawPath)))
|
|
12056
13055
|
continue;
|
|
12057
13056
|
const resolved = fileId ? project.resolvePath(fileId) : null;
|
|
12058
|
-
if (fileId && resolved !== null && !
|
|
13057
|
+
if (fileId && resolved !== null && !import_node_fs18.default.existsSync(resolved))
|
|
12059
13058
|
throw new Error(
|
|
12060
13059
|
`${str(target.name) ?? "target"}: linked framework ${name2} (${fileId}) points at missing ${resolved} in ${project.projectFile}`
|
|
12061
13060
|
);
|
|
@@ -12078,7 +13077,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
12078
13077
|
({ product }) => !options.nativeModules || nativeTargets.has(built.ref) || options.nativeModules.includes(product)
|
|
12079
13078
|
);
|
|
12080
13079
|
const resolvedFile = workspaceResolvedFile(xcodeprojOrWorkspace);
|
|
12081
|
-
let packageResolved =
|
|
13080
|
+
let packageResolved = import_node_fs18.default.existsSync(resolvedFile) ? [import_node_fs18.default.realpathSync.native(resolvedFile)] : [...new Set(localPackageDirs.map((dir) => import_node_path18.default.join(dir, "Package.resolved")))].filter((file) => import_node_fs18.default.existsSync(file)).map((file) => import_node_fs18.default.realpathSync.native(file)).sort();
|
|
12082
13081
|
if (packageResolved.length === 0) {
|
|
12083
13082
|
const requirements = remotePackageRequirements(projects);
|
|
12084
13083
|
if (requirements.length > 0) {
|
|
@@ -12129,14 +13128,14 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
12129
13128
|
} : {},
|
|
12130
13129
|
rootDir: commonAncestor(
|
|
12131
13130
|
[
|
|
12132
|
-
workspace ?
|
|
13131
|
+
workspace ? import_node_path18.default.dirname(workspace) : app.project.projectDir,
|
|
12133
13132
|
...used.map((project) => project.projectDir),
|
|
12134
13133
|
...localPackageDirs,
|
|
12135
13134
|
...linkedProducts.flatMap(
|
|
12136
|
-
({ source }) => source.kind === "local" &&
|
|
13135
|
+
({ source }) => source.kind === "local" && import_node_fs18.default.existsSync(source.dir) ? [source.dir] : []
|
|
12137
13136
|
),
|
|
12138
13137
|
...new Set(podSourceDirs)
|
|
12139
|
-
].map((dir) =>
|
|
13138
|
+
].map((dir) => import_node_fs18.default.realpathSync.native(dir))
|
|
12140
13139
|
),
|
|
12141
13140
|
projectFiles: [
|
|
12142
13141
|
.../* @__PURE__ */ new Set([
|
|
@@ -12157,7 +13156,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
12157
13156
|
resourceProducts,
|
|
12158
13157
|
linkedProducts,
|
|
12159
13158
|
localPackageDirs: [
|
|
12160
|
-
...new Set(localPackageDirs.map((dir) =>
|
|
13159
|
+
...new Set(localPackageDirs.map((dir) => import_node_fs18.default.realpathSync.native(dir)))
|
|
12161
13160
|
].sort(),
|
|
12162
13161
|
binaryFrameworks: [...binaryFrameworks].map(([name2, file]) => ({ name: name2, path: file })).sort((left, right) => left.name.localeCompare(right.name)),
|
|
12163
13162
|
sdkFrameworks: [...sdkFrameworks].filter(
|
|
@@ -12189,13 +13188,13 @@ const result = JSON.stringify(getConfig(root, { skipSDKVersionRequirement: true
|
|
|
12189
13188
|
if (Buffer.byteLength(result) > 1024 * 1024) throw new Error('Expo native configuration exceeds 1 MiB.');
|
|
12190
13189
|
writeFileSync(process.argv[2], result, { mode: 0o600 });`;
|
|
12191
13190
|
function hasExpoConfig(projectRoot) {
|
|
12192
|
-
const appJsonPath =
|
|
12193
|
-
const appJson =
|
|
13191
|
+
const appJsonPath = import_node_path19.default.join(projectRoot, "app.json");
|
|
13192
|
+
const appJson = import_node_fs19.default.existsSync(appJsonPath) ? JSON.parse(import_node_fs19.default.readFileSync(appJsonPath, "utf8")) : null;
|
|
12194
13193
|
const staticExpo = isRecord(appJson) && (isRecord(appJson.expo) || [appJson.ios, appJson.android].some(
|
|
12195
13194
|
(value) => isRecord(value) && typeof value.googleServicesFile === "string"
|
|
12196
13195
|
));
|
|
12197
13196
|
return staticExpo || ["app.config.js", "app.config.ts", "app.config.cjs", "app.config.mjs"].some(
|
|
12198
|
-
(name2) =>
|
|
13197
|
+
(name2) => import_node_fs19.default.existsSync(import_node_path19.default.join(projectRoot, name2))
|
|
12199
13198
|
);
|
|
12200
13199
|
}
|
|
12201
13200
|
function expoConfigArgs(projectRoot, resultPath) {
|
|
@@ -12203,7 +13202,7 @@ function expoConfigArgs(projectRoot, resultPath) {
|
|
|
12203
13202
|
"--input-type=commonjs",
|
|
12204
13203
|
"-e",
|
|
12205
13204
|
EXPO_CONFIG_SCRIPT,
|
|
12206
|
-
|
|
13205
|
+
import_node_path19.default.resolve(projectRoot),
|
|
12207
13206
|
resultPath
|
|
12208
13207
|
];
|
|
12209
13208
|
}
|
|
@@ -12217,17 +13216,17 @@ function readExpoConfigResult(resultPath, status, signal, stderr) {
|
|
|
12217
13216
|
throw new Error(
|
|
12218
13217
|
stderr || (signal ? `Expo native configuration evaluation was killed by ${signal}.` : "Expo native configuration evaluation failed.")
|
|
12219
13218
|
);
|
|
12220
|
-
const resolved = JSON.parse(
|
|
13219
|
+
const resolved = JSON.parse(import_node_fs19.default.readFileSync(resultPath, "utf8"));
|
|
12221
13220
|
if (!isRecord(resolved)) throw new Error("Expo native configuration is unavailable.");
|
|
12222
13221
|
return resolved;
|
|
12223
13222
|
}
|
|
12224
|
-
var resultDirectory = () =>
|
|
13223
|
+
var resultDirectory = () => import_node_fs19.default.mkdtempSync(import_node_path19.default.join(import_node_os5.default.tmpdir(), "peach-expo-config-"));
|
|
12225
13224
|
function readExpoConfig(projectRoot) {
|
|
12226
13225
|
if (!hasExpoConfig(projectRoot)) return {};
|
|
12227
13226
|
const directory = resultDirectory();
|
|
12228
|
-
const resultPath =
|
|
13227
|
+
const resultPath = import_node_path19.default.join(directory, "config.json");
|
|
12229
13228
|
try {
|
|
12230
|
-
const child = (0,
|
|
13229
|
+
const child = (0, import_node_child_process10.spawnSync)("node", expoConfigArgs(projectRoot, resultPath), {
|
|
12231
13230
|
cwd: projectRoot,
|
|
12232
13231
|
encoding: "utf8",
|
|
12233
13232
|
stdio: ["ignore", "ignore", "pipe"],
|
|
@@ -12237,7 +13236,7 @@ function readExpoConfig(projectRoot) {
|
|
|
12237
13236
|
if (child.error) throw child.error;
|
|
12238
13237
|
return readExpoConfigResult(resultPath, child.status, child.signal, child.stderr);
|
|
12239
13238
|
} finally {
|
|
12240
|
-
|
|
13239
|
+
import_node_fs19.default.rmSync(directory, { recursive: true, force: true });
|
|
12241
13240
|
}
|
|
12242
13241
|
}
|
|
12243
13242
|
var HELPER_DEPTH = 3;
|
|
@@ -12285,7 +13284,7 @@ function splitClauses(condition) {
|
|
|
12285
13284
|
function findHelper(type, name2, label, sources) {
|
|
12286
13285
|
const found = [];
|
|
12287
13286
|
for (const file of sources) {
|
|
12288
|
-
const raw =
|
|
13287
|
+
const raw = import_node_fs19.default.readFileSync(file, "utf8");
|
|
12289
13288
|
const blank = blankSwiftObjcLiterals(raw);
|
|
12290
13289
|
if (file.endsWith(".swift") && label === void 0) {
|
|
12291
13290
|
const owners = type ? [
|
|
@@ -12371,7 +13370,7 @@ function evaluateSwiftBody(body, scope, depth) {
|
|
|
12371
13370
|
}
|
|
12372
13371
|
function evaluateObjcBody(body, bundle, constants, scope) {
|
|
12373
13372
|
const plists = scope.resources.filter(
|
|
12374
|
-
(file) =>
|
|
13373
|
+
(file) => import_node_path19.default.basename(file) === "GoogleService-Info.plist"
|
|
12375
13374
|
);
|
|
12376
13375
|
const variables = /* @__PURE__ */ new Map();
|
|
12377
13376
|
const literal2 = (text2) => {
|
|
@@ -12414,7 +13413,7 @@ function evaluateObjcBody(body, bundle, constants, scope) {
|
|
|
12414
13413
|
variables.set(name2, plists.length === 1 ? plists[0] : void 0);
|
|
12415
13414
|
} else if (dictionary && variables.has(dictionary[1])) {
|
|
12416
13415
|
const file = variables.get(dictionary[1]);
|
|
12417
|
-
const parsed = typeof file === "string" ? parsePlistSource(
|
|
13416
|
+
const parsed = typeof file === "string" ? parsePlistSource(import_node_fs19.default.readFileSync(file, "utf8")) : void 0;
|
|
12418
13417
|
variables.set(name2, isRecord(parsed) ? parsed : void 0);
|
|
12419
13418
|
} else if (entry && variables.has(entry[1])) {
|
|
12420
13419
|
const key = literal2(entry[2]);
|
|
@@ -12427,7 +13426,7 @@ function evaluateObjcBody(body, bundle, constants, scope) {
|
|
|
12427
13426
|
}
|
|
12428
13427
|
function evaluateClauses(clauses, scope, bound, depth) {
|
|
12429
13428
|
const sources = scope.resources.filter(
|
|
12430
|
-
(file) =>
|
|
13429
|
+
(file) => import_node_path19.default.basename(file) === "GoogleService-Info.plist"
|
|
12431
13430
|
);
|
|
12432
13431
|
for (const clause of clauses) {
|
|
12433
13432
|
if (clause === "true") continue;
|
|
@@ -12444,7 +13443,7 @@ function evaluateClauses(clauses, scope, bound, depth) {
|
|
|
12444
13443
|
const dictionary = /^let\s+(\w+)\s*=\s*NSDictionary\s*\(\s*contentsOfFile:\s*(\w+)\s*\)$/.exec(clause);
|
|
12445
13444
|
if (dictionary && typeof bound.get(dictionary[2]) === "string") {
|
|
12446
13445
|
const parsed = parsePlistSource(
|
|
12447
|
-
|
|
13446
|
+
import_node_fs19.default.readFileSync(String(bound.get(dictionary[2])), "utf8")
|
|
12448
13447
|
);
|
|
12449
13448
|
if (!isRecord(parsed)) return false;
|
|
12450
13449
|
bound.set(dictionary[1], parsed);
|
|
@@ -12533,7 +13532,7 @@ function findDefaultConfigureCall(body, sources) {
|
|
|
12533
13532
|
const [, type, name2] = call;
|
|
12534
13533
|
for (const file of sources) {
|
|
12535
13534
|
if (!file.endsWith(".swift")) continue;
|
|
12536
|
-
const source = blankSwiftObjcLiterals(
|
|
13535
|
+
const source = blankSwiftObjcLiterals(import_node_fs19.default.readFileSync(file, "utf8"));
|
|
12537
13536
|
const declaration = new RegExp(
|
|
12538
13537
|
`\\b(?:enum|struct|class)\\s+${type}\\b[^{]*\\{`
|
|
12539
13538
|
).exec(source);
|
|
@@ -12555,10 +13554,10 @@ function readTargetGoogleServicesFile(projectRoot, container, target, prepareGen
|
|
|
12555
13554
|
prepareGeneratedSources
|
|
12556
13555
|
});
|
|
12557
13556
|
const delegates = app.allSources.filter(
|
|
12558
|
-
(file) => /^AppDelegate\.(swift|mm|m)$/.test(
|
|
13557
|
+
(file) => /^AppDelegate\.(swift|mm|m)$/.test(import_node_path19.default.basename(file))
|
|
12559
13558
|
);
|
|
12560
13559
|
const defaultConfigured = delegates.some((file) => {
|
|
12561
|
-
const raw =
|
|
13560
|
+
const raw = import_node_fs19.default.readFileSync(file, "utf8");
|
|
12562
13561
|
const source = blankSwiftObjcLiterals(raw);
|
|
12563
13562
|
const launch = /(?:\bfunc\s+application\s*\([\s\S]*?didFinishLaunchingWithOptions[\s\S]*?\)\s*->\s*Bool|^-\s*\(BOOL\)\s*application\s*:[\s\S]*?didFinishLaunchingWithOptions[^{]*)\s*\{/m.exec(
|
|
12564
13563
|
source
|
|
@@ -12629,17 +13628,17 @@ function readTargetGoogleServicesFile(projectRoot, container, target, prepareGen
|
|
|
12629
13628
|
return guarded;
|
|
12630
13629
|
});
|
|
12631
13630
|
if (!defaultConfigured) return null;
|
|
12632
|
-
const bundle =
|
|
13631
|
+
const bundle = import_node_path19.default.join(
|
|
12633
13632
|
app.settings("BUILT_PRODUCTS_DIR"),
|
|
12634
13633
|
app.settings("WRAPPER_NAME") || `${app.settings("PRODUCT_NAME")}.app`
|
|
12635
13634
|
);
|
|
12636
13635
|
const staged = app.copiedFiles.filter(
|
|
12637
|
-
({ from, to }) => to ===
|
|
12638
|
-
).map(({ from }) =>
|
|
13636
|
+
({ from, to }) => to === import_node_path19.default.join(bundle, "GoogleService-Info.plist") && import_node_fs19.default.existsSync(from)
|
|
13637
|
+
).map(({ from }) => import_node_fs19.default.realpathSync(from));
|
|
12639
13638
|
const resources = [
|
|
12640
13639
|
.../* @__PURE__ */ new Set([
|
|
12641
13640
|
...app.resources.filter(
|
|
12642
|
-
(file) => /^GoogleService-Info\.plist$/.test(
|
|
13641
|
+
(file) => /^GoogleService-Info\.plist$/.test(import_node_path19.default.basename(file))
|
|
12643
13642
|
),
|
|
12644
13643
|
...staged
|
|
12645
13644
|
])
|
|
@@ -12648,7 +13647,7 @@ function readTargetGoogleServicesFile(projectRoot, container, target, prepareGen
|
|
|
12648
13647
|
throw new Error(
|
|
12649
13648
|
"native Firebase default initialization requires one GoogleService-Info.plist build resource"
|
|
12650
13649
|
);
|
|
12651
|
-
return
|
|
13650
|
+
return import_node_path19.default.relative(import_node_fs19.default.realpathSync(projectRoot), resources[0]);
|
|
12652
13651
|
}
|
|
12653
13652
|
function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"], iosTarget, config = readExpoConfig(projectRoot), prepareGeneratedSources = false) {
|
|
12654
13653
|
const result = {};
|
|
@@ -12669,8 +13668,8 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"], i
|
|
|
12669
13668
|
const native = config[platform];
|
|
12670
13669
|
if (!isRecord(native) || typeof native.googleServicesFile !== "string") continue;
|
|
12671
13670
|
try {
|
|
12672
|
-
const source =
|
|
12673
|
-
|
|
13671
|
+
const source = import_node_fs19.default.readFileSync(
|
|
13672
|
+
import_node_path19.default.resolve(projectRoot, native.googleServicesFile),
|
|
12674
13673
|
"utf8"
|
|
12675
13674
|
);
|
|
12676
13675
|
const parsed = platform === "ios" ? parsePlistSource(source) : JSON.parse(source);
|
|
@@ -12750,9 +13749,9 @@ init_is_record();
|
|
|
12750
13749
|
|
|
12751
13750
|
// src/native-app-identity-project.ts
|
|
12752
13751
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
12753
|
-
var
|
|
13752
|
+
var import_node_fs22 = __toESM(require("node:fs"), 1);
|
|
12754
13753
|
var import_node_module3 = require("node:module");
|
|
12755
|
-
var
|
|
13754
|
+
var import_node_path22 = __toESM(require("node:path"), 1);
|
|
12756
13755
|
init_is_record();
|
|
12757
13756
|
function nonEmptyString2(value) {
|
|
12758
13757
|
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
@@ -12840,7 +13839,7 @@ function readNativeAppIdentityFromXcodeTarget(app, parseInfoPlist = parsePlistSo
|
|
|
12840
13839
|
const rtcAppGroupIdentifier = nonEmptyString2(dictionary.RTCAppGroupIdentifier);
|
|
12841
13840
|
const screenShareExtensionBundleId = typeof dictionary.ScreenShareExtensionBundleId === "string" ? dictionary.ScreenShareExtensionBundleId : void 0;
|
|
12842
13841
|
const rootModuleName = readRootModuleName(
|
|
12843
|
-
app.allSources.filter((file) => /Delegate\.(?:swift|mm|m)$/.test(file) &&
|
|
13842
|
+
app.allSources.filter((file) => /Delegate\.(?:swift|mm|m)$/.test(file) && import_node_fs22.default.existsSync(file)).map((file) => import_node_fs22.default.readFileSync(file, "utf8"))
|
|
12844
13843
|
);
|
|
12845
13844
|
return stampNativeBuildSdk({
|
|
12846
13845
|
...app.keychainAccessGroups === void 0 ? {} : { keychainAccessGroups: app.keychainAccessGroups },
|
|
@@ -12862,7 +13861,7 @@ function readNativeAppIdentityFromXcodeTarget(app, parseInfoPlist = parsePlistSo
|
|
|
12862
13861
|
googleSignIn: readGoogleSignInConfiguration(
|
|
12863
13862
|
dictionary,
|
|
12864
13863
|
Object.fromEntries(
|
|
12865
|
-
app.resources.filter((file) => file.endsWith(".plist")).map((file) => [file, parseInfoPlist(
|
|
13864
|
+
app.resources.filter((file) => file.endsWith(".plist")).map((file) => [file, parseInfoPlist(import_node_fs22.default.readFileSync(file, "utf8"))])
|
|
12866
13865
|
)
|
|
12867
13866
|
),
|
|
12868
13867
|
supportedInterfaceOrientations,
|
|
@@ -12872,11 +13871,11 @@ function readNativeAppIdentityFromXcodeTarget(app, parseInfoPlist = parsePlistSo
|
|
|
12872
13871
|
bundleIcons: resolveNativeBundleIcons(icons, catalogAlternateNames, (value) => value),
|
|
12873
13872
|
appIconArtwork: resolveNativeAppIconArtwork(
|
|
12874
13873
|
app.resources,
|
|
12875
|
-
(file) =>
|
|
13874
|
+
(file) => import_node_fs22.default.readFileSync(file, "utf8"),
|
|
12876
13875
|
(file) => {
|
|
12877
|
-
const extension =
|
|
13876
|
+
const extension = import_node_path22.default.extname(file).toLowerCase();
|
|
12878
13877
|
const contentType = extension === ".jpg" || extension === ".jpeg" ? "image/jpeg" : extension === ".webp" ? "image/webp" : "image/png";
|
|
12879
|
-
return `data:${contentType};base64,${
|
|
13878
|
+
return `data:${contentType};base64,${import_node_fs22.default.readFileSync(file).toString("base64")}`;
|
|
12880
13879
|
},
|
|
12881
13880
|
icons,
|
|
12882
13881
|
app.appIconName,
|
|
@@ -12906,11 +13905,11 @@ function readNativeAppIdentityFromSources(projectRoot, platform, parseInfoPlist,
|
|
|
12906
13905
|
const read = selectNativeAppIdentityReader(platform, {
|
|
12907
13906
|
android: () => null,
|
|
12908
13907
|
ios: () => {
|
|
12909
|
-
const nested =
|
|
12910
|
-
const iosRoot =
|
|
13908
|
+
const nested = import_node_path22.default.join(projectRoot, "ios");
|
|
13909
|
+
const iosRoot = import_node_fs22.default.existsSync(nested) ? nested : projectRoot;
|
|
12911
13910
|
const prefix2 = iosRoot === nested ? "ios/" : "";
|
|
12912
13911
|
const files = {};
|
|
12913
|
-
for (const entry of
|
|
13912
|
+
for (const entry of import_node_fs22.default.readdirSync(iosRoot, { withFileTypes: true })) {
|
|
12914
13913
|
if (entry.name === "Pods") continue;
|
|
12915
13914
|
if (entry.isDirectory()) {
|
|
12916
13915
|
const names = entry.name.endsWith(".xcodeproj") ? ["project.pbxproj"] : [
|
|
@@ -12918,17 +13917,17 @@ function readNativeAppIdentityFromSources(projectRoot, platform, parseInfoPlist,
|
|
|
12918
13917
|
"AppDelegate.swift",
|
|
12919
13918
|
"AppDelegate.mm",
|
|
12920
13919
|
"AppDelegate.m",
|
|
12921
|
-
...
|
|
13920
|
+
...import_node_fs22.default.readdirSync(import_node_path22.default.join(iosRoot, entry.name)).filter((name2) => name2.endsWith(".entitlements"))
|
|
12922
13921
|
];
|
|
12923
13922
|
for (const name2 of names) {
|
|
12924
13923
|
const relative3 = `${prefix2}${entry.name}/${name2}`;
|
|
12925
|
-
const file =
|
|
12926
|
-
if (
|
|
13924
|
+
const file = import_node_path22.default.join(projectRoot, relative3);
|
|
13925
|
+
if (import_node_fs22.default.existsSync(file)) files[relative3] = import_node_fs22.default.readFileSync(file, "utf8");
|
|
12927
13926
|
}
|
|
12928
13927
|
} else if (/AppDelegate\.(?:swift|mm|m)$|\.entitlements$/.test(entry.name)) {
|
|
12929
13928
|
const relative3 = `${prefix2}${entry.name}`;
|
|
12930
|
-
const file =
|
|
12931
|
-
if (
|
|
13929
|
+
const file = import_node_path22.default.join(projectRoot, relative3);
|
|
13930
|
+
if (import_node_fs22.default.existsSync(file)) files[relative3] = import_node_fs22.default.readFileSync(file, "utf8");
|
|
12932
13931
|
}
|
|
12933
13932
|
}
|
|
12934
13933
|
const identity = extractNativeAppIdentityFromFiles(
|
|
@@ -12945,41 +13944,41 @@ function readNativeAppIdentityFromSources(projectRoot, platform, parseInfoPlist,
|
|
|
12945
13944
|
function readAndroidNativeAppIdentity(projectRoot, androidMergedManifest) {
|
|
12946
13945
|
const files = {};
|
|
12947
13946
|
if (androidMergedManifest) {
|
|
12948
|
-
const file =
|
|
12949
|
-
if (!
|
|
12950
|
-
files[androidMergedManifest] =
|
|
13947
|
+
const file = import_node_path22.default.resolve(projectRoot, androidMergedManifest);
|
|
13948
|
+
if (!import_node_fs22.default.existsSync(file)) return null;
|
|
13949
|
+
files[androidMergedManifest] = import_node_fs22.default.readFileSync(file, "utf8");
|
|
12951
13950
|
} else {
|
|
12952
|
-
const androidRoot =
|
|
12953
|
-
if (!
|
|
13951
|
+
const androidRoot = import_node_path22.default.join(projectRoot, "android");
|
|
13952
|
+
if (!import_node_fs22.default.existsSync(androidRoot)) return null;
|
|
12954
13953
|
const collect = (directory) => {
|
|
12955
|
-
for (const entry of
|
|
12956
|
-
const file =
|
|
13954
|
+
for (const entry of import_node_fs22.default.readdirSync(directory, { withFileTypes: true })) {
|
|
13955
|
+
const file = import_node_path22.default.join(directory, entry.name);
|
|
12957
13956
|
if (entry.isDirectory()) collect(file);
|
|
12958
13957
|
else if (entry.isFile() && entry.name === "AndroidManifest.xml")
|
|
12959
|
-
files[
|
|
13958
|
+
files[import_node_path22.default.relative(projectRoot, file).split(import_node_path22.default.sep).join("/")] = import_node_fs22.default.readFileSync(file, "utf8");
|
|
12960
13959
|
}
|
|
12961
13960
|
};
|
|
12962
|
-
for (const module2 of
|
|
13961
|
+
for (const module2 of import_node_fs22.default.readdirSync(androidRoot, { withFileTypes: true })) {
|
|
12963
13962
|
if (!module2.isDirectory()) continue;
|
|
12964
|
-
const outputs =
|
|
13963
|
+
const outputs = import_node_path22.default.join(
|
|
12965
13964
|
androidRoot,
|
|
12966
13965
|
module2.name,
|
|
12967
13966
|
"build/intermediates/merged_manifests"
|
|
12968
13967
|
);
|
|
12969
|
-
if (
|
|
13968
|
+
if (import_node_fs22.default.existsSync(outputs)) collect(outputs);
|
|
12970
13969
|
}
|
|
12971
13970
|
}
|
|
12972
13971
|
for (const manifest of Object.keys(files)) {
|
|
12973
13972
|
const resourceDirectory = androidMergedResourceValuesDirectory(manifest);
|
|
12974
13973
|
if (!resourceDirectory) continue;
|
|
12975
|
-
const absolute =
|
|
12976
|
-
if (!
|
|
12977
|
-
for (const entry of
|
|
13974
|
+
const absolute = import_node_path22.default.resolve(projectRoot, resourceDirectory);
|
|
13975
|
+
if (!import_node_fs22.default.existsSync(absolute)) continue;
|
|
13976
|
+
for (const entry of import_node_fs22.default.readdirSync(absolute, { withFileTypes: true })) {
|
|
12978
13977
|
if (!entry.isDirectory() || !/^values(?:-|$)/.test(entry.name)) continue;
|
|
12979
|
-
for (const resource of
|
|
13978
|
+
for (const resource of import_node_fs22.default.readdirSync(import_node_path22.default.join(absolute, entry.name))) {
|
|
12980
13979
|
if (!resource.endsWith(".xml")) continue;
|
|
12981
13980
|
const file = `${resourceDirectory}/${entry.name}/${resource}`;
|
|
12982
|
-
files[file] =
|
|
13981
|
+
files[file] = import_node_fs22.default.readFileSync(import_node_path22.default.resolve(projectRoot, file), "utf8");
|
|
12983
13982
|
}
|
|
12984
13983
|
}
|
|
12985
13984
|
}
|
|
@@ -12996,7 +13995,7 @@ function readIosNativeAppIdentity(projectRoot, parseInfoPlist, iosTarget, enviro
|
|
|
12996
13995
|
const app = readIosAppTarget(projectRoot, iosTarget, environment);
|
|
12997
13996
|
if (!app) return null;
|
|
12998
13997
|
const identity = readNativeAppIdentityFromXcodeTarget(app, parseInfoPlist);
|
|
12999
|
-
const projectManifestPath =
|
|
13998
|
+
const projectManifestPath = import_node_path22.default.join(projectRoot, "package.json");
|
|
13000
13999
|
const projectRequire = (0, import_node_module3.createRequire)(projectManifestPath);
|
|
13001
14000
|
let reanimatedManifestPath;
|
|
13002
14001
|
try {
|
|
@@ -13010,22 +14009,22 @@ function readIosNativeAppIdentity(projectRoot, parseInfoPlist, iosTarget, enviro
|
|
|
13010
14009
|
throw error;
|
|
13011
14010
|
}
|
|
13012
14011
|
const installedManifest = JSON.parse(
|
|
13013
|
-
|
|
14012
|
+
import_node_fs22.default.readFileSync(reanimatedManifestPath, "utf8")
|
|
13014
14013
|
);
|
|
13015
14014
|
const installedVersion = isRecord(installedManifest) ? nonEmptyString2(installedManifest.version) : void 0;
|
|
13016
14015
|
if (!installedVersion) throw new Error("Reanimated package version is malformed");
|
|
13017
14016
|
if (Number.parseInt(installedVersion, 10) < 4) return identity;
|
|
13018
14017
|
const defaults = JSON.parse(
|
|
13019
|
-
|
|
13020
|
-
|
|
13021
|
-
|
|
14018
|
+
import_node_fs22.default.readFileSync(
|
|
14019
|
+
import_node_path22.default.join(
|
|
14020
|
+
import_node_path22.default.dirname(reanimatedManifestPath),
|
|
13022
14021
|
"src/featureFlags/staticFlags.json"
|
|
13023
14022
|
),
|
|
13024
14023
|
"utf8"
|
|
13025
14024
|
)
|
|
13026
14025
|
);
|
|
13027
14026
|
if (!isRecord(defaults)) throw new Error("Reanimated static flags are malformed");
|
|
13028
|
-
const manifest = JSON.parse(
|
|
14027
|
+
const manifest = JSON.parse(import_node_fs22.default.readFileSync(projectManifestPath, "utf8"));
|
|
13029
14028
|
const reanimated = isRecord(manifest) ? manifest.reanimated : void 0;
|
|
13030
14029
|
const overrides = isRecord(reanimated) ? reanimated.staticFeatureFlags : void 0;
|
|
13031
14030
|
if (overrides !== void 0 && !isRecord(overrides)) {
|
|
@@ -15906,8 +16905,8 @@ var COMPAT_STUBS = {
|
|
|
15906
16905
|
|
|
15907
16906
|
// src/installed-native-build-options.ts
|
|
15908
16907
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
15909
|
-
var
|
|
15910
|
-
var
|
|
16908
|
+
var import_node_fs23 = __toESM(require("node:fs"), 1);
|
|
16909
|
+
var import_node_path23 = __toESM(require("node:path"), 1);
|
|
15911
16910
|
init_version_range();
|
|
15912
16911
|
var RIVE_PACKAGE = "@rive-app/react-native";
|
|
15913
16912
|
var RIVE_05 = [">=0.5.0 <0.6.0"];
|
|
@@ -15916,10 +16915,10 @@ function missing(error) {
|
|
|
15916
16915
|
}
|
|
15917
16916
|
function answerSync(step) {
|
|
15918
16917
|
try {
|
|
15919
|
-
if (step.type === "realpath") return
|
|
15920
|
-
if (step.type === "read") return
|
|
15921
|
-
if (step.type === "isDirectory") return
|
|
15922
|
-
return
|
|
16918
|
+
if (step.type === "realpath") return import_node_fs23.default.realpathSync(step.path);
|
|
16919
|
+
if (step.type === "read") return import_node_fs23.default.readFileSync(step.path, "utf8");
|
|
16920
|
+
if (step.type === "isDirectory") return import_node_fs23.default.statSync(step.path).isDirectory();
|
|
16921
|
+
return import_node_fs23.default.readdirSync(step.path, { withFileTypes: true }).map((entry) => ({
|
|
15923
16922
|
name: entry.name,
|
|
15924
16923
|
directory: entry.isDirectory(),
|
|
15925
16924
|
symbolicLink: entry.isSymbolicLink()
|
|
@@ -15931,11 +16930,11 @@ function answerSync(step) {
|
|
|
15931
16930
|
}
|
|
15932
16931
|
async function answerAsync(step) {
|
|
15933
16932
|
try {
|
|
15934
|
-
if (step.type === "realpath") return await
|
|
15935
|
-
if (step.type === "read") return await
|
|
16933
|
+
if (step.type === "realpath") return await import_node_fs23.default.promises.realpath(step.path);
|
|
16934
|
+
if (step.type === "read") return await import_node_fs23.default.promises.readFile(step.path, "utf8");
|
|
15936
16935
|
if (step.type === "isDirectory")
|
|
15937
|
-
return (await
|
|
15938
|
-
return (await
|
|
16936
|
+
return (await import_node_fs23.default.promises.stat(step.path)).isDirectory();
|
|
16937
|
+
return (await import_node_fs23.default.promises.readdir(step.path, { withFileTypes: true })).map(
|
|
15939
16938
|
(entry) => ({
|
|
15940
16939
|
name: entry.name,
|
|
15941
16940
|
directory: entry.isDirectory(),
|
|
@@ -15968,7 +16967,7 @@ function* rubyFiles(directory, seen, iosRoot = false) {
|
|
|
15968
16967
|
const files = [];
|
|
15969
16968
|
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
15970
16969
|
if (iosRoot && (entry.name === "Pods" || entry.name === "build")) continue;
|
|
15971
|
-
const target =
|
|
16970
|
+
const target = import_node_path23.default.join(directory, entry.name);
|
|
15972
16971
|
let isDirectory2 = entry.directory;
|
|
15973
16972
|
if (entry.symbolicLink)
|
|
15974
16973
|
isDirectory2 = (yield { type: "isDirectory", path: target }) === true;
|
|
@@ -15981,7 +16980,7 @@ function* nativeBuildOptionsWalk(projectRoot, versions, environment) {
|
|
|
15981
16980
|
let sensorOptions = {};
|
|
15982
16981
|
const sensors = versions["expo-sensors"];
|
|
15983
16982
|
if (sensors && resolveCompatVersionRange([">=58.0.4 <59.0.0"], sensors).status === "matched") {
|
|
15984
|
-
const file =
|
|
16983
|
+
const file = import_node_path23.default.join(projectRoot, "ios", "Podfile.properties.json");
|
|
15985
16984
|
const source = yield { type: "read", path: file };
|
|
15986
16985
|
if (source !== null && typeof source !== "string")
|
|
15987
16986
|
throw new Error(`cannot inspect ${file}`);
|
|
@@ -15997,8 +16996,8 @@ function* nativeBuildOptionsWalk(projectRoot, versions, environment) {
|
|
|
15997
16996
|
if (!needsRiveOptions(versions)) return sensorOptions;
|
|
15998
16997
|
if (environment.USE_RIVE_LEGACY === "1" || environment.USE_RIVE_LEGACY === "true")
|
|
15999
16998
|
return { ...sensorOptions, [RIVE_PACKAGE]: { USE_RIVE_LEGACY: true } };
|
|
16000
|
-
const ios =
|
|
16001
|
-
const podfile =
|
|
16999
|
+
const ios = import_node_path23.default.join(projectRoot, "ios");
|
|
17000
|
+
const podfile = import_node_path23.default.join(ios, "Podfile");
|
|
16002
17001
|
const files = [podfile, ...yield* rubyFiles(ios, /* @__PURE__ */ new Set(), true)];
|
|
16003
17002
|
let value = false;
|
|
16004
17003
|
let assigned = false;
|
|
@@ -16263,10 +17262,10 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
16263
17262
|
// scripts/dev-server-scanner.ts
|
|
16264
17263
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
16265
17264
|
var import_child_process = require("child_process");
|
|
16266
|
-
var
|
|
16267
|
-
var
|
|
16268
|
-
var
|
|
16269
|
-
var
|
|
17265
|
+
var import_promises3 = require("fs/promises");
|
|
17266
|
+
var import_node_fs24 = require("node:fs");
|
|
17267
|
+
var import_node_os6 = require("node:os");
|
|
17268
|
+
var import_node_path24 = require("node:path");
|
|
16270
17269
|
init_backend_origin();
|
|
16271
17270
|
init_config();
|
|
16272
17271
|
|
|
@@ -16406,11 +17405,11 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
16406
17405
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
16407
17406
|
|
|
16408
17407
|
// scripts/dev-server-scanner.ts
|
|
16409
|
-
var LISTENER_LOCK_PATH = (0,
|
|
16410
|
-
var LISTENER_RESULT_PATH = (0,
|
|
17408
|
+
var LISTENER_LOCK_PATH = (0, import_node_path24.join)((0, import_node_os6.tmpdir)(), "peach-listener-scan.lock");
|
|
17409
|
+
var LISTENER_RESULT_PATH = (0, import_node_path24.join)((0, import_node_os6.tmpdir)(), "peach-listener-scan.result");
|
|
16411
17410
|
var LISTENER_LOCK_STALE_MS = 25e3;
|
|
16412
17411
|
var LISTENER_LOCK_WAIT_MS = 8e3;
|
|
16413
|
-
function
|
|
17412
|
+
function sleep2(ms) {
|
|
16414
17413
|
return new Promise((resolve4) => setTimeout(resolve4, ms));
|
|
16415
17414
|
}
|
|
16416
17415
|
function pidIsAlive(pid) {
|
|
@@ -16425,8 +17424,8 @@ function pidIsAlive(pid) {
|
|
|
16425
17424
|
}
|
|
16426
17425
|
function readLockOwner() {
|
|
16427
17426
|
try {
|
|
16428
|
-
const raw = (0,
|
|
16429
|
-
const mtimeMs = (0,
|
|
17427
|
+
const raw = (0, import_node_fs24.readFileSync)(LISTENER_LOCK_PATH, "utf8");
|
|
17428
|
+
const mtimeMs = (0, import_node_fs24.statSync)(LISTENER_LOCK_PATH).mtimeMs;
|
|
16430
17429
|
const pid = Number(raw.split("-")[0]);
|
|
16431
17430
|
return { raw, pid: Number.isInteger(pid) ? pid : -1, mtimeMs };
|
|
16432
17431
|
} catch {
|
|
@@ -16439,15 +17438,15 @@ function lockIsAbandoned(owner) {
|
|
|
16439
17438
|
}
|
|
16440
17439
|
function clearLock(raw) {
|
|
16441
17440
|
try {
|
|
16442
|
-
if ((0,
|
|
16443
|
-
(0,
|
|
17441
|
+
if ((0, import_node_fs24.readFileSync)(LISTENER_LOCK_PATH, "utf8") !== raw) return;
|
|
17442
|
+
(0, import_node_fs24.unlinkSync)(LISTENER_LOCK_PATH);
|
|
16444
17443
|
} catch {
|
|
16445
17444
|
}
|
|
16446
17445
|
}
|
|
16447
17446
|
function readResult() {
|
|
16448
17447
|
try {
|
|
16449
17448
|
const parsed = JSON.parse(
|
|
16450
|
-
(0,
|
|
17449
|
+
(0, import_node_fs24.readFileSync)(LISTENER_RESULT_PATH, "utf8")
|
|
16451
17450
|
);
|
|
16452
17451
|
if (!parsed || typeof parsed.token !== "string" || typeof parsed.key !== "string")
|
|
16453
17452
|
return null;
|
|
@@ -16458,8 +17457,8 @@ function readResult() {
|
|
|
16458
17457
|
}
|
|
16459
17458
|
function publishResult(payload) {
|
|
16460
17459
|
const tmp = `${LISTENER_RESULT_PATH}.${process.pid}.tmp`;
|
|
16461
|
-
(0,
|
|
16462
|
-
(0,
|
|
17460
|
+
(0, import_node_fs24.writeFileSync)(tmp, JSON.stringify(payload));
|
|
17461
|
+
(0, import_node_fs24.renameSync)(tmp, LISTENER_RESULT_PATH);
|
|
16463
17462
|
}
|
|
16464
17463
|
function throwPublished(payload) {
|
|
16465
17464
|
throw Object.assign(new Error(payload.message || "listener scan failed"), {
|
|
@@ -16490,7 +17489,7 @@ async function waitForSharedResult(owner, key) {
|
|
|
16490
17489
|
clearLock(latest.raw);
|
|
16491
17490
|
return { kind: "retry" };
|
|
16492
17491
|
}
|
|
16493
|
-
await
|
|
17492
|
+
await sleep2(25);
|
|
16494
17493
|
}
|
|
16495
17494
|
throw Object.assign(new Error("listener scan lock was held past the wait"), {
|
|
16496
17495
|
killed: true
|
|
@@ -16502,7 +17501,7 @@ async function withListenerLock(key, body) {
|
|
|
16502
17501
|
for (; ; ) {
|
|
16503
17502
|
let fd = null;
|
|
16504
17503
|
try {
|
|
16505
|
-
fd = (0,
|
|
17504
|
+
fd = (0, import_node_fs24.openSync)(LISTENER_LOCK_PATH, "wx");
|
|
16506
17505
|
} catch (error) {
|
|
16507
17506
|
const code = error instanceof Error && "code" in error ? error.code : "";
|
|
16508
17507
|
if (code !== "EEXIST") throw error;
|
|
@@ -16511,7 +17510,7 @@ async function withListenerLock(key, body) {
|
|
|
16511
17510
|
if (owner) clearLock(owner.raw);
|
|
16512
17511
|
else {
|
|
16513
17512
|
try {
|
|
16514
|
-
(0,
|
|
17513
|
+
(0, import_node_fs24.unlinkSync)(LISTENER_LOCK_PATH);
|
|
16515
17514
|
} catch {
|
|
16516
17515
|
}
|
|
16517
17516
|
}
|
|
@@ -16522,12 +17521,12 @@ async function withListenerLock(key, body) {
|
|
|
16522
17521
|
if (shared.kind === "value") return shared.value;
|
|
16523
17522
|
continue;
|
|
16524
17523
|
}
|
|
16525
|
-
await
|
|
17524
|
+
await sleep2(25);
|
|
16526
17525
|
continue;
|
|
16527
17526
|
}
|
|
16528
17527
|
if (fd === null) continue;
|
|
16529
17528
|
try {
|
|
16530
|
-
(0,
|
|
17529
|
+
(0, import_node_fs24.writeSync)(fd, token);
|
|
16531
17530
|
try {
|
|
16532
17531
|
const value = await body();
|
|
16533
17532
|
publishResult({ token, key, ok: true, value });
|
|
@@ -16544,7 +17543,7 @@ async function withListenerLock(key, body) {
|
|
|
16544
17543
|
}
|
|
16545
17544
|
} finally {
|
|
16546
17545
|
try {
|
|
16547
|
-
(0,
|
|
17546
|
+
(0, import_node_fs24.closeSync)(fd);
|
|
16548
17547
|
} catch {
|
|
16549
17548
|
}
|
|
16550
17549
|
clearLock(token);
|
|
@@ -16793,7 +17792,7 @@ async function flushCwdQueue() {
|
|
|
16793
17792
|
const needLsof = [];
|
|
16794
17793
|
for (const pid of pending) {
|
|
16795
17794
|
try {
|
|
16796
|
-
const cwd = await (0,
|
|
17795
|
+
const cwd = await (0, import_promises3.readlink)(`/proc/${pid}/cwd`);
|
|
16797
17796
|
if (cwd) {
|
|
16798
17797
|
cwdByPid.set(pid, cwd);
|
|
16799
17798
|
continue;
|
|
@@ -17029,7 +18028,7 @@ function nodeRequestHeaderEntries(headers) {
|
|
|
17029
18028
|
|
|
17030
18029
|
// src/host/hostname-resolver.ts
|
|
17031
18030
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
17032
|
-
var
|
|
18031
|
+
var import_promises4 = require("node:dns/promises");
|
|
17033
18032
|
|
|
17034
18033
|
// src/dns-over-https.ts
|
|
17035
18034
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -17071,7 +18070,7 @@ function parseIpv6(text2) {
|
|
|
17071
18070
|
|
|
17072
18071
|
// src/host/network-policy.ts
|
|
17073
18072
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
17074
|
-
var
|
|
18073
|
+
var import_node_path25 = require("node:path");
|
|
17075
18074
|
var import_node_url = require("node:url");
|
|
17076
18075
|
var NETWORK_POLICY_TIMEOUT_MS = 1e4;
|
|
17077
18076
|
var NetworkPolicyDeniedError = class extends Error {
|
|
@@ -17124,7 +18123,7 @@ function createNetworkAuthorizer(policy) {
|
|
|
17124
18123
|
};
|
|
17125
18124
|
}
|
|
17126
18125
|
async function loadNetworkPolicy(file) {
|
|
17127
|
-
if (!(0,
|
|
18126
|
+
if (!(0, import_node_path25.isAbsolute)(file)) {
|
|
17128
18127
|
throw new Error(`PEACH_NETWORK_POLICY must be an absolute path: ${file}`);
|
|
17129
18128
|
}
|
|
17130
18129
|
const loaded3 = await import(
|
|
@@ -17160,7 +18159,7 @@ async function handleHostnameResolutionRequest(req, res) {
|
|
|
17160
18159
|
}
|
|
17161
18160
|
let addresses;
|
|
17162
18161
|
try {
|
|
17163
|
-
addresses = (await (0,
|
|
18162
|
+
addresses = (await (0, import_promises4.lookup)(host2, { all: true })).map(({ address }) => {
|
|
17164
18163
|
const bytes = parseIpLiteral(address);
|
|
17165
18164
|
if (!bytes) throw new Error("system resolver returned an invalid address");
|
|
17166
18165
|
return bytes;
|
|
@@ -17213,17 +18212,17 @@ function projectLoopbackUrl(value) {
|
|
|
17213
18212
|
// src/host/rolldown-bundle-forward.ts
|
|
17214
18213
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
17215
18214
|
var import_stream = require("stream");
|
|
17216
|
-
var
|
|
18215
|
+
var import_promises5 = require("stream/promises");
|
|
17217
18216
|
|
|
17218
18217
|
// src/cli-runtime.ts
|
|
17219
18218
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
17220
|
-
var
|
|
17221
|
-
var
|
|
18219
|
+
var import_node_crypto7 = require("node:crypto");
|
|
18220
|
+
var import_node_fs25 = require("node:fs");
|
|
17222
18221
|
var import_node_module4 = require("node:module");
|
|
17223
|
-
var
|
|
18222
|
+
var import_node_path26 = require("node:path");
|
|
17224
18223
|
|
|
17225
18224
|
// runtime-companion.json
|
|
17226
|
-
var runtime_companion_default = { abi: 1, sha256: "
|
|
18225
|
+
var runtime_companion_default = { abi: 1, sha256: "1c15d055a3e1e68a17d3f735cd1c592fdc418c85e781e44abf4f4aa0b1215b52", file: "node/cli-1c15d055a3e1e68a17d3f735cd1c592fdc418c85e781e44abf4f4aa0b1215b52.cjs" };
|
|
17227
18226
|
|
|
17228
18227
|
// src/cli-runtime.ts
|
|
17229
18228
|
var CLI_COMPANION_ABI = 1;
|
|
@@ -17231,12 +18230,12 @@ function cliCompanionPath() {
|
|
|
17231
18230
|
return `node/cli-${runtime_companion_default.sha256}.cjs`;
|
|
17232
18231
|
}
|
|
17233
18232
|
function verifyCliCompanion(root) {
|
|
17234
|
-
verifyCompanionFile((0,
|
|
18233
|
+
verifyCompanionFile((0, import_node_path26.join)(root, cliCompanionPath()));
|
|
17235
18234
|
}
|
|
17236
18235
|
function verifyCompanionFile(file) {
|
|
17237
18236
|
let bytes;
|
|
17238
18237
|
try {
|
|
17239
|
-
bytes = (0,
|
|
18238
|
+
bytes = (0, import_node_fs25.readFileSync)(file);
|
|
17240
18239
|
} catch (error) {
|
|
17241
18240
|
if (error instanceof Error) {
|
|
17242
18241
|
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" : ""}` : "";
|
|
@@ -17244,20 +18243,41 @@ function verifyCompanionFile(file) {
|
|
|
17244
18243
|
}
|
|
17245
18244
|
throw error;
|
|
17246
18245
|
}
|
|
17247
|
-
const hash = (0,
|
|
18246
|
+
const hash = (0, import_node_crypto7.createHash)("sha256").update(bytes).digest("hex");
|
|
17248
18247
|
if (hash !== runtime_companion_default.sha256) {
|
|
17249
18248
|
throw new Error(
|
|
17250
18249
|
"Peach runtime companion does not match this CLI; run `peach runtime install`"
|
|
17251
18250
|
);
|
|
17252
18251
|
}
|
|
17253
18252
|
}
|
|
18253
|
+
async function ensureCliCompanion(root) {
|
|
18254
|
+
const file = (0, import_node_path26.join)(root, cliCompanionPath());
|
|
18255
|
+
try {
|
|
18256
|
+
verifyCompanionFile(file);
|
|
18257
|
+
return;
|
|
18258
|
+
} catch (error) {
|
|
18259
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT"))
|
|
18260
|
+
throw error;
|
|
18261
|
+
}
|
|
18262
|
+
const staged = `${file}.${process.pid}`;
|
|
18263
|
+
try {
|
|
18264
|
+
await downloadToFile(
|
|
18265
|
+
`https://r2.rnxsim.com/rnx-cli/companions/cli-${runtime_companion_default.sha256}.cjs`,
|
|
18266
|
+
staged
|
|
18267
|
+
);
|
|
18268
|
+
verifyCompanionFile(staged);
|
|
18269
|
+
(0, import_node_fs25.renameSync)(staged, file);
|
|
18270
|
+
} finally {
|
|
18271
|
+
(0, import_node_fs25.rmSync)(staged, { force: true });
|
|
18272
|
+
}
|
|
18273
|
+
}
|
|
17254
18274
|
var loaded2;
|
|
17255
18275
|
function getCliRuntime() {
|
|
17256
18276
|
if (loaded2) return loaded2.runtime;
|
|
17257
18277
|
const root = peachRuntimeRoot();
|
|
17258
18278
|
verifyCliCompanion(root);
|
|
17259
18279
|
const require2 = (0, import_node_module4.createRequire)(__sootsim_import_meta_url);
|
|
17260
|
-
const runtime = require2((0,
|
|
18280
|
+
const runtime = require2((0, import_node_path26.join)(root, cliCompanionPath()));
|
|
17261
18281
|
if (runtime.cliCompanionAbi !== CLI_COMPANION_ABI) {
|
|
17262
18282
|
throw new Error(
|
|
17263
18283
|
"Incompatible Peach runtime companion ABI; run `peach runtime install`"
|
|
@@ -17272,7 +18292,7 @@ var ROLLDOWN_INVENTORY_HEADER = "x-peach-rolldown-inventory";
|
|
|
17272
18292
|
async function forwardRolldownBundleResponse(upstream, res) {
|
|
17273
18293
|
res.setHeader(ROLLDOWN_INVENTORY_HEADER, "1");
|
|
17274
18294
|
if (upstream.headers[ROLLDOWN_INVENTORY_HEADER] === "1") {
|
|
17275
|
-
await (0,
|
|
18295
|
+
await (0, import_promises5.pipeline)(upstream, res);
|
|
17276
18296
|
return;
|
|
17277
18297
|
}
|
|
17278
18298
|
const contentType = typeof upstream.headers["content-type"] === "string" ? upstream.headers["content-type"] : "";
|
|
@@ -17314,7 +18334,7 @@ async function forwardRolldownBundleResponse(upstream, res) {
|
|
|
17314
18334
|
}
|
|
17315
18335
|
yield Buffer.from(annotated.slice(sent), "utf8");
|
|
17316
18336
|
};
|
|
17317
|
-
await (0,
|
|
18337
|
+
await (0, import_promises5.pipeline)(import_stream.Readable.from(annotate(), { objectMode: false }), res);
|
|
17318
18338
|
}
|
|
17319
18339
|
|
|
17320
18340
|
// src/host/fetch-proxy-handler.ts
|
|
@@ -17645,7 +18665,7 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
17645
18665
|
await route.respond(proxyRes, hopCookies);
|
|
17646
18666
|
if (isNativeCookieRedirect(hop)) res.removeHeader("location");
|
|
17647
18667
|
res.statusCode = isNativeCookieRedirect(hop) ? 200 : status;
|
|
17648
|
-
await (0,
|
|
18668
|
+
await (0, import_promises6.pipeline)(proxyRes, res);
|
|
17649
18669
|
return;
|
|
17650
18670
|
}
|
|
17651
18671
|
if (location && (status === 301 || status === 302 || status === 303 || status === 307 || status === 308)) {
|
|
@@ -17656,7 +18676,7 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
17656
18676
|
const switchToGet = (status === 301 || status === 302) && method === "POST" || status === 303 && method !== "GET" && method !== "HEAD";
|
|
17657
18677
|
const redirectUrl = resolveRedirectUrl(location, targetUrl);
|
|
17658
18678
|
proxyRes.resume();
|
|
17659
|
-
await (0,
|
|
18679
|
+
await (0, import_promises6.finished)(proxyRes);
|
|
17660
18680
|
await proxy(
|
|
17661
18681
|
redirectUrl,
|
|
17662
18682
|
switchToGet ? "GET" : method,
|
|
@@ -17673,7 +18693,7 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
17673
18693
|
await forwardRolldownBundleResponse(proxyRes, res);
|
|
17674
18694
|
return;
|
|
17675
18695
|
}
|
|
17676
|
-
await (0,
|
|
18696
|
+
await (0, import_promises6.pipeline)(proxyRes, res);
|
|
17677
18697
|
};
|
|
17678
18698
|
let upstreamAnswered = false;
|
|
17679
18699
|
let body;
|
|
@@ -17852,6 +18872,198 @@ function insertNativeFirebaseFooter(source, config) {
|
|
|
17852
18872
|
return start < 0 ? detached + footer : detached.slice(0, start) + footer + detached.slice(start);
|
|
17853
18873
|
}
|
|
17854
18874
|
|
|
18875
|
+
// src/runtime-packs.ts
|
|
18876
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
18877
|
+
var import_node_fs27 = __toESM(require("node:fs"), 1);
|
|
18878
|
+
var import_node_path28 = __toESM(require("node:path"), 1);
|
|
18879
|
+
var import_node_timers = require("node:timers");
|
|
18880
|
+
|
|
18881
|
+
// src/runtime-delivery.ts
|
|
18882
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
18883
|
+
init_home_paths();
|
|
18884
|
+
init_public_brand();
|
|
18885
|
+
var DEFAULT_RUNTIME_CDN_ORIGIN = peachPublicBrand.origin;
|
|
18886
|
+
var RNX_CHANGELOG_URL = `${peachPublicBrand.origin}/changelog`;
|
|
18887
|
+
var RNX_CHANGELOG_API_URL = `${peachPublicBrand.origin}/api/changelog/sootsim`;
|
|
18888
|
+
var RNX_RUNTIME_PRODUCT = {
|
|
18889
|
+
id: "peach",
|
|
18890
|
+
defaultCdnOrigin: DEFAULT_RUNTIME_CDN_ORIGIN,
|
|
18891
|
+
manifestPath: "/runtimes/manifest.json",
|
|
18892
|
+
tarballPath: (version) => `/runtimes/sootsim-runtime-${version}.tar.zst`,
|
|
18893
|
+
// the engine runtime is a static SPA: shell at the root, engine/ and
|
|
18894
|
+
// engine-tenant/ beneath it. index.html is what the daemon and the
|
|
18895
|
+
// vite/metro plugins serve, so its absence means the tarball is not one.
|
|
18896
|
+
installedMarker: "index.html",
|
|
18897
|
+
verifyInstall: ensureCliCompanion,
|
|
18898
|
+
env: {
|
|
18899
|
+
cdnOrigin: "PEACH_CDN_ORIGIN",
|
|
18900
|
+
channel: "PEACH_RUNTIME_CHANNEL"
|
|
18901
|
+
},
|
|
18902
|
+
ensureHome: ensureRnxHome,
|
|
18903
|
+
configFile: configFilePath,
|
|
18904
|
+
runtimesDir,
|
|
18905
|
+
runtimeDir,
|
|
18906
|
+
cacheDir,
|
|
18907
|
+
readActiveRuntime,
|
|
18908
|
+
writeActiveRuntime
|
|
18909
|
+
};
|
|
18910
|
+
var rnxRuntime = createRuntimeDelivery(RNX_RUNTIME_PRODUCT);
|
|
18911
|
+
|
|
18912
|
+
// src/runtime-packs.ts
|
|
18913
|
+
var inflight = /* @__PURE__ */ new Map();
|
|
18914
|
+
var packsByRoot = /* @__PURE__ */ new Map();
|
|
18915
|
+
var listedByRoot = /* @__PURE__ */ new Map();
|
|
18916
|
+
function listedFiles(runtimeRoot) {
|
|
18917
|
+
let listed = listedByRoot.get(runtimeRoot);
|
|
18918
|
+
if (listed) return listed;
|
|
18919
|
+
listed = /* @__PURE__ */ new Map();
|
|
18920
|
+
for (const [pack, entry] of Object.entries(readPacks(runtimeRoot) ?? {}))
|
|
18921
|
+
for (const file of entry.files ?? []) {
|
|
18922
|
+
const name2 = import_node_path28.default.posix.basename(file);
|
|
18923
|
+
listed.set(name2, [...listed.get(name2) ?? [], { file, pack }]);
|
|
18924
|
+
}
|
|
18925
|
+
listedByRoot.set(runtimeRoot, listed);
|
|
18926
|
+
return listed;
|
|
18927
|
+
}
|
|
18928
|
+
function readPacks(runtimeRoot) {
|
|
18929
|
+
const cached = packsByRoot.get(runtimeRoot);
|
|
18930
|
+
if (cached !== void 0) return cached;
|
|
18931
|
+
const file = import_node_path28.default.join(runtimeRoot, RUNTIME_PACKS_FILE);
|
|
18932
|
+
if (!import_node_fs27.default.existsSync(file)) {
|
|
18933
|
+
packsByRoot.set(runtimeRoot, null);
|
|
18934
|
+
return null;
|
|
18935
|
+
}
|
|
18936
|
+
const parsed = JSON.parse(import_node_fs27.default.readFileSync(file, "utf8"));
|
|
18937
|
+
const packs = {};
|
|
18938
|
+
if (typeof parsed !== "object" || parsed === null)
|
|
18939
|
+
throw new Error(`${file} is not an object`);
|
|
18940
|
+
for (const [prefix2, entry] of Object.entries(parsed)) {
|
|
18941
|
+
if (typeof entry?.file !== "string" || typeof entry?.sha256 !== "string")
|
|
18942
|
+
throw new Error(`${file} entry ${prefix2} lacks file and sha256`);
|
|
18943
|
+
const files = entry.files;
|
|
18944
|
+
if (files !== void 0 && !(Array.isArray(files) && files.every((f) => typeof f === "string")))
|
|
18945
|
+
throw new Error(`${file} entry ${prefix2} has files that are not paths`);
|
|
18946
|
+
packs[prefix2] = {
|
|
18947
|
+
file: entry.file,
|
|
18948
|
+
sha256: entry.sha256,
|
|
18949
|
+
...files ? { files } : {}
|
|
18950
|
+
};
|
|
18951
|
+
}
|
|
18952
|
+
packsByRoot.set(runtimeRoot, packs);
|
|
18953
|
+
return packs;
|
|
18954
|
+
}
|
|
18955
|
+
async function ensureRuntimePackFor(runtimeRoot, pathname) {
|
|
18956
|
+
warmRuntimePacks(runtimeRoot);
|
|
18957
|
+
const prefix2 = RUNTIME_PACK_PREFIXES.find(
|
|
18958
|
+
(candidate) => pathname.includes(`/${candidate}`)
|
|
18959
|
+
);
|
|
18960
|
+
if (prefix2) {
|
|
18961
|
+
await installNamedPack(runtimeRoot, prefix2);
|
|
18962
|
+
return;
|
|
18963
|
+
}
|
|
18964
|
+
const listed = listedFiles(runtimeRoot).get(import_node_path28.default.posix.basename(pathname))?.find(({ file }) => pathname.endsWith(`/${file}`));
|
|
18965
|
+
if (listed) {
|
|
18966
|
+
if (!import_node_fs27.default.existsSync(import_node_path28.default.join(runtimeRoot, listed.file)))
|
|
18967
|
+
await installNamedPack(runtimeRoot, listed.pack);
|
|
18968
|
+
return;
|
|
18969
|
+
}
|
|
18970
|
+
const at = pathname.indexOf(`/${RUNTIME_MERGE_PACK_DIR}`);
|
|
18971
|
+
if (at === -1) return;
|
|
18972
|
+
const tenantDir = import_node_path28.default.join(runtimeRoot, RUNTIME_MERGE_PACK_DIR);
|
|
18973
|
+
const rel = pathname.slice(at + RUNTIME_MERGE_PACK_DIR.length + 1);
|
|
18974
|
+
if (!/\.m?js$/.test(rel) || import_node_fs27.default.existsSync(import_node_path28.default.join(tenantDir, rel))) return;
|
|
18975
|
+
await installNamedPack(runtimeRoot, RUNTIME_MERGE_PACK_DIR);
|
|
18976
|
+
}
|
|
18977
|
+
function installNamedPack(runtimeRoot, name2) {
|
|
18978
|
+
if (name2 === RUNTIME_MERGE_PACK_DIR) {
|
|
18979
|
+
const tenantDir = import_node_path28.default.join(runtimeRoot, RUNTIME_MERGE_PACK_DIR);
|
|
18980
|
+
return mergePack(
|
|
18981
|
+
runtimeRoot,
|
|
18982
|
+
name2,
|
|
18983
|
+
import_node_path28.default.join(tenantDir, RUNTIME_MERGE_PACK_INSTALL),
|
|
18984
|
+
tenantDir
|
|
18985
|
+
);
|
|
18986
|
+
}
|
|
18987
|
+
if (readPacks(runtimeRoot)?.[name2]?.files)
|
|
18988
|
+
return mergePack(
|
|
18989
|
+
runtimeRoot,
|
|
18990
|
+
name2,
|
|
18991
|
+
import_node_path28.default.join(runtimeRoot, `.pack-${name2}`),
|
|
18992
|
+
runtimeRoot
|
|
18993
|
+
);
|
|
18994
|
+
return installPack(runtimeRoot, name2, import_node_path28.default.join(runtimeRoot, name2.slice(0, -1)));
|
|
18995
|
+
}
|
|
18996
|
+
var WARM_DELAY_MS = 3e4;
|
|
18997
|
+
var warming = /* @__PURE__ */ new Set();
|
|
18998
|
+
function warmRuntimePacks(runtimeRoot) {
|
|
18999
|
+
if (warming.has(runtimeRoot)) return;
|
|
19000
|
+
warming.add(runtimeRoot);
|
|
19001
|
+
const warm = async () => {
|
|
19002
|
+
for (const name2 of Object.keys(readPacks(runtimeRoot) ?? {}))
|
|
19003
|
+
if (!await installNamedPack(runtimeRoot, name2)) return;
|
|
19004
|
+
};
|
|
19005
|
+
const schedule = import_node_timers.setTimeout;
|
|
19006
|
+
schedule(() => void warm(), WARM_DELAY_MS).unref();
|
|
19007
|
+
}
|
|
19008
|
+
async function mergePack(runtimeRoot, name2, installDir, targetDir) {
|
|
19009
|
+
if (import_node_fs27.default.existsSync(import_node_path28.default.join(installDir, RUNTIME_MERGE_PACK_MERGED))) return true;
|
|
19010
|
+
if (!await installPack(runtimeRoot, name2, installDir)) return false;
|
|
19011
|
+
const link = (sub) => {
|
|
19012
|
+
for (const entry of import_node_fs27.default.readdirSync(import_node_path28.default.join(installDir, sub), {
|
|
19013
|
+
withFileTypes: true
|
|
19014
|
+
})) {
|
|
19015
|
+
const child = import_node_path28.default.join(sub, entry.name);
|
|
19016
|
+
if (entry.isDirectory()) {
|
|
19017
|
+
import_node_fs27.default.mkdirSync(import_node_path28.default.join(targetDir, child), { recursive: true });
|
|
19018
|
+
link(child);
|
|
19019
|
+
} else if (entry.name !== RUNTIME_PACK_MARKER) {
|
|
19020
|
+
try {
|
|
19021
|
+
import_node_fs27.default.linkSync(import_node_path28.default.join(installDir, child), import_node_path28.default.join(targetDir, child));
|
|
19022
|
+
} catch (error) {
|
|
19023
|
+
if (!(error instanceof Error && "code" in error && error.code === "EEXIST"))
|
|
19024
|
+
throw error;
|
|
19025
|
+
}
|
|
19026
|
+
}
|
|
19027
|
+
}
|
|
19028
|
+
};
|
|
19029
|
+
try {
|
|
19030
|
+
link("");
|
|
19031
|
+
import_node_fs27.default.writeFileSync(import_node_path28.default.join(installDir, RUNTIME_MERGE_PACK_MERGED), "");
|
|
19032
|
+
return true;
|
|
19033
|
+
} catch (error) {
|
|
19034
|
+
console.error(
|
|
19035
|
+
`[peach] ${name2} pack merge failed: ${error instanceof Error ? error.message : String(error)}`
|
|
19036
|
+
);
|
|
19037
|
+
return false;
|
|
19038
|
+
}
|
|
19039
|
+
}
|
|
19040
|
+
async function installPack(runtimeRoot, prefix2, destDir) {
|
|
19041
|
+
const marker = import_node_path28.default.join(destDir, RUNTIME_PACK_MARKER);
|
|
19042
|
+
if (import_node_fs27.default.existsSync(marker)) return true;
|
|
19043
|
+
const pack = readPacks(runtimeRoot)?.[prefix2];
|
|
19044
|
+
if (!pack) return true;
|
|
19045
|
+
let install = inflight.get(destDir);
|
|
19046
|
+
if (!install) {
|
|
19047
|
+
const version = import_node_path28.default.basename(runtimeRoot);
|
|
19048
|
+
const url = new URL(pack.file, rnxRuntime.tarballUrl(version));
|
|
19049
|
+
url.searchParams.set("sha256", pack.sha256);
|
|
19050
|
+
install = installVerifiedTarball({
|
|
19051
|
+
url: url.toString(),
|
|
19052
|
+
digest: { algorithm: "sha256", encoding: "hex", value: pack.sha256 },
|
|
19053
|
+
destDir,
|
|
19054
|
+
installedMarker: RUNTIME_PACK_MARKER,
|
|
19055
|
+
label: `peach runtime ${version} pack ${prefix2}`
|
|
19056
|
+
}).catch((error) => {
|
|
19057
|
+
console.error(
|
|
19058
|
+
`[peach] ${prefix2} pack download failed: ${error instanceof Error ? error.message : String(error)}`
|
|
19059
|
+
);
|
|
19060
|
+
}).finally(() => inflight.delete(destDir));
|
|
19061
|
+
inflight.set(destDir, install);
|
|
19062
|
+
}
|
|
19063
|
+
await install;
|
|
19064
|
+
return import_node_fs27.default.existsSync(marker);
|
|
19065
|
+
}
|
|
19066
|
+
|
|
17855
19067
|
// src/runtimePlatformContract.ts
|
|
17856
19068
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
17857
19069
|
var IOS_ADAPTER = Object.freeze({
|
|
@@ -17987,7 +19199,7 @@ function withPeach(config, options = {}) {
|
|
|
17987
19199
|
const configuredBundleUrl = "/index.bundle?platform=ios&dev=true&hot=true&minify=false";
|
|
17988
19200
|
const cfgServer = config.server;
|
|
17989
19201
|
const port = resolveMetroPort(cfgServer);
|
|
17990
|
-
const metroServerId = (0,
|
|
19202
|
+
const metroServerId = (0, import_node_crypto8.randomUUID)();
|
|
17991
19203
|
const bundleUrl = tagRnxBundleForPlugin(
|
|
17992
19204
|
configuredBundleUrl,
|
|
17993
19205
|
`http://localhost:${port}`,
|
|
@@ -18118,7 +19330,7 @@ function withPeach(config, options = {}) {
|
|
|
18118
19330
|
return middleware;
|
|
18119
19331
|
}
|
|
18120
19332
|
const server = connect();
|
|
18121
|
-
server.use((req, res, next) => {
|
|
19333
|
+
server.use(async (req, res, next) => {
|
|
18122
19334
|
if (isReplacementModuleRequestUrl(req.url)) {
|
|
18123
19335
|
void handleReplacementModuleRequest(req, res, {
|
|
18124
19336
|
servedRoots: [cfgProjectRoot, ...cfgWatchFolders],
|
|
@@ -18162,6 +19374,7 @@ function withPeach(config, options = {}) {
|
|
|
18162
19374
|
next();
|
|
18163
19375
|
return;
|
|
18164
19376
|
}
|
|
19377
|
+
await ensureRuntimePackFor(runtimeRoot, pathname);
|
|
18165
19378
|
if (isRootRuntimeAssetPath(pathname)) {
|
|
18166
19379
|
const fullPath = resolveRuntimeFilePath(runtimeRoot, pathname);
|
|
18167
19380
|
if (fullPath) {
|