peachsim 0.1.2210 → 0.1.2213
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/command-registry.ts +1 -0
- package/cli/commands/inspect/settling.ts +1 -1
- package/cli/commands/map.ts +576 -0
- package/cli/commands/runtime.ts +1 -1
- package/cli/main.ts +6 -0
- package/cli/outbound-endpoints.ts +11 -0
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +16 -7
- 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 +14 -5
- 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 +999 -811
- 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 +1953 -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 +1793 -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 +1535 -1289
- 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 +7 -4
- package/dist-lib/vite.cjs +1517 -303
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +1 -0
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/CoreData.apinotes +35 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/CoreData.h +8 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSAttributeDescription.h +30 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSEntityDescription.h +14 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSExpressionDescription.h +10 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSFetchIndexDescription.h +13 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSFetchIndexElementDescription.h +18 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObject.h +11 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObjectContext.h +19 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObjectID.h +2 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObjectModel.h +3 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSMergePolicy.h +17 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSPersistentStore.h +8 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSPersistentStoreCoordinator.h +6 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSPropertyDescription.h +13 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSRelationshipDescription.h +21 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIImage.h +1 -10
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UINibLoading.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKitTypes.framework/Headers/UIKitTypes.h +11 -0
- package/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-shipped-binaries.ts +1 -1
- package/src/swift-standin-config.ts +4 -2
- package/src/vite-plugin-one.ts +4 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2213 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -39,7 +39,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
39
39
|
var define_SWIFT_COVERAGE_SOURCE_DIGESTS_default;
|
|
40
40
|
var init_define_SWIFT_COVERAGE_SOURCE_DIGESTS = __esm({
|
|
41
41
|
"<define:__SWIFT_COVERAGE_SOURCE_DIGESTS__>"() {
|
|
42
|
-
define_SWIFT_COVERAGE_SOURCE_DIGESTS_default = { "swift-coverage/indexdump.ts": "0d82d8eeb96bf377f409ea7e33274c341a710c0e071f6b6e17571a23d8d92412", "swift-coverage/indexing.ts": "633ccf19eec1f382a8847d0ee1dca42a2792a3c60aafd43622ed5152b09b8272", "swift-coverage/types.ts": "bd8fae54ea6c53e110cd8a5d7b57c1d532dd0166e09fdaea63c4f270c3780dd1", "swift-coverage/source.ts": "c151758a9f67631bc61473c375df0dc017da6902a34533b2cf4fc4fd7d19b6ee", "swift-coverage/package.ts": "1f0068be7461fa7c5a7a891faf318f305cbed2e94c19667ba76627f7e5be260b", "swift-coverage/xcode.ts": "65a500b806ce1c3a496de27f2e0ad77287c0f6795c618342c08af647f92af1fa", "swift-coverage/xcode-assets.ts": "99e03b74c961d2449afd58c2cbc415ba91d1d469a4f89e461c137fd6c305b27c", "swift-coverage/xcode-asset-symbols.ts": "1b2a67733bc9d139b351466270205452a6172140bc25080d72619e2952c44671", "swift-coverage/xcode-bridging.ts": "33184be8c5daf6646aa5a1276a4e15531f1be27b7c26f56550e0fbb1fc678a11", "swift-coverage/xcode-packages.ts": "8e6020d17d24474150a5a50d042aca6261819ef75c79680a287a66f395909915", "swift-coverage/xcode-strings.ts": "f2dd4c7cd8ef77035184b0132909c2fa09fd20ed06b7757c2f1f960bfdde031c", "swift-coverage/reader.ts": "da559b67ecd1161dea70c980b5f98f2c55af3550f0714479100fa5e9e813625c", "swift-coverage/provenance.ts": "eb3b41ae8b58b48f6758f084800f188dfb1edb227e483abdd6b80cde66e849b9", "swift-package-manifest.ts": "4b7d4a715cdaf57468ead23f2ff9dce76d02c6a888d73d144d4baa2ae571ba3c", "swift-package.ts": "338cfef9a34a930206ac2e1a8a90b85c8d61f776d9a41e6445dc18e0c5385cdb", "swift-source-file.ts": "93fd659ed63a27b67f54a7c229a7ceb636dc9c59e68414920ba36cff1eda1f94", "swift-toolchain.ts": "25505683ca29a0b380413bf2a5026d4967eacf886e35bc11ece6e15317e5bb02", "home-paths.ts": "
|
|
42
|
+
define_SWIFT_COVERAGE_SOURCE_DIGESTS_default = { "swift-coverage/indexdump.ts": "0d82d8eeb96bf377f409ea7e33274c341a710c0e071f6b6e17571a23d8d92412", "swift-coverage/indexing.ts": "633ccf19eec1f382a8847d0ee1dca42a2792a3c60aafd43622ed5152b09b8272", "swift-coverage/types.ts": "bd8fae54ea6c53e110cd8a5d7b57c1d532dd0166e09fdaea63c4f270c3780dd1", "swift-coverage/source.ts": "c151758a9f67631bc61473c375df0dc017da6902a34533b2cf4fc4fd7d19b6ee", "swift-coverage/package.ts": "1f0068be7461fa7c5a7a891faf318f305cbed2e94c19667ba76627f7e5be260b", "swift-coverage/xcode.ts": "65a500b806ce1c3a496de27f2e0ad77287c0f6795c618342c08af647f92af1fa", "swift-coverage/xcode-assets.ts": "99e03b74c961d2449afd58c2cbc415ba91d1d469a4f89e461c137fd6c305b27c", "swift-coverage/xcode-asset-symbols.ts": "1b2a67733bc9d139b351466270205452a6172140bc25080d72619e2952c44671", "swift-coverage/xcode-bridging.ts": "33184be8c5daf6646aa5a1276a4e15531f1be27b7c26f56550e0fbb1fc678a11", "swift-coverage/xcode-packages.ts": "8e6020d17d24474150a5a50d042aca6261819ef75c79680a287a66f395909915", "swift-coverage/xcode-strings.ts": "f2dd4c7cd8ef77035184b0132909c2fa09fd20ed06b7757c2f1f960bfdde031c", "swift-coverage/reader.ts": "da559b67ecd1161dea70c980b5f98f2c55af3550f0714479100fa5e9e813625c", "swift-coverage/provenance.ts": "eb3b41ae8b58b48f6758f084800f188dfb1edb227e483abdd6b80cde66e849b9", "swift-package-manifest.ts": "4b7d4a715cdaf57468ead23f2ff9dce76d02c6a888d73d144d4baa2ae571ba3c", "swift-package.ts": "338cfef9a34a930206ac2e1a8a90b85c8d61f776d9a41e6445dc18e0c5385cdb", "swift-source-file.ts": "93fd659ed63a27b67f54a7c229a7ceb636dc9c59e68414920ba36cff1eda1f94", "swift-toolchain.ts": "25505683ca29a0b380413bf2a5026d4967eacf886e35bc11ece6e15317e5bb02", "home-paths.ts": "d1606390f0e8e50f0ff72544eadb3d49dfabf08e004c1218f2998c36fb8995dd", "xcode-header-search.ts": "f8c3d557b4eca5ddad32907545353eb7ad53b2ebd0969d9ed8f7275e109a13b1", "xcode-project.ts": "86f79e98323ec065e0e5195324c75ca608f490efbd95dcc25c53d5aa0b9aecc9", "xcode-target-members.ts": "ad7589132bffab265e8a10b64e24484fe88b4a2b1cc0ee19a97f151a002eca77", "xcode-json-project.ts": "41990ebbe4b488eef34e74c4608b4b48e5a5b299ba98ca7fbcfdfa0e77be63b6", "openstep-plist.ts": "74e6ce1dac80c9c318e0e9f5e3e8cd19a898a8820c36fc160609695bcb59dcd3" };
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
|
|
@@ -903,6 +903,31 @@ var init_product = __esm({
|
|
|
903
903
|
}
|
|
904
904
|
});
|
|
905
905
|
|
|
906
|
+
// ../contrast-runtime-delivery/src/packs.ts
|
|
907
|
+
var RUNTIME_PACKS_FILE, RUNTIME_PACK_MARKER, RUNTIME_PACK_PREFIXES, RUNTIME_MERGE_PACK_DIR, RUNTIME_MERGE_PACK_INSTALL, RUNTIME_MERGE_PACK_MERGED;
|
|
908
|
+
var init_packs = __esm({
|
|
909
|
+
"../contrast-runtime-delivery/src/packs.ts"() {
|
|
910
|
+
"use strict";
|
|
911
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
912
|
+
RUNTIME_PACKS_FILE = "packs.json";
|
|
913
|
+
RUNTIME_PACK_MARKER = ".pack";
|
|
914
|
+
RUNTIME_PACK_PREFIXES = [
|
|
915
|
+
"engine/fonts/emoji/",
|
|
916
|
+
"engine/fonts/lang/",
|
|
917
|
+
"engine/fonts/named/",
|
|
918
|
+
"engine/fonts/vector-icons/",
|
|
919
|
+
"engine/fonts/webview/",
|
|
920
|
+
"engine/kotlin/",
|
|
921
|
+
"engine/material-symbols/",
|
|
922
|
+
"engine/pdfjs/",
|
|
923
|
+
"three-mode/"
|
|
924
|
+
];
|
|
925
|
+
RUNTIME_MERGE_PACK_DIR = "engine-tenant/";
|
|
926
|
+
RUNTIME_MERGE_PACK_INSTALL = ".pack-prod";
|
|
927
|
+
RUNTIME_MERGE_PACK_MERGED = ".merged";
|
|
928
|
+
}
|
|
929
|
+
});
|
|
930
|
+
|
|
906
931
|
// ../contrast-runtime-delivery/src/index.ts
|
|
907
932
|
function createRuntimeDelivery(product) {
|
|
908
933
|
function readConfig() {
|
|
@@ -1418,6 +1443,7 @@ var init_src = __esm({
|
|
|
1418
1443
|
import_node_zlib = __toESM(require("node:zlib"), 1);
|
|
1419
1444
|
init_process_group();
|
|
1420
1445
|
init_product();
|
|
1446
|
+
init_packs();
|
|
1421
1447
|
init_product();
|
|
1422
1448
|
DEFAULT_LOCAL_RUNTIME_RETENTION_COUNT = 2;
|
|
1423
1449
|
}
|
|
@@ -4642,17 +4668,17 @@ function visit(node, visitor) {
|
|
|
4642
4668
|
} else
|
|
4643
4669
|
visit_(null, node, visitor_, Object.freeze([]));
|
|
4644
4670
|
}
|
|
4645
|
-
function visit_(key2, node, visitor,
|
|
4646
|
-
const ctrl = callVisitor(key2, node, visitor,
|
|
4671
|
+
function visit_(key2, node, visitor, path112) {
|
|
4672
|
+
const ctrl = callVisitor(key2, node, visitor, path112);
|
|
4647
4673
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
4648
|
-
replaceNode(key2,
|
|
4649
|
-
return visit_(key2, ctrl, visitor,
|
|
4674
|
+
replaceNode(key2, path112, ctrl);
|
|
4675
|
+
return visit_(key2, ctrl, visitor, path112);
|
|
4650
4676
|
}
|
|
4651
4677
|
if (typeof ctrl !== "symbol") {
|
|
4652
4678
|
if (isCollection(node)) {
|
|
4653
|
-
|
|
4679
|
+
path112 = Object.freeze(path112.concat(node));
|
|
4654
4680
|
for (let i = 0; i < node.items.length; ++i) {
|
|
4655
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
4681
|
+
const ci = visit_(i, node.items[i], visitor, path112);
|
|
4656
4682
|
if (typeof ci === "number")
|
|
4657
4683
|
i = ci - 1;
|
|
4658
4684
|
else if (ci === BREAK)
|
|
@@ -4663,13 +4689,13 @@ function visit_(key2, node, visitor, path111) {
|
|
|
4663
4689
|
}
|
|
4664
4690
|
}
|
|
4665
4691
|
} else if (isPair(node)) {
|
|
4666
|
-
|
|
4667
|
-
const ck = visit_("key", node.key, visitor,
|
|
4692
|
+
path112 = Object.freeze(path112.concat(node));
|
|
4693
|
+
const ck = visit_("key", node.key, visitor, path112);
|
|
4668
4694
|
if (ck === BREAK)
|
|
4669
4695
|
return BREAK;
|
|
4670
4696
|
else if (ck === REMOVE)
|
|
4671
4697
|
node.key = null;
|
|
4672
|
-
const cv = visit_("value", node.value, visitor,
|
|
4698
|
+
const cv = visit_("value", node.value, visitor, path112);
|
|
4673
4699
|
if (cv === BREAK)
|
|
4674
4700
|
return BREAK;
|
|
4675
4701
|
else if (cv === REMOVE)
|
|
@@ -4687,17 +4713,17 @@ async function visitAsync(node, visitor) {
|
|
|
4687
4713
|
} else
|
|
4688
4714
|
await visitAsync_(null, node, visitor_, Object.freeze([]));
|
|
4689
4715
|
}
|
|
4690
|
-
async function visitAsync_(key2, node, visitor,
|
|
4691
|
-
const ctrl = await callVisitor(key2, node, visitor,
|
|
4716
|
+
async function visitAsync_(key2, node, visitor, path112) {
|
|
4717
|
+
const ctrl = await callVisitor(key2, node, visitor, path112);
|
|
4692
4718
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
4693
|
-
replaceNode(key2,
|
|
4694
|
-
return visitAsync_(key2, ctrl, visitor,
|
|
4719
|
+
replaceNode(key2, path112, ctrl);
|
|
4720
|
+
return visitAsync_(key2, ctrl, visitor, path112);
|
|
4695
4721
|
}
|
|
4696
4722
|
if (typeof ctrl !== "symbol") {
|
|
4697
4723
|
if (isCollection(node)) {
|
|
4698
|
-
|
|
4724
|
+
path112 = Object.freeze(path112.concat(node));
|
|
4699
4725
|
for (let i = 0; i < node.items.length; ++i) {
|
|
4700
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
4726
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path112);
|
|
4701
4727
|
if (typeof ci === "number")
|
|
4702
4728
|
i = ci - 1;
|
|
4703
4729
|
else if (ci === BREAK)
|
|
@@ -4708,13 +4734,13 @@ async function visitAsync_(key2, node, visitor, path111) {
|
|
|
4708
4734
|
}
|
|
4709
4735
|
}
|
|
4710
4736
|
} else if (isPair(node)) {
|
|
4711
|
-
|
|
4712
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
4737
|
+
path112 = Object.freeze(path112.concat(node));
|
|
4738
|
+
const ck = await visitAsync_("key", node.key, visitor, path112);
|
|
4713
4739
|
if (ck === BREAK)
|
|
4714
4740
|
return BREAK;
|
|
4715
4741
|
else if (ck === REMOVE)
|
|
4716
4742
|
node.key = null;
|
|
4717
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
4743
|
+
const cv = await visitAsync_("value", node.value, visitor, path112);
|
|
4718
4744
|
if (cv === BREAK)
|
|
4719
4745
|
return BREAK;
|
|
4720
4746
|
else if (cv === REMOVE)
|
|
@@ -4741,23 +4767,23 @@ function initVisitor(visitor) {
|
|
|
4741
4767
|
}
|
|
4742
4768
|
return visitor;
|
|
4743
4769
|
}
|
|
4744
|
-
function callVisitor(key2, node, visitor,
|
|
4770
|
+
function callVisitor(key2, node, visitor, path112) {
|
|
4745
4771
|
if (typeof visitor === "function")
|
|
4746
|
-
return visitor(key2, node,
|
|
4772
|
+
return visitor(key2, node, path112);
|
|
4747
4773
|
if (isMap(node))
|
|
4748
|
-
return visitor.Map?.(key2, node,
|
|
4774
|
+
return visitor.Map?.(key2, node, path112);
|
|
4749
4775
|
if (isSeq(node))
|
|
4750
|
-
return visitor.Seq?.(key2, node,
|
|
4776
|
+
return visitor.Seq?.(key2, node, path112);
|
|
4751
4777
|
if (isPair(node))
|
|
4752
|
-
return visitor.Pair?.(key2, node,
|
|
4778
|
+
return visitor.Pair?.(key2, node, path112);
|
|
4753
4779
|
if (isScalar(node))
|
|
4754
|
-
return visitor.Scalar?.(key2, node,
|
|
4780
|
+
return visitor.Scalar?.(key2, node, path112);
|
|
4755
4781
|
if (isAlias(node))
|
|
4756
|
-
return visitor.Alias?.(key2, node,
|
|
4782
|
+
return visitor.Alias?.(key2, node, path112);
|
|
4757
4783
|
return void 0;
|
|
4758
4784
|
}
|
|
4759
|
-
function replaceNode(key2,
|
|
4760
|
-
const parent =
|
|
4785
|
+
function replaceNode(key2, path112, node) {
|
|
4786
|
+
const parent = path112[path112.length - 1];
|
|
4761
4787
|
if (isCollection(parent)) {
|
|
4762
4788
|
parent.items[key2] = node;
|
|
4763
4789
|
} else if (isPair(parent)) {
|
|
@@ -5366,10 +5392,10 @@ var init_createNode = __esm({
|
|
|
5366
5392
|
});
|
|
5367
5393
|
|
|
5368
5394
|
// ../../node_modules/yaml/browser/dist/nodes/Collection.js
|
|
5369
|
-
function collectionFromPath(schema4,
|
|
5395
|
+
function collectionFromPath(schema4, path112, value) {
|
|
5370
5396
|
let v6 = value;
|
|
5371
|
-
for (let i =
|
|
5372
|
-
const k =
|
|
5397
|
+
for (let i = path112.length - 1; i >= 0; --i) {
|
|
5398
|
+
const k = path112[i];
|
|
5373
5399
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
5374
5400
|
const a = [];
|
|
5375
5401
|
a[k] = v6;
|
|
@@ -5395,7 +5421,7 @@ var init_Collection = __esm({
|
|
|
5395
5421
|
init_createNode();
|
|
5396
5422
|
init_identity();
|
|
5397
5423
|
init_Node();
|
|
5398
|
-
isEmptyPath = (
|
|
5424
|
+
isEmptyPath = (path112) => path112 == null || typeof path112 === "object" && !!path112[Symbol.iterator]().next().done;
|
|
5399
5425
|
Collection = class extends NodeBase {
|
|
5400
5426
|
constructor(type, schema4) {
|
|
5401
5427
|
super(type);
|
|
@@ -5425,11 +5451,11 @@ var init_Collection = __esm({
|
|
|
5425
5451
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
5426
5452
|
* that already exists in the map.
|
|
5427
5453
|
*/
|
|
5428
|
-
addIn(
|
|
5429
|
-
if (isEmptyPath(
|
|
5454
|
+
addIn(path112, value) {
|
|
5455
|
+
if (isEmptyPath(path112))
|
|
5430
5456
|
this.add(value);
|
|
5431
5457
|
else {
|
|
5432
|
-
const [key2, ...rest] =
|
|
5458
|
+
const [key2, ...rest] = path112;
|
|
5433
5459
|
const node = this.get(key2, true);
|
|
5434
5460
|
if (isCollection(node))
|
|
5435
5461
|
node.addIn(rest, value);
|
|
@@ -5443,8 +5469,8 @@ var init_Collection = __esm({
|
|
|
5443
5469
|
* Removes a value from the collection.
|
|
5444
5470
|
* @returns `true` if the item was found and removed.
|
|
5445
5471
|
*/
|
|
5446
|
-
deleteIn(
|
|
5447
|
-
const [key2, ...rest] =
|
|
5472
|
+
deleteIn(path112) {
|
|
5473
|
+
const [key2, ...rest] = path112;
|
|
5448
5474
|
if (rest.length === 0)
|
|
5449
5475
|
return this.delete(key2);
|
|
5450
5476
|
const node = this.get(key2, true);
|
|
@@ -5458,8 +5484,8 @@ var init_Collection = __esm({
|
|
|
5458
5484
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
5459
5485
|
* `true` (collections are always returned intact).
|
|
5460
5486
|
*/
|
|
5461
|
-
getIn(
|
|
5462
|
-
const [key2, ...rest] =
|
|
5487
|
+
getIn(path112, keepScalar) {
|
|
5488
|
+
const [key2, ...rest] = path112;
|
|
5463
5489
|
const node = this.get(key2, true);
|
|
5464
5490
|
if (rest.length === 0)
|
|
5465
5491
|
return !keepScalar && isScalar(node) ? node.value : node;
|
|
@@ -5477,8 +5503,8 @@ var init_Collection = __esm({
|
|
|
5477
5503
|
/**
|
|
5478
5504
|
* Checks if the collection includes a value with the key `key`.
|
|
5479
5505
|
*/
|
|
5480
|
-
hasIn(
|
|
5481
|
-
const [key2, ...rest] =
|
|
5506
|
+
hasIn(path112) {
|
|
5507
|
+
const [key2, ...rest] = path112;
|
|
5482
5508
|
if (rest.length === 0)
|
|
5483
5509
|
return this.has(key2);
|
|
5484
5510
|
const node = this.get(key2, true);
|
|
@@ -5488,8 +5514,8 @@ var init_Collection = __esm({
|
|
|
5488
5514
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
5489
5515
|
* boolean to add/remove the item from the set.
|
|
5490
5516
|
*/
|
|
5491
|
-
setIn(
|
|
5492
|
-
const [key2, ...rest] =
|
|
5517
|
+
setIn(path112, value) {
|
|
5518
|
+
const [key2, ...rest] = path112;
|
|
5493
5519
|
if (rest.length === 0) {
|
|
5494
5520
|
this.set(key2, value);
|
|
5495
5521
|
} else {
|
|
@@ -7958,9 +7984,9 @@ var init_Document = __esm({
|
|
|
7958
7984
|
this.contents.add(value);
|
|
7959
7985
|
}
|
|
7960
7986
|
/** Adds a value to the document. */
|
|
7961
|
-
addIn(
|
|
7987
|
+
addIn(path112, value) {
|
|
7962
7988
|
if (assertCollection(this.contents))
|
|
7963
|
-
this.contents.addIn(
|
|
7989
|
+
this.contents.addIn(path112, value);
|
|
7964
7990
|
}
|
|
7965
7991
|
/**
|
|
7966
7992
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -8035,14 +8061,14 @@ var init_Document = __esm({
|
|
|
8035
8061
|
* Removes a value from the document.
|
|
8036
8062
|
* @returns `true` if the item was found and removed.
|
|
8037
8063
|
*/
|
|
8038
|
-
deleteIn(
|
|
8039
|
-
if (isEmptyPath(
|
|
8064
|
+
deleteIn(path112) {
|
|
8065
|
+
if (isEmptyPath(path112)) {
|
|
8040
8066
|
if (this.contents == null)
|
|
8041
8067
|
return false;
|
|
8042
8068
|
this.contents = null;
|
|
8043
8069
|
return true;
|
|
8044
8070
|
}
|
|
8045
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
8071
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path112) : false;
|
|
8046
8072
|
}
|
|
8047
8073
|
/**
|
|
8048
8074
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -8057,10 +8083,10 @@ var init_Document = __esm({
|
|
|
8057
8083
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
8058
8084
|
* `true` (collections are always returned intact).
|
|
8059
8085
|
*/
|
|
8060
|
-
getIn(
|
|
8061
|
-
if (isEmptyPath(
|
|
8086
|
+
getIn(path112, keepScalar) {
|
|
8087
|
+
if (isEmptyPath(path112))
|
|
8062
8088
|
return !keepScalar && isScalar(this.contents) ? this.contents.value : this.contents;
|
|
8063
|
-
return isCollection(this.contents) ? this.contents.getIn(
|
|
8089
|
+
return isCollection(this.contents) ? this.contents.getIn(path112, keepScalar) : void 0;
|
|
8064
8090
|
}
|
|
8065
8091
|
/**
|
|
8066
8092
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -8071,10 +8097,10 @@ var init_Document = __esm({
|
|
|
8071
8097
|
/**
|
|
8072
8098
|
* Checks if the document includes a value at `path`.
|
|
8073
8099
|
*/
|
|
8074
|
-
hasIn(
|
|
8075
|
-
if (isEmptyPath(
|
|
8100
|
+
hasIn(path112) {
|
|
8101
|
+
if (isEmptyPath(path112))
|
|
8076
8102
|
return this.contents !== void 0;
|
|
8077
|
-
return isCollection(this.contents) ? this.contents.hasIn(
|
|
8103
|
+
return isCollection(this.contents) ? this.contents.hasIn(path112) : false;
|
|
8078
8104
|
}
|
|
8079
8105
|
/**
|
|
8080
8106
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -8091,13 +8117,13 @@ var init_Document = __esm({
|
|
|
8091
8117
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
8092
8118
|
* boolean to add/remove the item from the set.
|
|
8093
8119
|
*/
|
|
8094
|
-
setIn(
|
|
8095
|
-
if (isEmptyPath(
|
|
8120
|
+
setIn(path112, value) {
|
|
8121
|
+
if (isEmptyPath(path112)) {
|
|
8096
8122
|
this.contents = value;
|
|
8097
8123
|
} else if (this.contents == null) {
|
|
8098
|
-
this.contents = collectionFromPath(this.schema, Array.from(
|
|
8124
|
+
this.contents = collectionFromPath(this.schema, Array.from(path112), value);
|
|
8099
8125
|
} else if (assertCollection(this.contents)) {
|
|
8100
|
-
this.contents.setIn(
|
|
8126
|
+
this.contents.setIn(path112, value);
|
|
8101
8127
|
}
|
|
8102
8128
|
}
|
|
8103
8129
|
/**
|
|
@@ -10021,15 +10047,15 @@ function visit2(cst, visitor) {
|
|
|
10021
10047
|
cst = { start: cst.start, value: cst.value };
|
|
10022
10048
|
_visit(Object.freeze([]), cst, visitor);
|
|
10023
10049
|
}
|
|
10024
|
-
function _visit(
|
|
10025
|
-
let ctrl = visitor(item,
|
|
10050
|
+
function _visit(path112, item, visitor) {
|
|
10051
|
+
let ctrl = visitor(item, path112);
|
|
10026
10052
|
if (typeof ctrl === "symbol")
|
|
10027
10053
|
return ctrl;
|
|
10028
10054
|
for (const field of ["key", "value"]) {
|
|
10029
10055
|
const token = item[field];
|
|
10030
10056
|
if (token && "items" in token) {
|
|
10031
10057
|
for (let i = 0; i < token.items.length; ++i) {
|
|
10032
|
-
const ci = _visit(Object.freeze(
|
|
10058
|
+
const ci = _visit(Object.freeze(path112.concat([[field, i]])), token.items[i], visitor);
|
|
10033
10059
|
if (typeof ci === "number")
|
|
10034
10060
|
i = ci - 1;
|
|
10035
10061
|
else if (ci === BREAK2)
|
|
@@ -10040,10 +10066,10 @@ function _visit(path111, item, visitor) {
|
|
|
10040
10066
|
}
|
|
10041
10067
|
}
|
|
10042
10068
|
if (typeof ctrl === "function" && field === "key")
|
|
10043
|
-
ctrl = ctrl(item,
|
|
10069
|
+
ctrl = ctrl(item, path112);
|
|
10044
10070
|
}
|
|
10045
10071
|
}
|
|
10046
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
10072
|
+
return typeof ctrl === "function" ? ctrl(item, path112) : ctrl;
|
|
10047
10073
|
}
|
|
10048
10074
|
var BREAK2, SKIP2, REMOVE2;
|
|
10049
10075
|
var init_cst_visit = __esm({
|
|
@@ -10055,9 +10081,9 @@ var init_cst_visit = __esm({
|
|
|
10055
10081
|
visit2.BREAK = BREAK2;
|
|
10056
10082
|
visit2.SKIP = SKIP2;
|
|
10057
10083
|
visit2.REMOVE = REMOVE2;
|
|
10058
|
-
visit2.itemAtPath = (cst,
|
|
10084
|
+
visit2.itemAtPath = (cst, path112) => {
|
|
10059
10085
|
let item = cst;
|
|
10060
|
-
for (const [field, index] of
|
|
10086
|
+
for (const [field, index] of path112) {
|
|
10061
10087
|
const tok = item?.[field];
|
|
10062
10088
|
if (tok && "items" in tok) {
|
|
10063
10089
|
item = tok.items[index];
|
|
@@ -10066,9 +10092,9 @@ var init_cst_visit = __esm({
|
|
|
10066
10092
|
}
|
|
10067
10093
|
return item;
|
|
10068
10094
|
};
|
|
10069
|
-
visit2.parentCollection = (cst,
|
|
10070
|
-
const parent = visit2.itemAtPath(cst,
|
|
10071
|
-
const field =
|
|
10095
|
+
visit2.parentCollection = (cst, path112) => {
|
|
10096
|
+
const parent = visit2.itemAtPath(cst, path112.slice(0, -1));
|
|
10097
|
+
const field = path112[path112.length - 1][0];
|
|
10072
10098
|
const coll = parent?.[field];
|
|
10073
10099
|
if (coll && "items" in coll)
|
|
10074
10100
|
return coll;
|
|
@@ -11375,14 +11401,14 @@ var init_parser = __esm({
|
|
|
11375
11401
|
case "scalar":
|
|
11376
11402
|
case "single-quoted-scalar":
|
|
11377
11403
|
case "double-quoted-scalar": {
|
|
11378
|
-
const
|
|
11404
|
+
const fs88 = this.flowScalar(this.type);
|
|
11379
11405
|
if (atNextItem || it.value) {
|
|
11380
|
-
map2.items.push({ start, key:
|
|
11406
|
+
map2.items.push({ start, key: fs88, sep: [] });
|
|
11381
11407
|
this.onKeyLine = true;
|
|
11382
11408
|
} else if (it.sep) {
|
|
11383
|
-
this.stack.push(
|
|
11409
|
+
this.stack.push(fs88);
|
|
11384
11410
|
} else {
|
|
11385
|
-
Object.assign(it, { key:
|
|
11411
|
+
Object.assign(it, { key: fs88, sep: [] });
|
|
11386
11412
|
this.onKeyLine = true;
|
|
11387
11413
|
}
|
|
11388
11414
|
return;
|
|
@@ -11510,13 +11536,13 @@ var init_parser = __esm({
|
|
|
11510
11536
|
case "scalar":
|
|
11511
11537
|
case "single-quoted-scalar":
|
|
11512
11538
|
case "double-quoted-scalar": {
|
|
11513
|
-
const
|
|
11539
|
+
const fs88 = this.flowScalar(this.type);
|
|
11514
11540
|
if (!it || it.value)
|
|
11515
|
-
fc.items.push({ start: [], key:
|
|
11541
|
+
fc.items.push({ start: [], key: fs88, sep: [] });
|
|
11516
11542
|
else if (it.sep)
|
|
11517
|
-
this.stack.push(
|
|
11543
|
+
this.stack.push(fs88);
|
|
11518
11544
|
else
|
|
11519
|
-
Object.assign(it, { key:
|
|
11545
|
+
Object.assign(it, { key: fs88, sep: [] });
|
|
11520
11546
|
return;
|
|
11521
11547
|
}
|
|
11522
11548
|
case "flow-map-end":
|
|
@@ -11960,8 +11986,8 @@ function metadataValue(value, key2) {
|
|
|
11960
11986
|
if (!value || typeof value !== "object") return void 0;
|
|
11961
11987
|
return Object.getOwnPropertyDescriptor(value, key2)?.value;
|
|
11962
11988
|
}
|
|
11963
|
-
function readProjectJson(
|
|
11964
|
-
const text6 = readProjectMetadata(
|
|
11989
|
+
function readProjectJson(path112, files2 = nodeRepoFileReader) {
|
|
11990
|
+
const text6 = readProjectMetadata(path112, files2);
|
|
11965
11991
|
if (text6 === null) return null;
|
|
11966
11992
|
try {
|
|
11967
11993
|
const value = JSON.parse(text6);
|
|
@@ -13279,8 +13305,8 @@ export *
|
|
|
13279
13305
|
}`;
|
|
13280
13306
|
}
|
|
13281
13307
|
function swiftPackageIdentity(url) {
|
|
13282
|
-
const
|
|
13283
|
-
return (
|
|
13308
|
+
const path112 = url.endsWith("/") ? url.slice(0, -1) : url;
|
|
13309
|
+
return (path112.split("/").pop() ?? path112).replace(/\.git$/, "").toLowerCase();
|
|
13284
13310
|
}
|
|
13285
13311
|
function clangSettingEntries(settings, tool) {
|
|
13286
13312
|
return (settings ?? []).flatMap(
|
|
@@ -13981,14 +14007,14 @@ function addAsset(into, asset) {
|
|
|
13981
14007
|
function checkStack(dir, type, devices2) {
|
|
13982
14008
|
const sets = (parent, allowed) => (0, import_node_fs28.readdirSync)(parent, { withFileTypes: true }).flatMap((entry) => {
|
|
13983
14009
|
if (entry.name.startsWith(".") || entry.isFile()) return [];
|
|
13984
|
-
const
|
|
14010
|
+
const path112 = (0, import_node_path25.join)(parent, entry.name);
|
|
13985
14011
|
const extension = (0, import_node_path25.extname)(entry.name);
|
|
13986
14012
|
if (!entry.isDirectory() || !allowed.includes(extension))
|
|
13987
14013
|
return refuse(
|
|
13988
|
-
|
|
14014
|
+
path112,
|
|
13989
14015
|
`image stack content other than ${allowed.join(", ")} is unproven`
|
|
13990
14016
|
);
|
|
13991
|
-
return [{ path:
|
|
14017
|
+
return [{ path: path112, extension }];
|
|
13992
14018
|
});
|
|
13993
14019
|
for (const layer of sets(dir, [`.${type}layer`, ".imageset", ".colorset"])) {
|
|
13994
14020
|
if (layer.extension !== `.${type}layer`) continue;
|
|
@@ -14000,37 +14026,37 @@ function checkStack(dir, type, devices2) {
|
|
|
14000
14026
|
function walk(dir, into, devices2, extensions) {
|
|
14001
14027
|
for (const entry of (0, import_node_fs28.readdirSync)(dir, { withFileTypes: true })) {
|
|
14002
14028
|
if (entry.name.startsWith(".") || entry.isFile()) continue;
|
|
14003
|
-
const
|
|
14004
|
-
if (!entry.isDirectory()) return refuse(
|
|
14029
|
+
const path112 = (0, import_node_path25.join)(dir, entry.name);
|
|
14030
|
+
if (!entry.isDirectory()) return refuse(path112, "it is neither a file nor a directory");
|
|
14005
14031
|
const extension = (0, import_node_path25.extname)(entry.name).slice(1);
|
|
14006
14032
|
const type = extension.toLowerCase();
|
|
14007
14033
|
const base = entry.name.slice(0, entry.name.length - extension.length - 1);
|
|
14008
14034
|
if (type !== extension && knownTypes.has(type))
|
|
14009
|
-
return refuse(
|
|
14035
|
+
return refuse(path112, "its type extension is not lowercase");
|
|
14010
14036
|
if (type === "colorset" || type === "imageset" || type === "symbolset") {
|
|
14011
14037
|
addAsset(into, {
|
|
14012
14038
|
kind: type === "colorset" ? "color" : "image",
|
|
14013
14039
|
name: base,
|
|
14014
|
-
...assetState(
|
|
14040
|
+
...assetState(path112, type, devices2),
|
|
14015
14041
|
extensions,
|
|
14016
|
-
source:
|
|
14042
|
+
source: path112
|
|
14017
14043
|
});
|
|
14018
14044
|
continue;
|
|
14019
14045
|
}
|
|
14020
14046
|
if (silentTypes.has(type)) continue;
|
|
14021
14047
|
if (stackTypes.has(type)) {
|
|
14022
|
-
checkStack(
|
|
14048
|
+
checkStack(path112, type, devices2);
|
|
14023
14049
|
continue;
|
|
14024
14050
|
}
|
|
14025
|
-
if (unprovenTypes.has(type)) return refuse(
|
|
14051
|
+
if (unprovenTypes.has(type)) return refuse(path112, `${type} assets are unproven`);
|
|
14026
14052
|
const name3 = type === "spriteatlas" ? base : entry.name;
|
|
14027
|
-
if (!folderProperties((0, import_node_path25.join)(
|
|
14028
|
-
walk(
|
|
14053
|
+
if (!folderProperties((0, import_node_path25.join)(path112, "Contents.json")).namespace) {
|
|
14054
|
+
walk(path112, into, devices2, extensions);
|
|
14029
14055
|
continue;
|
|
14030
14056
|
}
|
|
14031
|
-
const child = into.namespaces.get(name3) ?? scope(
|
|
14057
|
+
const child = into.namespaces.get(name3) ?? scope(path112);
|
|
14032
14058
|
into.namespaces.set(name3, child);
|
|
14033
|
-
walk(
|
|
14059
|
+
walk(path112, child, devices2, extensions);
|
|
14034
14060
|
}
|
|
14035
14061
|
}
|
|
14036
14062
|
function words(name3) {
|
|
@@ -14077,11 +14103,11 @@ function members(into, kind, prefix, extensions) {
|
|
|
14077
14103
|
const assets2 = /* @__PURE__ */ new Set();
|
|
14078
14104
|
const out = [];
|
|
14079
14105
|
for (const entry of entries) {
|
|
14080
|
-
const
|
|
14106
|
+
const path112 = `${prefix}${entry.name}`;
|
|
14081
14107
|
const source = entry.child ? entry.child.source : entry.asset.source;
|
|
14082
14108
|
if (Array.from(entry.name).some((char) => char.charCodeAt(0) > 127))
|
|
14083
14109
|
refuse(source, "its name is not ASCII");
|
|
14084
|
-
const named = (text7) => `The \\"${escape(
|
|
14110
|
+
const named = (text7) => `The \\"${escape(path112)}\\" ${text7}`;
|
|
14085
14111
|
if (entry.child) {
|
|
14086
14112
|
const text7 = symbol(entry.name, true);
|
|
14087
14113
|
if (!text7)
|
|
@@ -14104,9 +14130,9 @@ function members(into, kind, prefix, extensions) {
|
|
|
14104
14130
|
namespaces.add(text7);
|
|
14105
14131
|
out.push({
|
|
14106
14132
|
type: "namespace",
|
|
14107
|
-
path:
|
|
14133
|
+
path: path112,
|
|
14108
14134
|
symbol: spelled(text7),
|
|
14109
|
-
members: members(entry.child, kind, `${
|
|
14135
|
+
members: members(entry.child, kind, `${path112}/`, extensions)
|
|
14110
14136
|
});
|
|
14111
14137
|
}
|
|
14112
14138
|
continue;
|
|
@@ -14133,7 +14159,7 @@ function members(into, kind, prefix, extensions) {
|
|
|
14133
14159
|
else if (!omitted)
|
|
14134
14160
|
out.push({
|
|
14135
14161
|
type: "asset",
|
|
14136
|
-
path:
|
|
14162
|
+
path: path112,
|
|
14137
14163
|
name: entry.name,
|
|
14138
14164
|
symbol: spelled(text6),
|
|
14139
14165
|
thinnable: asset.thinnable,
|
|
@@ -14415,8 +14441,8 @@ var init_xcode_asset_symbols = __esm({
|
|
|
14415
14441
|
import_node_path25 = require("node:path");
|
|
14416
14442
|
Refusal = class extends Error {
|
|
14417
14443
|
};
|
|
14418
|
-
refuse = (
|
|
14419
|
-
throw new Refusal(`Generated asset symbols are unproven for ${
|
|
14444
|
+
refuse = (path112, reason) => {
|
|
14445
|
+
throw new Refusal(`Generated asset symbols are unproven for ${path112}: ${reason}`);
|
|
14420
14446
|
};
|
|
14421
14447
|
isRecord2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
14422
14448
|
scope = (source) => ({
|
|
@@ -14862,11 +14888,11 @@ function catalogDigest(directory2) {
|
|
|
14862
14888
|
for (const entry of (0, import_node_fs29.readdirSync)(dir, { withFileTypes: true }).sort(
|
|
14863
14889
|
(a, b) => a.name.localeCompare(b.name)
|
|
14864
14890
|
)) {
|
|
14865
|
-
const
|
|
14866
|
-
if (entry.isDirectory()) walk3(
|
|
14867
|
-
else if (entry.isFile() && (0, import_node_fs29.statSync)(
|
|
14868
|
-
hashes.push([(0, import_node_path26.relative)(directory2,
|
|
14869
|
-
else throw new Error(`Unsupported asset catalog entry: ${
|
|
14891
|
+
const path112 = (0, import_node_path26.join)(dir, entry.name);
|
|
14892
|
+
if (entry.isDirectory()) walk3(path112);
|
|
14893
|
+
else if (entry.isFile() && (0, import_node_fs29.statSync)(path112).size <= 64 * 1024 * 1024)
|
|
14894
|
+
hashes.push([(0, import_node_path26.relative)(directory2, path112), sha2562((0, import_node_fs29.readFileSync)(path112))]);
|
|
14895
|
+
else throw new Error(`Unsupported asset catalog entry: ${path112}`);
|
|
14870
14896
|
}
|
|
14871
14897
|
};
|
|
14872
14898
|
walk3(directory2);
|
|
@@ -14877,7 +14903,7 @@ function symbolSource(plan, root) {
|
|
|
14877
14903
|
const known = symbolTexts.get(key2);
|
|
14878
14904
|
if (known !== void 0) return { status: "source", text: known };
|
|
14879
14905
|
const source = assetSymbolSource(
|
|
14880
|
-
plan.catalogs.map(({ path:
|
|
14906
|
+
plan.catalogs.map(({ path: path112 }) => (0, import_node_path26.join)(root, path112)),
|
|
14881
14907
|
plan.settings
|
|
14882
14908
|
);
|
|
14883
14909
|
if (source.status === "source") symbolTexts.set(key2, source.text);
|
|
@@ -14935,9 +14961,9 @@ function planAssetSymbols(resources, root, settings) {
|
|
|
14935
14961
|
`Generated asset symbols are proven only for TARGETED_DEVICE_FAMILY 1, 2, 1,2, 1,7, 1,2,6 or 1,2,7; this target resolves to "${families}".`
|
|
14936
14962
|
);
|
|
14937
14963
|
const plan = {
|
|
14938
|
-
catalogs: catalogs.map((
|
|
14939
|
-
path:
|
|
14940
|
-
sha256: catalogDigest((0, import_node_path26.join)(root,
|
|
14964
|
+
catalogs: catalogs.map((path112) => ({
|
|
14965
|
+
path: path112,
|
|
14966
|
+
sha256: catalogDigest((0, import_node_path26.join)(root, path112))
|
|
14941
14967
|
})),
|
|
14942
14968
|
settings: { deployment: target, devices: devices2, extensions: extensions === "YES" }
|
|
14943
14969
|
};
|
|
@@ -17970,10 +17996,10 @@ function synthesizedInterfaceEnums(interfaceText, module2, graphs) {
|
|
|
17970
17996
|
const enclosing = scopes.length > 0 ? scopes[scopes.length - 1].prefix : [];
|
|
17971
17997
|
if (scope2?.[3] === "enum" && opens > 0 && /(^|\s)(public|open)\s/.test(scope2[2] ?? "") && !/\bwhere\b/.test(first.masked) && first.masked[scope2.index + scope2[0].length] !== "<") {
|
|
17972
17998
|
const name3 = scope2[4];
|
|
17973
|
-
const
|
|
17974
|
-
if (!byPath.has(
|
|
17999
|
+
const path112 = scopeOf(name3, enclosing, false);
|
|
18000
|
+
if (!byPath.has(path112.join(".")) && (path112.length === 1 || byPath.has(path112.slice(0, -1).join(".")))) {
|
|
17975
18001
|
const keptAttrs = [...(scope2[1] ?? "").matchAll(/@\w+(?:\([^)]*\))?/g)].map((attr) => attr[0]).filter((attr) => !attr.startsWith("@objc"));
|
|
17976
|
-
const id = `s:peach-synthesized-${module2}-${
|
|
18002
|
+
const id = `s:peach-synthesized-${module2}-${path112.join(".")}`;
|
|
17977
18003
|
const body = [];
|
|
17978
18004
|
let inner = 1;
|
|
17979
18005
|
let closed = false;
|
|
@@ -18028,15 +18054,15 @@ function synthesizedInterfaceEnums(interfaceText, module2, graphs) {
|
|
|
18028
18054
|
symbols.push({
|
|
18029
18055
|
kind: { identifier: "swift.enum" },
|
|
18030
18056
|
identifier: { precise: id },
|
|
18031
|
-
pathComponents:
|
|
18057
|
+
pathComponents: path112,
|
|
18032
18058
|
declarationFragments: fragments,
|
|
18033
18059
|
accessLevel: "public"
|
|
18034
18060
|
});
|
|
18035
|
-
if (
|
|
18061
|
+
if (path112.length > 1)
|
|
18036
18062
|
relationships.push({
|
|
18037
18063
|
kind: "memberOf",
|
|
18038
18064
|
source: id,
|
|
18039
|
-
target: byPath.get(
|
|
18065
|
+
target: byPath.get(path112.slice(0, -1).join("."))
|
|
18040
18066
|
});
|
|
18041
18067
|
for (const kase of cases) {
|
|
18042
18068
|
const memberId = `${id}-${kase.leaf}`;
|
|
@@ -18045,7 +18071,7 @@ function synthesizedInterfaceEnums(interfaceText, module2, graphs) {
|
|
|
18045
18071
|
symbols.push({
|
|
18046
18072
|
kind: { identifier: "swift.enum.case" },
|
|
18047
18073
|
identifier: { precise: memberId },
|
|
18048
|
-
pathComponents: [...
|
|
18074
|
+
pathComponents: [...path112, kase.leaf],
|
|
18049
18075
|
declarationFragments: [
|
|
18050
18076
|
{ kind: "keyword", spelling: "case" },
|
|
18051
18077
|
{ kind: "text", spelling: " " },
|
|
@@ -18061,7 +18087,7 @@ function synthesizedInterfaceEnums(interfaceText, module2, graphs) {
|
|
|
18061
18087
|
symbols.push({
|
|
18062
18088
|
kind: { identifier: "swift.init" },
|
|
18063
18089
|
identifier: { precise: initId },
|
|
18064
|
-
pathComponents: [...
|
|
18090
|
+
pathComponents: [...path112, "init(rawValue:)"],
|
|
18065
18091
|
declarationFragments: [
|
|
18066
18092
|
{ kind: "keyword", spelling: "init" },
|
|
18067
18093
|
{ kind: "text", spelling: "?(" },
|
|
@@ -18130,7 +18156,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
18130
18156
|
})
|
|
18131
18157
|
)
|
|
18132
18158
|
);
|
|
18133
|
-
const trap = (
|
|
18159
|
+
const trap = (path112) => `fatalError("${path112} is ${options.placeholder === void 0 ? "a binary framework" : "a placeholder"} peach cannot run")`;
|
|
18134
18160
|
const skipped = [];
|
|
18135
18161
|
const behavior = options.behavior ?? /* @__PURE__ */ new Map();
|
|
18136
18162
|
const used = /* @__PURE__ */ new Set();
|
|
@@ -18480,34 +18506,34 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
18480
18506
|
lines.push(...physical);
|
|
18481
18507
|
owners.push(...physical.map(() => current2));
|
|
18482
18508
|
};
|
|
18483
|
-
const emitAt = (
|
|
18484
|
-
if (omit.has(
|
|
18509
|
+
const emitAt = (path112, line) => {
|
|
18510
|
+
if (omit.has(path112)) return;
|
|
18485
18511
|
const previous = current2;
|
|
18486
|
-
current2 =
|
|
18512
|
+
current2 = path112;
|
|
18487
18513
|
emit(line);
|
|
18488
18514
|
current2 = previous;
|
|
18489
18515
|
};
|
|
18490
18516
|
const emitInertState = (id, indent2, build) => {
|
|
18491
|
-
const
|
|
18517
|
+
const path112 = pathOf(byId.get(id));
|
|
18492
18518
|
emitAt(hiddenInit(id), `${indent2}init(_peachInert: Void) { ${build} }`);
|
|
18493
18519
|
const list2 = conforms.get(id) ?? [];
|
|
18494
18520
|
const has = (name3) => (children.get(id) ?? []).some((member) => leaf(member) === name3);
|
|
18495
18521
|
if (list2.includes("Encodable") && !has("encode(to:)"))
|
|
18496
18522
|
emitAt(
|
|
18497
|
-
`${
|
|
18523
|
+
`${path112}.encode(to:)`,
|
|
18498
18524
|
`${indent2}public func encode(to encoder: Encoder) throws {}`
|
|
18499
18525
|
);
|
|
18500
18526
|
if (list2.includes("Decodable") && !has("init(from:)"))
|
|
18501
18527
|
emitAt(
|
|
18502
|
-
`${
|
|
18528
|
+
`${path112}.init(from:)`,
|
|
18503
18529
|
`${indent2}public init(from decoder: Decoder) throws { self.init(_peachInert: ()) }`
|
|
18504
18530
|
);
|
|
18505
18531
|
};
|
|
18506
18532
|
const scoped = (body) => (symbol2, ...rest) => {
|
|
18507
|
-
const
|
|
18508
|
-
if (omit.has(
|
|
18533
|
+
const path112 = pathOf(symbol2);
|
|
18534
|
+
if (omit.has(path112)) return void skipped.push({ path: path112, reason: omit.get(path112) });
|
|
18509
18535
|
const previous = current2;
|
|
18510
|
-
current2 =
|
|
18536
|
+
current2 = path112;
|
|
18511
18537
|
try {
|
|
18512
18538
|
body(symbol2, ...rest);
|
|
18513
18539
|
} finally {
|
|
@@ -18539,7 +18565,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
18539
18565
|
};
|
|
18540
18566
|
const emitMember = scoped(
|
|
18541
18567
|
(member, indent2, context) => {
|
|
18542
|
-
const
|
|
18568
|
+
const path112 = pathOf(member);
|
|
18543
18569
|
if (TYPE_KINDS.has(member.kind.identifier)) {
|
|
18544
18570
|
const origin = origins.get(member.identifier.precise)?.split(".")[0];
|
|
18545
18571
|
const parent = owner.get(member.identifier.precise);
|
|
@@ -18556,7 +18582,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
18556
18582
|
))
|
|
18557
18583
|
return;
|
|
18558
18584
|
if (!MEMBER_KINDS.has(member.kind.identifier)) {
|
|
18559
|
-
skipped.push({ path:
|
|
18585
|
+
skipped.push({ path: path112, reason: `unhandled ${member.kind.identifier}` });
|
|
18560
18586
|
return;
|
|
18561
18587
|
}
|
|
18562
18588
|
const { 1: spelledAttrs, 2: rest } = LEADING_ATTRS.exec(text(member));
|
|
@@ -18564,15 +18590,15 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
18564
18590
|
/@(\w+)(?:\([^)]*\))?\s*/g,
|
|
18565
18591
|
(attr, name3) => typeByPath.has(name3) ? "" : attr
|
|
18566
18592
|
) : spelledAttrs;
|
|
18567
|
-
const attrs = options.unobjc?.has(
|
|
18593
|
+
const attrs = options.unobjc?.has(path112) ? wrapped.replace(/@objc(?:\([^)]*\))?\s*/g, "") : wrapped;
|
|
18568
18594
|
const modifiers = /^((?:(?:required|final|override|convenience|unowned(?:\(\w+\))?|weak|lazy|nonisolated|mutating|nonmutating) )*)(.*)$/s.exec(
|
|
18569
18595
|
rest
|
|
18570
18596
|
);
|
|
18571
18597
|
const flags = new Set(
|
|
18572
18598
|
modifiers[1].trim().split(/\s+/).filter(Boolean).map((flag) => flag.replace(/\(.*/, ""))
|
|
18573
18599
|
);
|
|
18574
|
-
const requiredInit = context.inClass && !!options.requiredInits?.has(
|
|
18575
|
-
const restatesRequired = context.inClass &&
|
|
18600
|
+
const requiredInit = context.inClass && !!options.requiredInits?.has(path112);
|
|
18601
|
+
const restatesRequired = context.inClass && path112.endsWith(".init()") && [...superChain(owner.get(member.identifier.precise) ?? "")].some(
|
|
18576
18602
|
(at) => options.requiredInits?.has(`${pathOf(byId.get(at))}.init()`)
|
|
18577
18603
|
);
|
|
18578
18604
|
const protocolInit = member.kind.identifier === "swift.init" && /^c:objc\(pl\)\w+\(im\).*::SYNTHESIZED::c:objc\(cs\)/.test(
|
|
@@ -18582,12 +18608,12 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
18582
18608
|
const final = context.inClass && flags.has("final") ? "final " : "";
|
|
18583
18609
|
const mutating = flags.has("mutating") ? "mutating " : flags.has("nonmutating") ? "nonmutating " : "";
|
|
18584
18610
|
let core = `${flags.has("convenience") ? "convenience " : ""}${modifiers[2]}`;
|
|
18585
|
-
const override = context.inClass && !options.plain?.has(
|
|
18611
|
+
const override = context.inClass && !options.plain?.has(path112) && !restatesRequired && (flags.has("override") || overrides.has(member.identifier.precise) || options.forcedOverride?.has(path112) || isObjC(member) && path112.endsWith(".init()")) ? "override " : "";
|
|
18586
18612
|
const head = `${indent2}${attrs}${access(member, context.openOwner)} ${required ? "required " : ""}${final}${override}${mutating}`;
|
|
18587
|
-
const measured = behavior.get(
|
|
18588
|
-
if (measured) used.add(
|
|
18613
|
+
const measured = behavior.get(path112);
|
|
18614
|
+
if (measured) used.add(path112);
|
|
18589
18615
|
const overloadBody = /\basync\b/.test(core) ? measured?.asyncBody : /\bResult</.test(core) ? measured?.resultBody : void 0;
|
|
18590
|
-
const body = overloadBody ?? measured?.body ?? (options.inert ? inertBody(member) : trap(
|
|
18616
|
+
const body = overloadBody ?? measured?.body ?? (options.inert ? inertBody(member) : trap(path112));
|
|
18591
18617
|
switch (member.kind.identifier) {
|
|
18592
18618
|
case "swift.property":
|
|
18593
18619
|
case "swift.type.property":
|
|
@@ -18600,13 +18626,13 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
18600
18626
|
const parameter = !measured && !options.inert && !settable && /:\s*some\s/.test(decl) ? opaqueParameter(member) : void 0;
|
|
18601
18627
|
const getter = parameter ? `return ({ () -> ${parameter} in ${body} })()` : body;
|
|
18602
18628
|
const computed = decl.replace(/^((?:static |class )*)let /, "$1var ");
|
|
18603
|
-
const wrapper = options.projections?.get(
|
|
18629
|
+
const wrapper = options.projections?.get(path112);
|
|
18604
18630
|
if (wrapper) {
|
|
18605
18631
|
const type = /^var\s+`?\w+`?\s*:\s*(.+)$/s.exec(computed)?.[1];
|
|
18606
|
-
const initial = type && inertValue(type, /* @__PURE__ */ new Set(), [
|
|
18632
|
+
const initial = type && inertValue(type, /* @__PURE__ */ new Set(), [path112]);
|
|
18607
18633
|
if (!initial)
|
|
18608
18634
|
return void skipped.push({
|
|
18609
|
-
path:
|
|
18635
|
+
path: path112,
|
|
18610
18636
|
reason: `wrapped by ${wrapper} with no inert initial value`
|
|
18611
18637
|
});
|
|
18612
18638
|
const own = new RegExp(
|
|
@@ -18627,7 +18653,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
18627
18653
|
return;
|
|
18628
18654
|
}
|
|
18629
18655
|
emit(
|
|
18630
|
-
`${head}${computed} { get${effects} { ${getter} }${settable && !effects ? ` ${parsed.nonmutating ? "nonmutating " : ""}set { ${measured?.set ?? (options.inert ? "" : trap(
|
|
18656
|
+
`${head}${computed} { get${effects} { ${getter} }${settable && !effects ? ` ${parsed.nonmutating ? "nonmutating " : ""}set { ${measured?.set ?? (options.inert ? "" : trap(path112))} }` : ""} }`
|
|
18631
18657
|
);
|
|
18632
18658
|
return;
|
|
18633
18659
|
}
|
|
@@ -18686,7 +18712,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
18686
18712
|
};
|
|
18687
18713
|
const emitType = scoped(
|
|
18688
18714
|
(symbol2, indent2) => {
|
|
18689
|
-
const
|
|
18715
|
+
const path112 = pathOf(symbol2);
|
|
18690
18716
|
const id = symbol2.identifier.precise;
|
|
18691
18717
|
const inner = `${indent2} `;
|
|
18692
18718
|
switch (symbol2.kind.identifier) {
|
|
@@ -18703,10 +18729,10 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
18703
18729
|
case "swift.class": {
|
|
18704
18730
|
const shape = header(symbol2, "class", indent2);
|
|
18705
18731
|
if (!shape)
|
|
18706
|
-
return void skipped.push({ path:
|
|
18707
|
-
const parent = options.superclasses?.get(
|
|
18732
|
+
return void skipped.push({ path: path112, reason: `unparsed class ${text(symbol2)}` });
|
|
18733
|
+
const parent = options.superclasses?.get(path112) ?? superclass.get(id);
|
|
18708
18734
|
const blocked = classBlocked(id);
|
|
18709
|
-
if (blocked) return void skipped.push({ path:
|
|
18735
|
+
if (blocked) return void skipped.push({ path: path112, reason: blocked });
|
|
18710
18736
|
const ancestors = /* @__PURE__ */ new Set();
|
|
18711
18737
|
const inherited = /* @__PURE__ */ new Set();
|
|
18712
18738
|
for (let at = superId.get(id); at; at = superId.get(at)) {
|
|
@@ -18722,7 +18748,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
18722
18748
|
"Equatable",
|
|
18723
18749
|
"CustomStringConvertible",
|
|
18724
18750
|
"CustomDebugStringConvertible"
|
|
18725
|
-
].includes(name3)) && !(name3 === nsObjectProtocol && externalRoot(id) === nsObject) && !options.unconformed?.get(
|
|
18751
|
+
].includes(name3)) && !(name3 === nsObjectProtocol && externalRoot(id) === nsObject) && !options.unconformed?.get(path112)?.has(name3)
|
|
18726
18752
|
)
|
|
18727
18753
|
].filter((name3, at, all2) => all2.indexOf(name3) === at);
|
|
18728
18754
|
const parentSymbol = superId.has(id) ? byId.get(superId.get(id)) : void 0;
|
|
@@ -18734,9 +18760,9 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
18734
18760
|
`${indent2}${shape.attrs}${objcName ? `@objc(${objcName}) ` : ""}${shape.final}${open ? "open" : "public"} class ${shape.name}${shape.generics}${list2.length ? `: ${list2.join(", ")}` : ""}${selfConforming(shape.where)} {`
|
|
18735
18761
|
);
|
|
18736
18762
|
const members2 = membersOf(id);
|
|
18737
|
-
const extra = options.behavior?.get(
|
|
18763
|
+
const extra = options.behavior?.get(path112)?.members;
|
|
18738
18764
|
if (extra) {
|
|
18739
|
-
used.add(
|
|
18765
|
+
used.add(path112);
|
|
18740
18766
|
emit(`${inner}${extra}`);
|
|
18741
18767
|
}
|
|
18742
18768
|
for (const member of members2)
|
|
@@ -18792,11 +18818,11 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
18792
18818
|
if (protocol && member.kind.identifier === "swift.method" && leaf(member).endsWith("()") && have.has(`instance|leaf|${leaf(member).slice(0, -2)}`))
|
|
18793
18819
|
propertyWitnesses.push({
|
|
18794
18820
|
owner: current2,
|
|
18795
|
-
head: `extension ${pathOf(protocol)} where Self: ${
|
|
18821
|
+
head: `extension ${pathOf(protocol)} where Self: ${path112} {`,
|
|
18796
18822
|
member,
|
|
18797
|
-
path:
|
|
18823
|
+
path: path112
|
|
18798
18824
|
});
|
|
18799
|
-
else emitWitness(member, inner,
|
|
18825
|
+
else emitWitness(member, inner, path112, open && isObjC(member));
|
|
18800
18826
|
}
|
|
18801
18827
|
}
|
|
18802
18828
|
if (options.inert && designated2 && classBuild(id) === "hidden")
|
|
@@ -18804,13 +18830,13 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
18804
18830
|
const coder = members2.some((member) => leaf(member) === "init(coder:)");
|
|
18805
18831
|
if (designated2 && !coder && externalRoot(id) !== "NSObject" && externalRoot(id) !== null)
|
|
18806
18832
|
emit(
|
|
18807
|
-
`${inner}public required init${options.coderNonfailable?.has(
|
|
18833
|
+
`${inner}public required init${options.coderNonfailable?.has(path112) ? "" : "?"}(coder: NSCoder) { ${options.inert && !options.coderNonfailable?.has(path112) ? "return nil" : trap(`${path112}.init(coder:)`)} }`
|
|
18808
18834
|
);
|
|
18809
18835
|
if (designated2 && !members2.some((member) => leaf(member) === "init()") && [...superChain(id)].some(
|
|
18810
18836
|
(at) => options.requiredInits?.has(`${pathOf(byId.get(at))}.init()`)
|
|
18811
18837
|
))
|
|
18812
18838
|
emit(
|
|
18813
|
-
`${inner}public required init() { ${options.inert ? superInit(id) : trap(`${
|
|
18839
|
+
`${inner}public required init() { ${options.inert ? superInit(id) : trap(`${path112}.init()`)} }`
|
|
18814
18840
|
);
|
|
18815
18841
|
emit(`${indent2}}`);
|
|
18816
18842
|
return;
|
|
@@ -18818,7 +18844,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
18818
18844
|
case "swift.struct": {
|
|
18819
18845
|
const shape = header(symbol2, "struct", indent2);
|
|
18820
18846
|
if (!shape)
|
|
18821
|
-
return void skipped.push({ path:
|
|
18847
|
+
return void skipped.push({ path: path112, reason: `unparsed struct ${text(symbol2)}` });
|
|
18822
18848
|
const members2 = membersOf(id);
|
|
18823
18849
|
const raw2 = rawType(members2);
|
|
18824
18850
|
const list2 = inheritance(id);
|
|
@@ -18859,7 +18885,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
18859
18885
|
emitInertState(
|
|
18860
18886
|
id,
|
|
18861
18887
|
inner,
|
|
18862
|
-
raw2 ? `self.rawValue = ${inertValue(raw2, /* @__PURE__ */ new Set(), [
|
|
18888
|
+
raw2 ? `self.rawValue = ${inertValue(raw2, /* @__PURE__ */ new Set(), [path112]) ?? "0"}` : ""
|
|
18863
18889
|
);
|
|
18864
18890
|
emit(`${indent2}}`);
|
|
18865
18891
|
return;
|
|
@@ -18867,7 +18893,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
18867
18893
|
case "swift.enum": {
|
|
18868
18894
|
const shape = header(symbol2, "enum", indent2);
|
|
18869
18895
|
if (!shape)
|
|
18870
|
-
return void skipped.push({ path:
|
|
18896
|
+
return void skipped.push({ path: path112, reason: `unparsed enum ${text(symbol2)}` });
|
|
18871
18897
|
const members2 = membersOf(id);
|
|
18872
18898
|
const cases = members2.filter(
|
|
18873
18899
|
(member) => member.kind.identifier === "swift.enum.case"
|
|
@@ -18877,7 +18903,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
18877
18903
|
const missing2 = raw2 ? cases.filter((member) => !values.has(member.identifier.precise)) : [];
|
|
18878
18904
|
if (raw2 && (isObjC(symbol2) || /^c:@C?M@[^@]+@E@/.test(id)) && missing2.length > 0)
|
|
18879
18905
|
return void skipped.push({
|
|
18880
|
-
path:
|
|
18906
|
+
path: path112,
|
|
18881
18907
|
reason: `no header value for ${missing2.map(leaf).join(", ")}`
|
|
18882
18908
|
});
|
|
18883
18909
|
const list2 = inheritance(id, raw2 ?? void 0).filter(
|
|
@@ -18917,8 +18943,8 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
18917
18943
|
});
|
|
18918
18944
|
}
|
|
18919
18945
|
if (options.inert) {
|
|
18920
|
-
const value = options.trapped?.has(hiddenInit(id)) ? null : inertValue(
|
|
18921
|
-
emitInertState(id, inner, value === null ? trap(
|
|
18946
|
+
const value = options.trapped?.has(hiddenInit(id)) ? null : inertValue(path112, /* @__PURE__ */ new Set(), []);
|
|
18947
|
+
emitInertState(id, inner, value === null ? trap(path112) : `self = ${value}`);
|
|
18922
18948
|
}
|
|
18923
18949
|
emit(`${indent2}}`);
|
|
18924
18950
|
return;
|
|
@@ -18927,14 +18953,14 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
18927
18953
|
const shape = header(symbol2, "protocol", indent2);
|
|
18928
18954
|
if (!shape)
|
|
18929
18955
|
return void skipped.push({
|
|
18930
|
-
path:
|
|
18956
|
+
path: path112,
|
|
18931
18957
|
reason: `unparsed protocol ${text(symbol2)}`
|
|
18932
18958
|
});
|
|
18933
18959
|
const native = nativeObjcProtocols.has(id);
|
|
18934
18960
|
const objcName = native ? /^c:objc\(pl\)(\w+)$/.exec(id)?.[1] : void 0;
|
|
18935
18961
|
if (native && !objcName)
|
|
18936
18962
|
return void skipped.push({
|
|
18937
|
-
path:
|
|
18963
|
+
path: path112,
|
|
18938
18964
|
reason: `unknown Objective-C protocol identity ${id}`
|
|
18939
18965
|
});
|
|
18940
18966
|
const list2 = [
|
|
@@ -18962,7 +18988,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
18962
18988
|
}
|
|
18963
18989
|
emit(`${indent2}}`);
|
|
18964
18990
|
if (defaults.length > 0) {
|
|
18965
|
-
emit(`${indent2}extension ${
|
|
18991
|
+
emit(`${indent2}extension ${path112} {`);
|
|
18966
18992
|
for (const member of defaults) {
|
|
18967
18993
|
const decl = text(member);
|
|
18968
18994
|
if (optional3.has(member.identifier.precise) && member.kind.identifier === "swift.method" && !decl.replace(/\([^)]*\)/g, "").includes("->") && !/ async\b/.test(decl))
|
|
@@ -19057,7 +19083,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
19057
19083
|
};
|
|
19058
19084
|
const atWidth = (value, raw2) => (raw2 === "UInt" || raw2 === "Swift.UInt") && value === "18446744073709551615" ? "4294967295" : (raw2 === "Int" || raw2 === "Swift.Int") && value === "9223372036854775807" ? "2147483647" : (raw2 === "Int" || raw2 === "Swift.Int") && value === "-9223372036854775808" ? "-2147483648" : value;
|
|
19059
19085
|
const emitGlobal = scoped((symbol2) => {
|
|
19060
|
-
const
|
|
19086
|
+
const path112 = pathOf(symbol2);
|
|
19061
19087
|
const kind = symbol2.kind.identifier;
|
|
19062
19088
|
if (kind === "swift.func" || kind === "swift.func.op" || kind === "swift.method" || kind === "swift.type.method") {
|
|
19063
19089
|
const { 1: attrs, 2: rest } = LEADING_ATTRS.exec(text(symbol2));
|
|
@@ -19066,20 +19092,20 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
19066
19092
|
if (leaf(symbol2).endsWith("(_:)") && !/^(?:prefix|infix|postfix)\b/.test(spelled2))
|
|
19067
19093
|
spelled2 = `prefix ${spelled2}`;
|
|
19068
19094
|
}
|
|
19069
|
-
const measured = behavior.get(
|
|
19070
|
-
if (measured) used.add(
|
|
19095
|
+
const measured = behavior.get(path112);
|
|
19096
|
+
if (measured) used.add(path112);
|
|
19071
19097
|
const overloadBody = /\basync\b/.test(spelled2) ? measured?.asyncBody : /\bResult</.test(spelled2) ? measured?.resultBody : void 0;
|
|
19072
19098
|
emit(
|
|
19073
|
-
`${attrs}public ${spelled2} { ${overloadBody ?? measured?.body ?? (options.inert ? inertBody(symbol2) : trap(
|
|
19099
|
+
`${attrs}public ${spelled2} { ${overloadBody ?? measured?.body ?? (options.inert ? inertBody(symbol2) : trap(path112))} }`
|
|
19074
19100
|
);
|
|
19075
19101
|
} else if (kind === "swift.var") {
|
|
19076
19102
|
const parsed = splitAccessors(text(symbol2).replace(/^let /, "var "));
|
|
19077
|
-
const measured = behavior.get(
|
|
19078
|
-
if (measured) used.add(
|
|
19103
|
+
const measured = behavior.get(path112);
|
|
19104
|
+
if (measured) used.add(path112);
|
|
19079
19105
|
emit(
|
|
19080
|
-
`public ${parsed.decl} { ${measured?.body ?? (options.inert ? inertBody(symbol2) : trap(
|
|
19106
|
+
`public ${parsed.decl} { ${measured?.body ?? (options.inert ? inertBody(symbol2) : trap(path112))} }`
|
|
19081
19107
|
);
|
|
19082
|
-
} else skipped.push({ path:
|
|
19108
|
+
} else skipped.push({ path: path112, reason: `unhandled top-level ${kind}` });
|
|
19083
19109
|
});
|
|
19084
19110
|
const cExports = new Set(
|
|
19085
19111
|
[...byId.values()].flatMap((symbol2) => {
|
|
@@ -19096,7 +19122,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
19096
19122
|
return !name3 || !cExports.has(`${name3}|${text(symbol2)}`);
|
|
19097
19123
|
}).sort((a, b) => pathOf(a).localeCompare(pathOf(b)));
|
|
19098
19124
|
for (const symbol2 of roots) {
|
|
19099
|
-
const
|
|
19125
|
+
const path112 = pathOf(symbol2);
|
|
19100
19126
|
if (TYPE_KINDS.has(symbol2.kind.identifier)) emitType(symbol2, "");
|
|
19101
19127
|
else emitGlobal(symbol2);
|
|
19102
19128
|
}
|
|
@@ -19157,9 +19183,9 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
19157
19183
|
"#endif",
|
|
19158
19184
|
""
|
|
19159
19185
|
];
|
|
19160
|
-
for (const
|
|
19161
|
-
if (!used.has(
|
|
19162
|
-
skipped.push({ path:
|
|
19186
|
+
for (const path112 of behavior.keys())
|
|
19187
|
+
if (!used.has(path112))
|
|
19188
|
+
skipped.push({ path: path112, reason: "behavior names no emitted declaration" });
|
|
19163
19189
|
return {
|
|
19164
19190
|
source: `${[...banner, ...lines].join("\n")}
|
|
19165
19191
|
`,
|
|
@@ -21362,9 +21388,9 @@ function originalColumn(line, column) {
|
|
|
21362
21388
|
}
|
|
21363
21389
|
function designTimeDiagnostic(output2, files2) {
|
|
21364
21390
|
const rewritten = /* @__PURE__ */ new Map();
|
|
21365
|
-
const linesOf = (
|
|
21391
|
+
const linesOf = (path112) => {
|
|
21366
21392
|
const file = Object.keys(files2).find(
|
|
21367
|
-
(name3) => name3.endsWith(".swift") && (
|
|
21393
|
+
(name3) => name3.endsWith(".swift") && (path112 === name3 || path112.endsWith(`/${name3}`))
|
|
21368
21394
|
);
|
|
21369
21395
|
if (file === void 0) return null;
|
|
21370
21396
|
let lines = rewritten.get(file);
|
|
@@ -33014,7 +33040,7 @@ int EXUpdatesApplyBSDiffPatch(const char * _Nonnull oldFilePath,
|
|
|
33014
33040
|
REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
33015
33041
|
MULTI_MANIFEST_VERSION = 68;
|
|
33016
33042
|
SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
|
|
33017
|
-
compilerSourceDigest = true ? "
|
|
33043
|
+
compilerSourceDigest = true ? "4646bbe2e0cd2e48e498f51fd3d0d5ea29ecd5e6163fdf3afe8d64d4368022d7" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
|
|
33018
33044
|
nativeCxxCompilerFlags = ["-fno-cxx-modules"];
|
|
33019
33045
|
cFlagArray = (flags) => JSON.stringify(withoutGlogModuleMap(flags));
|
|
33020
33046
|
cxxFlagArray = (flags) => JSON.stringify([...nativeCxxCompilerFlags, ...withoutGlogModuleMap(flags)]);
|
|
@@ -37475,7 +37501,7 @@ var init_swift_standin_digest = __esm({
|
|
|
37475
37501
|
STANDIN_DIGEST_ENTRYPOINTS = ["swift-standins.ts", "swift-objc-compile.ts"];
|
|
37476
37502
|
SPECIFIER = /from\s*['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
37477
37503
|
standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
|
|
37478
|
-
STANDIN_SOURCE_DIGEST = true ? "
|
|
37504
|
+
STANDIN_SOURCE_DIGEST = true ? "f077081111b09ca27482cd53be422dae6cd1bd3a5fd2b2bdef48a83a9c0d6ca8" : standinSourceDigest();
|
|
37479
37505
|
}
|
|
37480
37506
|
});
|
|
37481
37507
|
|
|
@@ -37747,9 +37773,9 @@ async function packageTreeDigest(root) {
|
|
|
37747
37773
|
(a, b) => a.name.localeCompare(b.name)
|
|
37748
37774
|
)) {
|
|
37749
37775
|
if (entry.name === "node_modules") continue;
|
|
37750
|
-
const
|
|
37751
|
-
if (entry.isDirectory()) walk3((0, import_node_path66.join)(directory2, entry.name), `${
|
|
37752
|
-
else if (entry.isFile()) files2.push(
|
|
37776
|
+
const path112 = `${relative4}${entry.name}`;
|
|
37777
|
+
if (entry.isDirectory()) walk3((0, import_node_path66.join)(directory2, entry.name), `${path112}/`);
|
|
37778
|
+
else if (entry.isFile()) files2.push(path112);
|
|
37753
37779
|
}
|
|
37754
37780
|
};
|
|
37755
37781
|
walk3(root, "");
|
|
@@ -38817,7 +38843,7 @@ function resolveSwiftPackages(options) {
|
|
|
38817
38843
|
headers.set(name3, import_node_path71.default.relative(binary2.dir, dir));
|
|
38818
38844
|
};
|
|
38819
38845
|
visit3(pkg, binary2.target);
|
|
38820
|
-
binary2.headerDependencies = [...headers].map(([module2,
|
|
38846
|
+
binary2.headerDependencies = [...headers].map(([module2, path112]) => ({ module: module2, path: path112 }));
|
|
38821
38847
|
}
|
|
38822
38848
|
for (const owner of options.owners ?? []) {
|
|
38823
38849
|
const found = productClosure(owner.products);
|
|
@@ -39551,8 +39577,8 @@ function withBuiltinStandinBehavior(behavior) {
|
|
|
39551
39577
|
for (const [module2, members2] of Object.entries(BUILTIN_STANDIN_BEHAVIOR))
|
|
39552
39578
|
merged[module2] = {
|
|
39553
39579
|
...Object.fromEntries(
|
|
39554
|
-
Object.entries(members2).map(([
|
|
39555
|
-
|
|
39580
|
+
Object.entries(members2).map(([path112, entry]) => [
|
|
39581
|
+
path112,
|
|
39556
39582
|
{ ...entry, builtin: true }
|
|
39557
39583
|
])
|
|
39558
39584
|
),
|
|
@@ -43642,8 +43668,8 @@ function imagesetFiles(images) {
|
|
|
43642
43668
|
];
|
|
43643
43669
|
}).sort((a, b) => a.scale - b.scale);
|
|
43644
43670
|
}
|
|
43645
|
-
function flatScale(
|
|
43646
|
-
const match = /@([23])x\.[^./]+$/.exec(
|
|
43671
|
+
function flatScale(path112) {
|
|
43672
|
+
const match = /@([23])x\.[^./]+$/.exec(path112);
|
|
43647
43673
|
return match ? Number(match[1]) : 1;
|
|
43648
43674
|
}
|
|
43649
43675
|
function providesNamespace(text6) {
|
|
@@ -43670,8 +43696,8 @@ function catalogEntryName(contentsPath, kind, readText) {
|
|
|
43670
43696
|
}
|
|
43671
43697
|
return segments.join("/");
|
|
43672
43698
|
}
|
|
43673
|
-
function isFlatResourceImage(
|
|
43674
|
-
return
|
|
43699
|
+
function isFlatResourceImage(path112) {
|
|
43700
|
+
return path112.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path112));
|
|
43675
43701
|
}
|
|
43676
43702
|
function enumerateBundleImages(paths, readText, bundleForFile = () => ".") {
|
|
43677
43703
|
const table = [];
|
|
@@ -43684,7 +43710,7 @@ function enumerateBundleImages(paths, readText, bundleForFile = () => ".") {
|
|
|
43684
43710
|
seen.set(bundlePath, names);
|
|
43685
43711
|
return { bundlePath, names };
|
|
43686
43712
|
};
|
|
43687
|
-
const catalogs = paths.filter((
|
|
43713
|
+
const catalogs = paths.filter((path112) => baseOf(path112) === "Contents.json");
|
|
43688
43714
|
for (const contentsPath of catalogs) {
|
|
43689
43715
|
const name3 = catalogEntryName(contentsPath, ".imageset", readText);
|
|
43690
43716
|
if (name3 === null) continue;
|
|
@@ -43716,13 +43742,13 @@ function enumerateBundleImages(paths, readText, bundleForFile = () => ".") {
|
|
|
43716
43742
|
...intent === "template" || intent === "original" ? { renderingMode: intent } : {}
|
|
43717
43743
|
});
|
|
43718
43744
|
}
|
|
43719
|
-
for (const
|
|
43720
|
-
if (!isFlatResourceImage(
|
|
43721
|
-
const name3 = baseOf(
|
|
43722
|
-
const { bundlePath, names } = namesFor(
|
|
43745
|
+
for (const path112 of paths) {
|
|
43746
|
+
if (!isFlatResourceImage(path112)) continue;
|
|
43747
|
+
const name3 = baseOf(path112).slice(0, -extOf(path112).length);
|
|
43748
|
+
const { bundlePath, names } = namesFor(path112);
|
|
43723
43749
|
if (name3 === "" || names.has(name3)) continue;
|
|
43724
43750
|
names.add(name3);
|
|
43725
|
-
table.push({ name: name3, file:
|
|
43751
|
+
table.push({ name: name3, file: path112, scale: flatScale(path112), bundlePath });
|
|
43726
43752
|
}
|
|
43727
43753
|
return table;
|
|
43728
43754
|
}
|
|
@@ -43757,7 +43783,7 @@ function colorsetValue(color) {
|
|
|
43757
43783
|
}
|
|
43758
43784
|
function enumerateBundleColors(paths, readText) {
|
|
43759
43785
|
const table = {};
|
|
43760
|
-
for (const contentsPath of paths.filter((
|
|
43786
|
+
for (const contentsPath of paths.filter((path112) => baseOf(path112) === "Contents.json")) {
|
|
43761
43787
|
const name3 = catalogEntryName(contentsPath, ".colorset", readText);
|
|
43762
43788
|
if (name3 === null || name3 in table) continue;
|
|
43763
43789
|
let colors;
|
|
@@ -43821,8 +43847,8 @@ function axisExtremes(points) {
|
|
|
43821
43847
|
function pathBounds(d) {
|
|
43822
43848
|
const xs = [];
|
|
43823
43849
|
const ys = [];
|
|
43824
|
-
for (const
|
|
43825
|
-
(0, import_svgpath.default)(
|
|
43850
|
+
for (const path112 of d)
|
|
43851
|
+
(0, import_svgpath.default)(path112).abs().unshort().unarc().iterate((segment, _index, x, y) => {
|
|
43826
43852
|
const [command, ...args] = segment;
|
|
43827
43853
|
if (command === "M" || command === "L") {
|
|
43828
43854
|
xs.push(Number(args[0]));
|
|
@@ -43849,7 +43875,7 @@ function guide(svg, id, axis) {
|
|
|
43849
43875
|
}
|
|
43850
43876
|
function enumerateBundleSymbols(paths, readText, bundleForFile) {
|
|
43851
43877
|
const table = {};
|
|
43852
|
-
for (const contentsPath of paths.filter((
|
|
43878
|
+
for (const contentsPath of paths.filter((path112) => baseOf(path112) === "Contents.json")) {
|
|
43853
43879
|
const name3 = catalogEntryName(contentsPath, ".symbolset", readText);
|
|
43854
43880
|
if (name3 === null) continue;
|
|
43855
43881
|
const bundle = bundleForFile(contentsPath);
|
|
@@ -43908,8 +43934,8 @@ function enumerateBundleSymbols(paths, readText, bundleForFile) {
|
|
|
43908
43934
|
advance,
|
|
43909
43935
|
box: [12 - wide / 2, 12 - tall / 2, wide, tall],
|
|
43910
43936
|
...customLayout ? { customLayout } : {},
|
|
43911
|
-
layers: d.map((
|
|
43912
|
-
d: (0, import_svgpath.default)(
|
|
43937
|
+
layers: d.map((path112) => ({
|
|
43938
|
+
d: (0, import_svgpath.default)(path112).abs().scale(em).translate(translateX, translateY).round(3).toString()
|
|
43913
43939
|
}))
|
|
43914
43940
|
};
|
|
43915
43941
|
table[vectorKey] = vector;
|
|
@@ -43920,18 +43946,18 @@ function enumerateBundleSymbols(paths, readText, bundleForFile) {
|
|
|
43920
43946
|
}
|
|
43921
43947
|
return table;
|
|
43922
43948
|
}
|
|
43923
|
-
function isCopiedResource(
|
|
43924
|
-
if (copiedBundle ||
|
|
43949
|
+
function isCopiedResource(path112, copiedBundle) {
|
|
43950
|
+
if (copiedBundle || path112.split("/").some((segment) => /\.(atlasc|bundle|storyboardc|nib)$/.test(segment)))
|
|
43925
43951
|
return true;
|
|
43926
|
-
const ext = extOf(
|
|
43952
|
+
const ext = extOf(path112);
|
|
43927
43953
|
if (ext === ".json" || ext === ".xcstrings") return true;
|
|
43928
|
-
return !RASTER_EXTENSIONS.has(ext) && !COMPILED_EXTENSIONS.has(ext) && !
|
|
43954
|
+
return !RASTER_EXTENSIONS.has(ext) && !COMPILED_EXTENSIONS.has(ext) && !path112.split("/").some((segment) => segment.endsWith(".xcassets"));
|
|
43929
43955
|
}
|
|
43930
43956
|
function enumerateBundleResources(paths, copiedBundle = false) {
|
|
43931
43957
|
const found = [];
|
|
43932
43958
|
const seen = /* @__PURE__ */ new Set();
|
|
43933
43959
|
const ordered = [...paths].filter(
|
|
43934
|
-
(
|
|
43960
|
+
(path112) => path112.split("/").includes("Resources") && path112.split("/").every((segment) => segment !== "" && segment !== "..") && isCopiedResource(path112, copiedBundle)
|
|
43935
43961
|
).sort((a, b) => {
|
|
43936
43962
|
const aDepth = a.split("/").length;
|
|
43937
43963
|
const bDepth = b.split("/").length;
|
|
@@ -44077,31 +44103,31 @@ function tokens(text6) {
|
|
|
44077
44103
|
}
|
|
44078
44104
|
return result;
|
|
44079
44105
|
}
|
|
44080
|
-
function qualified(language, key2,
|
|
44081
|
-
return `(${language}: ${key2}${
|
|
44106
|
+
function qualified(language, key2, path112) {
|
|
44107
|
+
return `(${language}: ${key2}${path112 === "" ? "" : "|==|" + path112})`;
|
|
44082
44108
|
}
|
|
44083
|
-
function requiresNumber(language, key2,
|
|
44109
|
+
function requiresNumber(language, key2, path112) {
|
|
44084
44110
|
return Error(
|
|
44085
|
-
"Plural variation requires referencing the number in the string. To maintain grammatical correctness for strings that do not reference the number of items, use separate top-level strings for one and greater than one. " + qualified(language, key2,
|
|
44111
|
+
"Plural variation requires referencing the number in the string. To maintain grammatical correctness for strings that do not reference the number of items, use separate top-level strings for one and greater than one. " + qualified(language, key2, path112)
|
|
44086
44112
|
);
|
|
44087
44113
|
}
|
|
44088
|
-
function moreThanOne(language, key2,
|
|
44114
|
+
function moreThanOne(language, key2, path112) {
|
|
44089
44115
|
return Error(
|
|
44090
|
-
"Cannot infer format specifier for string group because more than one numerical specifier was found " + qualified(language, key2,
|
|
44116
|
+
"Cannot infer format specifier for string group because more than one numerical specifier was found " + qualified(language, key2, path112)
|
|
44091
44117
|
);
|
|
44092
44118
|
}
|
|
44093
44119
|
function schemaPath(segments) {
|
|
44094
44120
|
return segments.map((segment) => `'${segment}'`).join(" -> ");
|
|
44095
44121
|
}
|
|
44096
|
-
function checkUnitShape(node,
|
|
44122
|
+
function checkUnitShape(node, path112) {
|
|
44097
44123
|
const raw2 = node.stringUnit;
|
|
44098
44124
|
if (raw2 === void 0)
|
|
44099
|
-
throw Error(`Missing required key 'stringUnit' inside ${schemaPath(
|
|
44125
|
+
throw Error(`Missing required key 'stringUnit' inside ${schemaPath(path112)}`);
|
|
44100
44126
|
if (raw2 === null)
|
|
44101
|
-
throw Error(`Missing required value for key 'stringUnit' inside ${schemaPath(
|
|
44127
|
+
throw Error(`Missing required value for key 'stringUnit' inside ${schemaPath(path112)}`);
|
|
44102
44128
|
if (!isRecord3(raw2))
|
|
44103
|
-
throw Error(`Expected dictionary for key 'stringUnit' inside ${schemaPath(
|
|
44104
|
-
const unitPath = [...
|
|
44129
|
+
throw Error(`Expected dictionary for key 'stringUnit' inside ${schemaPath(path112)}`);
|
|
44130
|
+
const unitPath = [...path112, "stringUnit"];
|
|
44105
44131
|
if (!Object.hasOwn(raw2, "state"))
|
|
44106
44132
|
throw Error(`Missing required key 'state' inside ${schemaPath(unitPath)}`);
|
|
44107
44133
|
const state = raw2.state;
|
|
@@ -44118,38 +44144,38 @@ function checkUnitShape(node, path111) {
|
|
|
44118
44144
|
throw Error(`Expected string for key 'value' inside ${schemaPath(unitPath)}`);
|
|
44119
44145
|
return value;
|
|
44120
44146
|
}
|
|
44121
|
-
function checkPluralShape(node,
|
|
44147
|
+
function checkPluralShape(node, path112) {
|
|
44122
44148
|
for (const [category, raw2] of Object.entries(node)) {
|
|
44123
|
-
const categoryPath = [...
|
|
44149
|
+
const categoryPath = [...path112, category];
|
|
44124
44150
|
if (raw2 === null)
|
|
44125
44151
|
throw Error(
|
|
44126
|
-
`Missing required value for key '${category}' inside ${schemaPath(
|
|
44152
|
+
`Missing required value for key '${category}' inside ${schemaPath(path112)}`
|
|
44127
44153
|
);
|
|
44128
44154
|
if (!isRecord3(raw2))
|
|
44129
|
-
throw Error(`Expected dictionary for key '${category}' inside ${schemaPath(
|
|
44155
|
+
throw Error(`Expected dictionary for key '${category}' inside ${schemaPath(path112)}`);
|
|
44130
44156
|
checkUnitShape(raw2, categoryPath);
|
|
44131
44157
|
}
|
|
44132
44158
|
}
|
|
44133
|
-
function checkLocalizationShape(node,
|
|
44159
|
+
function checkLocalizationShape(node, path112, deviceValue = false) {
|
|
44134
44160
|
if (node === null)
|
|
44135
44161
|
throw Error(
|
|
44136
|
-
`Missing required value for key '${
|
|
44162
|
+
`Missing required value for key '${path112[path112.length - 1]}' inside ${schemaPath(path112.slice(0, -1))}`
|
|
44137
44163
|
);
|
|
44138
44164
|
if (!isRecord3(node))
|
|
44139
44165
|
throw Error(
|
|
44140
|
-
`Expected dictionary for key '${
|
|
44166
|
+
`Expected dictionary for key '${path112[path112.length - 1]}' inside ${schemaPath(path112.slice(0, -1))}`
|
|
44141
44167
|
);
|
|
44142
|
-
if (Object.hasOwn(node, "variations")) checkVariationsShape(node.variations,
|
|
44168
|
+
if (Object.hasOwn(node, "variations")) checkVariationsShape(node.variations, path112);
|
|
44143
44169
|
if (!deviceValue && Object.hasOwn(node, "substitutions"))
|
|
44144
|
-
checkSubstitutionsShape(node.substitutions,
|
|
44145
|
-
if (!Object.hasOwn(node, "variations")) checkUnitShape(node,
|
|
44170
|
+
checkSubstitutionsShape(node.substitutions, path112);
|
|
44171
|
+
if (!Object.hasOwn(node, "variations")) checkUnitShape(node, path112);
|
|
44146
44172
|
}
|
|
44147
|
-
function checkVariationsShape(variations,
|
|
44173
|
+
function checkVariationsShape(variations, path112) {
|
|
44148
44174
|
if (variations === null)
|
|
44149
|
-
throw Error(`Missing required value for key 'variations' inside ${schemaPath(
|
|
44175
|
+
throw Error(`Missing required value for key 'variations' inside ${schemaPath(path112)}`);
|
|
44150
44176
|
if (!isRecord3(variations))
|
|
44151
|
-
throw Error(`Expected dictionary for key 'variations' inside ${schemaPath(
|
|
44152
|
-
const variationsPath = [...
|
|
44177
|
+
throw Error(`Expected dictionary for key 'variations' inside ${schemaPath(path112)}`);
|
|
44178
|
+
const variationsPath = [...path112, "variations"];
|
|
44153
44179
|
for (const [type, raw2] of Object.entries(variations)) {
|
|
44154
44180
|
if (raw2 === null)
|
|
44155
44181
|
throw Error(
|
|
@@ -44175,11 +44201,11 @@ function checkVariationsShape(variations, path111) {
|
|
|
44175
44201
|
}
|
|
44176
44202
|
}
|
|
44177
44203
|
}
|
|
44178
|
-
function checkSubstitutionsShape(substitutions,
|
|
44204
|
+
function checkSubstitutionsShape(substitutions, path112) {
|
|
44179
44205
|
if (substitutions === null) return;
|
|
44180
44206
|
if (!isRecord3(substitutions))
|
|
44181
|
-
throw Error(`Expected dictionary for key 'substitutions' inside ${schemaPath(
|
|
44182
|
-
const substitutionsPath = [...
|
|
44207
|
+
throw Error(`Expected dictionary for key 'substitutions' inside ${schemaPath(path112)}`);
|
|
44208
|
+
const substitutionsPath = [...path112, "substitutions"];
|
|
44183
44209
|
for (const [name3, raw2] of Object.entries(substitutions)) {
|
|
44184
44210
|
const subPath = [...substitutionsPath, name3];
|
|
44185
44211
|
if (raw2 === null)
|
|
@@ -44221,10 +44247,10 @@ function scanSpecs(forms) {
|
|
|
44221
44247
|
}
|
|
44222
44248
|
return specs;
|
|
44223
44249
|
}
|
|
44224
|
-
function inferPlural(forms, language, key2,
|
|
44250
|
+
function inferPlural(forms, language, key2, path112) {
|
|
44225
44251
|
const specs = scanSpecs(forms);
|
|
44226
|
-
if (specs.size === 0) throw requiresNumber(language, key2,
|
|
44227
|
-
if (specs.size > 1) throw moreThanOne(language, key2,
|
|
44252
|
+
if (specs.size === 0) throw requiresNumber(language, key2, path112);
|
|
44253
|
+
if (specs.size > 1) throw moreThanOne(language, key2, path112);
|
|
44228
44254
|
return [...specs.values()][0] ?? { specifier: "", argument: 0 };
|
|
44229
44255
|
}
|
|
44230
44256
|
function unit(value) {
|
|
@@ -44693,8 +44719,8 @@ function plist4(value, depth) {
|
|
|
44693
44719
|
}
|
|
44694
44720
|
function compileStringCatalog(source, name3) {
|
|
44695
44721
|
return Object.fromEntries(
|
|
44696
|
-
Object.entries(compileCatalogTables(source, name3)).map(([
|
|
44697
|
-
|
|
44722
|
+
Object.entries(compileCatalogTables(source, name3)).map(([path112, table]) => [
|
|
44723
|
+
path112,
|
|
44698
44724
|
'<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n<plist version="1.0">\n' + plist4(table, 0) + "</plist>\n"
|
|
44699
44725
|
])
|
|
44700
44726
|
);
|
|
@@ -45918,8 +45944,8 @@ function sourceEntryPath() {
|
|
|
45918
45944
|
return null;
|
|
45919
45945
|
}
|
|
45920
45946
|
}
|
|
45921
|
-
function isCliEntry(
|
|
45922
|
-
const name3 = (0, import_node_path81.basename)(
|
|
45947
|
+
function isCliEntry(path112) {
|
|
45948
|
+
const name3 = (0, import_node_path81.basename)(path112);
|
|
45923
45949
|
return name3 === "bin.ts" || name3 === "bin.js";
|
|
45924
45950
|
}
|
|
45925
45951
|
function rnxSelfInvocation() {
|
|
@@ -50860,11 +50886,11 @@ function stringList(value) {
|
|
|
50860
50886
|
function externalSpecMembers(root, requested) {
|
|
50861
50887
|
const children = (spec) => Array.isArray(spec.subspecs) ? spec.subspecs.filter(object5) : [];
|
|
50862
50888
|
const chains = /* @__PURE__ */ new Map();
|
|
50863
|
-
const select = (
|
|
50864
|
-
const key2 =
|
|
50889
|
+
const select = (path112) => {
|
|
50890
|
+
const key2 = path112.join("/");
|
|
50865
50891
|
if (chains.has(key2)) return;
|
|
50866
50892
|
const chain = [root];
|
|
50867
|
-
for (const part of
|
|
50893
|
+
for (const part of path112) {
|
|
50868
50894
|
const child = children(chain.at(-1)).find((sub) => sub.name === part);
|
|
50869
50895
|
if (!child) throw new Error(`${String(root.name)} has no subspec ${key2}`);
|
|
50870
50896
|
chain.push(child);
|
|
@@ -50873,7 +50899,7 @@ function externalSpecMembers(root, requested) {
|
|
|
50873
50899
|
const spec = chain.at(-1);
|
|
50874
50900
|
const defaults = stringList(spec.default_subspecs ?? spec.default_subspec);
|
|
50875
50901
|
const activated = defaults[0] === "none" ? [] : defaults.length > 0 ? defaults : children(spec).map((sub) => String(sub.name));
|
|
50876
|
-
for (const name3 of activated) select([...
|
|
50902
|
+
for (const name3 of activated) select([...path112, ...name3.split("/")]);
|
|
50877
50903
|
for (const member of chain)
|
|
50878
50904
|
for (const dependencies of [member.dependencies, iosOf(member)?.dependencies])
|
|
50879
50905
|
for (const dependency of object5(dependencies) ? Object.keys(dependencies) : []) {
|
|
@@ -53898,7 +53924,7 @@ var init_nitro_superset = __esm({
|
|
|
53898
53924
|
init_nitroContract();
|
|
53899
53925
|
init_swift_standin_digest();
|
|
53900
53926
|
NITRO_SUPERSET_ENTRY_NAME = "superset";
|
|
53901
|
-
NITRO_COMPILER_DIGEST = true ? "
|
|
53927
|
+
NITRO_COMPILER_DIGEST = true ? "d738b6ab8d9565d2ed45147861078597c0ce97c0b2f9eccb844e3b6bbf98cc62" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
|
|
53902
53928
|
nitroSupersetLock = parseLock(nitro_superset_lock_default);
|
|
53903
53929
|
nitroSupersetKey = (inputs) => nativeEntryKey({ ...inputs, compiler: NITRO_COMPILER_DIGEST });
|
|
53904
53930
|
published2 = /* @__PURE__ */ new Map();
|
|
@@ -53919,7 +53945,7 @@ var init_nitro_superset = __esm({
|
|
|
53919
53945
|
var runtime_companion_default;
|
|
53920
53946
|
var init_runtime_companion = __esm({
|
|
53921
53947
|
"runtime-companion.json"() {
|
|
53922
|
-
runtime_companion_default = { abi: 1, sha256: "
|
|
53948
|
+
runtime_companion_default = { abi: 1, sha256: "1c15d055a3e1e68a17d3f735cd1c592fdc418c85e781e44abf4f4aa0b1215b52", file: "node/cli-1c15d055a3e1e68a17d3f735cd1c592fdc418c85e781e44abf4f4aa0b1215b52.cjs" };
|
|
53923
53949
|
}
|
|
53924
53950
|
});
|
|
53925
53951
|
|
|
@@ -54115,10 +54141,10 @@ __export(optional_demo_registry_exports, {
|
|
|
54115
54141
|
function findInternalDemoRegistry(startDir) {
|
|
54116
54142
|
let dir = startDir;
|
|
54117
54143
|
for (let step = 0; step < MAX_ANCESTOR_STEPS; step++) {
|
|
54118
|
-
if ((0,
|
|
54119
|
-
const candidate = (0,
|
|
54120
|
-
if ((0,
|
|
54121
|
-
const parent = (0,
|
|
54144
|
+
if ((0, import_node_path105.basename)(dir) === "node_modules") return null;
|
|
54145
|
+
const candidate = (0, import_node_path105.join)(dir, REGISTRY_REPO_PATH);
|
|
54146
|
+
if ((0, import_node_fs104.existsSync)(candidate)) return candidate;
|
|
54147
|
+
const parent = (0, import_node_path105.dirname)(dir);
|
|
54122
54148
|
if (parent === dir) return null;
|
|
54123
54149
|
dir = parent;
|
|
54124
54150
|
}
|
|
@@ -54126,7 +54152,7 @@ function findInternalDemoRegistry(startDir) {
|
|
|
54126
54152
|
}
|
|
54127
54153
|
async function loadOptionalDemoApps() {
|
|
54128
54154
|
if (cached2) return cached2;
|
|
54129
|
-
const registryPath = findInternalDemoRegistry((0,
|
|
54155
|
+
const registryPath = findInternalDemoRegistry((0, import_node_path105.dirname)((0, import_node_url7.fileURLToPath)(__sootsim_import_meta_url)));
|
|
54130
54156
|
if (!registryPath) {
|
|
54131
54157
|
cached2 = [];
|
|
54132
54158
|
return cached2;
|
|
@@ -54145,13 +54171,13 @@ async function loadOptionalDemoApps() {
|
|
|
54145
54171
|
function optionalDemoAppsSync() {
|
|
54146
54172
|
return cached2 ?? [];
|
|
54147
54173
|
}
|
|
54148
|
-
var
|
|
54174
|
+
var import_node_fs104, import_node_path105, import_node_url7, REGISTRY_REPO_PATH, MAX_ANCESTOR_STEPS, cached2;
|
|
54149
54175
|
var init_optional_demo_registry = __esm({
|
|
54150
54176
|
"scripts/optional-demo-registry.ts"() {
|
|
54151
54177
|
"use strict";
|
|
54152
54178
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
54153
|
-
|
|
54154
|
-
|
|
54179
|
+
import_node_fs104 = require("node:fs");
|
|
54180
|
+
import_node_path105 = require("node:path");
|
|
54155
54181
|
import_node_url7 = require("node:url");
|
|
54156
54182
|
REGISTRY_REPO_PATH = "packages/peachsim/scripts/demo-app-registry.ts";
|
|
54157
54183
|
MAX_ANCESTOR_STEPS = 8;
|
|
@@ -54240,7 +54266,7 @@ var init_androidAutolinkingContract = __esm({
|
|
|
54240
54266
|
|
|
54241
54267
|
// src/android-autolinking.ts
|
|
54242
54268
|
async function resolveExpoAndroidAutolinking(appRoot) {
|
|
54243
|
-
const root =
|
|
54269
|
+
const root = import_node_fs115.default.realpathSync(appRoot);
|
|
54244
54270
|
const existing = resolving.get(root);
|
|
54245
54271
|
if (existing) return existing;
|
|
54246
54272
|
const pending = resolveAndroidModules(root);
|
|
@@ -54254,7 +54280,7 @@ async function resolveExpoAndroidAutolinking(appRoot) {
|
|
|
54254
54280
|
async function resolveAndroidModules(appRoot) {
|
|
54255
54281
|
let autolinker;
|
|
54256
54282
|
try {
|
|
54257
|
-
autolinker = (0, import_node_module18.createRequire)(
|
|
54283
|
+
autolinker = (0, import_node_module18.createRequire)(import_node_path117.default.join(appRoot, "package.json")).resolve(
|
|
54258
54284
|
"expo-modules-autolinking/package.json"
|
|
54259
54285
|
);
|
|
54260
54286
|
} catch (error) {
|
|
@@ -54264,7 +54290,7 @@ async function resolveAndroidModules(appRoot) {
|
|
|
54264
54290
|
const { stdout } = await run8(
|
|
54265
54291
|
process.execPath,
|
|
54266
54292
|
[
|
|
54267
|
-
|
|
54293
|
+
import_node_path117.default.join(import_node_path117.default.dirname(autolinker), "bin/expo-modules-autolinking.js"),
|
|
54268
54294
|
"resolve",
|
|
54269
54295
|
"--platform",
|
|
54270
54296
|
"android",
|
|
@@ -54317,15 +54343,15 @@ async function resolveReactNativeAndroidAutolinking(appRoot) {
|
|
|
54317
54343
|
}
|
|
54318
54344
|
return linked;
|
|
54319
54345
|
}
|
|
54320
|
-
var import_node_child_process51,
|
|
54346
|
+
var import_node_child_process51, import_node_fs115, import_node_module18, import_node_path117, import_node_util18, run8, resolving;
|
|
54321
54347
|
var init_android_autolinking = __esm({
|
|
54322
54348
|
"src/android-autolinking.ts"() {
|
|
54323
54349
|
"use strict";
|
|
54324
54350
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
54325
54351
|
import_node_child_process51 = require("node:child_process");
|
|
54326
|
-
|
|
54352
|
+
import_node_fs115 = __toESM(require("node:fs"), 1);
|
|
54327
54353
|
import_node_module18 = require("node:module");
|
|
54328
|
-
|
|
54354
|
+
import_node_path117 = __toESM(require("node:path"), 1);
|
|
54329
54355
|
import_node_util18 = require("node:util");
|
|
54330
54356
|
init_androidAutolinkingContract();
|
|
54331
54357
|
init_forked_script_contract();
|
|
@@ -54345,25 +54371,25 @@ async function resolveAndroidGradleSources(request) {
|
|
|
54345
54371
|
let { root } = request;
|
|
54346
54372
|
const { projects: projectDirs, variant: variant2 } = request;
|
|
54347
54373
|
if (projectDirs.length === 0) return [];
|
|
54348
|
-
if (!
|
|
54374
|
+
if (!import_node_path118.default.isAbsolute(root) || projectDirs.some((dir) => !import_node_path118.default.isAbsolute(dir)))
|
|
54349
54375
|
throw new Error("Android Gradle source selection requires absolute project paths");
|
|
54350
54376
|
if (!variant2) throw new Error("Android Gradle source selection requires a variant");
|
|
54351
|
-
root =
|
|
54352
|
-
const projects2 = [...new Set(projectDirs.map((dir) =>
|
|
54353
|
-
const parent =
|
|
54354
|
-
|
|
54355
|
-
const work =
|
|
54377
|
+
root = import_node_fs116.default.realpathSync(root);
|
|
54378
|
+
const projects2 = [...new Set(projectDirs.map((dir) => import_node_fs116.default.realpathSync(dir)))];
|
|
54379
|
+
const parent = import_node_path118.default.join(kotlinHome(), "gradle-sources");
|
|
54380
|
+
import_node_fs116.default.mkdirSync(parent, { recursive: true });
|
|
54381
|
+
const work = import_node_fs116.default.mkdtempSync(import_node_path118.default.join(parent, ".query-"));
|
|
54356
54382
|
const task = `peachAndroidSources${(0, import_node_crypto59.randomBytes)(8).toString("hex")}`;
|
|
54357
|
-
const script =
|
|
54383
|
+
const script = import_node_path118.default.join(work, "sources.gradle");
|
|
54358
54384
|
const encoded = Buffer.from(
|
|
54359
54385
|
JSON.stringify({ root, projects: projects2, variant: variant2, output: work, task })
|
|
54360
54386
|
).toString("base64");
|
|
54361
|
-
|
|
54387
|
+
import_node_fs116.default.writeFileSync(script, modelQuery.replace("__PEACH_REQUEST__", encoded));
|
|
54362
54388
|
try {
|
|
54363
54389
|
await run9(
|
|
54364
54390
|
"bash",
|
|
54365
54391
|
[
|
|
54366
|
-
|
|
54392
|
+
import_node_path118.default.join(root, "gradlew"),
|
|
54367
54393
|
"--init-script",
|
|
54368
54394
|
script,
|
|
54369
54395
|
`${task}All`,
|
|
@@ -54382,13 +54408,13 @@ async function resolveAndroidGradleSources(request) {
|
|
|
54382
54408
|
);
|
|
54383
54409
|
return projects2.map((projectDir, index) => {
|
|
54384
54410
|
const value = JSON.parse(
|
|
54385
|
-
|
|
54411
|
+
import_node_fs116.default.readFileSync(import_node_path118.default.join(work, `${index}.json`), "utf8")
|
|
54386
54412
|
);
|
|
54387
54413
|
if (!isRecord(value) || value.projectDir !== projectDir || value.variant !== variant2 || typeof value.projectPath !== "string" || value.applicationId !== null && typeof value.applicationId !== "string" || typeof value.namespace !== "string" || !value.namespace || value.targetSdk !== null && (typeof value.targetSdk !== "number" || !Number.isInteger(value.targetSdk) || value.targetSdk <= 0))
|
|
54388
54414
|
throw new Error("Gradle printed an invalid Android project source model");
|
|
54389
54415
|
const sources = (field) => {
|
|
54390
54416
|
const list2 = value[field];
|
|
54391
|
-
if (!Array.isArray(list2) || !list2.every((file) => typeof file === "string" &&
|
|
54417
|
+
if (!Array.isArray(list2) || !list2.every((file) => typeof file === "string" && import_node_path118.default.isAbsolute(file)))
|
|
54392
54418
|
throw new Error(`Gradle printed invalid Android ${field} source paths`);
|
|
54393
54419
|
return list2.map(String);
|
|
54394
54420
|
};
|
|
@@ -54423,18 +54449,18 @@ async function resolveAndroidGradleSources(request) {
|
|
|
54423
54449
|
};
|
|
54424
54450
|
});
|
|
54425
54451
|
} finally {
|
|
54426
|
-
|
|
54452
|
+
import_node_fs116.default.rmSync(work, { recursive: true, force: true });
|
|
54427
54453
|
}
|
|
54428
54454
|
}
|
|
54429
|
-
var import_node_child_process52, import_node_crypto59,
|
|
54455
|
+
var import_node_child_process52, import_node_crypto59, import_node_fs116, import_node_path118, import_node_util19, run9, modelQuery;
|
|
54430
54456
|
var init_android_gradle_sources = __esm({
|
|
54431
54457
|
"src/android-gradle-sources.ts"() {
|
|
54432
54458
|
"use strict";
|
|
54433
54459
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
54434
54460
|
import_node_child_process52 = require("node:child_process");
|
|
54435
54461
|
import_node_crypto59 = require("node:crypto");
|
|
54436
|
-
|
|
54437
|
-
|
|
54462
|
+
import_node_fs116 = __toESM(require("node:fs"), 1);
|
|
54463
|
+
import_node_path118 = __toESM(require("node:path"), 1);
|
|
54438
54464
|
import_node_util19 = require("node:util");
|
|
54439
54465
|
init_forked_script_contract();
|
|
54440
54466
|
init_is_record();
|
|
@@ -54574,27 +54600,27 @@ function readBridgeFiles(output2) {
|
|
|
54574
54600
|
});
|
|
54575
54601
|
}
|
|
54576
54602
|
function androidAppSources(appRoot) {
|
|
54577
|
-
const moduleDir =
|
|
54578
|
-
const gradle = ["build.gradle", "build.gradle.kts"].map((name3) =>
|
|
54603
|
+
const moduleDir = import_node_path119.default.join(appRoot, "android", "app");
|
|
54604
|
+
const gradle = ["build.gradle", "build.gradle.kts"].map((name3) => import_node_path119.default.join(moduleDir, name3)).find((file) => import_node_fs117.default.existsSync(file));
|
|
54579
54605
|
if (!gradle) return null;
|
|
54580
54606
|
const id = /\bapplicationId\s*=?\s*["']([^"']+)["']/.exec(
|
|
54581
|
-
|
|
54607
|
+
import_node_fs117.default.readFileSync(gradle, "utf8")
|
|
54582
54608
|
);
|
|
54583
54609
|
if (!id) throw new Error(`${gradle}: no applicationId`);
|
|
54584
54610
|
const kotlin = [];
|
|
54585
54611
|
const java = [];
|
|
54586
54612
|
const walk3 = (dir) => {
|
|
54587
|
-
if (!
|
|
54588
|
-
for (const child of
|
|
54589
|
-
const file =
|
|
54613
|
+
if (!import_node_fs117.default.existsSync(dir)) return;
|
|
54614
|
+
for (const child of import_node_fs117.default.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
54615
|
+
const file = import_node_path119.default.join(dir, child.name);
|
|
54590
54616
|
if (child.isSymbolicLink()) throw new Error(`Android source is a symlink: ${file}`);
|
|
54591
54617
|
if (child.isDirectory()) walk3(file);
|
|
54592
54618
|
else if (child.name.endsWith(".kt")) kotlin.push(file);
|
|
54593
54619
|
else if (child.name.endsWith(".java")) java.push(file);
|
|
54594
54620
|
}
|
|
54595
54621
|
};
|
|
54596
|
-
walk3(
|
|
54597
|
-
walk3(
|
|
54622
|
+
walk3(import_node_path119.default.join(moduleDir, "src", "main", "java"));
|
|
54623
|
+
walk3(import_node_path119.default.join(moduleDir, "src", "main", "kotlin"));
|
|
54598
54624
|
return { applicationId: id[1], kotlin, java };
|
|
54599
54625
|
}
|
|
54600
54626
|
function declares(source, owner, name3) {
|
|
@@ -54603,7 +54629,7 @@ function declares(source, owner, name3) {
|
|
|
54603
54629
|
}
|
|
54604
54630
|
function selectBridgePackages(applicationId, files2, javaFiles) {
|
|
54605
54631
|
const texts = new Map(
|
|
54606
|
-
files2.map((file) => [file.file,
|
|
54632
|
+
files2.map((file) => [file.file, import_node_fs117.default.readFileSync(file.file, "utf8")])
|
|
54607
54633
|
);
|
|
54608
54634
|
const owners = /* @__PURE__ */ new Map();
|
|
54609
54635
|
for (const file of files2)
|
|
@@ -54611,8 +54637,8 @@ function selectBridgePackages(applicationId, files2, javaFiles) {
|
|
|
54611
54637
|
owners.set(name3, [...owners.get(name3) ?? [], file]);
|
|
54612
54638
|
const javaDeclarations = javaFiles.map((file) => ({
|
|
54613
54639
|
file,
|
|
54614
|
-
package: /^\s*package\s+([\w.]+)\s*;/m.exec(
|
|
54615
|
-
name:
|
|
54640
|
+
package: /^\s*package\s+([\w.]+)\s*;/m.exec(import_node_fs117.default.readFileSync(file, "utf8"))?.[1] ?? "",
|
|
54641
|
+
name: import_node_path119.default.basename(file, ".java")
|
|
54616
54642
|
}));
|
|
54617
54643
|
const closure = (root) => {
|
|
54618
54644
|
const seen = /* @__PURE__ */ new Set([root]);
|
|
@@ -54685,13 +54711,13 @@ function moduleName(text6, className2) {
|
|
|
54685
54711
|
);
|
|
54686
54712
|
return match ? match[1] : null;
|
|
54687
54713
|
}
|
|
54688
|
-
var
|
|
54714
|
+
var import_node_fs117, import_node_path119, qualified2;
|
|
54689
54715
|
var init_android_bridge_packages = __esm({
|
|
54690
54716
|
"src/android-bridge-packages.ts"() {
|
|
54691
54717
|
"use strict";
|
|
54692
54718
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
54693
|
-
|
|
54694
|
-
|
|
54719
|
+
import_node_fs117 = __toESM(require("node:fs"), 1);
|
|
54720
|
+
import_node_path119 = __toESM(require("node:path"), 1);
|
|
54695
54721
|
init_is_record();
|
|
54696
54722
|
qualified2 = (file, name3) => file.package ? `${file.package}.${name3}` : name3;
|
|
54697
54723
|
}
|
|
@@ -54700,28 +54726,28 @@ var init_android_bridge_packages = __esm({
|
|
|
54700
54726
|
// src/java-module-abi.ts
|
|
54701
54727
|
async function readJavaModuleSpecs(files2, sdkRoot, toolchain) {
|
|
54702
54728
|
const digest3 = (0, import_node_crypto60.createHash)("sha256");
|
|
54703
|
-
const parent =
|
|
54704
|
-
|
|
54705
|
-
const work =
|
|
54729
|
+
const parent = import_node_path120.default.join(kotlinHome(), "java-specs");
|
|
54730
|
+
import_node_fs118.default.mkdirSync(parent, { recursive: true });
|
|
54731
|
+
const work = import_node_fs118.default.mkdtempSync(import_node_path120.default.join(parent, ".read-"));
|
|
54706
54732
|
try {
|
|
54707
54733
|
const origins = /* @__PURE__ */ new Map();
|
|
54708
54734
|
for (const [index, file] of files2.entries()) {
|
|
54709
|
-
const bytes =
|
|
54735
|
+
const bytes = import_node_fs118.default.readFileSync(file);
|
|
54710
54736
|
digest3.update(file).update("\0").update(bytes).update("\0");
|
|
54711
|
-
const target =
|
|
54712
|
-
|
|
54713
|
-
|
|
54737
|
+
const target = import_node_path120.default.join(work, String(index), import_node_path120.default.basename(file));
|
|
54738
|
+
import_node_fs118.default.mkdirSync(import_node_path120.default.dirname(target));
|
|
54739
|
+
import_node_fs118.default.writeFileSync(target, bytes);
|
|
54714
54740
|
origins.set(target, file);
|
|
54715
54741
|
}
|
|
54716
54742
|
const { stdout } = await run10(
|
|
54717
|
-
|
|
54743
|
+
import_node_path120.default.join(toolchain.javaHome, "bin", "java"),
|
|
54718
54744
|
[
|
|
54719
54745
|
"-cp",
|
|
54720
54746
|
[
|
|
54721
|
-
|
|
54722
|
-
|
|
54723
|
-
|
|
54724
|
-
].join(
|
|
54747
|
+
import_node_path120.default.join(sdkRoot, "tools.jar"),
|
|
54748
|
+
import_node_path120.default.resolve(import_node_path120.default.dirname(toolchain.kotlinc), "../lib/kotlin-compiler.jar"),
|
|
54749
|
+
import_node_path120.default.resolve(import_node_path120.default.dirname(toolchain.kotlinc), "../lib/kotlin-stdlib.jar")
|
|
54750
|
+
].join(import_node_path120.default.delimiter),
|
|
54725
54751
|
"dev.peach.tools.javaabi.JavaModuleSpecsKt",
|
|
54726
54752
|
...origins.keys()
|
|
54727
54753
|
],
|
|
@@ -54751,20 +54777,20 @@ ${diagnostic.trim()}`, { cause });
|
|
|
54751
54777
|
});
|
|
54752
54778
|
return { sha256: digest3.digest("hex"), specs };
|
|
54753
54779
|
} finally {
|
|
54754
|
-
|
|
54780
|
+
import_node_fs118.default.rmSync(work, { recursive: true, force: true });
|
|
54755
54781
|
}
|
|
54756
54782
|
}
|
|
54757
54783
|
async function compileJavaModuleAbi(input) {
|
|
54758
54784
|
const { specs, work, hash, toolchain, libraries, sdkRoot, sdkLibrary, language } = input;
|
|
54759
|
-
const directory2 =
|
|
54760
|
-
|
|
54785
|
+
const directory2 = import_node_path120.default.join(work, "java-abi");
|
|
54786
|
+
import_node_fs118.default.mkdirSync(directory2);
|
|
54761
54787
|
const sources = specs.specs.map((spec, index) => {
|
|
54762
|
-
const target =
|
|
54763
|
-
|
|
54788
|
+
const target = import_node_path120.default.join(directory2, `Spec${index}.kt`);
|
|
54789
|
+
import_node_fs118.default.writeFileSync(target, spec.source);
|
|
54764
54790
|
return target;
|
|
54765
54791
|
});
|
|
54766
|
-
const initializer =
|
|
54767
|
-
|
|
54792
|
+
const initializer = import_node_path120.default.join(directory2, "Bindings.kt");
|
|
54793
|
+
import_node_fs118.default.writeFileSync(
|
|
54768
54794
|
initializer,
|
|
54769
54795
|
[
|
|
54770
54796
|
"package dev.peach.jni",
|
|
@@ -54778,8 +54804,8 @@ async function compileJavaModuleAbi(input) {
|
|
|
54778
54804
|
"-J-Xmx2g",
|
|
54779
54805
|
"-Xwasm-target=js",
|
|
54780
54806
|
"-libraries",
|
|
54781
|
-
libraries.join(
|
|
54782
|
-
`-Xplugin=${
|
|
54807
|
+
libraries.join(import_node_path120.default.delimiter),
|
|
54808
|
+
`-Xplugin=${import_node_path120.default.join(sdkRoot, "plugin.jar")}`,
|
|
54783
54809
|
`-Xfriend-modules=${sdkLibrary}`,
|
|
54784
54810
|
"-language-version",
|
|
54785
54811
|
language,
|
|
@@ -54795,33 +54821,33 @@ async function compileJavaModuleAbi(input) {
|
|
|
54795
54821
|
],
|
|
54796
54822
|
{ maxBuffer: 16 * 1024 * 1024 }
|
|
54797
54823
|
);
|
|
54798
|
-
const library =
|
|
54824
|
+
const library = import_node_path120.default.join(directory2, "java-abi.klib");
|
|
54799
54825
|
await run10(
|
|
54800
|
-
|
|
54826
|
+
import_node_path120.default.join(toolchain.javaHome, "bin", "java"),
|
|
54801
54827
|
[
|
|
54802
54828
|
"-cp",
|
|
54803
54829
|
[
|
|
54804
|
-
|
|
54805
|
-
|
|
54806
|
-
|
|
54807
|
-
].join(
|
|
54830
|
+
import_node_path120.default.join(sdkRoot, "tools.jar"),
|
|
54831
|
+
import_node_path120.default.resolve(import_node_path120.default.dirname(toolchain.kotlinc), "../lib/kotlin-compiler.jar"),
|
|
54832
|
+
import_node_path120.default.resolve(import_node_path120.default.dirname(toolchain.kotlinc), "../lib/kotlin-stdlib.jar")
|
|
54833
|
+
].join(import_node_path120.default.delimiter),
|
|
54808
54834
|
"dev.peach.tools.platform.JavaPlatformTypesKt",
|
|
54809
|
-
|
|
54835
|
+
import_node_path120.default.join(directory2, `${name3}.klib`),
|
|
54810
54836
|
library
|
|
54811
54837
|
],
|
|
54812
54838
|
{ maxBuffer: 16 * 1024 * 1024 }
|
|
54813
54839
|
);
|
|
54814
54840
|
return library;
|
|
54815
54841
|
}
|
|
54816
|
-
var import_node_child_process53, import_node_crypto60,
|
|
54842
|
+
var import_node_child_process53, import_node_crypto60, import_node_fs118, import_node_path120, import_node_util20, run10, JAVA_BINDINGS_INITIALIZER;
|
|
54817
54843
|
var init_java_module_abi = __esm({
|
|
54818
54844
|
"src/java-module-abi.ts"() {
|
|
54819
54845
|
"use strict";
|
|
54820
54846
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
54821
54847
|
import_node_child_process53 = require("node:child_process");
|
|
54822
54848
|
import_node_crypto60 = require("node:crypto");
|
|
54823
|
-
|
|
54824
|
-
|
|
54849
|
+
import_node_fs118 = __toESM(require("node:fs"), 1);
|
|
54850
|
+
import_node_path120 = __toESM(require("node:path"), 1);
|
|
54825
54851
|
import_node_util20 = require("node:util");
|
|
54826
54852
|
init_android_bridge_packages();
|
|
54827
54853
|
init_is_record();
|
|
@@ -54909,22 +54935,22 @@ var init_kotlinSdkContract = __esm({
|
|
|
54909
54935
|
// src/kotlin-sdk.ts
|
|
54910
54936
|
function verifyKotlinSdkDirectory(root, compilerSha256) {
|
|
54911
54937
|
const expectedNames = ["manifest.json", ...KOTLIN_SDK_FILES];
|
|
54912
|
-
const names =
|
|
54938
|
+
const names = import_node_fs119.default.readdirSync(root);
|
|
54913
54939
|
if (names.length !== expectedNames.length || names.some((name3) => !expectedNames.includes(name3)))
|
|
54914
54940
|
throw new Error("Kotlin SDK directory contains unexpected inputs");
|
|
54915
|
-
const manifestStat =
|
|
54941
|
+
const manifestStat = import_node_fs119.default.lstatSync(import_node_path121.default.join(root, "manifest.json"));
|
|
54916
54942
|
if (!manifestStat.isFile() || manifestStat.nlink !== 1)
|
|
54917
54943
|
throw new Error("Kotlin SDK manifest is not a regular file");
|
|
54918
54944
|
const manifest = readKotlinSdkManifest(
|
|
54919
|
-
|
|
54945
|
+
import_node_fs119.default.readFileSync(import_node_path121.default.join(root, "manifest.json"), "utf8"),
|
|
54920
54946
|
compilerSha256
|
|
54921
54947
|
);
|
|
54922
54948
|
for (const [name3, expected] of Object.entries(manifest.files)) {
|
|
54923
|
-
const target =
|
|
54924
|
-
const stat2 =
|
|
54949
|
+
const target = import_node_path121.default.join(root, name3);
|
|
54950
|
+
const stat2 = import_node_fs119.default.lstatSync(target);
|
|
54925
54951
|
if (!stat2.isFile() || stat2.nlink !== 1)
|
|
54926
54952
|
throw new Error(`Kotlin SDK binary is not a regular file: ${name3}`);
|
|
54927
|
-
const bytes =
|
|
54953
|
+
const bytes = import_node_fs119.default.readFileSync(target);
|
|
54928
54954
|
if (bytes.length !== expected.bytes || (0, import_node_crypto61.createHash)("sha256").update(bytes).digest("hex") !== expected.sha256)
|
|
54929
54955
|
throw new Error(`Kotlin SDK binary differs from its manifest: ${name3}`);
|
|
54930
54956
|
}
|
|
@@ -54932,43 +54958,43 @@ function verifyKotlinSdkDirectory(root, compilerSha256) {
|
|
|
54932
54958
|
}
|
|
54933
54959
|
async function installKotlinSdkArchive(archive, compilerSha256) {
|
|
54934
54960
|
const sha2564 = (0, import_node_crypto61.createHash)("sha256").update(archive).digest("hex");
|
|
54935
|
-
const parent =
|
|
54936
|
-
const root =
|
|
54937
|
-
if (
|
|
54961
|
+
const parent = import_node_path121.default.join(kotlinHome(), "sdk");
|
|
54962
|
+
const root = import_node_path121.default.join(parent, sha2564);
|
|
54963
|
+
if (import_node_fs119.default.existsSync(root))
|
|
54938
54964
|
return { root, sha256: sha2564, manifest: verifyKotlinSdkDirectory(root, compilerSha256) };
|
|
54939
|
-
|
|
54940
|
-
const work =
|
|
54965
|
+
import_node_fs119.default.mkdirSync(parent, { recursive: true });
|
|
54966
|
+
const work = import_node_fs119.default.mkdtempSync(import_node_path121.default.join(parent, ".install-"));
|
|
54941
54967
|
try {
|
|
54942
|
-
const packed =
|
|
54943
|
-
|
|
54968
|
+
const packed = import_node_path121.default.join(work, "sdk.tar.gz");
|
|
54969
|
+
import_node_fs119.default.writeFileSync(packed, archive);
|
|
54944
54970
|
const { stdout } = await run11("tar", ["-tzf", packed]);
|
|
54945
54971
|
const names = stdout.trim().split("\n");
|
|
54946
54972
|
const expected = ["manifest.json", ...KOTLIN_SDK_FILES];
|
|
54947
54973
|
if (names.length !== expected.length || new Set(names).size !== names.length || names.some((name3) => !expected.includes(name3)))
|
|
54948
54974
|
throw new Error("Kotlin SDK archive contains unexpected inputs");
|
|
54949
54975
|
await run11("tar", ["-xzf", packed, "-C", work, "--", ...expected]);
|
|
54950
|
-
|
|
54976
|
+
import_node_fs119.default.rmSync(packed);
|
|
54951
54977
|
const manifest = verifyKotlinSdkDirectory(work, compilerSha256);
|
|
54952
54978
|
try {
|
|
54953
|
-
|
|
54979
|
+
import_node_fs119.default.renameSync(work, root);
|
|
54954
54980
|
} catch (error) {
|
|
54955
|
-
if (!
|
|
54981
|
+
if (!import_node_fs119.default.existsSync(root)) throw error;
|
|
54956
54982
|
verifyKotlinSdkDirectory(root, compilerSha256);
|
|
54957
54983
|
}
|
|
54958
54984
|
return { root, sha256: sha2564, manifest };
|
|
54959
54985
|
} finally {
|
|
54960
|
-
|
|
54986
|
+
import_node_fs119.default.rmSync(work, { recursive: true, force: true });
|
|
54961
54987
|
}
|
|
54962
54988
|
}
|
|
54963
|
-
var import_node_child_process54, import_node_crypto61,
|
|
54989
|
+
var import_node_child_process54, import_node_crypto61, import_node_fs119, import_node_path121, import_node_util21, run11;
|
|
54964
54990
|
var init_kotlin_sdk = __esm({
|
|
54965
54991
|
"src/kotlin-sdk.ts"() {
|
|
54966
54992
|
"use strict";
|
|
54967
54993
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
54968
54994
|
import_node_child_process54 = require("node:child_process");
|
|
54969
54995
|
import_node_crypto61 = require("node:crypto");
|
|
54970
|
-
|
|
54971
|
-
|
|
54996
|
+
import_node_fs119 = __toESM(require("node:fs"), 1);
|
|
54997
|
+
import_node_path121 = __toESM(require("node:path"), 1);
|
|
54972
54998
|
import_node_util21 = require("node:util");
|
|
54973
54999
|
init_kotlin_toolchain();
|
|
54974
55000
|
init_kotlinSdkContract();
|
|
@@ -54978,8 +55004,8 @@ var init_kotlin_sdk = __esm({
|
|
|
54978
55004
|
|
|
54979
55005
|
// src/android-bridge-dependencies.ts
|
|
54980
55006
|
async function collectAndroidBridgeDependencies(appRoot, moduleRoot) {
|
|
54981
|
-
const root =
|
|
54982
|
-
if (!
|
|
55007
|
+
const root = import_node_path122.default.join(appRoot, "android");
|
|
55008
|
+
if (!import_node_fs120.default.existsSync(import_node_path122.default.join(root, "gradlew"))) return null;
|
|
54983
55009
|
const dependencies = (await resolveReactNativeAndroidAutolinking(appRoot)).flatMap(
|
|
54984
55010
|
(dependency) => dependency.sourceDir === null || dependency.packageInstance === null ? [] : [
|
|
54985
55011
|
{
|
|
@@ -54993,7 +55019,7 @@ async function collectAndroidBridgeDependencies(appRoot, moduleRoot) {
|
|
|
54993
55019
|
const models = await resolveAndroidGradleSources({
|
|
54994
55020
|
root,
|
|
54995
55021
|
projects: [
|
|
54996
|
-
|
|
55022
|
+
import_node_path122.default.join(root, "app"),
|
|
54997
55023
|
...dependencies.map((dependency) => dependency.sourceDir)
|
|
54998
55024
|
],
|
|
54999
55025
|
variant: "debug"
|
|
@@ -55003,7 +55029,7 @@ async function collectAndroidBridgeDependencies(appRoot, moduleRoot) {
|
|
|
55003
55029
|
const toolchain = readToolchain(moduleRoot);
|
|
55004
55030
|
const [sdk, ready] = await Promise.all([
|
|
55005
55031
|
installKotlinSdkArchive(
|
|
55006
|
-
|
|
55032
|
+
import_node_fs120.default.readFileSync(import_node_path122.default.join(moduleRoot, "sdk.tar.gz")),
|
|
55007
55033
|
toolchain.compiler.sha256
|
|
55008
55034
|
),
|
|
55009
55035
|
ensureToolchain(toolchain)
|
|
@@ -55011,7 +55037,7 @@ async function collectAndroidBridgeDependencies(appRoot, moduleRoot) {
|
|
|
55011
55037
|
const packages = [];
|
|
55012
55038
|
for (const dependency of dependencies) {
|
|
55013
55039
|
const model = models.find(
|
|
55014
|
-
(entry) => entry.projectDir ===
|
|
55040
|
+
(entry) => entry.projectDir === import_node_fs120.default.realpathSync(dependency.sourceDir)
|
|
55015
55041
|
);
|
|
55016
55042
|
try {
|
|
55017
55043
|
const className2 = /^import\s+([\w.]+)\s*;$/.exec(
|
|
@@ -55050,13 +55076,13 @@ async function collectAndroidBridgeDependencies(appRoot, moduleRoot) {
|
|
|
55050
55076
|
}
|
|
55051
55077
|
return packages.length ? { applicationId, packages } : null;
|
|
55052
55078
|
}
|
|
55053
|
-
var
|
|
55079
|
+
var import_node_fs120, import_node_path122;
|
|
55054
55080
|
var init_android_bridge_dependencies = __esm({
|
|
55055
55081
|
"src/android-bridge-dependencies.ts"() {
|
|
55056
55082
|
"use strict";
|
|
55057
55083
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
55058
|
-
|
|
55059
|
-
|
|
55084
|
+
import_node_fs120 = __toESM(require("node:fs"), 1);
|
|
55085
|
+
import_node_path122 = __toESM(require("node:path"), 1);
|
|
55060
55086
|
init_android_autolinking();
|
|
55061
55087
|
init_android_gradle_sources();
|
|
55062
55088
|
init_java_module_abi();
|
|
@@ -55068,46 +55094,46 @@ var init_android_bridge_dependencies = __esm({
|
|
|
55068
55094
|
// src/kotlin-module.ts
|
|
55069
55095
|
function peachKotlinModuleRoot() {
|
|
55070
55096
|
if (!IS_STANDALONE)
|
|
55071
|
-
return
|
|
55097
|
+
return import_node_path123.default.resolve(import_node_path123.default.dirname((0, import_node_url9.fileURLToPath)(__sootsim_import_meta_url)), "..", "kotlin");
|
|
55072
55098
|
if (installedRoot) return installedRoot;
|
|
55073
55099
|
const files2 = __PEACH_BUNDLED_KOTLIN__;
|
|
55074
55100
|
const digest3 = (0, import_node_crypto62.createHash)("sha256").update(JSON.stringify(files2)).digest("hex");
|
|
55075
|
-
const parent =
|
|
55076
|
-
const root =
|
|
55077
|
-
|
|
55078
|
-
if (!
|
|
55079
|
-
const pending =
|
|
55101
|
+
const parent = import_node_path123.default.join(rnxHomeDir(), "kotlin", "modules");
|
|
55102
|
+
const root = import_node_path123.default.join(parent, digest3);
|
|
55103
|
+
import_node_fs121.default.mkdirSync(parent, { recursive: true });
|
|
55104
|
+
if (!import_node_fs121.default.existsSync(root)) {
|
|
55105
|
+
const pending = import_node_fs121.default.mkdtempSync(import_node_path123.default.join(parent, ".install-"));
|
|
55080
55106
|
try {
|
|
55081
55107
|
for (const [name3, contents] of Object.entries(files2)) {
|
|
55082
|
-
const file =
|
|
55083
|
-
|
|
55084
|
-
|
|
55108
|
+
const file = import_node_path123.default.join(pending, name3);
|
|
55109
|
+
import_node_fs121.default.mkdirSync(import_node_path123.default.dirname(file), { recursive: true });
|
|
55110
|
+
import_node_fs121.default.writeFileSync(file, Buffer.from(contents, "base64"));
|
|
55085
55111
|
}
|
|
55086
55112
|
try {
|
|
55087
|
-
|
|
55113
|
+
import_node_fs121.default.renameSync(pending, root);
|
|
55088
55114
|
} catch (error) {
|
|
55089
55115
|
if (!isRecord(error) || error.code !== "EEXIST" && error.code !== "ENOTEMPTY")
|
|
55090
55116
|
throw error;
|
|
55091
55117
|
}
|
|
55092
55118
|
} finally {
|
|
55093
|
-
|
|
55119
|
+
import_node_fs121.default.rmSync(pending, { recursive: true, force: true });
|
|
55094
55120
|
}
|
|
55095
55121
|
}
|
|
55096
55122
|
for (const [name3, contents] of Object.entries(files2)) {
|
|
55097
|
-
if (!
|
|
55123
|
+
if (!import_node_fs121.default.readFileSync(import_node_path123.default.join(root, name3)).equals(Buffer.from(contents, "base64")))
|
|
55098
55124
|
throw new Error(`packaged Kotlin module differs from this CLI: ${name3}`);
|
|
55099
55125
|
}
|
|
55100
55126
|
installedRoot = root;
|
|
55101
55127
|
return root;
|
|
55102
55128
|
}
|
|
55103
|
-
var import_node_crypto62,
|
|
55129
|
+
var import_node_crypto62, import_node_fs121, import_node_path123, import_node_url9, installedRoot;
|
|
55104
55130
|
var init_kotlin_module = __esm({
|
|
55105
55131
|
"src/kotlin-module.ts"() {
|
|
55106
55132
|
"use strict";
|
|
55107
55133
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
55108
55134
|
import_node_crypto62 = require("node:crypto");
|
|
55109
|
-
|
|
55110
|
-
|
|
55135
|
+
import_node_fs121 = __toESM(require("node:fs"), 1);
|
|
55136
|
+
import_node_path123 = __toESM(require("node:path"), 1);
|
|
55111
55137
|
import_node_url9 = require("node:url");
|
|
55112
55138
|
init_standalone();
|
|
55113
55139
|
init_home_paths();
|
|
@@ -55365,16 +55391,16 @@ __export(kotlin_host_exports, {
|
|
|
55365
55391
|
});
|
|
55366
55392
|
function loadKotlinSdk(moduleRoot, toolchain) {
|
|
55367
55393
|
return installKotlinSdkArchive(
|
|
55368
|
-
|
|
55394
|
+
import_node_fs122.default.readFileSync(import_node_path124.default.join(moduleRoot, "sdk.tar.gz")),
|
|
55369
55395
|
toolchain.compiler.sha256
|
|
55370
55396
|
);
|
|
55371
55397
|
}
|
|
55372
55398
|
function appKotlinLanguage(root) {
|
|
55373
|
-
const reactNative =
|
|
55374
|
-
(0, import_node_module19.createRequire)(
|
|
55399
|
+
const reactNative = import_node_path124.default.dirname(
|
|
55400
|
+
(0, import_node_module19.createRequire)(import_node_path124.default.join(root, "package.json")).resolve("react-native/package.json")
|
|
55375
55401
|
);
|
|
55376
|
-
const versions =
|
|
55377
|
-
|
|
55402
|
+
const versions = import_node_fs122.default.readFileSync(
|
|
55403
|
+
import_node_path124.default.join(reactNative, "gradle", "libs.versions.toml"),
|
|
55378
55404
|
"utf8"
|
|
55379
55405
|
);
|
|
55380
55406
|
const match = /^kotlin\s*=\s*"(\d+)\.(\d+)/m.exec(versions);
|
|
@@ -55385,9 +55411,9 @@ function appKotlinLanguage(root) {
|
|
|
55385
55411
|
function kotlinSources(root, skip = SKIP_DIRS) {
|
|
55386
55412
|
const sources = [];
|
|
55387
55413
|
const walk3 = (dir) => {
|
|
55388
|
-
for (const entry of
|
|
55414
|
+
for (const entry of import_node_fs122.default.readdirSync(dir, { withFileTypes: true })) {
|
|
55389
55415
|
if (entry.name.startsWith(".") || skip.has(entry.name)) continue;
|
|
55390
|
-
const full =
|
|
55416
|
+
const full = import_node_path124.default.join(dir, entry.name);
|
|
55391
55417
|
if (entry.isDirectory()) walk3(full);
|
|
55392
55418
|
else if (entry.isFile() && entry.name.endsWith(".kt")) sources.push(full);
|
|
55393
55419
|
}
|
|
@@ -55449,7 +55475,7 @@ function entrySource(ids) {
|
|
|
55449
55475
|
].join("\n");
|
|
55450
55476
|
}
|
|
55451
55477
|
function buildsDir() {
|
|
55452
|
-
return
|
|
55478
|
+
return import_node_path124.default.join(kotlinHome(), "builds");
|
|
55453
55479
|
}
|
|
55454
55480
|
async function kotlinArtifact(root, moduleRoot, origin, target = "app") {
|
|
55455
55481
|
const { kotlinSourceId, nativeSourceContract, renderKotlinSourceGlue } = await import("vxrn/native-source-contract");
|
|
@@ -55462,7 +55488,7 @@ async function kotlinArtifact(root, moduleRoot, origin, target = "app") {
|
|
|
55462
55488
|
const viewIds = [];
|
|
55463
55489
|
let usesCompose = false;
|
|
55464
55490
|
for (const file of sources) {
|
|
55465
|
-
const source =
|
|
55491
|
+
const source = import_node_fs122.default.readFileSync(file, "utf8");
|
|
55466
55492
|
if (/\bandroidx\.compose\./.test(source)) usesCompose = true;
|
|
55467
55493
|
const contract = nativeSourceContract(file, source);
|
|
55468
55494
|
if (contract.modules.length === 0 && contract.views.length === 0) continue;
|
|
@@ -55553,22 +55579,22 @@ function readExpoTypes(output2) {
|
|
|
55553
55579
|
async function scanSources(tool, parse11, toolchain, moduleRoot, files2) {
|
|
55554
55580
|
const digest3 = (0, import_node_crypto63.createHash)("sha256").update(JSON.stringify(toolchain.compiler));
|
|
55555
55581
|
const sdk = await loadKotlinSdk(moduleRoot, toolchain);
|
|
55556
|
-
digest3.update(
|
|
55582
|
+
digest3.update(import_node_fs122.default.readFileSync(import_node_path124.default.join(moduleRoot, "sdk.tar.gz")));
|
|
55557
55583
|
digest3.update(tool);
|
|
55558
|
-
for (const file of files2) digest3.update(`${file}\0${
|
|
55584
|
+
for (const file of files2) digest3.update(`${file}\0${import_node_fs122.default.readFileSync(file, "utf8")}\0`);
|
|
55559
55585
|
const key2 = digest3.digest("hex");
|
|
55560
55586
|
let scan2 = toolScans.get(key2);
|
|
55561
55587
|
if (!scan2) {
|
|
55562
55588
|
scan2 = (async () => {
|
|
55563
55589
|
const { kotlinc } = await ensureToolchain(toolchain);
|
|
55564
55590
|
const { stdout } = await run12(
|
|
55565
|
-
|
|
55591
|
+
import_node_path124.default.join(import_node_path124.default.dirname(kotlinc), "kotlin"),
|
|
55566
55592
|
[
|
|
55567
55593
|
"-cp",
|
|
55568
55594
|
[
|
|
55569
|
-
|
|
55570
|
-
|
|
55571
|
-
].join(
|
|
55595
|
+
import_node_path124.default.resolve(import_node_path124.default.dirname(kotlinc), "../lib/kotlin-compiler.jar"),
|
|
55596
|
+
import_node_path124.default.join(sdk.root, "tools.jar")
|
|
55597
|
+
].join(import_node_path124.default.delimiter),
|
|
55572
55598
|
tool,
|
|
55573
55599
|
...files2
|
|
55574
55600
|
],
|
|
@@ -55586,7 +55612,7 @@ async function scanSources(tool, parse11, toolchain, moduleRoot, files2) {
|
|
|
55586
55612
|
async function scanExpoTypes(toolchain, moduleRoot, sources) {
|
|
55587
55613
|
const candidates = sources.filter(
|
|
55588
55614
|
(file) => /\bRecord\b|\benum\s+class\b|\bExpoComposeView\b|\bExpoView\b|\bComposeProps\b|:\s*(?:[A-Za-z0-9_.]+\.)?(?:View|FrameLayout|LinearLayout|ViewGroup)\b/.test(
|
|
55589
|
-
|
|
55615
|
+
import_node_fs122.default.readFileSync(file, "utf8")
|
|
55590
55616
|
)
|
|
55591
55617
|
);
|
|
55592
55618
|
if (candidates.length === 0) return [];
|
|
@@ -55730,7 +55756,7 @@ function expoTypeSources(files2) {
|
|
|
55730
55756
|
)
|
|
55731
55757
|
];
|
|
55732
55758
|
if (edits.length > 0 || views.length > 0) {
|
|
55733
|
-
let text6 =
|
|
55759
|
+
let text6 = import_node_fs122.default.readFileSync(file.file, "utf8").replaceAll("\r\n", "\n");
|
|
55734
55760
|
for (const { range: range2, owner, field } of edits.sort((a, b) => b.range[0] - a.range[0]))
|
|
55735
55761
|
text6 = `${text6.slice(0, range2[0])}dev.peach.expo.PeachExpoTypes.initial(${owner}::class, ${literal2(field.key)}, ${field.required}) { ${text6.slice(range2[0], range2[1])} }${text6.slice(range2[1])}`;
|
|
55736
55762
|
if (views.length > 0) {
|
|
@@ -55746,7 +55772,7 @@ function expoTypeSources(files2) {
|
|
|
55746
55772
|
`${file.package ? `${file.package}.` : ""}peachExpoViews${index}()`
|
|
55747
55773
|
);
|
|
55748
55774
|
}
|
|
55749
|
-
const name3 = `PeachExpoSource_${index}_${
|
|
55775
|
+
const name3 = `PeachExpoSource_${index}_${import_node_path124.default.basename(file.file)}`;
|
|
55750
55776
|
generated[name3] = text6;
|
|
55751
55777
|
origins[name3] = file.file;
|
|
55752
55778
|
}
|
|
@@ -55788,7 +55814,7 @@ async function expoKotlinArtifact(root, moduleRoot, origin, modules) {
|
|
|
55788
55814
|
const language = appKotlinLanguage(root);
|
|
55789
55815
|
const scanned = await scanExpoTypes(toolchain, moduleRoot, modules.sources);
|
|
55790
55816
|
const usesCompose = scanned.some((file) => file.views.length > 0) || modules.sources.some(
|
|
55791
|
-
(file) => /\bandroidx\.compose\./.test(
|
|
55817
|
+
(file) => /\bandroidx\.compose\./.test(import_node_fs122.default.readFileSync(file, "utf8"))
|
|
55792
55818
|
);
|
|
55793
55819
|
const types = expoTypeSources(scanned);
|
|
55794
55820
|
const rewritten = new Set(Object.values(types.origins));
|
|
@@ -56009,7 +56035,7 @@ function appResourceSources(app) {
|
|
|
56009
56035
|
entries: app.drawables.map((drawable) => ({
|
|
56010
56036
|
name: drawable.name,
|
|
56011
56037
|
init: `listOf(
|
|
56012
|
-
${drawable.files.map((file) => drawableInit(file,
|
|
56038
|
+
${drawable.files.map((file) => drawableInit(file, import_node_path124.default.relative(app.moduleDir, file.file))).join(",\n")}
|
|
56013
56039
|
)`
|
|
56014
56040
|
}))
|
|
56015
56041
|
},
|
|
@@ -56133,7 +56159,7 @@ function drawableInit(drawable, file) {
|
|
|
56133
56159
|
if (drawable.kind === "xml") return `PeachDrawable.Xml(${where})`;
|
|
56134
56160
|
if (drawable.kind === "bitmap")
|
|
56135
56161
|
return `PeachDrawable.Bitmap(${where}, ${drawable.ninePatch}, ${literal2(
|
|
56136
|
-
|
|
56162
|
+
import_node_fs122.default.readFileSync(drawable.file).toString("base64")
|
|
56137
56163
|
)})`;
|
|
56138
56164
|
const vector = drawable.vector;
|
|
56139
56165
|
const float3 = (value) => `${value}f`;
|
|
@@ -56197,8 +56223,8 @@ async function compileKotlin(input, origin) {
|
|
|
56197
56223
|
javaSpecs = []
|
|
56198
56224
|
} = input;
|
|
56199
56225
|
const sdk = await loadKotlinSdk(moduleRoot, toolchain);
|
|
56200
|
-
const plugin =
|
|
56201
|
-
const sdkLibrary =
|
|
56226
|
+
const plugin = import_node_path124.default.join(sdk.root, "plugin.jar");
|
|
56227
|
+
const sdkLibrary = import_node_path124.default.join(sdk.root, `${sdkProfile}.klib`);
|
|
56202
56228
|
const javaRead = javaSpecs.length ? await readJavaModuleSpecs(javaSpecs, sdk.root, await ensureToolchain(toolchain)) : null;
|
|
56203
56229
|
const java = javaRead && javaRead.specs.some((spec) => !spec.application) ? { ...javaRead, specs: javaRead.specs.filter((spec) => !spec.application) } : null;
|
|
56204
56230
|
const applicationJava = javaRead?.specs.filter((spec) => spec.application) ?? [];
|
|
@@ -56226,7 +56252,7 @@ async function compileKotlin(input, origin) {
|
|
|
56226
56252
|
};
|
|
56227
56253
|
const inputs = sources.map((file) => ({
|
|
56228
56254
|
file,
|
|
56229
|
-
bytes:
|
|
56255
|
+
bytes: import_node_fs122.default.readFileSync(file)
|
|
56230
56256
|
}));
|
|
56231
56257
|
const digest3 = (0, import_node_crypto63.createHash)("sha256");
|
|
56232
56258
|
digest3.update(
|
|
@@ -56241,7 +56267,7 @@ async function compileKotlin(input, origin) {
|
|
|
56241
56267
|
})
|
|
56242
56268
|
);
|
|
56243
56269
|
for (const { file, bytes } of inputs)
|
|
56244
|
-
digest3.update(
|
|
56270
|
+
digest3.update(import_node_path124.default.relative(root, file)).update("\0").update(bytes).update("\0");
|
|
56245
56271
|
if (viewModels) digest3.update(viewModels.toolClass);
|
|
56246
56272
|
for (const [name3, text6] of Object.entries(generated))
|
|
56247
56273
|
digest3.update(`${name3}\0${text6}\0`);
|
|
@@ -56250,39 +56276,39 @@ async function compileKotlin(input, origin) {
|
|
|
56250
56276
|
url: `${origin}${KOTLIN_ARTIFACT_PREFIX}${hash}/app.mjs`,
|
|
56251
56277
|
hash
|
|
56252
56278
|
};
|
|
56253
|
-
const out =
|
|
56254
|
-
if (
|
|
56279
|
+
const out = import_node_path124.default.join(buildsDir(), hash);
|
|
56280
|
+
if (import_node_fs122.default.existsSync(import_node_path124.default.join(out, "js", "app.wasm"))) return artifact;
|
|
56255
56281
|
const pending = builds.get(hash);
|
|
56256
56282
|
if (pending) return pending;
|
|
56257
56283
|
const build = (async () => {
|
|
56258
56284
|
const ready = await ensureToolchain(toolchain);
|
|
56259
56285
|
const { kotlinc } = ready;
|
|
56260
56286
|
const libraries = [...ready.libraries, sdkLibrary];
|
|
56261
|
-
const composeRuntime =
|
|
56287
|
+
const composeRuntime = import_node_path124.default.join(
|
|
56262
56288
|
kotlinHome(),
|
|
56263
56289
|
toolchain.compiler.version,
|
|
56264
56290
|
toolchain.composeRuntime.name
|
|
56265
56291
|
);
|
|
56266
56292
|
if (usesCompose) {
|
|
56267
56293
|
for (const library of toolchain.composeLibraries) {
|
|
56268
|
-
const target =
|
|
56294
|
+
const target = import_node_path124.default.join(kotlinHome(), toolchain.compiler.version, library.name);
|
|
56269
56295
|
await fetchVerified(library, target);
|
|
56270
56296
|
libraries.push(target);
|
|
56271
56297
|
}
|
|
56272
56298
|
await fetchVerified(toolchain.composeRuntime, composeRuntime);
|
|
56273
56299
|
}
|
|
56274
|
-
|
|
56275
|
-
const work =
|
|
56276
|
-
const javaLibrary = java ?
|
|
56300
|
+
import_node_fs122.default.mkdirSync(buildsDir(), { recursive: true });
|
|
56301
|
+
const work = import_node_fs122.default.mkdtempSync(import_node_path124.default.join(buildsDir(), `${hash}-`));
|
|
56302
|
+
const javaLibrary = java ? import_node_path124.default.join(work, "java-abi", "java-abi.klib") : null;
|
|
56277
56303
|
if (javaLibrary) libraries.push(javaLibrary);
|
|
56278
|
-
const generatedDir =
|
|
56279
|
-
|
|
56304
|
+
const generatedDir = import_node_path124.default.join(work, "generated");
|
|
56305
|
+
import_node_fs122.default.mkdirSync(generatedDir);
|
|
56280
56306
|
for (const [name3, text6] of Object.entries(generated))
|
|
56281
|
-
|
|
56307
|
+
import_node_fs122.default.writeFileSync(import_node_path124.default.join(generatedDir, name3), text6);
|
|
56282
56308
|
const compiledSources = inputs.map(({ file, bytes }, index) => {
|
|
56283
|
-
const target =
|
|
56284
|
-
|
|
56285
|
-
|
|
56309
|
+
const target = import_node_path124.default.join(work, "sources", String(index), import_node_path124.default.basename(file));
|
|
56310
|
+
import_node_fs122.default.mkdirSync(import_node_path124.default.dirname(target), { recursive: true });
|
|
56311
|
+
import_node_fs122.default.writeFileSync(target, bytes);
|
|
56286
56312
|
return { file, target };
|
|
56287
56313
|
});
|
|
56288
56314
|
const common = [
|
|
@@ -56291,19 +56317,19 @@ async function compileKotlin(input, origin) {
|
|
|
56291
56317
|
"-Xallow-kotlin-package",
|
|
56292
56318
|
"-Xwasm-target=js",
|
|
56293
56319
|
"-libraries",
|
|
56294
|
-
libraries.join(
|
|
56320
|
+
libraries.join(import_node_path124.default.delimiter)
|
|
56295
56321
|
];
|
|
56296
56322
|
const compileKlib = (outputDir) => run12(
|
|
56297
56323
|
kotlinc,
|
|
56298
56324
|
[
|
|
56299
56325
|
...common,
|
|
56300
56326
|
`-Xplugin=${plugin}`,
|
|
56301
|
-
`-Xfriend-modules=${[sdkLibrary, ...javaLibrary ? [javaLibrary] : []].join(
|
|
56327
|
+
`-Xfriend-modules=${[sdkLibrary, ...javaLibrary ? [javaLibrary] : []].join(import_node_path124.default.delimiter)}`,
|
|
56302
56328
|
...usesCompose ? [
|
|
56303
|
-
`-Xplugin=${
|
|
56329
|
+
`-Xplugin=${import_node_path124.default.resolve(import_node_path124.default.dirname(kotlinc), "../lib/compose-compiler-plugin.jar")}`
|
|
56304
56330
|
] : [],
|
|
56305
56331
|
...usesSerialization ? [
|
|
56306
|
-
`-Xplugin=${
|
|
56332
|
+
`-Xplugin=${import_node_path124.default.resolve(import_node_path124.default.dirname(kotlinc), "../lib/kotlinx-serialization-compiler-plugin.jar")}`
|
|
56307
56333
|
] : [],
|
|
56308
56334
|
"-language-version",
|
|
56309
56335
|
language,
|
|
@@ -56316,7 +56342,7 @@ async function compileKotlin(input, origin) {
|
|
|
56316
56342
|
"-ir-output-name",
|
|
56317
56343
|
"app",
|
|
56318
56344
|
...compiledSources.map(({ target }) => target),
|
|
56319
|
-
...Object.keys(generated).map((name3) =>
|
|
56345
|
+
...Object.keys(generated).map((name3) => import_node_path124.default.join(generatedDir, name3))
|
|
56320
56346
|
],
|
|
56321
56347
|
{ maxBuffer: 16 * 1024 * 1024 }
|
|
56322
56348
|
);
|
|
@@ -56335,36 +56361,36 @@ async function compileKotlin(input, origin) {
|
|
|
56335
56361
|
if (viewModels && inputs.some(
|
|
56336
56362
|
({ file, bytes }) => sources.includes(file) && bytes.includes("ViewModel")
|
|
56337
56363
|
)) {
|
|
56338
|
-
await compileKlib(
|
|
56364
|
+
await compileKlib(import_node_path124.default.join(work, "abi"));
|
|
56339
56365
|
const { stdout } = await run12(
|
|
56340
|
-
|
|
56366
|
+
import_node_path124.default.join(import_node_path124.default.dirname(kotlinc), "kotlin"),
|
|
56341
56367
|
[
|
|
56342
56368
|
"-cp",
|
|
56343
56369
|
[
|
|
56344
|
-
|
|
56345
|
-
|
|
56346
|
-
].join(
|
|
56370
|
+
import_node_path124.default.resolve(import_node_path124.default.dirname(kotlinc), "../lib/kotlin-compiler.jar"),
|
|
56371
|
+
import_node_path124.default.join(sdk.root, "tools.jar")
|
|
56372
|
+
].join(import_node_path124.default.delimiter),
|
|
56347
56373
|
viewModels.toolClass,
|
|
56348
|
-
|
|
56374
|
+
import_node_path124.default.join(work, "abi")
|
|
56349
56375
|
],
|
|
56350
56376
|
{ maxBuffer: 64 * 1024 * 1024 }
|
|
56351
56377
|
);
|
|
56352
|
-
|
|
56353
|
-
|
|
56378
|
+
import_node_fs122.default.writeFileSync(
|
|
56379
|
+
import_node_path124.default.join(generatedDir, viewModels.file),
|
|
56354
56380
|
viewModels.render(viewModelClasses(readAbiClasses(stdout)))
|
|
56355
56381
|
);
|
|
56356
56382
|
}
|
|
56357
|
-
await compileKlib(
|
|
56383
|
+
await compileKlib(import_node_path124.default.join(work, "klib"));
|
|
56358
56384
|
await run12(
|
|
56359
56385
|
kotlinc,
|
|
56360
56386
|
[
|
|
56361
56387
|
...common,
|
|
56362
56388
|
"-nowarn",
|
|
56363
56389
|
"-Xpartial-linkage-loglevel=error",
|
|
56364
|
-
`-Xinclude=${
|
|
56390
|
+
`-Xinclude=${import_node_path124.default.join(work, "klib")}`,
|
|
56365
56391
|
"-Xir-produce-js",
|
|
56366
56392
|
"-ir-output-dir",
|
|
56367
|
-
|
|
56393
|
+
import_node_path124.default.join(work, "js"),
|
|
56368
56394
|
"-ir-output-name",
|
|
56369
56395
|
"app"
|
|
56370
56396
|
],
|
|
@@ -56377,10 +56403,10 @@ async function compileKotlin(input, origin) {
|
|
|
56377
56403
|
composeRuntime,
|
|
56378
56404
|
"skiko.mjs",
|
|
56379
56405
|
"-d",
|
|
56380
|
-
|
|
56406
|
+
import_node_path124.default.join(work, "js")
|
|
56381
56407
|
]);
|
|
56382
|
-
const skikoPath =
|
|
56383
|
-
const upstream = (0, import_acorn3.parse)(
|
|
56408
|
+
const skikoPath = import_node_path124.default.join(work, "js", "skiko.mjs");
|
|
56409
|
+
const upstream = (0, import_acorn3.parse)(import_node_fs122.default.readFileSync(skikoPath, "utf8"), {
|
|
56384
56410
|
ecmaVersion: "latest",
|
|
56385
56411
|
sourceType: "module"
|
|
56386
56412
|
});
|
|
@@ -56403,7 +56429,7 @@ async function compileKotlin(input, origin) {
|
|
|
56403
56429
|
"GL",
|
|
56404
56430
|
...bindings
|
|
56405
56431
|
];
|
|
56406
|
-
|
|
56432
|
+
import_node_fs122.default.writeFileSync(
|
|
56407
56433
|
skikoPath,
|
|
56408
56434
|
[
|
|
56409
56435
|
"const runtime = globalThis.__peachKotlinSkiko;",
|
|
@@ -56417,10 +56443,10 @@ async function compileKotlin(input, origin) {
|
|
|
56417
56443
|
if (usesCompose) {
|
|
56418
56444
|
for (const library of toolchain.composeJsLibraries) {
|
|
56419
56445
|
let imported = false;
|
|
56420
|
-
for (const file of
|
|
56446
|
+
for (const file of import_node_fs122.default.readdirSync(import_node_path124.default.join(work, "js"))) {
|
|
56421
56447
|
if (!file.endsWith(".mjs")) continue;
|
|
56422
|
-
const target =
|
|
56423
|
-
const source =
|
|
56448
|
+
const target = import_node_path124.default.join(work, "js", file);
|
|
56449
|
+
const source = import_node_fs122.default.readFileSync(target, "utf8");
|
|
56424
56450
|
let next = source;
|
|
56425
56451
|
for (const quote of ["'", '"'])
|
|
56426
56452
|
next = next.replaceAll(
|
|
@@ -56428,11 +56454,11 @@ async function compileKotlin(input, origin) {
|
|
|
56428
56454
|
`from ${quote}./${library.file}${quote}`
|
|
56429
56455
|
);
|
|
56430
56456
|
if (next === source) continue;
|
|
56431
|
-
|
|
56457
|
+
import_node_fs122.default.writeFileSync(target, next);
|
|
56432
56458
|
imported = true;
|
|
56433
56459
|
}
|
|
56434
56460
|
if (!imported) continue;
|
|
56435
|
-
const archive =
|
|
56461
|
+
const archive = import_node_path124.default.join(
|
|
56436
56462
|
kotlinHome(),
|
|
56437
56463
|
toolchain.compiler.version,
|
|
56438
56464
|
library.name
|
|
@@ -56441,24 +56467,24 @@ async function compileKotlin(input, origin) {
|
|
|
56441
56467
|
const { stdout } = await run12("tar", ["-xOf", archive, library.archiveEntry], {
|
|
56442
56468
|
maxBuffer: 16 * 1024 * 1024
|
|
56443
56469
|
});
|
|
56444
|
-
|
|
56470
|
+
import_node_fs122.default.writeFileSync(import_node_path124.default.join(work, "js", library.file), stdout);
|
|
56445
56471
|
}
|
|
56446
56472
|
}
|
|
56447
56473
|
} catch (error) {
|
|
56448
|
-
|
|
56474
|
+
import_node_fs122.default.rmSync(work, { recursive: true, force: true });
|
|
56449
56475
|
let output2 = isRecord(error) ? `${String(error.stderr ?? "")}${String(error.stdout ?? "")}` : "";
|
|
56450
56476
|
for (const [name3, source] of Object.entries(origins))
|
|
56451
|
-
output2 = output2.replaceAll(
|
|
56477
|
+
output2 = output2.replaceAll(import_node_path124.default.join(generatedDir, name3), source);
|
|
56452
56478
|
for (const [index, spec] of applicationJava.entries())
|
|
56453
56479
|
output2 = output2.replaceAll(
|
|
56454
|
-
|
|
56480
|
+
import_node_path124.default.join(generatedDir, `JavaApplication${index}.kt`),
|
|
56455
56481
|
spec.file
|
|
56456
56482
|
);
|
|
56457
56483
|
for (const { file, target } of compiledSources)
|
|
56458
|
-
output2 = output2.replaceAll(target, file).replaceAll(
|
|
56484
|
+
output2 = output2.replaceAll(target, file).replaceAll(import_node_path124.default.relative(process.cwd(), target), file);
|
|
56459
56485
|
for (const [index, spec] of (java?.specs ?? []).entries())
|
|
56460
56486
|
output2 = output2.replaceAll(
|
|
56461
|
-
|
|
56487
|
+
import_node_path124.default.join(work, "java-abi", `Spec${index}.kt`),
|
|
56462
56488
|
spec.file
|
|
56463
56489
|
);
|
|
56464
56490
|
output2 = output2.replace(
|
|
@@ -56473,9 +56499,9 @@ ${output2.trim() || (error instanceof Error ? error.message : String(error))}`
|
|
|
56473
56499
|
const seams = [
|
|
56474
56500
|
["process.release.name", "process.release?.name"]
|
|
56475
56501
|
];
|
|
56476
|
-
const js =
|
|
56502
|
+
const js = import_node_fs122.default.readdirSync(import_node_path124.default.join(work, "js")).filter((file) => file.endsWith(".mjs"));
|
|
56477
56503
|
if (js.some(
|
|
56478
|
-
(file) =>
|
|
56504
|
+
(file) => import_node_fs122.default.readFileSync(import_node_path124.default.join(work, "js", file), "utf8").includes("'kotlinx.coroutines.")
|
|
56479
56505
|
))
|
|
56480
56506
|
seams.push([
|
|
56481
56507
|
"(typeof(window) !== 'undefined' && window != null && typeof(window.addEventListener) === 'function') ? window : null",
|
|
@@ -56484,12 +56510,12 @@ ${output2.trim() || (error instanceof Error ? error.message : String(error))}`
|
|
|
56484
56510
|
for (const [from, to] of seams) {
|
|
56485
56511
|
let patched = 0;
|
|
56486
56512
|
for (const file of js) {
|
|
56487
|
-
const target =
|
|
56488
|
-
const text6 =
|
|
56513
|
+
const target = import_node_path124.default.join(work, "js", file);
|
|
56514
|
+
const text6 = import_node_fs122.default.readFileSync(target, "utf8");
|
|
56489
56515
|
const next = text6.replaceAll(from, to);
|
|
56490
56516
|
if (next !== text6) {
|
|
56491
56517
|
patched++;
|
|
56492
|
-
|
|
56518
|
+
import_node_fs122.default.writeFileSync(target, next);
|
|
56493
56519
|
}
|
|
56494
56520
|
}
|
|
56495
56521
|
if (patched === 0)
|
|
@@ -56497,11 +56523,11 @@ ${output2.trim() || (error instanceof Error ? error.message : String(error))}`
|
|
|
56497
56523
|
`kotlin output no longer contains ${from}; recheck how it detects its host in Peach`
|
|
56498
56524
|
);
|
|
56499
56525
|
}
|
|
56500
|
-
const entry =
|
|
56501
|
-
const entrySource2 =
|
|
56502
|
-
const importsPath =
|
|
56526
|
+
const entry = import_node_path124.default.join(work, "js/app.mjs");
|
|
56527
|
+
const entrySource2 = import_node_fs122.default.readFileSync(entry, "utf8");
|
|
56528
|
+
const importsPath = import_node_path124.default.join(work, "js/app.import-object.mjs");
|
|
56503
56529
|
const importsFactory = kotlinInstanceSource(
|
|
56504
|
-
|
|
56530
|
+
import_node_fs122.default.readFileSync(importsPath, "utf8"),
|
|
56505
56531
|
"createKotlinImportObject"
|
|
56506
56532
|
);
|
|
56507
56533
|
const runtimeFactory = kotlinInstanceSource(
|
|
@@ -56509,9 +56535,9 @@ ${output2.trim() || (error instanceof Error ? error.message : String(error))}`
|
|
|
56509
56535
|
"createKotlinInstance",
|
|
56510
56536
|
/* @__PURE__ */ new Map([["./app.import-object.mjs", "createKotlinImportObject"]])
|
|
56511
56537
|
);
|
|
56512
|
-
|
|
56513
|
-
|
|
56514
|
-
|
|
56538
|
+
import_node_fs122.default.writeFileSync(importsPath, importsFactory.source);
|
|
56539
|
+
import_node_fs122.default.writeFileSync(import_node_path124.default.join(work, "js/app-runtime.mjs"), runtimeFactory.source);
|
|
56540
|
+
import_node_fs122.default.writeFileSync(
|
|
56515
56541
|
entry,
|
|
56516
56542
|
[
|
|
56517
56543
|
"import { createKotlinInstance } from './app-runtime.mjs';",
|
|
@@ -56524,10 +56550,10 @@ ${output2.trim() || (error instanceof Error ? error.message : String(error))}`
|
|
|
56524
56550
|
].join("\n")
|
|
56525
56551
|
);
|
|
56526
56552
|
try {
|
|
56527
|
-
|
|
56553
|
+
import_node_fs122.default.renameSync(work, out);
|
|
56528
56554
|
} catch (error) {
|
|
56529
|
-
if (!
|
|
56530
|
-
|
|
56555
|
+
if (!import_node_fs122.default.existsSync(import_node_path124.default.join(out, "js", "app.wasm"))) throw error;
|
|
56556
|
+
import_node_fs122.default.rmSync(work, { recursive: true, force: true });
|
|
56531
56557
|
}
|
|
56532
56558
|
return artifact;
|
|
56533
56559
|
})().finally(() => builds.delete(hash));
|
|
@@ -56535,24 +56561,24 @@ ${output2.trim() || (error instanceof Error ? error.message : String(error))}`
|
|
|
56535
56561
|
return build;
|
|
56536
56562
|
}
|
|
56537
56563
|
function kotlinArtifactFiles(hash) {
|
|
56538
|
-
const dir =
|
|
56539
|
-
return
|
|
56540
|
-
const contentType2 = CONTENT_TYPES[
|
|
56564
|
+
const dir = import_node_path124.default.join(buildsDir(), hash, "js");
|
|
56565
|
+
return import_node_fs122.default.readdirSync(dir).sort().map((name3) => {
|
|
56566
|
+
const contentType2 = CONTENT_TYPES[import_node_path124.default.extname(name3)];
|
|
56541
56567
|
if (!contentType2) throw new Error(`unexpected kotlin artifact file ${name3}`);
|
|
56542
|
-
return { name: name3, bytes:
|
|
56568
|
+
return { name: name3, bytes: import_node_fs122.default.readFileSync(import_node_path124.default.join(dir, name3)), contentType: contentType2 };
|
|
56543
56569
|
});
|
|
56544
56570
|
}
|
|
56545
56571
|
function serveKotlinArtifact(pathname, res) {
|
|
56546
56572
|
if (!pathname.startsWith(KOTLIN_ARTIFACT_PREFIX)) return false;
|
|
56547
56573
|
const [hash, file, ...rest] = pathname.slice(KOTLIN_ARTIFACT_PREFIX.length).split("/");
|
|
56548
|
-
const type = file ? CONTENT_TYPES[
|
|
56574
|
+
const type = file ? CONTENT_TYPES[import_node_path124.default.extname(file)] : void 0;
|
|
56549
56575
|
if (!hash || !/^[0-9a-f]+$/.test(hash) || !file || rest.length > 0 || !type || file.includes("..")) {
|
|
56550
56576
|
res.statusCode = 404;
|
|
56551
56577
|
res.end("not a kotlin artifact");
|
|
56552
56578
|
return true;
|
|
56553
56579
|
}
|
|
56554
|
-
const target =
|
|
56555
|
-
if (!
|
|
56580
|
+
const target = import_node_path124.default.join(buildsDir(), hash, "js", file);
|
|
56581
|
+
if (!import_node_fs122.default.existsSync(target)) {
|
|
56556
56582
|
res.statusCode = 404;
|
|
56557
56583
|
res.end(`kotlin artifact ${hash}/${file} was not built`);
|
|
56558
56584
|
return true;
|
|
@@ -56560,7 +56586,7 @@ function serveKotlinArtifact(pathname, res) {
|
|
|
56560
56586
|
res.setHeader("access-control-allow-origin", "*");
|
|
56561
56587
|
res.setHeader("content-type", type);
|
|
56562
56588
|
res.setHeader("cache-control", "public, max-age=31536000, immutable");
|
|
56563
|
-
res.end(
|
|
56589
|
+
res.end(import_node_fs122.default.readFileSync(target));
|
|
56564
56590
|
return true;
|
|
56565
56591
|
}
|
|
56566
56592
|
async function serveKotlinRequest(pathname, res, app) {
|
|
@@ -56577,16 +56603,16 @@ async function serveKotlinRequest(pathname, res, app) {
|
|
|
56577
56603
|
}
|
|
56578
56604
|
return true;
|
|
56579
56605
|
}
|
|
56580
|
-
var import_node_child_process55, import_node_crypto63,
|
|
56606
|
+
var import_node_child_process55, import_node_crypto63, import_node_fs122, import_node_module19, import_node_path124, import_node_util22, import_acorn3, run12, KOTLIN_ARTIFACT_PREFIX, SKIP_DIRS, BUILD_FORMAT, builds, toolScans, BRIDGE_PARAMETERS, BRIDGE_CASTS, BRIDGE_RETURNS, bridgeType, JAVA_CLASSES, argb, escapes2, literal2, CONTENT_TYPES, KOTLIN_PACKAGE_PATH;
|
|
56581
56607
|
var init_kotlin_host = __esm({
|
|
56582
56608
|
"src/kotlin-host.ts"() {
|
|
56583
56609
|
"use strict";
|
|
56584
56610
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
56585
56611
|
import_node_child_process55 = require("node:child_process");
|
|
56586
56612
|
import_node_crypto63 = require("node:crypto");
|
|
56587
|
-
|
|
56613
|
+
import_node_fs122 = __toESM(require("node:fs"), 1);
|
|
56588
56614
|
import_node_module19 = require("node:module");
|
|
56589
|
-
|
|
56615
|
+
import_node_path124 = __toESM(require("node:path"), 1);
|
|
56590
56616
|
import_node_util22 = require("node:util");
|
|
56591
56617
|
import_acorn3 = require("acorn");
|
|
56592
56618
|
init_android_bridge_packages();
|
|
@@ -56699,8 +56725,8 @@ async function collectExpoKotlinModules(appRoot) {
|
|
|
56699
56725
|
for (const project2 of entry.projects) {
|
|
56700
56726
|
if (!isRecord(project2) || typeof project2.sourceDir !== "string" || !Array.isArray(project2.modules))
|
|
56701
56727
|
throw new Error("invalid Expo Android project");
|
|
56702
|
-
const sourceDir =
|
|
56703
|
-
const installed = sourceDir.split(
|
|
56728
|
+
const sourceDir = import_node_fs123.default.realpathSync(project2.sourceDir);
|
|
56729
|
+
const installed = sourceDir.split(import_node_path125.default.sep).includes("node_modules");
|
|
56704
56730
|
if (installed) {
|
|
56705
56731
|
if (typeof entry.packageName !== "string") continue;
|
|
56706
56732
|
if (peachAnsweredNativePackages().has(entry.packageName)) {
|
|
@@ -56727,9 +56753,9 @@ async function collectExpoKotlinModules(appRoot) {
|
|
|
56727
56753
|
group.unsupported ??= reason;
|
|
56728
56754
|
};
|
|
56729
56755
|
const walk3 = (dir) => {
|
|
56730
|
-
if (!
|
|
56731
|
-
for (const child of
|
|
56732
|
-
const file =
|
|
56756
|
+
if (!import_node_fs123.default.existsSync(dir)) return;
|
|
56757
|
+
for (const child of import_node_fs123.default.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
56758
|
+
const file = import_node_path125.default.join(dir, child.name);
|
|
56733
56759
|
if (child.isSymbolicLink()) reject(`Expo Kotlin source is a symlink: ${file}`);
|
|
56734
56760
|
else if (child.isDirectory()) walk3(file);
|
|
56735
56761
|
else if (child.name.endsWith(".java"))
|
|
@@ -56737,8 +56763,8 @@ async function collectExpoKotlinModules(appRoot) {
|
|
|
56737
56763
|
else if (child.name.endsWith(".kt")) group.sources.push(file);
|
|
56738
56764
|
}
|
|
56739
56765
|
};
|
|
56740
|
-
walk3(
|
|
56741
|
-
walk3(
|
|
56766
|
+
walk3(import_node_path125.default.join(sourceDir, "src", "main", "java"));
|
|
56767
|
+
walk3(import_node_path125.default.join(sourceDir, "src", "main", "kotlin"));
|
|
56742
56768
|
result.push(group);
|
|
56743
56769
|
}
|
|
56744
56770
|
}
|
|
@@ -56751,7 +56777,7 @@ async function collectBridgePackages(appRoot) {
|
|
|
56751
56777
|
);
|
|
56752
56778
|
const app = androidAppSources(appRoot);
|
|
56753
56779
|
if (!app || !app.kotlin.some(
|
|
56754
|
-
(file) => /\b(?:Base|Turbo)?ReactPackage\b/.test(
|
|
56780
|
+
(file) => /\b(?:Base|Turbo)?ReactPackage\b/.test(import_node_fs123.default.readFileSync(file, "utf8"))
|
|
56755
56781
|
))
|
|
56756
56782
|
return dependencies;
|
|
56757
56783
|
const { scanBridgeFiles: scanBridgeFiles2 } = await Promise.resolve().then(() => (init_kotlin_host(), kotlin_host_exports));
|
|
@@ -56866,7 +56892,7 @@ async function handleExpoKotlinRequest(req, res) {
|
|
|
56866
56892
|
return true;
|
|
56867
56893
|
}
|
|
56868
56894
|
const root = url.searchParams.get("root");
|
|
56869
|
-
if (!root || !
|
|
56895
|
+
if (!root || !import_node_path125.default.isAbsolute(root)) {
|
|
56870
56896
|
res.writeHead(400);
|
|
56871
56897
|
res.end("missing absolute app root");
|
|
56872
56898
|
return true;
|
|
@@ -56897,13 +56923,13 @@ async function handleExpoKotlinRequest(req, res) {
|
|
|
56897
56923
|
}
|
|
56898
56924
|
return true;
|
|
56899
56925
|
}
|
|
56900
|
-
var
|
|
56926
|
+
var import_node_fs123, import_node_path125, EXPO_KOTLIN_ROUTE, compiling2;
|
|
56901
56927
|
var init_expo_kotlin_host = __esm({
|
|
56902
56928
|
"src/expo-kotlin-host.ts"() {
|
|
56903
56929
|
"use strict";
|
|
56904
56930
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
56905
|
-
|
|
56906
|
-
|
|
56931
|
+
import_node_fs123 = __toESM(require("node:fs"), 1);
|
|
56932
|
+
import_node_path125 = __toESM(require("node:path"), 1);
|
|
56907
56933
|
init_android_autolinking();
|
|
56908
56934
|
init_android_bridge_dependencies();
|
|
56909
56935
|
init_android_bridge_packages();
|
|
@@ -56926,14 +56952,14 @@ function sharedDesktopAuthAccounts(user) {
|
|
|
56926
56952
|
function getBaseDir() {
|
|
56927
56953
|
const explicit = process.env[SESSION_FILE_ENV];
|
|
56928
56954
|
if (explicit?.trim()) {
|
|
56929
|
-
return (0,
|
|
56955
|
+
return (0, import_node_path126.dirname)((0, import_node_path126.resolve)(explicit));
|
|
56930
56956
|
}
|
|
56931
56957
|
return electronUserDataDir();
|
|
56932
56958
|
}
|
|
56933
56959
|
function getSharedDesktopAuthFilePath() {
|
|
56934
56960
|
const explicit = process.env[SESSION_FILE_ENV];
|
|
56935
|
-
if (explicit?.trim()) return (0,
|
|
56936
|
-
return (0,
|
|
56961
|
+
if (explicit?.trim()) return (0, import_node_path126.resolve)(explicit);
|
|
56962
|
+
return (0, import_node_path126.join)(getBaseDir(), "desktop-auth.json");
|
|
56937
56963
|
}
|
|
56938
56964
|
function normalizeUser(input) {
|
|
56939
56965
|
if (!input || typeof input !== "object") return null;
|
|
@@ -56983,27 +57009,27 @@ function normalizeSession(input) {
|
|
|
56983
57009
|
}
|
|
56984
57010
|
function readSharedDesktopAuthSession() {
|
|
56985
57011
|
const filepath = getSharedDesktopAuthFilePath();
|
|
56986
|
-
if (!(0,
|
|
57012
|
+
if (!(0, import_node_fs124.existsSync)(filepath)) return null;
|
|
56987
57013
|
try {
|
|
56988
|
-
const parsed = JSON.parse((0,
|
|
57014
|
+
const parsed = JSON.parse((0, import_node_fs124.readFileSync)(filepath, "utf8"));
|
|
56989
57015
|
const normalized = normalizeSession(parsed);
|
|
56990
57016
|
if (!normalized) {
|
|
56991
|
-
(0,
|
|
57017
|
+
(0, import_node_fs124.rmSync)(filepath, { force: true });
|
|
56992
57018
|
return null;
|
|
56993
57019
|
}
|
|
56994
57020
|
return normalized;
|
|
56995
57021
|
} catch {
|
|
56996
|
-
(0,
|
|
57022
|
+
(0, import_node_fs124.rmSync)(filepath, { force: true });
|
|
56997
57023
|
return null;
|
|
56998
57024
|
}
|
|
56999
57025
|
}
|
|
57000
|
-
var
|
|
57026
|
+
var import_node_fs124, import_node_path126, SESSION_VERSION, SESSION_FILE_ENV, DEFAULT_ORIGIN;
|
|
57001
57027
|
var init_shared_session = __esm({
|
|
57002
57028
|
"src/auth/shared-session.ts"() {
|
|
57003
57029
|
"use strict";
|
|
57004
57030
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
57005
|
-
|
|
57006
|
-
|
|
57031
|
+
import_node_fs124 = require("node:fs");
|
|
57032
|
+
import_node_path126 = require("node:path");
|
|
57007
57033
|
init_home_paths();
|
|
57008
57034
|
init_public_brand();
|
|
57009
57035
|
SESSION_VERSION = 1;
|
|
@@ -57039,32 +57065,32 @@ var init_run_rnx = __esm({
|
|
|
57039
57065
|
|
|
57040
57066
|
// cli/secure-file.ts
|
|
57041
57067
|
function writeSecureJsonAtomic(filepath, value) {
|
|
57042
|
-
(0,
|
|
57068
|
+
(0, import_node_fs125.mkdirSync)((0, import_node_path127.dirname)(filepath), { recursive: true });
|
|
57043
57069
|
const temporary = `${filepath}.tmp-${process.pid}-${(0, import_node_crypto64.randomUUID)()}`;
|
|
57044
57070
|
let descriptor = null;
|
|
57045
57071
|
try {
|
|
57046
|
-
descriptor = (0,
|
|
57047
|
-
(0,
|
|
57048
|
-
(0,
|
|
57072
|
+
descriptor = (0, import_node_fs125.openSync)(temporary, "wx", 384);
|
|
57073
|
+
(0, import_node_fs125.fchmodSync)(descriptor, 384);
|
|
57074
|
+
(0, import_node_fs125.writeFileSync)(descriptor, `${JSON.stringify(value, null, 2)}
|
|
57049
57075
|
`);
|
|
57050
|
-
(0,
|
|
57051
|
-
(0,
|
|
57076
|
+
(0, import_node_fs125.fsyncSync)(descriptor);
|
|
57077
|
+
(0, import_node_fs125.closeSync)(descriptor);
|
|
57052
57078
|
descriptor = null;
|
|
57053
|
-
(0,
|
|
57079
|
+
(0, import_node_fs125.renameSync)(temporary, filepath);
|
|
57054
57080
|
} catch (error) {
|
|
57055
|
-
if (descriptor !== null) (0,
|
|
57056
|
-
(0,
|
|
57081
|
+
if (descriptor !== null) (0, import_node_fs125.closeSync)(descriptor);
|
|
57082
|
+
(0, import_node_fs125.rmSync)(temporary, { force: true });
|
|
57057
57083
|
throw error;
|
|
57058
57084
|
}
|
|
57059
57085
|
}
|
|
57060
|
-
var import_node_crypto64,
|
|
57086
|
+
var import_node_crypto64, import_node_fs125, import_node_path127;
|
|
57061
57087
|
var init_secure_file = __esm({
|
|
57062
57088
|
"cli/secure-file.ts"() {
|
|
57063
57089
|
"use strict";
|
|
57064
57090
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
57065
57091
|
import_node_crypto64 = require("node:crypto");
|
|
57066
|
-
|
|
57067
|
-
|
|
57092
|
+
import_node_fs125 = require("node:fs");
|
|
57093
|
+
import_node_path127 = require("node:path");
|
|
57068
57094
|
}
|
|
57069
57095
|
});
|
|
57070
57096
|
|
|
@@ -57113,25 +57139,25 @@ function isCliApiKeySecret(secret) {
|
|
|
57113
57139
|
return secret.startsWith("sk_rnx_");
|
|
57114
57140
|
}
|
|
57115
57141
|
function savedApiKeyFile() {
|
|
57116
|
-
return
|
|
57142
|
+
return import_node_path128.default.join(rnxHomeDir(), "api-key.json");
|
|
57117
57143
|
}
|
|
57118
57144
|
function readApiKeyFile(file) {
|
|
57119
|
-
if (!(0,
|
|
57120
|
-
const secret = (0,
|
|
57145
|
+
if (!(0, import_node_fs126.existsSync)(file)) return null;
|
|
57146
|
+
const secret = (0, import_node_fs126.readFileSync)(file, "utf8").trim();
|
|
57121
57147
|
return isCliApiKeySecret(secret) ? secret : null;
|
|
57122
57148
|
}
|
|
57123
57149
|
function saveApiKey(secret) {
|
|
57124
57150
|
writeSecureJsonAtomic(savedApiKeyFile(), { secret });
|
|
57125
57151
|
}
|
|
57126
57152
|
function forgetApiKey() {
|
|
57127
|
-
if (!(0,
|
|
57128
|
-
(0,
|
|
57153
|
+
if (!(0, import_node_fs126.existsSync)(savedApiKeyFile())) return false;
|
|
57154
|
+
(0, import_node_fs126.rmSync)(savedApiKeyFile());
|
|
57129
57155
|
return true;
|
|
57130
57156
|
}
|
|
57131
57157
|
function readSavedApiKey() {
|
|
57132
|
-
if (!(0,
|
|
57158
|
+
if (!(0, import_node_fs126.existsSync)(savedApiKeyFile())) return null;
|
|
57133
57159
|
const saved = savedKeySchema.safeParse(
|
|
57134
|
-
JSON.parse((0,
|
|
57160
|
+
JSON.parse((0, import_node_fs126.readFileSync)(savedApiKeyFile(), "utf8"))
|
|
57135
57161
|
);
|
|
57136
57162
|
return saved.success && isCliApiKeySecret(saved.data.secret) ? saved.data.secret : null;
|
|
57137
57163
|
}
|
|
@@ -57191,13 +57217,13 @@ function authHeaderOrExit(commandLabel) {
|
|
|
57191
57217
|
);
|
|
57192
57218
|
rnxExit(1);
|
|
57193
57219
|
}
|
|
57194
|
-
var
|
|
57220
|
+
var import_node_fs126, import_node_path128, import_zod, GITHUB_TOKEN_PREFIXES, DOWNLOADED_API_KEY_FILE, savedKeySchema, CHOOSE_ACCOUNT_HINT;
|
|
57195
57221
|
var init_auth = __esm({
|
|
57196
57222
|
"cli/auth.ts"() {
|
|
57197
57223
|
"use strict";
|
|
57198
57224
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
57199
|
-
|
|
57200
|
-
|
|
57225
|
+
import_node_fs126 = require("node:fs");
|
|
57226
|
+
import_node_path128 = __toESM(require("node:path"), 1);
|
|
57201
57227
|
import_zod = require("zod");
|
|
57202
57228
|
init_shared_session();
|
|
57203
57229
|
init_home_paths();
|
|
@@ -58855,8 +58881,8 @@ function metroIosAssetDestRelatives(httpServerLocation, filename) {
|
|
|
58855
58881
|
}
|
|
58856
58882
|
const out = [];
|
|
58857
58883
|
for (const dir of dirs) {
|
|
58858
|
-
const
|
|
58859
|
-
if (!out.includes(
|
|
58884
|
+
const path112 = `${dir}/${filename}`;
|
|
58885
|
+
if (!out.includes(path112)) out.push(path112);
|
|
58860
58886
|
}
|
|
58861
58887
|
if (!out.includes(filename)) out.push(filename);
|
|
58862
58888
|
return out;
|
|
@@ -59561,27 +59587,27 @@ function resolveCloudOrigin(value) {
|
|
|
59561
59587
|
return normalizeCloudOrigin(source);
|
|
59562
59588
|
}
|
|
59563
59589
|
function readImmutableBundleSource(bundlePath, command) {
|
|
59564
|
-
const filepath = (0,
|
|
59565
|
-
if ((0,
|
|
59590
|
+
const filepath = (0, import_node_path129.resolve)(bundlePath);
|
|
59591
|
+
if ((0, import_node_path129.extname)(filepath) === ".hbc") {
|
|
59566
59592
|
const platform2 = filepath.includes("/android/") ? "android" : "ios";
|
|
59567
59593
|
throw new Error(
|
|
59568
59594
|
`${command} cannot preview Hermes bytecode (${bundlePath}). Export plain JavaScript with \`npx expo export --platform ${platform2} --no-bytecode\` and preview the .js bundle instead.`
|
|
59569
59595
|
);
|
|
59570
59596
|
}
|
|
59571
|
-
if ((0,
|
|
59597
|
+
if ((0, import_node_path129.extname)(filepath) !== ".js") {
|
|
59572
59598
|
throw new Error(`${command} requires one local .js bundle`);
|
|
59573
59599
|
}
|
|
59574
|
-
const descriptor = (0,
|
|
59600
|
+
const descriptor = (0, import_node_fs127.openSync)(filepath, "r");
|
|
59575
59601
|
try {
|
|
59576
|
-
const before = (0,
|
|
59602
|
+
const before = (0, import_node_fs127.fstatSync)(descriptor, { bigint: true });
|
|
59577
59603
|
if (!before.isFile()) {
|
|
59578
59604
|
throw new Error(`${command} bundle must be a regular local file`);
|
|
59579
59605
|
}
|
|
59580
59606
|
if (before.size <= 0n) {
|
|
59581
59607
|
throw new Error(`${command} bundle is empty`);
|
|
59582
59608
|
}
|
|
59583
|
-
const bytes = (0,
|
|
59584
|
-
const after = (0,
|
|
59609
|
+
const bytes = (0, import_node_fs127.readFileSync)(descriptor);
|
|
59610
|
+
const after = (0, import_node_fs127.fstatSync)(descriptor, { bigint: true });
|
|
59585
59611
|
if (before.dev !== after.dev || before.ino !== after.ino || before.size !== after.size || before.mtimeNs !== after.mtimeNs || bytes.length !== Number(before.size)) {
|
|
59586
59612
|
throw new Error(`${command} bundle changed while it was being read`);
|
|
59587
59613
|
}
|
|
@@ -59593,7 +59619,7 @@ function readImmutableBundleSource(bundlePath, command) {
|
|
|
59593
59619
|
}
|
|
59594
59620
|
return source;
|
|
59595
59621
|
} finally {
|
|
59596
|
-
(0,
|
|
59622
|
+
(0, import_node_fs127.closeSync)(descriptor);
|
|
59597
59623
|
}
|
|
59598
59624
|
}
|
|
59599
59625
|
async function fetchBundleSource(bundleUrl, command) {
|
|
@@ -59647,15 +59673,15 @@ async function loadBundleSource(bundleInput, command) {
|
|
|
59647
59673
|
return source;
|
|
59648
59674
|
}
|
|
59649
59675
|
function listMetroAssetDest(assetsPath) {
|
|
59650
|
-
const directory2 = (0,
|
|
59651
|
-
if (!(0,
|
|
59652
|
-
const skipNested = (0,
|
|
59676
|
+
const directory2 = (0, import_node_path129.resolve)(assetsPath);
|
|
59677
|
+
if (!(0, import_node_fs127.existsSync)(directory2)) return { directory: directory2, files: [], truncated: false };
|
|
59678
|
+
const skipNested = (0, import_node_fs127.existsSync)((0, import_node_path129.join)(directory2, "package.json"));
|
|
59653
59679
|
const files2 = [];
|
|
59654
59680
|
let truncated = false;
|
|
59655
59681
|
const walk3 = (dir, prefix) => {
|
|
59656
59682
|
let entries;
|
|
59657
59683
|
try {
|
|
59658
|
-
entries = (0,
|
|
59684
|
+
entries = (0, import_node_fs127.readdirSync)(dir, { withFileTypes: true });
|
|
59659
59685
|
} catch {
|
|
59660
59686
|
return;
|
|
59661
59687
|
}
|
|
@@ -59667,7 +59693,7 @@ function listMetroAssetDest(assetsPath) {
|
|
|
59667
59693
|
if (entry.isDirectory()) {
|
|
59668
59694
|
if (entry.name === ".git") continue;
|
|
59669
59695
|
if (skipNested && PROJECT_ONLY_DIRECTORIES.has(entry.name)) continue;
|
|
59670
|
-
walk3((0,
|
|
59696
|
+
walk3((0, import_node_path129.join)(dir, entry.name), prefix ? `${prefix}/${entry.name}` : entry.name);
|
|
59671
59697
|
} else if (entry.isFile()) {
|
|
59672
59698
|
files2.push(prefix ? `${prefix}/${entry.name}` : entry.name);
|
|
59673
59699
|
}
|
|
@@ -59702,7 +59728,7 @@ function distinctByContent(directory2, options) {
|
|
|
59702
59728
|
for (const relative4 of options) {
|
|
59703
59729
|
let bytes;
|
|
59704
59730
|
try {
|
|
59705
|
-
bytes = (0,
|
|
59731
|
+
bytes = (0, import_node_fs127.readFileSync)((0, import_node_path129.join)(directory2, relative4));
|
|
59706
59732
|
} catch {
|
|
59707
59733
|
continue;
|
|
59708
59734
|
}
|
|
@@ -59747,7 +59773,7 @@ function placeMetroDescriptor(listing, descriptor) {
|
|
|
59747
59773
|
let bytes;
|
|
59748
59774
|
try {
|
|
59749
59775
|
bytes = combination.map(
|
|
59750
|
-
(relative4) => (0,
|
|
59776
|
+
(relative4) => (0, import_node_fs127.readFileSync)((0, import_node_path129.join)(listing.directory, relative4))
|
|
59751
59777
|
);
|
|
59752
59778
|
} catch {
|
|
59753
59779
|
continue;
|
|
@@ -59775,10 +59801,10 @@ function unverifiedContentKey(dest, fileDigests) {
|
|
|
59775
59801
|
return JSON.stringify(
|
|
59776
59802
|
dest.placements.map(
|
|
59777
59803
|
(placement) => placement.verified ? null : [...placement.files].map(([scale, relative4]) => {
|
|
59778
|
-
const file = (0,
|
|
59804
|
+
const file = (0, import_node_path129.join)(dest.directory, relative4);
|
|
59779
59805
|
let digest3 = fileDigests.get(file);
|
|
59780
59806
|
if (digest3 === void 0) {
|
|
59781
|
-
digest3 = (0, import_node_crypto65.createHash)("sha256").update((0,
|
|
59807
|
+
digest3 = (0, import_node_crypto65.createHash)("sha256").update((0, import_node_fs127.readFileSync)(file)).digest("hex");
|
|
59782
59808
|
fileDigests.set(file, digest3);
|
|
59783
59809
|
}
|
|
59784
59810
|
return [scale, digest3];
|
|
@@ -59787,42 +59813,42 @@ function unverifiedContentKey(dest, fileDigests) {
|
|
|
59787
59813
|
);
|
|
59788
59814
|
}
|
|
59789
59815
|
function findExpoExportRoot(bundleDirectory) {
|
|
59790
|
-
let directory2 = (0,
|
|
59816
|
+
let directory2 = (0, import_node_path129.resolve)(bundleDirectory);
|
|
59791
59817
|
for (let depth = 0; depth < 6; depth++) {
|
|
59792
|
-
const metadata = (0,
|
|
59793
|
-
if ((0,
|
|
59818
|
+
const metadata = (0, import_node_path129.join)(directory2, "metadata.json");
|
|
59819
|
+
if ((0, import_node_fs127.existsSync)(metadata) && (0, import_node_fs127.existsSync)((0, import_node_path129.join)(directory2, "assets"))) {
|
|
59794
59820
|
try {
|
|
59795
|
-
if ((0,
|
|
59821
|
+
if ((0, import_node_fs127.readFileSync)(metadata, "utf8").includes('"fileMetadata"')) {
|
|
59796
59822
|
return directory2;
|
|
59797
59823
|
}
|
|
59798
59824
|
} catch {
|
|
59799
59825
|
}
|
|
59800
59826
|
}
|
|
59801
|
-
const parent = (0,
|
|
59827
|
+
const parent = (0, import_node_path129.dirname)(directory2);
|
|
59802
59828
|
if (parent === directory2) return null;
|
|
59803
59829
|
directory2 = parent;
|
|
59804
59830
|
}
|
|
59805
59831
|
return null;
|
|
59806
59832
|
}
|
|
59807
59833
|
function searchMetroAssetDest(bundlePath, descriptors, command, assetsDirectory) {
|
|
59808
|
-
const bundleDirectory = (0,
|
|
59834
|
+
const bundleDirectory = (0, import_node_path129.dirname)((0, import_node_path129.resolve)(bundlePath));
|
|
59809
59835
|
const expoRoot = assetsDirectory || isRemoteBundleInput(bundlePath) ? null : findExpoExportRoot(bundleDirectory);
|
|
59810
|
-
const candidates = assetsDirectory ? [(0,
|
|
59811
|
-
...expoRoot ? [(0,
|
|
59812
|
-
(0,
|
|
59836
|
+
const candidates = assetsDirectory ? [(0, import_node_path129.resolve)(assetsDirectory)] : [
|
|
59837
|
+
...expoRoot ? [(0, import_node_path129.join)(expoRoot, "assets")] : [],
|
|
59838
|
+
(0, import_node_path129.join)(bundleDirectory, "assets"),
|
|
59813
59839
|
bundleDirectory,
|
|
59814
|
-
(0,
|
|
59840
|
+
(0, import_node_path129.resolve)(bundleDirectory, "..", "assets")
|
|
59815
59841
|
];
|
|
59816
59842
|
const cwd = process.cwd();
|
|
59817
59843
|
let projectDirectory = null;
|
|
59818
59844
|
for (const start of assetsDirectory ? [] : [bundleDirectory, cwd]) {
|
|
59819
|
-
let directory2 = (0,
|
|
59845
|
+
let directory2 = (0, import_node_path129.resolve)(start);
|
|
59820
59846
|
while (true) {
|
|
59821
59847
|
if (detectProject(directory2)?.hasMetroConfig) {
|
|
59822
59848
|
projectDirectory = directory2;
|
|
59823
59849
|
break;
|
|
59824
59850
|
}
|
|
59825
|
-
const parent = (0,
|
|
59851
|
+
const parent = (0, import_node_path129.dirname)(directory2);
|
|
59826
59852
|
if (parent === directory2) break;
|
|
59827
59853
|
directory2 = parent;
|
|
59828
59854
|
}
|
|
@@ -59830,11 +59856,11 @@ function searchMetroAssetDest(bundlePath, descriptors, command, assetsDirectory)
|
|
|
59830
59856
|
}
|
|
59831
59857
|
if (projectDirectory) {
|
|
59832
59858
|
candidates.push(
|
|
59833
|
-
(0,
|
|
59834
|
-
(0,
|
|
59835
|
-
(0,
|
|
59836
|
-
(0,
|
|
59837
|
-
(0,
|
|
59859
|
+
(0, import_node_path129.join)(projectDirectory, "assets"),
|
|
59860
|
+
(0, import_node_path129.join)(projectDirectory, "dist"),
|
|
59861
|
+
(0, import_node_path129.join)(projectDirectory, "dist", "assets"),
|
|
59862
|
+
(0, import_node_path129.join)(projectDirectory, "build"),
|
|
59863
|
+
(0, import_node_path129.join)(projectDirectory, "build", "assets")
|
|
59838
59864
|
);
|
|
59839
59865
|
}
|
|
59840
59866
|
const searched = [];
|
|
@@ -59842,7 +59868,7 @@ function searchMetroAssetDest(bundlePath, descriptors, command, assetsDirectory)
|
|
|
59842
59868
|
const stale = [];
|
|
59843
59869
|
let truncated = false;
|
|
59844
59870
|
for (const candidate of candidates) {
|
|
59845
|
-
const directory2 = (0,
|
|
59871
|
+
const directory2 = (0, import_node_path129.resolve)(candidate);
|
|
59846
59872
|
if (searched.includes(directory2)) continue;
|
|
59847
59873
|
searched.push(directory2);
|
|
59848
59874
|
const listing = listMetroAssetDest(directory2);
|
|
@@ -59952,7 +59978,7 @@ async function embedBundleAssets(bundlePath, command, assetPolicy, assetsDirecto
|
|
|
59952
59978
|
);
|
|
59953
59979
|
}
|
|
59954
59980
|
const relative4 = placement?.files.get(variant2.scale);
|
|
59955
|
-
if (relative4 && dest) return (0,
|
|
59981
|
+
if (relative4 && dest) return (0, import_node_fs127.readFileSync)((0, import_node_path129.join)(dest.directory, relative4));
|
|
59956
59982
|
if (placement && placement.files.size > 0) return null;
|
|
59957
59983
|
if (placement && placement.ambiguous.length > 0 && dest) {
|
|
59958
59984
|
throw new Error(
|
|
@@ -59981,7 +60007,7 @@ async function embedBundleAssets(bundlePath, command, assetPolicy, assetsDirecto
|
|
|
59981
60007
|
);
|
|
59982
60008
|
const classic = metroIosAssetDestRelatives(variant2.descriptor.httpServerLocation, filename)[0] ?? filename;
|
|
59983
60009
|
throw new Error(
|
|
59984
|
-
`${command} could not read ${(0,
|
|
60010
|
+
`${command} could not read ${(0, import_node_path129.join)(dest?.directory ?? ".", classic)} for ${variant2.descriptor.name}.${variant2.descriptor.type} at scale ${variant2.scale}, and has no stand-in for a .${variant2.descriptor.type} asset. Rebuild with \`react-native bundle --assets-dest\`.`
|
|
59985
60011
|
);
|
|
59986
60012
|
});
|
|
59987
60013
|
return {
|
|
@@ -60127,14 +60153,14 @@ async function createCloudBox(options) {
|
|
|
60127
60153
|
warnings: artifact.warnings
|
|
60128
60154
|
};
|
|
60129
60155
|
}
|
|
60130
|
-
var import_node_crypto65,
|
|
60156
|
+
var import_node_crypto65, import_node_fs127, import_node_path129, import_node_vm, DEFAULT_RNX_CLOUD_ORIGIN, MAX_RNX_CLOUD_BUNDLE_BYTES, REMOTE_COMMAND, PREVIEW_COMMAND, MAX_ASSET_DEST_FILES, ACCOUNT_CHOICE_REFUSALS, PROJECT_ONLY_DIRECTORIES, MAX_PLACEMENT_COMBINATIONS;
|
|
60131
60157
|
var init_cloud_client = __esm({
|
|
60132
60158
|
"cli/cloud-client.ts"() {
|
|
60133
60159
|
"use strict";
|
|
60134
60160
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
60135
60161
|
import_node_crypto65 = require("node:crypto");
|
|
60136
|
-
|
|
60137
|
-
|
|
60162
|
+
import_node_fs127 = require("node:fs");
|
|
60163
|
+
import_node_path129 = require("node:path");
|
|
60138
60164
|
import_node_vm = require("node:vm");
|
|
60139
60165
|
init_metroAssetArtifact();
|
|
60140
60166
|
init_metroCloudArtifact();
|
|
@@ -60300,12 +60326,12 @@ function commandWritesSim(msg) {
|
|
|
60300
60326
|
// src/chromium-admission.ts
|
|
60301
60327
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
60302
60328
|
function readChromiumQueue(deps, verified2, own) {
|
|
60303
|
-
const { fs:
|
|
60304
|
-
const dir =
|
|
60329
|
+
const { fs: fs88, os: os17, path: path112, childProcess: childProcess2 } = deps;
|
|
60330
|
+
const dir = path112.join(
|
|
60305
60331
|
process.platform === "win32" ? os17.tmpdir() : "/tmp",
|
|
60306
60332
|
"chromium-admission"
|
|
60307
60333
|
);
|
|
60308
|
-
|
|
60334
|
+
fs88.mkdirSync(dir, { recursive: true });
|
|
60309
60335
|
const limit = Math.max(2, Math.floor(os17.cpus().length / 2));
|
|
60310
60336
|
const live = (entry) => {
|
|
60311
60337
|
const match = /^(\d+)-(\d+)-/.exec(entry);
|
|
@@ -60333,10 +60359,10 @@ function readChromiumQueue(deps, verified2, own) {
|
|
|
60333
60359
|
return same;
|
|
60334
60360
|
};
|
|
60335
60361
|
const tickets = [];
|
|
60336
|
-
for (const entry of
|
|
60362
|
+
for (const entry of fs88.readdirSync(dir)) {
|
|
60337
60363
|
if (entry !== own && !live(entry)) {
|
|
60338
60364
|
try {
|
|
60339
|
-
|
|
60365
|
+
fs88.unlinkSync(path112.join(dir, entry));
|
|
60340
60366
|
} catch {
|
|
60341
60367
|
}
|
|
60342
60368
|
continue;
|
|
@@ -60344,7 +60370,7 @@ function readChromiumQueue(deps, verified2, own) {
|
|
|
60344
60370
|
try {
|
|
60345
60371
|
tickets.push({
|
|
60346
60372
|
entry,
|
|
60347
|
-
created:
|
|
60373
|
+
created: fs88.statSync(path112.join(dir, entry), { bigint: true }).ctimeNs
|
|
60348
60374
|
});
|
|
60349
60375
|
} catch {
|
|
60350
60376
|
}
|
|
@@ -61479,7 +61505,7 @@ function scanLocalNative(appDir, pkg, answered, platform2, knownPackages = /* @_
|
|
|
61479
61505
|
expoModule: moduleDir ? (0, import_node_path14.relative)(appDir, moduleDir) || "." : null,
|
|
61480
61506
|
optional: optional3,
|
|
61481
61507
|
swift: moduleDir ? (nativeFilesByModule.get(moduleDir) ?? []).some(
|
|
61482
|
-
(
|
|
61508
|
+
(path112) => path112.endsWith(".swift") && [...(readSmallFile(path112) ?? "").matchAll(/\bName\(\s*"(\w+)"\s*\)/g)].some(
|
|
61483
61509
|
(match) => match[1] === name3
|
|
61484
61510
|
)
|
|
61485
61511
|
) : false,
|
|
@@ -63325,7 +63351,7 @@ init_swift_native_pin();
|
|
|
63325
63351
|
init_xcode_project();
|
|
63326
63352
|
var EXPO_NATIVE_ENTRY_NAME = "ios";
|
|
63327
63353
|
function expoNativeCompilerDigestValue() {
|
|
63328
|
-
return true ? "
|
|
63354
|
+
return true ? "84a9fe588bafb71e772f78ffc8de2ac50d4ff654547f5aab6cb44528fc7c7d15" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
|
|
63329
63355
|
}
|
|
63330
63356
|
var IDENTITY_SOURCE_SKIPS = 1 | 4 | 8 | 16 | 32 | 64 | 128 | 4096;
|
|
63331
63357
|
function readSources(value) {
|
|
@@ -68190,7 +68216,7 @@ var RNX_RUNTIME_PRODUCT = {
|
|
|
68190
68216
|
id: "peach",
|
|
68191
68217
|
defaultCdnOrigin: DEFAULT_RUNTIME_CDN_ORIGIN,
|
|
68192
68218
|
manifestPath: "/runtimes/manifest.json",
|
|
68193
|
-
tarballPath: (version2) => `/runtimes/sootsim-runtime-${version2}.tar.
|
|
68219
|
+
tarballPath: (version2) => `/runtimes/sootsim-runtime-${version2}.tar.zst`,
|
|
68194
68220
|
// the engine runtime is a static SPA: shell at the root, engine/ and
|
|
68195
68221
|
// engine-tenant/ beneath it. index.html is what the daemon and the
|
|
68196
68222
|
// vite/metro plugins serve, so its absence means the tarball is not one.
|
|
@@ -68210,10 +68236,170 @@ var RNX_RUNTIME_PRODUCT = {
|
|
|
68210
68236
|
};
|
|
68211
68237
|
var rnxRuntime = createRuntimeDelivery(RNX_RUNTIME_PRODUCT);
|
|
68212
68238
|
|
|
68239
|
+
// src/runtime-packs.ts
|
|
68240
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
68241
|
+
var import_node_fs103 = __toESM(require("node:fs"), 1);
|
|
68242
|
+
var import_node_path102 = __toESM(require("node:path"), 1);
|
|
68243
|
+
var import_node_timers2 = require("node:timers");
|
|
68244
|
+
init_src();
|
|
68245
|
+
var inflight = /* @__PURE__ */ new Map();
|
|
68246
|
+
var packsByRoot = /* @__PURE__ */ new Map();
|
|
68247
|
+
var listedByRoot = /* @__PURE__ */ new Map();
|
|
68248
|
+
function listedFiles(runtimeRoot) {
|
|
68249
|
+
let listed = listedByRoot.get(runtimeRoot);
|
|
68250
|
+
if (listed) return listed;
|
|
68251
|
+
listed = /* @__PURE__ */ new Map();
|
|
68252
|
+
for (const [pack, entry] of Object.entries(readPacks(runtimeRoot) ?? {}))
|
|
68253
|
+
for (const file of entry.files ?? []) {
|
|
68254
|
+
const name3 = import_node_path102.default.posix.basename(file);
|
|
68255
|
+
listed.set(name3, [...listed.get(name3) ?? [], { file, pack }]);
|
|
68256
|
+
}
|
|
68257
|
+
listedByRoot.set(runtimeRoot, listed);
|
|
68258
|
+
return listed;
|
|
68259
|
+
}
|
|
68260
|
+
function readPacks(runtimeRoot) {
|
|
68261
|
+
const cached3 = packsByRoot.get(runtimeRoot);
|
|
68262
|
+
if (cached3 !== void 0) return cached3;
|
|
68263
|
+
const file = import_node_path102.default.join(runtimeRoot, RUNTIME_PACKS_FILE);
|
|
68264
|
+
if (!import_node_fs103.default.existsSync(file)) {
|
|
68265
|
+
packsByRoot.set(runtimeRoot, null);
|
|
68266
|
+
return null;
|
|
68267
|
+
}
|
|
68268
|
+
const parsed = JSON.parse(import_node_fs103.default.readFileSync(file, "utf8"));
|
|
68269
|
+
const packs = {};
|
|
68270
|
+
if (typeof parsed !== "object" || parsed === null)
|
|
68271
|
+
throw new Error(`${file} is not an object`);
|
|
68272
|
+
for (const [prefix, entry] of Object.entries(parsed)) {
|
|
68273
|
+
if (typeof entry?.file !== "string" || typeof entry?.sha256 !== "string")
|
|
68274
|
+
throw new Error(`${file} entry ${prefix} lacks file and sha256`);
|
|
68275
|
+
const files2 = entry.files;
|
|
68276
|
+
if (files2 !== void 0 && !(Array.isArray(files2) && files2.every((f) => typeof f === "string")))
|
|
68277
|
+
throw new Error(`${file} entry ${prefix} has files that are not paths`);
|
|
68278
|
+
packs[prefix] = {
|
|
68279
|
+
file: entry.file,
|
|
68280
|
+
sha256: entry.sha256,
|
|
68281
|
+
...files2 ? { files: files2 } : {}
|
|
68282
|
+
};
|
|
68283
|
+
}
|
|
68284
|
+
packsByRoot.set(runtimeRoot, packs);
|
|
68285
|
+
return packs;
|
|
68286
|
+
}
|
|
68287
|
+
async function ensureRuntimePackFor(runtimeRoot, pathname) {
|
|
68288
|
+
warmRuntimePacks(runtimeRoot);
|
|
68289
|
+
const prefix = RUNTIME_PACK_PREFIXES.find(
|
|
68290
|
+
(candidate) => pathname.includes(`/${candidate}`)
|
|
68291
|
+
);
|
|
68292
|
+
if (prefix) {
|
|
68293
|
+
await installNamedPack(runtimeRoot, prefix);
|
|
68294
|
+
return;
|
|
68295
|
+
}
|
|
68296
|
+
const listed = listedFiles(runtimeRoot).get(import_node_path102.default.posix.basename(pathname))?.find(({ file }) => pathname.endsWith(`/${file}`));
|
|
68297
|
+
if (listed) {
|
|
68298
|
+
if (!import_node_fs103.default.existsSync(import_node_path102.default.join(runtimeRoot, listed.file)))
|
|
68299
|
+
await installNamedPack(runtimeRoot, listed.pack);
|
|
68300
|
+
return;
|
|
68301
|
+
}
|
|
68302
|
+
const at = pathname.indexOf(`/${RUNTIME_MERGE_PACK_DIR}`);
|
|
68303
|
+
if (at === -1) return;
|
|
68304
|
+
const tenantDir = import_node_path102.default.join(runtimeRoot, RUNTIME_MERGE_PACK_DIR);
|
|
68305
|
+
const rel = pathname.slice(at + RUNTIME_MERGE_PACK_DIR.length + 1);
|
|
68306
|
+
if (!/\.m?js$/.test(rel) || import_node_fs103.default.existsSync(import_node_path102.default.join(tenantDir, rel))) return;
|
|
68307
|
+
await installNamedPack(runtimeRoot, RUNTIME_MERGE_PACK_DIR);
|
|
68308
|
+
}
|
|
68309
|
+
function installNamedPack(runtimeRoot, name3) {
|
|
68310
|
+
if (name3 === RUNTIME_MERGE_PACK_DIR) {
|
|
68311
|
+
const tenantDir = import_node_path102.default.join(runtimeRoot, RUNTIME_MERGE_PACK_DIR);
|
|
68312
|
+
return mergePack(
|
|
68313
|
+
runtimeRoot,
|
|
68314
|
+
name3,
|
|
68315
|
+
import_node_path102.default.join(tenantDir, RUNTIME_MERGE_PACK_INSTALL),
|
|
68316
|
+
tenantDir
|
|
68317
|
+
);
|
|
68318
|
+
}
|
|
68319
|
+
if (readPacks(runtimeRoot)?.[name3]?.files)
|
|
68320
|
+
return mergePack(
|
|
68321
|
+
runtimeRoot,
|
|
68322
|
+
name3,
|
|
68323
|
+
import_node_path102.default.join(runtimeRoot, `.pack-${name3}`),
|
|
68324
|
+
runtimeRoot
|
|
68325
|
+
);
|
|
68326
|
+
return installPack(runtimeRoot, name3, import_node_path102.default.join(runtimeRoot, name3.slice(0, -1)));
|
|
68327
|
+
}
|
|
68328
|
+
var WARM_DELAY_MS = 3e4;
|
|
68329
|
+
var warming = /* @__PURE__ */ new Set();
|
|
68330
|
+
function warmRuntimePacks(runtimeRoot) {
|
|
68331
|
+
if (warming.has(runtimeRoot)) return;
|
|
68332
|
+
warming.add(runtimeRoot);
|
|
68333
|
+
const warm = async () => {
|
|
68334
|
+
for (const name3 of Object.keys(readPacks(runtimeRoot) ?? {}))
|
|
68335
|
+
if (!await installNamedPack(runtimeRoot, name3)) return;
|
|
68336
|
+
};
|
|
68337
|
+
const schedule = import_node_timers2.setTimeout;
|
|
68338
|
+
schedule(() => void warm(), WARM_DELAY_MS).unref();
|
|
68339
|
+
}
|
|
68340
|
+
async function mergePack(runtimeRoot, name3, installDir, targetDir) {
|
|
68341
|
+
if (import_node_fs103.default.existsSync(import_node_path102.default.join(installDir, RUNTIME_MERGE_PACK_MERGED))) return true;
|
|
68342
|
+
if (!await installPack(runtimeRoot, name3, installDir)) return false;
|
|
68343
|
+
const link = (sub) => {
|
|
68344
|
+
for (const entry of import_node_fs103.default.readdirSync(import_node_path102.default.join(installDir, sub), {
|
|
68345
|
+
withFileTypes: true
|
|
68346
|
+
})) {
|
|
68347
|
+
const child = import_node_path102.default.join(sub, entry.name);
|
|
68348
|
+
if (entry.isDirectory()) {
|
|
68349
|
+
import_node_fs103.default.mkdirSync(import_node_path102.default.join(targetDir, child), { recursive: true });
|
|
68350
|
+
link(child);
|
|
68351
|
+
} else if (entry.name !== RUNTIME_PACK_MARKER) {
|
|
68352
|
+
try {
|
|
68353
|
+
import_node_fs103.default.linkSync(import_node_path102.default.join(installDir, child), import_node_path102.default.join(targetDir, child));
|
|
68354
|
+
} catch (error) {
|
|
68355
|
+
if (!(error instanceof Error && "code" in error && error.code === "EEXIST"))
|
|
68356
|
+
throw error;
|
|
68357
|
+
}
|
|
68358
|
+
}
|
|
68359
|
+
}
|
|
68360
|
+
};
|
|
68361
|
+
try {
|
|
68362
|
+
link("");
|
|
68363
|
+
import_node_fs103.default.writeFileSync(import_node_path102.default.join(installDir, RUNTIME_MERGE_PACK_MERGED), "");
|
|
68364
|
+
return true;
|
|
68365
|
+
} catch (error) {
|
|
68366
|
+
console.error(
|
|
68367
|
+
`[peach] ${name3} pack merge failed: ${error instanceof Error ? error.message : String(error)}`
|
|
68368
|
+
);
|
|
68369
|
+
return false;
|
|
68370
|
+
}
|
|
68371
|
+
}
|
|
68372
|
+
async function installPack(runtimeRoot, prefix, destDir) {
|
|
68373
|
+
const marker = import_node_path102.default.join(destDir, RUNTIME_PACK_MARKER);
|
|
68374
|
+
if (import_node_fs103.default.existsSync(marker)) return true;
|
|
68375
|
+
const pack = readPacks(runtimeRoot)?.[prefix];
|
|
68376
|
+
if (!pack) return true;
|
|
68377
|
+
let install = inflight.get(destDir);
|
|
68378
|
+
if (!install) {
|
|
68379
|
+
const version2 = import_node_path102.default.basename(runtimeRoot);
|
|
68380
|
+
const url = new URL(pack.file, rnxRuntime.tarballUrl(version2));
|
|
68381
|
+
url.searchParams.set("sha256", pack.sha256);
|
|
68382
|
+
install = installVerifiedTarball({
|
|
68383
|
+
url: url.toString(),
|
|
68384
|
+
digest: { algorithm: "sha256", encoding: "hex", value: pack.sha256 },
|
|
68385
|
+
destDir,
|
|
68386
|
+
installedMarker: RUNTIME_PACK_MARKER,
|
|
68387
|
+
label: `peach runtime ${version2} pack ${prefix}`
|
|
68388
|
+
}).catch((error) => {
|
|
68389
|
+
console.error(
|
|
68390
|
+
`[peach] ${prefix} pack download failed: ${error instanceof Error ? error.message : String(error)}`
|
|
68391
|
+
);
|
|
68392
|
+
}).finally(() => inflight.delete(destDir));
|
|
68393
|
+
inflight.set(destDir, install);
|
|
68394
|
+
}
|
|
68395
|
+
await install;
|
|
68396
|
+
return import_node_fs103.default.existsSync(marker);
|
|
68397
|
+
}
|
|
68398
|
+
|
|
68213
68399
|
// src/turbo-bundle.ts
|
|
68214
68400
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
68215
68401
|
var import_node_module17 = require("node:module");
|
|
68216
|
-
var
|
|
68402
|
+
var import_node_path103 = __toESM(require("node:path"), 1);
|
|
68217
68403
|
init_installed_native_libraries();
|
|
68218
68404
|
init_swift_distribution();
|
|
68219
68405
|
init_swift_host();
|
|
@@ -68265,8 +68451,8 @@ async function compileTurboApp(appRoot, origin, moduleRoot, iosTarget, prepareRe
|
|
|
68265
68451
|
}
|
|
68266
68452
|
const { artifact, collection } = await compileTurboModule({
|
|
68267
68453
|
appRoot,
|
|
68268
|
-
reactNativeRoot:
|
|
68269
|
-
(0, import_node_module17.createRequire)(
|
|
68454
|
+
reactNativeRoot: import_node_path103.default.dirname(
|
|
68455
|
+
(0, import_node_module17.createRequire)(import_node_path103.default.join(projectRoot, "package.json")).resolve(
|
|
68270
68456
|
"react-native/package.json"
|
|
68271
68457
|
)
|
|
68272
68458
|
),
|
|
@@ -68298,8 +68484,8 @@ var handleTurboRequest = compiledModuleRequestHandler(
|
|
|
68298
68484
|
// src/host/agent-host.ts
|
|
68299
68485
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
68300
68486
|
var import_node_crypto57 = require("node:crypto");
|
|
68301
|
-
var
|
|
68302
|
-
var
|
|
68487
|
+
var import_node_fs108 = __toESM(require("node:fs"), 1);
|
|
68488
|
+
var import_node_path109 = __toESM(require("node:path"), 1);
|
|
68303
68489
|
|
|
68304
68490
|
// scripts/dev-server-scanner.ts
|
|
68305
68491
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -68307,9 +68493,9 @@ var import_child_process = require("child_process");
|
|
|
68307
68493
|
var import_promises11 = require("fs/promises");
|
|
68308
68494
|
var import_http = __toESM(require("http"), 1);
|
|
68309
68495
|
var import_net = __toESM(require("net"), 1);
|
|
68310
|
-
var
|
|
68496
|
+
var import_node_fs105 = require("node:fs");
|
|
68311
68497
|
var import_node_os21 = require("node:os");
|
|
68312
|
-
var
|
|
68498
|
+
var import_node_path106 = require("node:path");
|
|
68313
68499
|
init_backend_origin();
|
|
68314
68500
|
|
|
68315
68501
|
// src/dev-bundle-resolution.ts
|
|
@@ -68577,7 +68763,7 @@ function configuredWidgetFromScan(value, bundleUrl) {
|
|
|
68577
68763
|
// src/settings-bundle.ts
|
|
68578
68764
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
68579
68765
|
var import_promises10 = require("node:fs/promises");
|
|
68580
|
-
var
|
|
68766
|
+
var import_node_path104 = require("node:path");
|
|
68581
68767
|
init_is_record();
|
|
68582
68768
|
init_plist();
|
|
68583
68769
|
var MAX_PLIST_BYTES = 1048576;
|
|
@@ -68658,9 +68844,9 @@ function safeChildPlistName(value) {
|
|
|
68658
68844
|
name: file.toLowerCase().endsWith(".plist") ? file : `${file}.plist`
|
|
68659
68845
|
};
|
|
68660
68846
|
}
|
|
68661
|
-
async function readableSettingsBundle(
|
|
68847
|
+
async function readableSettingsBundle(path112) {
|
|
68662
68848
|
try {
|
|
68663
|
-
const root = await (0, import_promises10.stat)((0,
|
|
68849
|
+
const root = await (0, import_promises10.stat)((0, import_node_path104.join)(path112, "Root.plist"));
|
|
68664
68850
|
return root.isFile() && root.size <= MAX_PLIST_BYTES;
|
|
68665
68851
|
} catch {
|
|
68666
68852
|
return false;
|
|
@@ -68668,18 +68854,18 @@ async function readableSettingsBundle(path111) {
|
|
|
68668
68854
|
}
|
|
68669
68855
|
async function findSettingsBundle(projectRoot) {
|
|
68670
68856
|
const directCandidates = [
|
|
68671
|
-
(0,
|
|
68672
|
-
(0,
|
|
68857
|
+
(0, import_node_path104.join)(projectRoot, "Settings.bundle"),
|
|
68858
|
+
(0, import_node_path104.join)(projectRoot, "ios", "Settings.bundle")
|
|
68673
68859
|
];
|
|
68674
68860
|
for (const candidate of directCandidates) {
|
|
68675
68861
|
if (await readableSettingsBundle(candidate)) return candidate;
|
|
68676
68862
|
}
|
|
68677
68863
|
try {
|
|
68678
|
-
const iosRoot = (0,
|
|
68864
|
+
const iosRoot = (0, import_node_path104.join)(projectRoot, "ios");
|
|
68679
68865
|
const children = await (0, import_promises10.readdir)(iosRoot, { withFileTypes: true });
|
|
68680
68866
|
const candidates = children.filter(
|
|
68681
68867
|
(entry) => entry.isDirectory() && entry.name !== "Pods" && entry.name !== "build" && !entry.name.startsWith(".")
|
|
68682
|
-
).map((entry) => (0,
|
|
68868
|
+
).map((entry) => (0, import_node_path104.join)(iosRoot, entry.name, "Settings.bundle")).sort();
|
|
68683
68869
|
for (const candidate of candidates) {
|
|
68684
68870
|
if (await readableSettingsBundle(candidate)) return candidate;
|
|
68685
68871
|
}
|
|
@@ -68694,7 +68880,7 @@ async function settingsBundleFingerprint(bundlePath) {
|
|
|
68694
68880
|
if (names.length === 0 || names.length > MAX_PLIST_FILES) return null;
|
|
68695
68881
|
const parts = await Promise.all(
|
|
68696
68882
|
names.map(async (name3) => {
|
|
68697
|
-
const metadata = await (0, import_promises10.stat)((0,
|
|
68883
|
+
const metadata = await (0, import_promises10.stat)((0, import_node_path104.join)(bundlePath, name3));
|
|
68698
68884
|
if (!metadata.isFile() || metadata.size > MAX_PLIST_BYTES) return null;
|
|
68699
68885
|
return `${name3}:${metadata.size}:${metadata.mtimeMs}:${metadata.ctimeMs}`;
|
|
68700
68886
|
})
|
|
@@ -68705,11 +68891,11 @@ async function settingsBundleFingerprint(bundlePath) {
|
|
|
68705
68891
|
return null;
|
|
68706
68892
|
}
|
|
68707
68893
|
}
|
|
68708
|
-
async function parsePlistRecord(
|
|
68894
|
+
async function parsePlistRecord(path112) {
|
|
68709
68895
|
try {
|
|
68710
|
-
const metadata = await (0, import_promises10.stat)(
|
|
68896
|
+
const metadata = await (0, import_promises10.stat)(path112);
|
|
68711
68897
|
if (!metadata.isFile() || metadata.size > MAX_PLIST_BYTES) return null;
|
|
68712
|
-
const source = await (0, import_promises10.readFile)(
|
|
68898
|
+
const source = await (0, import_promises10.readFile)(path112, "utf8");
|
|
68713
68899
|
const parsed = parsePlistSource(source);
|
|
68714
68900
|
return isRecord(parsed) ? parsed : null;
|
|
68715
68901
|
} catch {
|
|
@@ -68858,7 +69044,7 @@ async function parseSpecifierFile(fileName, context) {
|
|
|
68858
69044
|
return null;
|
|
68859
69045
|
}
|
|
68860
69046
|
context.budget.files += 1;
|
|
68861
|
-
const root = await parsePlistRecord((0,
|
|
69047
|
+
const root = await parsePlistRecord((0, import_node_path104.join)(context.bundlePath, fileName));
|
|
68862
69048
|
if (!root || !Array.isArray(root.PreferenceSpecifiers)) {
|
|
68863
69049
|
context.fileCache.set(fileName, null);
|
|
68864
69050
|
return null;
|
|
@@ -68912,8 +69098,8 @@ function parseSwiftHostDiscovery(value) {
|
|
|
68912
69098
|
|
|
68913
69099
|
// scripts/dev-server-scanner.ts
|
|
68914
69100
|
init_optional_demo_registry();
|
|
68915
|
-
var LISTENER_LOCK_PATH = (0,
|
|
68916
|
-
var LISTENER_RESULT_PATH = (0,
|
|
69101
|
+
var LISTENER_LOCK_PATH = (0, import_node_path106.join)((0, import_node_os21.tmpdir)(), "peach-listener-scan.lock");
|
|
69102
|
+
var LISTENER_RESULT_PATH = (0, import_node_path106.join)((0, import_node_os21.tmpdir)(), "peach-listener-scan.result");
|
|
68917
69103
|
var LISTENER_LOCK_STALE_MS = 25e3;
|
|
68918
69104
|
var LISTENER_LOCK_WAIT_MS = 8e3;
|
|
68919
69105
|
function sleep3(ms) {
|
|
@@ -68931,8 +69117,8 @@ function pidIsAlive(pid) {
|
|
|
68931
69117
|
}
|
|
68932
69118
|
function readLockOwner() {
|
|
68933
69119
|
try {
|
|
68934
|
-
const raw2 = (0,
|
|
68935
|
-
const mtimeMs = (0,
|
|
69120
|
+
const raw2 = (0, import_node_fs105.readFileSync)(LISTENER_LOCK_PATH, "utf8");
|
|
69121
|
+
const mtimeMs = (0, import_node_fs105.statSync)(LISTENER_LOCK_PATH).mtimeMs;
|
|
68936
69122
|
const pid = Number(raw2.split("-")[0]);
|
|
68937
69123
|
return { raw: raw2, pid: Number.isInteger(pid) ? pid : -1, mtimeMs };
|
|
68938
69124
|
} catch {
|
|
@@ -68945,15 +69131,15 @@ function lockIsAbandoned(owner) {
|
|
|
68945
69131
|
}
|
|
68946
69132
|
function clearLock(raw2) {
|
|
68947
69133
|
try {
|
|
68948
|
-
if ((0,
|
|
68949
|
-
(0,
|
|
69134
|
+
if ((0, import_node_fs105.readFileSync)(LISTENER_LOCK_PATH, "utf8") !== raw2) return;
|
|
69135
|
+
(0, import_node_fs105.unlinkSync)(LISTENER_LOCK_PATH);
|
|
68950
69136
|
} catch {
|
|
68951
69137
|
}
|
|
68952
69138
|
}
|
|
68953
69139
|
function readResult() {
|
|
68954
69140
|
try {
|
|
68955
69141
|
const parsed = JSON.parse(
|
|
68956
|
-
(0,
|
|
69142
|
+
(0, import_node_fs105.readFileSync)(LISTENER_RESULT_PATH, "utf8")
|
|
68957
69143
|
);
|
|
68958
69144
|
if (!parsed || typeof parsed.token !== "string" || typeof parsed.key !== "string")
|
|
68959
69145
|
return null;
|
|
@@ -68964,8 +69150,8 @@ function readResult() {
|
|
|
68964
69150
|
}
|
|
68965
69151
|
function publishResult(payload) {
|
|
68966
69152
|
const tmp = `${LISTENER_RESULT_PATH}.${process.pid}.tmp`;
|
|
68967
|
-
(0,
|
|
68968
|
-
(0,
|
|
69153
|
+
(0, import_node_fs105.writeFileSync)(tmp, JSON.stringify(payload));
|
|
69154
|
+
(0, import_node_fs105.renameSync)(tmp, LISTENER_RESULT_PATH);
|
|
68969
69155
|
}
|
|
68970
69156
|
function throwPublished(payload) {
|
|
68971
69157
|
throw Object.assign(new Error(payload.message || "listener scan failed"), {
|
|
@@ -69008,7 +69194,7 @@ async function withListenerLock(key2, body) {
|
|
|
69008
69194
|
for (; ; ) {
|
|
69009
69195
|
let fd = null;
|
|
69010
69196
|
try {
|
|
69011
|
-
fd = (0,
|
|
69197
|
+
fd = (0, import_node_fs105.openSync)(LISTENER_LOCK_PATH, "wx");
|
|
69012
69198
|
} catch (error) {
|
|
69013
69199
|
const code = error instanceof Error && "code" in error ? error.code : "";
|
|
69014
69200
|
if (code !== "EEXIST") throw error;
|
|
@@ -69017,7 +69203,7 @@ async function withListenerLock(key2, body) {
|
|
|
69017
69203
|
if (owner) clearLock(owner.raw);
|
|
69018
69204
|
else {
|
|
69019
69205
|
try {
|
|
69020
|
-
(0,
|
|
69206
|
+
(0, import_node_fs105.unlinkSync)(LISTENER_LOCK_PATH);
|
|
69021
69207
|
} catch {
|
|
69022
69208
|
}
|
|
69023
69209
|
}
|
|
@@ -69033,7 +69219,7 @@ async function withListenerLock(key2, body) {
|
|
|
69033
69219
|
}
|
|
69034
69220
|
if (fd === null) continue;
|
|
69035
69221
|
try {
|
|
69036
|
-
(0,
|
|
69222
|
+
(0, import_node_fs105.writeSync)(fd, token);
|
|
69037
69223
|
try {
|
|
69038
69224
|
const value = await body();
|
|
69039
69225
|
publishResult({ token, key: key2, ok: true, value });
|
|
@@ -69050,7 +69236,7 @@ async function withListenerLock(key2, body) {
|
|
|
69050
69236
|
}
|
|
69051
69237
|
} finally {
|
|
69052
69238
|
try {
|
|
69053
|
-
(0,
|
|
69239
|
+
(0, import_node_fs105.closeSync)(fd);
|
|
69054
69240
|
} catch {
|
|
69055
69241
|
}
|
|
69056
69242
|
clearLock(token);
|
|
@@ -69148,7 +69334,7 @@ async function tcpPing(port, timeout = TCP_GATE_MS) {
|
|
|
69148
69334
|
return null;
|
|
69149
69335
|
}
|
|
69150
69336
|
}
|
|
69151
|
-
function httpGet(hostname, port,
|
|
69337
|
+
function httpGet(hostname, port, path112, method = "GET", timeout = TIMEOUT_MS, headers = {}) {
|
|
69152
69338
|
return new Promise((resolve7) => {
|
|
69153
69339
|
let settled = false;
|
|
69154
69340
|
let killing = false;
|
|
@@ -69157,7 +69343,7 @@ function httpGet(hostname, port, path111, method = "GET", timeout = TIMEOUT_MS,
|
|
|
69157
69343
|
settled = true;
|
|
69158
69344
|
resolve7(value);
|
|
69159
69345
|
};
|
|
69160
|
-
const req = import_http.default.request({ hostname, port, path:
|
|
69346
|
+
const req = import_http.default.request({ hostname, port, path: path112, method, headers }, (res) => {
|
|
69161
69347
|
let body = "";
|
|
69162
69348
|
res.on("data", (c) => body += c.toString());
|
|
69163
69349
|
const contentType2 = (() => {
|
|
@@ -69474,16 +69660,16 @@ function resolveProcessCwd(pid) {
|
|
|
69474
69660
|
});
|
|
69475
69661
|
}
|
|
69476
69662
|
function nativeBundleRoot(projectCwd) {
|
|
69477
|
-
const ios = projectCwd && (0,
|
|
69478
|
-
if (!ios || !(0,
|
|
69663
|
+
const ios = projectCwd && (0, import_node_path106.join)(projectCwd, "ios");
|
|
69664
|
+
if (!ios || !(0, import_node_fs105.existsSync)(ios)) return "index";
|
|
69479
69665
|
const delegates = [
|
|
69480
69666
|
ios,
|
|
69481
|
-
...(0,
|
|
69667
|
+
...(0, import_node_fs105.readdirSync)(ios, { withFileTypes: true }).filter((entry) => entry.isDirectory() && entry.name !== "Pods").map((entry) => (0, import_node_path106.join)(ios, entry.name))
|
|
69482
69668
|
].flatMap(
|
|
69483
|
-
(directory2) => ["AppDelegate.swift", "AppDelegate.mm", "AppDelegate.m"].map((name3) => (0,
|
|
69669
|
+
(directory2) => ["AppDelegate.swift", "AppDelegate.mm", "AppDelegate.m"].map((name3) => (0, import_node_path106.join)(directory2, name3)).filter((file) => (0, import_node_fs105.existsSync)(file))
|
|
69484
69670
|
);
|
|
69485
69671
|
for (const file of delegates) {
|
|
69486
|
-
const root = /BundleRoot:\s*@?"([^"]+)"/.exec((0,
|
|
69672
|
+
const root = /BundleRoot:\s*@?"([^"]+)"/.exec((0, import_node_fs105.readFileSync)(file, "utf8"))?.[1];
|
|
69487
69673
|
if (root) return root;
|
|
69488
69674
|
}
|
|
69489
69675
|
return "index";
|
|
@@ -69507,13 +69693,13 @@ function withRuntimeConfig(port, bundleUrl, projectCwd) {
|
|
|
69507
69693
|
let physicalProjectCwd;
|
|
69508
69694
|
if (projectCwd && demoApps.length > 0) {
|
|
69509
69695
|
try {
|
|
69510
|
-
physicalProjectCwd = (0,
|
|
69696
|
+
physicalProjectCwd = (0, import_node_fs105.realpathSync)((0, import_node_path106.resolve)(projectCwd));
|
|
69511
69697
|
} catch {
|
|
69512
69698
|
}
|
|
69513
69699
|
}
|
|
69514
69700
|
const knownApps = physicalProjectCwd ? demoApps.filter((app) => {
|
|
69515
69701
|
try {
|
|
69516
|
-
return (0,
|
|
69702
|
+
return (0, import_node_fs105.realpathSync)((0, import_node_path106.resolve)(app.dir)) === physicalProjectCwd;
|
|
69517
69703
|
} catch {
|
|
69518
69704
|
return false;
|
|
69519
69705
|
}
|
|
@@ -70020,8 +70206,8 @@ async function scanDevServers(opts = {}) {
|
|
|
70020
70206
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
70021
70207
|
var import_node_child_process49 = require("node:child_process");
|
|
70022
70208
|
var import_node_crypto56 = require("node:crypto");
|
|
70023
|
-
var
|
|
70024
|
-
var
|
|
70209
|
+
var import_node_fs107 = __toESM(require("node:fs"), 1);
|
|
70210
|
+
var import_node_path108 = __toESM(require("node:path"), 1);
|
|
70025
70211
|
var import_node_readline = __toESM(require("node:readline"), 1);
|
|
70026
70212
|
init_self_invocation();
|
|
70027
70213
|
init_standalone();
|
|
@@ -70070,8 +70256,8 @@ function encodeAgentPromptEnvelope(input) {
|
|
|
70070
70256
|
// src/attached-projects.ts
|
|
70071
70257
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
70072
70258
|
var import_node_crypto55 = require("node:crypto");
|
|
70073
|
-
var
|
|
70074
|
-
var
|
|
70259
|
+
var import_node_fs106 = __toESM(require("node:fs"), 1);
|
|
70260
|
+
var import_node_path107 = __toESM(require("node:path"), 1);
|
|
70075
70261
|
init_home_paths();
|
|
70076
70262
|
var overrideDir = null;
|
|
70077
70263
|
function userDataDir() {
|
|
@@ -70084,7 +70270,7 @@ function getUserDataDir() {
|
|
|
70084
70270
|
return userDataDir();
|
|
70085
70271
|
}
|
|
70086
70272
|
function storeFile() {
|
|
70087
|
-
return
|
|
70273
|
+
return import_node_path107.default.join(userDataDir(), "attached-projects.json");
|
|
70088
70274
|
}
|
|
70089
70275
|
function cloneEmpty() {
|
|
70090
70276
|
return {
|
|
@@ -70098,7 +70284,7 @@ function loadStore() {
|
|
|
70098
70284
|
const file = storeFile();
|
|
70099
70285
|
let raw2;
|
|
70100
70286
|
try {
|
|
70101
|
-
raw2 =
|
|
70287
|
+
raw2 = import_node_fs106.default.readFileSync(file, "utf8");
|
|
70102
70288
|
} catch (err) {
|
|
70103
70289
|
if (err.code === "ENOENT") return cloneEmpty();
|
|
70104
70290
|
throw err;
|
|
@@ -70115,7 +70301,7 @@ function loadStore() {
|
|
|
70115
70301
|
} catch (err) {
|
|
70116
70302
|
const quarantine = `${file}.corrupt-${Date.now()}`;
|
|
70117
70303
|
try {
|
|
70118
|
-
|
|
70304
|
+
import_node_fs106.default.renameSync(file, quarantine);
|
|
70119
70305
|
console.warn(
|
|
70120
70306
|
`[sootsim] attached-projects.json was unparseable; quarantined to ${quarantine}. original error: ${err.message}`
|
|
70121
70307
|
);
|
|
@@ -70126,16 +70312,16 @@ function loadStore() {
|
|
|
70126
70312
|
}
|
|
70127
70313
|
function writeStore(store) {
|
|
70128
70314
|
const file = storeFile();
|
|
70129
|
-
|
|
70315
|
+
import_node_fs106.default.mkdirSync(import_node_path107.default.dirname(file), { recursive: true });
|
|
70130
70316
|
const tmp = `${file}.tmp-${process.pid}-${Date.now()}`;
|
|
70131
|
-
const fd =
|
|
70317
|
+
const fd = import_node_fs106.default.openSync(tmp, "w", 384);
|
|
70132
70318
|
try {
|
|
70133
|
-
|
|
70134
|
-
|
|
70319
|
+
import_node_fs106.default.writeFileSync(fd, JSON.stringify(store, null, 2));
|
|
70320
|
+
import_node_fs106.default.fsyncSync(fd);
|
|
70135
70321
|
} finally {
|
|
70136
|
-
|
|
70322
|
+
import_node_fs106.default.closeSync(fd);
|
|
70137
70323
|
}
|
|
70138
|
-
|
|
70324
|
+
import_node_fs106.default.renameSync(tmp, file);
|
|
70139
70325
|
}
|
|
70140
70326
|
function mutateStore(fn) {
|
|
70141
70327
|
const store = loadStore();
|
|
@@ -70144,13 +70330,13 @@ function mutateStore(fn) {
|
|
|
70144
70330
|
return store;
|
|
70145
70331
|
}
|
|
70146
70332
|
function projectIdForCwd(cwd) {
|
|
70147
|
-
return (0, import_node_crypto55.createHash)("sha256").update(
|
|
70333
|
+
return (0, import_node_crypto55.createHash)("sha256").update(import_node_path107.default.resolve(cwd)).digest("hex").slice(0, 16);
|
|
70148
70334
|
}
|
|
70149
70335
|
function newSessionId() {
|
|
70150
70336
|
return `s_${(0, import_node_crypto55.randomBytes)(10).toString("hex")}`;
|
|
70151
70337
|
}
|
|
70152
70338
|
function upsertProject(input) {
|
|
70153
|
-
const cwd =
|
|
70339
|
+
const cwd = import_node_path107.default.resolve(input.cwd);
|
|
70154
70340
|
const id = projectIdForCwd(cwd);
|
|
70155
70341
|
let result;
|
|
70156
70342
|
mutateStore((store) => {
|
|
@@ -70176,7 +70362,7 @@ function upsertProject(input) {
|
|
|
70176
70362
|
const now = Date.now();
|
|
70177
70363
|
const created = {
|
|
70178
70364
|
id,
|
|
70179
|
-
name: input.name ??
|
|
70365
|
+
name: input.name ?? import_node_path107.default.basename(cwd),
|
|
70180
70366
|
cwd,
|
|
70181
70367
|
repoRoot: input.repoRoot,
|
|
70182
70368
|
sourceRoots: input.sourceRoots ?? [cwd],
|
|
@@ -70322,8 +70508,8 @@ async function seedFromDemoAppRegistry() {
|
|
|
70322
70508
|
if (apps.length === 0) return;
|
|
70323
70509
|
mutateStore((store) => {
|
|
70324
70510
|
for (const app of apps) {
|
|
70325
|
-
if (!
|
|
70326
|
-
const cwd =
|
|
70511
|
+
if (!import_node_fs106.default.existsSync(app.dir)) continue;
|
|
70512
|
+
const cwd = import_node_path107.default.resolve(app.dir);
|
|
70327
70513
|
const id = projectIdForCwd(cwd);
|
|
70328
70514
|
if (store.attachedProjects.some((p) => p.id === id)) continue;
|
|
70329
70515
|
const now = Date.now();
|
|
@@ -70348,16 +70534,16 @@ async function seedFromDemoAppRegistry() {
|
|
|
70348
70534
|
// src/agent-sessions.ts
|
|
70349
70535
|
init_public_brand();
|
|
70350
70536
|
function sessionDir(sessionId) {
|
|
70351
|
-
return
|
|
70537
|
+
return import_node_path108.default.join(getUserDataDir(), "sessions", sessionId);
|
|
70352
70538
|
}
|
|
70353
70539
|
function promptFifoPath(sessionId) {
|
|
70354
|
-
return
|
|
70540
|
+
return import_node_path108.default.join(sessionDir(sessionId), "prompt.in");
|
|
70355
70541
|
}
|
|
70356
70542
|
function eventsFifoPath(sessionId) {
|
|
70357
|
-
return
|
|
70543
|
+
return import_node_path108.default.join(sessionDir(sessionId), "events.out");
|
|
70358
70544
|
}
|
|
70359
70545
|
function transcriptPath(sessionId) {
|
|
70360
|
-
return
|
|
70546
|
+
return import_node_path108.default.join(getUserDataDir(), "transcripts", `${sessionId}.log`);
|
|
70361
70547
|
}
|
|
70362
70548
|
function pidIsAlive2(pid, sessionId) {
|
|
70363
70549
|
if (!pid) return false;
|
|
@@ -70367,7 +70553,7 @@ function pidIsAlive2(pid, sessionId) {
|
|
|
70367
70553
|
return false;
|
|
70368
70554
|
}
|
|
70369
70555
|
if (sessionId) {
|
|
70370
|
-
if (!
|
|
70556
|
+
if (!import_node_fs107.default.existsSync(sessionDir(sessionId))) return false;
|
|
70371
70557
|
}
|
|
70372
70558
|
return true;
|
|
70373
70559
|
}
|
|
@@ -70380,11 +70566,11 @@ function resolveSootsimInvocation() {
|
|
|
70380
70566
|
const resourcesPath = process.resourcesPath;
|
|
70381
70567
|
if (resourcesPath) {
|
|
70382
70568
|
const candidates = [
|
|
70383
|
-
|
|
70384
|
-
|
|
70569
|
+
import_node_path108.default.join(resourcesPath, "bin", "sootsim"),
|
|
70570
|
+
import_node_path108.default.join(resourcesPath, "bin", `sootsim-${process.platform}-${process.arch}`)
|
|
70385
70571
|
];
|
|
70386
70572
|
for (const c of candidates) {
|
|
70387
|
-
if (
|
|
70573
|
+
if (import_node_fs107.default.existsSync(c)) return { executable: c, prefixArgs: [] };
|
|
70388
70574
|
}
|
|
70389
70575
|
}
|
|
70390
70576
|
}
|
|
@@ -70403,15 +70589,15 @@ function tryWorkspaceSootsim() {
|
|
|
70403
70589
|
const sootsimDir = resolveSootsimPackageDir();
|
|
70404
70590
|
if (!sootsimDir) return null;
|
|
70405
70591
|
const binaryName = `peach-${process.platform === "win32" ? "windows" : process.platform}-${process.arch}${process.platform === "win32" ? ".exe" : ""}`;
|
|
70406
|
-
const distBinary =
|
|
70407
|
-
if (
|
|
70408
|
-
const distBin =
|
|
70409
|
-
if (
|
|
70592
|
+
const distBinary = import_node_path108.default.join(sootsimDir, "dist-bin", binaryName);
|
|
70593
|
+
if (import_node_fs107.default.existsSync(distBinary)) return { executable: distBinary, prefixArgs: [] };
|
|
70594
|
+
const distBin = import_node_path108.default.join(sootsimDir, "dist-cli", "bin.js");
|
|
70595
|
+
if (import_node_fs107.default.existsSync(distBin)) {
|
|
70410
70596
|
try {
|
|
70411
|
-
const src =
|
|
70412
|
-
if (
|
|
70413
|
-
const srcMtime =
|
|
70414
|
-
const buildMtime =
|
|
70597
|
+
const src = import_node_path108.default.join(sootsimDir, "cli", "commands", "agent-wrapper.ts");
|
|
70598
|
+
if (import_node_fs107.default.existsSync(src)) {
|
|
70599
|
+
const srcMtime = import_node_fs107.default.statSync(src).mtimeMs;
|
|
70600
|
+
const buildMtime = import_node_fs107.default.statSync(distBin).mtimeMs;
|
|
70415
70601
|
if (buildMtime < srcMtime) {
|
|
70416
70602
|
console.warn(
|
|
70417
70603
|
`[peach] dist-cli/bin.js is older than agent-wrapper.ts \u2014 rebuild with \`bun run --cwd packages/peachsim build:cli\`.`
|
|
@@ -70430,22 +70616,22 @@ function tryWorkspaceSootsim() {
|
|
|
70430
70616
|
function resolveSootsimPackageDir() {
|
|
70431
70617
|
try {
|
|
70432
70618
|
const resolved = require.resolve(`${rnxPublicBrand.packageName}/package.json`);
|
|
70433
|
-
return
|
|
70619
|
+
return import_node_path108.default.dirname(resolved);
|
|
70434
70620
|
} catch {
|
|
70435
70621
|
}
|
|
70436
70622
|
const here = fileFromImportMeta();
|
|
70437
70623
|
if (!here) return null;
|
|
70438
|
-
let cur =
|
|
70624
|
+
let cur = import_node_path108.default.dirname(here);
|
|
70439
70625
|
for (let i = 0; i < 8; i++) {
|
|
70440
|
-
const pkg =
|
|
70626
|
+
const pkg = import_node_path108.default.join(cur, "package.json");
|
|
70441
70627
|
try {
|
|
70442
|
-
if (
|
|
70443
|
-
const parsed = JSON.parse(
|
|
70628
|
+
if (import_node_fs107.default.existsSync(pkg)) {
|
|
70629
|
+
const parsed = JSON.parse(import_node_fs107.default.readFileSync(pkg, "utf8"));
|
|
70444
70630
|
if (parsed.name === rnxPublicBrand.packageName) return cur;
|
|
70445
70631
|
}
|
|
70446
70632
|
} catch {
|
|
70447
70633
|
}
|
|
70448
|
-
const parent =
|
|
70634
|
+
const parent = import_node_path108.default.dirname(cur);
|
|
70449
70635
|
if (parent === cur) break;
|
|
70450
70636
|
cur = parent;
|
|
70451
70637
|
}
|
|
@@ -70461,28 +70647,28 @@ function fileFromImportMeta() {
|
|
|
70461
70647
|
}
|
|
70462
70648
|
}
|
|
70463
70649
|
async function withStartLock(projectId, provider, fn) {
|
|
70464
|
-
const lockDir =
|
|
70465
|
-
|
|
70650
|
+
const lockDir = import_node_path108.default.join(getUserDataDir(), "locks");
|
|
70651
|
+
import_node_fs107.default.mkdirSync(lockDir, { recursive: true });
|
|
70466
70652
|
try {
|
|
70467
|
-
|
|
70653
|
+
import_node_fs107.default.chmodSync(lockDir, 448);
|
|
70468
70654
|
} catch {
|
|
70469
70655
|
}
|
|
70470
|
-
const lockPath =
|
|
70656
|
+
const lockPath = import_node_path108.default.join(lockDir, `start-${projectId}-${provider}.lock`);
|
|
70471
70657
|
const deadline = Date.now() + 4e3;
|
|
70472
70658
|
let fd = null;
|
|
70473
70659
|
while (fd === null) {
|
|
70474
70660
|
try {
|
|
70475
|
-
fd =
|
|
70661
|
+
fd = import_node_fs107.default.openSync(
|
|
70476
70662
|
lockPath,
|
|
70477
|
-
|
|
70663
|
+
import_node_fs107.constants.O_WRONLY | import_node_fs107.constants.O_CREAT | import_node_fs107.constants.O_EXCL,
|
|
70478
70664
|
384
|
|
70479
70665
|
);
|
|
70480
70666
|
} catch (err) {
|
|
70481
70667
|
if (err.code !== "EEXIST") throw err;
|
|
70482
70668
|
try {
|
|
70483
|
-
const stale = Number(
|
|
70669
|
+
const stale = Number(import_node_fs107.default.readFileSync(lockPath, "utf8").trim());
|
|
70484
70670
|
if (stale && !isProcessAlive(stale)) {
|
|
70485
|
-
|
|
70671
|
+
import_node_fs107.default.unlinkSync(lockPath);
|
|
70486
70672
|
continue;
|
|
70487
70673
|
}
|
|
70488
70674
|
} catch {
|
|
@@ -70496,15 +70682,15 @@ async function withStartLock(projectId, provider, fn) {
|
|
|
70496
70682
|
}
|
|
70497
70683
|
}
|
|
70498
70684
|
try {
|
|
70499
|
-
|
|
70685
|
+
import_node_fs107.default.writeFileSync(fd, String(process.pid));
|
|
70500
70686
|
return await fn();
|
|
70501
70687
|
} finally {
|
|
70502
70688
|
try {
|
|
70503
|
-
|
|
70689
|
+
import_node_fs107.default.closeSync(fd);
|
|
70504
70690
|
} catch {
|
|
70505
70691
|
}
|
|
70506
70692
|
try {
|
|
70507
|
-
|
|
70693
|
+
import_node_fs107.default.unlinkSync(lockPath);
|
|
70508
70694
|
} catch {
|
|
70509
70695
|
}
|
|
70510
70696
|
}
|
|
@@ -70518,25 +70704,25 @@ function isProcessAlive(pid) {
|
|
|
70518
70704
|
}
|
|
70519
70705
|
}
|
|
70520
70706
|
function mkfifoSync(p) {
|
|
70521
|
-
const parent =
|
|
70522
|
-
|
|
70707
|
+
const parent = import_node_path108.default.dirname(p);
|
|
70708
|
+
import_node_fs107.default.mkdirSync(parent, { recursive: true });
|
|
70523
70709
|
try {
|
|
70524
|
-
|
|
70710
|
+
import_node_fs107.default.chmodSync(parent, 448);
|
|
70525
70711
|
} catch {
|
|
70526
70712
|
}
|
|
70527
|
-
if (
|
|
70713
|
+
if (import_node_fs107.default.existsSync(p)) {
|
|
70528
70714
|
try {
|
|
70529
|
-
const stat2 =
|
|
70715
|
+
const stat2 = import_node_fs107.default.statSync(p);
|
|
70530
70716
|
if (stat2.isFIFO()) {
|
|
70531
70717
|
try {
|
|
70532
|
-
|
|
70718
|
+
import_node_fs107.default.chmodSync(p, 384);
|
|
70533
70719
|
} catch {
|
|
70534
70720
|
}
|
|
70535
70721
|
return;
|
|
70536
70722
|
}
|
|
70537
|
-
|
|
70723
|
+
import_node_fs107.default.unlinkSync(p);
|
|
70538
70724
|
} catch {
|
|
70539
|
-
|
|
70725
|
+
import_node_fs107.default.unlinkSync(p);
|
|
70540
70726
|
}
|
|
70541
70727
|
}
|
|
70542
70728
|
const result = (0, import_node_child_process49.spawnSync)("mkfifo", ["-m", "600", p]);
|
|
@@ -70583,10 +70769,10 @@ async function startSession(opts) {
|
|
|
70583
70769
|
const transcript = transcriptPath(session.id);
|
|
70584
70770
|
mkfifoSync(promptIn);
|
|
70585
70771
|
mkfifoSync(eventsOut);
|
|
70586
|
-
const transcriptDir =
|
|
70587
|
-
|
|
70772
|
+
const transcriptDir = import_node_path108.default.dirname(transcript);
|
|
70773
|
+
import_node_fs107.default.mkdirSync(transcriptDir, { recursive: true });
|
|
70588
70774
|
try {
|
|
70589
|
-
|
|
70775
|
+
import_node_fs107.default.chmodSync(transcriptDir, 448);
|
|
70590
70776
|
} catch {
|
|
70591
70777
|
}
|
|
70592
70778
|
const { executable, prefixArgs } = resolveSootsimInvocation();
|
|
@@ -70637,7 +70823,7 @@ async function startSession(opts) {
|
|
|
70637
70823
|
}
|
|
70638
70824
|
}
|
|
70639
70825
|
try {
|
|
70640
|
-
|
|
70826
|
+
import_node_fs107.default.rmSync(sessionDir(session.id), { recursive: true, force: true });
|
|
70641
70827
|
} catch {
|
|
70642
70828
|
}
|
|
70643
70829
|
updateSessionStatus(session.id, { status: "ended" });
|
|
@@ -70665,18 +70851,18 @@ async function sendPrompt(sessionId, prompt) {
|
|
|
70665
70851
|
);
|
|
70666
70852
|
}
|
|
70667
70853
|
const fifo = promptFifoPath(sessionId);
|
|
70668
|
-
if (!
|
|
70854
|
+
if (!import_node_fs107.default.existsSync(fifo)) {
|
|
70669
70855
|
throw new AgentSessionError("NO_FIFO", `prompt FIFO missing: ${fifo}`);
|
|
70670
70856
|
}
|
|
70671
|
-
const fd =
|
|
70857
|
+
const fd = import_node_fs107.default.openSync(fifo, import_node_fs107.constants.O_WRONLY);
|
|
70672
70858
|
try {
|
|
70673
70859
|
const wireText = encodeAgentPromptEnvelope(prompt);
|
|
70674
70860
|
if (!wireText) {
|
|
70675
70861
|
throw new AgentSessionError("EMPTY_PROMPT", "prompt text is empty");
|
|
70676
70862
|
}
|
|
70677
|
-
|
|
70863
|
+
import_node_fs107.default.writeSync(fd, wireText + "\n");
|
|
70678
70864
|
} finally {
|
|
70679
|
-
|
|
70865
|
+
import_node_fs107.default.closeSync(fd);
|
|
70680
70866
|
}
|
|
70681
70867
|
updateSessionStatus(sessionId, {
|
|
70682
70868
|
lastPrompt: prompt.displayText ?? prompt.text,
|
|
@@ -70698,7 +70884,7 @@ async function endSession(sessionId) {
|
|
|
70698
70884
|
const base = getUserDataDir();
|
|
70699
70885
|
if (dir.startsWith(base)) {
|
|
70700
70886
|
try {
|
|
70701
|
-
|
|
70887
|
+
import_node_fs107.default.rmSync(dir, { recursive: true, force: true });
|
|
70702
70888
|
} catch {
|
|
70703
70889
|
}
|
|
70704
70890
|
}
|
|
@@ -70706,11 +70892,11 @@ async function endSession(sessionId) {
|
|
|
70706
70892
|
}
|
|
70707
70893
|
function subscribeEvents(sessionId, onEvent) {
|
|
70708
70894
|
const fifo = eventsFifoPath(sessionId);
|
|
70709
|
-
if (!
|
|
70895
|
+
if (!import_node_fs107.default.existsSync(fifo)) {
|
|
70710
70896
|
throw new AgentSessionError("NO_FIFO", `events FIFO missing: ${fifo}`);
|
|
70711
70897
|
}
|
|
70712
|
-
const fd =
|
|
70713
|
-
const stream =
|
|
70898
|
+
const fd = import_node_fs107.default.openSync(fifo, import_node_fs107.constants.O_RDWR);
|
|
70899
|
+
const stream = import_node_fs107.default.createReadStream("", { fd, autoClose: true });
|
|
70714
70900
|
const rl = import_node_readline.default.createInterface({ input: stream, crlfDelay: Infinity });
|
|
70715
70901
|
rl.on("line", (line) => {
|
|
70716
70902
|
const event = parseAgentEventLine(line);
|
|
@@ -70721,7 +70907,7 @@ function subscribeEvents(sessionId, onEvent) {
|
|
|
70721
70907
|
if (closed) return;
|
|
70722
70908
|
closed = true;
|
|
70723
70909
|
try {
|
|
70724
|
-
|
|
70910
|
+
import_node_fs107.default.writeSync(fd, "\n");
|
|
70725
70911
|
} catch {
|
|
70726
70912
|
}
|
|
70727
70913
|
try {
|
|
@@ -70735,7 +70921,7 @@ function subscribeEvents(sessionId, onEvent) {
|
|
|
70735
70921
|
};
|
|
70736
70922
|
}
|
|
70737
70923
|
async function waitForFirstEvent(fifo, predicate, timeoutMs) {
|
|
70738
|
-
const fd =
|
|
70924
|
+
const fd = import_node_fs107.default.openSync(fifo, import_node_fs107.constants.O_RDWR | import_node_fs107.constants.O_NONBLOCK);
|
|
70739
70925
|
const buf = Buffer.alloc(8192);
|
|
70740
70926
|
let leftover = "";
|
|
70741
70927
|
const deadline = Date.now() + timeoutMs;
|
|
@@ -70743,7 +70929,7 @@ async function waitForFirstEvent(fifo, predicate, timeoutMs) {
|
|
|
70743
70929
|
while (Date.now() < deadline) {
|
|
70744
70930
|
let n = 0;
|
|
70745
70931
|
try {
|
|
70746
|
-
n =
|
|
70932
|
+
n = import_node_fs107.default.readSync(fd, buf, 0, buf.length, null);
|
|
70747
70933
|
} catch (err) {
|
|
70748
70934
|
if (err.code !== "EAGAIN") throw err;
|
|
70749
70935
|
n = 0;
|
|
@@ -70763,7 +70949,7 @@ async function waitForFirstEvent(fifo, predicate, timeoutMs) {
|
|
|
70763
70949
|
}
|
|
70764
70950
|
return null;
|
|
70765
70951
|
} finally {
|
|
70766
|
-
|
|
70952
|
+
import_node_fs107.default.closeSync(fd);
|
|
70767
70953
|
}
|
|
70768
70954
|
}
|
|
70769
70955
|
|
|
@@ -71017,7 +71203,7 @@ var AgentHost = class {
|
|
|
71017
71203
|
);
|
|
71018
71204
|
const project2 = upsertProject({
|
|
71019
71205
|
cwd: match.cwd,
|
|
71020
|
-
name: match.projectName ??
|
|
71206
|
+
name: match.projectName ?? import_node_path109.default.basename(match.cwd),
|
|
71021
71207
|
preferredProvider: input.provider ?? existing?.preferredProvider,
|
|
71022
71208
|
sourceRoots: existing?.sourceRoots ?? [match.cwd],
|
|
71023
71209
|
knownBundleUrls,
|
|
@@ -71028,18 +71214,18 @@ var AgentHost = class {
|
|
|
71028
71214
|
}
|
|
71029
71215
|
getTranscript(sessionId) {
|
|
71030
71216
|
const p = transcriptPath(sessionId);
|
|
71031
|
-
if (!
|
|
71217
|
+
if (!import_node_fs108.default.existsSync(p)) {
|
|
71032
71218
|
return { error: "transcript not found", code: "NO_TRANSCRIPT" };
|
|
71033
71219
|
}
|
|
71034
|
-
return
|
|
71220
|
+
return import_node_fs108.default.readFileSync(p, "utf8");
|
|
71035
71221
|
}
|
|
71036
71222
|
getPaths() {
|
|
71037
71223
|
const dir = getUserDataDir();
|
|
71038
71224
|
return {
|
|
71039
71225
|
userDataDir: dir,
|
|
71040
|
-
storeFile:
|
|
71041
|
-
sessionsDir:
|
|
71042
|
-
transcriptsDir:
|
|
71226
|
+
storeFile: import_node_path109.default.join(dir, "attached-projects.json"),
|
|
71227
|
+
sessionsDir: import_node_path109.default.join(dir, "sessions"),
|
|
71228
|
+
transcriptsDir: import_node_path109.default.join(dir, "transcripts")
|
|
71043
71229
|
};
|
|
71044
71230
|
}
|
|
71045
71231
|
// --- subscription management ---
|
|
@@ -71337,19 +71523,19 @@ function mapFrameworkToProjectFramework(fw) {
|
|
|
71337
71523
|
|
|
71338
71524
|
// src/host/app-package-handler.ts
|
|
71339
71525
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
71340
|
-
var
|
|
71341
|
-
var
|
|
71526
|
+
var import_node_fs109 = __toESM(require("node:fs"), 1);
|
|
71527
|
+
var import_node_path110 = __toESM(require("node:path"), 1);
|
|
71342
71528
|
init_home_paths();
|
|
71343
71529
|
init_is_record();
|
|
71344
71530
|
function readRoutes() {
|
|
71345
71531
|
const file = process.env.PEACH_APP_MANIFEST;
|
|
71346
71532
|
const routes2 = /* @__PURE__ */ new Map();
|
|
71347
71533
|
if (!file) return routes2;
|
|
71348
|
-
const manifest = JSON.parse(
|
|
71534
|
+
const manifest = JSON.parse(import_node_fs109.default.readFileSync(file, "utf8"));
|
|
71349
71535
|
if (!isRecord(manifest) || manifest.schemaVersion !== 1 || !isRecord(manifest.routes))
|
|
71350
71536
|
throw new Error("invalid packaged app manifest");
|
|
71351
71537
|
for (const [route, resource] of Object.entries(manifest.routes)) {
|
|
71352
|
-
if (!route.startsWith("/") || !isRecord(resource) || typeof resource.file !== "string" || !resource.file ||
|
|
71538
|
+
if (!route.startsWith("/") || !isRecord(resource) || typeof resource.file !== "string" || !resource.file || import_node_path110.default.basename(resource.file) !== resource.file || [".", ".."].includes(resource.file) || typeof resource.contentType !== "string" || /[\r\n]/.test(resource.contentType))
|
|
71353
71539
|
throw new Error(`invalid packaged app resource: ${route}`);
|
|
71354
71540
|
routes2.set(route, { file: resource.file, contentType: resource.contentType });
|
|
71355
71541
|
}
|
|
@@ -71360,7 +71546,7 @@ function serveAppPackageResource(req, res) {
|
|
|
71360
71546
|
const resource = routes.get(new URL(req.url ?? "/", "http://localhost").pathname);
|
|
71361
71547
|
if (!resource) return false;
|
|
71362
71548
|
res.setHeader("Content-Type", resource.contentType);
|
|
71363
|
-
const stream =
|
|
71549
|
+
const stream = import_node_fs109.default.createReadStream(import_node_path110.default.join(cacheDir(), "staged", resource.file));
|
|
71364
71550
|
stream.on("error", () => {
|
|
71365
71551
|
res.statusCode = 500;
|
|
71366
71552
|
res.end("packaged resource unavailable");
|
|
@@ -74227,8 +74413,8 @@ init_package_versions();
|
|
|
74227
74413
|
|
|
74228
74414
|
// src/installed-native-build-options.ts
|
|
74229
74415
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
74230
|
-
var
|
|
74231
|
-
var
|
|
74416
|
+
var import_node_fs110 = __toESM(require("node:fs"), 1);
|
|
74417
|
+
var import_node_path111 = __toESM(require("node:path"), 1);
|
|
74232
74418
|
var RIVE_PACKAGE = "@rive-app/react-native";
|
|
74233
74419
|
var RIVE_05 = [">=0.5.0 <0.6.0"];
|
|
74234
74420
|
function missing(error) {
|
|
@@ -74236,11 +74422,11 @@ function missing(error) {
|
|
|
74236
74422
|
}
|
|
74237
74423
|
async function answerAsync(step) {
|
|
74238
74424
|
try {
|
|
74239
|
-
if (step.type === "realpath") return await
|
|
74240
|
-
if (step.type === "read") return await
|
|
74425
|
+
if (step.type === "realpath") return await import_node_fs110.default.promises.realpath(step.path);
|
|
74426
|
+
if (step.type === "read") return await import_node_fs110.default.promises.readFile(step.path, "utf8");
|
|
74241
74427
|
if (step.type === "isDirectory")
|
|
74242
|
-
return (await
|
|
74243
|
-
return (await
|
|
74428
|
+
return (await import_node_fs110.default.promises.stat(step.path)).isDirectory();
|
|
74429
|
+
return (await import_node_fs110.default.promises.readdir(step.path, { withFileTypes: true })).map(
|
|
74244
74430
|
(entry) => ({
|
|
74245
74431
|
name: entry.name,
|
|
74246
74432
|
directory: entry.isDirectory(),
|
|
@@ -74273,7 +74459,7 @@ function* rubyFiles(directory2, seen, iosRoot = false) {
|
|
|
74273
74459
|
const files2 = [];
|
|
74274
74460
|
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
74275
74461
|
if (iosRoot && (entry.name === "Pods" || entry.name === "build")) continue;
|
|
74276
|
-
const target =
|
|
74462
|
+
const target = import_node_path111.default.join(directory2, entry.name);
|
|
74277
74463
|
let isDirectory3 = entry.directory;
|
|
74278
74464
|
if (entry.symbolicLink)
|
|
74279
74465
|
isDirectory3 = (yield { type: "isDirectory", path: target }) === true;
|
|
@@ -74286,7 +74472,7 @@ function* nativeBuildOptionsWalk(projectRoot, versions, environment) {
|
|
|
74286
74472
|
let sensorOptions = {};
|
|
74287
74473
|
const sensors = versions["expo-sensors"];
|
|
74288
74474
|
if (sensors && resolveCompatVersionRange([">=58.0.4 <59.0.0"], sensors).status === "matched") {
|
|
74289
|
-
const file =
|
|
74475
|
+
const file = import_node_path111.default.join(projectRoot, "ios", "Podfile.properties.json");
|
|
74290
74476
|
const source = yield { type: "read", path: file };
|
|
74291
74477
|
if (source !== null && typeof source !== "string")
|
|
74292
74478
|
throw new Error(`cannot inspect ${file}`);
|
|
@@ -74302,8 +74488,8 @@ function* nativeBuildOptionsWalk(projectRoot, versions, environment) {
|
|
|
74302
74488
|
if (!needsRiveOptions(versions)) return sensorOptions;
|
|
74303
74489
|
if (environment.USE_RIVE_LEGACY === "1" || environment.USE_RIVE_LEGACY === "true")
|
|
74304
74490
|
return { ...sensorOptions, [RIVE_PACKAGE]: { USE_RIVE_LEGACY: true } };
|
|
74305
|
-
const ios =
|
|
74306
|
-
const podfile =
|
|
74491
|
+
const ios = import_node_path111.default.join(projectRoot, "ios");
|
|
74492
|
+
const podfile = import_node_path111.default.join(ios, "Podfile");
|
|
74307
74493
|
const files2 = [podfile, ...yield* rubyFiles(ios, /* @__PURE__ */ new Set(), true)];
|
|
74308
74494
|
let value = false;
|
|
74309
74495
|
let assigned = false;
|
|
@@ -74754,7 +74940,7 @@ function parseIpv6(text6) {
|
|
|
74754
74940
|
|
|
74755
74941
|
// src/host/network-policy.ts
|
|
74756
74942
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
74757
|
-
var
|
|
74943
|
+
var import_node_path112 = require("node:path");
|
|
74758
74944
|
var import_node_url8 = require("node:url");
|
|
74759
74945
|
var NETWORK_POLICY_TIMEOUT_MS = 1e4;
|
|
74760
74946
|
var NetworkPolicyDeniedError = class extends Error {
|
|
@@ -74807,7 +74993,7 @@ function createNetworkAuthorizer(policy) {
|
|
|
74807
74993
|
};
|
|
74808
74994
|
}
|
|
74809
74995
|
async function loadNetworkPolicy(file) {
|
|
74810
|
-
if (!(0,
|
|
74996
|
+
if (!(0, import_node_path112.isAbsolute)(file)) {
|
|
74811
74997
|
throw new Error(`PEACH_NETWORK_POLICY must be an absolute path: ${file}`);
|
|
74812
74998
|
}
|
|
74813
74999
|
const loaded3 = await import(
|
|
@@ -75347,14 +75533,14 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
75347
75533
|
// src/host/fetch-proxy-transport.ts
|
|
75348
75534
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
75349
75535
|
var import_node_crypto58 = require("node:crypto");
|
|
75350
|
-
var
|
|
75536
|
+
var import_node_fs111 = require("node:fs");
|
|
75351
75537
|
var import_node_http22 = require("node:http2");
|
|
75352
|
-
var
|
|
75538
|
+
var import_node_path113 = __toESM(require("node:path"), 1);
|
|
75353
75539
|
var import_x509 = require("@peculiar/x509");
|
|
75354
75540
|
function readIdentity(identityPath) {
|
|
75355
75541
|
let parsed;
|
|
75356
75542
|
try {
|
|
75357
|
-
parsed = JSON.parse((0,
|
|
75543
|
+
parsed = JSON.parse((0, import_node_fs111.readFileSync)(identityPath, "utf8"));
|
|
75358
75544
|
} catch {
|
|
75359
75545
|
return null;
|
|
75360
75546
|
}
|
|
@@ -75369,8 +75555,8 @@ function readIdentity(identityPath) {
|
|
|
75369
75555
|
return { key: key2, cert, spki, port };
|
|
75370
75556
|
}
|
|
75371
75557
|
function writeIdentity(identityPath, identity2) {
|
|
75372
|
-
(0,
|
|
75373
|
-
(0,
|
|
75558
|
+
(0, import_node_fs111.mkdirSync)(import_node_path113.default.dirname(identityPath), { recursive: true });
|
|
75559
|
+
(0, import_node_fs111.writeFileSync)(identityPath, JSON.stringify(identity2), { mode: 384 });
|
|
75374
75560
|
}
|
|
75375
75561
|
async function createIdentity() {
|
|
75376
75562
|
const algorithm = { name: "ECDSA", namedCurve: "P-256", hash: "SHA-256" };
|
|
@@ -75576,8 +75762,8 @@ async function openUrl(url, options = {}) {
|
|
|
75576
75762
|
|
|
75577
75763
|
// src/host/plane-host.ts
|
|
75578
75764
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
75579
|
-
var
|
|
75580
|
-
var
|
|
75765
|
+
var import_node_fs113 = __toESM(require("node:fs"), 1);
|
|
75766
|
+
var import_node_path115 = __toESM(require("node:path"), 1);
|
|
75581
75767
|
|
|
75582
75768
|
// ../peach-box/src/plane.ts
|
|
75583
75769
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -75674,8 +75860,8 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
75674
75860
|
// cli/commands/box/checkout-plane.ts
|
|
75675
75861
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
75676
75862
|
var import_node_child_process50 = require("node:child_process");
|
|
75677
|
-
var
|
|
75678
|
-
var
|
|
75863
|
+
var import_node_fs112 = __toESM(require("node:fs"), 1);
|
|
75864
|
+
var import_node_path114 = __toESM(require("node:path"), 1);
|
|
75679
75865
|
var CheckoutRequiresGitError = class extends Error {
|
|
75680
75866
|
};
|
|
75681
75867
|
var BINARY_SNIFF_BYTES = 8192;
|
|
@@ -75686,14 +75872,14 @@ function looksBinary(filePath, size) {
|
|
|
75686
75872
|
if (size === 0) return false;
|
|
75687
75873
|
let fd;
|
|
75688
75874
|
try {
|
|
75689
|
-
fd =
|
|
75875
|
+
fd = import_node_fs112.default.openSync(filePath, "r");
|
|
75690
75876
|
const buffer = Buffer.alloc(Math.min(BINARY_SNIFF_BYTES, size));
|
|
75691
|
-
const read =
|
|
75877
|
+
const read = import_node_fs112.default.readSync(fd, buffer, 0, buffer.length, 0);
|
|
75692
75878
|
return buffer.subarray(0, read).includes(0);
|
|
75693
75879
|
} catch {
|
|
75694
75880
|
return false;
|
|
75695
75881
|
} finally {
|
|
75696
|
-
if (fd !== void 0)
|
|
75882
|
+
if (fd !== void 0) import_node_fs112.default.closeSync(fd);
|
|
75697
75883
|
}
|
|
75698
75884
|
}
|
|
75699
75885
|
var CheckoutFilePlane = class {
|
|
@@ -75706,7 +75892,7 @@ var CheckoutFilePlane = class {
|
|
|
75706
75892
|
listTimeoutMs;
|
|
75707
75893
|
trackedOnly;
|
|
75708
75894
|
constructor(root, options = {}) {
|
|
75709
|
-
this.root =
|
|
75895
|
+
this.root = import_node_path114.default.resolve(root);
|
|
75710
75896
|
this.listTimeoutMs = options.listTimeoutMs ?? LIST_FILES_TIMEOUT_MS;
|
|
75711
75897
|
this.trackedOnly = options.trackedOnly ?? false;
|
|
75712
75898
|
}
|
|
@@ -75768,13 +75954,13 @@ var CheckoutFilePlane = class {
|
|
|
75768
75954
|
if (!relative4) continue;
|
|
75769
75955
|
let stat2;
|
|
75770
75956
|
try {
|
|
75771
|
-
stat2 =
|
|
75957
|
+
stat2 = import_node_fs112.default.statSync(import_node_path114.default.join(this.root, relative4));
|
|
75772
75958
|
} catch {
|
|
75773
75959
|
continue;
|
|
75774
75960
|
}
|
|
75775
75961
|
if (!stat2.isFile()) continue;
|
|
75776
75962
|
const seen = this.sniffed.get(relative4);
|
|
75777
|
-
const binary2 = seen && seen.size === stat2.size && seen.mtimeMs === stat2.mtimeMs ? seen.binary : looksBinary(
|
|
75963
|
+
const binary2 = seen && seen.size === stat2.size && seen.mtimeMs === stat2.mtimeMs ? seen.binary : looksBinary(import_node_path114.default.join(this.root, relative4), stat2.size);
|
|
75778
75964
|
nextSniffed.set(relative4, { size: stat2.size, mtimeMs: stat2.mtimeMs, binary: binary2 });
|
|
75779
75965
|
next.set(relative4, {
|
|
75780
75966
|
size: stat2.size,
|
|
@@ -75788,22 +75974,22 @@ var CheckoutFilePlane = class {
|
|
|
75788
75974
|
this.sniffed = nextSniffed;
|
|
75789
75975
|
}
|
|
75790
75976
|
absolute(planePath) {
|
|
75791
|
-
const resolved =
|
|
75792
|
-
if (resolved !== this.root && !resolved.startsWith(`${this.root}${
|
|
75977
|
+
const resolved = import_node_path114.default.resolve(this.root, planePath);
|
|
75978
|
+
if (resolved !== this.root && !resolved.startsWith(`${this.root}${import_node_path114.default.sep}`)) {
|
|
75793
75979
|
throw new Error(`path escapes the project: ${planePath}`);
|
|
75794
75980
|
}
|
|
75795
75981
|
return resolved;
|
|
75796
75982
|
}
|
|
75797
75983
|
async read(planePath) {
|
|
75798
|
-
return
|
|
75984
|
+
return import_node_fs112.default.promises.readFile(this.absolute(planePath), "utf8");
|
|
75799
75985
|
}
|
|
75800
75986
|
async readBytes(planePath) {
|
|
75801
|
-
return
|
|
75987
|
+
return import_node_fs112.default.promises.readFile(this.absolute(planePath));
|
|
75802
75988
|
}
|
|
75803
75989
|
async write(planePath, content) {
|
|
75804
75990
|
const absolute = this.absolute(planePath);
|
|
75805
|
-
await
|
|
75806
|
-
await
|
|
75991
|
+
await import_node_fs112.default.promises.mkdir(import_node_path114.default.dirname(absolute), { recursive: true });
|
|
75992
|
+
await import_node_fs112.default.promises.writeFile(absolute, content);
|
|
75807
75993
|
this.entries.set(planePath, {
|
|
75808
75994
|
size: content.byteLength,
|
|
75809
75995
|
readOnly: false,
|
|
@@ -75812,7 +75998,7 @@ var CheckoutFilePlane = class {
|
|
|
75812
75998
|
});
|
|
75813
75999
|
}
|
|
75814
76000
|
async delete(planePath) {
|
|
75815
|
-
await
|
|
76001
|
+
await import_node_fs112.default.promises.rm(this.absolute(planePath), { force: true });
|
|
75816
76002
|
this.entries.delete(planePath);
|
|
75817
76003
|
}
|
|
75818
76004
|
};
|
|
@@ -75938,14 +76124,14 @@ var PlaneHost = class {
|
|
|
75938
76124
|
// root and an opened one cannot disagree about the same directory.
|
|
75939
76125
|
realRoot(root) {
|
|
75940
76126
|
if (!root) throw new Error("root is required");
|
|
75941
|
-
const resolved =
|
|
76127
|
+
const resolved = import_node_path115.default.resolve(root);
|
|
75942
76128
|
let real;
|
|
75943
76129
|
try {
|
|
75944
|
-
real =
|
|
76130
|
+
real = import_node_fs113.default.realpathSync(resolved);
|
|
75945
76131
|
} catch {
|
|
75946
76132
|
throw new Error(`no such directory: ${resolved}`);
|
|
75947
76133
|
}
|
|
75948
|
-
if (!
|
|
76134
|
+
if (!import_node_fs113.default.statSync(real).isDirectory()) throw new Error(`not a directory: ${real}`);
|
|
75949
76135
|
return real;
|
|
75950
76136
|
}
|
|
75951
76137
|
respond(ws, id, result) {
|
|
@@ -75966,9 +76152,9 @@ var PlaneHost = class {
|
|
|
75966
76152
|
|
|
75967
76153
|
// src/host/replacement-module-handler.ts
|
|
75968
76154
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
75969
|
-
var
|
|
76155
|
+
var import_node_fs114 = require("node:fs");
|
|
75970
76156
|
var import_promises15 = __toESM(require("node:fs/promises"), 1);
|
|
75971
|
-
var
|
|
76157
|
+
var import_node_path116 = __toESM(require("node:path"), 1);
|
|
75972
76158
|
|
|
75973
76159
|
// ../contrast-bundler/src/replacementModule.ts
|
|
75974
76160
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -76298,16 +76484,16 @@ function sendJavaScript(req, res, source) {
|
|
|
76298
76484
|
res.end(req.method === "HEAD" ? void 0 : source);
|
|
76299
76485
|
}
|
|
76300
76486
|
function resolveReplacementModuleFile(fromFile, specifier) {
|
|
76301
|
-
const base =
|
|
76487
|
+
const base = import_node_path116.default.resolve(import_node_path116.default.dirname(fromFile), specifier);
|
|
76302
76488
|
const candidates = [
|
|
76303
76489
|
...REPLACEMENT_MODULE_EXTENSIONS.some(
|
|
76304
|
-
(ext) => ext ===
|
|
76490
|
+
(ext) => ext === import_node_path116.default.extname(base).toLowerCase()
|
|
76305
76491
|
) ? [base] : [],
|
|
76306
76492
|
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => base + ext),
|
|
76307
|
-
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) =>
|
|
76493
|
+
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => import_node_path116.default.join(base, `index${ext}`))
|
|
76308
76494
|
];
|
|
76309
76495
|
const found = candidates.find(
|
|
76310
|
-
(candidate) => (0,
|
|
76496
|
+
(candidate) => (0, import_node_fs114.statSync)(candidate, { throwIfNoEntry: false })?.isFile()
|
|
76311
76497
|
);
|
|
76312
76498
|
if (!found) {
|
|
76313
76499
|
throw new Error(
|
|
@@ -76318,8 +76504,8 @@ function resolveReplacementModuleFile(fromFile, specifier) {
|
|
|
76318
76504
|
}
|
|
76319
76505
|
function isInsideAny(roots, file) {
|
|
76320
76506
|
return roots.some((root) => {
|
|
76321
|
-
const relative4 =
|
|
76322
|
-
return !relative4.startsWith("..") && !
|
|
76507
|
+
const relative4 = import_node_path116.default.relative(root, file);
|
|
76508
|
+
return !relative4.startsWith("..") && !import_node_path116.default.isAbsolute(relative4);
|
|
76323
76509
|
});
|
|
76324
76510
|
}
|
|
76325
76511
|
function isReplacementModuleRequestUrl(rawUrl) {
|
|
@@ -76368,19 +76554,19 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
76368
76554
|
res.end("missing path param");
|
|
76369
76555
|
return true;
|
|
76370
76556
|
}
|
|
76371
|
-
const extension =
|
|
76557
|
+
const extension = import_node_path116.default.extname(targetPath).toLowerCase();
|
|
76372
76558
|
if (!REPLACEMENT_MODULE_EXTENSIONS.some((allowed) => allowed === extension)) {
|
|
76373
76559
|
res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
76374
76560
|
res.end(`replacement files must be ${REPLACEMENT_MODULE_EXTENSIONS.join(", ")}`);
|
|
76375
76561
|
return true;
|
|
76376
76562
|
}
|
|
76377
|
-
if (!
|
|
76563
|
+
if (!import_node_path116.default.isAbsolute(targetPath)) {
|
|
76378
76564
|
res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
76379
76565
|
res.end("replacement file path must be absolute");
|
|
76380
76566
|
return true;
|
|
76381
76567
|
}
|
|
76382
76568
|
const runtimePackages = new Set(url.searchParams.getAll("runtimePackage"));
|
|
76383
|
-
const servedRoots = options.servedRoots?.map((root) =>
|
|
76569
|
+
const servedRoots = options.servedRoots?.map((root) => import_node_path116.default.resolve(root));
|
|
76384
76570
|
if (servedRoots && !isInsideAny(servedRoots, targetPath)) {
|
|
76385
76571
|
res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
|
|
76386
76572
|
res.end("replacement file must be inside a folder the bundler serves");
|
|
@@ -76440,16 +76626,16 @@ var SCAN_FRESH_MS = 2e3;
|
|
|
76440
76626
|
function createServerScanHandler(options) {
|
|
76441
76627
|
let cache = null;
|
|
76442
76628
|
let cachedAt = 0;
|
|
76443
|
-
let
|
|
76629
|
+
let inflight2 = null;
|
|
76444
76630
|
let inflightFresh = false;
|
|
76445
76631
|
function runScan(fresh = false) {
|
|
76446
|
-
if (
|
|
76632
|
+
if (inflight2 && fresh && !inflightFresh) {
|
|
76447
76633
|
const again = () => runScan(true);
|
|
76448
|
-
return
|
|
76634
|
+
return inflight2.then(again, again);
|
|
76449
76635
|
}
|
|
76450
|
-
if (
|
|
76636
|
+
if (inflight2) return inflight2;
|
|
76451
76637
|
inflightFresh = fresh;
|
|
76452
|
-
|
|
76638
|
+
inflight2 = scanDevServers({
|
|
76453
76639
|
excludePorts: options.excludePorts(),
|
|
76454
76640
|
fresh,
|
|
76455
76641
|
buildIconProxyUrl: buildBrowserAssetProxyUrl
|
|
@@ -76463,9 +76649,9 @@ function createServerScanHandler(options) {
|
|
|
76463
76649
|
if (cache && cache.length > 0) return cache;
|
|
76464
76650
|
throw error;
|
|
76465
76651
|
}).finally(() => {
|
|
76466
|
-
|
|
76652
|
+
inflight2 = null;
|
|
76467
76653
|
});
|
|
76468
|
-
return
|
|
76654
|
+
return inflight2;
|
|
76469
76655
|
}
|
|
76470
76656
|
return async function handleServerScan(req, res) {
|
|
76471
76657
|
function sendJson(status, body) {
|
|
@@ -78487,95 +78673,97 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
|
|
|
78487
78673
|
res.end("forbidden");
|
|
78488
78674
|
return;
|
|
78489
78675
|
}
|
|
78490
|
-
|
|
78491
|
-
|
|
78492
|
-
|
|
78493
|
-
|
|
78494
|
-
|
|
78495
|
-
|
|
78496
|
-
|
|
78497
|
-
|
|
78498
|
-
|
|
78499
|
-
|
|
78500
|
-
|
|
78501
|
-
|
|
78502
|
-
|
|
78503
|
-
|
|
78504
|
-
|
|
78505
|
-
|
|
78506
|
-
}
|
|
78507
|
-
}
|
|
78508
|
-
import_fs4.default.stat(servePath, (err, stats) => {
|
|
78509
|
-
if (err || !stats?.isFile()) {
|
|
78510
|
-
const ext2 = import_path4.default.extname(rel).toLowerCase();
|
|
78511
|
-
if (ext2 && ext2 !== ".html") {
|
|
78512
|
-
res.writeHead(404);
|
|
78513
|
-
res.end("not found");
|
|
78514
|
-
return;
|
|
78515
|
-
}
|
|
78516
|
-
if (rel.startsWith("/__") || rel.startsWith("/api/") || rel === "/api") {
|
|
78517
|
-
res.writeHead(404, { "Content-Type": "text/plain; charset=utf-8" });
|
|
78518
|
-
res.end("not found");
|
|
78676
|
+
void ensureRuntimePackFor(baseDir, rel).then(
|
|
78677
|
+
() => import_fs4.default.realpath(resolved, (realErr, realResolved) => {
|
|
78678
|
+
const servePath = realErr ? resolved : realResolved;
|
|
78679
|
+
const servePathWithSep = servePath.endsWith(import_path4.default.sep) ? servePath : servePath + import_path4.default.sep;
|
|
78680
|
+
if (!realErr) {
|
|
78681
|
+
const realBaseWithSep = (() => {
|
|
78682
|
+
try {
|
|
78683
|
+
const rb = import_fs4.default.realpathSync(baseDir);
|
|
78684
|
+
return rb.endsWith(import_path4.default.sep) ? rb : rb + import_path4.default.sep;
|
|
78685
|
+
} catch {
|
|
78686
|
+
return baseWithSep;
|
|
78687
|
+
}
|
|
78688
|
+
})();
|
|
78689
|
+
if (!servePathWithSep.startsWith(realBaseWithSep) && servePath + import_path4.default.sep !== realBaseWithSep) {
|
|
78690
|
+
res.writeHead(403);
|
|
78691
|
+
res.end("forbidden");
|
|
78519
78692
|
return;
|
|
78520
78693
|
}
|
|
78521
|
-
|
|
78522
|
-
|
|
78523
|
-
|
|
78694
|
+
}
|
|
78695
|
+
import_fs4.default.stat(servePath, (err, stats) => {
|
|
78696
|
+
if (err || !stats?.isFile()) {
|
|
78697
|
+
const ext2 = import_path4.default.extname(rel).toLowerCase();
|
|
78698
|
+
if (ext2 && ext2 !== ".html") {
|
|
78524
78699
|
res.writeHead(404);
|
|
78525
78700
|
res.end("not found");
|
|
78526
78701
|
return;
|
|
78527
78702
|
}
|
|
78528
|
-
|
|
78529
|
-
"Content-Type": "text/
|
|
78530
|
-
"
|
|
78531
|
-
});
|
|
78532
|
-
if (method === "HEAD") {
|
|
78533
|
-
res.end();
|
|
78703
|
+
if (rel.startsWith("/__") || rel.startsWith("/api/") || rel === "/api") {
|
|
78704
|
+
res.writeHead(404, { "Content-Type": "text/plain; charset=utf-8" });
|
|
78705
|
+
res.end("not found");
|
|
78534
78706
|
return;
|
|
78535
78707
|
}
|
|
78536
|
-
|
|
78537
|
-
|
|
78538
|
-
|
|
78539
|
-
|
|
78540
|
-
|
|
78541
|
-
|
|
78542
|
-
|
|
78543
|
-
|
|
78544
|
-
|
|
78545
|
-
|
|
78546
|
-
|
|
78547
|
-
|
|
78548
|
-
...publicEngineFont ? { "Access-Control-Allow-Origin": "*" } : {}
|
|
78549
|
-
});
|
|
78550
|
-
if (method === "HEAD") {
|
|
78551
|
-
res.end();
|
|
78552
|
-
return;
|
|
78553
|
-
}
|
|
78554
|
-
if (ext === ".html") {
|
|
78555
|
-
import_fs4.default.readFile(servePath, (readErr, data) => {
|
|
78556
|
-
if (readErr) {
|
|
78557
|
-
try {
|
|
78708
|
+
const indexPath = import_path4.default.join(baseDir, "index.html");
|
|
78709
|
+
import_fs4.default.readFile(indexPath, (err2, data) => {
|
|
78710
|
+
if (err2) {
|
|
78711
|
+
res.writeHead(404);
|
|
78712
|
+
res.end("not found");
|
|
78713
|
+
return;
|
|
78714
|
+
}
|
|
78715
|
+
res.writeHead(200, {
|
|
78716
|
+
"Content-Type": "text/html; charset=utf-8",
|
|
78717
|
+
"Cache-Control": "no-store"
|
|
78718
|
+
});
|
|
78719
|
+
if (method === "HEAD") {
|
|
78558
78720
|
res.end();
|
|
78559
|
-
|
|
78721
|
+
return;
|
|
78560
78722
|
}
|
|
78561
|
-
|
|
78562
|
-
|
|
78563
|
-
|
|
78564
|
-
|
|
78565
|
-
|
|
78723
|
+
res.end(
|
|
78724
|
+
injectSharedConfigIntoHtml(data, this.effectivePort, this.contrastOrigin)
|
|
78725
|
+
);
|
|
78726
|
+
});
|
|
78727
|
+
return;
|
|
78728
|
+
}
|
|
78729
|
+
const ext = import_path4.default.extname(servePath).toLowerCase();
|
|
78730
|
+
const contentType2 = HTTP_MIME_TYPES[ext] || "application/octet-stream";
|
|
78731
|
+
res.writeHead(200, {
|
|
78732
|
+
"Content-Type": contentType2,
|
|
78733
|
+
"Cache-Control": "no-store",
|
|
78734
|
+
// native file documents have an opaque origin when reading public fonts.
|
|
78735
|
+
...publicEngineFont ? { "Access-Control-Allow-Origin": "*" } : {}
|
|
78566
78736
|
});
|
|
78567
|
-
|
|
78568
|
-
}
|
|
78569
|
-
const stream = import_fs4.default.createReadStream(servePath);
|
|
78570
|
-
stream.pipe(res);
|
|
78571
|
-
stream.on("error", () => {
|
|
78572
|
-
try {
|
|
78737
|
+
if (method === "HEAD") {
|
|
78573
78738
|
res.end();
|
|
78574
|
-
|
|
78739
|
+
return;
|
|
78575
78740
|
}
|
|
78741
|
+
if (ext === ".html") {
|
|
78742
|
+
import_fs4.default.readFile(servePath, (readErr, data) => {
|
|
78743
|
+
if (readErr) {
|
|
78744
|
+
try {
|
|
78745
|
+
res.end();
|
|
78746
|
+
} catch {
|
|
78747
|
+
}
|
|
78748
|
+
return;
|
|
78749
|
+
}
|
|
78750
|
+
res.end(
|
|
78751
|
+
injectSharedConfigIntoHtml(data, this.effectivePort, this.contrastOrigin)
|
|
78752
|
+
);
|
|
78753
|
+
});
|
|
78754
|
+
return;
|
|
78755
|
+
}
|
|
78756
|
+
const stream = import_fs4.default.createReadStream(servePath);
|
|
78757
|
+
stream.pipe(res);
|
|
78758
|
+
stream.on("error", () => {
|
|
78759
|
+
try {
|
|
78760
|
+
res.end();
|
|
78761
|
+
} catch {
|
|
78762
|
+
}
|
|
78763
|
+
});
|
|
78576
78764
|
});
|
|
78577
|
-
})
|
|
78578
|
-
|
|
78765
|
+
})
|
|
78766
|
+
);
|
|
78579
78767
|
}
|
|
78580
78768
|
sweepIdleCliClients() {
|
|
78581
78769
|
const now = Date.now();
|