peachsim 0.1.2210 → 0.1.2215
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/command-registry.ts +1 -0
- package/cli/commands/inspect/settling.ts +1 -1
- package/cli/commands/map.ts +576 -0
- package/cli/commands/runtime.ts +1 -1
- package/cli/main.ts +6 -0
- package/cli/outbound-endpoints.ts +11 -0
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +31 -13
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +6 -3
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +29 -11
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +1019 -819
- package/dist-lib/host/fetch-proxy-handler.cjs +8 -5
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1956 -752
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +1796 -593
- package/dist-lib/native-app-identity-project.cjs +6 -3
- package/dist-lib/native-app-identity-project.mjs +6 -3
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +25 -24
- package/dist-lib/public-origins-lib.json +73 -53
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/reap-browser.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +2 -2
- package/dist-lib/sdk.mjs +2 -2
- package/dist-lib/skills.cjs +1555 -1297
- package/dist-lib/swift-compile.cjs +2 -2
- package/dist-lib/swift-compile.mjs +2 -2
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +21 -9
- package/dist-lib/vite.cjs +1520 -303
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/native-layout.d.ts +4 -0
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/scene-table.d.ts +4 -0
- package/dist-types/packages/peach-engine/src/engine/scroll.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +42 -0
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/CoreData.apinotes +35 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/CoreData.h +8 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSAttributeDescription.h +30 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSEntityDescription.h +14 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSExpressionDescription.h +10 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSFetchIndexDescription.h +13 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSFetchIndexElementDescription.h +18 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObject.h +11 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObjectContext.h +19 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObjectID.h +2 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObjectModel.h +3 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSMergePolicy.h +17 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSPersistentStore.h +8 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSPersistentStoreCoordinator.h +6 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSPropertyDescription.h +13 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSRelationshipDescription.h +21 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIImage.h +1 -10
- package/sdk/ios/System/Library/Frameworks/UIKitTypes.framework/Headers/UIKitTypes.h +11 -0
- package/sdk/ios/wasm/include/fcntl.h +3 -0
- package/skills/contrast/SKILL.md +1 -0
- package/src/home-paths.ts +1 -1
- package/src/host/bridge-host.ts +101 -97
- package/src/metro-plugin.ts +4 -1
- package/src/react-native-coverage/native-source-ranges-file.ts +1 -1
- package/src/runtime-assets.ts +0 -1
- package/src/runtime-delivery.ts +1 -1
- package/src/runtime-packs.ts +212 -0
- package/src/swift-package-manifest.ts +7 -2
- package/src/swift-shipped-binaries.ts +1 -1
- package/src/swift-standin-config.ts +4 -2
- package/src/swift-standin-emit.ts +1 -1
- package/src/swift-standins.ts +10 -3
- package/src/vite-plugin-one.ts +4 -1
package/dist-lib/metro.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2215 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -39,7 +39,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
39
39
|
var define_SWIFT_COVERAGE_SOURCE_DIGESTS_default;
|
|
40
40
|
var init_define_SWIFT_COVERAGE_SOURCE_DIGESTS = __esm({
|
|
41
41
|
"<define:__SWIFT_COVERAGE_SOURCE_DIGESTS__>"() {
|
|
42
|
-
define_SWIFT_COVERAGE_SOURCE_DIGESTS_default = { "swift-coverage/indexdump.ts": "0d82d8eeb96bf377f409ea7e33274c341a710c0e071f6b6e17571a23d8d92412", "swift-coverage/indexing.ts": "633ccf19eec1f382a8847d0ee1dca42a2792a3c60aafd43622ed5152b09b8272", "swift-coverage/types.ts": "bd8fae54ea6c53e110cd8a5d7b57c1d532dd0166e09fdaea63c4f270c3780dd1", "swift-coverage/source.ts": "c151758a9f67631bc61473c375df0dc017da6902a34533b2cf4fc4fd7d19b6ee", "swift-coverage/package.ts": "1f0068be7461fa7c5a7a891faf318f305cbed2e94c19667ba76627f7e5be260b", "swift-coverage/xcode.ts": "65a500b806ce1c3a496de27f2e0ad77287c0f6795c618342c08af647f92af1fa", "swift-coverage/xcode-assets.ts": "99e03b74c961d2449afd58c2cbc415ba91d1d469a4f89e461c137fd6c305b27c", "swift-coverage/xcode-asset-symbols.ts": "1b2a67733bc9d139b351466270205452a6172140bc25080d72619e2952c44671", "swift-coverage/xcode-bridging.ts": "33184be8c5daf6646aa5a1276a4e15531f1be27b7c26f56550e0fbb1fc678a11", "swift-coverage/xcode-packages.ts": "8e6020d17d24474150a5a50d042aca6261819ef75c79680a287a66f395909915", "swift-coverage/xcode-strings.ts": "f2dd4c7cd8ef77035184b0132909c2fa09fd20ed06b7757c2f1f960bfdde031c", "swift-coverage/reader.ts": "da559b67ecd1161dea70c980b5f98f2c55af3550f0714479100fa5e9e813625c", "swift-coverage/provenance.ts": "eb3b41ae8b58b48f6758f084800f188dfb1edb227e483abdd6b80cde66e849b9", "swift-package-manifest.ts": "
|
|
42
|
+
define_SWIFT_COVERAGE_SOURCE_DIGESTS_default = { "swift-coverage/indexdump.ts": "0d82d8eeb96bf377f409ea7e33274c341a710c0e071f6b6e17571a23d8d92412", "swift-coverage/indexing.ts": "633ccf19eec1f382a8847d0ee1dca42a2792a3c60aafd43622ed5152b09b8272", "swift-coverage/types.ts": "bd8fae54ea6c53e110cd8a5d7b57c1d532dd0166e09fdaea63c4f270c3780dd1", "swift-coverage/source.ts": "c151758a9f67631bc61473c375df0dc017da6902a34533b2cf4fc4fd7d19b6ee", "swift-coverage/package.ts": "1f0068be7461fa7c5a7a891faf318f305cbed2e94c19667ba76627f7e5be260b", "swift-coverage/xcode.ts": "65a500b806ce1c3a496de27f2e0ad77287c0f6795c618342c08af647f92af1fa", "swift-coverage/xcode-assets.ts": "99e03b74c961d2449afd58c2cbc415ba91d1d469a4f89e461c137fd6c305b27c", "swift-coverage/xcode-asset-symbols.ts": "1b2a67733bc9d139b351466270205452a6172140bc25080d72619e2952c44671", "swift-coverage/xcode-bridging.ts": "33184be8c5daf6646aa5a1276a4e15531f1be27b7c26f56550e0fbb1fc678a11", "swift-coverage/xcode-packages.ts": "8e6020d17d24474150a5a50d042aca6261819ef75c79680a287a66f395909915", "swift-coverage/xcode-strings.ts": "f2dd4c7cd8ef77035184b0132909c2fa09fd20ed06b7757c2f1f960bfdde031c", "swift-coverage/reader.ts": "da559b67ecd1161dea70c980b5f98f2c55af3550f0714479100fa5e9e813625c", "swift-coverage/provenance.ts": "eb3b41ae8b58b48f6758f084800f188dfb1edb227e483abdd6b80cde66e849b9", "swift-package-manifest.ts": "29c2661be4b952101c9b9b8fd861560e6ce63b25dd4464f47475aaf72024f4fe", "swift-package.ts": "338cfef9a34a930206ac2e1a8a90b85c8d61f776d9a41e6445dc18e0c5385cdb", "swift-source-file.ts": "93fd659ed63a27b67f54a7c229a7ceb636dc9c59e68414920ba36cff1eda1f94", "swift-toolchain.ts": "25505683ca29a0b380413bf2a5026d4967eacf886e35bc11ece6e15317e5bb02", "home-paths.ts": "d1606390f0e8e50f0ff72544eadb3d49dfabf08e004c1218f2998c36fb8995dd", "xcode-header-search.ts": "f8c3d557b4eca5ddad32907545353eb7ad53b2ebd0969d9ed8f7275e109a13b1", "xcode-project.ts": "86f79e98323ec065e0e5195324c75ca608f490efbd95dcc25c53d5aa0b9aecc9", "xcode-target-members.ts": "ad7589132bffab265e8a10b64e24484fe88b4a2b1cc0ee19a97f151a002eca77", "xcode-json-project.ts": "41990ebbe4b488eef34e74c4608b4b48e5a5b299ba98ca7fbcfdfa0e77be63b6", "openstep-plist.ts": "74e6ce1dac80c9c318e0e9f5e3e8cd19a898a8820c36fc160609695bcb59dcd3" };
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
|
|
@@ -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,984 @@ 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/named/",
|
|
7732
|
+
"engine/fonts/vector-icons/",
|
|
7733
|
+
"engine/fonts/webview/",
|
|
7734
|
+
"engine/kotlin/",
|
|
7735
|
+
"engine/material-symbols/",
|
|
7736
|
+
"engine/pdfjs/",
|
|
7737
|
+
"three-mode/"
|
|
7738
|
+
];
|
|
7739
|
+
var RUNTIME_MERGE_PACK_DIR = "engine-tenant/";
|
|
7740
|
+
var RUNTIME_MERGE_PACK_INSTALL = ".pack-prod";
|
|
7741
|
+
var RUNTIME_MERGE_PACK_MERGED = ".merged";
|
|
7742
|
+
|
|
7743
|
+
// ../contrast-runtime-delivery/src/index.ts
|
|
7744
|
+
var DEFAULT_LOCAL_RUNTIME_RETENTION_COUNT = 2;
|
|
7745
|
+
function createRuntimeDelivery(product) {
|
|
7746
|
+
function readConfig() {
|
|
7747
|
+
try {
|
|
7748
|
+
const parsed = JSON.parse(
|
|
7749
|
+
import_node_fs9.default.readFileSync(product.configFile(), "utf8")
|
|
7750
|
+
);
|
|
7751
|
+
return parsed && typeof parsed === "object" ? parsed : {};
|
|
7752
|
+
} catch {
|
|
7753
|
+
return {};
|
|
7754
|
+
}
|
|
7755
|
+
}
|
|
7756
|
+
function resolveCdnOrigin(input) {
|
|
7757
|
+
const config = readConfig();
|
|
7758
|
+
const value = input || process.env[product.env.cdnOrigin] || config.cdnOrigin || product.defaultCdnOrigin;
|
|
7759
|
+
return value.replace(/\/+$/, "");
|
|
7760
|
+
}
|
|
7761
|
+
function resolveChannel(input) {
|
|
7762
|
+
const config = readConfig();
|
|
7763
|
+
return input || process.env[product.env.channel] || config.runtimeChannel || product.defaultChannel || "stable";
|
|
7764
|
+
}
|
|
7765
|
+
function resolvePin() {
|
|
7766
|
+
if (!product.env.pin) return null;
|
|
7767
|
+
const env = process.env[product.env.pin];
|
|
7768
|
+
if (env && env.trim()) return env.trim();
|
|
7769
|
+
const config = readConfig();
|
|
7770
|
+
return typeof config.runtimeVersion === "string" && config.runtimeVersion.trim() ? config.runtimeVersion.trim() : null;
|
|
7771
|
+
}
|
|
7772
|
+
function manifestUrl(cdnOrigin) {
|
|
7773
|
+
const url = new URL(`${resolveCdnOrigin(cdnOrigin)}${product.manifestPath}`);
|
|
7774
|
+
url.searchParams.set("t", String(Date.now()));
|
|
7775
|
+
return url.toString();
|
|
7776
|
+
}
|
|
7777
|
+
function tarballUrl(version, cdnOrigin) {
|
|
7778
|
+
return `${resolveCdnOrigin(cdnOrigin)}${product.tarballPath(version)}`;
|
|
7779
|
+
}
|
|
7780
|
+
const UP_TO_DATE_CHECK_TIMEOUT_MS = 2e3;
|
|
7781
|
+
async function fetchManifest(cdnOrigin, timeoutMs) {
|
|
7782
|
+
const url = manifestUrl(cdnOrigin);
|
|
7783
|
+
const res = await fetch(url, {
|
|
7784
|
+
headers: { Accept: "application/json" },
|
|
7785
|
+
// an install is allowed to wait; a best-effort check is not. see
|
|
7786
|
+
// UP_TO_DATE_CHECK_TIMEOUT_MS.
|
|
7787
|
+
...timeoutMs ? { signal: AbortSignal.timeout(timeoutMs) } : {}
|
|
7788
|
+
});
|
|
7789
|
+
if (!res.ok) {
|
|
7790
|
+
throw new Error(`manifest fetch failed: ${res.status} ${res.statusText} (${url})`);
|
|
7791
|
+
}
|
|
7792
|
+
return await res.json();
|
|
7793
|
+
}
|
|
7794
|
+
function resolveVersion(manifest, opts = {}) {
|
|
7795
|
+
const channel = resolveChannel(opts.channel);
|
|
7796
|
+
const version = opts.version || resolvePin() || manifest.channels[channel]?.latest;
|
|
7797
|
+
if (!version) {
|
|
7798
|
+
throw new Error(
|
|
7799
|
+
`no version specified and channel '${channel}' has no latest entry in the manifest`
|
|
7800
|
+
);
|
|
7801
|
+
}
|
|
7802
|
+
if (!isValidRuntimeVersion(version)) {
|
|
7803
|
+
throw new Error(`invalid runtime version: ${version}`);
|
|
7804
|
+
}
|
|
7805
|
+
const entry = manifest.versions[version];
|
|
7806
|
+
if (!entry) {
|
|
7807
|
+
throw new Error(
|
|
7808
|
+
`version ${version} not found in manifest; available: ${Object.keys(manifest.versions).slice(-10).join(", ") || "(none)"}`
|
|
7809
|
+
);
|
|
7810
|
+
}
|
|
7811
|
+
return { version, channel, entry };
|
|
7812
|
+
}
|
|
7813
|
+
async function isVerifiedInstall(dir) {
|
|
7814
|
+
if (!import_node_fs9.default.existsSync(import_node_path7.default.join(dir, product.installedMarker))) return false;
|
|
7815
|
+
try {
|
|
7816
|
+
await product.verifyInstall?.(dir);
|
|
7817
|
+
return true;
|
|
7818
|
+
} catch {
|
|
7819
|
+
return false;
|
|
7820
|
+
}
|
|
7821
|
+
}
|
|
7822
|
+
async function install(opts = {}) {
|
|
7823
|
+
product.ensureHome();
|
|
7824
|
+
const cdnOrigin = resolveCdnOrigin(opts.cdnOrigin);
|
|
7825
|
+
const manifest = await fetchManifest(cdnOrigin);
|
|
7826
|
+
const { version, channel, entry } = resolveVersion(manifest, opts);
|
|
7827
|
+
const destDir = product.runtimeDir(version);
|
|
7828
|
+
const setActive = opts.setActive !== false;
|
|
7829
|
+
const protectVersions = [version, ...opts.protectVersions ?? []];
|
|
7830
|
+
pruneLocalRetention({ protectVersions });
|
|
7831
|
+
if (!opts.force && await isVerifiedInstall(destDir)) {
|
|
7832
|
+
if (setActive) product.writeActiveRuntime(version);
|
|
7833
|
+
pruneLocalRetention({ protectVersions });
|
|
7834
|
+
return {
|
|
7835
|
+
version,
|
|
7836
|
+
channel,
|
|
7837
|
+
cdnOrigin,
|
|
7838
|
+
runtimeDir: destDir,
|
|
7839
|
+
installed: false,
|
|
7840
|
+
activated: setActive,
|
|
7841
|
+
manifest
|
|
7842
|
+
};
|
|
7843
|
+
}
|
|
7844
|
+
if (!opts.quiet)
|
|
7845
|
+
process.stderr.write(`${product.id}: downloading runtime ${version}\u2026
|
|
7846
|
+
`);
|
|
7847
|
+
await installVerifiedTarball({
|
|
7848
|
+
url: entry.base?.tarball || entry.tarball || tarballUrl(version, cdnOrigin),
|
|
7849
|
+
digest: {
|
|
7850
|
+
algorithm: "sha256",
|
|
7851
|
+
encoding: "hex",
|
|
7852
|
+
value: entry.base?.sha256 ?? entry.sha256
|
|
7853
|
+
},
|
|
7854
|
+
destDir,
|
|
7855
|
+
installedMarker: product.installedMarker,
|
|
7856
|
+
verify: product.verifyInstall,
|
|
7857
|
+
label: `runtime ${version}`
|
|
7858
|
+
});
|
|
7859
|
+
if (setActive) product.writeActiveRuntime(version);
|
|
7860
|
+
pruneLocalRetention({ protectVersions });
|
|
7861
|
+
return {
|
|
7862
|
+
version,
|
|
7863
|
+
channel,
|
|
7864
|
+
cdnOrigin,
|
|
7865
|
+
runtimeDir: destDir,
|
|
7866
|
+
installed: true,
|
|
7867
|
+
activated: setActive,
|
|
7868
|
+
manifest
|
|
7869
|
+
};
|
|
7870
|
+
}
|
|
7871
|
+
async function updateToLatest(opts = {}) {
|
|
7872
|
+
product.ensureHome();
|
|
7873
|
+
pruneLocalRetention({ protectVersions: opts.protectVersions });
|
|
7874
|
+
const cdnOrigin = resolveCdnOrigin(opts.cdnOrigin);
|
|
7875
|
+
const channel = resolveChannel(opts.channel);
|
|
7876
|
+
const pin = resolvePin();
|
|
7877
|
+
if (pin) {
|
|
7878
|
+
const activeVersion2 = product.readActiveRuntime();
|
|
7879
|
+
const pinInstalled = await isVerifiedInstall(product.runtimeDir(pin));
|
|
7880
|
+
if (activeVersion2 === pin && pinInstalled) {
|
|
7881
|
+
return {
|
|
7882
|
+
checked: true,
|
|
7883
|
+
updated: false,
|
|
7884
|
+
reason: `runtime is pinned to ${pin}`,
|
|
7885
|
+
activeVersion: activeVersion2,
|
|
7886
|
+
latestVersion: pin
|
|
7887
|
+
};
|
|
7888
|
+
}
|
|
7889
|
+
const installed2 = await install({
|
|
7890
|
+
version: pin,
|
|
7891
|
+
channel,
|
|
7892
|
+
cdnOrigin,
|
|
7893
|
+
setActive: false,
|
|
7894
|
+
protectVersions: opts.protectVersions
|
|
7895
|
+
});
|
|
7896
|
+
return {
|
|
7897
|
+
checked: true,
|
|
7898
|
+
updated: true,
|
|
7899
|
+
reason: `runtime is pinned to ${pin}`,
|
|
7900
|
+
activeVersion: pin,
|
|
7901
|
+
latestVersion: pin,
|
|
7902
|
+
install: installed2
|
|
7903
|
+
};
|
|
7904
|
+
}
|
|
7905
|
+
const manifest = await fetchManifest(cdnOrigin);
|
|
7906
|
+
const latestVersion = manifest.channels[channel]?.latest;
|
|
7907
|
+
if (!latestVersion) {
|
|
7908
|
+
return {
|
|
7909
|
+
checked: true,
|
|
7910
|
+
updated: false,
|
|
7911
|
+
reason: `channel '${channel}' has no latest runtime`,
|
|
7912
|
+
activeVersion: product.readActiveRuntime()
|
|
7913
|
+
};
|
|
7914
|
+
}
|
|
7915
|
+
const entry = manifest.versions[latestVersion];
|
|
7916
|
+
if (!entry) {
|
|
7917
|
+
return {
|
|
7918
|
+
checked: true,
|
|
7919
|
+
updated: false,
|
|
7920
|
+
reason: `manifest is missing version ${latestVersion}`,
|
|
7921
|
+
activeVersion: product.readActiveRuntime(),
|
|
7922
|
+
latestVersion
|
|
7923
|
+
};
|
|
7924
|
+
}
|
|
7925
|
+
const activeVersion = product.readActiveRuntime();
|
|
7926
|
+
const activeDir = activeVersion ? product.runtimeDir(activeVersion) : null;
|
|
7927
|
+
const activeInstalled = activeDir ? await isVerifiedInstall(activeDir) : false;
|
|
7928
|
+
const shouldInstall = !activeVersion || !activeInstalled || compareSemver(latestVersion, activeVersion) > 0;
|
|
7929
|
+
if (!shouldInstall) {
|
|
7930
|
+
return {
|
|
7931
|
+
checked: true,
|
|
7932
|
+
updated: false,
|
|
7933
|
+
reason: "active runtime is current",
|
|
7934
|
+
activeVersion,
|
|
7935
|
+
latestVersion
|
|
7936
|
+
};
|
|
7937
|
+
}
|
|
7938
|
+
const installed = await install({
|
|
7939
|
+
version: latestVersion,
|
|
7940
|
+
channel,
|
|
7941
|
+
cdnOrigin,
|
|
7942
|
+
setActive: false,
|
|
7943
|
+
protectVersions: opts.protectVersions
|
|
7944
|
+
});
|
|
7945
|
+
return {
|
|
7946
|
+
checked: true,
|
|
7947
|
+
updated: true,
|
|
7948
|
+
activeVersion: latestVersion,
|
|
7949
|
+
latestVersion,
|
|
7950
|
+
install: installed
|
|
7951
|
+
};
|
|
7952
|
+
}
|
|
7953
|
+
async function checkUpToDate(opts = {}) {
|
|
7954
|
+
const active = product.readActiveRuntime();
|
|
7955
|
+
const pinned = resolvePin();
|
|
7956
|
+
if (pinned) {
|
|
7957
|
+
return { active, latest: pinned, pinned, outdated: active !== pinned };
|
|
7958
|
+
}
|
|
7959
|
+
try {
|
|
7960
|
+
const manifest = await fetchManifest(
|
|
7961
|
+
resolveCdnOrigin(opts.cdnOrigin),
|
|
7962
|
+
UP_TO_DATE_CHECK_TIMEOUT_MS
|
|
7963
|
+
);
|
|
7964
|
+
const channel = resolveChannel(opts.channel);
|
|
7965
|
+
const latest = manifest.channels[channel]?.latest ?? null;
|
|
7966
|
+
const outdated = !!(latest && (!active || compareSemver(latest, active) > 0));
|
|
7967
|
+
return { active, latest, pinned: null, outdated };
|
|
7968
|
+
} catch {
|
|
7969
|
+
return { active, latest: null, pinned: null, outdated: false };
|
|
7970
|
+
}
|
|
7971
|
+
}
|
|
7972
|
+
function planLocalRetention(opts = {}) {
|
|
7973
|
+
product.ensureHome();
|
|
7974
|
+
const retainVersions = Math.max(
|
|
7975
|
+
1,
|
|
7976
|
+
Math.floor(opts.retainVersions ?? DEFAULT_LOCAL_RUNTIME_RETENTION_COUNT)
|
|
7977
|
+
);
|
|
7978
|
+
const installed = listInstalledRuntimes(product);
|
|
7979
|
+
const installedSet = new Set(installed);
|
|
7980
|
+
const activeVersion = product.readActiveRuntime();
|
|
7981
|
+
const pinnedVersion = resolvePin();
|
|
7982
|
+
const keep = /* @__PURE__ */ new Set();
|
|
7983
|
+
for (const version of [
|
|
7984
|
+
activeVersion,
|
|
7985
|
+
pinnedVersion,
|
|
7986
|
+
...opts.protectVersions ?? []
|
|
7987
|
+
]) {
|
|
7988
|
+
if (version && installedSet.has(version)) keep.add(version);
|
|
7989
|
+
}
|
|
7990
|
+
for (const version of [...installed].reverse()) {
|
|
7991
|
+
if (keep.size >= retainVersions) break;
|
|
7992
|
+
keep.add(version);
|
|
7993
|
+
}
|
|
7994
|
+
const cacheTemplateMarker = "__RUNTIME_VERSION__";
|
|
7995
|
+
const cacheTemplate = runtimeTarballCacheName(product, cacheTemplateMarker);
|
|
7996
|
+
const markerOffset = cacheTemplate.indexOf(cacheTemplateMarker);
|
|
7997
|
+
const cachePrefix = cacheTemplate.slice(0, markerOffset);
|
|
7998
|
+
const cacheSuffix = cacheTemplate.slice(markerOffset + cacheTemplateMarker.length);
|
|
7999
|
+
let removeCacheFiles = [];
|
|
8000
|
+
if (markerOffset >= 0) {
|
|
8001
|
+
try {
|
|
8002
|
+
removeCacheFiles = import_node_fs9.default.readdirSync(product.cacheDir(), { withFileTypes: true }).filter((entry) => {
|
|
8003
|
+
if (!entry.isFile()) return false;
|
|
8004
|
+
const complete = entry.name.startsWith(cachePrefix) && entry.name.endsWith(cacheSuffix);
|
|
8005
|
+
const partial = entry.name.startsWith(cachePrefix) && entry.name.endsWith(`${cacheSuffix}.partial`);
|
|
8006
|
+
return complete || partial;
|
|
8007
|
+
}).map((entry) => import_node_path7.default.join(product.cacheDir(), entry.name)).sort();
|
|
8008
|
+
} catch {
|
|
8009
|
+
}
|
|
8010
|
+
}
|
|
8011
|
+
return {
|
|
8012
|
+
activeVersion,
|
|
8013
|
+
pinnedVersion,
|
|
8014
|
+
keepVersions: installed.filter((version) => keep.has(version)),
|
|
8015
|
+
removeVersions: installed.filter((version) => !keep.has(version)),
|
|
8016
|
+
removeCacheFiles
|
|
8017
|
+
};
|
|
8018
|
+
}
|
|
8019
|
+
function pruneLocalRetention(opts = {}) {
|
|
8020
|
+
const plan = planLocalRetention(opts);
|
|
8021
|
+
for (const version of plan.removeVersions) {
|
|
8022
|
+
import_node_fs9.default.rmSync(product.runtimeDir(version), { recursive: true, force: true });
|
|
8023
|
+
}
|
|
8024
|
+
for (const cacheFile of plan.removeCacheFiles) {
|
|
8025
|
+
import_node_fs9.default.rmSync(cacheFile, { force: true });
|
|
8026
|
+
}
|
|
8027
|
+
return plan;
|
|
8028
|
+
}
|
|
8029
|
+
return {
|
|
8030
|
+
product,
|
|
8031
|
+
resolveCdnOrigin,
|
|
8032
|
+
resolveChannel,
|
|
8033
|
+
resolvePin,
|
|
8034
|
+
manifestUrl,
|
|
8035
|
+
tarballUrl,
|
|
8036
|
+
fetchManifest,
|
|
8037
|
+
resolveVersion,
|
|
8038
|
+
install,
|
|
8039
|
+
updateToLatest,
|
|
8040
|
+
checkUpToDate,
|
|
8041
|
+
planLocalRetention,
|
|
8042
|
+
pruneLocalRetention,
|
|
8043
|
+
listInstalled: () => listInstalledRuntimes(product)
|
|
8044
|
+
};
|
|
8045
|
+
}
|
|
8046
|
+
async function installVerifiedTarball(tarball) {
|
|
8047
|
+
const { destDir, installedMarker, signal } = tarball;
|
|
8048
|
+
import_node_fs9.default.mkdirSync(import_node_path7.default.dirname(destDir), { recursive: true });
|
|
8049
|
+
const presentAtStart = import_node_fs9.default.existsSync(import_node_path7.default.join(destDir, installedMarker));
|
|
8050
|
+
const lock = `${destDir}.lock`;
|
|
8051
|
+
for (; ; ) {
|
|
8052
|
+
signal?.throwIfAborted();
|
|
8053
|
+
try {
|
|
8054
|
+
import_node_fs9.default.writeFileSync(lock, String(process.pid), { flag: "wx" });
|
|
8055
|
+
break;
|
|
8056
|
+
} catch (err) {
|
|
8057
|
+
if (!isErrnoCode(err, "EEXIST")) throw err;
|
|
8058
|
+
if (lockOwnerGone(lock)) import_node_fs9.default.rmSync(lock, { force: true });
|
|
8059
|
+
else await new Promise((resolve4) => setTimeout(resolve4, 250));
|
|
8060
|
+
}
|
|
8061
|
+
}
|
|
8062
|
+
try {
|
|
8063
|
+
if (!presentAtStart && import_node_fs9.default.existsSync(import_node_path7.default.join(destDir, installedMarker))) {
|
|
8064
|
+
await tarball.verify?.(destDir);
|
|
8065
|
+
return;
|
|
8066
|
+
}
|
|
8067
|
+
await installVerifiedTarballLocked(tarball, presentAtStart);
|
|
8068
|
+
} finally {
|
|
8069
|
+
import_node_fs9.default.rmSync(lock, { force: true });
|
|
8070
|
+
}
|
|
8071
|
+
}
|
|
8072
|
+
function lockOwnerGone(lock) {
|
|
8073
|
+
try {
|
|
8074
|
+
process.kill(Number(import_node_fs9.default.readFileSync(lock, "utf8")), 0);
|
|
8075
|
+
return false;
|
|
8076
|
+
} catch (err) {
|
|
8077
|
+
return !isErrnoCode(err, "EPERM", "ENOENT");
|
|
8078
|
+
}
|
|
8079
|
+
}
|
|
8080
|
+
async function installVerifiedTarballLocked(tarball, presentAtStart) {
|
|
8081
|
+
const { url, digest, destDir, installedMarker, label, signal } = tarball;
|
|
8082
|
+
signal?.throwIfAborted();
|
|
8083
|
+
const downloadDir = import_node_fs9.default.mkdtempSync(import_node_path7.default.join(import_node_os3.default.tmpdir(), "runtime-delivery-download-"));
|
|
8084
|
+
const archivePath = import_node_path7.default.join(downloadDir, "archive");
|
|
8085
|
+
const tmpDir = import_node_fs9.default.mkdtempSync(
|
|
8086
|
+
import_node_path7.default.join(import_node_path7.default.dirname(destDir), `.installing-${import_node_path7.default.basename(destDir)}-`)
|
|
8087
|
+
);
|
|
8088
|
+
try {
|
|
8089
|
+
await downloadToFile(url, archivePath, signal);
|
|
8090
|
+
const actual = await digestFile(
|
|
8091
|
+
archivePath,
|
|
8092
|
+
digest.algorithm,
|
|
8093
|
+
digest.encoding,
|
|
8094
|
+
signal
|
|
8095
|
+
);
|
|
8096
|
+
if (actual !== digest.value) {
|
|
8097
|
+
throw new Error(
|
|
8098
|
+
`${digest.algorithm} mismatch for ${label}: expected ${digest.value}, actual ${actual}`
|
|
8099
|
+
);
|
|
8100
|
+
}
|
|
8101
|
+
const { pathname } = new URL(url);
|
|
8102
|
+
if (pathname.endsWith(".zip")) await extractZip(archivePath, tmpDir, signal);
|
|
8103
|
+
else
|
|
8104
|
+
await extractTarball(
|
|
8105
|
+
archivePath,
|
|
8106
|
+
pathname.endsWith(".tar.zst"),
|
|
8107
|
+
tmpDir,
|
|
8108
|
+
tarball.stripComponents ?? 0,
|
|
8109
|
+
signal
|
|
8110
|
+
);
|
|
8111
|
+
signal?.throwIfAborted();
|
|
8112
|
+
if (!import_node_fs9.default.existsSync(import_node_path7.default.join(tmpDir, installedMarker))) {
|
|
8113
|
+
throw new Error(`extracted tarball for ${label} is missing ${installedMarker}`);
|
|
8114
|
+
}
|
|
8115
|
+
await tarball.verify?.(tmpDir);
|
|
8116
|
+
signal?.throwIfAborted();
|
|
8117
|
+
try {
|
|
8118
|
+
import_node_fs9.default.renameSync(tmpDir, destDir);
|
|
8119
|
+
} catch (err) {
|
|
8120
|
+
if (!isErrnoCode(err, "ENOTEMPTY", "EEXIST")) throw err;
|
|
8121
|
+
if (!presentAtStart && import_node_fs9.default.existsSync(import_node_path7.default.join(destDir, installedMarker))) {
|
|
8122
|
+
await tarball.verify?.(destDir);
|
|
8123
|
+
return;
|
|
8124
|
+
}
|
|
8125
|
+
const aside = `${tmpDir}-replaced`;
|
|
8126
|
+
try {
|
|
8127
|
+
import_node_fs9.default.renameSync(destDir, aside);
|
|
8128
|
+
} catch (moveErr) {
|
|
8129
|
+
if (!isErrnoCode(moveErr, "ENOENT")) throw moveErr;
|
|
8130
|
+
}
|
|
8131
|
+
try {
|
|
8132
|
+
import_node_fs9.default.renameSync(tmpDir, destDir);
|
|
8133
|
+
} catch (landErr) {
|
|
8134
|
+
if (!isErrnoCode(landErr, "ENOTEMPTY", "EEXIST") || !import_node_fs9.default.existsSync(import_node_path7.default.join(destDir, installedMarker))) {
|
|
8135
|
+
throw landErr;
|
|
8136
|
+
}
|
|
8137
|
+
await tarball.verify?.(destDir);
|
|
8138
|
+
} finally {
|
|
8139
|
+
import_node_fs9.default.rmSync(aside, { recursive: true, force: true });
|
|
8140
|
+
}
|
|
8141
|
+
}
|
|
8142
|
+
} finally {
|
|
8143
|
+
import_node_fs9.default.rmSync(tmpDir, { recursive: true, force: true });
|
|
8144
|
+
import_node_fs9.default.rmSync(downloadDir, { recursive: true, force: true });
|
|
8145
|
+
}
|
|
8146
|
+
}
|
|
8147
|
+
function isErrnoCode(err, ...codes) {
|
|
8148
|
+
return err instanceof Error && "code" in err && codes.includes(String(err.code));
|
|
8149
|
+
}
|
|
8150
|
+
async function downloadToFile(url, destPath, signal) {
|
|
8151
|
+
const res = await fetch(url, { signal });
|
|
8152
|
+
if (!res.ok || !res.body) {
|
|
8153
|
+
throw new Error(`download failed: ${res.status} ${res.statusText} (${url})`);
|
|
8154
|
+
}
|
|
8155
|
+
import_node_fs9.default.mkdirSync(import_node_path7.default.dirname(destPath), { recursive: true });
|
|
8156
|
+
const tmp = `${destPath}.partial`;
|
|
8157
|
+
try {
|
|
8158
|
+
await (0, import_promises2.pipeline)(
|
|
8159
|
+
import_node_stream2.Readable.fromWeb(res.body),
|
|
8160
|
+
import_node_fs9.default.createWriteStream(tmp),
|
|
8161
|
+
{ signal }
|
|
8162
|
+
);
|
|
8163
|
+
signal?.throwIfAborted();
|
|
8164
|
+
import_node_fs9.default.renameSync(tmp, destPath);
|
|
8165
|
+
} catch (err) {
|
|
8166
|
+
try {
|
|
8167
|
+
import_node_fs9.default.unlinkSync(tmp);
|
|
8168
|
+
} catch {
|
|
8169
|
+
}
|
|
8170
|
+
throw err;
|
|
8171
|
+
}
|
|
8172
|
+
}
|
|
8173
|
+
async function digestFile(filePath, algorithm, encoding, signal) {
|
|
8174
|
+
const hash = import_node_crypto2.default.createHash(algorithm);
|
|
8175
|
+
await (0, import_promises2.pipeline)(import_node_fs9.default.createReadStream(filePath), hash, { signal });
|
|
8176
|
+
return hash.digest(encoding);
|
|
8177
|
+
}
|
|
8178
|
+
function extractZip(zipPath, destDir, signal) {
|
|
8179
|
+
return runExtractor("ditto", ["-x", "-k", zipPath, destDir], signal);
|
|
8180
|
+
}
|
|
8181
|
+
async function extractTarball(tarPath, zstd, destDir, stripComponents, signal) {
|
|
8182
|
+
const args = [zstd ? "-xf" : "-xzf", "-"];
|
|
8183
|
+
if (stripComponents > 0) args.push(`--strip-components=${stripComponents}`);
|
|
8184
|
+
if (zstd) {
|
|
8185
|
+
const decoder = import_node_zlib.default.createZstdDecompress({
|
|
8186
|
+
params: { [import_node_zlib.default.constants.ZSTD_d_windowLogMax]: 30 }
|
|
8187
|
+
});
|
|
8188
|
+
await runExtractor("tar", args, signal, {
|
|
8189
|
+
cwd: destDir,
|
|
8190
|
+
stdin: (stdin) => (0, import_promises2.pipeline)(import_node_fs9.default.createReadStream(tarPath), decoder, stdin, { signal })
|
|
8191
|
+
});
|
|
8192
|
+
return;
|
|
8193
|
+
}
|
|
8194
|
+
const archive = import_node_fs9.default.openSync(tarPath, "r");
|
|
8195
|
+
try {
|
|
8196
|
+
await runExtractor("tar", args, signal, { cwd: destDir, stdin: archive });
|
|
8197
|
+
} finally {
|
|
8198
|
+
import_node_fs9.default.closeSync(archive);
|
|
8199
|
+
}
|
|
8200
|
+
}
|
|
8201
|
+
async function runExtractor(command, args, signal, input) {
|
|
8202
|
+
signal?.throwIfAborted();
|
|
8203
|
+
const stdin = input?.stdin;
|
|
8204
|
+
const stdio = [
|
|
8205
|
+
typeof stdin === "function" ? "pipe" : stdin ?? "ignore",
|
|
8206
|
+
"inherit",
|
|
8207
|
+
"inherit"
|
|
8208
|
+
];
|
|
8209
|
+
const child = (0, import_node_child_process5.spawn)(command, args, {
|
|
8210
|
+
cwd: input?.cwd,
|
|
8211
|
+
stdio,
|
|
8212
|
+
detached: process.platform !== "win32"
|
|
8213
|
+
});
|
|
8214
|
+
const fed = typeof stdin === "function" && child.stdin ? stdin(child.stdin) : void 0;
|
|
8215
|
+
void fed?.catch(() => {
|
|
8216
|
+
});
|
|
8217
|
+
let stopping;
|
|
8218
|
+
const abort = () => {
|
|
8219
|
+
stopping ??= terminateProcessGroup(child, "SIGKILL", 0);
|
|
8220
|
+
void stopping.catch(() => {
|
|
8221
|
+
});
|
|
8222
|
+
};
|
|
8223
|
+
try {
|
|
8224
|
+
await new Promise((resolve4, reject) => {
|
|
8225
|
+
let failure;
|
|
8226
|
+
child.on("error", (error) => {
|
|
8227
|
+
failure = error;
|
|
8228
|
+
});
|
|
8229
|
+
child.on("close", (code) => {
|
|
8230
|
+
if (signal?.aborted) {
|
|
8231
|
+
const reason = signal.reason;
|
|
8232
|
+
reject(
|
|
8233
|
+
reason instanceof Error ? reason : new Error("Extraction canceled", { cause: reason })
|
|
8234
|
+
);
|
|
8235
|
+
} else if (failure) reject(failure);
|
|
8236
|
+
else if (code === 0) resolve4();
|
|
8237
|
+
else reject(new Error(`${command} exited with code ${code}`));
|
|
8238
|
+
});
|
|
8239
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
8240
|
+
if (signal?.aborted) abort();
|
|
8241
|
+
});
|
|
8242
|
+
await fed;
|
|
8243
|
+
} finally {
|
|
8244
|
+
signal?.removeEventListener("abort", abort);
|
|
8245
|
+
await stopping;
|
|
8246
|
+
}
|
|
8247
|
+
}
|
|
7258
8248
|
|
|
7259
8249
|
// src/runtime-assets.ts
|
|
7260
8250
|
init_home_paths();
|
|
@@ -7320,7 +8310,6 @@ var ROOT_RUNTIME_PATHS = [
|
|
|
7320
8310
|
"/fonts/",
|
|
7321
8311
|
"/icons/",
|
|
7322
8312
|
"/sounds/",
|
|
7323
|
-
"/spike/",
|
|
7324
8313
|
"/test-wallpaper.jpg",
|
|
7325
8314
|
"/preview-sw.js",
|
|
7326
8315
|
"/preview/guest-bridge-host.js",
|
|
@@ -7471,10 +8460,10 @@ function peachRuntimeRoot() {
|
|
|
7471
8460
|
|
|
7472
8461
|
// src/expo-autolinking.ts
|
|
7473
8462
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
7474
|
-
var
|
|
8463
|
+
var import_node_child_process6 = require("node:child_process");
|
|
7475
8464
|
var import_node_util3 = require("node:util");
|
|
7476
8465
|
init_forked_script_contract();
|
|
7477
|
-
var run3 = (0, import_node_util3.promisify)(
|
|
8466
|
+
var run3 = (0, import_node_util3.promisify)(import_node_child_process6.execFile);
|
|
7478
8467
|
|
|
7479
8468
|
// src/expo-native-prebuilt.ts
|
|
7480
8469
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -7491,21 +8480,21 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
7491
8480
|
|
|
7492
8481
|
// src/swift-objc-sdk-tree.ts
|
|
7493
8482
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
7494
|
-
var
|
|
7495
|
-
var
|
|
8483
|
+
var import_node_fs11 = require("node:fs");
|
|
8484
|
+
var import_node_path9 = __toESM(require("node:path"), 1);
|
|
7496
8485
|
function readIosSdkTree(root) {
|
|
7497
|
-
return (0,
|
|
7498
|
-
const file =
|
|
8486
|
+
return (0, import_node_fs11.readdirSync)(root, { recursive: true, withFileTypes: true }).filter((entry) => entry.isFile()).map((entry) => {
|
|
8487
|
+
const file = import_node_path9.default.join(entry.parentPath, entry.name);
|
|
7499
8488
|
return [
|
|
7500
|
-
|
|
7501
|
-
(0,
|
|
8489
|
+
import_node_path9.default.relative(root, file).split(import_node_path9.default.sep).join("/"),
|
|
8490
|
+
(0, import_node_fs11.readFileSync)(file, "utf8")
|
|
7502
8491
|
];
|
|
7503
8492
|
}).sort(([a], [b]) => a < b ? -1 : 1);
|
|
7504
8493
|
}
|
|
7505
8494
|
|
|
7506
8495
|
// src/swift-standin-digest.ts
|
|
7507
8496
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
7508
|
-
var STANDIN_SOURCE_DIGEST = true ? "
|
|
8497
|
+
var STANDIN_SOURCE_DIGEST = true ? "11f82a07cd8d59c1bfcf554927b6e5a2d9b01d6846fd7107ca7c0f6f30519538" : standinSourceDigest();
|
|
7509
8498
|
|
|
7510
8499
|
// src/expo-native-workspace.ts
|
|
7511
8500
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -7549,10 +8538,10 @@ init_is_record();
|
|
|
7549
8538
|
|
|
7550
8539
|
// src/native-firebase-config.ts
|
|
7551
8540
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
7552
|
-
var
|
|
7553
|
-
var
|
|
7554
|
-
var
|
|
7555
|
-
var
|
|
8541
|
+
var import_node_child_process10 = require("node:child_process");
|
|
8542
|
+
var import_node_fs19 = __toESM(require("node:fs"), 1);
|
|
8543
|
+
var import_node_os5 = __toESM(require("node:os"), 1);
|
|
8544
|
+
var import_node_path19 = __toESM(require("node:path"), 1);
|
|
7556
8545
|
init_is_record();
|
|
7557
8546
|
|
|
7558
8547
|
// src/plist.ts
|
|
@@ -7564,10 +8553,10 @@ function parsePlistSource(source) {
|
|
|
7564
8553
|
|
|
7565
8554
|
// src/xcode-project.ts
|
|
7566
8555
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
7567
|
-
var
|
|
7568
|
-
var
|
|
7569
|
-
var
|
|
7570
|
-
var
|
|
8556
|
+
var import_node_child_process9 = require("node:child_process");
|
|
8557
|
+
var import_node_crypto6 = require("node:crypto");
|
|
8558
|
+
var import_node_fs18 = __toESM(require("node:fs"), 1);
|
|
8559
|
+
var import_node_path18 = __toESM(require("node:path"), 1);
|
|
7571
8560
|
var import_plist2 = __toESM(require("plist"), 1);
|
|
7572
8561
|
init_is_record();
|
|
7573
8562
|
|
|
@@ -7918,7 +8907,7 @@ function parseOpenStepPlist(text2) {
|
|
|
7918
8907
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
7919
8908
|
var NEVER_MEMBER = /(?:^|\/)(?:Info\.plist|[^/]+\.entitlements|[^/]+\.xcconfig|\.DS_Store)$/;
|
|
7920
8909
|
var BUNDLE_DIR = /\.(xcassets|bundle|lproj|xcdatamodeld|scnassets|spriteatlas|rcproject|storyboardc|icon)$/;
|
|
7921
|
-
function xcodePathResolver(objects, projectDir,
|
|
8910
|
+
function xcodePathResolver(objects, projectDir, join8, sourceTreeRoot) {
|
|
7922
8911
|
const parents = /* @__PURE__ */ new Map();
|
|
7923
8912
|
for (const [id, entry] of Object.entries(objects)) {
|
|
7924
8913
|
if (!isDict(entry)) continue;
|
|
@@ -7936,14 +8925,14 @@ function xcodePathResolver(objects, projectDir, join7, sourceTreeRoot) {
|
|
|
7936
8925
|
const own = str(entry.path) ?? "";
|
|
7937
8926
|
const tree2 = str(entry.sourceTree) ?? "<group>";
|
|
7938
8927
|
if (tree2 === "<absolute>") result = own;
|
|
7939
|
-
else if (tree2 === "SOURCE_ROOT") result =
|
|
8928
|
+
else if (tree2 === "SOURCE_ROOT") result = join8(projectDir, own);
|
|
7940
8929
|
else if (tree2 === "<group>") {
|
|
7941
8930
|
const parent = parents.get(id);
|
|
7942
8931
|
const base = parent ? resolve4(parent) : projectDir;
|
|
7943
|
-
if (base !== null) result =
|
|
8932
|
+
if (base !== null) result = join8(base, own);
|
|
7944
8933
|
} else {
|
|
7945
8934
|
const base = sourceTreeRoot?.(tree2);
|
|
7946
|
-
if (base) result =
|
|
8935
|
+
if (base) result = join8(base, own);
|
|
7947
8936
|
}
|
|
7948
8937
|
}
|
|
7949
8938
|
paths.set(id, result);
|
|
@@ -7965,7 +8954,7 @@ function xcodeTargetMemberVisitor(objects) {
|
|
|
7965
8954
|
if (isDict(group) && group.isa === "PBXFileSystemSynchronizedRootGroup")
|
|
7966
8955
|
synchronizedGroups.push({ id, group });
|
|
7967
8956
|
}
|
|
7968
|
-
return (targetId, resolvePath, filesUnder,
|
|
8957
|
+
return (targetId, resolvePath, filesUnder, join8, visit3) => {
|
|
7969
8958
|
const target = objects[targetId];
|
|
7970
8959
|
if (!isDict(target)) return;
|
|
7971
8960
|
for (const phaseId of list(target.buildPhases)) {
|
|
@@ -8000,7 +8989,7 @@ function xcodeTargetMemberVisitor(objects) {
|
|
|
8000
8989
|
for (const relative3 of list(exception.membershipExceptions))
|
|
8001
8990
|
exceptions.add(relative3);
|
|
8002
8991
|
}
|
|
8003
|
-
const members = owned.has(groupId) ? filesUnder(folder) : [...exceptions].flatMap((relative3) => filesUnder(
|
|
8992
|
+
const members = owned.has(groupId) ? filesUnder(folder) : [...exceptions].flatMap((relative3) => filesUnder(join8(folder, relative3)));
|
|
8004
8993
|
for (const file of members) {
|
|
8005
8994
|
const relative3 = file.slice(prefix2.length);
|
|
8006
8995
|
const excepted = [...exceptions].some(
|
|
@@ -8170,10 +9159,10 @@ function appTargetReleaseSettings(pbxproj, targetName, infoPlistRelativePath) {
|
|
|
8170
9159
|
var APP_DELEGATE_PATH_RE = /(?:^|\/)(?:ios\/)?([^/]+)\/AppDelegate\.(?:swift|mm|m)$/;
|
|
8171
9160
|
function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri) {
|
|
8172
9161
|
const pbxprojPath = Object.keys(files).find(
|
|
8173
|
-
(
|
|
9162
|
+
(path29) => /(?:^|\/)ios\/[^/]+\.xcodeproj\/project\.pbxproj$/.test(path29)
|
|
8174
9163
|
) ?? Object.keys(files).find(
|
|
8175
|
-
(
|
|
8176
|
-
) ?? Object.keys(files).find((
|
|
9164
|
+
(path29) => /(?:^|\/)[^/]+\.xcodeproj\/project\.pbxproj$/.test(path29)
|
|
9165
|
+
) ?? Object.keys(files).find((path29) => /(?:^|\/)project\.pbxproj$/.test(path29));
|
|
8177
9166
|
if (!pbxprojPath) return null;
|
|
8178
9167
|
const pbxproj = files[pbxprojPath];
|
|
8179
9168
|
let objects = {};
|
|
@@ -8215,7 +9204,7 @@ function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri)
|
|
|
8215
9204
|
} else if (applicationTargetNames.size === 1) {
|
|
8216
9205
|
targetName = [...applicationTargetNames][0];
|
|
8217
9206
|
} else if (applicationTargetNames.size > 1) {
|
|
8218
|
-
const delegateTargets = Object.keys(files).filter((
|
|
9207
|
+
const delegateTargets = Object.keys(files).filter((path29) => !path29.includes("/Pods/")).map((path29) => path29.match(APP_DELEGATE_PATH_RE)?.[1]).filter(
|
|
8219
9208
|
(name2) => typeof name2 === "string" && applicationTargetNames.has(name2)
|
|
8220
9209
|
);
|
|
8221
9210
|
if (delegateTargets.length === 1) {
|
|
@@ -8431,7 +9420,7 @@ function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri)
|
|
|
8431
9420
|
if (resourceUri) {
|
|
8432
9421
|
if (!selectedTarget)
|
|
8433
9422
|
throw new Error("native app icon target membership is unresolved");
|
|
8434
|
-
const
|
|
9423
|
+
const join8 = (base, own) => {
|
|
8435
9424
|
const segments = [];
|
|
8436
9425
|
for (const segment of `${base}/${own}`.split("/")) {
|
|
8437
9426
|
if (segment === "" || segment === ".") continue;
|
|
@@ -8444,22 +9433,22 @@ function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri)
|
|
|
8444
9433
|
const project = Object.values(objects).find(
|
|
8445
9434
|
(object4) => isRecord(object4) && object4.isa === "PBXProject"
|
|
8446
9435
|
);
|
|
8447
|
-
const projectDir =
|
|
9436
|
+
const projectDir = join8(
|
|
8448
9437
|
pbxprojPath.replace(/(?:^|\/)[^/]+\.xcodeproj\/project\.pbxproj$/, ""),
|
|
8449
9438
|
isRecord(project) && typeof project.projectDirPath === "string" ? project.projectDirPath : ""
|
|
8450
9439
|
);
|
|
8451
9440
|
const paths = Object.keys(files);
|
|
8452
9441
|
xcodeTargetMemberVisitor(objects)(
|
|
8453
9442
|
selectedTarget.id,
|
|
8454
|
-
xcodePathResolver(objects, projectDir,
|
|
9443
|
+
xcodePathResolver(objects, projectDir, join8),
|
|
8455
9444
|
(file) => {
|
|
8456
9445
|
if (Object.hasOwn(files, file)) return [file];
|
|
8457
9446
|
const prefix2 = file === "" ? "" : `${file.replace(/\/$/, "")}/`;
|
|
8458
9447
|
return paths.filter(
|
|
8459
|
-
(
|
|
9448
|
+
(path29) => path29.startsWith(prefix2) && !/(?:^|\/)\./.test(path29.slice(prefix2.length))
|
|
8460
9449
|
);
|
|
8461
9450
|
},
|
|
8462
|
-
|
|
9451
|
+
join8,
|
|
8463
9452
|
(file, kind) => {
|
|
8464
9453
|
if (kind === "resource") resources.add(file);
|
|
8465
9454
|
}
|
|
@@ -8467,7 +9456,7 @@ function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri)
|
|
|
8467
9456
|
}
|
|
8468
9457
|
const rootModuleName = readRootModuleName(
|
|
8469
9458
|
Object.entries(files).filter(
|
|
8470
|
-
([
|
|
9459
|
+
([path29]) => !path29.includes("/Pods/") && (/(?:^|\/)(?:ios\/)?AppDelegate\.(?:swift|mm|m)$/.test(path29) || path29.match(APP_DELEGATE_PATH_RE)?.[1] === targetName)
|
|
8471
9460
|
).map(([, source]) => source)
|
|
8472
9461
|
);
|
|
8473
9462
|
return {
|
|
@@ -8560,26 +9549,26 @@ function extractNativeAppIdentityFromFiles(files, platform, parseInfoPlist, iosT
|
|
|
8560
9549
|
|
|
8561
9550
|
// src/prepared-xcode-phases.ts
|
|
8562
9551
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
8563
|
-
var
|
|
8564
|
-
var
|
|
8565
|
-
var
|
|
9552
|
+
var import_node_crypto3 = require("node:crypto");
|
|
9553
|
+
var import_node_fs14 = __toESM(require("node:fs"), 1);
|
|
9554
|
+
var import_node_path11 = __toESM(require("node:path"), 1);
|
|
8566
9555
|
var workspaces = /* @__PURE__ */ new Map();
|
|
8567
9556
|
var recording;
|
|
8568
9557
|
function relativeFile(root, file) {
|
|
8569
|
-
const relative3 =
|
|
8570
|
-
if (!relative3 || relative3 === ".." || relative3.startsWith(`..${
|
|
9558
|
+
const relative3 = import_node_path11.default.relative(root, file);
|
|
9559
|
+
if (!relative3 || relative3 === ".." || relative3.startsWith(`..${import_node_path11.default.sep}`) || import_node_path11.default.isAbsolute(relative3))
|
|
8571
9560
|
throw new Error(`prepared Xcode output is outside its workspace: ${file}`);
|
|
8572
|
-
return relative3.split(
|
|
9561
|
+
return relative3.split(import_node_path11.default.sep).join("/");
|
|
8573
9562
|
}
|
|
8574
9563
|
function output(root, file) {
|
|
8575
9564
|
const relative3 = relativeFile(root, file);
|
|
8576
|
-
const stat =
|
|
9565
|
+
const stat = import_node_fs14.default.statSync(file, { throwIfNoEntry: false });
|
|
8577
9566
|
if (!stat) return { path: relative3, sha256: null };
|
|
8578
9567
|
if (!stat.isFile()) throw new Error(`prepared Xcode output is not a file: ${file}`);
|
|
8579
|
-
relativeFile(root,
|
|
8580
|
-
const bytes =
|
|
9568
|
+
relativeFile(root, import_node_fs14.default.realpathSync(file));
|
|
9569
|
+
const bytes = import_node_fs14.default.readFileSync(file);
|
|
8581
9570
|
const prefix2 = Buffer.from(root);
|
|
8582
|
-
const hash = (0,
|
|
9571
|
+
const hash = (0, import_node_crypto3.createHash)("sha256");
|
|
8583
9572
|
let offset = 0;
|
|
8584
9573
|
for (let index = bytes.indexOf(prefix2); index !== -1; index = bytes.indexOf(prefix2, offset)) {
|
|
8585
9574
|
hash.update(bytes.subarray(offset, index)).update("\0workspace\0");
|
|
@@ -8593,8 +9582,8 @@ function output(root, file) {
|
|
|
8593
9582
|
}
|
|
8594
9583
|
function preparedXcodePhase(project, target, phase, configuration, outputs, recorded) {
|
|
8595
9584
|
const root = recording?.root ?? [...workspaces.keys()].find((root2) => {
|
|
8596
|
-
const relative3 =
|
|
8597
|
-
return relative3 !== ".." && !relative3.startsWith(`..${
|
|
9585
|
+
const relative3 = import_node_path11.default.relative(root2, project);
|
|
9586
|
+
return relative3 !== ".." && !relative3.startsWith(`..${import_node_path11.default.sep}`) && !import_node_path11.default.isAbsolute(relative3);
|
|
8598
9587
|
});
|
|
8599
9588
|
if (!root) return false;
|
|
8600
9589
|
const entry = {
|
|
@@ -8630,8 +9619,8 @@ function preparedXcodePhase(project, target, phase, configuration, outputs, reco
|
|
|
8630
9619
|
|
|
8631
9620
|
// src/swift-binary-modules.ts
|
|
8632
9621
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
8633
|
-
var
|
|
8634
|
-
var
|
|
9622
|
+
var import_node_fs15 = __toESM(require("node:fs"), 1);
|
|
9623
|
+
var import_node_path12 = __toESM(require("node:path"), 1);
|
|
8635
9624
|
init_home_paths();
|
|
8636
9625
|
|
|
8637
9626
|
// src/swift-package.ts
|
|
@@ -8676,7 +9665,7 @@ function moduleMapName(text2) {
|
|
|
8676
9665
|
}
|
|
8677
9666
|
|
|
8678
9667
|
// src/swift-binary-modules.ts
|
|
8679
|
-
var cacheDir2 =
|
|
9668
|
+
var cacheDir2 = import_node_path12.default.join(cacheDir(), "swift-binary-modules");
|
|
8680
9669
|
function frameworkModules(paths) {
|
|
8681
9670
|
const modules = /* @__PURE__ */ new Set();
|
|
8682
9671
|
for (const file of paths) {
|
|
@@ -8686,21 +9675,21 @@ function frameworkModules(paths) {
|
|
|
8686
9675
|
return [...modules].sort();
|
|
8687
9676
|
}
|
|
8688
9677
|
function localSwiftBinaryModules(dir) {
|
|
8689
|
-
if (!
|
|
8690
|
-
const slices =
|
|
9678
|
+
if (!import_node_fs15.default.existsSync(dir)) return [];
|
|
9679
|
+
const slices = import_node_fs15.default.readdirSync(dir, { withFileTypes: true }).filter((slice) => slice.isDirectory());
|
|
8691
9680
|
const frameworks = frameworkModules(
|
|
8692
9681
|
slices.flatMap(
|
|
8693
|
-
(slice) =>
|
|
9682
|
+
(slice) => import_node_fs15.default.readdirSync(import_node_path12.default.join(dir, slice.name)).map((entry) => `${slice.name}/${entry}`)
|
|
8694
9683
|
)
|
|
8695
9684
|
);
|
|
8696
9685
|
if (frameworks.length > 0) return frameworks;
|
|
8697
9686
|
const modules = /* @__PURE__ */ new Set();
|
|
8698
9687
|
for (const slice of slices) {
|
|
8699
|
-
const headers =
|
|
8700
|
-
if (!
|
|
8701
|
-
for (const file of
|
|
8702
|
-
if (
|
|
8703
|
-
const module2 = moduleMapName(
|
|
9688
|
+
const headers = import_node_path12.default.join(dir, slice.name, "Headers");
|
|
9689
|
+
if (!import_node_fs15.default.existsSync(headers)) continue;
|
|
9690
|
+
for (const file of import_node_fs15.default.readdirSync(headers, { recursive: true, encoding: "utf8" })) {
|
|
9691
|
+
if (import_node_path12.default.basename(file) !== "module.modulemap") continue;
|
|
9692
|
+
const module2 = moduleMapName(import_node_fs15.default.readFileSync(import_node_path12.default.join(headers, file), "utf8"));
|
|
8704
9693
|
if (module2) modules.add(module2);
|
|
8705
9694
|
}
|
|
8706
9695
|
}
|
|
@@ -8712,9 +9701,9 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
8712
9701
|
|
|
8713
9702
|
// src/swift-coverage/provenance.ts
|
|
8714
9703
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
8715
|
-
var
|
|
8716
|
-
var
|
|
8717
|
-
var
|
|
9704
|
+
var import_node_crypto4 = require("node:crypto");
|
|
9705
|
+
var import_node_fs16 = require("node:fs");
|
|
9706
|
+
var import_node_path13 = require("node:path");
|
|
8718
9707
|
var SWIFT_COVERAGE_DIGEST_SOURCES = [
|
|
8719
9708
|
"swift-coverage/indexdump.ts",
|
|
8720
9709
|
"swift-coverage/indexing.ts",
|
|
@@ -8744,11 +9733,11 @@ function swiftCoverageSourceDigests(srcDir) {
|
|
|
8744
9733
|
return Object.fromEntries(
|
|
8745
9734
|
SWIFT_COVERAGE_DIGEST_SOURCES.map((file) => [
|
|
8746
9735
|
file,
|
|
8747
|
-
(0,
|
|
9736
|
+
(0, import_node_crypto4.createHash)("sha256").update((0, import_node_fs16.readFileSync)((0, import_node_path13.join)(srcDir, file))).digest("hex")
|
|
8748
9737
|
])
|
|
8749
9738
|
);
|
|
8750
9739
|
}
|
|
8751
|
-
var swiftCoverageProvenance = typeof define_SWIFT_COVERAGE_SOURCE_DIGESTS_default === "object" ? define_SWIFT_COVERAGE_SOURCE_DIGESTS_default : swiftCoverageSourceDigests((0,
|
|
9740
|
+
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
9741
|
|
|
8753
9742
|
// src/swift-coverage/xcode-asset-symbols.ts
|
|
8754
9743
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -8934,8 +9923,8 @@ var assetSymbolSettingKeys = [
|
|
|
8934
9923
|
|
|
8935
9924
|
// src/swift-package-manifest.ts
|
|
8936
9925
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
8937
|
-
var
|
|
8938
|
-
var
|
|
9926
|
+
var import_node_child_process8 = require("node:child_process");
|
|
9927
|
+
var import_node_path16 = __toESM(require("node:path"), 1);
|
|
8939
9928
|
var import_node_util5 = require("node:util");
|
|
8940
9929
|
init_home_paths();
|
|
8941
9930
|
|
|
@@ -8971,12 +9960,12 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
8971
9960
|
|
|
8972
9961
|
// src/swift-toolchain.ts
|
|
8973
9962
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
8974
|
-
var
|
|
8975
|
-
var
|
|
9963
|
+
var import_node_fs17 = __toESM(require("node:fs"), 1);
|
|
9964
|
+
var import_node_path14 = __toESM(require("node:path"), 1);
|
|
8976
9965
|
function peachsimPackageRoot() {
|
|
8977
9966
|
let dir = __sootsim_import_meta_dirname;
|
|
8978
|
-
while (!
|
|
8979
|
-
dir =
|
|
9967
|
+
while (!import_node_fs17.default.existsSync(import_node_path14.default.join(dir, "package.json")) && dir !== import_node_path14.default.dirname(dir))
|
|
9968
|
+
dir = import_node_path14.default.dirname(dir);
|
|
8980
9969
|
return dir;
|
|
8981
9970
|
}
|
|
8982
9971
|
var SWIFT_HOST_COMPILER_RELEASE = "swift-6.4.0-RELEASE-custom-81b2c791c27276bf";
|
|
@@ -9205,7 +10194,7 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
9205
10194
|
|
|
9206
10195
|
// src/swift-objc-standin.ts
|
|
9207
10196
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
9208
|
-
var
|
|
10197
|
+
var import_node_crypto5 = require("node:crypto");
|
|
9209
10198
|
init_is_record();
|
|
9210
10199
|
|
|
9211
10200
|
// src/swift-interface-bodies.ts
|
|
@@ -9213,10 +10202,10 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
9213
10202
|
|
|
9214
10203
|
// src/swift-objc-sdk.ts
|
|
9215
10204
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
9216
|
-
var
|
|
10205
|
+
var import_node_path15 = __toESM(require("node:path"), 1);
|
|
9217
10206
|
var IOS_SDK_TARGET = "arm64-apple-ios16.0-simulator";
|
|
9218
10207
|
var OVERLAY_PATH = /^usr\/lib\/swift\/([^/]+)\.swiftmodule\/arm64-apple-ios-simulator\.swiftinterface$/;
|
|
9219
|
-
var tree = typeof __PEACH_BUNDLED_IOS_SDK__ === "undefined" ? readIosSdkTree(
|
|
10208
|
+
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
10209
|
var IOS_SDK_HEADERS = {};
|
|
9221
10210
|
var IOS_SDK_OVERLAYS = {};
|
|
9222
10211
|
for (const [file, text2] of tree) {
|
|
@@ -9251,7 +10240,7 @@ var NATIVE_GRAPH_INPUTS = {
|
|
|
9251
10240
|
compiler: "Apple Swift version 6.4 (swiftlang-6.4.0.34.1 clang-2100.3.34.1)",
|
|
9252
10241
|
target: IOS_SDK_TARGET
|
|
9253
10242
|
};
|
|
9254
|
-
var NATIVE_GRAPH_ID = (0,
|
|
10243
|
+
var NATIVE_GRAPH_ID = (0, import_node_crypto5.createHash)("sha256").update(JSON.stringify(NATIVE_GRAPH_INPUTS)).digest("hex");
|
|
9255
10244
|
|
|
9256
10245
|
// src/swift-shared-sdk.ts
|
|
9257
10246
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -9502,9 +10491,9 @@ var WASM_OPTIMIZE_IDENTITY = `wasm-opt ${import_wasm_opt.BINARYEN_VERSION} -Oz $
|
|
|
9502
10491
|
|
|
9503
10492
|
// src/swift-icu.ts
|
|
9504
10493
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
9505
|
-
var
|
|
10494
|
+
var import_node_child_process7 = require("node:child_process");
|
|
9506
10495
|
var import_node_util4 = require("node:util");
|
|
9507
|
-
var
|
|
10496
|
+
var import_node_zlib2 = require("node:zlib");
|
|
9508
10497
|
|
|
9509
10498
|
// ../sootsim-swift/src/icuData.ts
|
|
9510
10499
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -9518,10 +10507,10 @@ var VERSION = 1;
|
|
|
9518
10507
|
var SWIFT_ICU_PACKED = `picu${VERSION}`;
|
|
9519
10508
|
|
|
9520
10509
|
// 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)(
|
|
10510
|
+
var run4 = (0, import_node_util4.promisify)(import_node_child_process7.execFile);
|
|
10511
|
+
var deflate = (0, import_node_util4.promisify)(import_node_zlib2.gzip);
|
|
10512
|
+
var compressBrotli = (0, import_node_util4.promisify)(import_node_zlib2.brotliCompress);
|
|
10513
|
+
var inflateGzip = (0, import_node_util4.promisify)(import_node_zlib2.gunzip);
|
|
9525
10514
|
|
|
9526
10515
|
// src/swift-link-roots.ts
|
|
9527
10516
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -9624,7 +10613,7 @@ var FOUNDATION_IMPLICIT_MODULES = [
|
|
|
9624
10613
|
var FOUNDATION_IMPLICIT_FLAGS = FOUNDATION_IMPLICIT_MODULES.map(
|
|
9625
10614
|
(module2) => `, "-Xfrontend", "-import-module", "-Xfrontend", "${module2}"`
|
|
9626
10615
|
).join("");
|
|
9627
|
-
var compilerSourceDigest = true ? "
|
|
10616
|
+
var compilerSourceDigest = true ? "94960e7e108c556e2184ef22baae1e061ca63c08c954c6ad0f677b524be5e117" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
|
|
9628
10617
|
var CORE_FOUNDATION_HANDLE_IMPORTS = [
|
|
9629
10618
|
"CFAllocator",
|
|
9630
10619
|
"CFArray",
|
|
@@ -9674,12 +10663,12 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
9674
10663
|
init_is_record();
|
|
9675
10664
|
|
|
9676
10665
|
// src/swift-package-manifest.ts
|
|
9677
|
-
var cacheDir3 =
|
|
9678
|
-
var execFileAsync = (0, import_node_util5.promisify)(
|
|
10666
|
+
var cacheDir3 = import_node_path16.default.join(cacheDir(), "swift-manifests");
|
|
10667
|
+
var execFileAsync = (0, import_node_util5.promisify)(import_node_child_process8.execFile);
|
|
9679
10668
|
|
|
9680
10669
|
// src/xcode-json-project.ts
|
|
9681
10670
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
9682
|
-
var
|
|
10671
|
+
var import_node_path17 = __toESM(require("node:path"), 1);
|
|
9683
10672
|
var import_json52 = __toESM(require_lib(), 1);
|
|
9684
10673
|
var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9685
10674
|
var text = (value) => typeof value === "string" ? value : void 0;
|
|
@@ -9737,7 +10726,7 @@ var PHASE_ISA = {
|
|
|
9737
10726
|
function readXcodeJsonProject(xcodeproj, source) {
|
|
9738
10727
|
const json = import_json52.default.parse(source);
|
|
9739
10728
|
if (!isJsonObject(json)) throw new Error(`${xcodeproj}/project.xcproj is not an object`);
|
|
9740
|
-
const projectDir =
|
|
10729
|
+
const projectDir = import_node_path17.default.dirname(xcodeproj);
|
|
9741
10730
|
const objects = {};
|
|
9742
10731
|
let next = 0;
|
|
9743
10732
|
const add = (entry, id) => {
|
|
@@ -9750,7 +10739,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
9750
10739
|
const base = /^<([A-Z]+)>\/(.*)$/.exec(raw);
|
|
9751
10740
|
if (base) {
|
|
9752
10741
|
if (base[1] === "PROJECT")
|
|
9753
|
-
return { sourceTree: "<absolute>", path:
|
|
10742
|
+
return { sourceTree: "<absolute>", path: import_node_path17.default.join(projectDir, base[2]) };
|
|
9754
10743
|
if (base[1] === "PRODUCTS")
|
|
9755
10744
|
return { sourceTree: "BUILT_PRODUCTS_DIR", path: base[2] };
|
|
9756
10745
|
return null;
|
|
@@ -9758,7 +10747,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
9758
10747
|
const unescaped = raw.replaceAll("\\<", "<");
|
|
9759
10748
|
if (unescaped.startsWith("/")) return { sourceTree: "<absolute>", path: unescaped };
|
|
9760
10749
|
if (unescaped.startsWith("~")) return null;
|
|
9761
|
-
return groupDir === null ? null : { sourceTree: "<absolute>", path:
|
|
10750
|
+
return groupDir === null ? null : { sourceTree: "<absolute>", path: import_node_path17.default.join(groupDir, unescaped) };
|
|
9762
10751
|
};
|
|
9763
10752
|
const memberships = [];
|
|
9764
10753
|
const folders = [];
|
|
@@ -9769,7 +10758,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
9769
10758
|
const kind = text(entry.kind) ?? "file-reference";
|
|
9770
10759
|
const raw = text(entry.path) ?? "";
|
|
9771
10760
|
const located = raw === "" ? null : locate(raw, parent.dir);
|
|
9772
|
-
const name2 = text(entry.name) ??
|
|
10761
|
+
const name2 = text(entry.name) ?? import_node_path17.default.basename(raw);
|
|
9773
10762
|
const node = { id: "", name: name2, dir: null, parent, children: [] };
|
|
9774
10763
|
if (kind === "group" || kind === "variant-group" || kind === "version-group") {
|
|
9775
10764
|
node.dir = raw === "" ? parent.dir : located?.sourceTree === "<absolute>" ? located.path : null;
|
|
@@ -9890,7 +10879,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
9890
10879
|
if (!isObject(entry)) continue;
|
|
9891
10880
|
const repository = text(entry.repository);
|
|
9892
10881
|
const local = text(entry.path);
|
|
9893
|
-
const name2 = local !== void 0 ?
|
|
10882
|
+
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$/, "");
|
|
9894
10883
|
const id = text(entry.kind) === "local" && local !== void 0 ? add({ isa: "XCLocalSwiftPackageReference", relativePath: local }) : add({
|
|
9895
10884
|
isa: "XCRemoteSwiftPackageReference",
|
|
9896
10885
|
repositoryURL: repository ?? "",
|
|
@@ -10110,28 +11099,28 @@ var CONDITIONS = {
|
|
|
10110
11099
|
variant: "normal"
|
|
10111
11100
|
};
|
|
10112
11101
|
function walkFiles(dir) {
|
|
10113
|
-
if (!
|
|
11102
|
+
if (!import_node_fs18.default.existsSync(dir)) return [];
|
|
10114
11103
|
const out = [];
|
|
10115
|
-
for (const entry of
|
|
11104
|
+
for (const entry of import_node_fs18.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
|
|
10116
11105
|
if (entry.name.startsWith(".")) continue;
|
|
10117
|
-
const full =
|
|
11106
|
+
const full = import_node_path18.default.join(dir, entry.name);
|
|
10118
11107
|
if (entry.isDirectory()) out.push(...walkFiles(full));
|
|
10119
11108
|
else if (entry.isFile()) out.push(full);
|
|
10120
11109
|
}
|
|
10121
11110
|
return out;
|
|
10122
11111
|
}
|
|
10123
|
-
var isDirectory = (dir) =>
|
|
11112
|
+
var isDirectory = (dir) => import_node_fs18.default.existsSync(dir) && import_node_fs18.default.statSync(dir).isDirectory();
|
|
10124
11113
|
function readXcconfig(file, read) {
|
|
10125
|
-
if (read.includes(file) || !
|
|
11114
|
+
if (read.includes(file) || !import_node_fs18.default.existsSync(file)) return {};
|
|
10126
11115
|
read.push(file);
|
|
10127
11116
|
const settings = {};
|
|
10128
|
-
for (const raw of
|
|
11117
|
+
for (const raw of import_node_fs18.default.readFileSync(file, "utf8").split("\n")) {
|
|
10129
11118
|
const line = raw.replace(/\/\/.*$/, "").trim();
|
|
10130
11119
|
const include = /^#include\??\s+"([^"]+)"/.exec(line);
|
|
10131
11120
|
if (include) {
|
|
10132
11121
|
Object.assign(
|
|
10133
11122
|
settings,
|
|
10134
|
-
readXcconfig(
|
|
11123
|
+
readXcconfig(import_node_path18.default.resolve(import_node_path18.default.dirname(file), include[1]), read)
|
|
10135
11124
|
);
|
|
10136
11125
|
continue;
|
|
10137
11126
|
}
|
|
@@ -10181,22 +11170,22 @@ function decodeXml(text2) {
|
|
|
10181
11170
|
return text2.replaceAll(""", '"').replaceAll("'", "'").replaceAll("<", "<").replaceAll(">", ">").replaceAll("&", "&");
|
|
10182
11171
|
}
|
|
10183
11172
|
function workspaceReferences(workspace) {
|
|
10184
|
-
const data =
|
|
10185
|
-
if (!
|
|
11173
|
+
const data = import_node_path18.default.join(workspace, "contents.xcworkspacedata");
|
|
11174
|
+
if (!import_node_fs18.default.existsSync(data))
|
|
10186
11175
|
throw new Error(`${workspace} has no contents.xcworkspacedata`);
|
|
10187
|
-
const container =
|
|
11176
|
+
const container = import_node_path18.default.dirname(workspace);
|
|
10188
11177
|
const locate = (location, base) => {
|
|
10189
11178
|
const colon = location.indexOf(":");
|
|
10190
11179
|
const kind = location.slice(0, colon);
|
|
10191
11180
|
const rest = location.slice(colon + 1);
|
|
10192
|
-
if (kind === "group") return
|
|
10193
|
-
if (kind === "container" || kind === "self") return
|
|
10194
|
-
if (kind === "absolute") return
|
|
10195
|
-
throw new Error(`${
|
|
11181
|
+
if (kind === "group") return import_node_path18.default.resolve(base, rest);
|
|
11182
|
+
if (kind === "container" || kind === "self") return import_node_path18.default.resolve(container, rest);
|
|
11183
|
+
if (kind === "absolute") return import_node_path18.default.resolve(rest);
|
|
11184
|
+
throw new Error(`${import_node_path18.default.basename(workspace)} has an unsupported location ${location}`);
|
|
10196
11185
|
};
|
|
10197
11186
|
const groups = [container];
|
|
10198
11187
|
const references = [];
|
|
10199
|
-
for (const [, closing, tag, attributes, selfClosing] of
|
|
11188
|
+
for (const [, closing, tag, attributes, selfClosing] of import_node_fs18.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
|
|
10200
11189
|
if (closing) {
|
|
10201
11190
|
if (tag === "Group") groups.pop();
|
|
10202
11191
|
continue;
|
|
@@ -10247,8 +11236,8 @@ function remotePackageRequirements(projects) {
|
|
|
10247
11236
|
var loaded = /* @__PURE__ */ new Map();
|
|
10248
11237
|
function xcodeProjectFile(xcodeproj) {
|
|
10249
11238
|
for (const name2 of ["project.pbxproj", "project.xcproj"]) {
|
|
10250
|
-
const file =
|
|
10251
|
-
if (
|
|
11239
|
+
const file = import_node_path18.default.join(xcodeproj, name2);
|
|
11240
|
+
if (import_node_fs18.default.existsSync(file)) return file;
|
|
10252
11241
|
}
|
|
10253
11242
|
return null;
|
|
10254
11243
|
}
|
|
@@ -10256,8 +11245,8 @@ function loadProject(xcodeproj) {
|
|
|
10256
11245
|
const projectFile = xcodeProjectFile(xcodeproj);
|
|
10257
11246
|
if (!projectFile)
|
|
10258
11247
|
throw new Error(`${xcodeproj} has no project.pbxproj or project.xcproj`);
|
|
10259
|
-
const source =
|
|
10260
|
-
const digest = (0,
|
|
11248
|
+
const source = import_node_fs18.default.readFileSync(projectFile, "utf8");
|
|
11249
|
+
const digest = (0, import_node_crypto6.createHash)("sha256").update(source).digest("hex");
|
|
10261
11250
|
const cached = loaded.get(projectFile);
|
|
10262
11251
|
if (cached?.digest === digest) return cached.project;
|
|
10263
11252
|
const root = projectFile.endsWith(".xcproj") ? readXcodeJsonProject(xcodeproj, source) : parseOpenStepPlist(source);
|
|
@@ -10273,10 +11262,10 @@ function loadProject(xcodeproj) {
|
|
|
10273
11262
|
if (!project || project.isa !== "PBXProject") {
|
|
10274
11263
|
throw new Error(`${projectFile} has no PBXProject root`);
|
|
10275
11264
|
}
|
|
10276
|
-
const projectDir =
|
|
10277
|
-
|
|
11265
|
+
const projectDir = import_node_fs18.default.realpathSync.native(
|
|
11266
|
+
import_node_path18.default.resolve(import_node_path18.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
|
|
10278
11267
|
);
|
|
10279
|
-
const resolvePath = xcodePathResolver(objects, projectDir,
|
|
11268
|
+
const resolvePath = xcodePathResolver(objects, projectDir, import_node_path18.default.join);
|
|
10280
11269
|
const result = {
|
|
10281
11270
|
xcodeproj,
|
|
10282
11271
|
projectFile,
|
|
@@ -10313,8 +11302,8 @@ function targetSettings(ref, configuration, builtins, options = {}, overrides =
|
|
|
10313
11302
|
const relative3 = str(config.baseConfigurationReferenceRelativePath);
|
|
10314
11303
|
const own = isDict(config.buildSettings) ? config.buildSettings : {};
|
|
10315
11304
|
const directory = anchor ? project.resolvePath(anchor) : null;
|
|
10316
|
-
const baseFile = base ? project.resolvePath(base) : directory && relative3 ?
|
|
10317
|
-
if (options.requireSources !== false && (base || anchor || relative3) && (!baseFile || !
|
|
11305
|
+
const baseFile = base ? project.resolvePath(base) : directory && relative3 ? import_node_path18.default.resolve(directory, relative3) : null;
|
|
11306
|
+
if (options.requireSources !== false && (base || anchor || relative3) && (!baseFile || !import_node_fs18.default.existsSync(baseFile)))
|
|
10318
11307
|
throw new Error(
|
|
10319
11308
|
`Unable to open base configuration reference file '${baseFile ?? base ?? relative3 ?? anchor}'`
|
|
10320
11309
|
);
|
|
@@ -10360,7 +11349,7 @@ function targetSettings(ref, configuration, builtins, options = {}, overrides =
|
|
|
10360
11349
|
const derivedSettings = {
|
|
10361
11350
|
DEVELOPER_DIR: () => options.environment?.DEVELOPER_DIR ?? process.env.DEVELOPER_DIR ?? (developerDir ??= process.platform === "darwin" ? (
|
|
10362
11351
|
// runner-toolchain-platform: darwin
|
|
10363
|
-
(0,
|
|
11352
|
+
(0, import_node_child_process9.execFileSync)("xcode-select", ["-p"], {
|
|
10364
11353
|
encoding: "utf8",
|
|
10365
11354
|
stdio: ["ignore", "pipe", "pipe"]
|
|
10366
11355
|
}).trim()
|
|
@@ -10412,26 +11401,26 @@ function scriptCommand(shell, script) {
|
|
|
10412
11401
|
return [executable, ...args, "-c", script];
|
|
10413
11402
|
}
|
|
10414
11403
|
function expandSearchPath(directory, rules2) {
|
|
10415
|
-
if (
|
|
11404
|
+
if (import_node_path18.default.basename(directory) !== "**") return [directory];
|
|
10416
11405
|
const expanded = [];
|
|
10417
11406
|
const seen = /* @__PURE__ */ new Set();
|
|
10418
|
-
const queue = [
|
|
11407
|
+
const queue = [import_node_path18.default.dirname(directory)];
|
|
10419
11408
|
for (let at = 0; at < queue.length; at++) {
|
|
10420
11409
|
const current = queue[at];
|
|
10421
11410
|
let real;
|
|
10422
11411
|
try {
|
|
10423
|
-
real =
|
|
11412
|
+
real = import_node_fs18.default.realpathSync.native(current);
|
|
10424
11413
|
} catch {
|
|
10425
11414
|
continue;
|
|
10426
11415
|
}
|
|
10427
|
-
if (!
|
|
11416
|
+
if (!import_node_fs18.default.statSync(real).isDirectory() || seen.has(real)) continue;
|
|
10428
11417
|
seen.add(real);
|
|
10429
11418
|
expanded.push(current);
|
|
10430
|
-
for (const entry of
|
|
11419
|
+
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)) {
|
|
10431
11420
|
if (entry.isSymbolicLink() ? !rules2.followLinks : !entry.isDirectory()) continue;
|
|
10432
11421
|
if (rules2.excluded.some((pattern) => pattern.test(entry.name)) && !rules2.included.some((pattern) => pattern.test(entry.name)))
|
|
10433
11422
|
continue;
|
|
10434
|
-
queue.push(
|
|
11423
|
+
queue.push(import_node_path18.default.join(current, entry.name));
|
|
10435
11424
|
}
|
|
10436
11425
|
}
|
|
10437
11426
|
return expanded;
|
|
@@ -10502,7 +11491,7 @@ function shellAssetCatalogs(script, settings, projectDir) {
|
|
|
10502
11491
|
for (const token of tokens) {
|
|
10503
11492
|
if (token.startsWith("-")) break;
|
|
10504
11493
|
const file = resolve4(token);
|
|
10505
|
-
if (file?.endsWith(".xcassets")) catalogs.push(
|
|
11494
|
+
if (file?.endsWith(".xcassets")) catalogs.push(import_node_path18.default.resolve(projectDir, file));
|
|
10506
11495
|
}
|
|
10507
11496
|
}
|
|
10508
11497
|
return catalogs;
|
|
@@ -10547,14 +11536,14 @@ function shellCopies(script, settings, projectDir) {
|
|
|
10547
11536
|
if (operands.length !== 2 || operands.some((operand) => operand.startsWith("-")))
|
|
10548
11537
|
return [];
|
|
10549
11538
|
copies.push({
|
|
10550
|
-
from:
|
|
10551
|
-
to:
|
|
11539
|
+
from: import_node_path18.default.resolve(projectDir, operands[0]),
|
|
11540
|
+
to: import_node_path18.default.resolve(projectDir, operands[1])
|
|
10552
11541
|
});
|
|
10553
11542
|
}
|
|
10554
11543
|
return copies;
|
|
10555
11544
|
}
|
|
10556
11545
|
function fileListEntries(file, absolute) {
|
|
10557
|
-
return
|
|
11546
|
+
return import_node_fs18.default.readFileSync(file, "utf8").split(/\r?\n/).map((line) => line.trim()).filter((line) => line !== "" && !line.startsWith("#")).map(absolute);
|
|
10558
11547
|
}
|
|
10559
11548
|
function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
10560
11549
|
const { project, target, id: targetId } = ref;
|
|
@@ -10567,7 +11556,7 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
10567
11556
|
const copiedFiles = [];
|
|
10568
11557
|
let generatedInfoPlist = false;
|
|
10569
11558
|
const declaredInfoPlist = settings("INFOPLIST_FILE");
|
|
10570
|
-
const infoPlistOutput = declaredInfoPlist ?
|
|
11559
|
+
const infoPlistOutput = declaredInfoPlist ? import_node_path18.default.resolve(project.projectDir, declaredInfoPlist) : null;
|
|
10571
11560
|
const isPreparedOutput = (file) => file === infoPlistOutput || options.requireSources !== false && file.endsWith(".swift");
|
|
10572
11561
|
for (const phaseId of list(target.buildPhases)) {
|
|
10573
11562
|
const phase = project.object(phaseId);
|
|
@@ -10582,7 +11571,7 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
10582
11571
|
copiedFiles.push(
|
|
10583
11572
|
...shellCopies(str(phase.shellScript) ?? "", settings, project.projectDir)
|
|
10584
11573
|
);
|
|
10585
|
-
const absolute = (raw) =>
|
|
11574
|
+
const absolute = (raw) => import_node_path18.default.resolve(project.projectDir, expand(raw, settings));
|
|
10586
11575
|
const inputs = list(phase.inputPaths).map(absolute);
|
|
10587
11576
|
const outputs = list(phase.outputPaths).map(absolute);
|
|
10588
11577
|
const fileLists = /* @__PURE__ */ new Map();
|
|
@@ -10591,7 +11580,7 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
10591
11580
|
kind === "INPUT" ? phase.inputFileListPaths : phase.outputFileListPaths
|
|
10592
11581
|
).map((raw) => {
|
|
10593
11582
|
const file = absolute(raw);
|
|
10594
|
-
if (!
|
|
11583
|
+
if (!import_node_fs18.default.existsSync(file)) {
|
|
10595
11584
|
return { file, entries: [] };
|
|
10596
11585
|
}
|
|
10597
11586
|
return { file, entries: fileListEntries(file, absolute) };
|
|
@@ -10612,7 +11601,7 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
10612
11601
|
...fileLists.get("OUTPUT").map((item) => item.file)
|
|
10613
11602
|
];
|
|
10614
11603
|
if (allOutputs.some((file) => file.endsWith(".swift") || file === infoPlistOutput)) {
|
|
10615
|
-
for (const file of inputFiles) if (
|
|
11604
|
+
for (const file of inputFiles) if (import_node_fs18.default.existsSync(file)) projectInputs.add(file);
|
|
10616
11605
|
}
|
|
10617
11606
|
if (options.prepareGeneratedSources === true && allOutputs.some(isPreparedOutput)) {
|
|
10618
11607
|
const configuration = settings("CONFIGURATION");
|
|
@@ -10625,10 +11614,10 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
10625
11614
|
false
|
|
10626
11615
|
))
|
|
10627
11616
|
continue;
|
|
10628
|
-
const phaseDir =
|
|
11617
|
+
const phaseDir = import_node_path18.default.join(settings("TARGET_TEMP_DIR"), `Script-${phaseId}`);
|
|
10629
11618
|
for (const lists of fileLists.values())
|
|
10630
11619
|
for (const { file } of lists)
|
|
10631
|
-
if (!
|
|
11620
|
+
if (!import_node_fs18.default.existsSync(file))
|
|
10632
11621
|
throw new Error(
|
|
10633
11622
|
`${targetName}: Run Script "${script}" missing file list ${file}`
|
|
10634
11623
|
);
|
|
@@ -10647,25 +11636,25 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
10647
11636
|
const lists = fileLists.get(kind);
|
|
10648
11637
|
env[`SCRIPT_${kind}_FILE_LIST_COUNT`] = String(lists.length);
|
|
10649
11638
|
lists.forEach((_item, index) => {
|
|
10650
|
-
env[`SCRIPT_${kind}_FILE_LIST_${index}`] =
|
|
11639
|
+
env[`SCRIPT_${kind}_FILE_LIST_${index}`] = import_node_path18.default.join(
|
|
10651
11640
|
phaseDir,
|
|
10652
11641
|
`${kind}-${index}.xcfilelist`
|
|
10653
11642
|
);
|
|
10654
11643
|
});
|
|
10655
11644
|
}
|
|
10656
|
-
const signature = (0,
|
|
11645
|
+
const signature = (0, import_node_crypto6.createHash)("sha256").update(
|
|
10657
11646
|
JSON.stringify([phase, [...settingKeys].map((key2) => [key2, settings(key2)])])
|
|
10658
11647
|
);
|
|
10659
11648
|
for (const file of inputFiles) {
|
|
10660
11649
|
signature.update(file);
|
|
10661
|
-
if (
|
|
10662
|
-
const stat =
|
|
11650
|
+
if (import_node_fs18.default.existsSync(file)) {
|
|
11651
|
+
const stat = import_node_fs18.default.statSync(file);
|
|
10663
11652
|
signature.update(`${stat.mtimeMs}:${stat.ctimeMs}:${stat.size}`);
|
|
10664
11653
|
} else signature.update("missing");
|
|
10665
11654
|
}
|
|
10666
11655
|
const stamp = signature.digest("hex");
|
|
10667
11656
|
const key = `${project.projectFile}:${targetId}:${phaseId}:${settings("CONFIGURATION")}`;
|
|
10668
|
-
if (preparedSourcePhases.get(key) === stamp && allOutputs.every((file) =>
|
|
11657
|
+
if (preparedSourcePhases.get(key) === stamp && allOutputs.every((file) => import_node_fs18.default.existsSync(file))) {
|
|
10669
11658
|
preparedXcodePhase(
|
|
10670
11659
|
project.projectFile,
|
|
10671
11660
|
targetId,
|
|
@@ -10676,14 +11665,14 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
10676
11665
|
);
|
|
10677
11666
|
continue;
|
|
10678
11667
|
}
|
|
10679
|
-
|
|
10680
|
-
|
|
10681
|
-
|
|
11668
|
+
import_node_fs18.default.mkdirSync(phaseDir, { recursive: true });
|
|
11669
|
+
import_node_fs18.default.mkdirSync(settings("BUILT_PRODUCTS_DIR"), { recursive: true });
|
|
11670
|
+
import_node_fs18.default.mkdirSync(settings("DERIVED_FILE_DIR"), { recursive: true });
|
|
10682
11671
|
for (const output2 of allOutputs)
|
|
10683
|
-
|
|
11672
|
+
import_node_fs18.default.mkdirSync(import_node_path18.default.dirname(output2), { recursive: true });
|
|
10684
11673
|
for (const [kind, lists] of fileLists)
|
|
10685
11674
|
lists.forEach((item, index) => {
|
|
10686
|
-
|
|
11675
|
+
import_node_fs18.default.writeFileSync(
|
|
10687
11676
|
env[`SCRIPT_${kind}_FILE_LIST_${index}`],
|
|
10688
11677
|
`${item.entries.join("\n")}
|
|
10689
11678
|
`
|
|
@@ -10694,7 +11683,7 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
10694
11683
|
str(phase.shellPath) ?? "/bin/sh",
|
|
10695
11684
|
str(phase.shellScript) ?? ""
|
|
10696
11685
|
);
|
|
10697
|
-
(0,
|
|
11686
|
+
(0, import_node_child_process9.execFileSync)(shell, args, {
|
|
10698
11687
|
cwd: project.projectDir,
|
|
10699
11688
|
env,
|
|
10700
11689
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -10710,7 +11699,7 @@ ${output2}`
|
|
|
10710
11699
|
);
|
|
10711
11700
|
}
|
|
10712
11701
|
const missing2 = allOutputs.filter(
|
|
10713
|
-
(file) => file === infoPlistOutput && !
|
|
11702
|
+
(file) => file === infoPlistOutput && !import_node_fs18.default.existsSync(file)
|
|
10714
11703
|
);
|
|
10715
11704
|
if (missing2.length > 0)
|
|
10716
11705
|
throw new Error(
|
|
@@ -10729,9 +11718,9 @@ ${output2}`
|
|
|
10729
11718
|
}
|
|
10730
11719
|
project.visitMembers(
|
|
10731
11720
|
targetId,
|
|
10732
|
-
xcodePathResolver(project.objects, project.projectDir,
|
|
10733
|
-
(file) => isDirectory(file) ? walkFiles(file) :
|
|
10734
|
-
|
|
11721
|
+
xcodePathResolver(project.objects, project.projectDir, import_node_path18.default.join, settings),
|
|
11722
|
+
(file) => isDirectory(file) ? walkFiles(file) : import_node_fs18.default.existsSync(file) ? [file] : [],
|
|
11723
|
+
import_node_path18.default.join,
|
|
10735
11724
|
(file, kind) => {
|
|
10736
11725
|
if (kind === "header") {
|
|
10737
11726
|
headers.add(file);
|
|
@@ -10741,9 +11730,9 @@ ${output2}`
|
|
|
10741
11730
|
resources.add(file);
|
|
10742
11731
|
return;
|
|
10743
11732
|
}
|
|
10744
|
-
if (!
|
|
11733
|
+
if (!import_node_fs18.default.existsSync(file)) {
|
|
10745
11734
|
if (options.requireSources === false) return;
|
|
10746
|
-
const script = scriptForOutput.get(
|
|
11735
|
+
const script = scriptForOutput.get(import_node_path18.default.normalize(file));
|
|
10747
11736
|
throw new Error(
|
|
10748
11737
|
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}`
|
|
10749
11738
|
);
|
|
@@ -10754,17 +11743,17 @@ ${output2}`
|
|
|
10754
11743
|
);
|
|
10755
11744
|
if (options.prepareGeneratedSources && options.requireSources !== false) {
|
|
10756
11745
|
const interfaceFiles = [...resources].filter(
|
|
10757
|
-
(file) => /\.(storyboard|xib)$/.test(file) && !file.split(
|
|
11746
|
+
(file) => /\.(storyboard|xib)$/.test(file) && !file.split(import_node_path18.default.sep).some((part) => part.endsWith(".bundle"))
|
|
10758
11747
|
);
|
|
10759
11748
|
if (process.platform !== "darwin") {
|
|
10760
11749
|
let launchName = settings("INFOPLIST_KEY_UILaunchStoryboardName");
|
|
10761
|
-
if (!launchName && infoPlistOutput &&
|
|
10762
|
-
const info = import_plist2.default.parse(
|
|
11750
|
+
if (!launchName && infoPlistOutput && import_node_fs18.default.existsSync(infoPlistOutput)) {
|
|
11751
|
+
const info = import_plist2.default.parse(import_node_fs18.default.readFileSync(infoPlistOutput, "utf8"));
|
|
10763
11752
|
const declared = isRecord(info) ? info.UILaunchStoryboardName : void 0;
|
|
10764
11753
|
if (typeof declared === "string") launchName = expand(declared, settings);
|
|
10765
11754
|
}
|
|
10766
11755
|
const runtimeInterfaceFiles = interfaceFiles.filter(
|
|
10767
|
-
(file) =>
|
|
11756
|
+
(file) => import_node_path18.default.basename(file, import_node_path18.default.extname(file)) !== launchName
|
|
10768
11757
|
);
|
|
10769
11758
|
if (runtimeInterfaceFiles.length > 0)
|
|
10770
11759
|
throw new Error(
|
|
@@ -10775,19 +11764,19 @@ ${output2}`
|
|
|
10775
11764
|
}
|
|
10776
11765
|
const interfaceOutputs = /* @__PURE__ */ new Set();
|
|
10777
11766
|
for (const file of interfaceFiles) {
|
|
10778
|
-
const localization = file.split(
|
|
11767
|
+
const localization = file.split(import_node_path18.default.sep).findLast((part) => part.endsWith(".lproj")) ?? "";
|
|
10779
11768
|
const extension = file.endsWith(".storyboard") ? ".storyboardc" : ".nib";
|
|
10780
|
-
const output2 =
|
|
11769
|
+
const output2 = import_node_path18.default.join(
|
|
10781
11770
|
settings("DERIVED_FILE_DIR"),
|
|
10782
11771
|
"InterfaceBuilder",
|
|
10783
11772
|
localization,
|
|
10784
|
-
|
|
11773
|
+
import_node_path18.default.basename(file, import_node_path18.default.extname(file)) + extension
|
|
10785
11774
|
);
|
|
10786
11775
|
if (interfaceOutputs.has(output2))
|
|
10787
11776
|
throw new Error(`${targetName}: duplicate Interface Builder output ${output2}`);
|
|
10788
11777
|
interfaceOutputs.add(output2);
|
|
10789
|
-
|
|
10790
|
-
|
|
11778
|
+
import_node_fs18.default.rmSync(output2, { recursive: true, force: true });
|
|
11779
|
+
import_node_fs18.default.mkdirSync(import_node_path18.default.dirname(output2), { recursive: true });
|
|
10791
11780
|
const args = [
|
|
10792
11781
|
"ibtool",
|
|
10793
11782
|
"--compile",
|
|
@@ -10801,7 +11790,7 @@ ${output2}`
|
|
|
10801
11790
|
const families = settings("TARGETED_DEVICE_FAMILY").split(",").map((value) => value.trim());
|
|
10802
11791
|
if (families.includes("1")) args.push("--target-device", "iphone");
|
|
10803
11792
|
if (families.includes("2")) args.push("--target-device", "ipad");
|
|
10804
|
-
(0,
|
|
11793
|
+
(0, import_node_child_process9.execFileSync)("xcrun", args, {
|
|
10805
11794
|
cwd: project.projectDir,
|
|
10806
11795
|
stdio: ["ignore", "pipe", "pipe"],
|
|
10807
11796
|
timeout: runScriptTimeoutMs
|
|
@@ -10821,13 +11810,13 @@ ${output2}`
|
|
|
10821
11810
|
for (const definition of definitions) {
|
|
10822
11811
|
const configuredLanguage = settings("INTENTS_CODEGEN_LANGUAGE");
|
|
10823
11812
|
const language = !configuredLanguage || configuredLanguage === "Automatic" ? sources.size > 0 ? "Swift" : "Objective-C" : configuredLanguage;
|
|
10824
|
-
const output2 =
|
|
11813
|
+
const output2 = import_node_path18.default.join(
|
|
10825
11814
|
settings("DERIVED_FILE_DIR"),
|
|
10826
11815
|
"IntentDefinitionGenerated",
|
|
10827
|
-
|
|
11816
|
+
import_node_path18.default.basename(definition, ".intentdefinition")
|
|
10828
11817
|
);
|
|
10829
|
-
|
|
10830
|
-
|
|
11818
|
+
import_node_fs18.default.rmSync(output2, { recursive: true, force: true });
|
|
11819
|
+
import_node_fs18.default.mkdirSync(output2, { recursive: true });
|
|
10831
11820
|
const args = [
|
|
10832
11821
|
"intentbuilderc",
|
|
10833
11822
|
"generate",
|
|
@@ -10846,7 +11835,7 @@ ${output2}`
|
|
|
10846
11835
|
args.push("-swiftVersion", settings("SWIFT_VERSION") || "5.0");
|
|
10847
11836
|
if (settings("DEFINES_MODULE") === "YES")
|
|
10848
11837
|
args.push("-moduleName", settings("PRODUCT_MODULE_NAME"));
|
|
10849
|
-
(0,
|
|
11838
|
+
(0, import_node_child_process9.execFileSync)("xcrun", args, {
|
|
10850
11839
|
cwd: project.projectDir,
|
|
10851
11840
|
stdio: ["ignore", "pipe", "pipe"],
|
|
10852
11841
|
timeout: runScriptTimeoutMs
|
|
@@ -10871,37 +11860,37 @@ ${output2}`
|
|
|
10871
11860
|
function commonAncestor(dirs) {
|
|
10872
11861
|
let common = dirs[0];
|
|
10873
11862
|
for (const dir of dirs) {
|
|
10874
|
-
while (common !==
|
|
10875
|
-
common =
|
|
11863
|
+
while (common !== import_node_path18.default.dirname(common) && import_node_path18.default.relative(common, dir).startsWith(".."))
|
|
11864
|
+
common = import_node_path18.default.dirname(common);
|
|
10876
11865
|
}
|
|
10877
11866
|
return common;
|
|
10878
11867
|
}
|
|
10879
|
-
var isPodsProject = (xcodeproj) =>
|
|
11868
|
+
var isPodsProject = (xcodeproj) => import_node_path18.default.basename(xcodeproj) === "Pods.xcodeproj" && import_node_path18.default.basename(import_node_path18.default.dirname(xcodeproj)) === "Pods";
|
|
10880
11869
|
function installedPodsSandbox(pods) {
|
|
10881
|
-
const podfileLock =
|
|
10882
|
-
const manifestLock =
|
|
10883
|
-
if (!
|
|
11870
|
+
const podfileLock = import_node_path18.default.join(import_node_path18.default.dirname(pods), "Podfile.lock");
|
|
11871
|
+
const manifestLock = import_node_path18.default.join(pods, "Manifest.lock");
|
|
11872
|
+
if (!import_node_fs18.default.existsSync(podfileLock))
|
|
10884
11873
|
throw new Error(
|
|
10885
|
-
`${pods} has no ${podfileLock}: run \`pod install\` in ${
|
|
11874
|
+
`${pods} has no ${podfileLock}: run \`pod install\` in ${import_node_path18.default.dirname(pods)}`
|
|
10886
11875
|
);
|
|
10887
|
-
if (!
|
|
11876
|
+
if (!import_node_fs18.default.existsSync(manifestLock) || !import_node_fs18.default.readFileSync(manifestLock).equals(import_node_fs18.default.readFileSync(podfileLock)))
|
|
10888
11877
|
throw new Error(
|
|
10889
|
-
`The sandbox is not in sync with the Podfile.lock: ${manifestLock} differs from ${podfileLock}. Run \`pod install\` in ${
|
|
11878
|
+
`The sandbox is not in sync with the Podfile.lock: ${manifestLock} differs from ${podfileLock}. Run \`pod install\` in ${import_node_path18.default.dirname(pods)}`
|
|
10890
11879
|
);
|
|
10891
11880
|
const specChecksums = {};
|
|
10892
|
-
const lines =
|
|
11881
|
+
const lines = import_node_fs18.default.readFileSync(manifestLock, "utf8").split("\n");
|
|
10893
11882
|
const start = lines.indexOf("SPEC CHECKSUMS:");
|
|
10894
11883
|
for (const line of start === -1 ? [] : lines.slice(start + 1)) {
|
|
10895
11884
|
const entry = /^ {2}"?([^":]+)"?: ([0-9a-f]+)$/.exec(line);
|
|
10896
11885
|
if (!entry) break;
|
|
10897
11886
|
specChecksums[entry[1]] = entry[2];
|
|
10898
11887
|
}
|
|
10899
|
-
const specs =
|
|
11888
|
+
const specs = import_node_path18.default.join(pods, "Local Podspecs");
|
|
10900
11889
|
return {
|
|
10901
11890
|
podfileLock,
|
|
10902
11891
|
manifestLock,
|
|
10903
11892
|
specChecksums,
|
|
10904
|
-
localPodspecs: isDirectory(specs) ?
|
|
11893
|
+
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)) : []
|
|
10905
11894
|
};
|
|
10906
11895
|
}
|
|
10907
11896
|
function workspaceProjects(xcodeprojOrWorkspace, installedPods = false) {
|
|
@@ -10913,14 +11902,14 @@ function workspaceProjects(xcodeprojOrWorkspace, installedPods = false) {
|
|
|
10913
11902
|
if (!xcodeProjectFile(xcodeproj)) {
|
|
10914
11903
|
if (installedPods && isPodsProject(xcodeproj))
|
|
10915
11904
|
throw new Error(
|
|
10916
|
-
`${
|
|
11905
|
+
`${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))}`
|
|
10917
11906
|
);
|
|
10918
11907
|
return;
|
|
10919
11908
|
}
|
|
10920
|
-
const key =
|
|
10921
|
-
if (projectAt.has(key) || !installedPods && key.split(
|
|
11909
|
+
const key = import_node_fs18.default.realpathSync.native(xcodeproj);
|
|
11910
|
+
if (projectAt.has(key) || !installedPods && key.split(import_node_path18.default.sep).includes("Pods"))
|
|
10922
11911
|
return;
|
|
10923
|
-
if (isPodsProject(key)) cocoapods = installedPodsSandbox(
|
|
11912
|
+
if (isPodsProject(key)) cocoapods = installedPodsSandbox(import_node_path18.default.dirname(key));
|
|
10924
11913
|
const project = loadProject(key);
|
|
10925
11914
|
projectAt.set(key, project);
|
|
10926
11915
|
projects.push(project);
|
|
@@ -10936,12 +11925,12 @@ function workspaceProjects(xcodeprojOrWorkspace, installedPods = false) {
|
|
|
10936
11925
|
for (const reference of listed)
|
|
10937
11926
|
if (reference.endsWith(".xcodeproj")) addProject(reference);
|
|
10938
11927
|
if (projects.length === 0) {
|
|
10939
|
-
throw new Error(`${
|
|
11928
|
+
throw new Error(`${import_node_path18.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
|
|
10940
11929
|
}
|
|
10941
|
-
const podfile =
|
|
10942
|
-
if (installedPods && !cocoapods &&
|
|
11930
|
+
const podfile = import_node_path18.default.join(import_node_path18.default.dirname(xcodeprojOrWorkspace), "Podfile");
|
|
11931
|
+
if (installedPods && !cocoapods && import_node_fs18.default.existsSync(podfile))
|
|
10943
11932
|
throw new Error(
|
|
10944
|
-
`${podfile} is not installed into ${
|
|
11933
|
+
`${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`
|
|
10945
11934
|
);
|
|
10946
11935
|
return { listed, projects, projectAt, cocoapods };
|
|
10947
11936
|
}
|
|
@@ -10979,7 +11968,7 @@ function listXcodeAppTargets(xcodeprojOrWorkspace, options = {}) {
|
|
|
10979
11968
|
return workspaceProjects(xcodeprojOrWorkspace).projects.flatMap(projectTargets).filter((ref) => isIosAppTarget(ref, options)).map((ref) => str(ref.target.name) ?? ref.id);
|
|
10980
11969
|
}
|
|
10981
11970
|
function defaultXcodeAppTarget(xcodeproj) {
|
|
10982
|
-
const project = loadProject(
|
|
11971
|
+
const project = loadProject(import_node_fs18.default.realpathSync.native(xcodeproj));
|
|
10983
11972
|
for (const [id, target] of Object.entries(project.objects)) {
|
|
10984
11973
|
if (!isDict(target) || target.isa !== "PBXNativeTarget") continue;
|
|
10985
11974
|
if (isIosAppTarget({ project, id, target }, { requireSources: false }))
|
|
@@ -10987,30 +11976,30 @@ function defaultXcodeAppTarget(xcodeproj) {
|
|
|
10987
11976
|
}
|
|
10988
11977
|
}
|
|
10989
11978
|
function readXcodeScheme(xcodeprojOrWorkspace, scheme) {
|
|
10990
|
-
const container =
|
|
11979
|
+
const container = import_node_fs18.default.realpathSync.native(xcodeprojOrWorkspace);
|
|
10991
11980
|
const { projects } = workspaceProjects(container);
|
|
10992
11981
|
const containers = [
|
|
10993
11982
|
.../* @__PURE__ */ new Set([container, ...projects.map((project2) => project2.xcodeproj)])
|
|
10994
11983
|
];
|
|
10995
11984
|
const found = containers.flatMap(
|
|
10996
11985
|
(dir) => [
|
|
10997
|
-
|
|
10998
|
-
...isDirectory(
|
|
11986
|
+
import_node_path18.default.join(dir, "xcshareddata"),
|
|
11987
|
+
...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)) : []
|
|
10999
11988
|
].map((data) => ({
|
|
11000
11989
|
dir,
|
|
11001
|
-
file:
|
|
11990
|
+
file: import_node_path18.default.join(data, "xcschemes", `${scheme}.xcscheme`)
|
|
11002
11991
|
}))
|
|
11003
|
-
).find((candidate) =>
|
|
11992
|
+
).find((candidate) => import_node_fs18.default.existsSync(candidate.file));
|
|
11004
11993
|
if (!found) {
|
|
11005
11994
|
const known = containers.flatMap(
|
|
11006
|
-
(dir) =>
|
|
11995
|
+
(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() : []
|
|
11007
11996
|
);
|
|
11008
11997
|
throw new Error(
|
|
11009
|
-
`${
|
|
11998
|
+
`${import_node_path18.default.basename(container)} has no scheme ${scheme}; it shares ${known.join(", ") || "none"}`
|
|
11010
11999
|
);
|
|
11011
12000
|
}
|
|
11012
12001
|
const launch = /<LaunchAction\b([^>]*)>([\s\S]*?)<\/LaunchAction>/.exec(
|
|
11013
|
-
|
|
12002
|
+
import_node_fs18.default.readFileSync(found.file, "utf8")
|
|
11014
12003
|
);
|
|
11015
12004
|
const attribute = (text2, name3) => {
|
|
11016
12005
|
const value = new RegExp(`\\b${name3}\\s*=\\s*"([^"]*)"`).exec(text2)?.[1];
|
|
@@ -11023,12 +12012,12 @@ function readXcodeScheme(xcodeprojOrWorkspace, scheme) {
|
|
|
11023
12012
|
if (!configuration || !blueprint || !referenced?.startsWith("container:")) {
|
|
11024
12013
|
throw new Error(`scheme ${scheme} runs no application target`);
|
|
11025
12014
|
}
|
|
11026
|
-
const projectPath =
|
|
11027
|
-
|
|
12015
|
+
const projectPath = import_node_path18.default.resolve(
|
|
12016
|
+
import_node_path18.default.dirname(found.dir),
|
|
11028
12017
|
referenced.slice("container:".length)
|
|
11029
12018
|
);
|
|
11030
12019
|
const project = projects.find(
|
|
11031
|
-
(candidate) =>
|
|
12020
|
+
(candidate) => import_node_fs18.default.existsSync(projectPath) && candidate.xcodeproj === import_node_fs18.default.realpathSync.native(projectPath)
|
|
11032
12021
|
);
|
|
11033
12022
|
const target = project && projectTargets(project).find((ref) => ref.id === blueprint);
|
|
11034
12023
|
const name2 = target && str(target.target.name);
|
|
@@ -11048,26 +12037,26 @@ function readXcodeScheme(xcodeprojOrWorkspace, scheme) {
|
|
|
11048
12037
|
var NativeAppTargetSelectionError = class extends Error {
|
|
11049
12038
|
};
|
|
11050
12039
|
function selectIosAppTarget(projectRoot, iosTarget) {
|
|
11051
|
-
const nested =
|
|
11052
|
-
const iosRoot =
|
|
11053
|
-
const entries =
|
|
12040
|
+
const nested = import_node_path18.default.join(projectRoot, "ios");
|
|
12041
|
+
const iosRoot = import_node_fs18.default.existsSync(nested) ? nested : projectRoot;
|
|
12042
|
+
const entries = import_node_fs18.default.readdirSync(iosRoot, { withFileTypes: true });
|
|
11054
12043
|
const projects = (entries.some((entry) => entry.isDirectory() && entry.name.endsWith(".xcodeproj")) ? entries.filter((entry) => entry.isDirectory() && entry.name.endsWith(".xcodeproj")).map((entry) => ({
|
|
11055
|
-
xcodeproj:
|
|
12044
|
+
xcodeproj: import_node_path18.default.join(iosRoot, entry.name),
|
|
11056
12045
|
workspace: null
|
|
11057
12046
|
})) : entries.filter((entry) => entry.isDirectory() && entry.name.endsWith(".xcworkspace")).flatMap((entry) => {
|
|
11058
|
-
const workspace =
|
|
12047
|
+
const workspace = import_node_path18.default.join(iosRoot, entry.name);
|
|
11059
12048
|
return workspaceReferences(workspace).map((xcodeproj2) => ({
|
|
11060
12049
|
xcodeproj: xcodeproj2,
|
|
11061
12050
|
workspace
|
|
11062
12051
|
}));
|
|
11063
12052
|
}).filter(
|
|
11064
|
-
({ xcodeproj: xcodeproj2 }) => xcodeproj2.endsWith(".xcodeproj") && !xcodeproj2.split(
|
|
12053
|
+
({ xcodeproj: xcodeproj2 }) => xcodeproj2.endsWith(".xcodeproj") && !xcodeproj2.split(import_node_path18.default.sep).includes("Pods") && import_node_fs18.default.existsSync(xcodeproj2)
|
|
11065
12054
|
).filter(
|
|
11066
12055
|
({ xcodeproj: xcodeproj2 }) => listXcodeAppTargets(xcodeproj2, { requireSources: false }).length > 0
|
|
11067
12056
|
)).map(({ xcodeproj: xcodeproj2, workspace }) => ({
|
|
11068
12057
|
xcodeproj: xcodeproj2,
|
|
11069
12058
|
workspace,
|
|
11070
|
-
name:
|
|
12059
|
+
name: import_node_path18.default.basename(xcodeproj2)
|
|
11071
12060
|
}));
|
|
11072
12061
|
if (projects.length === 0) return null;
|
|
11073
12062
|
if (projects.length > 1 && !iosTarget) {
|
|
@@ -11106,13 +12095,13 @@ function selectIosAppTarget(projectRoot, iosTarget) {
|
|
|
11106
12095
|
if (!target) throw new Error("native app identity has no iOS application target");
|
|
11107
12096
|
if (!iosTarget) {
|
|
11108
12097
|
const workspace = xcodeproj.replace(/\.xcodeproj$/, ".xcworkspace");
|
|
11109
|
-
const container =
|
|
12098
|
+
const container = import_node_fs18.default.existsSync(workspace) ? workspace : xcodeproj;
|
|
11110
12099
|
const hasScheme = [container, xcodeproj].some((dir) => {
|
|
11111
|
-
if (
|
|
12100
|
+
if (import_node_fs18.default.existsSync(import_node_path18.default.join(dir, "xcshareddata", "xcschemes", `${target}.xcscheme`)))
|
|
11112
12101
|
return true;
|
|
11113
|
-
const users =
|
|
11114
|
-
return
|
|
11115
|
-
(user) =>
|
|
12102
|
+
const users = import_node_path18.default.join(dir, "xcuserdata");
|
|
12103
|
+
return import_node_fs18.default.existsSync(users) && import_node_fs18.default.readdirSync(users).some(
|
|
12104
|
+
(user) => import_node_fs18.default.existsSync(import_node_path18.default.join(users, user, "xcschemes", `${target}.xcscheme`))
|
|
11116
12105
|
);
|
|
11117
12106
|
});
|
|
11118
12107
|
if (hasScheme) target = readXcodeScheme(container, target).target;
|
|
@@ -11123,8 +12112,8 @@ function selectIosAppTarget(projectRoot, iosTarget) {
|
|
|
11123
12112
|
);
|
|
11124
12113
|
return { xcodeproj, target, workspace: project.workspace };
|
|
11125
12114
|
}
|
|
11126
|
-
var workspaceResolvedFile = (xcodeprojOrWorkspace) =>
|
|
11127
|
-
xcodeprojOrWorkspace.endsWith(".xcworkspace") ? xcodeprojOrWorkspace :
|
|
12115
|
+
var workspaceResolvedFile = (xcodeprojOrWorkspace) => import_node_path18.default.join(
|
|
12116
|
+
xcodeprojOrWorkspace.endsWith(".xcworkspace") ? xcodeprojOrWorkspace : import_node_path18.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
|
|
11128
12117
|
"xcshareddata",
|
|
11129
12118
|
"swiftpm",
|
|
11130
12119
|
"Package.resolved"
|
|
@@ -11139,7 +12128,7 @@ var SwiftPackageResolutionRequired = class extends Error {
|
|
|
11139
12128
|
}
|
|
11140
12129
|
};
|
|
11141
12130
|
function readXcodeAppTarget(input, targetName, configurationName, options = {}) {
|
|
11142
|
-
const xcodeprojOrWorkspace =
|
|
12131
|
+
const xcodeprojOrWorkspace = import_node_fs18.default.realpathSync.native(input);
|
|
11143
12132
|
const workspace = xcodeprojOrWorkspace.endsWith(".xcworkspace") ? xcodeprojOrWorkspace : null;
|
|
11144
12133
|
const { listed, projects, projectAt, cocoapods } = workspaceProjects(
|
|
11145
12134
|
xcodeprojOrWorkspace,
|
|
@@ -11148,7 +12137,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11148
12137
|
const allTargets = projects.flatMap(projectTargets);
|
|
11149
12138
|
const appTargets = allTargets.filter((ref) => isIosAppTarget(ref, options));
|
|
11150
12139
|
const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
|
|
11151
|
-
const container =
|
|
12140
|
+
const container = import_node_path18.default.basename(xcodeprojOrWorkspace);
|
|
11152
12141
|
const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
|
|
11153
12142
|
if (named.length !== 1) {
|
|
11154
12143
|
if (appTargets.length === 0)
|
|
@@ -11169,15 +12158,15 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11169
12158
|
for (const ref of allTargets) {
|
|
11170
12159
|
const product = ref.project.object(str(ref.target.productReference));
|
|
11171
12160
|
const file = str(product?.path);
|
|
11172
|
-
if (file && !byProduct.has(
|
|
11173
|
-
byProduct.set(
|
|
12161
|
+
if (file && !byProduct.has(import_node_path18.default.basename(file)))
|
|
12162
|
+
byProduct.set(import_node_path18.default.basename(file), ref);
|
|
11174
12163
|
}
|
|
11175
12164
|
const proxied = (project, proxyId) => {
|
|
11176
12165
|
const proxy = project.object(proxyId);
|
|
11177
12166
|
if (proxy?.isa !== "PBXContainerItemProxy") return void 0;
|
|
11178
12167
|
const portal = str(proxy.containerPortal);
|
|
11179
12168
|
const portalPath = project.resolvePath(portal ?? "");
|
|
11180
|
-
const owner = project.object(portal)?.isa === "PBXProject" ? project : portalPath &&
|
|
12169
|
+
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;
|
|
11181
12170
|
const remote = str(proxy.remoteGlobalIDString);
|
|
11182
12171
|
if (!owner || !remote) return void 0;
|
|
11183
12172
|
return projectTargets(owner).find(
|
|
@@ -11194,7 +12183,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11194
12183
|
const buildFile = project.object(buildFileId);
|
|
11195
12184
|
if (!buildFile || !xcodeBuildFileBuildsForIos(buildFile)) continue;
|
|
11196
12185
|
const file = project.object(str(buildFile.fileRef));
|
|
11197
|
-
const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(
|
|
12186
|
+
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;
|
|
11198
12187
|
if (resolved)
|
|
11199
12188
|
found.push({
|
|
11200
12189
|
target: resolved,
|
|
@@ -11278,8 +12267,8 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11278
12267
|
ref.project.visitMembers(
|
|
11279
12268
|
ref.id,
|
|
11280
12269
|
ref.project.resolvePath,
|
|
11281
|
-
(file) => isDirectory(file) ? walkFiles(file) :
|
|
11282
|
-
|
|
12270
|
+
(file) => isDirectory(file) ? walkFiles(file) : import_node_fs18.default.existsSync(file) ? [file] : [],
|
|
12271
|
+
import_node_path18.default.join,
|
|
11283
12272
|
(file, kind) => {
|
|
11284
12273
|
if (kind === "header") found.push(file);
|
|
11285
12274
|
}
|
|
@@ -11295,12 +12284,12 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11295
12284
|
for (const ref of projectTargets(project)) {
|
|
11296
12285
|
const product = productName(ref);
|
|
11297
12286
|
for (const { file, visibility } of headerPhase(ref)) {
|
|
11298
|
-
const name2 =
|
|
12287
|
+
const name2 = import_node_path18.default.basename(file);
|
|
11299
12288
|
if (!entries.has(name2))
|
|
11300
12289
|
entries.set(name2, visibility !== "Project" ? `${product}/${name2}` : file);
|
|
11301
12290
|
}
|
|
11302
12291
|
for (const file of synchronizedHeaders(ref)) {
|
|
11303
|
-
const name2 =
|
|
12292
|
+
const name2 = import_node_path18.default.basename(file);
|
|
11304
12293
|
if (!entries.has(name2)) entries.set(name2, file);
|
|
11305
12294
|
}
|
|
11306
12295
|
}
|
|
@@ -11310,7 +12299,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11310
12299
|
if (folder === null) continue;
|
|
11311
12300
|
for (const file of walkFiles(folder)) {
|
|
11312
12301
|
if (!HEADER_FILE.test(file)) continue;
|
|
11313
|
-
const name2 =
|
|
12302
|
+
const name2 = import_node_path18.default.basename(file);
|
|
11314
12303
|
if (!entries.has(name2)) entries.set(name2, file);
|
|
11315
12304
|
}
|
|
11316
12305
|
}
|
|
@@ -11318,18 +12307,18 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11318
12307
|
for (const id of Object.keys(project.objects)) {
|
|
11319
12308
|
if (project.object(id)?.isa !== "PBXFileReference") continue;
|
|
11320
12309
|
const file = project.resolvePath(id);
|
|
11321
|
-
if (file && HEADER_FILE.test(file) && !entries.has(
|
|
11322
|
-
entries.set(
|
|
12310
|
+
if (file && HEADER_FILE.test(file) && !entries.has(import_node_path18.default.basename(file)))
|
|
12311
|
+
entries.set(import_node_path18.default.basename(file), file);
|
|
11323
12312
|
}
|
|
11324
12313
|
const map2 = [...entries];
|
|
11325
12314
|
projectHeaderMaps.set(project, map2);
|
|
11326
12315
|
return map2;
|
|
11327
12316
|
};
|
|
11328
12317
|
const xcconfigs = /* @__PURE__ */ new Set();
|
|
11329
|
-
const buildDir = (project) =>
|
|
12318
|
+
const buildDir = (project) => import_node_path18.default.join(project.projectDir, ".build/peach-xcode/Build");
|
|
11330
12319
|
const workspaceBuild = {
|
|
11331
|
-
SYMROOT:
|
|
11332
|
-
OBJROOT:
|
|
12320
|
+
SYMROOT: import_node_path18.default.join(buildDir(app.project), "Products"),
|
|
12321
|
+
OBJROOT: import_node_path18.default.join(buildDir(app.project), "Intermediates.noindex")
|
|
11333
12322
|
};
|
|
11334
12323
|
const moduleTarget = (ref) => {
|
|
11335
12324
|
const name2 = str(ref.target.name) ?? ref.id;
|
|
@@ -11344,16 +12333,16 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11344
12333
|
TARGET_NAME: name2,
|
|
11345
12334
|
TARGETNAME: "$(TARGET_NAME)",
|
|
11346
12335
|
PROJECT: "$(PROJECT_NAME)",
|
|
11347
|
-
PROJECT_NAME:
|
|
12336
|
+
PROJECT_NAME: import_node_path18.default.basename(ref.project.xcodeproj, ".xcodeproj"),
|
|
11348
12337
|
PROJECT_CLASS_PREFIX: isDict(ref.project.project.attributes) ? str(ref.project.project.attributes.CLASSPREFIX) ?? "" : "",
|
|
11349
12338
|
PROJECT_FILE_PATH: ref.project.xcodeproj,
|
|
11350
12339
|
SRCROOT: ref.project.projectDir,
|
|
11351
12340
|
SOURCE_ROOT: ref.project.projectDir,
|
|
11352
12341
|
PROJECT_DIR: ref.project.projectDir,
|
|
11353
|
-
SYMROOT:
|
|
12342
|
+
SYMROOT: import_node_path18.default.join(buildDir(ref.project), "Products"),
|
|
11354
12343
|
BUILD_DIR: "$(SYMROOT)",
|
|
11355
12344
|
BUILD_ROOT: "$(SYMROOT)",
|
|
11356
|
-
OBJROOT:
|
|
12345
|
+
OBJROOT: import_node_path18.default.join(buildDir(ref.project), "Intermediates.noindex"),
|
|
11357
12346
|
CONFIGURATION_BUILD_DIR: "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)",
|
|
11358
12347
|
BUILT_PRODUCTS_DIR: "$(CONFIGURATION_BUILD_DIR)",
|
|
11359
12348
|
TARGET_BUILD_DIR: "$(CONFIGURATION_BUILD_DIR)",
|
|
@@ -11395,7 +12384,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11395
12384
|
xcconfigs
|
|
11396
12385
|
);
|
|
11397
12386
|
const searchRules = recursiveSearchRules(settings2);
|
|
11398
|
-
const absolute = (file) =>
|
|
12387
|
+
const absolute = (file) => import_node_path18.default.resolve(ref.project.projectDir, file);
|
|
11399
12388
|
const framework = FRAMEWORK_PRODUCTS.has(str(ref.target.productType) ?? "");
|
|
11400
12389
|
const product = settings2("PRODUCT_NAME");
|
|
11401
12390
|
const moduleName = applyOperator(settings2("PRODUCT_MODULE_NAME"), "c99extidentifier");
|
|
@@ -11426,7 +12415,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11426
12415
|
`${name2}: Swift compatibility header phase has no Swift producer sources`
|
|
11427
12416
|
);
|
|
11428
12417
|
const building = options.prepareGeneratedSources && options.requireSources !== false;
|
|
11429
|
-
const versioning = building && allSources.length > 0 && settings2("VERSIONING_SYSTEM") === "apple-generic" ?
|
|
12418
|
+
const versioning = building && allSources.length > 0 && settings2("VERSIONING_SYSTEM") === "apple-generic" ? import_node_path18.default.join(settings2("DERIVED_FILE_DIR"), `${product}_vers.c`) : null;
|
|
11430
12419
|
if (versioning) {
|
|
11431
12420
|
const version = settings2("CURRENT_PROJECT_VERSION");
|
|
11432
12421
|
const custom = [
|
|
@@ -11439,7 +12428,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11439
12428
|
].filter((key) => settings2(key));
|
|
11440
12429
|
if (custom.length)
|
|
11441
12430
|
throw new Error(
|
|
11442
|
-
`${name2}: Xcode generates ${
|
|
12431
|
+
`${name2}: Xcode generates ${import_node_path18.default.basename(versioning)} with ${custom.join(", ")}; peach does not model VERSION_INFO_* overrides`
|
|
11443
12432
|
);
|
|
11444
12433
|
const symbol = product.replace(/^[^A-Za-z_]/, "_").replace(/[^A-Za-z0-9_]/g, "_");
|
|
11445
12434
|
const [major, minor] = version.split(".");
|
|
@@ -11452,9 +12441,9 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11452
12441
|
` const double ${symbol}VersionNumber __attribute__ ((used)) = (double)${number2};`,
|
|
11453
12442
|
""
|
|
11454
12443
|
].join("\n");
|
|
11455
|
-
if (!
|
|
11456
|
-
|
|
11457
|
-
|
|
12444
|
+
if (!import_node_fs18.default.existsSync(versioning) || import_node_fs18.default.readFileSync(versioning, "utf8") !== unit) {
|
|
12445
|
+
import_node_fs18.default.mkdirSync(import_node_path18.default.dirname(versioning), { recursive: true });
|
|
12446
|
+
import_node_fs18.default.writeFileSync(versioning, unit);
|
|
11458
12447
|
}
|
|
11459
12448
|
allSources.push(versioning);
|
|
11460
12449
|
}
|
|
@@ -11473,7 +12462,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11473
12462
|
const headerFiles = headerPhase(ref);
|
|
11474
12463
|
const ownHeaders = /* @__PURE__ */ new Map();
|
|
11475
12464
|
for (const { file, visibility } of headerFiles) {
|
|
11476
|
-
const name3 =
|
|
12465
|
+
const name3 = import_node_path18.default.basename(file);
|
|
11477
12466
|
const published = visibility !== "Project";
|
|
11478
12467
|
if (!ownHeaders.has(name3))
|
|
11479
12468
|
ownHeaders.set(name3, published ? `${product}/${name3}` : file);
|
|
@@ -11481,7 +12470,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11481
12470
|
ownHeaders.set(`${product}/${name3}`, file);
|
|
11482
12471
|
}
|
|
11483
12472
|
for (const file of synchronizedHeaders(ref)) {
|
|
11484
|
-
const name3 =
|
|
12473
|
+
const name3 = import_node_path18.default.basename(file);
|
|
11485
12474
|
if (ownHeaders.has(name3)) continue;
|
|
11486
12475
|
ownHeaders.set(name3, file);
|
|
11487
12476
|
const qualified = `${product}/${name3}`;
|
|
@@ -11493,24 +12482,24 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11493
12482
|
const otherProduct = productName(other);
|
|
11494
12483
|
for (const { file, visibility } of headerPhase(other)) {
|
|
11495
12484
|
if (visibility === "Project") continue;
|
|
11496
|
-
const key = `${otherProduct}/${
|
|
12485
|
+
const key = `${otherProduct}/${import_node_path18.default.basename(file)}`;
|
|
11497
12486
|
if (!nonFrameworkHeaders.has(key)) nonFrameworkHeaders.set(key, file);
|
|
11498
12487
|
}
|
|
11499
12488
|
}
|
|
11500
|
-
const wrapper =
|
|
12489
|
+
const wrapper = import_node_path18.default.join(settings2("BUILT_PRODUCTS_DIR"), `${product}.framework`);
|
|
11501
12490
|
const moduleMap = (settings2("DEFINES_MODULE") === "YES" || !framework) && settings2("MODULEMAP_FILE") ? absolute(settings2("MODULEMAP_FILE")) : null;
|
|
11502
|
-
const frameworkUmbrella = !compatibility && framework && members.sources.length > 0 && moduleMap ?
|
|
11503
|
-
const frameworkCompatibility = frameworkUmbrella && moduleMap &&
|
|
12491
|
+
const frameworkUmbrella = !compatibility && framework && members.sources.length > 0 && moduleMap ? import_node_path18.default.join(import_node_path18.default.dirname(moduleMap), `${moduleName}-umbrella.h`) : null;
|
|
12492
|
+
const frameworkCompatibility = frameworkUmbrella && moduleMap && import_node_fs18.default.existsSync(moduleMap) && import_node_fs18.default.existsSync(frameworkUmbrella) ? {
|
|
11504
12493
|
framework: true,
|
|
11505
12494
|
moduleMap,
|
|
11506
12495
|
umbrella: frameworkUmbrella,
|
|
11507
|
-
outputModuleMap:
|
|
11508
|
-
outputUmbrella:
|
|
12496
|
+
outputModuleMap: import_node_path18.default.join(wrapper, "Modules", "module.modulemap"),
|
|
12497
|
+
outputUmbrella: import_node_path18.default.join(
|
|
11509
12498
|
wrapper,
|
|
11510
12499
|
"Headers",
|
|
11511
|
-
|
|
12500
|
+
import_node_path18.default.basename(frameworkUmbrella)
|
|
11512
12501
|
),
|
|
11513
|
-
outputHeader:
|
|
12502
|
+
outputHeader: import_node_path18.default.join(
|
|
11514
12503
|
wrapper,
|
|
11515
12504
|
"Headers",
|
|
11516
12505
|
settings2("SWIFT_OBJC_INTERFACE_HEADER_NAME") || `${moduleName}-Swift.h`
|
|
@@ -11524,10 +12513,10 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11524
12513
|
outputUmbrella: compatibility.outputUmbrella,
|
|
11525
12514
|
outputHeader: compatibility.outputHeader
|
|
11526
12515
|
} : frameworkCompatibility;
|
|
11527
|
-
const podHeaders = !framework && isPodsProject(ref.project.xcodeproj) && moduleMap &&
|
|
12516
|
+
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) => {
|
|
11528
12517
|
if (!/\.(h|hh|hpp|hxx|modulemap)$/.test(entry)) return [];
|
|
11529
|
-
const file =
|
|
11530
|
-
return
|
|
12518
|
+
const file = import_node_path18.default.join(import_node_path18.default.dirname(moduleMap), entry);
|
|
12519
|
+
return import_node_fs18.default.existsSync(file) ? [file] : [];
|
|
11531
12520
|
}) : [];
|
|
11532
12521
|
const fileFlags = {};
|
|
11533
12522
|
for (const phaseId of list(ref.target.buildPhases)) {
|
|
@@ -11602,15 +12591,15 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11602
12591
|
// xcode searches its products' include directory before
|
|
11603
12592
|
// HEADER_SEARCH_PATHS and the target's derived sources after.
|
|
11604
12593
|
headerSearchPaths: [
|
|
11605
|
-
|
|
12594
|
+
import_node_path18.default.join(settings2("BUILT_PRODUCTS_DIR"), "include"),
|
|
11606
12595
|
...settingList(settings2("HEADER_SEARCH_PATHS")).flatMap(
|
|
11607
12596
|
(raw) => expandSearchPath(absolute(raw), searchRules)
|
|
11608
12597
|
),
|
|
11609
|
-
|
|
12598
|
+
import_node_path18.default.join(
|
|
11610
12599
|
`${settings2("DERIVED_FILE_DIR")}-normal`,
|
|
11611
12600
|
settings2("CURRENT_ARCH")
|
|
11612
12601
|
),
|
|
11613
|
-
|
|
12602
|
+
import_node_path18.default.join(settings2("DERIVED_FILE_DIR"), settings2("CURRENT_ARCH")),
|
|
11614
12603
|
settings2("DERIVED_FILE_DIR")
|
|
11615
12604
|
],
|
|
11616
12605
|
userHeaderSearchPaths: settingList(
|
|
@@ -11660,10 +12649,10 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11660
12649
|
...headerFiles.flatMap(
|
|
11661
12650
|
({ file, visibility }) => visibility === "Project" ? [] : [
|
|
11662
12651
|
[
|
|
11663
|
-
|
|
12652
|
+
import_node_path18.default.join(
|
|
11664
12653
|
wrapper,
|
|
11665
12654
|
visibility === "Public" ? "Headers" : "PrivateHeaders",
|
|
11666
|
-
|
|
12655
|
+
import_node_path18.default.basename(file)
|
|
11667
12656
|
),
|
|
11668
12657
|
file
|
|
11669
12658
|
]
|
|
@@ -11677,7 +12666,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11677
12666
|
return [];
|
|
11678
12667
|
const destination = expand(
|
|
11679
12668
|
str(phase.dstPath) ?? "",
|
|
11680
|
-
(name3) => name3 === "PUBLIC_HEADERS_FOLDER_PATH" ?
|
|
12669
|
+
(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)
|
|
11681
12670
|
);
|
|
11682
12671
|
return list(phase.files).flatMap((id) => {
|
|
11683
12672
|
const file = ref.project.resolvePath(
|
|
@@ -11685,17 +12674,17 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11685
12674
|
);
|
|
11686
12675
|
return file && HEADER_FILE.test(file) ? [
|
|
11687
12676
|
[
|
|
11688
|
-
|
|
12677
|
+
import_node_path18.default.resolve(
|
|
11689
12678
|
settings2("BUILT_PRODUCTS_DIR"),
|
|
11690
12679
|
destination,
|
|
11691
|
-
|
|
12680
|
+
import_node_path18.default.basename(file)
|
|
11692
12681
|
),
|
|
11693
12682
|
file
|
|
11694
12683
|
]
|
|
11695
12684
|
] : [];
|
|
11696
12685
|
});
|
|
11697
12686
|
}),
|
|
11698
|
-
...moduleMap ? [[
|
|
12687
|
+
...moduleMap ? [[import_node_path18.default.join(wrapper, "Modules", "module.modulemap"), moduleMap]] : []
|
|
11699
12688
|
]) : Object.fromEntries([
|
|
11700
12689
|
...podHeaders.map((file) => [file, file]),
|
|
11701
12690
|
...moduleMap ? [[moduleMap, moduleMap]] : []
|
|
@@ -11727,7 +12716,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11727
12716
|
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 }));
|
|
11728
12717
|
const frameworks = frameworkTargets.map(({ framework }) => framework);
|
|
11729
12718
|
const podSourceDirs = builtTargets.slice(0, -1).flatMap(
|
|
11730
|
-
({ ref, module: module3 }) => isPodsProject(ref.project.xcodeproj) ? [...module3.allSources, ...module3.objc?.headers ?? []].map((file) =>
|
|
12719
|
+
({ 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)) : []
|
|
11731
12720
|
);
|
|
11732
12721
|
const expandValue = (value, settings2) => {
|
|
11733
12722
|
if (typeof value === "string") return expand(value, settings2);
|
|
@@ -11748,7 +12737,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11748
12737
|
const phase = owner.ref.project.object(phaseId);
|
|
11749
12738
|
if (phase?.isa !== "PBXShellScriptBuildPhase" || str(phase.name) !== "[CP] Copy Pods Resources")
|
|
11750
12739
|
continue;
|
|
11751
|
-
const absolute = (raw) =>
|
|
12740
|
+
const absolute = (raw) => import_node_path18.default.resolve(owner.ref.project.projectDir, expand(raw, owner.settings));
|
|
11752
12741
|
const entries = (paths) => paths.flatMap((raw) => {
|
|
11753
12742
|
const file = absolute(raw);
|
|
11754
12743
|
xcconfigs.add(file);
|
|
@@ -11764,7 +12753,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11764
12753
|
].filter((file) => file.endsWith(".bundle"));
|
|
11765
12754
|
if (inputs.length !== outputs.length)
|
|
11766
12755
|
throw new Error(`${owner.module.name}: resource bundle copy lists differ`);
|
|
11767
|
-
const destinationRoot =
|
|
12756
|
+
const destinationRoot = import_node_path18.default.join(
|
|
11768
12757
|
owner.settings("TARGET_BUILD_DIR"),
|
|
11769
12758
|
owner.settings("UNLOCALIZED_RESOURCES_FOLDER_PATH")
|
|
11770
12759
|
);
|
|
@@ -11773,24 +12762,24 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11773
12762
|
const file = str(
|
|
11774
12763
|
target.ref.project.object(str(target.ref.target.productReference))?.path
|
|
11775
12764
|
);
|
|
11776
|
-
return file &&
|
|
12765
|
+
return file && import_node_path18.default.join(target.settings("TARGET_BUILD_DIR"), file) === input2;
|
|
11777
12766
|
});
|
|
11778
12767
|
if (!product && !isDirectory(input2))
|
|
11779
12768
|
throw new Error(
|
|
11780
12769
|
`${owner.module.name}: resource bundle input has no selected producer: ${input2}`
|
|
11781
12770
|
);
|
|
11782
|
-
const destination =
|
|
11783
|
-
if (destination === ".." || destination.startsWith(`..${
|
|
12771
|
+
const destination = import_node_path18.default.relative(destinationRoot, outputs[index]);
|
|
12772
|
+
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))
|
|
11784
12773
|
throw new Error(
|
|
11785
12774
|
`${owner.module.name}: invalid resource bundle copy destination`
|
|
11786
12775
|
);
|
|
11787
|
-
const infoFile = product ?
|
|
12776
|
+
const infoFile = product ? import_node_path18.default.resolve(
|
|
11788
12777
|
product.ref.project.projectDir,
|
|
11789
12778
|
product.settings("INFOPLIST_FILE")
|
|
11790
12779
|
) : null;
|
|
11791
12780
|
if (infoFile) xcconfigs.add(infoFile);
|
|
11792
12781
|
const prefix2 = owner.ref === app ? "" : `Frameworks/${owner.module.moduleName}.framework/`;
|
|
11793
|
-
const bundlePath = prefix2 + destination.split(
|
|
12782
|
+
const bundlePath = prefix2 + destination.split(import_node_path18.default.sep).join("/");
|
|
11794
12783
|
if (resourceProducts.some((resource) => resource.path === bundlePath))
|
|
11795
12784
|
throw new Error(
|
|
11796
12785
|
`${owner.module.name}: duplicate resource bundle destination ${bundlePath}`
|
|
@@ -11801,22 +12790,22 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11801
12790
|
resources: product.module.resources,
|
|
11802
12791
|
infoPlist: import_plist2.default.build(
|
|
11803
12792
|
expandValue(
|
|
11804
|
-
import_plist2.default.parse(
|
|
12793
|
+
import_plist2.default.parse(import_node_fs18.default.readFileSync(infoFile, "utf8")),
|
|
11805
12794
|
product.settings
|
|
11806
12795
|
)
|
|
11807
12796
|
)
|
|
11808
12797
|
} : {
|
|
11809
|
-
resources:
|
|
12798
|
+
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(),
|
|
11810
12799
|
sourceRoot: input2
|
|
11811
12800
|
}
|
|
11812
12801
|
});
|
|
11813
12802
|
}
|
|
11814
12803
|
}
|
|
11815
12804
|
}
|
|
11816
|
-
const infoPlistFile = settings("INFOPLIST_FILE") ?
|
|
11817
|
-
const entitlementsFile = settings("CODE_SIGN_ENTITLEMENTS") ?
|
|
12805
|
+
const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path18.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
|
|
12806
|
+
const entitlementsFile = settings("CODE_SIGN_ENTITLEMENTS") ? import_node_path18.default.resolve(app.project.projectDir, settings("CODE_SIGN_ENTITLEMENTS")) : null;
|
|
11818
12807
|
const infoPlistPending = module2.generatedInfoPlist && !options.prepareGeneratedSources;
|
|
11819
|
-
const sourceInfo = infoPlistFile && !infoPlistPending ? import_plist2.default.parse(
|
|
12808
|
+
const sourceInfo = infoPlistFile && !infoPlistPending ? import_plist2.default.parse(import_node_fs18.default.readFileSync(infoPlistFile, "utf8")) : {};
|
|
11820
12809
|
if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
|
|
11821
12810
|
throw new Error(`${module2.name} Info.plist must contain a dictionary`);
|
|
11822
12811
|
}
|
|
@@ -11840,7 +12829,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11840
12829
|
}
|
|
11841
12830
|
const bundleIdentifier = settings("PRODUCT_BUNDLE_IDENTIFIER") || (typeof info.CFBundleIdentifier === "string" ? info.CFBundleIdentifier : "");
|
|
11842
12831
|
const keychainAccessGroups = entitlementsFile ? readKeychainAccessGroups(
|
|
11843
|
-
import_plist2.default.parse(
|
|
12832
|
+
import_plist2.default.parse(import_node_fs18.default.readFileSync(entitlementsFile, "utf8")),
|
|
11844
12833
|
(value) => expand(value, (key) => {
|
|
11845
12834
|
if (key === "AppIdentifierPrefix") return "FAKETEAMID.";
|
|
11846
12835
|
if (key === "TeamIdentifierPrefix") return "";
|
|
@@ -11876,7 +12865,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11876
12865
|
};
|
|
11877
12866
|
}
|
|
11878
12867
|
const localPackageDirs = [
|
|
11879
|
-
...listed.filter((reference) =>
|
|
12868
|
+
...listed.filter((reference) => import_node_fs18.default.existsSync(import_node_path18.default.join(reference, "Package.swift"))),
|
|
11880
12869
|
...projects.flatMap(
|
|
11881
12870
|
(project) => Object.entries(project.objects).flatMap(([id, entry]) => {
|
|
11882
12871
|
if (!isDict(entry)) return [];
|
|
@@ -11886,19 +12875,19 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11886
12875
|
const packages = [];
|
|
11887
12876
|
while (pending.length > 0) {
|
|
11888
12877
|
const dir = pending.pop();
|
|
11889
|
-
if (
|
|
12878
|
+
if (import_node_fs18.default.existsSync(import_node_path18.default.join(dir, "Package.swift"))) {
|
|
11890
12879
|
packages.push(dir);
|
|
11891
12880
|
continue;
|
|
11892
12881
|
}
|
|
11893
12882
|
if (!isDirectory(dir)) continue;
|
|
11894
|
-
for (const child of
|
|
12883
|
+
for (const child of import_node_fs18.default.readdirSync(dir, { withFileTypes: true }))
|
|
11895
12884
|
if (child.isDirectory() && !child.name.startsWith("."))
|
|
11896
|
-
pending.push(
|
|
12885
|
+
pending.push(import_node_path18.default.join(dir, child.name));
|
|
11897
12886
|
}
|
|
11898
12887
|
return packages;
|
|
11899
12888
|
}
|
|
11900
|
-
const candidate = entry.isa === "XCLocalSwiftPackageReference" ?
|
|
11901
|
-
return candidate &&
|
|
12889
|
+
const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path18.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
|
|
12890
|
+
return candidate && import_node_fs18.default.existsSync(import_node_path18.default.join(candidate, "Package.swift")) ? [candidate] : [];
|
|
11902
12891
|
})
|
|
11903
12892
|
)
|
|
11904
12893
|
];
|
|
@@ -11928,7 +12917,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11928
12917
|
if ((flag === "-framework" || flag === "-weak_framework") && name2)
|
|
11929
12918
|
sdkFrameworks.add(name2);
|
|
11930
12919
|
});
|
|
11931
|
-
const absolute = (raw) =>
|
|
12920
|
+
const absolute = (raw) => import_node_path18.default.resolve(ref.project.projectDir, expand(raw, settings2));
|
|
11932
12921
|
const requested = options.nativeModules;
|
|
11933
12922
|
const includeBinary = (name2, dir) => {
|
|
11934
12923
|
if (!requested || nativeTargets.has(ref) || requested.includes(name2) || dir.endsWith(".xcframework") && localSwiftBinaryModules(dir).some((module3) => requested.includes(module3)))
|
|
@@ -11940,14 +12929,14 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11940
12929
|
for (const directory of expandSearchPath(absolute(raw), searchRules)) {
|
|
11941
12930
|
if (frameworkSearchDirectories.has(directory)) continue;
|
|
11942
12931
|
frameworkSearchDirectories.add(directory);
|
|
11943
|
-
if (!
|
|
12932
|
+
if (!import_node_fs18.default.statSync(directory, { throwIfNoEntry: false })?.isDirectory() || /\.sdk\/(?:System|Developer)\/Library\/Frameworks\/?$/.test(directory))
|
|
11944
12933
|
continue;
|
|
11945
|
-
for (const entry of
|
|
12934
|
+
for (const entry of import_node_fs18.default.readdirSync(directory, { withFileTypes: true })) {
|
|
11946
12935
|
const name2 = /^(.+)\.framework$/.exec(entry.name)?.[1];
|
|
11947
12936
|
if (!name2 || byProduct.has(entry.name) || searchedFrameworks.has(name2))
|
|
11948
12937
|
continue;
|
|
11949
|
-
const file =
|
|
11950
|
-
if (
|
|
12938
|
+
const file = import_node_path18.default.join(directory, entry.name);
|
|
12939
|
+
if (import_node_fs18.default.statSync(file, { throwIfNoEntry: false })?.isDirectory())
|
|
11951
12940
|
searchedFrameworks.set(name2, file);
|
|
11952
12941
|
}
|
|
11953
12942
|
}
|
|
@@ -11955,9 +12944,9 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11955
12944
|
}
|
|
11956
12945
|
for (const raw of settingList(settings2("SWIFT_INCLUDE_PATHS"))) {
|
|
11957
12946
|
const dir = absolute(raw);
|
|
11958
|
-
const modulemap =
|
|
11959
|
-
if (!
|
|
11960
|
-
const name2 = moduleMapName(
|
|
12947
|
+
const modulemap = import_node_path18.default.join(dir, "module.modulemap");
|
|
12948
|
+
if (!import_node_fs18.default.existsSync(modulemap)) continue;
|
|
12949
|
+
const name2 = moduleMapName(import_node_fs18.default.readFileSync(modulemap, "utf8"));
|
|
11961
12950
|
if (name2 && !binaryFrameworks.has(name2)) includeBinary(name2, dir);
|
|
11962
12951
|
}
|
|
11963
12952
|
for (const phaseId of list(ref.target.buildPhases)) {
|
|
@@ -11966,7 +12955,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
11966
12955
|
const inputs = list(phase.inputPaths).map(absolute);
|
|
11967
12956
|
for (const raw of list(phase.inputFileListPaths)) {
|
|
11968
12957
|
const file = absolute(raw);
|
|
11969
|
-
if (!
|
|
12958
|
+
if (!import_node_fs18.default.existsSync(file)) continue;
|
|
11970
12959
|
xcconfigs.add(file);
|
|
11971
12960
|
inputs.push(...fileListEntries(file, absolute));
|
|
11972
12961
|
}
|
|
@@ -12031,7 +13020,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
12031
13020
|
...productAttributes.get(dependencyId)?.length ? { attributes: productAttributes.get(dependencyId) } : {},
|
|
12032
13021
|
source: reference?.isa === "XCRemoteSwiftPackageReference" ? { kind: "remote", url: str(reference.repositoryURL) ?? "" } : reference?.isa === "XCLocalSwiftPackageReference" ? {
|
|
12033
13022
|
kind: "local",
|
|
12034
|
-
dir:
|
|
13023
|
+
dir: import_node_path18.default.resolve(
|
|
12035
13024
|
project.projectDir,
|
|
12036
13025
|
str(reference.relativePath) ?? ""
|
|
12037
13026
|
)
|
|
@@ -12065,10 +13054,10 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
12065
13054
|
continue;
|
|
12066
13055
|
}
|
|
12067
13056
|
if (tree2 === "BUILT_PRODUCTS_DIR" || tree2 === "DEVELOPER_DIR" || // a target in the workspace builds it, so it exists only after that build
|
|
12068
|
-
byProduct.has(
|
|
13057
|
+
byProduct.has(import_node_path18.default.basename(rawPath)))
|
|
12069
13058
|
continue;
|
|
12070
13059
|
const resolved = fileId ? project.resolvePath(fileId) : null;
|
|
12071
|
-
if (fileId && resolved !== null && !
|
|
13060
|
+
if (fileId && resolved !== null && !import_node_fs18.default.existsSync(resolved))
|
|
12072
13061
|
throw new Error(
|
|
12073
13062
|
`${str(target.name) ?? "target"}: linked framework ${name2} (${fileId}) points at missing ${resolved} in ${project.projectFile}`
|
|
12074
13063
|
);
|
|
@@ -12091,7 +13080,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
12091
13080
|
({ product }) => !options.nativeModules || nativeTargets.has(built.ref) || options.nativeModules.includes(product)
|
|
12092
13081
|
);
|
|
12093
13082
|
const resolvedFile = workspaceResolvedFile(xcodeprojOrWorkspace);
|
|
12094
|
-
let packageResolved =
|
|
13083
|
+
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();
|
|
12095
13084
|
if (packageResolved.length === 0) {
|
|
12096
13085
|
const requirements = remotePackageRequirements(projects);
|
|
12097
13086
|
if (requirements.length > 0) {
|
|
@@ -12142,14 +13131,14 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
12142
13131
|
} : {},
|
|
12143
13132
|
rootDir: commonAncestor(
|
|
12144
13133
|
[
|
|
12145
|
-
workspace ?
|
|
13134
|
+
workspace ? import_node_path18.default.dirname(workspace) : app.project.projectDir,
|
|
12146
13135
|
...used.map((project) => project.projectDir),
|
|
12147
13136
|
...localPackageDirs,
|
|
12148
13137
|
...linkedProducts.flatMap(
|
|
12149
|
-
({ source }) => source.kind === "local" &&
|
|
13138
|
+
({ source }) => source.kind === "local" && import_node_fs18.default.existsSync(source.dir) ? [source.dir] : []
|
|
12150
13139
|
),
|
|
12151
13140
|
...new Set(podSourceDirs)
|
|
12152
|
-
].map((dir) =>
|
|
13141
|
+
].map((dir) => import_node_fs18.default.realpathSync.native(dir))
|
|
12153
13142
|
),
|
|
12154
13143
|
projectFiles: [
|
|
12155
13144
|
.../* @__PURE__ */ new Set([
|
|
@@ -12170,7 +13159,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
12170
13159
|
resourceProducts,
|
|
12171
13160
|
linkedProducts,
|
|
12172
13161
|
localPackageDirs: [
|
|
12173
|
-
...new Set(localPackageDirs.map((dir) =>
|
|
13162
|
+
...new Set(localPackageDirs.map((dir) => import_node_fs18.default.realpathSync.native(dir)))
|
|
12174
13163
|
].sort(),
|
|
12175
13164
|
binaryFrameworks: [...binaryFrameworks].map(([name2, file]) => ({ name: name2, path: file })).sort((left, right) => left.name.localeCompare(right.name)),
|
|
12176
13165
|
sdkFrameworks: [...sdkFrameworks].filter(
|
|
@@ -12202,13 +13191,13 @@ const result = JSON.stringify(getConfig(root, { skipSDKVersionRequirement: true
|
|
|
12202
13191
|
if (Buffer.byteLength(result) > 1024 * 1024) throw new Error('Expo native configuration exceeds 1 MiB.');
|
|
12203
13192
|
writeFileSync(process.argv[2], result, { mode: 0o600 });`;
|
|
12204
13193
|
function hasExpoConfig(projectRoot) {
|
|
12205
|
-
const appJsonPath =
|
|
12206
|
-
const appJson =
|
|
13194
|
+
const appJsonPath = import_node_path19.default.join(projectRoot, "app.json");
|
|
13195
|
+
const appJson = import_node_fs19.default.existsSync(appJsonPath) ? JSON.parse(import_node_fs19.default.readFileSync(appJsonPath, "utf8")) : null;
|
|
12207
13196
|
const staticExpo = isRecord(appJson) && (isRecord(appJson.expo) || [appJson.ios, appJson.android].some(
|
|
12208
13197
|
(value) => isRecord(value) && typeof value.googleServicesFile === "string"
|
|
12209
13198
|
));
|
|
12210
13199
|
return staticExpo || ["app.config.js", "app.config.ts", "app.config.cjs", "app.config.mjs"].some(
|
|
12211
|
-
(name2) =>
|
|
13200
|
+
(name2) => import_node_fs19.default.existsSync(import_node_path19.default.join(projectRoot, name2))
|
|
12212
13201
|
);
|
|
12213
13202
|
}
|
|
12214
13203
|
function expoConfigArgs(projectRoot, resultPath) {
|
|
@@ -12216,7 +13205,7 @@ function expoConfigArgs(projectRoot, resultPath) {
|
|
|
12216
13205
|
"--input-type=commonjs",
|
|
12217
13206
|
"-e",
|
|
12218
13207
|
EXPO_CONFIG_SCRIPT,
|
|
12219
|
-
|
|
13208
|
+
import_node_path19.default.resolve(projectRoot),
|
|
12220
13209
|
resultPath
|
|
12221
13210
|
];
|
|
12222
13211
|
}
|
|
@@ -12230,17 +13219,17 @@ function readExpoConfigResult(resultPath, status, signal, stderr) {
|
|
|
12230
13219
|
throw new Error(
|
|
12231
13220
|
stderr || (signal ? `Expo native configuration evaluation was killed by ${signal}.` : "Expo native configuration evaluation failed.")
|
|
12232
13221
|
);
|
|
12233
|
-
const resolved = JSON.parse(
|
|
13222
|
+
const resolved = JSON.parse(import_node_fs19.default.readFileSync(resultPath, "utf8"));
|
|
12234
13223
|
if (!isRecord(resolved)) throw new Error("Expo native configuration is unavailable.");
|
|
12235
13224
|
return resolved;
|
|
12236
13225
|
}
|
|
12237
|
-
var resultDirectory = () =>
|
|
13226
|
+
var resultDirectory = () => import_node_fs19.default.mkdtempSync(import_node_path19.default.join(import_node_os5.default.tmpdir(), "peach-expo-config-"));
|
|
12238
13227
|
function readExpoConfig(projectRoot) {
|
|
12239
13228
|
if (!hasExpoConfig(projectRoot)) return {};
|
|
12240
13229
|
const directory = resultDirectory();
|
|
12241
|
-
const resultPath =
|
|
13230
|
+
const resultPath = import_node_path19.default.join(directory, "config.json");
|
|
12242
13231
|
try {
|
|
12243
|
-
const child = (0,
|
|
13232
|
+
const child = (0, import_node_child_process10.spawnSync)("node", expoConfigArgs(projectRoot, resultPath), {
|
|
12244
13233
|
cwd: projectRoot,
|
|
12245
13234
|
encoding: "utf8",
|
|
12246
13235
|
stdio: ["ignore", "ignore", "pipe"],
|
|
@@ -12250,7 +13239,7 @@ function readExpoConfig(projectRoot) {
|
|
|
12250
13239
|
if (child.error) throw child.error;
|
|
12251
13240
|
return readExpoConfigResult(resultPath, child.status, child.signal, child.stderr);
|
|
12252
13241
|
} finally {
|
|
12253
|
-
|
|
13242
|
+
import_node_fs19.default.rmSync(directory, { recursive: true, force: true });
|
|
12254
13243
|
}
|
|
12255
13244
|
}
|
|
12256
13245
|
var HELPER_DEPTH = 3;
|
|
@@ -12298,7 +13287,7 @@ function splitClauses(condition) {
|
|
|
12298
13287
|
function findHelper(type, name2, label, sources) {
|
|
12299
13288
|
const found = [];
|
|
12300
13289
|
for (const file of sources) {
|
|
12301
|
-
const raw =
|
|
13290
|
+
const raw = import_node_fs19.default.readFileSync(file, "utf8");
|
|
12302
13291
|
const blank = blankSwiftObjcLiterals(raw);
|
|
12303
13292
|
if (file.endsWith(".swift") && label === void 0) {
|
|
12304
13293
|
const owners = type ? [
|
|
@@ -12384,7 +13373,7 @@ function evaluateSwiftBody(body, scope, depth) {
|
|
|
12384
13373
|
}
|
|
12385
13374
|
function evaluateObjcBody(body, bundle, constants, scope) {
|
|
12386
13375
|
const plists = scope.resources.filter(
|
|
12387
|
-
(file) =>
|
|
13376
|
+
(file) => import_node_path19.default.basename(file) === "GoogleService-Info.plist"
|
|
12388
13377
|
);
|
|
12389
13378
|
const variables = /* @__PURE__ */ new Map();
|
|
12390
13379
|
const literal2 = (text2) => {
|
|
@@ -12427,7 +13416,7 @@ function evaluateObjcBody(body, bundle, constants, scope) {
|
|
|
12427
13416
|
variables.set(name2, plists.length === 1 ? plists[0] : void 0);
|
|
12428
13417
|
} else if (dictionary && variables.has(dictionary[1])) {
|
|
12429
13418
|
const file = variables.get(dictionary[1]);
|
|
12430
|
-
const parsed = typeof file === "string" ? parsePlistSource(
|
|
13419
|
+
const parsed = typeof file === "string" ? parsePlistSource(import_node_fs19.default.readFileSync(file, "utf8")) : void 0;
|
|
12431
13420
|
variables.set(name2, isRecord(parsed) ? parsed : void 0);
|
|
12432
13421
|
} else if (entry && variables.has(entry[1])) {
|
|
12433
13422
|
const key = literal2(entry[2]);
|
|
@@ -12440,7 +13429,7 @@ function evaluateObjcBody(body, bundle, constants, scope) {
|
|
|
12440
13429
|
}
|
|
12441
13430
|
function evaluateClauses(clauses, scope, bound, depth) {
|
|
12442
13431
|
const sources = scope.resources.filter(
|
|
12443
|
-
(file) =>
|
|
13432
|
+
(file) => import_node_path19.default.basename(file) === "GoogleService-Info.plist"
|
|
12444
13433
|
);
|
|
12445
13434
|
for (const clause of clauses) {
|
|
12446
13435
|
if (clause === "true") continue;
|
|
@@ -12457,7 +13446,7 @@ function evaluateClauses(clauses, scope, bound, depth) {
|
|
|
12457
13446
|
const dictionary = /^let\s+(\w+)\s*=\s*NSDictionary\s*\(\s*contentsOfFile:\s*(\w+)\s*\)$/.exec(clause);
|
|
12458
13447
|
if (dictionary && typeof bound.get(dictionary[2]) === "string") {
|
|
12459
13448
|
const parsed = parsePlistSource(
|
|
12460
|
-
|
|
13449
|
+
import_node_fs19.default.readFileSync(String(bound.get(dictionary[2])), "utf8")
|
|
12461
13450
|
);
|
|
12462
13451
|
if (!isRecord(parsed)) return false;
|
|
12463
13452
|
bound.set(dictionary[1], parsed);
|
|
@@ -12546,7 +13535,7 @@ function findDefaultConfigureCall(body, sources) {
|
|
|
12546
13535
|
const [, type, name2] = call;
|
|
12547
13536
|
for (const file of sources) {
|
|
12548
13537
|
if (!file.endsWith(".swift")) continue;
|
|
12549
|
-
const source = blankSwiftObjcLiterals(
|
|
13538
|
+
const source = blankSwiftObjcLiterals(import_node_fs19.default.readFileSync(file, "utf8"));
|
|
12550
13539
|
const declaration = new RegExp(
|
|
12551
13540
|
`\\b(?:enum|struct|class)\\s+${type}\\b[^{]*\\{`
|
|
12552
13541
|
).exec(source);
|
|
@@ -12568,10 +13557,10 @@ function readTargetGoogleServicesFile(projectRoot, container, target, prepareGen
|
|
|
12568
13557
|
prepareGeneratedSources
|
|
12569
13558
|
});
|
|
12570
13559
|
const delegates = app.allSources.filter(
|
|
12571
|
-
(file) => /^AppDelegate\.(swift|mm|m)$/.test(
|
|
13560
|
+
(file) => /^AppDelegate\.(swift|mm|m)$/.test(import_node_path19.default.basename(file))
|
|
12572
13561
|
);
|
|
12573
13562
|
const defaultConfigured = delegates.some((file) => {
|
|
12574
|
-
const raw =
|
|
13563
|
+
const raw = import_node_fs19.default.readFileSync(file, "utf8");
|
|
12575
13564
|
const source = blankSwiftObjcLiterals(raw);
|
|
12576
13565
|
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(
|
|
12577
13566
|
source
|
|
@@ -12642,17 +13631,17 @@ function readTargetGoogleServicesFile(projectRoot, container, target, prepareGen
|
|
|
12642
13631
|
return guarded;
|
|
12643
13632
|
});
|
|
12644
13633
|
if (!defaultConfigured) return null;
|
|
12645
|
-
const bundle =
|
|
13634
|
+
const bundle = import_node_path19.default.join(
|
|
12646
13635
|
app.settings("BUILT_PRODUCTS_DIR"),
|
|
12647
13636
|
app.settings("WRAPPER_NAME") || `${app.settings("PRODUCT_NAME")}.app`
|
|
12648
13637
|
);
|
|
12649
13638
|
const staged = app.copiedFiles.filter(
|
|
12650
|
-
({ from, to }) => to ===
|
|
12651
|
-
).map(({ from }) =>
|
|
13639
|
+
({ from, to }) => to === import_node_path19.default.join(bundle, "GoogleService-Info.plist") && import_node_fs19.default.existsSync(from)
|
|
13640
|
+
).map(({ from }) => import_node_fs19.default.realpathSync(from));
|
|
12652
13641
|
const resources = [
|
|
12653
13642
|
.../* @__PURE__ */ new Set([
|
|
12654
13643
|
...app.resources.filter(
|
|
12655
|
-
(file) => /^GoogleService-Info\.plist$/.test(
|
|
13644
|
+
(file) => /^GoogleService-Info\.plist$/.test(import_node_path19.default.basename(file))
|
|
12656
13645
|
),
|
|
12657
13646
|
...staged
|
|
12658
13647
|
])
|
|
@@ -12661,7 +13650,7 @@ function readTargetGoogleServicesFile(projectRoot, container, target, prepareGen
|
|
|
12661
13650
|
throw new Error(
|
|
12662
13651
|
"native Firebase default initialization requires one GoogleService-Info.plist build resource"
|
|
12663
13652
|
);
|
|
12664
|
-
return
|
|
13653
|
+
return import_node_path19.default.relative(import_node_fs19.default.realpathSync(projectRoot), resources[0]);
|
|
12665
13654
|
}
|
|
12666
13655
|
function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"], iosTarget, config = readExpoConfig(projectRoot), prepareGeneratedSources = false) {
|
|
12667
13656
|
const result = {};
|
|
@@ -12682,8 +13671,8 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"], i
|
|
|
12682
13671
|
const native = config[platform];
|
|
12683
13672
|
if (!isRecord(native) || typeof native.googleServicesFile !== "string") continue;
|
|
12684
13673
|
try {
|
|
12685
|
-
const source =
|
|
12686
|
-
|
|
13674
|
+
const source = import_node_fs19.default.readFileSync(
|
|
13675
|
+
import_node_path19.default.resolve(projectRoot, native.googleServicesFile),
|
|
12687
13676
|
"utf8"
|
|
12688
13677
|
);
|
|
12689
13678
|
const parsed = platform === "ios" ? parsePlistSource(source) : JSON.parse(source);
|
|
@@ -12763,9 +13752,9 @@ init_is_record();
|
|
|
12763
13752
|
|
|
12764
13753
|
// src/native-app-identity-project.ts
|
|
12765
13754
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
12766
|
-
var
|
|
13755
|
+
var import_node_fs22 = __toESM(require("node:fs"), 1);
|
|
12767
13756
|
var import_node_module3 = require("node:module");
|
|
12768
|
-
var
|
|
13757
|
+
var import_node_path22 = __toESM(require("node:path"), 1);
|
|
12769
13758
|
init_is_record();
|
|
12770
13759
|
function nonEmptyString2(value) {
|
|
12771
13760
|
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
@@ -12853,7 +13842,7 @@ function readNativeAppIdentityFromXcodeTarget(app, parseInfoPlist = parsePlistSo
|
|
|
12853
13842
|
const rtcAppGroupIdentifier = nonEmptyString2(dictionary.RTCAppGroupIdentifier);
|
|
12854
13843
|
const screenShareExtensionBundleId = typeof dictionary.ScreenShareExtensionBundleId === "string" ? dictionary.ScreenShareExtensionBundleId : void 0;
|
|
12855
13844
|
const rootModuleName = readRootModuleName(
|
|
12856
|
-
app.allSources.filter((file) => /Delegate\.(?:swift|mm|m)$/.test(file) &&
|
|
13845
|
+
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"))
|
|
12857
13846
|
);
|
|
12858
13847
|
return stampNativeBuildSdk({
|
|
12859
13848
|
...app.keychainAccessGroups === void 0 ? {} : { keychainAccessGroups: app.keychainAccessGroups },
|
|
@@ -12875,7 +13864,7 @@ function readNativeAppIdentityFromXcodeTarget(app, parseInfoPlist = parsePlistSo
|
|
|
12875
13864
|
googleSignIn: readGoogleSignInConfiguration(
|
|
12876
13865
|
dictionary,
|
|
12877
13866
|
Object.fromEntries(
|
|
12878
|
-
app.resources.filter((file) => file.endsWith(".plist")).map((file) => [file, parseInfoPlist(
|
|
13867
|
+
app.resources.filter((file) => file.endsWith(".plist")).map((file) => [file, parseInfoPlist(import_node_fs22.default.readFileSync(file, "utf8"))])
|
|
12879
13868
|
)
|
|
12880
13869
|
),
|
|
12881
13870
|
supportedInterfaceOrientations,
|
|
@@ -12885,11 +13874,11 @@ function readNativeAppIdentityFromXcodeTarget(app, parseInfoPlist = parsePlistSo
|
|
|
12885
13874
|
bundleIcons: resolveNativeBundleIcons(icons, catalogAlternateNames, (value) => value),
|
|
12886
13875
|
appIconArtwork: resolveNativeAppIconArtwork(
|
|
12887
13876
|
app.resources,
|
|
12888
|
-
(file) =>
|
|
13877
|
+
(file) => import_node_fs22.default.readFileSync(file, "utf8"),
|
|
12889
13878
|
(file) => {
|
|
12890
|
-
const extension =
|
|
13879
|
+
const extension = import_node_path22.default.extname(file).toLowerCase();
|
|
12891
13880
|
const contentType = extension === ".jpg" || extension === ".jpeg" ? "image/jpeg" : extension === ".webp" ? "image/webp" : "image/png";
|
|
12892
|
-
return `data:${contentType};base64,${
|
|
13881
|
+
return `data:${contentType};base64,${import_node_fs22.default.readFileSync(file).toString("base64")}`;
|
|
12893
13882
|
},
|
|
12894
13883
|
icons,
|
|
12895
13884
|
app.appIconName,
|
|
@@ -12919,11 +13908,11 @@ function readNativeAppIdentityFromSources(projectRoot, platform, parseInfoPlist,
|
|
|
12919
13908
|
const read = selectNativeAppIdentityReader(platform, {
|
|
12920
13909
|
android: () => null,
|
|
12921
13910
|
ios: () => {
|
|
12922
|
-
const nested =
|
|
12923
|
-
const iosRoot =
|
|
13911
|
+
const nested = import_node_path22.default.join(projectRoot, "ios");
|
|
13912
|
+
const iosRoot = import_node_fs22.default.existsSync(nested) ? nested : projectRoot;
|
|
12924
13913
|
const prefix2 = iosRoot === nested ? "ios/" : "";
|
|
12925
13914
|
const files = {};
|
|
12926
|
-
for (const entry of
|
|
13915
|
+
for (const entry of import_node_fs22.default.readdirSync(iosRoot, { withFileTypes: true })) {
|
|
12927
13916
|
if (entry.name === "Pods") continue;
|
|
12928
13917
|
if (entry.isDirectory()) {
|
|
12929
13918
|
const names = entry.name.endsWith(".xcodeproj") ? ["project.pbxproj"] : [
|
|
@@ -12931,17 +13920,17 @@ function readNativeAppIdentityFromSources(projectRoot, platform, parseInfoPlist,
|
|
|
12931
13920
|
"AppDelegate.swift",
|
|
12932
13921
|
"AppDelegate.mm",
|
|
12933
13922
|
"AppDelegate.m",
|
|
12934
|
-
...
|
|
13923
|
+
...import_node_fs22.default.readdirSync(import_node_path22.default.join(iosRoot, entry.name)).filter((name2) => name2.endsWith(".entitlements"))
|
|
12935
13924
|
];
|
|
12936
13925
|
for (const name2 of names) {
|
|
12937
13926
|
const relative3 = `${prefix2}${entry.name}/${name2}`;
|
|
12938
|
-
const file =
|
|
12939
|
-
if (
|
|
13927
|
+
const file = import_node_path22.default.join(projectRoot, relative3);
|
|
13928
|
+
if (import_node_fs22.default.existsSync(file)) files[relative3] = import_node_fs22.default.readFileSync(file, "utf8");
|
|
12940
13929
|
}
|
|
12941
13930
|
} else if (/AppDelegate\.(?:swift|mm|m)$|\.entitlements$/.test(entry.name)) {
|
|
12942
13931
|
const relative3 = `${prefix2}${entry.name}`;
|
|
12943
|
-
const file =
|
|
12944
|
-
if (
|
|
13932
|
+
const file = import_node_path22.default.join(projectRoot, relative3);
|
|
13933
|
+
if (import_node_fs22.default.existsSync(file)) files[relative3] = import_node_fs22.default.readFileSync(file, "utf8");
|
|
12945
13934
|
}
|
|
12946
13935
|
}
|
|
12947
13936
|
const identity = extractNativeAppIdentityFromFiles(
|
|
@@ -12958,41 +13947,41 @@ function readNativeAppIdentityFromSources(projectRoot, platform, parseInfoPlist,
|
|
|
12958
13947
|
function readAndroidNativeAppIdentity(projectRoot, androidMergedManifest) {
|
|
12959
13948
|
const files = {};
|
|
12960
13949
|
if (androidMergedManifest) {
|
|
12961
|
-
const file =
|
|
12962
|
-
if (!
|
|
12963
|
-
files[androidMergedManifest] =
|
|
13950
|
+
const file = import_node_path22.default.resolve(projectRoot, androidMergedManifest);
|
|
13951
|
+
if (!import_node_fs22.default.existsSync(file)) return null;
|
|
13952
|
+
files[androidMergedManifest] = import_node_fs22.default.readFileSync(file, "utf8");
|
|
12964
13953
|
} else {
|
|
12965
|
-
const androidRoot =
|
|
12966
|
-
if (!
|
|
13954
|
+
const androidRoot = import_node_path22.default.join(projectRoot, "android");
|
|
13955
|
+
if (!import_node_fs22.default.existsSync(androidRoot)) return null;
|
|
12967
13956
|
const collect = (directory) => {
|
|
12968
|
-
for (const entry of
|
|
12969
|
-
const file =
|
|
13957
|
+
for (const entry of import_node_fs22.default.readdirSync(directory, { withFileTypes: true })) {
|
|
13958
|
+
const file = import_node_path22.default.join(directory, entry.name);
|
|
12970
13959
|
if (entry.isDirectory()) collect(file);
|
|
12971
13960
|
else if (entry.isFile() && entry.name === "AndroidManifest.xml")
|
|
12972
|
-
files[
|
|
13961
|
+
files[import_node_path22.default.relative(projectRoot, file).split(import_node_path22.default.sep).join("/")] = import_node_fs22.default.readFileSync(file, "utf8");
|
|
12973
13962
|
}
|
|
12974
13963
|
};
|
|
12975
|
-
for (const module2 of
|
|
13964
|
+
for (const module2 of import_node_fs22.default.readdirSync(androidRoot, { withFileTypes: true })) {
|
|
12976
13965
|
if (!module2.isDirectory()) continue;
|
|
12977
|
-
const outputs =
|
|
13966
|
+
const outputs = import_node_path22.default.join(
|
|
12978
13967
|
androidRoot,
|
|
12979
13968
|
module2.name,
|
|
12980
13969
|
"build/intermediates/merged_manifests"
|
|
12981
13970
|
);
|
|
12982
|
-
if (
|
|
13971
|
+
if (import_node_fs22.default.existsSync(outputs)) collect(outputs);
|
|
12983
13972
|
}
|
|
12984
13973
|
}
|
|
12985
13974
|
for (const manifest of Object.keys(files)) {
|
|
12986
13975
|
const resourceDirectory = androidMergedResourceValuesDirectory(manifest);
|
|
12987
13976
|
if (!resourceDirectory) continue;
|
|
12988
|
-
const absolute =
|
|
12989
|
-
if (!
|
|
12990
|
-
for (const entry of
|
|
13977
|
+
const absolute = import_node_path22.default.resolve(projectRoot, resourceDirectory);
|
|
13978
|
+
if (!import_node_fs22.default.existsSync(absolute)) continue;
|
|
13979
|
+
for (const entry of import_node_fs22.default.readdirSync(absolute, { withFileTypes: true })) {
|
|
12991
13980
|
if (!entry.isDirectory() || !/^values(?:-|$)/.test(entry.name)) continue;
|
|
12992
|
-
for (const resource of
|
|
13981
|
+
for (const resource of import_node_fs22.default.readdirSync(import_node_path22.default.join(absolute, entry.name))) {
|
|
12993
13982
|
if (!resource.endsWith(".xml")) continue;
|
|
12994
13983
|
const file = `${resourceDirectory}/${entry.name}/${resource}`;
|
|
12995
|
-
files[file] =
|
|
13984
|
+
files[file] = import_node_fs22.default.readFileSync(import_node_path22.default.resolve(projectRoot, file), "utf8");
|
|
12996
13985
|
}
|
|
12997
13986
|
}
|
|
12998
13987
|
}
|
|
@@ -13009,7 +13998,7 @@ function readIosNativeAppIdentity(projectRoot, parseInfoPlist, iosTarget, enviro
|
|
|
13009
13998
|
const app = readIosAppTarget(projectRoot, iosTarget, environment);
|
|
13010
13999
|
if (!app) return null;
|
|
13011
14000
|
const identity = readNativeAppIdentityFromXcodeTarget(app, parseInfoPlist);
|
|
13012
|
-
const projectManifestPath =
|
|
14001
|
+
const projectManifestPath = import_node_path22.default.join(projectRoot, "package.json");
|
|
13013
14002
|
const projectRequire = (0, import_node_module3.createRequire)(projectManifestPath);
|
|
13014
14003
|
let reanimatedManifestPath;
|
|
13015
14004
|
try {
|
|
@@ -13023,22 +14012,22 @@ function readIosNativeAppIdentity(projectRoot, parseInfoPlist, iosTarget, enviro
|
|
|
13023
14012
|
throw error;
|
|
13024
14013
|
}
|
|
13025
14014
|
const installedManifest = JSON.parse(
|
|
13026
|
-
|
|
14015
|
+
import_node_fs22.default.readFileSync(reanimatedManifestPath, "utf8")
|
|
13027
14016
|
);
|
|
13028
14017
|
const installedVersion = isRecord(installedManifest) ? nonEmptyString2(installedManifest.version) : void 0;
|
|
13029
14018
|
if (!installedVersion) throw new Error("Reanimated package version is malformed");
|
|
13030
14019
|
if (Number.parseInt(installedVersion, 10) < 4) return identity;
|
|
13031
14020
|
const defaults = JSON.parse(
|
|
13032
|
-
|
|
13033
|
-
|
|
13034
|
-
|
|
14021
|
+
import_node_fs22.default.readFileSync(
|
|
14022
|
+
import_node_path22.default.join(
|
|
14023
|
+
import_node_path22.default.dirname(reanimatedManifestPath),
|
|
13035
14024
|
"src/featureFlags/staticFlags.json"
|
|
13036
14025
|
),
|
|
13037
14026
|
"utf8"
|
|
13038
14027
|
)
|
|
13039
14028
|
);
|
|
13040
14029
|
if (!isRecord(defaults)) throw new Error("Reanimated static flags are malformed");
|
|
13041
|
-
const manifest = JSON.parse(
|
|
14030
|
+
const manifest = JSON.parse(import_node_fs22.default.readFileSync(projectManifestPath, "utf8"));
|
|
13042
14031
|
const reanimated = isRecord(manifest) ? manifest.reanimated : void 0;
|
|
13043
14032
|
const overrides = isRecord(reanimated) ? reanimated.staticFeatureFlags : void 0;
|
|
13044
14033
|
if (overrides !== void 0 && !isRecord(overrides)) {
|
|
@@ -15919,8 +16908,8 @@ var COMPAT_STUBS = {
|
|
|
15919
16908
|
|
|
15920
16909
|
// src/installed-native-build-options.ts
|
|
15921
16910
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
15922
|
-
var
|
|
15923
|
-
var
|
|
16911
|
+
var import_node_fs23 = __toESM(require("node:fs"), 1);
|
|
16912
|
+
var import_node_path23 = __toESM(require("node:path"), 1);
|
|
15924
16913
|
init_version_range();
|
|
15925
16914
|
var RIVE_PACKAGE = "@rive-app/react-native";
|
|
15926
16915
|
var RIVE_05 = [">=0.5.0 <0.6.0"];
|
|
@@ -15929,10 +16918,10 @@ function missing(error) {
|
|
|
15929
16918
|
}
|
|
15930
16919
|
function answerSync(step) {
|
|
15931
16920
|
try {
|
|
15932
|
-
if (step.type === "realpath") return
|
|
15933
|
-
if (step.type === "read") return
|
|
15934
|
-
if (step.type === "isDirectory") return
|
|
15935
|
-
return
|
|
16921
|
+
if (step.type === "realpath") return import_node_fs23.default.realpathSync(step.path);
|
|
16922
|
+
if (step.type === "read") return import_node_fs23.default.readFileSync(step.path, "utf8");
|
|
16923
|
+
if (step.type === "isDirectory") return import_node_fs23.default.statSync(step.path).isDirectory();
|
|
16924
|
+
return import_node_fs23.default.readdirSync(step.path, { withFileTypes: true }).map((entry) => ({
|
|
15936
16925
|
name: entry.name,
|
|
15937
16926
|
directory: entry.isDirectory(),
|
|
15938
16927
|
symbolicLink: entry.isSymbolicLink()
|
|
@@ -15944,11 +16933,11 @@ function answerSync(step) {
|
|
|
15944
16933
|
}
|
|
15945
16934
|
async function answerAsync(step) {
|
|
15946
16935
|
try {
|
|
15947
|
-
if (step.type === "realpath") return await
|
|
15948
|
-
if (step.type === "read") return await
|
|
16936
|
+
if (step.type === "realpath") return await import_node_fs23.default.promises.realpath(step.path);
|
|
16937
|
+
if (step.type === "read") return await import_node_fs23.default.promises.readFile(step.path, "utf8");
|
|
15949
16938
|
if (step.type === "isDirectory")
|
|
15950
|
-
return (await
|
|
15951
|
-
return (await
|
|
16939
|
+
return (await import_node_fs23.default.promises.stat(step.path)).isDirectory();
|
|
16940
|
+
return (await import_node_fs23.default.promises.readdir(step.path, { withFileTypes: true })).map(
|
|
15952
16941
|
(entry) => ({
|
|
15953
16942
|
name: entry.name,
|
|
15954
16943
|
directory: entry.isDirectory(),
|
|
@@ -15981,7 +16970,7 @@ function* rubyFiles(directory, seen, iosRoot = false) {
|
|
|
15981
16970
|
const files = [];
|
|
15982
16971
|
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
15983
16972
|
if (iosRoot && (entry.name === "Pods" || entry.name === "build")) continue;
|
|
15984
|
-
const target =
|
|
16973
|
+
const target = import_node_path23.default.join(directory, entry.name);
|
|
15985
16974
|
let isDirectory2 = entry.directory;
|
|
15986
16975
|
if (entry.symbolicLink)
|
|
15987
16976
|
isDirectory2 = (yield { type: "isDirectory", path: target }) === true;
|
|
@@ -15994,7 +16983,7 @@ function* nativeBuildOptionsWalk(projectRoot, versions, environment) {
|
|
|
15994
16983
|
let sensorOptions = {};
|
|
15995
16984
|
const sensors = versions["expo-sensors"];
|
|
15996
16985
|
if (sensors && resolveCompatVersionRange([">=58.0.4 <59.0.0"], sensors).status === "matched") {
|
|
15997
|
-
const file =
|
|
16986
|
+
const file = import_node_path23.default.join(projectRoot, "ios", "Podfile.properties.json");
|
|
15998
16987
|
const source = yield { type: "read", path: file };
|
|
15999
16988
|
if (source !== null && typeof source !== "string")
|
|
16000
16989
|
throw new Error(`cannot inspect ${file}`);
|
|
@@ -16010,8 +16999,8 @@ function* nativeBuildOptionsWalk(projectRoot, versions, environment) {
|
|
|
16010
16999
|
if (!needsRiveOptions(versions)) return sensorOptions;
|
|
16011
17000
|
if (environment.USE_RIVE_LEGACY === "1" || environment.USE_RIVE_LEGACY === "true")
|
|
16012
17001
|
return { ...sensorOptions, [RIVE_PACKAGE]: { USE_RIVE_LEGACY: true } };
|
|
16013
|
-
const ios =
|
|
16014
|
-
const podfile =
|
|
17002
|
+
const ios = import_node_path23.default.join(projectRoot, "ios");
|
|
17003
|
+
const podfile = import_node_path23.default.join(ios, "Podfile");
|
|
16015
17004
|
const files = [podfile, ...yield* rubyFiles(ios, /* @__PURE__ */ new Set(), true)];
|
|
16016
17005
|
let value = false;
|
|
16017
17006
|
let assigned = false;
|
|
@@ -16276,10 +17265,10 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
16276
17265
|
// scripts/dev-server-scanner.ts
|
|
16277
17266
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
16278
17267
|
var import_child_process = require("child_process");
|
|
16279
|
-
var
|
|
16280
|
-
var
|
|
16281
|
-
var
|
|
16282
|
-
var
|
|
17268
|
+
var import_promises3 = require("fs/promises");
|
|
17269
|
+
var import_node_fs24 = require("node:fs");
|
|
17270
|
+
var import_node_os6 = require("node:os");
|
|
17271
|
+
var import_node_path24 = require("node:path");
|
|
16283
17272
|
init_backend_origin();
|
|
16284
17273
|
init_config();
|
|
16285
17274
|
|
|
@@ -16419,11 +17408,11 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
16419
17408
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
16420
17409
|
|
|
16421
17410
|
// scripts/dev-server-scanner.ts
|
|
16422
|
-
var LISTENER_LOCK_PATH = (0,
|
|
16423
|
-
var LISTENER_RESULT_PATH = (0,
|
|
17411
|
+
var LISTENER_LOCK_PATH = (0, import_node_path24.join)((0, import_node_os6.tmpdir)(), "peach-listener-scan.lock");
|
|
17412
|
+
var LISTENER_RESULT_PATH = (0, import_node_path24.join)((0, import_node_os6.tmpdir)(), "peach-listener-scan.result");
|
|
16424
17413
|
var LISTENER_LOCK_STALE_MS = 25e3;
|
|
16425
17414
|
var LISTENER_LOCK_WAIT_MS = 8e3;
|
|
16426
|
-
function
|
|
17415
|
+
function sleep2(ms) {
|
|
16427
17416
|
return new Promise((resolve4) => setTimeout(resolve4, ms));
|
|
16428
17417
|
}
|
|
16429
17418
|
function pidIsAlive(pid) {
|
|
@@ -16438,8 +17427,8 @@ function pidIsAlive(pid) {
|
|
|
16438
17427
|
}
|
|
16439
17428
|
function readLockOwner() {
|
|
16440
17429
|
try {
|
|
16441
|
-
const raw = (0,
|
|
16442
|
-
const mtimeMs = (0,
|
|
17430
|
+
const raw = (0, import_node_fs24.readFileSync)(LISTENER_LOCK_PATH, "utf8");
|
|
17431
|
+
const mtimeMs = (0, import_node_fs24.statSync)(LISTENER_LOCK_PATH).mtimeMs;
|
|
16443
17432
|
const pid = Number(raw.split("-")[0]);
|
|
16444
17433
|
return { raw, pid: Number.isInteger(pid) ? pid : -1, mtimeMs };
|
|
16445
17434
|
} catch {
|
|
@@ -16452,15 +17441,15 @@ function lockIsAbandoned(owner) {
|
|
|
16452
17441
|
}
|
|
16453
17442
|
function clearLock(raw) {
|
|
16454
17443
|
try {
|
|
16455
|
-
if ((0,
|
|
16456
|
-
(0,
|
|
17444
|
+
if ((0, import_node_fs24.readFileSync)(LISTENER_LOCK_PATH, "utf8") !== raw) return;
|
|
17445
|
+
(0, import_node_fs24.unlinkSync)(LISTENER_LOCK_PATH);
|
|
16457
17446
|
} catch {
|
|
16458
17447
|
}
|
|
16459
17448
|
}
|
|
16460
17449
|
function readResult() {
|
|
16461
17450
|
try {
|
|
16462
17451
|
const parsed = JSON.parse(
|
|
16463
|
-
(0,
|
|
17452
|
+
(0, import_node_fs24.readFileSync)(LISTENER_RESULT_PATH, "utf8")
|
|
16464
17453
|
);
|
|
16465
17454
|
if (!parsed || typeof parsed.token !== "string" || typeof parsed.key !== "string")
|
|
16466
17455
|
return null;
|
|
@@ -16471,8 +17460,8 @@ function readResult() {
|
|
|
16471
17460
|
}
|
|
16472
17461
|
function publishResult(payload) {
|
|
16473
17462
|
const tmp = `${LISTENER_RESULT_PATH}.${process.pid}.tmp`;
|
|
16474
|
-
(0,
|
|
16475
|
-
(0,
|
|
17463
|
+
(0, import_node_fs24.writeFileSync)(tmp, JSON.stringify(payload));
|
|
17464
|
+
(0, import_node_fs24.renameSync)(tmp, LISTENER_RESULT_PATH);
|
|
16476
17465
|
}
|
|
16477
17466
|
function throwPublished(payload) {
|
|
16478
17467
|
throw Object.assign(new Error(payload.message || "listener scan failed"), {
|
|
@@ -16503,7 +17492,7 @@ async function waitForSharedResult(owner, key) {
|
|
|
16503
17492
|
clearLock(latest.raw);
|
|
16504
17493
|
return { kind: "retry" };
|
|
16505
17494
|
}
|
|
16506
|
-
await
|
|
17495
|
+
await sleep2(25);
|
|
16507
17496
|
}
|
|
16508
17497
|
throw Object.assign(new Error("listener scan lock was held past the wait"), {
|
|
16509
17498
|
killed: true
|
|
@@ -16515,7 +17504,7 @@ async function withListenerLock(key, body) {
|
|
|
16515
17504
|
for (; ; ) {
|
|
16516
17505
|
let fd = null;
|
|
16517
17506
|
try {
|
|
16518
|
-
fd = (0,
|
|
17507
|
+
fd = (0, import_node_fs24.openSync)(LISTENER_LOCK_PATH, "wx");
|
|
16519
17508
|
} catch (error) {
|
|
16520
17509
|
const code = error instanceof Error && "code" in error ? error.code : "";
|
|
16521
17510
|
if (code !== "EEXIST") throw error;
|
|
@@ -16524,7 +17513,7 @@ async function withListenerLock(key, body) {
|
|
|
16524
17513
|
if (owner) clearLock(owner.raw);
|
|
16525
17514
|
else {
|
|
16526
17515
|
try {
|
|
16527
|
-
(0,
|
|
17516
|
+
(0, import_node_fs24.unlinkSync)(LISTENER_LOCK_PATH);
|
|
16528
17517
|
} catch {
|
|
16529
17518
|
}
|
|
16530
17519
|
}
|
|
@@ -16535,12 +17524,12 @@ async function withListenerLock(key, body) {
|
|
|
16535
17524
|
if (shared.kind === "value") return shared.value;
|
|
16536
17525
|
continue;
|
|
16537
17526
|
}
|
|
16538
|
-
await
|
|
17527
|
+
await sleep2(25);
|
|
16539
17528
|
continue;
|
|
16540
17529
|
}
|
|
16541
17530
|
if (fd === null) continue;
|
|
16542
17531
|
try {
|
|
16543
|
-
(0,
|
|
17532
|
+
(0, import_node_fs24.writeSync)(fd, token);
|
|
16544
17533
|
try {
|
|
16545
17534
|
const value = await body();
|
|
16546
17535
|
publishResult({ token, key, ok: true, value });
|
|
@@ -16557,7 +17546,7 @@ async function withListenerLock(key, body) {
|
|
|
16557
17546
|
}
|
|
16558
17547
|
} finally {
|
|
16559
17548
|
try {
|
|
16560
|
-
(0,
|
|
17549
|
+
(0, import_node_fs24.closeSync)(fd);
|
|
16561
17550
|
} catch {
|
|
16562
17551
|
}
|
|
16563
17552
|
clearLock(token);
|
|
@@ -16806,7 +17795,7 @@ async function flushCwdQueue() {
|
|
|
16806
17795
|
const needLsof = [];
|
|
16807
17796
|
for (const pid of pending) {
|
|
16808
17797
|
try {
|
|
16809
|
-
const cwd = await (0,
|
|
17798
|
+
const cwd = await (0, import_promises3.readlink)(`/proc/${pid}/cwd`);
|
|
16810
17799
|
if (cwd) {
|
|
16811
17800
|
cwdByPid.set(pid, cwd);
|
|
16812
17801
|
continue;
|
|
@@ -17042,7 +18031,7 @@ function nodeRequestHeaderEntries(headers) {
|
|
|
17042
18031
|
|
|
17043
18032
|
// src/host/hostname-resolver.ts
|
|
17044
18033
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
17045
|
-
var
|
|
18034
|
+
var import_promises4 = require("node:dns/promises");
|
|
17046
18035
|
|
|
17047
18036
|
// src/dns-over-https.ts
|
|
17048
18037
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -17084,7 +18073,7 @@ function parseIpv6(text2) {
|
|
|
17084
18073
|
|
|
17085
18074
|
// src/host/network-policy.ts
|
|
17086
18075
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
17087
|
-
var
|
|
18076
|
+
var import_node_path25 = require("node:path");
|
|
17088
18077
|
var import_node_url = require("node:url");
|
|
17089
18078
|
var NETWORK_POLICY_TIMEOUT_MS = 1e4;
|
|
17090
18079
|
var NetworkPolicyDeniedError = class extends Error {
|
|
@@ -17137,7 +18126,7 @@ function createNetworkAuthorizer(policy) {
|
|
|
17137
18126
|
};
|
|
17138
18127
|
}
|
|
17139
18128
|
async function loadNetworkPolicy(file) {
|
|
17140
|
-
if (!(0,
|
|
18129
|
+
if (!(0, import_node_path25.isAbsolute)(file)) {
|
|
17141
18130
|
throw new Error(`PEACH_NETWORK_POLICY must be an absolute path: ${file}`);
|
|
17142
18131
|
}
|
|
17143
18132
|
const loaded3 = await import(
|
|
@@ -17173,7 +18162,7 @@ async function handleHostnameResolutionRequest(req, res) {
|
|
|
17173
18162
|
}
|
|
17174
18163
|
let addresses;
|
|
17175
18164
|
try {
|
|
17176
|
-
addresses = (await (0,
|
|
18165
|
+
addresses = (await (0, import_promises4.lookup)(host2, { all: true })).map(({ address }) => {
|
|
17177
18166
|
const bytes = parseIpLiteral(address);
|
|
17178
18167
|
if (!bytes) throw new Error("system resolver returned an invalid address");
|
|
17179
18168
|
return bytes;
|
|
@@ -17226,17 +18215,17 @@ function projectLoopbackUrl(value) {
|
|
|
17226
18215
|
// src/host/rolldown-bundle-forward.ts
|
|
17227
18216
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
17228
18217
|
var import_stream = require("stream");
|
|
17229
|
-
var
|
|
18218
|
+
var import_promises5 = require("stream/promises");
|
|
17230
18219
|
|
|
17231
18220
|
// src/cli-runtime.ts
|
|
17232
18221
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
17233
|
-
var
|
|
17234
|
-
var
|
|
18222
|
+
var import_node_crypto7 = require("node:crypto");
|
|
18223
|
+
var import_node_fs25 = require("node:fs");
|
|
17235
18224
|
var import_node_module4 = require("node:module");
|
|
17236
|
-
var
|
|
18225
|
+
var import_node_path26 = require("node:path");
|
|
17237
18226
|
|
|
17238
18227
|
// runtime-companion.json
|
|
17239
|
-
var runtime_companion_default = { abi: 1, sha256: "
|
|
18228
|
+
var runtime_companion_default = { abi: 1, sha256: "2e4d78c7cfb64a492abbe3734e69a59408c00041b36d1a05a2d7fdfcbf6adb7b", file: "node/cli-2e4d78c7cfb64a492abbe3734e69a59408c00041b36d1a05a2d7fdfcbf6adb7b.cjs" };
|
|
17240
18229
|
|
|
17241
18230
|
// src/cli-runtime.ts
|
|
17242
18231
|
var CLI_COMPANION_ABI = 1;
|
|
@@ -17244,12 +18233,12 @@ function cliCompanionPath() {
|
|
|
17244
18233
|
return `node/cli-${runtime_companion_default.sha256}.cjs`;
|
|
17245
18234
|
}
|
|
17246
18235
|
function verifyCliCompanion(root) {
|
|
17247
|
-
verifyCompanionFile((0,
|
|
18236
|
+
verifyCompanionFile((0, import_node_path26.join)(root, cliCompanionPath()));
|
|
17248
18237
|
}
|
|
17249
18238
|
function verifyCompanionFile(file) {
|
|
17250
18239
|
let bytes;
|
|
17251
18240
|
try {
|
|
17252
|
-
bytes = (0,
|
|
18241
|
+
bytes = (0, import_node_fs25.readFileSync)(file);
|
|
17253
18242
|
} catch (error) {
|
|
17254
18243
|
if (error instanceof Error) {
|
|
17255
18244
|
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" : ""}` : "";
|
|
@@ -17257,20 +18246,41 @@ function verifyCompanionFile(file) {
|
|
|
17257
18246
|
}
|
|
17258
18247
|
throw error;
|
|
17259
18248
|
}
|
|
17260
|
-
const hash = (0,
|
|
18249
|
+
const hash = (0, import_node_crypto7.createHash)("sha256").update(bytes).digest("hex");
|
|
17261
18250
|
if (hash !== runtime_companion_default.sha256) {
|
|
17262
18251
|
throw new Error(
|
|
17263
18252
|
"Peach runtime companion does not match this CLI; run `peach runtime install`"
|
|
17264
18253
|
);
|
|
17265
18254
|
}
|
|
17266
18255
|
}
|
|
18256
|
+
async function ensureCliCompanion(root) {
|
|
18257
|
+
const file = (0, import_node_path26.join)(root, cliCompanionPath());
|
|
18258
|
+
try {
|
|
18259
|
+
verifyCompanionFile(file);
|
|
18260
|
+
return;
|
|
18261
|
+
} catch (error) {
|
|
18262
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT"))
|
|
18263
|
+
throw error;
|
|
18264
|
+
}
|
|
18265
|
+
const staged = `${file}.${process.pid}`;
|
|
18266
|
+
try {
|
|
18267
|
+
await downloadToFile(
|
|
18268
|
+
`https://r2.rnxsim.com/rnx-cli/companions/cli-${runtime_companion_default.sha256}.cjs`,
|
|
18269
|
+
staged
|
|
18270
|
+
);
|
|
18271
|
+
verifyCompanionFile(staged);
|
|
18272
|
+
(0, import_node_fs25.renameSync)(staged, file);
|
|
18273
|
+
} finally {
|
|
18274
|
+
(0, import_node_fs25.rmSync)(staged, { force: true });
|
|
18275
|
+
}
|
|
18276
|
+
}
|
|
17267
18277
|
var loaded2;
|
|
17268
18278
|
function getCliRuntime() {
|
|
17269
18279
|
if (loaded2) return loaded2.runtime;
|
|
17270
18280
|
const root = peachRuntimeRoot();
|
|
17271
18281
|
verifyCliCompanion(root);
|
|
17272
18282
|
const require2 = (0, import_node_module4.createRequire)(__sootsim_import_meta_url);
|
|
17273
|
-
const runtime = require2((0,
|
|
18283
|
+
const runtime = require2((0, import_node_path26.join)(root, cliCompanionPath()));
|
|
17274
18284
|
if (runtime.cliCompanionAbi !== CLI_COMPANION_ABI) {
|
|
17275
18285
|
throw new Error(
|
|
17276
18286
|
"Incompatible Peach runtime companion ABI; run `peach runtime install`"
|
|
@@ -17285,7 +18295,7 @@ var ROLLDOWN_INVENTORY_HEADER = "x-peach-rolldown-inventory";
|
|
|
17285
18295
|
async function forwardRolldownBundleResponse(upstream, res) {
|
|
17286
18296
|
res.setHeader(ROLLDOWN_INVENTORY_HEADER, "1");
|
|
17287
18297
|
if (upstream.headers[ROLLDOWN_INVENTORY_HEADER] === "1") {
|
|
17288
|
-
await (0,
|
|
18298
|
+
await (0, import_promises5.pipeline)(upstream, res);
|
|
17289
18299
|
return;
|
|
17290
18300
|
}
|
|
17291
18301
|
const contentType = typeof upstream.headers["content-type"] === "string" ? upstream.headers["content-type"] : "";
|
|
@@ -17327,7 +18337,7 @@ async function forwardRolldownBundleResponse(upstream, res) {
|
|
|
17327
18337
|
}
|
|
17328
18338
|
yield Buffer.from(annotated.slice(sent), "utf8");
|
|
17329
18339
|
};
|
|
17330
|
-
await (0,
|
|
18340
|
+
await (0, import_promises5.pipeline)(import_stream.Readable.from(annotate(), { objectMode: false }), res);
|
|
17331
18341
|
}
|
|
17332
18342
|
|
|
17333
18343
|
// src/host/fetch-proxy-handler.ts
|
|
@@ -17658,7 +18668,7 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
17658
18668
|
await route.respond(proxyRes, hopCookies);
|
|
17659
18669
|
if (isNativeCookieRedirect(hop)) res.removeHeader("location");
|
|
17660
18670
|
res.statusCode = isNativeCookieRedirect(hop) ? 200 : status;
|
|
17661
|
-
await (0,
|
|
18671
|
+
await (0, import_promises6.pipeline)(proxyRes, res);
|
|
17662
18672
|
return;
|
|
17663
18673
|
}
|
|
17664
18674
|
if (location && (status === 301 || status === 302 || status === 303 || status === 307 || status === 308)) {
|
|
@@ -17669,7 +18679,7 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
17669
18679
|
const switchToGet = (status === 301 || status === 302) && method === "POST" || status === 303 && method !== "GET" && method !== "HEAD";
|
|
17670
18680
|
const redirectUrl = resolveRedirectUrl(location, targetUrl);
|
|
17671
18681
|
proxyRes.resume();
|
|
17672
|
-
await (0,
|
|
18682
|
+
await (0, import_promises6.finished)(proxyRes);
|
|
17673
18683
|
await proxy(
|
|
17674
18684
|
redirectUrl,
|
|
17675
18685
|
switchToGet ? "GET" : method,
|
|
@@ -17686,7 +18696,7 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
17686
18696
|
await forwardRolldownBundleResponse(proxyRes, res);
|
|
17687
18697
|
return;
|
|
17688
18698
|
}
|
|
17689
|
-
await (0,
|
|
18699
|
+
await (0, import_promises6.pipeline)(proxyRes, res);
|
|
17690
18700
|
};
|
|
17691
18701
|
let upstreamAnswered = false;
|
|
17692
18702
|
let body;
|
|
@@ -17865,6 +18875,198 @@ function insertNativeFirebaseFooter(source, config) {
|
|
|
17865
18875
|
return start < 0 ? detached + footer : detached.slice(0, start) + footer + detached.slice(start);
|
|
17866
18876
|
}
|
|
17867
18877
|
|
|
18878
|
+
// src/runtime-packs.ts
|
|
18879
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
18880
|
+
var import_node_fs27 = __toESM(require("node:fs"), 1);
|
|
18881
|
+
var import_node_path28 = __toESM(require("node:path"), 1);
|
|
18882
|
+
var import_node_timers = require("node:timers");
|
|
18883
|
+
|
|
18884
|
+
// src/runtime-delivery.ts
|
|
18885
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
18886
|
+
init_home_paths();
|
|
18887
|
+
init_public_brand();
|
|
18888
|
+
var DEFAULT_RUNTIME_CDN_ORIGIN = peachPublicBrand.origin;
|
|
18889
|
+
var RNX_CHANGELOG_URL = `${peachPublicBrand.origin}/changelog`;
|
|
18890
|
+
var RNX_CHANGELOG_API_URL = `${peachPublicBrand.origin}/api/changelog/sootsim`;
|
|
18891
|
+
var RNX_RUNTIME_PRODUCT = {
|
|
18892
|
+
id: "peach",
|
|
18893
|
+
defaultCdnOrigin: DEFAULT_RUNTIME_CDN_ORIGIN,
|
|
18894
|
+
manifestPath: "/runtimes/manifest.json",
|
|
18895
|
+
tarballPath: (version) => `/runtimes/sootsim-runtime-${version}.tar.zst`,
|
|
18896
|
+
// the engine runtime is a static SPA: shell at the root, engine/ and
|
|
18897
|
+
// engine-tenant/ beneath it. index.html is what the daemon and the
|
|
18898
|
+
// vite/metro plugins serve, so its absence means the tarball is not one.
|
|
18899
|
+
installedMarker: "index.html",
|
|
18900
|
+
verifyInstall: ensureCliCompanion,
|
|
18901
|
+
env: {
|
|
18902
|
+
cdnOrigin: "PEACH_CDN_ORIGIN",
|
|
18903
|
+
channel: "PEACH_RUNTIME_CHANNEL"
|
|
18904
|
+
},
|
|
18905
|
+
ensureHome: ensureRnxHome,
|
|
18906
|
+
configFile: configFilePath,
|
|
18907
|
+
runtimesDir,
|
|
18908
|
+
runtimeDir,
|
|
18909
|
+
cacheDir,
|
|
18910
|
+
readActiveRuntime,
|
|
18911
|
+
writeActiveRuntime
|
|
18912
|
+
};
|
|
18913
|
+
var rnxRuntime = createRuntimeDelivery(RNX_RUNTIME_PRODUCT);
|
|
18914
|
+
|
|
18915
|
+
// src/runtime-packs.ts
|
|
18916
|
+
var inflight = /* @__PURE__ */ new Map();
|
|
18917
|
+
var packsByRoot = /* @__PURE__ */ new Map();
|
|
18918
|
+
var listedByRoot = /* @__PURE__ */ new Map();
|
|
18919
|
+
function listedFiles(runtimeRoot) {
|
|
18920
|
+
let listed = listedByRoot.get(runtimeRoot);
|
|
18921
|
+
if (listed) return listed;
|
|
18922
|
+
listed = /* @__PURE__ */ new Map();
|
|
18923
|
+
for (const [pack, entry] of Object.entries(readPacks(runtimeRoot) ?? {}))
|
|
18924
|
+
for (const file of entry.files ?? []) {
|
|
18925
|
+
const name2 = import_node_path28.default.posix.basename(file);
|
|
18926
|
+
listed.set(name2, [...listed.get(name2) ?? [], { file, pack }]);
|
|
18927
|
+
}
|
|
18928
|
+
listedByRoot.set(runtimeRoot, listed);
|
|
18929
|
+
return listed;
|
|
18930
|
+
}
|
|
18931
|
+
function readPacks(runtimeRoot) {
|
|
18932
|
+
const cached = packsByRoot.get(runtimeRoot);
|
|
18933
|
+
if (cached !== void 0) return cached;
|
|
18934
|
+
const file = import_node_path28.default.join(runtimeRoot, RUNTIME_PACKS_FILE);
|
|
18935
|
+
if (!import_node_fs27.default.existsSync(file)) {
|
|
18936
|
+
packsByRoot.set(runtimeRoot, null);
|
|
18937
|
+
return null;
|
|
18938
|
+
}
|
|
18939
|
+
const parsed = JSON.parse(import_node_fs27.default.readFileSync(file, "utf8"));
|
|
18940
|
+
const packs = {};
|
|
18941
|
+
if (typeof parsed !== "object" || parsed === null)
|
|
18942
|
+
throw new Error(`${file} is not an object`);
|
|
18943
|
+
for (const [prefix2, entry] of Object.entries(parsed)) {
|
|
18944
|
+
if (typeof entry?.file !== "string" || typeof entry?.sha256 !== "string")
|
|
18945
|
+
throw new Error(`${file} entry ${prefix2} lacks file and sha256`);
|
|
18946
|
+
const files = entry.files;
|
|
18947
|
+
if (files !== void 0 && !(Array.isArray(files) && files.every((f) => typeof f === "string")))
|
|
18948
|
+
throw new Error(`${file} entry ${prefix2} has files that are not paths`);
|
|
18949
|
+
packs[prefix2] = {
|
|
18950
|
+
file: entry.file,
|
|
18951
|
+
sha256: entry.sha256,
|
|
18952
|
+
...files ? { files } : {}
|
|
18953
|
+
};
|
|
18954
|
+
}
|
|
18955
|
+
packsByRoot.set(runtimeRoot, packs);
|
|
18956
|
+
return packs;
|
|
18957
|
+
}
|
|
18958
|
+
async function ensureRuntimePackFor(runtimeRoot, pathname) {
|
|
18959
|
+
warmRuntimePacks(runtimeRoot);
|
|
18960
|
+
const prefix2 = RUNTIME_PACK_PREFIXES.find(
|
|
18961
|
+
(candidate) => pathname.includes(`/${candidate}`)
|
|
18962
|
+
);
|
|
18963
|
+
if (prefix2) {
|
|
18964
|
+
await installNamedPack(runtimeRoot, prefix2);
|
|
18965
|
+
return;
|
|
18966
|
+
}
|
|
18967
|
+
const listed = listedFiles(runtimeRoot).get(import_node_path28.default.posix.basename(pathname))?.find(({ file }) => pathname.endsWith(`/${file}`));
|
|
18968
|
+
if (listed) {
|
|
18969
|
+
if (!import_node_fs27.default.existsSync(import_node_path28.default.join(runtimeRoot, listed.file)))
|
|
18970
|
+
await installNamedPack(runtimeRoot, listed.pack);
|
|
18971
|
+
return;
|
|
18972
|
+
}
|
|
18973
|
+
const at = pathname.indexOf(`/${RUNTIME_MERGE_PACK_DIR}`);
|
|
18974
|
+
if (at === -1) return;
|
|
18975
|
+
const tenantDir = import_node_path28.default.join(runtimeRoot, RUNTIME_MERGE_PACK_DIR);
|
|
18976
|
+
const rel = pathname.slice(at + RUNTIME_MERGE_PACK_DIR.length + 1);
|
|
18977
|
+
if (!/\.m?js$/.test(rel) || import_node_fs27.default.existsSync(import_node_path28.default.join(tenantDir, rel))) return;
|
|
18978
|
+
await installNamedPack(runtimeRoot, RUNTIME_MERGE_PACK_DIR);
|
|
18979
|
+
}
|
|
18980
|
+
function installNamedPack(runtimeRoot, name2) {
|
|
18981
|
+
if (name2 === RUNTIME_MERGE_PACK_DIR) {
|
|
18982
|
+
const tenantDir = import_node_path28.default.join(runtimeRoot, RUNTIME_MERGE_PACK_DIR);
|
|
18983
|
+
return mergePack(
|
|
18984
|
+
runtimeRoot,
|
|
18985
|
+
name2,
|
|
18986
|
+
import_node_path28.default.join(tenantDir, RUNTIME_MERGE_PACK_INSTALL),
|
|
18987
|
+
tenantDir
|
|
18988
|
+
);
|
|
18989
|
+
}
|
|
18990
|
+
if (readPacks(runtimeRoot)?.[name2]?.files)
|
|
18991
|
+
return mergePack(
|
|
18992
|
+
runtimeRoot,
|
|
18993
|
+
name2,
|
|
18994
|
+
import_node_path28.default.join(runtimeRoot, `.pack-${name2}`),
|
|
18995
|
+
runtimeRoot
|
|
18996
|
+
);
|
|
18997
|
+
return installPack(runtimeRoot, name2, import_node_path28.default.join(runtimeRoot, name2.slice(0, -1)));
|
|
18998
|
+
}
|
|
18999
|
+
var WARM_DELAY_MS = 3e4;
|
|
19000
|
+
var warming = /* @__PURE__ */ new Set();
|
|
19001
|
+
function warmRuntimePacks(runtimeRoot) {
|
|
19002
|
+
if (warming.has(runtimeRoot)) return;
|
|
19003
|
+
warming.add(runtimeRoot);
|
|
19004
|
+
const warm = async () => {
|
|
19005
|
+
for (const name2 of Object.keys(readPacks(runtimeRoot) ?? {}))
|
|
19006
|
+
if (!await installNamedPack(runtimeRoot, name2)) return;
|
|
19007
|
+
};
|
|
19008
|
+
const schedule = import_node_timers.setTimeout;
|
|
19009
|
+
schedule(() => void warm(), WARM_DELAY_MS).unref();
|
|
19010
|
+
}
|
|
19011
|
+
async function mergePack(runtimeRoot, name2, installDir, targetDir) {
|
|
19012
|
+
if (import_node_fs27.default.existsSync(import_node_path28.default.join(installDir, RUNTIME_MERGE_PACK_MERGED))) return true;
|
|
19013
|
+
if (!await installPack(runtimeRoot, name2, installDir)) return false;
|
|
19014
|
+
const link = (sub) => {
|
|
19015
|
+
for (const entry of import_node_fs27.default.readdirSync(import_node_path28.default.join(installDir, sub), {
|
|
19016
|
+
withFileTypes: true
|
|
19017
|
+
})) {
|
|
19018
|
+
const child = import_node_path28.default.join(sub, entry.name);
|
|
19019
|
+
if (entry.isDirectory()) {
|
|
19020
|
+
import_node_fs27.default.mkdirSync(import_node_path28.default.join(targetDir, child), { recursive: true });
|
|
19021
|
+
link(child);
|
|
19022
|
+
} else if (entry.name !== RUNTIME_PACK_MARKER) {
|
|
19023
|
+
try {
|
|
19024
|
+
import_node_fs27.default.linkSync(import_node_path28.default.join(installDir, child), import_node_path28.default.join(targetDir, child));
|
|
19025
|
+
} catch (error) {
|
|
19026
|
+
if (!(error instanceof Error && "code" in error && error.code === "EEXIST"))
|
|
19027
|
+
throw error;
|
|
19028
|
+
}
|
|
19029
|
+
}
|
|
19030
|
+
}
|
|
19031
|
+
};
|
|
19032
|
+
try {
|
|
19033
|
+
link("");
|
|
19034
|
+
import_node_fs27.default.writeFileSync(import_node_path28.default.join(installDir, RUNTIME_MERGE_PACK_MERGED), "");
|
|
19035
|
+
return true;
|
|
19036
|
+
} catch (error) {
|
|
19037
|
+
console.error(
|
|
19038
|
+
`[peach] ${name2} pack merge failed: ${error instanceof Error ? error.message : String(error)}`
|
|
19039
|
+
);
|
|
19040
|
+
return false;
|
|
19041
|
+
}
|
|
19042
|
+
}
|
|
19043
|
+
async function installPack(runtimeRoot, prefix2, destDir) {
|
|
19044
|
+
const marker = import_node_path28.default.join(destDir, RUNTIME_PACK_MARKER);
|
|
19045
|
+
if (import_node_fs27.default.existsSync(marker)) return true;
|
|
19046
|
+
const pack = readPacks(runtimeRoot)?.[prefix2];
|
|
19047
|
+
if (!pack) return true;
|
|
19048
|
+
let install = inflight.get(destDir);
|
|
19049
|
+
if (!install) {
|
|
19050
|
+
const version = import_node_path28.default.basename(runtimeRoot);
|
|
19051
|
+
const url = new URL(pack.file, rnxRuntime.tarballUrl(version));
|
|
19052
|
+
url.searchParams.set("sha256", pack.sha256);
|
|
19053
|
+
install = installVerifiedTarball({
|
|
19054
|
+
url: url.toString(),
|
|
19055
|
+
digest: { algorithm: "sha256", encoding: "hex", value: pack.sha256 },
|
|
19056
|
+
destDir,
|
|
19057
|
+
installedMarker: RUNTIME_PACK_MARKER,
|
|
19058
|
+
label: `peach runtime ${version} pack ${prefix2}`
|
|
19059
|
+
}).catch((error) => {
|
|
19060
|
+
console.error(
|
|
19061
|
+
`[peach] ${prefix2} pack download failed: ${error instanceof Error ? error.message : String(error)}`
|
|
19062
|
+
);
|
|
19063
|
+
}).finally(() => inflight.delete(destDir));
|
|
19064
|
+
inflight.set(destDir, install);
|
|
19065
|
+
}
|
|
19066
|
+
await install;
|
|
19067
|
+
return import_node_fs27.default.existsSync(marker);
|
|
19068
|
+
}
|
|
19069
|
+
|
|
17868
19070
|
// src/runtimePlatformContract.ts
|
|
17869
19071
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
17870
19072
|
var IOS_ADAPTER = Object.freeze({
|
|
@@ -18000,7 +19202,7 @@ function withPeach(config, options = {}) {
|
|
|
18000
19202
|
const configuredBundleUrl = "/index.bundle?platform=ios&dev=true&hot=true&minify=false";
|
|
18001
19203
|
const cfgServer = config.server;
|
|
18002
19204
|
const port = resolveMetroPort(cfgServer);
|
|
18003
|
-
const metroServerId = (0,
|
|
19205
|
+
const metroServerId = (0, import_node_crypto8.randomUUID)();
|
|
18004
19206
|
const bundleUrl = tagRnxBundleForPlugin(
|
|
18005
19207
|
configuredBundleUrl,
|
|
18006
19208
|
`http://localhost:${port}`,
|
|
@@ -18131,7 +19333,7 @@ function withPeach(config, options = {}) {
|
|
|
18131
19333
|
return middleware;
|
|
18132
19334
|
}
|
|
18133
19335
|
const server = connect();
|
|
18134
|
-
server.use((req, res, next) => {
|
|
19336
|
+
server.use(async (req, res, next) => {
|
|
18135
19337
|
if (isReplacementModuleRequestUrl(req.url)) {
|
|
18136
19338
|
void handleReplacementModuleRequest(req, res, {
|
|
18137
19339
|
servedRoots: [cfgProjectRoot, ...cfgWatchFolders],
|
|
@@ -18175,6 +19377,7 @@ function withPeach(config, options = {}) {
|
|
|
18175
19377
|
next();
|
|
18176
19378
|
return;
|
|
18177
19379
|
}
|
|
19380
|
+
await ensureRuntimePackFor(runtimeRoot, pathname);
|
|
18178
19381
|
if (isRootRuntimeAssetPath(pathname)) {
|
|
18179
19382
|
const fullPath = resolveRuntimeFilePath(runtimeRoot, pathname);
|
|
18180
19383
|
if (fullPath) {
|