peachsim 0.1.769 → 0.1.770
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/outbound-endpoints.ts +14 -0
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-identity.cjs +1 -1
- package/dist-lib/agent-sessions.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/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cli-constants.cjs +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/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +548 -436
- package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
- 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 +1 -1
- 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 +1 -1
- 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/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/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/render-mode.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +817 -698
- package/dist-lib/swift-compile.cjs +1 -1
- package/dist-lib/swift-compile.mjs +1 -1
- 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 +381 -269
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/src/swift-binary-modules.ts +116 -0
- package/src/swift-host.ts +28 -4
- package/src/swift-package-manifest.ts +3 -0
- package/src/swift-packages.ts +32 -4
package/dist-lib/skills.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.770 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -18532,9 +18532,9 @@ function overlapsBounds(left, right) {
|
|
|
18532
18532
|
}
|
|
18533
18533
|
function resolveCompatVersionRange(availableRegistryRanges, declaredVersion) {
|
|
18534
18534
|
const declaredGroups = parseRange(declaredVersion);
|
|
18535
|
-
const registryGroups = availableRegistryRanges.map((
|
|
18536
|
-
range,
|
|
18537
|
-
bounds: parseRange(
|
|
18535
|
+
const registryGroups = availableRegistryRanges.map((range2) => ({
|
|
18536
|
+
range: range2,
|
|
18537
|
+
bounds: parseRange(range2)
|
|
18538
18538
|
}));
|
|
18539
18539
|
if (!declaredGroups || registryGroups.some((candidate) => !candidate.bounds)) {
|
|
18540
18540
|
return {
|
|
@@ -19802,9 +19802,9 @@ function safeChildPlistName(value) {
|
|
|
19802
19802
|
name: file.toLowerCase().endsWith(".plist") ? file : `${file}.plist`
|
|
19803
19803
|
};
|
|
19804
19804
|
}
|
|
19805
|
-
async function readableSettingsBundle(
|
|
19805
|
+
async function readableSettingsBundle(path36) {
|
|
19806
19806
|
try {
|
|
19807
|
-
const root = await (0, import_promises.stat)((0, import_node_path.join)(
|
|
19807
|
+
const root = await (0, import_promises.stat)((0, import_node_path.join)(path36, "Root.plist"));
|
|
19808
19808
|
return root.isFile() && root.size <= MAX_PLIST_BYTES;
|
|
19809
19809
|
} catch {
|
|
19810
19810
|
return false;
|
|
@@ -19849,11 +19849,11 @@ async function settingsBundleFingerprint(bundlePath) {
|
|
|
19849
19849
|
return null;
|
|
19850
19850
|
}
|
|
19851
19851
|
}
|
|
19852
|
-
async function parsePlistRecord(
|
|
19852
|
+
async function parsePlistRecord(path36) {
|
|
19853
19853
|
try {
|
|
19854
|
-
const metadata = await (0, import_promises.stat)(
|
|
19854
|
+
const metadata = await (0, import_promises.stat)(path36);
|
|
19855
19855
|
if (!metadata.isFile() || metadata.size > MAX_PLIST_BYTES) return null;
|
|
19856
|
-
const source = await (0, import_promises.readFile)(
|
|
19856
|
+
const source = await (0, import_promises.readFile)(path36, "utf8");
|
|
19857
19857
|
const parsed = parsePlistSource(source);
|
|
19858
19858
|
return isRecord2(parsed) ? parsed : null;
|
|
19859
19859
|
} catch {
|
|
@@ -20177,7 +20177,7 @@ async function tcpPing(port, timeout = TCP_GATE_MS) {
|
|
|
20177
20177
|
return null;
|
|
20178
20178
|
}
|
|
20179
20179
|
}
|
|
20180
|
-
function httpGet(hostname, port,
|
|
20180
|
+
function httpGet(hostname, port, path36, method = "GET", timeout = TIMEOUT_MS, headers = {}) {
|
|
20181
20181
|
return new Promise((resolve10) => {
|
|
20182
20182
|
let settled = false;
|
|
20183
20183
|
let killing = false;
|
|
@@ -20186,7 +20186,7 @@ function httpGet(hostname, port, path35, method = "GET", timeout = TIMEOUT_MS, h
|
|
|
20186
20186
|
settled = true;
|
|
20187
20187
|
resolve10(value);
|
|
20188
20188
|
};
|
|
20189
|
-
const req = import_http.default.request({ hostname, port, path:
|
|
20189
|
+
const req = import_http.default.request({ hostname, port, path: path36, method, headers }, (res) => {
|
|
20190
20190
|
let body = "";
|
|
20191
20191
|
res.on("data", (c) => body += c.toString());
|
|
20192
20192
|
const contentType = (() => {
|
|
@@ -22349,14 +22349,14 @@ function liftExtensionOverrides(source, extraObjCExtensions) {
|
|
|
22349
22349
|
const args = forwardedArguments(source.slice(open + 1, close));
|
|
22350
22350
|
if (args === null) continue;
|
|
22351
22351
|
const call = (clause.includes("->") ? "return " : "") + (/\b(?:throws|rethrows)\b/.test(clause) ? "try " : "") + (/\basync\b/.test(clause) ? "await " : "") + `__peach_ext_${name2}(${args})`;
|
|
22352
|
-
const
|
|
22352
|
+
const signature2 = `func ${name2}${func[3] ?? ""}${source.slice(open, close + 1)}${clause ? ` ${clause}` : ""}`;
|
|
22353
22353
|
const nameAt = at + rest.indexOf(name2, rest.indexOf("func", "override".length + func[1].length) + 4);
|
|
22354
22354
|
lifted.push({
|
|
22355
22355
|
type: top.name,
|
|
22356
22356
|
member: name2,
|
|
22357
22357
|
at,
|
|
22358
22358
|
modifiers,
|
|
22359
|
-
decl:
|
|
22359
|
+
decl: signature2,
|
|
22360
22360
|
forward: `{ ${call} };`,
|
|
22361
22361
|
nameAt,
|
|
22362
22362
|
edits: [
|
|
@@ -23811,8 +23811,8 @@ function pickImagesetFile(images) {
|
|
|
23811
23811
|
scale: pick.scale === "2x" ? 2 : pick.scale === "3x" ? 3 : 1
|
|
23812
23812
|
};
|
|
23813
23813
|
}
|
|
23814
|
-
function flatScale(
|
|
23815
|
-
const match = /@([23])x\.[^./]+$/.exec(
|
|
23814
|
+
function flatScale(path36) {
|
|
23815
|
+
const match = /@([23])x\.[^./]+$/.exec(path36);
|
|
23816
23816
|
return match ? Number(match[1]) : 1;
|
|
23817
23817
|
}
|
|
23818
23818
|
function providesNamespace(text2) {
|
|
@@ -23839,13 +23839,13 @@ function catalogEntryName(contentsPath, kind, readText2) {
|
|
|
23839
23839
|
}
|
|
23840
23840
|
return segments.join("/");
|
|
23841
23841
|
}
|
|
23842
|
-
function isFlatResourceImage(
|
|
23843
|
-
return
|
|
23842
|
+
function isFlatResourceImage(path36) {
|
|
23843
|
+
return path36.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path36));
|
|
23844
23844
|
}
|
|
23845
23845
|
function enumerateBundleImages(paths, readText2) {
|
|
23846
23846
|
const table = [];
|
|
23847
23847
|
const seen = /* @__PURE__ */ new Set();
|
|
23848
|
-
const catalogs = paths.filter((
|
|
23848
|
+
const catalogs = paths.filter((path36) => baseOf(path36) === "Contents.json");
|
|
23849
23849
|
for (const contentsPath of catalogs) {
|
|
23850
23850
|
const name2 = catalogEntryName(contentsPath, ".imageset", readText2);
|
|
23851
23851
|
if (name2 === null || seen.has(name2)) continue;
|
|
@@ -23866,12 +23866,12 @@ function enumerateBundleImages(paths, readText2) {
|
|
|
23866
23866
|
seen.add(name2);
|
|
23867
23867
|
table.push({ name: name2, file: `${dir}/${pick.filename}`, scale: pick.scale });
|
|
23868
23868
|
}
|
|
23869
|
-
for (const
|
|
23870
|
-
if (!isFlatResourceImage(
|
|
23871
|
-
const name2 = baseOf(
|
|
23869
|
+
for (const path36 of paths) {
|
|
23870
|
+
if (!isFlatResourceImage(path36)) continue;
|
|
23871
|
+
const name2 = baseOf(path36).slice(0, -extOf(path36).length);
|
|
23872
23872
|
if (name2 === "" || seen.has(name2)) continue;
|
|
23873
23873
|
seen.add(name2);
|
|
23874
|
-
table.push({ name: name2, file:
|
|
23874
|
+
table.push({ name: name2, file: path36, scale: flatScale(path36) });
|
|
23875
23875
|
}
|
|
23876
23876
|
return table;
|
|
23877
23877
|
}
|
|
@@ -23900,7 +23900,7 @@ function colorsetValue(color) {
|
|
|
23900
23900
|
}
|
|
23901
23901
|
function enumerateBundleColors(paths, readText2) {
|
|
23902
23902
|
const table = {};
|
|
23903
|
-
for (const contentsPath of paths.filter((
|
|
23903
|
+
for (const contentsPath of paths.filter((path36) => baseOf(path36) === "Contents.json")) {
|
|
23904
23904
|
const name2 = catalogEntryName(contentsPath, ".colorset", readText2);
|
|
23905
23905
|
if (name2 === null || name2 in table) continue;
|
|
23906
23906
|
let colors;
|
|
@@ -23964,8 +23964,8 @@ function axisExtremes(points) {
|
|
|
23964
23964
|
function pathBounds(d) {
|
|
23965
23965
|
const xs = [];
|
|
23966
23966
|
const ys = [];
|
|
23967
|
-
for (const
|
|
23968
|
-
(0, import_svgpath.default)(
|
|
23967
|
+
for (const path36 of d)
|
|
23968
|
+
(0, import_svgpath.default)(path36).abs().unshort().unarc().iterate((segment, _index, x, y) => {
|
|
23969
23969
|
const [command, ...args] = segment;
|
|
23970
23970
|
if (command === "M" || command === "L") {
|
|
23971
23971
|
xs.push(Number(args[0]));
|
|
@@ -23992,7 +23992,7 @@ function guide(svg, id, axis) {
|
|
|
23992
23992
|
}
|
|
23993
23993
|
function enumerateBundleSymbols(paths, readText2) {
|
|
23994
23994
|
const table = {};
|
|
23995
|
-
for (const contentsPath of paths.filter((
|
|
23995
|
+
for (const contentsPath of paths.filter((path36) => baseOf(path36) === "Contents.json")) {
|
|
23996
23996
|
const name2 = catalogEntryName(contentsPath, ".symbolset", readText2);
|
|
23997
23997
|
if (name2 === null || name2 in table) continue;
|
|
23998
23998
|
let symbols;
|
|
@@ -24025,8 +24025,8 @@ function enumerateBundleSymbols(paths, readText2) {
|
|
|
24025
24025
|
viewBox: "0 0 24 24",
|
|
24026
24026
|
advance,
|
|
24027
24027
|
box: [12 - advance / 2, 12 - tall / 2, advance, tall],
|
|
24028
|
-
layers: d.map((
|
|
24029
|
-
d: (0, import_svgpath.default)(
|
|
24028
|
+
layers: d.map((path36) => ({
|
|
24029
|
+
d: (0, import_svgpath.default)(path36).abs().scale(scale).translate(translateX, translateY).round(3).toString()
|
|
24030
24030
|
}))
|
|
24031
24031
|
};
|
|
24032
24032
|
}
|
|
@@ -24036,7 +24036,7 @@ function enumerateBundleJson(paths) {
|
|
|
24036
24036
|
const found = [];
|
|
24037
24037
|
const seen = /* @__PURE__ */ new Set();
|
|
24038
24038
|
const ordered = [...paths].filter(
|
|
24039
|
-
(
|
|
24039
|
+
(path36) => path36.split("/").includes("Resources") && path36.split("/").every((segment) => segment !== "" && segment !== "..") && (extOf(path36) === ".json" || extOf(path36) === ".xcstrings")
|
|
24040
24040
|
).sort((a, b) => {
|
|
24041
24041
|
const aDepth = a.split("/").length;
|
|
24042
24042
|
const bDepth = b.split("/").length;
|
|
@@ -24601,19 +24601,109 @@ var init_ios_sdk_frameworks = __esm({
|
|
|
24601
24601
|
}
|
|
24602
24602
|
});
|
|
24603
24603
|
|
|
24604
|
+
// src/swift-binary-modules.ts
|
|
24605
|
+
function frameworkModules(paths) {
|
|
24606
|
+
const modules = /* @__PURE__ */ new Set();
|
|
24607
|
+
for (const file of paths) {
|
|
24608
|
+
const segment = file.split("/").find((part) => part.endsWith(".framework"));
|
|
24609
|
+
if (segment) modules.add(segment.slice(0, -".framework".length));
|
|
24610
|
+
}
|
|
24611
|
+
return [...modules].sort();
|
|
24612
|
+
}
|
|
24613
|
+
async function range(url, spec) {
|
|
24614
|
+
const response = await fetch(url, {
|
|
24615
|
+
headers: { range: `bytes=${spec}` },
|
|
24616
|
+
signal: AbortSignal.timeout(2e4)
|
|
24617
|
+
});
|
|
24618
|
+
const match = /^bytes (\d+)-\d+\/(\d+)$/.exec(
|
|
24619
|
+
response.headers.get("content-range") ?? ""
|
|
24620
|
+
);
|
|
24621
|
+
if (response.status !== 206 || !match)
|
|
24622
|
+
throw new Error(`${url} answered ${response.status} to a range request`);
|
|
24623
|
+
return {
|
|
24624
|
+
bytes: Buffer.from(await response.arrayBuffer()),
|
|
24625
|
+
start: Number(match[1]),
|
|
24626
|
+
total: Number(match[2])
|
|
24627
|
+
};
|
|
24628
|
+
}
|
|
24629
|
+
async function zipEntries(url) {
|
|
24630
|
+
const { total } = await range(url, "0-0");
|
|
24631
|
+
const tail = await range(url, `${Math.max(0, total - 65558)}-${total - 1}`);
|
|
24632
|
+
const end = signature(tail.bytes, 101010256);
|
|
24633
|
+
if (end < 0) throw new Error(`${url} has no zip end record`);
|
|
24634
|
+
let size = tail.bytes.readUInt32LE(end + 12);
|
|
24635
|
+
let offset = tail.bytes.readUInt32LE(end + 16);
|
|
24636
|
+
if (offset === 4294967295 || size === 4294967295) {
|
|
24637
|
+
const locator = end - 20;
|
|
24638
|
+
if (locator < 0 || tail.bytes.readUInt32LE(locator) !== 117853008)
|
|
24639
|
+
throw new Error(`${url} has no zip64 locator`);
|
|
24640
|
+
const recordAt = Number(tail.bytes.readBigUInt64LE(locator + 8));
|
|
24641
|
+
const record2 = recordAt >= tail.start ? tail.bytes.subarray(recordAt - tail.start) : (await range(url, `${recordAt}-${recordAt + 55}`)).bytes;
|
|
24642
|
+
size = Number(record2.readBigUInt64LE(40));
|
|
24643
|
+
offset = Number(record2.readBigUInt64LE(48));
|
|
24644
|
+
}
|
|
24645
|
+
const directory = offset >= tail.start ? tail.bytes.subarray(offset - tail.start, offset - tail.start + size) : (await range(url, `${offset}-${offset + size - 1}`)).bytes;
|
|
24646
|
+
const names = [];
|
|
24647
|
+
for (let at = 0; at + 46 <= directory.length; ) {
|
|
24648
|
+
if (directory.readUInt32LE(at) !== 33639248) break;
|
|
24649
|
+
const nameLength = directory.readUInt16LE(at + 28);
|
|
24650
|
+
names.push(directory.toString("utf8", at + 46, at + 46 + nameLength));
|
|
24651
|
+
at += 46 + nameLength + directory.readUInt16LE(at + 30) + directory.readUInt16LE(at + 32);
|
|
24652
|
+
}
|
|
24653
|
+
return names;
|
|
24654
|
+
}
|
|
24655
|
+
function localEntries(dir) {
|
|
24656
|
+
if (!import_node_fs13.default.existsSync(dir)) return [];
|
|
24657
|
+
return import_node_fs13.default.readdirSync(dir, { withFileTypes: true }).filter((slice) => slice.isDirectory()).flatMap(
|
|
24658
|
+
(slice) => import_node_fs13.default.readdirSync(import_node_path13.default.join(dir, slice.name)).map((entry) => `${slice.name}/${entry}`)
|
|
24659
|
+
);
|
|
24660
|
+
}
|
|
24661
|
+
async function swiftBinaryModules(binary) {
|
|
24662
|
+
if (!binary.url) return frameworkModules(localEntries(binary.dir));
|
|
24663
|
+
const cached4 = import_node_path13.default.join(
|
|
24664
|
+
cacheDir2,
|
|
24665
|
+
`${(0, import_node_crypto5.createHash)("sha256").update(binary.url).digest("hex").slice(0, 32)}.json`
|
|
24666
|
+
);
|
|
24667
|
+
if (import_node_fs13.default.existsSync(cached4)) {
|
|
24668
|
+
const value = JSON.parse(import_node_fs13.default.readFileSync(cached4, "utf8"));
|
|
24669
|
+
if (Array.isArray(value) && value.every((name2) => typeof name2 === "string"))
|
|
24670
|
+
return value;
|
|
24671
|
+
}
|
|
24672
|
+
const modules = frameworkModules(await zipEntries(binary.url));
|
|
24673
|
+
import_node_fs13.default.mkdirSync(cacheDir2, { recursive: true });
|
|
24674
|
+
import_node_fs13.default.writeFileSync(cached4, JSON.stringify(modules));
|
|
24675
|
+
return modules;
|
|
24676
|
+
}
|
|
24677
|
+
var import_node_crypto5, import_node_fs13, import_node_os5, import_node_path13, cacheDir2, signature;
|
|
24678
|
+
var init_swift_binary_modules = __esm({
|
|
24679
|
+
"src/swift-binary-modules.ts"() {
|
|
24680
|
+
"use strict";
|
|
24681
|
+
import_node_crypto5 = require("node:crypto");
|
|
24682
|
+
import_node_fs13 = __toESM(require("node:fs"), 1);
|
|
24683
|
+
import_node_os5 = __toESM(require("node:os"), 1);
|
|
24684
|
+
import_node_path13 = __toESM(require("node:path"), 1);
|
|
24685
|
+
cacheDir2 = import_node_path13.default.join(import_node_os5.default.tmpdir(), "peach-swift-binary-modules");
|
|
24686
|
+
signature = (bytes, value) => {
|
|
24687
|
+
const needle = Buffer.alloc(4);
|
|
24688
|
+
needle.writeUInt32LE(value);
|
|
24689
|
+
return bytes.lastIndexOf(needle);
|
|
24690
|
+
};
|
|
24691
|
+
}
|
|
24692
|
+
});
|
|
24693
|
+
|
|
24604
24694
|
// src/swift-package-manifest.ts
|
|
24605
24695
|
function swiftCommand() {
|
|
24606
|
-
return process.platform === "darwin" ? { file: "xcrun", args: ["swift"] } : { file:
|
|
24696
|
+
return process.platform === "darwin" ? { file: "xcrun", args: ["swift"] } : { file: import_node_path14.default.join(swiftToolchainBin(swift_distribution_lock_default.release), "swift"), args: [] };
|
|
24607
24697
|
}
|
|
24608
24698
|
function dump(dir) {
|
|
24609
|
-
const manifests =
|
|
24699
|
+
const manifests = import_node_fs14.default.readdirSync(dir).filter((name2) => /^Package(@swift-[\d.]+)?\.swift$/.test(name2)).sort();
|
|
24610
24700
|
const command = swiftCommand();
|
|
24611
|
-
const key = (0,
|
|
24612
|
-
manifests.map((name2) => `${name2}\0${
|
|
24701
|
+
const key = (0, import_node_crypto6.createHash)("sha256").update(JSON.stringify([command, import_node_path14.default.resolve(dir)])).update(
|
|
24702
|
+
manifests.map((name2) => `${name2}\0${import_node_fs14.default.readFileSync(import_node_path14.default.join(dir, name2), "utf8")}`).join("\0")
|
|
24613
24703
|
).digest("hex").slice(0, 32);
|
|
24614
|
-
const cached4 =
|
|
24615
|
-
if (
|
|
24616
|
-
return { key, raw: record(JSON.parse(
|
|
24704
|
+
const cached4 = import_node_path14.default.join(cacheDir3, `${key}.json`);
|
|
24705
|
+
if (import_node_fs14.default.existsSync(cached4))
|
|
24706
|
+
return { key, raw: record(JSON.parse(import_node_fs14.default.readFileSync(cached4, "utf8"))) };
|
|
24617
24707
|
let output;
|
|
24618
24708
|
try {
|
|
24619
24709
|
output = (0, import_node_child_process7.execFileSync)(
|
|
@@ -24625,7 +24715,7 @@ function dump(dir) {
|
|
|
24625
24715
|
dir,
|
|
24626
24716
|
// swiftpm's scratch files never land in the app's own package
|
|
24627
24717
|
"--scratch-path",
|
|
24628
|
-
|
|
24718
|
+
import_node_path14.default.join(cacheDir3, `${key}.build`),
|
|
24629
24719
|
"dump-package"
|
|
24630
24720
|
],
|
|
24631
24721
|
{
|
|
@@ -24637,11 +24727,11 @@ function dump(dir) {
|
|
|
24637
24727
|
} catch (error) {
|
|
24638
24728
|
const stderr = error instanceof Error && "stderr" in error ? String(error.stderr).trim() : "";
|
|
24639
24729
|
throw new Error(
|
|
24640
|
-
`swiftpm could not evaluate ${
|
|
24730
|
+
`swiftpm could not evaluate ${import_node_path14.default.join(dir, "Package.swift")}${stderr ? `: ${stderr}` : ""}`
|
|
24641
24731
|
);
|
|
24642
24732
|
}
|
|
24643
|
-
|
|
24644
|
-
|
|
24733
|
+
import_node_fs14.default.mkdirSync(cacheDir3, { recursive: true });
|
|
24734
|
+
import_node_fs14.default.writeFileSync(cached4, output);
|
|
24645
24735
|
return { key, raw: record(JSON.parse(output)) };
|
|
24646
24736
|
}
|
|
24647
24737
|
function defaultTraits(manifest) {
|
|
@@ -24669,7 +24759,7 @@ function linksOnIOS(condition, traits) {
|
|
|
24669
24759
|
return gates.length === 0 || gates.some((name2) => traits.has(string(name2) ?? ""));
|
|
24670
24760
|
}
|
|
24671
24761
|
function swiftPackageManifest(dir) {
|
|
24672
|
-
dir =
|
|
24762
|
+
dir = import_node_fs14.default.realpathSync(dir);
|
|
24673
24763
|
const { key, raw: raw2 } = dump(dir);
|
|
24674
24764
|
const known = evaluated.get(key);
|
|
24675
24765
|
if (known) return known;
|
|
@@ -24717,7 +24807,7 @@ function swiftPackageManifest(dir) {
|
|
|
24717
24807
|
if (!name2 || !isTargetType(kind)) continue;
|
|
24718
24808
|
const declared = string(target.path);
|
|
24719
24809
|
const roots = kind === "test" ? ["Tests"] : ["Sources", "Source", "src", "srcs"];
|
|
24720
|
-
const targetDir = declared ?
|
|
24810
|
+
const targetDir = declared ? import_node_path14.default.resolve(dir, declared) : roots.map((root) => import_node_path14.default.join(dir, root, name2)).find((candidate) => import_node_fs14.default.existsSync(candidate)) ?? import_node_path14.default.join(dir, roots[0], name2);
|
|
24721
24811
|
const dependencies = [];
|
|
24722
24812
|
for (const dependency of array(target.dependencies)) {
|
|
24723
24813
|
const { target: local, product, byName } = record(dependency);
|
|
@@ -24759,7 +24849,8 @@ function swiftPackageManifest(dir) {
|
|
|
24759
24849
|
dependencies,
|
|
24760
24850
|
languageMode,
|
|
24761
24851
|
mainActorIsolation,
|
|
24762
|
-
declaresResources: array(target.resources).length > 0
|
|
24852
|
+
declaresResources: array(target.resources).length > 0,
|
|
24853
|
+
url: string(target.url) ?? null
|
|
24763
24854
|
});
|
|
24764
24855
|
}
|
|
24765
24856
|
const manifest = { dir, products, targets, packages };
|
|
@@ -24767,36 +24858,36 @@ function swiftPackageManifest(dir) {
|
|
|
24767
24858
|
return manifest;
|
|
24768
24859
|
}
|
|
24769
24860
|
function walk(dir) {
|
|
24770
|
-
if (!
|
|
24771
|
-
if (
|
|
24861
|
+
if (!import_node_fs14.default.existsSync(dir)) return [];
|
|
24862
|
+
if (import_node_fs14.default.statSync(dir).isFile()) return [dir];
|
|
24772
24863
|
const out = [];
|
|
24773
|
-
for (const entry of
|
|
24864
|
+
for (const entry of import_node_fs14.default.readdirSync(dir, { withFileTypes: true })) {
|
|
24774
24865
|
if (entry.name.startsWith(".")) continue;
|
|
24775
|
-
const full =
|
|
24866
|
+
const full = import_node_path14.default.join(dir, entry.name);
|
|
24776
24867
|
if (entry.isDirectory()) out.push(...walk(full));
|
|
24777
24868
|
else if (entry.isFile()) out.push(full);
|
|
24778
24869
|
}
|
|
24779
24870
|
return out;
|
|
24780
24871
|
}
|
|
24781
24872
|
function swiftTargetFiles(manifest, target) {
|
|
24782
|
-
const included = target.sources ? target.sources.map((source) =>
|
|
24873
|
+
const included = target.sources ? target.sources.map((source) => import_node_path14.default.resolve(target.dir, source)) : [target.dir];
|
|
24783
24874
|
const excluded = [
|
|
24784
|
-
...target.exclude.map((file) =>
|
|
24875
|
+
...target.exclude.map((file) => import_node_path14.default.resolve(target.dir, file)),
|
|
24785
24876
|
...[...manifest.targets.values()].flatMap(
|
|
24786
24877
|
(other) => other !== target && within(other.dir, [target.dir]) && other.dir !== target.dir ? [other.dir] : []
|
|
24787
24878
|
)
|
|
24788
24879
|
];
|
|
24789
24880
|
return included.flatMap(walk).filter((file) => !within(file, excluded)).sort();
|
|
24790
24881
|
}
|
|
24791
|
-
var import_node_child_process7,
|
|
24882
|
+
var import_node_child_process7, import_node_crypto6, import_node_fs14, import_node_os6, import_node_path14, TARGET_TYPES, isTargetType, record, array, string, cacheDir3, evaluated, within;
|
|
24792
24883
|
var init_swift_package_manifest = __esm({
|
|
24793
24884
|
"src/swift-package-manifest.ts"() {
|
|
24794
24885
|
"use strict";
|
|
24795
24886
|
import_node_child_process7 = require("node:child_process");
|
|
24796
|
-
|
|
24797
|
-
|
|
24798
|
-
|
|
24799
|
-
|
|
24887
|
+
import_node_crypto6 = require("node:crypto");
|
|
24888
|
+
import_node_fs14 = __toESM(require("node:fs"), 1);
|
|
24889
|
+
import_node_os6 = __toESM(require("node:os"), 1);
|
|
24890
|
+
import_node_path14 = __toESM(require("node:path"), 1);
|
|
24800
24891
|
init_swift_distribution_lock();
|
|
24801
24892
|
init_swift_toolchain();
|
|
24802
24893
|
TARGET_TYPES = [
|
|
@@ -24812,15 +24903,15 @@ var init_swift_package_manifest = __esm({
|
|
|
24812
24903
|
record = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
24813
24904
|
array = (value) => Array.isArray(value) ? value : [];
|
|
24814
24905
|
string = (value) => typeof value === "string" ? value : void 0;
|
|
24815
|
-
|
|
24906
|
+
cacheDir3 = import_node_path14.default.join(import_node_os6.default.tmpdir(), "peach-swift-manifests");
|
|
24816
24907
|
evaluated = /* @__PURE__ */ new Map();
|
|
24817
|
-
within = (file, roots) => roots.some((root) => file === root || file.startsWith(`${root}${
|
|
24908
|
+
within = (file, roots) => roots.some((root) => file === root || file.startsWith(`${root}${import_node_path14.default.sep}`));
|
|
24818
24909
|
}
|
|
24819
24910
|
});
|
|
24820
24911
|
|
|
24821
24912
|
// src/swift-packages.ts
|
|
24822
24913
|
function readPins(resolved) {
|
|
24823
|
-
const data = JSON.parse(
|
|
24914
|
+
const data = JSON.parse(import_node_fs15.default.readFileSync(resolved, "utf8"));
|
|
24824
24915
|
const pins = data && typeof data === "object" && "pins" in data && Array.isArray(data.pins) ? data.pins : null;
|
|
24825
24916
|
if (!pins)
|
|
24826
24917
|
throw new Error(`${resolved} has no pins; resolve packages in a current Xcode`);
|
|
@@ -24835,23 +24926,23 @@ function readPins(resolved) {
|
|
|
24835
24926
|
return out;
|
|
24836
24927
|
}
|
|
24837
24928
|
function checkout(checkouts, identity, pin) {
|
|
24838
|
-
const dir =
|
|
24929
|
+
const dir = import_node_path15.default.join(checkouts, identity);
|
|
24839
24930
|
const key = `${dir}\0${pin.revision}`;
|
|
24840
24931
|
if (verified2.has(key)) return dir;
|
|
24841
24932
|
const git = (...args) => (0, import_node_child_process8.execFileSync)("git", ["-C", dir, ...args], {
|
|
24842
24933
|
encoding: "utf8",
|
|
24843
24934
|
stdio: ["ignore", "pipe", "pipe"]
|
|
24844
24935
|
}).trim();
|
|
24845
|
-
const current =
|
|
24936
|
+
const current = import_node_fs15.default.existsSync(import_node_path15.default.join(dir, ".git")) ? git("rev-parse", "HEAD") : "";
|
|
24846
24937
|
if (current !== pin.revision) {
|
|
24847
|
-
|
|
24848
|
-
|
|
24938
|
+
import_node_fs15.default.rmSync(dir, { recursive: true, force: true });
|
|
24939
|
+
import_node_fs15.default.mkdirSync(dir, { recursive: true });
|
|
24849
24940
|
try {
|
|
24850
24941
|
git("init", "-q");
|
|
24851
24942
|
git("fetch", "-q", "--depth", "1", pin.location, pin.revision);
|
|
24852
24943
|
git("checkout", "-q", "FETCH_HEAD");
|
|
24853
24944
|
} catch (error) {
|
|
24854
|
-
|
|
24945
|
+
import_node_fs15.default.rmSync(dir, { recursive: true, force: true });
|
|
24855
24946
|
const stderr = error instanceof Error && "stderr" in error ? String(error.stderr).trim() : "";
|
|
24856
24947
|
throw new Error(
|
|
24857
24948
|
`could not fetch ${pin.location} at ${pin.revision}${stderr ? `: ${stderr}` : ""}`
|
|
@@ -24867,13 +24958,14 @@ function resolveSwiftPackages(options) {
|
|
|
24867
24958
|
const result = {
|
|
24868
24959
|
targets: [],
|
|
24869
24960
|
unavailable: /* @__PURE__ */ new Map(),
|
|
24870
|
-
modules: /* @__PURE__ */ new Map()
|
|
24961
|
+
modules: /* @__PURE__ */ new Map(),
|
|
24962
|
+
binaries: []
|
|
24871
24963
|
};
|
|
24872
24964
|
const pins = resolved ? readPins(resolved) : null;
|
|
24873
|
-
const checkouts =
|
|
24965
|
+
const checkouts = import_node_path15.default.join(rootDir, REMOTE_CHECKOUTS);
|
|
24874
24966
|
const packages = /* @__PURE__ */ new Map();
|
|
24875
24967
|
const load2 = (source) => {
|
|
24876
|
-
const key = source.kind === "local" ?
|
|
24968
|
+
const key = source.kind === "local" ? import_node_path15.default.resolve(source.dir) : source.url;
|
|
24877
24969
|
const cached4 = packages.get(key);
|
|
24878
24970
|
if (cached4 !== void 0) return cached4;
|
|
24879
24971
|
let loaded2;
|
|
@@ -24885,8 +24977,8 @@ function resolveSwiftPackages(options) {
|
|
|
24885
24977
|
if (!pin) {
|
|
24886
24978
|
loaded2 = pins ? `package ${identity} is not pinned in Package.resolved` : "no Package.resolved pins it; resolve packages in Xcode once";
|
|
24887
24979
|
} else {
|
|
24888
|
-
|
|
24889
|
-
|
|
24980
|
+
import_node_fs15.default.mkdirSync(checkouts, { recursive: true });
|
|
24981
|
+
import_node_fs15.default.writeFileSync(import_node_path15.default.join(import_node_path15.default.dirname(checkouts), ".gitignore"), "*\n");
|
|
24890
24982
|
loaded2 = {
|
|
24891
24983
|
source: source.url,
|
|
24892
24984
|
remote: true,
|
|
@@ -24906,8 +24998,8 @@ function resolveSwiftPackages(options) {
|
|
|
24906
24998
|
const outcome = (() => {
|
|
24907
24999
|
if (provided.has(name2)) return null;
|
|
24908
25000
|
const target = pkg.manifest.targets.get(name2);
|
|
24909
|
-
if (!target) return `${
|
|
24910
|
-
if (target.type === "binary") return `${name2}
|
|
25001
|
+
if (!target) return `${import_node_path15.default.basename(pkg.manifest.dir)} declares no target ${name2}`;
|
|
25002
|
+
if (target.type === "binary") return `${name2} ${BINARY}`;
|
|
24911
25003
|
if (target.type === "system") return `${name2} is a system C library`;
|
|
24912
25004
|
if (target.type !== "regular") return `${name2} is a ${target.type} target`;
|
|
24913
25005
|
const files = swiftTargetFiles(pkg.manifest, target);
|
|
@@ -24918,9 +25010,9 @@ function resolveSwiftPackages(options) {
|
|
|
24918
25010
|
const nested = resolveDependencyProduct(pkg, dependency.package, dependency.name);
|
|
24919
25011
|
return nested && `${dependency.name}: ${nested}`;
|
|
24920
25012
|
});
|
|
24921
|
-
const blocked = reasons
|
|
25013
|
+
const blocked = blocker(reasons);
|
|
24922
25014
|
if (blocked) return blocked;
|
|
24923
|
-
const relative3 = files.map((file) =>
|
|
25015
|
+
const relative3 = files.map((file) => import_node_path15.default.relative(target.dir, file));
|
|
24924
25016
|
targets.set(`${pkg.manifest.dir}\0${name2}`, {
|
|
24925
25017
|
name: name2,
|
|
24926
25018
|
path: "",
|
|
@@ -24942,7 +25034,7 @@ function resolveSwiftPackages(options) {
|
|
|
24942
25034
|
const resolveProduct = (pkg, product) => {
|
|
24943
25035
|
if (provided.has(product)) return null;
|
|
24944
25036
|
const roots = pkg.manifest.products.get(product);
|
|
24945
|
-
const reason = !roots ? `${
|
|
25037
|
+
const reason = !roots ? `${import_node_path15.default.basename(pkg.manifest.dir)} has no library ${product}` : blocker(roots.map((name2) => resolveTarget(pkg, name2)));
|
|
24946
25038
|
productOutcomes.set(`${pkg.manifest.dir}\0${product}`, { pkg, reason });
|
|
24947
25039
|
return reason;
|
|
24948
25040
|
};
|
|
@@ -24950,7 +25042,7 @@ function resolveSwiftPackages(options) {
|
|
|
24950
25042
|
if (provided.has(product)) return null;
|
|
24951
25043
|
const dependency = pkg.manifest.packages.get(packageName);
|
|
24952
25044
|
if (!dependency)
|
|
24953
|
-
return `${
|
|
25045
|
+
return `${import_node_path15.default.basename(pkg.manifest.dir)} names no package ${packageName}`;
|
|
24954
25046
|
if ("dir" in dependency) {
|
|
24955
25047
|
const loaded3 = load2({ kind: "local", dir: dependency.dir });
|
|
24956
25048
|
return typeof loaded3 === "string" ? loaded3 : resolveProduct(loaded3, product);
|
|
@@ -24977,6 +25069,13 @@ function resolveSwiftPackages(options) {
|
|
|
24977
25069
|
if (target.type === "test" || target.type === "plugin" || target.type === "macro")
|
|
24978
25070
|
continue;
|
|
24979
25071
|
if (target.type === "executable") continue;
|
|
25072
|
+
if (target.type === "binary")
|
|
25073
|
+
result.binaries.push({
|
|
25074
|
+
target: name2,
|
|
25075
|
+
source: pkg.source,
|
|
25076
|
+
url: target.url,
|
|
25077
|
+
dir: target.dir
|
|
25078
|
+
});
|
|
24980
25079
|
const reason = resolveTarget(pkg, name2);
|
|
24981
25080
|
if (reason && !result.modules.has(name2))
|
|
24982
25081
|
result.modules.set(name2, { source: pkg.source, reason });
|
|
@@ -24996,7 +25095,7 @@ function resolveSwiftPackages(options) {
|
|
|
24996
25095
|
if (dependency.kind === "target") reach(pkg, dependency.name);
|
|
24997
25096
|
else {
|
|
24998
25097
|
const source = pkg.manifest.packages.get(dependency.package);
|
|
24999
|
-
const nested = source && ("dir" in source ? packages.get(
|
|
25098
|
+
const nested = source && ("dir" in source ? packages.get(import_node_path15.default.resolve(source.dir)) : packages.get(source.url));
|
|
25000
25099
|
if (nested && typeof nested !== "string")
|
|
25001
25100
|
for (const root of nested.manifest.products.get(dependency.name) ?? [])
|
|
25002
25101
|
reach(nested, root);
|
|
@@ -25004,24 +25103,26 @@ function resolveSwiftPackages(options) {
|
|
|
25004
25103
|
}
|
|
25005
25104
|
};
|
|
25006
25105
|
for (const { product, source } of products) {
|
|
25007
|
-
const pkg = source.kind === "unnamed" ? unnamed().find((candidate) => candidate.manifest.products.has(product)) : packages.get(source.kind === "local" ?
|
|
25106
|
+
const pkg = source.kind === "unnamed" ? unnamed().find((candidate) => candidate.manifest.products.has(product)) : packages.get(source.kind === "local" ? import_node_path15.default.resolve(source.dir) : source.url);
|
|
25008
25107
|
if (!pkg || typeof pkg === "string") continue;
|
|
25009
25108
|
for (const root of pkg.manifest.products.get(product) ?? []) reach(pkg, root);
|
|
25010
25109
|
}
|
|
25011
25110
|
result.targets = [...targets.entries()].filter(([key]) => reached.has(key)).map(([, target]) => target);
|
|
25012
25111
|
return result;
|
|
25013
25112
|
}
|
|
25014
|
-
var import_node_child_process8,
|
|
25113
|
+
var import_node_child_process8, import_node_fs15, import_node_path15, REMOTE_CHECKOUTS, C_FAMILY, BINARY, blocker, verified2;
|
|
25015
25114
|
var init_swift_packages = __esm({
|
|
25016
25115
|
"src/swift-packages.ts"() {
|
|
25017
25116
|
"use strict";
|
|
25018
25117
|
import_node_child_process8 = require("node:child_process");
|
|
25019
|
-
|
|
25020
|
-
|
|
25118
|
+
import_node_fs15 = __toESM(require("node:fs"), 1);
|
|
25119
|
+
import_node_path15 = __toESM(require("node:path"), 1);
|
|
25021
25120
|
init_swift_package();
|
|
25022
25121
|
init_swift_package_manifest();
|
|
25023
|
-
REMOTE_CHECKOUTS =
|
|
25122
|
+
REMOTE_CHECKOUTS = import_node_path15.default.join(".build", "peach", "checkouts");
|
|
25024
25123
|
C_FAMILY = /\.(c|cc|cpp|cxx|m|mm|s|S)$/;
|
|
25124
|
+
BINARY = "is a binary framework";
|
|
25125
|
+
blocker = (reasons) => reasons.find((reason) => reason?.includes(BINARY)) ?? reasons.find((reason) => reason !== null) ?? null;
|
|
25025
25126
|
verified2 = /* @__PURE__ */ new Set();
|
|
25026
25127
|
}
|
|
25027
25128
|
});
|
|
@@ -25162,7 +25263,7 @@ var init_swift_submit = __esm({
|
|
|
25162
25263
|
function readXcodeJsonProject(xcodeproj, source) {
|
|
25163
25264
|
const json = import_json5.default.parse(source);
|
|
25164
25265
|
if (!isJsonObject(json)) throw new Error(`${xcodeproj}/project.xcproj is not an object`);
|
|
25165
|
-
const projectDir =
|
|
25266
|
+
const projectDir = import_node_path16.default.dirname(xcodeproj);
|
|
25166
25267
|
const objects = {};
|
|
25167
25268
|
let next = 0;
|
|
25168
25269
|
const add = (entry, id) => {
|
|
@@ -25175,7 +25276,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
25175
25276
|
const base = /^<([A-Z]+)>\/(.*)$/.exec(raw2);
|
|
25176
25277
|
if (base) {
|
|
25177
25278
|
if (base[1] === "PROJECT")
|
|
25178
|
-
return { sourceTree: "<absolute>", path:
|
|
25279
|
+
return { sourceTree: "<absolute>", path: import_node_path16.default.join(projectDir, base[2]) };
|
|
25179
25280
|
if (base[1] === "PRODUCTS")
|
|
25180
25281
|
return { sourceTree: "BUILT_PRODUCTS_DIR", path: base[2] };
|
|
25181
25282
|
return null;
|
|
@@ -25183,7 +25284,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
25183
25284
|
const unescaped = raw2.replaceAll("\\<", "<");
|
|
25184
25285
|
if (unescaped.startsWith("/")) return { sourceTree: "<absolute>", path: unescaped };
|
|
25185
25286
|
if (unescaped.startsWith("~")) return null;
|
|
25186
|
-
return groupDir === null ? null : { sourceTree: "<absolute>", path:
|
|
25287
|
+
return groupDir === null ? null : { sourceTree: "<absolute>", path: import_node_path16.default.join(groupDir, unescaped) };
|
|
25187
25288
|
};
|
|
25188
25289
|
const memberships = [];
|
|
25189
25290
|
const folders = [];
|
|
@@ -25194,7 +25295,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
25194
25295
|
const kind = text(entry.kind) ?? "file-reference";
|
|
25195
25296
|
const raw2 = text(entry.path) ?? "";
|
|
25196
25297
|
const located = raw2 === "" ? null : locate(raw2, parent.dir);
|
|
25197
|
-
const name2 = text(entry.name) ??
|
|
25298
|
+
const name2 = text(entry.name) ?? import_node_path16.default.basename(raw2);
|
|
25198
25299
|
const node = { id: "", name: name2, dir: null, parent, children: [] };
|
|
25199
25300
|
if (kind === "group" || kind === "variant-group" || kind === "version-group") {
|
|
25200
25301
|
node.dir = raw2 === "" ? parent.dir : located?.sourceTree === "<absolute>" ? located.path : null;
|
|
@@ -25309,7 +25410,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
25309
25410
|
if (!isObject(entry)) continue;
|
|
25310
25411
|
const repository = text(entry.repository);
|
|
25311
25412
|
const local = text(entry.path);
|
|
25312
|
-
const name2 = local !== void 0 ?
|
|
25413
|
+
const name2 = local !== void 0 ? import_node_path16.default.basename(import_node_path16.default.resolve(import_node_path16.default.dirname(xcodeproj), local)) : import_node_path16.default.basename(repository ?? "").replace(/\.git$/, "");
|
|
25313
25414
|
const id = text(entry.kind) === "local" && local !== void 0 ? add({ isa: "XCLocalSwiftPackageReference", relativePath: local }) : add({ isa: "XCRemoteSwiftPackageReference", repositoryURL: repository ?? "" });
|
|
25314
25415
|
packageIds.set(name2.toLowerCase(), id);
|
|
25315
25416
|
}
|
|
@@ -25477,11 +25578,11 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
25477
25578
|
function isJsonObject(value) {
|
|
25478
25579
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
25479
25580
|
}
|
|
25480
|
-
var
|
|
25581
|
+
var import_node_path16, import_json5, isObject, text, items, PHASE_ISA;
|
|
25481
25582
|
var init_xcode_json_project = __esm({
|
|
25482
25583
|
"src/xcode-json-project.ts"() {
|
|
25483
25584
|
"use strict";
|
|
25484
|
-
|
|
25585
|
+
import_node_path16 = __toESM(require("node:path"), 1);
|
|
25485
25586
|
import_json5 = __toESM(require("json5"), 1);
|
|
25486
25587
|
isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
25487
25588
|
text = (value) => typeof value === "string" ? value : void 0;
|
|
@@ -25588,27 +25689,27 @@ function parseOpenStepPlist(text2) {
|
|
|
25588
25689
|
return root;
|
|
25589
25690
|
}
|
|
25590
25691
|
function walkFiles(dir) {
|
|
25591
|
-
if (!
|
|
25692
|
+
if (!import_node_fs16.default.existsSync(dir)) return [];
|
|
25592
25693
|
const out = [];
|
|
25593
|
-
for (const entry of
|
|
25694
|
+
for (const entry of import_node_fs16.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
|
|
25594
25695
|
if (entry.name.startsWith(".")) continue;
|
|
25595
|
-
const full =
|
|
25696
|
+
const full = import_node_path17.default.join(dir, entry.name);
|
|
25596
25697
|
if (entry.isDirectory()) out.push(...walkFiles(full));
|
|
25597
25698
|
else if (entry.isFile()) out.push(full);
|
|
25598
25699
|
}
|
|
25599
25700
|
return out;
|
|
25600
25701
|
}
|
|
25601
25702
|
function readXcconfig(file, seen = /* @__PURE__ */ new Set()) {
|
|
25602
|
-
if (seen.has(file) || !
|
|
25703
|
+
if (seen.has(file) || !import_node_fs16.default.existsSync(file)) return {};
|
|
25603
25704
|
seen.add(file);
|
|
25604
25705
|
const settings = {};
|
|
25605
|
-
for (const raw2 of
|
|
25706
|
+
for (const raw2 of import_node_fs16.default.readFileSync(file, "utf8").split("\n")) {
|
|
25606
25707
|
const line = raw2.replace(/\/\/.*$/, "").trim();
|
|
25607
25708
|
const include = /^#include\??\s+"([^"]+)"/.exec(line);
|
|
25608
25709
|
if (include) {
|
|
25609
25710
|
Object.assign(
|
|
25610
25711
|
settings,
|
|
25611
|
-
readXcconfig(
|
|
25712
|
+
readXcconfig(import_node_path17.default.resolve(import_node_path17.default.dirname(file), include[1]), seen)
|
|
25612
25713
|
);
|
|
25613
25714
|
continue;
|
|
25614
25715
|
}
|
|
@@ -25658,22 +25759,22 @@ function decodeXml(text2) {
|
|
|
25658
25759
|
return text2.replaceAll(""", '"').replaceAll("'", "'").replaceAll("<", "<").replaceAll(">", ">").replaceAll("&", "&");
|
|
25659
25760
|
}
|
|
25660
25761
|
function workspaceReferences(workspace) {
|
|
25661
|
-
const data =
|
|
25662
|
-
if (!
|
|
25762
|
+
const data = import_node_path17.default.join(workspace, "contents.xcworkspacedata");
|
|
25763
|
+
if (!import_node_fs16.default.existsSync(data))
|
|
25663
25764
|
throw new Error(`${workspace} has no contents.xcworkspacedata`);
|
|
25664
|
-
const container =
|
|
25765
|
+
const container = import_node_path17.default.dirname(workspace);
|
|
25665
25766
|
const locate = (location2, base) => {
|
|
25666
25767
|
const colon = location2.indexOf(":");
|
|
25667
25768
|
const kind = location2.slice(0, colon);
|
|
25668
25769
|
const rest = location2.slice(colon + 1);
|
|
25669
|
-
if (kind === "group") return
|
|
25670
|
-
if (kind === "container" || kind === "self") return
|
|
25671
|
-
if (kind === "absolute") return
|
|
25672
|
-
throw new Error(`${
|
|
25770
|
+
if (kind === "group") return import_node_path17.default.resolve(base, rest);
|
|
25771
|
+
if (kind === "container" || kind === "self") return import_node_path17.default.resolve(container, rest);
|
|
25772
|
+
if (kind === "absolute") return import_node_path17.default.resolve(rest);
|
|
25773
|
+
throw new Error(`${import_node_path17.default.basename(workspace)} has an unsupported location ${location2}`);
|
|
25673
25774
|
};
|
|
25674
25775
|
const groups = [container];
|
|
25675
25776
|
const references = [];
|
|
25676
|
-
for (const [, closing, tag, attributes, selfClosing] of
|
|
25777
|
+
for (const [, closing, tag, attributes, selfClosing] of import_node_fs16.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
|
|
25677
25778
|
if (closing) {
|
|
25678
25779
|
if (tag === "Group") groups.pop();
|
|
25679
25780
|
continue;
|
|
@@ -25688,8 +25789,8 @@ function workspaceReferences(workspace) {
|
|
|
25688
25789
|
}
|
|
25689
25790
|
function xcodeProjectFile(xcodeproj) {
|
|
25690
25791
|
for (const name2 of ["project.pbxproj", "project.xcproj"]) {
|
|
25691
|
-
const file =
|
|
25692
|
-
if (
|
|
25792
|
+
const file = import_node_path17.default.join(xcodeproj, name2);
|
|
25793
|
+
if (import_node_fs16.default.existsSync(file)) return file;
|
|
25693
25794
|
}
|
|
25694
25795
|
return null;
|
|
25695
25796
|
}
|
|
@@ -25697,10 +25798,10 @@ function loadProject(xcodeproj) {
|
|
|
25697
25798
|
const projectFile = xcodeProjectFile(xcodeproj);
|
|
25698
25799
|
if (!projectFile)
|
|
25699
25800
|
throw new Error(`${xcodeproj} has no project.pbxproj or project.xcproj`);
|
|
25700
|
-
const mtimeMs =
|
|
25801
|
+
const mtimeMs = import_node_fs16.default.statSync(projectFile).mtimeMs;
|
|
25701
25802
|
const cached4 = loaded.get(projectFile);
|
|
25702
25803
|
if (cached4?.mtimeMs === mtimeMs) return cached4.project;
|
|
25703
|
-
const source =
|
|
25804
|
+
const source = import_node_fs16.default.readFileSync(projectFile, "utf8");
|
|
25704
25805
|
const root = projectFile.endsWith(".xcproj") ? readXcodeJsonProject(xcodeproj, source) : parseOpenStepPlist(source);
|
|
25705
25806
|
if (!isDict(root) || !isDict(root.objects)) {
|
|
25706
25807
|
throw new Error(`${projectFile} has no objects table`);
|
|
@@ -25714,8 +25815,8 @@ function loadProject(xcodeproj) {
|
|
|
25714
25815
|
if (!project || project.isa !== "PBXProject") {
|
|
25715
25816
|
throw new Error(`${projectFile} has no PBXProject root`);
|
|
25716
25817
|
}
|
|
25717
|
-
const projectDir =
|
|
25718
|
-
|
|
25818
|
+
const projectDir = import_node_fs16.default.realpathSync(
|
|
25819
|
+
import_node_path17.default.resolve(import_node_path17.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
|
|
25719
25820
|
);
|
|
25720
25821
|
const parent = /* @__PURE__ */ new Map();
|
|
25721
25822
|
for (const [id, entry] of Object.entries(objects)) {
|
|
@@ -25733,11 +25834,11 @@ function loadProject(xcodeproj) {
|
|
|
25733
25834
|
const own = str(entry.path) ?? "";
|
|
25734
25835
|
const tree = str(entry.sourceTree) ?? "<group>";
|
|
25735
25836
|
if (tree === "<absolute>") result2 = own;
|
|
25736
|
-
else if (tree === "SOURCE_ROOT") result2 =
|
|
25837
|
+
else if (tree === "SOURCE_ROOT") result2 = import_node_path17.default.join(projectDir, own);
|
|
25737
25838
|
else if (tree === "<group>") {
|
|
25738
25839
|
const up = parent.get(id);
|
|
25739
25840
|
const base = up ? resolvePath(up) : projectDir;
|
|
25740
|
-
result2 = base === null ? null :
|
|
25841
|
+
result2 = base === null ? null : import_node_path17.default.join(base, own);
|
|
25741
25842
|
}
|
|
25742
25843
|
}
|
|
25743
25844
|
resolvedPaths.set(id, result2);
|
|
@@ -25837,7 +25938,7 @@ function targetMembers(ref) {
|
|
|
25837
25938
|
const addResource = (file) => {
|
|
25838
25939
|
if (isDirectory(file)) {
|
|
25839
25940
|
for (const inner of walkFiles(file)) resources.add(inner);
|
|
25840
|
-
} else if (
|
|
25941
|
+
} else if (import_node_fs16.default.existsSync(file)) resources.add(file);
|
|
25841
25942
|
};
|
|
25842
25943
|
const fileRefPaths = (refId) => {
|
|
25843
25944
|
const entry = project.object(refId);
|
|
@@ -25858,7 +25959,7 @@ function targetMembers(ref) {
|
|
|
25858
25959
|
for (const buildFileId of list(phase.files)) {
|
|
25859
25960
|
for (const file of fileRefPaths(str(project.object(buildFileId)?.fileRef) ?? "")) {
|
|
25860
25961
|
if (phase.isa === "PBXSourcesBuildPhase") {
|
|
25861
|
-
if (!
|
|
25962
|
+
if (!import_node_fs16.default.existsSync(file)) continue;
|
|
25862
25963
|
allSources.add(file);
|
|
25863
25964
|
if (file.endsWith(".swift")) sources.add(file);
|
|
25864
25965
|
} else if (phase.isa === "PBXResourcesBuildPhase") addResource(file);
|
|
@@ -25866,7 +25967,7 @@ function targetMembers(ref) {
|
|
|
25866
25967
|
}
|
|
25867
25968
|
}
|
|
25868
25969
|
const addSynchronized = (folder, relative3) => {
|
|
25869
|
-
const file =
|
|
25970
|
+
const file = import_node_path17.default.join(folder, relative3);
|
|
25870
25971
|
if (NEVER_MEMBER.test(relative3)) return;
|
|
25871
25972
|
if (file.endsWith(".swift")) {
|
|
25872
25973
|
if (!relative3.split("/").some((segment) => BUNDLE_DIR.test(segment))) {
|
|
@@ -25891,7 +25992,7 @@ function targetMembers(ref) {
|
|
|
25891
25992
|
}
|
|
25892
25993
|
if (owned.has(groupId)) {
|
|
25893
25994
|
for (const file of walkFiles(folder)) {
|
|
25894
|
-
const relative3 =
|
|
25995
|
+
const relative3 = import_node_path17.default.relative(folder, file).split(import_node_path17.default.sep).join("/");
|
|
25895
25996
|
if ([...exceptions].some(
|
|
25896
25997
|
(exception) => relative3 === exception || relative3.startsWith(`${exception}/`)
|
|
25897
25998
|
))
|
|
@@ -25900,14 +26001,14 @@ function targetMembers(ref) {
|
|
|
25900
26001
|
}
|
|
25901
26002
|
} else {
|
|
25902
26003
|
for (const relative3 of exceptions) {
|
|
25903
|
-
const file =
|
|
26004
|
+
const file = import_node_path17.default.join(folder, relative3);
|
|
25904
26005
|
if (isDirectory(file)) {
|
|
25905
26006
|
for (const inner of walkFiles(file))
|
|
25906
26007
|
addSynchronized(
|
|
25907
26008
|
folder,
|
|
25908
|
-
|
|
26009
|
+
import_node_path17.default.relative(folder, inner).split(import_node_path17.default.sep).join("/")
|
|
25909
26010
|
);
|
|
25910
|
-
} else if (
|
|
26011
|
+
} else if (import_node_fs16.default.existsSync(file)) addSynchronized(folder, relative3);
|
|
25911
26012
|
}
|
|
25912
26013
|
}
|
|
25913
26014
|
}
|
|
@@ -25920,8 +26021,8 @@ function targetMembers(ref) {
|
|
|
25920
26021
|
function commonAncestor(dirs) {
|
|
25921
26022
|
let common = dirs[0];
|
|
25922
26023
|
for (const dir of dirs) {
|
|
25923
|
-
while (common !==
|
|
25924
|
-
common =
|
|
26024
|
+
while (common !== import_node_path17.default.dirname(common) && import_node_path17.default.relative(common, dir).startsWith(".."))
|
|
26025
|
+
common = import_node_path17.default.dirname(common);
|
|
25925
26026
|
}
|
|
25926
26027
|
return common;
|
|
25927
26028
|
}
|
|
@@ -25930,8 +26031,8 @@ function workspaceProjects(xcodeprojOrWorkspace) {
|
|
|
25930
26031
|
const projects2 = [];
|
|
25931
26032
|
const projectAt = /* @__PURE__ */ new Map();
|
|
25932
26033
|
const addProject = (xcodeproj) => {
|
|
25933
|
-
const key =
|
|
25934
|
-
if (projectAt.has(key) || key.split(
|
|
26034
|
+
const key = import_node_path17.default.resolve(xcodeproj);
|
|
26035
|
+
if (projectAt.has(key) || key.split(import_node_path17.default.sep).includes("Pods")) return;
|
|
25935
26036
|
if (!xcodeProjectFile(key)) return;
|
|
25936
26037
|
const project = loadProject(key);
|
|
25937
26038
|
projectAt.set(key, project);
|
|
@@ -25948,7 +26049,7 @@ function workspaceProjects(xcodeprojOrWorkspace) {
|
|
|
25948
26049
|
for (const reference of listed)
|
|
25949
26050
|
if (reference.endsWith(".xcodeproj")) addProject(reference);
|
|
25950
26051
|
if (projects2.length === 0) {
|
|
25951
|
-
throw new Error(`${
|
|
26052
|
+
throw new Error(`${import_node_path17.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
|
|
25952
26053
|
}
|
|
25953
26054
|
return { listed, projects: projects2, projectAt };
|
|
25954
26055
|
}
|
|
@@ -25972,7 +26073,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
25972
26073
|
const allTargets = projects2.flatMap(nativeTargets);
|
|
25973
26074
|
const appTargets = allTargets.filter((ref) => ref.target.productType === APPLICATION);
|
|
25974
26075
|
const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
|
|
25975
|
-
const container =
|
|
26076
|
+
const container = import_node_path17.default.basename(xcodeprojOrWorkspace);
|
|
25976
26077
|
const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
|
|
25977
26078
|
if (named.length !== 1) {
|
|
25978
26079
|
throw new Error(
|
|
@@ -25984,14 +26085,14 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
25984
26085
|
for (const ref of allTargets) {
|
|
25985
26086
|
const product = ref.project.object(str(ref.target.productReference));
|
|
25986
26087
|
const file = str(product?.path);
|
|
25987
|
-
if (file && !byProduct.has(
|
|
25988
|
-
byProduct.set(
|
|
26088
|
+
if (file && !byProduct.has(import_node_path17.default.basename(file)))
|
|
26089
|
+
byProduct.set(import_node_path17.default.basename(file), ref);
|
|
25989
26090
|
}
|
|
25990
26091
|
const proxied = (project, proxyId) => {
|
|
25991
26092
|
const proxy = project.object(proxyId);
|
|
25992
26093
|
if (proxy?.isa !== "PBXContainerItemProxy") return void 0;
|
|
25993
26094
|
const portal = str(proxy.containerPortal);
|
|
25994
|
-
const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(
|
|
26095
|
+
const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path17.default.resolve(project.resolvePath(portal ?? "") ?? ""));
|
|
25995
26096
|
const remote = str(proxy.remoteGlobalIDString);
|
|
25996
26097
|
if (!owner || !remote) return void 0;
|
|
25997
26098
|
return nativeTargets(owner).find(
|
|
@@ -26012,7 +26113,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
26012
26113
|
if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
|
|
26013
26114
|
for (const buildFileId of list(phase.files)) {
|
|
26014
26115
|
const file = project.object(str(project.object(buildFileId)?.fileRef));
|
|
26015
|
-
const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(
|
|
26116
|
+
const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path17.default.basename(str(file.path) ?? "")) : void 0;
|
|
26016
26117
|
if (resolved) found.push(resolved);
|
|
26017
26118
|
}
|
|
26018
26119
|
}
|
|
@@ -26033,7 +26134,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
26033
26134
|
const name2 = str(ref.target.name) ?? ref.id;
|
|
26034
26135
|
const { get: settings2, keys } = targetSettings(ref, {
|
|
26035
26136
|
TARGET_NAME: name2,
|
|
26036
|
-
PROJECT_NAME:
|
|
26137
|
+
PROJECT_NAME: import_node_path17.default.basename(ref.project.xcodeproj, ".xcodeproj"),
|
|
26037
26138
|
SRCROOT: ref.project.projectDir,
|
|
26038
26139
|
SOURCE_ROOT: ref.project.projectDir,
|
|
26039
26140
|
PROJECT_DIR: ref.project.projectDir,
|
|
@@ -26064,8 +26165,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
26064
26165
|
}
|
|
26065
26166
|
return value;
|
|
26066
26167
|
};
|
|
26067
|
-
const infoPlistFile = settings("INFOPLIST_FILE") ?
|
|
26068
|
-
const sourceInfo = infoPlistFile ? import_plist3.default.parse(
|
|
26168
|
+
const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path17.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
|
|
26169
|
+
const sourceInfo = infoPlistFile ? import_plist3.default.parse(import_node_fs16.default.readFileSync(infoPlistFile, "utf8")) : {};
|
|
26069
26170
|
if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
|
|
26070
26171
|
throw new Error(`${module2.name} Info.plist must contain a dictionary`);
|
|
26071
26172
|
}
|
|
@@ -26083,12 +26184,12 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
26083
26184
|
};
|
|
26084
26185
|
}
|
|
26085
26186
|
const localPackageDirs = [
|
|
26086
|
-
...listed.filter((reference) =>
|
|
26187
|
+
...listed.filter((reference) => import_node_fs16.default.existsSync(import_node_path17.default.join(reference, "Package.swift"))),
|
|
26087
26188
|
...projects2.flatMap(
|
|
26088
26189
|
(project) => Object.entries(project.objects).flatMap(([id, entry]) => {
|
|
26089
26190
|
if (!isDict(entry)) return [];
|
|
26090
|
-
const candidate = entry.isa === "XCLocalSwiftPackageReference" ?
|
|
26091
|
-
return candidate &&
|
|
26191
|
+
const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path17.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
|
|
26192
|
+
return candidate && import_node_fs16.default.existsSync(import_node_path17.default.join(candidate, "Package.swift")) ? [candidate] : [];
|
|
26092
26193
|
})
|
|
26093
26194
|
)
|
|
26094
26195
|
];
|
|
@@ -26112,7 +26213,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
26112
26213
|
product,
|
|
26113
26214
|
source: reference?.isa === "XCRemoteSwiftPackageReference" ? { kind: "remote", url: str(reference.repositoryURL) ?? "" } : reference?.isa === "XCLocalSwiftPackageReference" ? {
|
|
26114
26215
|
kind: "local",
|
|
26115
|
-
dir:
|
|
26216
|
+
dir: import_node_path17.default.resolve(
|
|
26116
26217
|
project.projectDir,
|
|
26117
26218
|
str(reference.relativePath) ?? ""
|
|
26118
26219
|
)
|
|
@@ -26134,8 +26235,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
26134
26235
|
}
|
|
26135
26236
|
}
|
|
26136
26237
|
}
|
|
26137
|
-
const resolvedFile =
|
|
26138
|
-
workspace ??
|
|
26238
|
+
const resolvedFile = import_node_path17.default.join(
|
|
26239
|
+
workspace ?? import_node_path17.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
|
|
26139
26240
|
"xcshareddata",
|
|
26140
26241
|
"swiftpm",
|
|
26141
26242
|
"Package.resolved"
|
|
@@ -26145,13 +26246,13 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
26145
26246
|
...module2,
|
|
26146
26247
|
rootDir: commonAncestor(
|
|
26147
26248
|
[
|
|
26148
|
-
workspace ?
|
|
26249
|
+
workspace ? import_node_path17.default.dirname(workspace) : app.project.projectDir,
|
|
26149
26250
|
...used.map((project) => project.projectDir),
|
|
26150
26251
|
...localPackageDirs,
|
|
26151
26252
|
...linkedProducts.flatMap(
|
|
26152
|
-
({ source }) => source.kind === "local" &&
|
|
26253
|
+
({ source }) => source.kind === "local" && import_node_fs16.default.existsSync(source.dir) ? [source.dir] : []
|
|
26153
26254
|
)
|
|
26154
|
-
].map((dir) =>
|
|
26255
|
+
].map((dir) => import_node_fs16.default.realpathSync(dir))
|
|
26155
26256
|
),
|
|
26156
26257
|
projectFiles: [...new Set(used.map((project) => project.projectFile))].sort(),
|
|
26157
26258
|
infoPlist: import_plist3.default.build(info),
|
|
@@ -26159,19 +26260,19 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
26159
26260
|
frameworks,
|
|
26160
26261
|
linkedProducts,
|
|
26161
26262
|
localPackageDirs: [
|
|
26162
|
-
...new Set(localPackageDirs.map((dir) =>
|
|
26263
|
+
...new Set(localPackageDirs.map((dir) => import_node_fs16.default.realpathSync(dir)))
|
|
26163
26264
|
].sort(),
|
|
26164
26265
|
binaryFrameworks: [...binaryFrameworks].sort(),
|
|
26165
|
-
packageResolved:
|
|
26266
|
+
packageResolved: import_node_fs16.default.existsSync(resolvedFile) ? resolvedFile : null,
|
|
26166
26267
|
appTargets: appTargetNames
|
|
26167
26268
|
};
|
|
26168
26269
|
}
|
|
26169
|
-
var
|
|
26270
|
+
var import_node_fs16, import_node_path17, import_plist3, isDict, str, list, APPLICATION, MODULE_PRODUCTS, NEVER_MEMBER, BUNDLE_DIR, CONDITIONS, isDirectory, loaded, targetRefs;
|
|
26170
26271
|
var init_xcode_project = __esm({
|
|
26171
26272
|
"src/xcode-project.ts"() {
|
|
26172
26273
|
"use strict";
|
|
26173
|
-
|
|
26174
|
-
|
|
26274
|
+
import_node_fs16 = __toESM(require("node:fs"), 1);
|
|
26275
|
+
import_node_path17 = __toESM(require("node:path"), 1);
|
|
26175
26276
|
import_plist3 = __toESM(require_plist(), 1);
|
|
26176
26277
|
init_xcode_json_project();
|
|
26177
26278
|
isDict = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -26191,7 +26292,7 @@ var init_xcode_project = __esm({
|
|
|
26191
26292
|
arch: "arm64",
|
|
26192
26293
|
variant: "normal"
|
|
26193
26294
|
};
|
|
26194
|
-
isDirectory = (dir) =>
|
|
26295
|
+
isDirectory = (dir) => import_node_fs16.default.existsSync(dir) && import_node_fs16.default.statSync(dir).isDirectory();
|
|
26195
26296
|
loaded = /* @__PURE__ */ new Map();
|
|
26196
26297
|
targetRefs = /* @__PURE__ */ new WeakMap();
|
|
26197
26298
|
}
|
|
@@ -26199,17 +26300,17 @@ var init_xcode_project = __esm({
|
|
|
26199
26300
|
|
|
26200
26301
|
// src/swift-host.ts
|
|
26201
26302
|
function swiftPackageId(packagePath) {
|
|
26202
|
-
return
|
|
26303
|
+
return import_node_path18.default.basename(packagePath).replace(/[^A-Za-z0-9_]/g, "_").replace(/^(\d)/, "_$1");
|
|
26203
26304
|
}
|
|
26204
26305
|
function nativeSourceDescriptor(packagePath) {
|
|
26205
|
-
packagePath =
|
|
26206
|
-
const file =
|
|
26207
|
-
if (!
|
|
26306
|
+
packagePath = import_node_fs17.default.realpathSync(packagePath);
|
|
26307
|
+
const file = import_node_path18.default.join(packagePath, NATIVE_DESCRIPTOR);
|
|
26308
|
+
if (!import_node_fs17.default.existsSync(file)) return null;
|
|
26208
26309
|
const value = JSON.parse(
|
|
26209
26310
|
readPackageFile(packagePath, file, MAX_SWIFT_COMPILE_SOURCE_BYTES).toString("utf8")
|
|
26210
26311
|
);
|
|
26211
26312
|
const invalid = () => new Error(`${file}: invalid One native source descriptor; run one typegen`);
|
|
26212
|
-
if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !
|
|
26313
|
+
if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !import_node_fs17.default.existsSync(import_node_path18.default.join(packagePath, NATIVE_GLUE))) {
|
|
26213
26314
|
throw invalid();
|
|
26214
26315
|
}
|
|
26215
26316
|
if (!isSwiftNativeModules(value) || value.packageId !== swiftPackageId(packagePath)) {
|
|
@@ -26218,7 +26319,7 @@ function nativeSourceDescriptor(packagePath) {
|
|
|
26218
26319
|
return value;
|
|
26219
26320
|
}
|
|
26220
26321
|
function projectFor(packagePath, hosted) {
|
|
26221
|
-
packagePath =
|
|
26322
|
+
packagePath = import_node_fs17.default.realpathSync(packagePath);
|
|
26222
26323
|
const existing = projects.get(packagePath);
|
|
26223
26324
|
if (existing) {
|
|
26224
26325
|
if (hosted && !existing.hosted) {
|
|
@@ -26239,14 +26340,14 @@ function projectFor(packagePath, hosted) {
|
|
|
26239
26340
|
return created;
|
|
26240
26341
|
}
|
|
26241
26342
|
function swiftPackages(entry, app) {
|
|
26242
|
-
const stamp = (file) => file &&
|
|
26343
|
+
const stamp = (file) => file && import_node_fs17.default.existsSync(file) ? import_node_fs17.default.statSync(file).mtimeMs : 0;
|
|
26243
26344
|
const key = JSON.stringify([
|
|
26244
26345
|
app.linkedProducts,
|
|
26245
26346
|
app.packageResolved,
|
|
26246
26347
|
stamp(app.packageResolved),
|
|
26247
|
-
app.localPackageDirs.map((dir) => stamp(
|
|
26348
|
+
app.localPackageDirs.map((dir) => stamp(import_node_path18.default.join(dir, "Package.swift"))),
|
|
26248
26349
|
app.linkedProducts.map(
|
|
26249
|
-
({ source }) => source.kind === "local" ? stamp(
|
|
26350
|
+
({ source }) => source.kind === "local" ? stamp(import_node_path18.default.join(source.dir, "Package.swift")) : 0
|
|
26250
26351
|
)
|
|
26251
26352
|
]);
|
|
26252
26353
|
if (entry.packages?.key !== key) {
|
|
@@ -26265,8 +26366,8 @@ function swiftPackages(entry, app) {
|
|
|
26265
26366
|
}
|
|
26266
26367
|
function xcodeInputKey(layout, file, relative3) {
|
|
26267
26368
|
const owner = layout.targetDirs.get(file);
|
|
26268
|
-
if (owner) return
|
|
26269
|
-
return relative3.startsWith(CHECKOUTS_PREFIX) ?
|
|
26369
|
+
if (owner) return import_node_path18.default.posix.join(owner, relative3);
|
|
26370
|
+
return relative3.startsWith(CHECKOUTS_PREFIX) ? import_node_path18.default.posix.join(XCODE_PACKAGES_DIR, relative3.slice(CHECKOUTS_PREFIX.length)) : relative3;
|
|
26270
26371
|
}
|
|
26271
26372
|
function xcodeLayout(root) {
|
|
26272
26373
|
const registered = xcodeProjects.get(root);
|
|
@@ -26277,7 +26378,7 @@ function xcodeLayout(root) {
|
|
|
26277
26378
|
const targetDirs = new Map(app.sources.map((file) => [file, XCODE_APP_DIR]));
|
|
26278
26379
|
const targets = [];
|
|
26279
26380
|
for (const framework of app.frameworks) {
|
|
26280
|
-
const dir =
|
|
26381
|
+
const dir = import_node_path18.default.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName);
|
|
26281
26382
|
for (const file of framework.sources) {
|
|
26282
26383
|
if (targetDirs.has(file)) continue;
|
|
26283
26384
|
targetDirs.set(file, dir);
|
|
@@ -26295,19 +26396,19 @@ function xcodeLayout(root) {
|
|
|
26295
26396
|
}
|
|
26296
26397
|
const packages = swiftPackages(registered, app);
|
|
26297
26398
|
for (const target of packages.targets) {
|
|
26298
|
-
const relative3 =
|
|
26299
|
-
target.remote ?
|
|
26399
|
+
const relative3 = import_node_path18.default.relative(
|
|
26400
|
+
target.remote ? import_node_path18.default.join(root, REMOTE_CHECKOUTS) : root,
|
|
26300
26401
|
target.dir
|
|
26301
26402
|
);
|
|
26302
|
-
if (relative3 === ".." || relative3.startsWith(`..${
|
|
26403
|
+
if (relative3 === ".." || relative3.startsWith(`..${import_node_path18.default.sep}`) || import_node_path18.default.isAbsolute(relative3))
|
|
26303
26404
|
throw new Error(`swift input escapes the selected package: ${target.dir}`);
|
|
26304
|
-
const posix2 = relative3.split(
|
|
26405
|
+
const posix2 = relative3.split(import_node_path18.default.sep).join(import_node_path18.default.posix.sep);
|
|
26305
26406
|
targets.push({
|
|
26306
26407
|
...target,
|
|
26307
|
-
path: target.remote ?
|
|
26408
|
+
path: target.remote ? import_node_path18.default.posix.join(XCODE_PACKAGES_DIR, posix2) : posix2,
|
|
26308
26409
|
exclude: []
|
|
26309
26410
|
});
|
|
26310
|
-
if (!target.remote) files.add(
|
|
26411
|
+
if (!target.remote) files.add(import_node_path18.default.join(target.packageDir, "Package.swift"));
|
|
26311
26412
|
for (const file of target.files) files.add(file);
|
|
26312
26413
|
}
|
|
26313
26414
|
for (const target of targets) {
|
|
@@ -26336,25 +26437,25 @@ function xcodeManifest(layout) {
|
|
|
26336
26437
|
].join("\n");
|
|
26337
26438
|
}
|
|
26338
26439
|
function packageFiles(root) {
|
|
26339
|
-
const canonicalRoot =
|
|
26440
|
+
const canonicalRoot = import_node_fs17.default.realpathSync(root);
|
|
26340
26441
|
const xcode = xcodeLayout(canonicalRoot);
|
|
26341
26442
|
return xcode ? xcode.files : sourceTreeFiles(canonicalRoot, canonicalRoot);
|
|
26342
26443
|
}
|
|
26343
26444
|
function sourceTreeFiles(dir, canonicalRoot) {
|
|
26344
26445
|
const found = [];
|
|
26345
26446
|
const walk2 = (dir2) => {
|
|
26346
|
-
for (const entry of
|
|
26447
|
+
for (const entry of import_node_fs17.default.readdirSync(dir2, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
|
|
26347
26448
|
if (entry.name.startsWith(".") && entry.name !== NATIVE_DESCRIPTOR && entry.name !== NATIVE_GLUE || SKIP_SOURCE_DIRS.has(entry.name))
|
|
26348
26449
|
continue;
|
|
26349
|
-
const full =
|
|
26450
|
+
const full = import_node_path18.default.join(dir2, entry.name);
|
|
26350
26451
|
if (entry.isSymbolicLink()) throw new Error(`swift input is a symlink: ${full}`);
|
|
26351
|
-
const real =
|
|
26352
|
-
const relative3 =
|
|
26353
|
-
if (relative3.startsWith(`..${
|
|
26452
|
+
const real = import_node_fs17.default.realpathSync(full);
|
|
26453
|
+
const relative3 = import_node_path18.default.relative(canonicalRoot, real);
|
|
26454
|
+
if (relative3.startsWith(`..${import_node_path18.default.sep}`) || relative3 === ".." || import_node_path18.default.isAbsolute(relative3)) {
|
|
26354
26455
|
throw new Error(`swift input escapes the selected package: ${full}`);
|
|
26355
26456
|
}
|
|
26356
26457
|
if (entry.isDirectory()) {
|
|
26357
|
-
if (
|
|
26458
|
+
if (import_node_fs17.default.existsSync(import_node_path18.default.join(full, "Package.swift"))) continue;
|
|
26358
26459
|
walk2(full);
|
|
26359
26460
|
} else if (entry.isFile()) {
|
|
26360
26461
|
found.push(full);
|
|
@@ -26362,29 +26463,29 @@ function sourceTreeFiles(dir, canonicalRoot) {
|
|
|
26362
26463
|
}
|
|
26363
26464
|
}
|
|
26364
26465
|
};
|
|
26365
|
-
if (
|
|
26466
|
+
if (import_node_fs17.default.existsSync(dir)) walk2(import_node_fs17.default.realpathSync(dir));
|
|
26366
26467
|
return found;
|
|
26367
26468
|
}
|
|
26368
26469
|
function readPackageFile(root, file, maxBytes) {
|
|
26369
|
-
const canonicalRoot =
|
|
26370
|
-
const relative3 =
|
|
26371
|
-
if (relative3 === ".." || relative3.startsWith(`..${
|
|
26470
|
+
const canonicalRoot = import_node_fs17.default.realpathSync(root);
|
|
26471
|
+
const relative3 = import_node_path18.default.relative(canonicalRoot, import_node_fs17.default.realpathSync(file));
|
|
26472
|
+
if (relative3 === ".." || relative3.startsWith(`..${import_node_path18.default.sep}`) || import_node_path18.default.isAbsolute(relative3)) {
|
|
26372
26473
|
throw new Error(`swift input escapes the selected package: ${file}`);
|
|
26373
26474
|
}
|
|
26374
|
-
let ancestor =
|
|
26475
|
+
let ancestor = import_node_path18.default.resolve(file);
|
|
26375
26476
|
while (ancestor !== canonicalRoot) {
|
|
26376
|
-
if (
|
|
26477
|
+
if (import_node_fs17.default.lstatSync(ancestor).isSymbolicLink()) {
|
|
26377
26478
|
throw new Error(`swift input is a symlink: ${ancestor}`);
|
|
26378
26479
|
}
|
|
26379
|
-
const parent =
|
|
26480
|
+
const parent = import_node_path18.default.dirname(ancestor);
|
|
26380
26481
|
if (parent === ancestor)
|
|
26381
26482
|
throw new Error(`swift input escapes the selected package: ${file}`);
|
|
26382
26483
|
ancestor = parent;
|
|
26383
26484
|
}
|
|
26384
|
-
const expected =
|
|
26385
|
-
const fd =
|
|
26485
|
+
const expected = import_node_fs17.default.statSync(file);
|
|
26486
|
+
const fd = import_node_fs17.default.openSync(file, import_node_fs17.default.constants.O_RDONLY | import_node_fs17.default.constants.O_NOFOLLOW);
|
|
26386
26487
|
try {
|
|
26387
|
-
const stat2 =
|
|
26488
|
+
const stat2 = import_node_fs17.default.fstatSync(fd);
|
|
26388
26489
|
if (stat2.dev !== expected.dev || stat2.ino !== expected.ino) {
|
|
26389
26490
|
throw new Error(`swift input changed while opening: ${file}`);
|
|
26390
26491
|
}
|
|
@@ -26394,16 +26495,16 @@ function readPackageFile(root, file, maxBytes) {
|
|
|
26394
26495
|
const bytes = Buffer.alloc(stat2.size + 1);
|
|
26395
26496
|
let offset = 0;
|
|
26396
26497
|
while (offset < bytes.length) {
|
|
26397
|
-
const count =
|
|
26498
|
+
const count = import_node_fs17.default.readSync(fd, bytes, offset, bytes.length - offset, null);
|
|
26398
26499
|
if (count === 0) break;
|
|
26399
26500
|
offset += count;
|
|
26400
26501
|
}
|
|
26401
|
-
if (offset !== stat2.size ||
|
|
26502
|
+
if (offset !== stat2.size || import_node_fs17.default.fstatSync(fd).size !== stat2.size) {
|
|
26402
26503
|
throw new Error(`swift input changed while reading: ${file}`);
|
|
26403
26504
|
}
|
|
26404
26505
|
return bytes.subarray(0, offset);
|
|
26405
26506
|
} finally {
|
|
26406
|
-
|
|
26507
|
+
import_node_fs17.default.closeSync(fd);
|
|
26407
26508
|
}
|
|
26408
26509
|
}
|
|
26409
26510
|
function sourceFiles(root) {
|
|
@@ -26411,14 +26512,14 @@ function sourceFiles(root) {
|
|
|
26411
26512
|
}
|
|
26412
26513
|
function resourceCandidateFiles(root) {
|
|
26413
26514
|
return packageFiles(root).filter(
|
|
26414
|
-
(file) => !file.endsWith(".swift") && !["project.pbxproj", "project.xcproj"].includes(
|
|
26515
|
+
(file) => !file.endsWith(".swift") && !["project.pbxproj", "project.xcproj"].includes(import_node_path18.default.basename(file))
|
|
26415
26516
|
);
|
|
26416
26517
|
}
|
|
26417
26518
|
function buildSwiftResourceTable(project, baseUrl) {
|
|
26418
26519
|
const limits = inputLimits(Boolean(project.hosted));
|
|
26419
26520
|
const absolute = resourceCandidateFiles(project.packagePath);
|
|
26420
26521
|
const relative3 = absolute.map(
|
|
26421
|
-
(file) =>
|
|
26522
|
+
(file) => import_node_path18.default.relative(project.packagePath, file).split(import_node_path18.default.sep).join(import_node_path18.default.posix.sep)
|
|
26422
26523
|
);
|
|
26423
26524
|
const byRelative = new Map(absolute.map((file, index) => [relative3[index], file]));
|
|
26424
26525
|
const readContents = (candidate) => {
|
|
@@ -26440,16 +26541,16 @@ function buildSwiftResourceTable(project, baseUrl) {
|
|
|
26440
26541
|
for (const { name: name2, file, scale } of found) {
|
|
26441
26542
|
const disk = byRelative.get(file);
|
|
26442
26543
|
if (!disk) continue;
|
|
26443
|
-
if (Object.keys(images).length >= limits.images || imageBytes +
|
|
26544
|
+
if (Object.keys(images).length >= limits.images || imageBytes + import_node_fs17.default.statSync(disk).size > limits.imageTotalBytes) {
|
|
26444
26545
|
throw new Error("swift image pack exceeds the compile service caps");
|
|
26445
26546
|
}
|
|
26446
26547
|
const bytes = readPackageFile(project.packagePath, disk, limits.imageBytes);
|
|
26447
26548
|
imageBytes += bytes.length;
|
|
26448
|
-
const hash = (0,
|
|
26449
|
-
const ext =
|
|
26549
|
+
const hash = (0, import_node_crypto7.createHash)("sha256").update(bytes).digest("hex").slice(0, 16);
|
|
26550
|
+
const ext = import_node_path18.default.posix.extname(file).toLowerCase();
|
|
26450
26551
|
table[name2] = { uri: `${baseUrl}${RESOURCE_PATH}${hash}${ext}`, scale };
|
|
26451
26552
|
images[name2] = {
|
|
26452
|
-
file:
|
|
26553
|
+
file: import_node_path18.default.posix.basename(file),
|
|
26453
26554
|
data: bytes.toString("base64")
|
|
26454
26555
|
};
|
|
26455
26556
|
watched.push(file);
|
|
@@ -26473,10 +26574,10 @@ function buildSwiftResourceTable(project, baseUrl) {
|
|
|
26473
26574
|
return { table, images, colors, symbols, watched };
|
|
26474
26575
|
}
|
|
26475
26576
|
function buildSwiftBundleFiles(packagePath, hosted) {
|
|
26476
|
-
packagePath =
|
|
26577
|
+
packagePath = import_node_fs17.default.realpathSync(packagePath);
|
|
26477
26578
|
const limits = inputLimits(hosted);
|
|
26478
26579
|
const relative3 = resourceCandidateFiles(packagePath).map(
|
|
26479
|
-
(file) =>
|
|
26580
|
+
(file) => import_node_path18.default.relative(packagePath, file).split(import_node_path18.default.sep).join(import_node_path18.default.posix.sep)
|
|
26480
26581
|
);
|
|
26481
26582
|
const files = {};
|
|
26482
26583
|
const watched = [];
|
|
@@ -26490,13 +26591,13 @@ function buildSwiftBundleFiles(packagePath, hosted) {
|
|
|
26490
26591
|
total += bytes.length;
|
|
26491
26592
|
if (xcode.app.infoPlistFile)
|
|
26492
26593
|
watched.push(
|
|
26493
|
-
|
|
26594
|
+
import_node_path18.default.relative(packagePath, xcode.app.infoPlistFile).split(import_node_path18.default.sep).join("/")
|
|
26494
26595
|
);
|
|
26495
26596
|
}
|
|
26496
26597
|
for (const { base, file } of enumerateBundleJson(relative3)) {
|
|
26497
26598
|
watched.push(file);
|
|
26498
|
-
const disk =
|
|
26499
|
-
if (Object.keys(files).length >= limits.resources || total +
|
|
26599
|
+
const disk = import_node_path18.default.join(packagePath, ...file.split("/"));
|
|
26600
|
+
if (Object.keys(files).length >= limits.resources || total + import_node_fs17.default.statSync(disk).size > limits.resourceTotalBytes) {
|
|
26500
26601
|
throw new Error(
|
|
26501
26602
|
`swift bundle pack exceeds ${limits.resources} files / ${limits.resourceTotalBytes} bytes`
|
|
26502
26603
|
);
|
|
@@ -26511,12 +26612,12 @@ function serveSwiftResource(project, key) {
|
|
|
26511
26612
|
return project.resourceFiles.get(key) ?? project.resourcesPrevious.get(key) ?? null;
|
|
26512
26613
|
}
|
|
26513
26614
|
function linkedModuleRoots(packagePath) {
|
|
26514
|
-
packagePath =
|
|
26615
|
+
packagePath = import_node_fs17.default.realpathSync(packagePath);
|
|
26515
26616
|
let manifest;
|
|
26516
26617
|
try {
|
|
26517
26618
|
manifest = readPackageFile(
|
|
26518
26619
|
packagePath,
|
|
26519
|
-
|
|
26620
|
+
import_node_path18.default.join(packagePath, "Package.swift"),
|
|
26520
26621
|
MAX_SWIFT_COMPILE_SOURCE_BYTES
|
|
26521
26622
|
).toString("utf8");
|
|
26522
26623
|
} catch {
|
|
@@ -26525,28 +26626,28 @@ function linkedModuleRoots(packagePath) {
|
|
|
26525
26626
|
const roots = /* @__PURE__ */ new Set();
|
|
26526
26627
|
const dependency = /\.package\(\s*path:\s*"([^"]+)"\s*\)/g;
|
|
26527
26628
|
for (const match of manifest.replace(/^\s*\/\/.*$/gm, "").matchAll(dependency)) {
|
|
26528
|
-
const root =
|
|
26529
|
-
if (
|
|
26629
|
+
const root = import_node_path18.default.resolve(packagePath, match[1]);
|
|
26630
|
+
if (import_node_fs17.default.existsSync(import_node_path18.default.join(root, "Package.swift"))) roots.add(root);
|
|
26530
26631
|
}
|
|
26531
26632
|
return [...roots].sort();
|
|
26532
26633
|
}
|
|
26533
26634
|
function sourceStamp(packagePath, moduleRootOverride, hosted = false) {
|
|
26534
|
-
const hash = (0,
|
|
26635
|
+
const hash = (0, import_node_crypto7.createHash)("sha256");
|
|
26535
26636
|
hash.update(packagePath);
|
|
26536
26637
|
const projectInputs = new Set(packageFiles(packagePath));
|
|
26537
26638
|
for (const file of [...projectInputs].sort()) {
|
|
26538
|
-
hash.update(
|
|
26539
|
-
const stat2 =
|
|
26639
|
+
hash.update(import_node_path18.default.relative(packagePath, file));
|
|
26640
|
+
const stat2 = import_node_fs17.default.statSync(file);
|
|
26540
26641
|
hash.update(`${stat2.mtimeMs}/${stat2.ctimeMs}/${stat2.size}`);
|
|
26541
26642
|
}
|
|
26542
26643
|
const moduleRoot = hosted ? void 0 : moduleRootOverride ?? linkedModuleRoots(packagePath).find(
|
|
26543
|
-
(root) =>
|
|
26644
|
+
(root) => import_node_fs17.default.existsSync(import_node_path18.default.join(root, "toolchain.json"))
|
|
26544
26645
|
);
|
|
26545
26646
|
if (moduleRoot) {
|
|
26546
26647
|
hash.update(moduleRoot);
|
|
26547
26648
|
for (const relative3 of swiftModuleInputFiles(moduleRoot)) {
|
|
26548
26649
|
hash.update(relative3);
|
|
26549
|
-
hash.update(String(
|
|
26650
|
+
hash.update(String(import_node_fs17.default.statSync(import_node_path18.default.join(moduleRoot, relative3)).mtimeMs));
|
|
26550
26651
|
}
|
|
26551
26652
|
}
|
|
26552
26653
|
return hash.digest("hex").slice(0, 16);
|
|
@@ -26558,8 +26659,8 @@ function packageSources(packagePath) {
|
|
|
26558
26659
|
const xcode = xcodeLayout(packagePath);
|
|
26559
26660
|
const files = {};
|
|
26560
26661
|
for (const file of sourceFiles(packagePath)) {
|
|
26561
|
-
const relative3 =
|
|
26562
|
-
if (xcode &&
|
|
26662
|
+
const relative3 = import_node_path18.default.relative(packagePath, file).split(import_node_path18.default.sep).join(import_node_path18.default.posix.sep);
|
|
26663
|
+
if (xcode && import_node_path18.default.basename(file) === "Package.swift") continue;
|
|
26563
26664
|
files[xcode ? xcodeInputKey(xcode, file, relative3) : relative3] = readPackageFile(
|
|
26564
26665
|
packagePath,
|
|
26565
26666
|
file,
|
|
@@ -26576,7 +26677,7 @@ function packageSnapshot(project) {
|
|
|
26576
26677
|
files,
|
|
26577
26678
|
resourcePaths: swiftImplicitResourcePaths(
|
|
26578
26679
|
resourceCandidateFiles(project.packagePath).map(
|
|
26579
|
-
(file) =>
|
|
26680
|
+
(file) => import_node_path18.default.relative(project.packagePath, file).split(import_node_path18.default.sep).join(import_node_path18.default.posix.sep)
|
|
26580
26681
|
)
|
|
26581
26682
|
),
|
|
26582
26683
|
resources: buildSwiftResourceTable(project, ""),
|
|
@@ -26585,7 +26686,7 @@ function packageSnapshot(project) {
|
|
|
26585
26686
|
...native ? {
|
|
26586
26687
|
glue: readPackageFile(
|
|
26587
26688
|
project.packagePath,
|
|
26588
|
-
|
|
26689
|
+
import_node_path18.default.join(project.packagePath, NATIVE_GLUE),
|
|
26589
26690
|
MAX_SWIFT_COMPILE_SOURCE_BYTES
|
|
26590
26691
|
).toString("utf8")
|
|
26591
26692
|
} : {}
|
|
@@ -26621,7 +26722,7 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
|
|
|
26621
26722
|
package: content
|
|
26622
26723
|
};
|
|
26623
26724
|
const moduleRoot = moduleRootOverride ?? linkedModuleRoots(packagePath).find(
|
|
26624
|
-
(root) =>
|
|
26725
|
+
(root) => import_node_fs17.default.existsSync(import_node_path18.default.join(root, "toolchain.json"))
|
|
26625
26726
|
) ?? await swiftDistributionRoot();
|
|
26626
26727
|
if (!moduleRoot)
|
|
26627
26728
|
return {
|
|
@@ -26640,17 +26741,17 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
|
|
|
26640
26741
|
...targets.length > 0 ? targets : ["App"]
|
|
26641
26742
|
])
|
|
26642
26743
|
);
|
|
26643
|
-
if (missing.size > 0) throw new Error(missingModulesMessage(packagePath, missing));
|
|
26744
|
+
if (missing.size > 0) throw new Error(await missingModulesMessage(packagePath, missing));
|
|
26644
26745
|
const artifact = await compileSwiftProjectUnit(input, {
|
|
26645
26746
|
// the compile rewrites Sources/App in its root before swiftpm builds, and
|
|
26646
26747
|
// its lock orders one process only: two vites on one root (a lane's dev
|
|
26647
26748
|
// server and a capture, or two checkouts) build each other's sources. so
|
|
26648
26749
|
// each app and module checkout gets its own root, which keeps the same
|
|
26649
26750
|
// app's incremental build across restarts.
|
|
26650
|
-
buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ??
|
|
26651
|
-
|
|
26751
|
+
buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ?? import_node_path18.default.join(
|
|
26752
|
+
import_node_os7.default.tmpdir(),
|
|
26652
26753
|
"contrast-swift-build",
|
|
26653
|
-
(0,
|
|
26754
|
+
(0, import_node_crypto7.createHash)("sha256").update(`${moduleRoot}\0${import_node_path18.default.resolve(packagePath)}`).digest("hex").slice(0, 16)
|
|
26654
26755
|
),
|
|
26655
26756
|
moduleRoot,
|
|
26656
26757
|
...toolchain
|
|
@@ -26699,7 +26800,7 @@ function swiftApiGapReport(output) {
|
|
|
26699
26800
|
...other.size > 0 ? ["other errors, often caused by the ones above:", ...rows(other)] : []
|
|
26700
26801
|
].join("\n");
|
|
26701
26802
|
}
|
|
26702
|
-
function missingModulesMessage(packagePath, missing) {
|
|
26803
|
+
async function missingModulesMessage(packagePath, missing) {
|
|
26703
26804
|
const layout = xcodeLayout(packagePath);
|
|
26704
26805
|
const gaps = new Map([
|
|
26705
26806
|
...(layout?.app.binaryFrameworks ?? []).map(
|
|
@@ -26721,12 +26822,29 @@ function missingModulesMessage(packagePath, missing) {
|
|
|
26721
26822
|
...layout?.packages.modules ?? [],
|
|
26722
26823
|
...layout?.packages.unavailable ?? []
|
|
26723
26824
|
]);
|
|
26825
|
+
const packaged = new Set(
|
|
26826
|
+
[...missing.keys()].filter(
|
|
26827
|
+
(name2) => !UNPROVIDED_PLATFORM_MODULES[name2] && !IOS_SDK_FRAMEWORKS.has(name2)
|
|
26828
|
+
)
|
|
26829
|
+
);
|
|
26830
|
+
if (packaged.size > 0)
|
|
26831
|
+
await Promise.all(
|
|
26832
|
+
(layout?.packages.binaries ?? []).map(async (binary) => {
|
|
26833
|
+
const modules = await swiftBinaryModules(binary).catch(() => []);
|
|
26834
|
+
for (const name2 of modules)
|
|
26835
|
+
if (packaged.has(name2))
|
|
26836
|
+
gaps.set(name2, {
|
|
26837
|
+
source: binary.source,
|
|
26838
|
+
reason: `${binary.target} is a binary framework`
|
|
26839
|
+
});
|
|
26840
|
+
})
|
|
26841
|
+
);
|
|
26724
26842
|
const width = Math.max(...[...missing.keys()].map((name2) => name2.length));
|
|
26725
26843
|
return [
|
|
26726
26844
|
`Peach does not provide ${missing.size} module${missing.size === 1 ? "" : "s"} this app imports:`,
|
|
26727
26845
|
...[...missing].map(([name2, files]) => {
|
|
26728
26846
|
const gap = gaps.get(name2);
|
|
26729
|
-
return ` ${name2.padEnd(width)} ${files.length} file${files.length === 1 ? "" : "s"}${gap ? `, ${gap.source.includes("://") ? `package ${gap.source}` : gap.source.startsWith("/") ? `package ${
|
|
26847
|
+
return ` ${name2.padEnd(width)} ${files.length} file${files.length === 1 ? "" : "s"}${gap ? `, ${gap.source.includes("://") ? `package ${gap.source}` : gap.source.startsWith("/") ? `package ${import_node_path18.default.relative(packagePath, gap.source) || "."}` : gap.source} (${gap.reason})` : ""}`;
|
|
26730
26848
|
})
|
|
26731
26849
|
].join("\n");
|
|
26732
26850
|
}
|
|
@@ -26734,7 +26852,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
|
|
|
26734
26852
|
const auth = hosted ? null : resolveCliAuth();
|
|
26735
26853
|
if (!hosted && (!auth || auth.kind === "github")) {
|
|
26736
26854
|
throw new Error(
|
|
26737
|
-
`compiling ${
|
|
26855
|
+
`compiling ${import_node_path18.default.basename(packagePath)} for Peach needs \`peach login\` or PEACH_API_KEY: this peachsim has no local SwiftUI module, so Contrast compiles it`
|
|
26738
26856
|
);
|
|
26739
26857
|
}
|
|
26740
26858
|
const origin = hosted?.origin ?? resolveContrastBackendOrigin(auth?.kind === "session" ? auth.origin : null);
|
|
@@ -26753,7 +26871,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
|
|
|
26753
26871
|
const bytes = sources.reduce((total2, text2) => total2 + Buffer.byteLength(text2), 0);
|
|
26754
26872
|
if (sources.length > MAX_SWIFT_COMPILE_FILES || bytes > MAX_SWIFT_COMPILE_SOURCE_BYTES) {
|
|
26755
26873
|
throw new Error(
|
|
26756
|
-
`${
|
|
26874
|
+
`${import_node_path18.default.basename(packagePath)} has ${sources.length} Swift files (${bytes} bytes), over Contrast's compile limits of ${MAX_SWIFT_COMPILE_FILES} files and ${MAX_SWIFT_COMPILE_SOURCE_BYTES} bytes; compile it on this machine with the Swift distribution instead`
|
|
26757
26875
|
);
|
|
26758
26876
|
}
|
|
26759
26877
|
const descriptor = snapshot.native;
|
|
@@ -26772,7 +26890,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
|
|
|
26772
26890
|
);
|
|
26773
26891
|
if (descriptor && address.native?.hash !== descriptor.hash) {
|
|
26774
26892
|
throw new Error(
|
|
26775
|
-
`${
|
|
26893
|
+
`${import_node_path18.default.basename(packagePath)}: Contrast compiled native contract ${address.native?.hash ?? "none"} but one typegen wrote ${descriptor.hash}; the app's One and the compile host's differ, or the compile host is older than this peachsim`
|
|
26776
26894
|
);
|
|
26777
26895
|
}
|
|
26778
26896
|
const response = await fetch(address.url, { signal });
|
|
@@ -26889,18 +27007,19 @@ function serveSwiftPackageAsset(pathname, res) {
|
|
|
26889
27007
|
res.end("swift artifact is stale");
|
|
26890
27008
|
return true;
|
|
26891
27009
|
}
|
|
26892
|
-
var
|
|
27010
|
+
var import_node_crypto7, import_node_fs17, import_node_os7, import_node_path18, ARTIFACT_PATH, RESOURCE_PATH, ICU_PATH, SKIP_SOURCE_DIRS, NATIVE_DESCRIPTOR, NATIVE_GLUE, projects, xcodeProjects, XCODE_APP_DIR, XCODE_FRAMEWORKS_DIR, XCODE_PACKAGES_DIR, CHECKOUTS_PREFIX, HOSTED_LIMITS, LOCAL_LIMITS, inputLimits, RESOURCE_CONTENT_TYPES, API_GAP_PATTERNS, UNPROVIDED_PLATFORM_MODULES, IOS_SDK_FRAMEWORKS;
|
|
26893
27011
|
var init_swift_host = __esm({
|
|
26894
27012
|
"src/swift-host.ts"() {
|
|
26895
27013
|
"use strict";
|
|
26896
|
-
|
|
26897
|
-
|
|
26898
|
-
|
|
26899
|
-
|
|
27014
|
+
import_node_crypto7 = require("node:crypto");
|
|
27015
|
+
import_node_fs17 = __toESM(require("node:fs"), 1);
|
|
27016
|
+
import_node_os7 = __toESM(require("node:os"), 1);
|
|
27017
|
+
import_node_path18 = __toESM(require("node:path"), 1);
|
|
26900
27018
|
init_bundleAssets();
|
|
26901
27019
|
init_auth();
|
|
26902
27020
|
init_backend_origin();
|
|
26903
27021
|
init_ios_sdk_frameworks();
|
|
27022
|
+
init_swift_binary_modules();
|
|
26904
27023
|
init_swift_compile();
|
|
26905
27024
|
init_swift_distribution();
|
|
26906
27025
|
init_swift_package();
|
|
@@ -26925,7 +27044,7 @@ var init_swift_host = __esm({
|
|
|
26925
27044
|
XCODE_APP_DIR = "__app__";
|
|
26926
27045
|
XCODE_FRAMEWORKS_DIR = "__frameworks__";
|
|
26927
27046
|
XCODE_PACKAGES_DIR = "__packages__";
|
|
26928
|
-
CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(
|
|
27047
|
+
CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(import_node_path18.default.sep).join(import_node_path18.default.posix.sep)}/`;
|
|
26929
27048
|
HOSTED_LIMITS = {
|
|
26930
27049
|
resources: MAX_SWIFT_COMPILE_RESOURCES,
|
|
26931
27050
|
resourceBytes: MAX_SWIFT_COMPILE_RESOURCE_BYTES,
|
|
@@ -26977,8 +27096,8 @@ var init_swift_host = __esm({
|
|
|
26977
27096
|
|
|
26978
27097
|
// src/expo-swift-host.ts
|
|
26979
27098
|
async function collectExpoSwiftSources(appRoot) {
|
|
26980
|
-
appRoot =
|
|
26981
|
-
const appRequire = (0, import_node_module.createRequire)(
|
|
27099
|
+
appRoot = import_node_fs18.default.realpathSync(appRoot);
|
|
27100
|
+
const appRequire = (0, import_node_module.createRequire)(import_node_path19.default.join(appRoot, "package.json"));
|
|
26982
27101
|
let autolinker;
|
|
26983
27102
|
try {
|
|
26984
27103
|
autolinker = appRequire.resolve("expo-modules-autolinking/package.json");
|
|
@@ -26992,7 +27111,7 @@ async function collectExpoSwiftSources(appRoot) {
|
|
|
26992
27111
|
(command) => run3(
|
|
26993
27112
|
process.execPath,
|
|
26994
27113
|
[
|
|
26995
|
-
|
|
27114
|
+
import_node_path19.default.join(import_node_path19.default.dirname(autolinker), "bin/expo-modules-autolinking.js"),
|
|
26996
27115
|
command,
|
|
26997
27116
|
"--platform",
|
|
26998
27117
|
"apple",
|
|
@@ -27023,8 +27142,8 @@ async function collectExpoSwiftSources(appRoot) {
|
|
|
27023
27142
|
const sourceRoot = Reflect.get(entry, "path");
|
|
27024
27143
|
if (typeof sourceRoot !== "string")
|
|
27025
27144
|
throw new Error("Expo autolinking entry has no path");
|
|
27026
|
-
const canonical =
|
|
27027
|
-
if (canonical.split(
|
|
27145
|
+
const canonical = import_node_fs18.default.realpathSync(sourceRoot);
|
|
27146
|
+
if (canonical.split(import_node_path19.default.sep).includes("node_modules")) continue;
|
|
27028
27147
|
const resolution = resolutions.find(
|
|
27029
27148
|
(candidate) => candidate && typeof candidate === "object" && Reflect.get(candidate, "packageName") === Reflect.get(entry, "name")
|
|
27030
27149
|
);
|
|
@@ -27050,12 +27169,12 @@ async function collectExpoSwiftSources(appRoot) {
|
|
|
27050
27169
|
`(${className.includes(".") ? className : `${namespace}.${className}`}.self, ${name2 === null ? "nil" : JSON.stringify(name2)})`
|
|
27051
27170
|
);
|
|
27052
27171
|
}
|
|
27053
|
-
const ios =
|
|
27054
|
-
if (
|
|
27172
|
+
const ios = import_node_path19.default.join(canonical, "ios");
|
|
27173
|
+
if (import_node_fs18.default.lstatSync(ios).isSymbolicLink())
|
|
27055
27174
|
throw new Error(`Expo Swift source directory is a symlink: ${ios}`);
|
|
27056
27175
|
const walk2 = (dir) => {
|
|
27057
|
-
for (const child of
|
|
27058
|
-
const file =
|
|
27176
|
+
for (const child of import_node_fs18.default.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
27177
|
+
const file = import_node_path19.default.join(dir, child.name);
|
|
27059
27178
|
if (child.isSymbolicLink())
|
|
27060
27179
|
throw new Error(`Expo Swift source is a symlink: ${file}`);
|
|
27061
27180
|
if (child.isDirectory()) {
|
|
@@ -27063,13 +27182,13 @@ async function collectExpoSwiftSources(appRoot) {
|
|
|
27063
27182
|
continue;
|
|
27064
27183
|
}
|
|
27065
27184
|
if (!child.name.endsWith(".swift")) continue;
|
|
27066
|
-
const size =
|
|
27185
|
+
const size = import_node_fs18.default.statSync(file).size;
|
|
27067
27186
|
bytes += size;
|
|
27068
27187
|
fileCount++;
|
|
27069
27188
|
if (fileCount > MAX_SWIFT_COMPILE_FILES - 2 || bytes > MAX_SWIFT_COMPILE_SOURCE_BYTES)
|
|
27070
27189
|
throw new Error("Expo Swift sources exceed compile service caps");
|
|
27071
|
-
files[`Sources/${namespace}/${
|
|
27072
|
-
${
|
|
27190
|
+
files[`Sources/${namespace}/${import_node_path19.default.relative(ios, file).split(import_node_path19.default.sep).join("/")}`] = `#sourceLocation(file: ${JSON.stringify(file)}, line: 1)
|
|
27191
|
+
${import_node_fs18.default.readFileSync(file, "utf8")}`;
|
|
27073
27192
|
}
|
|
27074
27193
|
};
|
|
27075
27194
|
walk2(ios);
|
|
@@ -27152,7 +27271,7 @@ async function handleExpoSwiftRequest(req, res) {
|
|
|
27152
27271
|
return true;
|
|
27153
27272
|
}
|
|
27154
27273
|
const root = url.searchParams.get("root");
|
|
27155
|
-
if (!root || !
|
|
27274
|
+
if (!root || !import_node_path19.default.isAbsolute(root)) {
|
|
27156
27275
|
res.writeHead(400);
|
|
27157
27276
|
res.end("missing absolute app root");
|
|
27158
27277
|
return true;
|
|
@@ -27169,7 +27288,7 @@ async function handleExpoSwiftRequest(req, res) {
|
|
|
27169
27288
|
modules: [],
|
|
27170
27289
|
failures: []
|
|
27171
27290
|
};
|
|
27172
|
-
const key = (0,
|
|
27291
|
+
const key = (0, import_node_crypto8.createHash)("sha256").update(import_node_fs18.default.realpathSync(root)).digest("hex");
|
|
27173
27292
|
const host2 = req.headers.host;
|
|
27174
27293
|
if (!host2) throw new Error("Expo Swift request has no host");
|
|
27175
27294
|
const base = `http://${host2}`;
|
|
@@ -27183,8 +27302,8 @@ async function handleExpoSwiftRequest(req, res) {
|
|
|
27183
27302
|
continue;
|
|
27184
27303
|
}
|
|
27185
27304
|
try {
|
|
27186
|
-
const packagePath =
|
|
27187
|
-
|
|
27305
|
+
const packagePath = import_node_path19.default.join(
|
|
27306
|
+
import_node_os8.default.tmpdir(),
|
|
27188
27307
|
"peach-expo-swift",
|
|
27189
27308
|
key,
|
|
27190
27309
|
unit.namespace
|
|
@@ -27193,7 +27312,7 @@ async function handleExpoSwiftRequest(req, res) {
|
|
|
27193
27312
|
packagePath,
|
|
27194
27313
|
new Map(
|
|
27195
27314
|
Object.entries(unit.files).map(([name2, source]) => [
|
|
27196
|
-
|
|
27315
|
+
import_node_path19.default.join(packagePath, name2),
|
|
27197
27316
|
source
|
|
27198
27317
|
])
|
|
27199
27318
|
)
|
|
@@ -27244,8 +27363,8 @@ async function handleExpoSwiftRequest(req, res) {
|
|
|
27244
27363
|
import PackageDescription
|
|
27245
27364
|
let package = Package(name: "PeachExpo", targets: [${targets.map((name2) => `.target(name: ${JSON.stringify(name2)}, path: ${JSON.stringify(`Sources/${name2}`)})`).join(", ")}, .executableTarget(name: "PeachExpoApp", path: "Sources/PeachExpoApp")])
|
|
27246
27365
|
`;
|
|
27247
|
-
const packagePath =
|
|
27248
|
-
|
|
27366
|
+
const packagePath = import_node_path19.default.join(
|
|
27367
|
+
import_node_os8.default.tmpdir(),
|
|
27249
27368
|
"peach-expo-swift",
|
|
27250
27369
|
key,
|
|
27251
27370
|
"linked-app"
|
|
@@ -27254,7 +27373,7 @@ let package = Package(name: "PeachExpo", targets: [${targets.map((name2) => `.ta
|
|
|
27254
27373
|
packagePath,
|
|
27255
27374
|
new Map(
|
|
27256
27375
|
Object.entries(files).map(([name2, source]) => [
|
|
27257
|
-
|
|
27376
|
+
import_node_path19.default.join(packagePath, name2),
|
|
27258
27377
|
source
|
|
27259
27378
|
])
|
|
27260
27379
|
)
|
|
@@ -27290,16 +27409,16 @@ let package = Package(name: "PeachExpo", targets: [${targets.map((name2) => `.ta
|
|
|
27290
27409
|
}
|
|
27291
27410
|
return true;
|
|
27292
27411
|
}
|
|
27293
|
-
var import_node_child_process9,
|
|
27412
|
+
var import_node_child_process9, import_node_crypto8, import_node_fs18, import_node_module, import_node_os8, import_node_path19, import_node_util3, run3, scriptEnv, EXPO_SWIFT_ROUTE, EXPO_SWIFT_ENTRY, compiling, failedCompilations;
|
|
27294
27413
|
var init_expo_swift_host = __esm({
|
|
27295
27414
|
"src/expo-swift-host.ts"() {
|
|
27296
27415
|
"use strict";
|
|
27297
27416
|
import_node_child_process9 = require("node:child_process");
|
|
27298
|
-
|
|
27299
|
-
|
|
27417
|
+
import_node_crypto8 = require("node:crypto");
|
|
27418
|
+
import_node_fs18 = __toESM(require("node:fs"), 1);
|
|
27300
27419
|
import_node_module = require("node:module");
|
|
27301
|
-
|
|
27302
|
-
|
|
27420
|
+
import_node_os8 = __toESM(require("node:os"), 1);
|
|
27421
|
+
import_node_path19 = __toESM(require("node:path"), 1);
|
|
27303
27422
|
import_node_util3 = require("node:util");
|
|
27304
27423
|
init_internal_child();
|
|
27305
27424
|
init_backend_origin();
|
|
@@ -27389,10 +27508,10 @@ function resolveRuntimeRootForHostname(hostname) {
|
|
|
27389
27508
|
}
|
|
27390
27509
|
function sendFileWithRanges(req, res, filePath, total, headers) {
|
|
27391
27510
|
const head = (req?.method || "GET").toUpperCase() === "HEAD";
|
|
27392
|
-
const
|
|
27393
|
-
const invalid =
|
|
27394
|
-
if (
|
|
27395
|
-
const [, startRaw, endRaw] =
|
|
27511
|
+
const range2 = /^bytes=(\d*)-(\d*)$/.exec(req?.headers?.range || "");
|
|
27512
|
+
const invalid = range2 && range2[1] && range2[2] && Number(range2[2]) < Number(range2[1]);
|
|
27513
|
+
if (range2 && (range2[1] || range2[2]) && !invalid) {
|
|
27514
|
+
const [, startRaw, endRaw] = range2;
|
|
27396
27515
|
const start = startRaw ? Number(startRaw) : Math.max(0, total - Number(endRaw));
|
|
27397
27516
|
const end = startRaw && endRaw ? Math.min(Number(endRaw), total - 1) : total - 1;
|
|
27398
27517
|
if (start > end || start >= total) {
|
|
@@ -27483,14 +27602,14 @@ var init_standalone = __esm({
|
|
|
27483
27602
|
// cli/self-invocation.ts
|
|
27484
27603
|
function sourceEntryPath() {
|
|
27485
27604
|
try {
|
|
27486
|
-
const candidate = (0,
|
|
27487
|
-
return (0,
|
|
27605
|
+
const candidate = (0, import_node_path20.join)((0, import_node_path20.dirname)((0, import_node_url3.fileURLToPath)(__sootsim_import_meta_url)), "bin.ts");
|
|
27606
|
+
return (0, import_node_fs19.existsSync)(candidate) ? candidate : null;
|
|
27488
27607
|
} catch {
|
|
27489
27608
|
return null;
|
|
27490
27609
|
}
|
|
27491
27610
|
}
|
|
27492
|
-
function isCliEntry(
|
|
27493
|
-
const name2 = (0,
|
|
27611
|
+
function isCliEntry(path36) {
|
|
27612
|
+
const name2 = (0, import_node_path20.basename)(path36);
|
|
27494
27613
|
return name2 === "bin.ts" || name2 === "bin.js";
|
|
27495
27614
|
}
|
|
27496
27615
|
function rnxSelfInvocation() {
|
|
@@ -27508,12 +27627,12 @@ function rnxSelfInvocation() {
|
|
|
27508
27627
|
}
|
|
27509
27628
|
return { executable: process.execPath, prefixArgs: [entry] };
|
|
27510
27629
|
}
|
|
27511
|
-
var
|
|
27630
|
+
var import_node_fs19, import_node_path20, import_node_url3;
|
|
27512
27631
|
var init_self_invocation = __esm({
|
|
27513
27632
|
"cli/self-invocation.ts"() {
|
|
27514
27633
|
"use strict";
|
|
27515
|
-
|
|
27516
|
-
|
|
27634
|
+
import_node_fs19 = require("node:fs");
|
|
27635
|
+
import_node_path20 = require("node:path");
|
|
27517
27636
|
import_node_url3 = require("node:url");
|
|
27518
27637
|
init_public_brand();
|
|
27519
27638
|
init_standalone();
|
|
@@ -27581,7 +27700,7 @@ function getUserDataDir() {
|
|
|
27581
27700
|
return userDataDir();
|
|
27582
27701
|
}
|
|
27583
27702
|
function storeFile() {
|
|
27584
|
-
return
|
|
27703
|
+
return import_node_path21.default.join(userDataDir(), "attached-projects.json");
|
|
27585
27704
|
}
|
|
27586
27705
|
function cloneEmpty() {
|
|
27587
27706
|
return {
|
|
@@ -27595,7 +27714,7 @@ function loadStore() {
|
|
|
27595
27714
|
const file = storeFile();
|
|
27596
27715
|
let raw2;
|
|
27597
27716
|
try {
|
|
27598
|
-
raw2 =
|
|
27717
|
+
raw2 = import_node_fs20.default.readFileSync(file, "utf8");
|
|
27599
27718
|
} catch (err) {
|
|
27600
27719
|
if (err.code === "ENOENT") return cloneEmpty();
|
|
27601
27720
|
throw err;
|
|
@@ -27612,7 +27731,7 @@ function loadStore() {
|
|
|
27612
27731
|
} catch (err) {
|
|
27613
27732
|
const quarantine = `${file}.corrupt-${Date.now()}`;
|
|
27614
27733
|
try {
|
|
27615
|
-
|
|
27734
|
+
import_node_fs20.default.renameSync(file, quarantine);
|
|
27616
27735
|
console.warn(
|
|
27617
27736
|
`[sootsim] attached-projects.json was unparseable; quarantined to ${quarantine}. original error: ${err.message}`
|
|
27618
27737
|
);
|
|
@@ -27623,16 +27742,16 @@ function loadStore() {
|
|
|
27623
27742
|
}
|
|
27624
27743
|
function writeStore(store) {
|
|
27625
27744
|
const file = storeFile();
|
|
27626
|
-
|
|
27745
|
+
import_node_fs20.default.mkdirSync(import_node_path21.default.dirname(file), { recursive: true });
|
|
27627
27746
|
const tmp = `${file}.tmp-${process.pid}-${Date.now()}`;
|
|
27628
|
-
const fd =
|
|
27747
|
+
const fd = import_node_fs20.default.openSync(tmp, "w", 384);
|
|
27629
27748
|
try {
|
|
27630
|
-
|
|
27631
|
-
|
|
27749
|
+
import_node_fs20.default.writeFileSync(fd, JSON.stringify(store, null, 2));
|
|
27750
|
+
import_node_fs20.default.fsyncSync(fd);
|
|
27632
27751
|
} finally {
|
|
27633
|
-
|
|
27752
|
+
import_node_fs20.default.closeSync(fd);
|
|
27634
27753
|
}
|
|
27635
|
-
|
|
27754
|
+
import_node_fs20.default.renameSync(tmp, file);
|
|
27636
27755
|
}
|
|
27637
27756
|
function mutateStore(fn) {
|
|
27638
27757
|
const store = loadStore();
|
|
@@ -27641,13 +27760,13 @@ function mutateStore(fn) {
|
|
|
27641
27760
|
return store;
|
|
27642
27761
|
}
|
|
27643
27762
|
function projectIdForCwd(cwd) {
|
|
27644
|
-
return (0,
|
|
27763
|
+
return (0, import_node_crypto9.createHash)("sha256").update(import_node_path21.default.resolve(cwd)).digest("hex").slice(0, 16);
|
|
27645
27764
|
}
|
|
27646
27765
|
function newSessionId() {
|
|
27647
|
-
return `s_${(0,
|
|
27766
|
+
return `s_${(0, import_node_crypto9.randomBytes)(10).toString("hex")}`;
|
|
27648
27767
|
}
|
|
27649
27768
|
function upsertProject(input) {
|
|
27650
|
-
const cwd =
|
|
27769
|
+
const cwd = import_node_path21.default.resolve(input.cwd);
|
|
27651
27770
|
const id = projectIdForCwd(cwd);
|
|
27652
27771
|
let result;
|
|
27653
27772
|
mutateStore((store) => {
|
|
@@ -27673,7 +27792,7 @@ function upsertProject(input) {
|
|
|
27673
27792
|
const now = Date.now();
|
|
27674
27793
|
const created = {
|
|
27675
27794
|
id,
|
|
27676
|
-
name: input.name ??
|
|
27795
|
+
name: input.name ?? import_node_path21.default.basename(cwd),
|
|
27677
27796
|
cwd,
|
|
27678
27797
|
repoRoot: input.repoRoot,
|
|
27679
27798
|
sourceRoots: input.sourceRoots ?? [cwd],
|
|
@@ -27818,8 +27937,8 @@ async function seedFromDemoAppRegistry() {
|
|
|
27818
27937
|
if (apps.length === 0) return;
|
|
27819
27938
|
mutateStore((store) => {
|
|
27820
27939
|
for (const app of apps) {
|
|
27821
|
-
if (!
|
|
27822
|
-
const cwd =
|
|
27940
|
+
if (!import_node_fs20.default.existsSync(app.dir)) continue;
|
|
27941
|
+
const cwd = import_node_path21.default.resolve(app.dir);
|
|
27823
27942
|
const id = projectIdForCwd(cwd);
|
|
27824
27943
|
if (store.attachedProjects.some((p) => p.id === id)) continue;
|
|
27825
27944
|
const now = Date.now();
|
|
@@ -27840,13 +27959,13 @@ async function seedFromDemoAppRegistry() {
|
|
|
27840
27959
|
}
|
|
27841
27960
|
});
|
|
27842
27961
|
}
|
|
27843
|
-
var
|
|
27962
|
+
var import_node_crypto9, import_node_fs20, import_node_path21, overrideDir, COST_HISTORY_MAX_AGE_MS;
|
|
27844
27963
|
var init_attached_projects = __esm({
|
|
27845
27964
|
"src/attached-projects.ts"() {
|
|
27846
27965
|
"use strict";
|
|
27847
|
-
|
|
27848
|
-
|
|
27849
|
-
|
|
27966
|
+
import_node_crypto9 = require("node:crypto");
|
|
27967
|
+
import_node_fs20 = __toESM(require("node:fs"), 1);
|
|
27968
|
+
import_node_path21 = __toESM(require("node:path"), 1);
|
|
27850
27969
|
init_home_paths();
|
|
27851
27970
|
overrideDir = null;
|
|
27852
27971
|
COST_HISTORY_MAX_AGE_MS = 14 * 24 * 60 * 60 * 1e3;
|
|
@@ -27855,16 +27974,16 @@ var init_attached_projects = __esm({
|
|
|
27855
27974
|
|
|
27856
27975
|
// src/agent-sessions.ts
|
|
27857
27976
|
function sessionDir(sessionId) {
|
|
27858
|
-
return
|
|
27977
|
+
return import_node_path22.default.join(getUserDataDir(), "sessions", sessionId);
|
|
27859
27978
|
}
|
|
27860
27979
|
function promptFifoPath(sessionId) {
|
|
27861
|
-
return
|
|
27980
|
+
return import_node_path22.default.join(sessionDir(sessionId), "prompt.in");
|
|
27862
27981
|
}
|
|
27863
27982
|
function eventsFifoPath(sessionId) {
|
|
27864
|
-
return
|
|
27983
|
+
return import_node_path22.default.join(sessionDir(sessionId), "events.out");
|
|
27865
27984
|
}
|
|
27866
27985
|
function transcriptPath(sessionId) {
|
|
27867
|
-
return
|
|
27986
|
+
return import_node_path22.default.join(getUserDataDir(), "transcripts", `${sessionId}.log`);
|
|
27868
27987
|
}
|
|
27869
27988
|
function pidIsAlive(pid, sessionId) {
|
|
27870
27989
|
if (!pid) return false;
|
|
@@ -27874,7 +27993,7 @@ function pidIsAlive(pid, sessionId) {
|
|
|
27874
27993
|
return false;
|
|
27875
27994
|
}
|
|
27876
27995
|
if (sessionId) {
|
|
27877
|
-
if (!
|
|
27996
|
+
if (!import_node_fs21.default.existsSync(sessionDir(sessionId))) return false;
|
|
27878
27997
|
}
|
|
27879
27998
|
return true;
|
|
27880
27999
|
}
|
|
@@ -27887,11 +28006,11 @@ function resolveSootsimInvocation() {
|
|
|
27887
28006
|
const resourcesPath = process.resourcesPath;
|
|
27888
28007
|
if (resourcesPath) {
|
|
27889
28008
|
const candidates = [
|
|
27890
|
-
|
|
27891
|
-
|
|
28009
|
+
import_node_path22.default.join(resourcesPath, "bin", "sootsim"),
|
|
28010
|
+
import_node_path22.default.join(resourcesPath, "bin", `sootsim-${process.platform}-${process.arch}`)
|
|
27892
28011
|
];
|
|
27893
28012
|
for (const c of candidates) {
|
|
27894
|
-
if (
|
|
28013
|
+
if (import_node_fs21.default.existsSync(c)) return { executable: c, prefixArgs: [] };
|
|
27895
28014
|
}
|
|
27896
28015
|
}
|
|
27897
28016
|
}
|
|
@@ -27910,15 +28029,15 @@ function tryWorkspaceSootsim() {
|
|
|
27910
28029
|
const sootsimDir = resolveSootsimPackageDir();
|
|
27911
28030
|
if (!sootsimDir) return null;
|
|
27912
28031
|
const binaryName = `peach-${process.platform === "win32" ? "windows" : process.platform}-${process.arch}${process.platform === "win32" ? ".exe" : ""}`;
|
|
27913
|
-
const distBinary =
|
|
27914
|
-
if (
|
|
27915
|
-
const distBin =
|
|
27916
|
-
if (
|
|
28032
|
+
const distBinary = import_node_path22.default.join(sootsimDir, "dist-bin", binaryName);
|
|
28033
|
+
if (import_node_fs21.default.existsSync(distBinary)) return { executable: distBinary, prefixArgs: [] };
|
|
28034
|
+
const distBin = import_node_path22.default.join(sootsimDir, "dist-cli", "bin.js");
|
|
28035
|
+
if (import_node_fs21.default.existsSync(distBin)) {
|
|
27917
28036
|
try {
|
|
27918
|
-
const src =
|
|
27919
|
-
if (
|
|
27920
|
-
const srcMtime =
|
|
27921
|
-
const buildMtime =
|
|
28037
|
+
const src = import_node_path22.default.join(sootsimDir, "cli", "commands", "agent-wrapper.ts");
|
|
28038
|
+
if (import_node_fs21.default.existsSync(src)) {
|
|
28039
|
+
const srcMtime = import_node_fs21.default.statSync(src).mtimeMs;
|
|
28040
|
+
const buildMtime = import_node_fs21.default.statSync(distBin).mtimeMs;
|
|
27922
28041
|
if (buildMtime < srcMtime) {
|
|
27923
28042
|
console.warn(
|
|
27924
28043
|
`[peach] dist-cli/bin.js is older than agent-wrapper.ts \u2014 rebuild with \`bun run --cwd packages/peachsim build:cli\`.`
|
|
@@ -27937,22 +28056,22 @@ function tryWorkspaceSootsim() {
|
|
|
27937
28056
|
function resolveSootsimPackageDir() {
|
|
27938
28057
|
try {
|
|
27939
28058
|
const resolved = require.resolve(`${rnxPublicBrand.packageName}/package.json`);
|
|
27940
|
-
return
|
|
28059
|
+
return import_node_path22.default.dirname(resolved);
|
|
27941
28060
|
} catch {
|
|
27942
28061
|
}
|
|
27943
28062
|
const here = fileFromImportMeta();
|
|
27944
28063
|
if (!here) return null;
|
|
27945
|
-
let cur =
|
|
28064
|
+
let cur = import_node_path22.default.dirname(here);
|
|
27946
28065
|
for (let i = 0; i < 8; i++) {
|
|
27947
|
-
const pkg =
|
|
28066
|
+
const pkg = import_node_path22.default.join(cur, "package.json");
|
|
27948
28067
|
try {
|
|
27949
|
-
if (
|
|
27950
|
-
const parsed = JSON.parse(
|
|
28068
|
+
if (import_node_fs21.default.existsSync(pkg)) {
|
|
28069
|
+
const parsed = JSON.parse(import_node_fs21.default.readFileSync(pkg, "utf8"));
|
|
27951
28070
|
if (parsed.name === rnxPublicBrand.packageName) return cur;
|
|
27952
28071
|
}
|
|
27953
28072
|
} catch {
|
|
27954
28073
|
}
|
|
27955
|
-
const parent =
|
|
28074
|
+
const parent = import_node_path22.default.dirname(cur);
|
|
27956
28075
|
if (parent === cur) break;
|
|
27957
28076
|
cur = parent;
|
|
27958
28077
|
}
|
|
@@ -27968,28 +28087,28 @@ function fileFromImportMeta() {
|
|
|
27968
28087
|
}
|
|
27969
28088
|
}
|
|
27970
28089
|
async function withStartLock(projectId, provider, fn) {
|
|
27971
|
-
const lockDir =
|
|
27972
|
-
|
|
28090
|
+
const lockDir = import_node_path22.default.join(getUserDataDir(), "locks");
|
|
28091
|
+
import_node_fs21.default.mkdirSync(lockDir, { recursive: true });
|
|
27973
28092
|
try {
|
|
27974
|
-
|
|
28093
|
+
import_node_fs21.default.chmodSync(lockDir, 448);
|
|
27975
28094
|
} catch {
|
|
27976
28095
|
}
|
|
27977
|
-
const lockPath =
|
|
28096
|
+
const lockPath = import_node_path22.default.join(lockDir, `start-${projectId}-${provider}.lock`);
|
|
27978
28097
|
const deadline = Date.now() + 4e3;
|
|
27979
28098
|
let fd = null;
|
|
27980
28099
|
while (fd === null) {
|
|
27981
28100
|
try {
|
|
27982
|
-
fd =
|
|
28101
|
+
fd = import_node_fs21.default.openSync(
|
|
27983
28102
|
lockPath,
|
|
27984
|
-
|
|
28103
|
+
import_node_fs21.constants.O_WRONLY | import_node_fs21.constants.O_CREAT | import_node_fs21.constants.O_EXCL,
|
|
27985
28104
|
384
|
|
27986
28105
|
);
|
|
27987
28106
|
} catch (err) {
|
|
27988
28107
|
if (err.code !== "EEXIST") throw err;
|
|
27989
28108
|
try {
|
|
27990
|
-
const stale = Number(
|
|
28109
|
+
const stale = Number(import_node_fs21.default.readFileSync(lockPath, "utf8").trim());
|
|
27991
28110
|
if (stale && !isProcessAlive(stale)) {
|
|
27992
|
-
|
|
28111
|
+
import_node_fs21.default.unlinkSync(lockPath);
|
|
27993
28112
|
continue;
|
|
27994
28113
|
}
|
|
27995
28114
|
} catch {
|
|
@@ -28003,15 +28122,15 @@ async function withStartLock(projectId, provider, fn) {
|
|
|
28003
28122
|
}
|
|
28004
28123
|
}
|
|
28005
28124
|
try {
|
|
28006
|
-
|
|
28125
|
+
import_node_fs21.default.writeFileSync(fd, String(process.pid));
|
|
28007
28126
|
return await fn();
|
|
28008
28127
|
} finally {
|
|
28009
28128
|
try {
|
|
28010
|
-
|
|
28129
|
+
import_node_fs21.default.closeSync(fd);
|
|
28011
28130
|
} catch {
|
|
28012
28131
|
}
|
|
28013
28132
|
try {
|
|
28014
|
-
|
|
28133
|
+
import_node_fs21.default.unlinkSync(lockPath);
|
|
28015
28134
|
} catch {
|
|
28016
28135
|
}
|
|
28017
28136
|
}
|
|
@@ -28025,25 +28144,25 @@ function isProcessAlive(pid) {
|
|
|
28025
28144
|
}
|
|
28026
28145
|
}
|
|
28027
28146
|
function mkfifoSync(p) {
|
|
28028
|
-
const parent =
|
|
28029
|
-
|
|
28147
|
+
const parent = import_node_path22.default.dirname(p);
|
|
28148
|
+
import_node_fs21.default.mkdirSync(parent, { recursive: true });
|
|
28030
28149
|
try {
|
|
28031
|
-
|
|
28150
|
+
import_node_fs21.default.chmodSync(parent, 448);
|
|
28032
28151
|
} catch {
|
|
28033
28152
|
}
|
|
28034
|
-
if (
|
|
28153
|
+
if (import_node_fs21.default.existsSync(p)) {
|
|
28035
28154
|
try {
|
|
28036
|
-
const stat2 =
|
|
28155
|
+
const stat2 = import_node_fs21.default.statSync(p);
|
|
28037
28156
|
if (stat2.isFIFO()) {
|
|
28038
28157
|
try {
|
|
28039
|
-
|
|
28158
|
+
import_node_fs21.default.chmodSync(p, 384);
|
|
28040
28159
|
} catch {
|
|
28041
28160
|
}
|
|
28042
28161
|
return;
|
|
28043
28162
|
}
|
|
28044
|
-
|
|
28163
|
+
import_node_fs21.default.unlinkSync(p);
|
|
28045
28164
|
} catch {
|
|
28046
|
-
|
|
28165
|
+
import_node_fs21.default.unlinkSync(p);
|
|
28047
28166
|
}
|
|
28048
28167
|
}
|
|
28049
28168
|
const result = (0, import_node_child_process10.spawnSync)("mkfifo", ["-m", "600", p]);
|
|
@@ -28069,7 +28188,7 @@ async function startSession(opts) {
|
|
|
28069
28188
|
`session already running for project=${project.id} provider=${provider} (session ${existingLive.id}, pid ${existingLive.wrapperPid}). end it first with \`peach agent end <sessionId>\`.`
|
|
28070
28189
|
);
|
|
28071
28190
|
}
|
|
28072
|
-
const claudeSessionUuid = provider === "claude" ? (0,
|
|
28191
|
+
const claudeSessionUuid = provider === "claude" ? (0, import_node_crypto10.randomUUID)() : void 0;
|
|
28073
28192
|
const session = upsertSession({
|
|
28074
28193
|
projectId: project.id,
|
|
28075
28194
|
provider,
|
|
@@ -28083,10 +28202,10 @@ async function startSession(opts) {
|
|
|
28083
28202
|
const transcript = transcriptPath(session.id);
|
|
28084
28203
|
mkfifoSync(promptIn);
|
|
28085
28204
|
mkfifoSync(eventsOut);
|
|
28086
|
-
const transcriptDir =
|
|
28087
|
-
|
|
28205
|
+
const transcriptDir = import_node_path22.default.dirname(transcript);
|
|
28206
|
+
import_node_fs21.default.mkdirSync(transcriptDir, { recursive: true });
|
|
28088
28207
|
try {
|
|
28089
|
-
|
|
28208
|
+
import_node_fs21.default.chmodSync(transcriptDir, 448);
|
|
28090
28209
|
} catch {
|
|
28091
28210
|
}
|
|
28092
28211
|
const { executable, prefixArgs } = resolveSootsimInvocation();
|
|
@@ -28137,7 +28256,7 @@ async function startSession(opts) {
|
|
|
28137
28256
|
}
|
|
28138
28257
|
}
|
|
28139
28258
|
try {
|
|
28140
|
-
|
|
28259
|
+
import_node_fs21.default.rmSync(sessionDir(session.id), { recursive: true, force: true });
|
|
28141
28260
|
} catch {
|
|
28142
28261
|
}
|
|
28143
28262
|
updateSessionStatus(session.id, { status: "ended" });
|
|
@@ -28165,18 +28284,18 @@ async function sendPrompt(sessionId, prompt) {
|
|
|
28165
28284
|
);
|
|
28166
28285
|
}
|
|
28167
28286
|
const fifo = promptFifoPath(sessionId);
|
|
28168
|
-
if (!
|
|
28287
|
+
if (!import_node_fs21.default.existsSync(fifo)) {
|
|
28169
28288
|
throw new AgentSessionError("NO_FIFO", `prompt FIFO missing: ${fifo}`);
|
|
28170
28289
|
}
|
|
28171
|
-
const fd =
|
|
28290
|
+
const fd = import_node_fs21.default.openSync(fifo, import_node_fs21.constants.O_WRONLY);
|
|
28172
28291
|
try {
|
|
28173
28292
|
const wireText = encodeAgentPromptEnvelope(prompt);
|
|
28174
28293
|
if (!wireText) {
|
|
28175
28294
|
throw new AgentSessionError("EMPTY_PROMPT", "prompt text is empty");
|
|
28176
28295
|
}
|
|
28177
|
-
|
|
28296
|
+
import_node_fs21.default.writeSync(fd, wireText + "\n");
|
|
28178
28297
|
} finally {
|
|
28179
|
-
|
|
28298
|
+
import_node_fs21.default.closeSync(fd);
|
|
28180
28299
|
}
|
|
28181
28300
|
updateSessionStatus(sessionId, {
|
|
28182
28301
|
lastPrompt: prompt.displayText ?? prompt.text,
|
|
@@ -28198,7 +28317,7 @@ async function endSession(sessionId) {
|
|
|
28198
28317
|
const base = getUserDataDir();
|
|
28199
28318
|
if (dir.startsWith(base)) {
|
|
28200
28319
|
try {
|
|
28201
|
-
|
|
28320
|
+
import_node_fs21.default.rmSync(dir, { recursive: true, force: true });
|
|
28202
28321
|
} catch {
|
|
28203
28322
|
}
|
|
28204
28323
|
}
|
|
@@ -28206,11 +28325,11 @@ async function endSession(sessionId) {
|
|
|
28206
28325
|
}
|
|
28207
28326
|
function subscribeEvents(sessionId, onEvent) {
|
|
28208
28327
|
const fifo = eventsFifoPath(sessionId);
|
|
28209
|
-
if (!
|
|
28328
|
+
if (!import_node_fs21.default.existsSync(fifo)) {
|
|
28210
28329
|
throw new AgentSessionError("NO_FIFO", `events FIFO missing: ${fifo}`);
|
|
28211
28330
|
}
|
|
28212
|
-
const fd =
|
|
28213
|
-
const stream =
|
|
28331
|
+
const fd = import_node_fs21.default.openSync(fifo, import_node_fs21.constants.O_RDWR);
|
|
28332
|
+
const stream = import_node_fs21.default.createReadStream("", { fd, autoClose: true });
|
|
28214
28333
|
const rl = import_node_readline.default.createInterface({ input: stream, crlfDelay: Infinity });
|
|
28215
28334
|
rl.on("line", (line) => {
|
|
28216
28335
|
const event = parseAgentEventLine(line);
|
|
@@ -28221,7 +28340,7 @@ function subscribeEvents(sessionId, onEvent) {
|
|
|
28221
28340
|
if (closed) return;
|
|
28222
28341
|
closed = true;
|
|
28223
28342
|
try {
|
|
28224
|
-
|
|
28343
|
+
import_node_fs21.default.writeSync(fd, "\n");
|
|
28225
28344
|
} catch {
|
|
28226
28345
|
}
|
|
28227
28346
|
try {
|
|
@@ -28235,7 +28354,7 @@ function subscribeEvents(sessionId, onEvent) {
|
|
|
28235
28354
|
};
|
|
28236
28355
|
}
|
|
28237
28356
|
async function waitForFirstEvent(fifo, predicate, timeoutMs) {
|
|
28238
|
-
const fd =
|
|
28357
|
+
const fd = import_node_fs21.default.openSync(fifo, import_node_fs21.constants.O_RDWR | import_node_fs21.constants.O_NONBLOCK);
|
|
28239
28358
|
const buf = Buffer.alloc(8192);
|
|
28240
28359
|
let leftover = "";
|
|
28241
28360
|
const deadline = Date.now() + timeoutMs;
|
|
@@ -28243,7 +28362,7 @@ async function waitForFirstEvent(fifo, predicate, timeoutMs) {
|
|
|
28243
28362
|
while (Date.now() < deadline) {
|
|
28244
28363
|
let n = 0;
|
|
28245
28364
|
try {
|
|
28246
|
-
n =
|
|
28365
|
+
n = import_node_fs21.default.readSync(fd, buf, 0, buf.length, null);
|
|
28247
28366
|
} catch (err) {
|
|
28248
28367
|
if (err.code !== "EAGAIN") throw err;
|
|
28249
28368
|
n = 0;
|
|
@@ -28263,17 +28382,17 @@ async function waitForFirstEvent(fifo, predicate, timeoutMs) {
|
|
|
28263
28382
|
}
|
|
28264
28383
|
return null;
|
|
28265
28384
|
} finally {
|
|
28266
|
-
|
|
28385
|
+
import_node_fs21.default.closeSync(fd);
|
|
28267
28386
|
}
|
|
28268
28387
|
}
|
|
28269
|
-
var import_node_child_process10,
|
|
28388
|
+
var import_node_child_process10, import_node_crypto10, import_node_fs21, import_node_path22, import_node_readline, AgentSessionError;
|
|
28270
28389
|
var init_agent_sessions = __esm({
|
|
28271
28390
|
"src/agent-sessions.ts"() {
|
|
28272
28391
|
"use strict";
|
|
28273
28392
|
import_node_child_process10 = require("node:child_process");
|
|
28274
|
-
|
|
28275
|
-
|
|
28276
|
-
|
|
28393
|
+
import_node_crypto10 = require("node:crypto");
|
|
28394
|
+
import_node_fs21 = __toESM(require("node:fs"), 1);
|
|
28395
|
+
import_node_path22 = __toESM(require("node:path"), 1);
|
|
28277
28396
|
import_node_readline = __toESM(require("node:readline"), 1);
|
|
28278
28397
|
init_self_invocation();
|
|
28279
28398
|
init_standalone();
|
|
@@ -28304,13 +28423,13 @@ function mapFrameworkToProjectFramework(fw) {
|
|
|
28304
28423
|
if (fw === "one" || fw === "vxrn") return "one";
|
|
28305
28424
|
return "unknown";
|
|
28306
28425
|
}
|
|
28307
|
-
var
|
|
28426
|
+
var import_node_crypto11, import_node_fs22, import_node_path23, WS_OPEN, SESSION_STATUS_PERSIST_DELAY_MS, AgentHost;
|
|
28308
28427
|
var init_agent_host = __esm({
|
|
28309
28428
|
"src/host/agent-host.ts"() {
|
|
28310
28429
|
"use strict";
|
|
28311
|
-
|
|
28312
|
-
|
|
28313
|
-
|
|
28430
|
+
import_node_crypto11 = require("node:crypto");
|
|
28431
|
+
import_node_fs22 = __toESM(require("node:fs"), 1);
|
|
28432
|
+
import_node_path23 = __toESM(require("node:path"), 1);
|
|
28314
28433
|
init_dev_server_scanner();
|
|
28315
28434
|
init_agent_sessions();
|
|
28316
28435
|
init_attached_projects();
|
|
@@ -28510,7 +28629,7 @@ var init_agent_host = __esm({
|
|
|
28510
28629
|
throw new AgentSessionError("EMPTY_PROMPT", "inspect message cannot be empty");
|
|
28511
28630
|
}
|
|
28512
28631
|
const message = {
|
|
28513
|
-
id: `inspect-${(0,
|
|
28632
|
+
id: `inspect-${(0, import_node_crypto11.randomUUID)()}`,
|
|
28514
28633
|
simId,
|
|
28515
28634
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
28516
28635
|
prompt
|
|
@@ -28556,7 +28675,7 @@ var init_agent_host = __esm({
|
|
|
28556
28675
|
);
|
|
28557
28676
|
const project = upsertProject({
|
|
28558
28677
|
cwd: match.cwd,
|
|
28559
|
-
name: match.projectName ??
|
|
28678
|
+
name: match.projectName ?? import_node_path23.default.basename(match.cwd),
|
|
28560
28679
|
preferredProvider: input.provider ?? existing?.preferredProvider,
|
|
28561
28680
|
sourceRoots: existing?.sourceRoots ?? [match.cwd],
|
|
28562
28681
|
knownBundleUrls,
|
|
@@ -28567,18 +28686,18 @@ var init_agent_host = __esm({
|
|
|
28567
28686
|
}
|
|
28568
28687
|
getTranscript(sessionId) {
|
|
28569
28688
|
const p = transcriptPath(sessionId);
|
|
28570
|
-
if (!
|
|
28689
|
+
if (!import_node_fs22.default.existsSync(p)) {
|
|
28571
28690
|
return { error: "transcript not found", code: "NO_TRANSCRIPT" };
|
|
28572
28691
|
}
|
|
28573
|
-
return
|
|
28692
|
+
return import_node_fs22.default.readFileSync(p, "utf8");
|
|
28574
28693
|
}
|
|
28575
28694
|
getPaths() {
|
|
28576
28695
|
const dir = getUserDataDir();
|
|
28577
28696
|
return {
|
|
28578
28697
|
userDataDir: dir,
|
|
28579
|
-
storeFile:
|
|
28580
|
-
sessionsDir:
|
|
28581
|
-
transcriptsDir:
|
|
28698
|
+
storeFile: import_node_path23.default.join(dir, "attached-projects.json"),
|
|
28699
|
+
sessionsDir: import_node_path23.default.join(dir, "sessions"),
|
|
28700
|
+
transcriptsDir: import_node_path23.default.join(dir, "transcripts")
|
|
28582
28701
|
};
|
|
28583
28702
|
}
|
|
28584
28703
|
// --- subscription management ---
|
|
@@ -29292,7 +29411,7 @@ async function startFetchProxyTransport() {
|
|
|
29292
29411
|
const keys = await crypto.subtle.generateKey(algorithm, true, ["sign", "verify"]);
|
|
29293
29412
|
const certificate = await import_x509.X509CertificateGenerator.createSelfSigned(
|
|
29294
29413
|
{
|
|
29295
|
-
serialNumber: (0,
|
|
29414
|
+
serialNumber: (0, import_node_crypto12.randomBytes)(16).toString("hex"),
|
|
29296
29415
|
name: "CN=localhost",
|
|
29297
29416
|
notBefore: new Date(Date.now() - 6e4),
|
|
29298
29417
|
notAfter: new Date(Date.now() + 365 * 24 * 60 * 6e4),
|
|
@@ -29305,7 +29424,7 @@ async function startFetchProxyTransport() {
|
|
|
29305
29424
|
crypto
|
|
29306
29425
|
);
|
|
29307
29426
|
const privateKey = Buffer.from(await crypto.subtle.exportKey("pkcs8", keys.privateKey));
|
|
29308
|
-
const spki = (0,
|
|
29427
|
+
const spki = (0, import_node_crypto12.createHash)("sha256").update(Buffer.from(await crypto.subtle.exportKey("spki", keys.publicKey))).digest("base64");
|
|
29309
29428
|
const sessions = /* @__PURE__ */ new Set();
|
|
29310
29429
|
const server = (0, import_node_http22.createSecureServer)(
|
|
29311
29430
|
{
|
|
@@ -29351,11 +29470,11 @@ ${privateKey.toString("base64").match(/.{1,64}/g)?.join("\n")}
|
|
|
29351
29470
|
}
|
|
29352
29471
|
};
|
|
29353
29472
|
}
|
|
29354
|
-
var
|
|
29473
|
+
var import_node_crypto12, import_node_http22, import_x509;
|
|
29355
29474
|
var init_fetch_proxy_transport = __esm({
|
|
29356
29475
|
"src/host/fetch-proxy-transport.ts"() {
|
|
29357
29476
|
"use strict";
|
|
29358
|
-
|
|
29477
|
+
import_node_crypto12 = require("node:crypto");
|
|
29359
29478
|
import_node_http22 = require("node:http2");
|
|
29360
29479
|
import_x509 = require("@peculiar/x509");
|
|
29361
29480
|
init_fetch_proxy_handler();
|
|
@@ -29572,23 +29691,23 @@ function looksBinary(filePath, size) {
|
|
|
29572
29691
|
if (size === 0) return false;
|
|
29573
29692
|
let fd;
|
|
29574
29693
|
try {
|
|
29575
|
-
fd =
|
|
29694
|
+
fd = import_node_fs23.default.openSync(filePath, "r");
|
|
29576
29695
|
const buffer = Buffer.alloc(Math.min(BINARY_SNIFF_BYTES, size));
|
|
29577
|
-
const read =
|
|
29696
|
+
const read = import_node_fs23.default.readSync(fd, buffer, 0, buffer.length, 0);
|
|
29578
29697
|
return buffer.subarray(0, read).includes(0);
|
|
29579
29698
|
} catch {
|
|
29580
29699
|
return false;
|
|
29581
29700
|
} finally {
|
|
29582
|
-
if (fd !== void 0)
|
|
29701
|
+
if (fd !== void 0) import_node_fs23.default.closeSync(fd);
|
|
29583
29702
|
}
|
|
29584
29703
|
}
|
|
29585
|
-
var import_node_child_process11,
|
|
29704
|
+
var import_node_child_process11, import_node_fs23, import_node_path24, CheckoutRequiresGitError, BINARY_SNIFF_BYTES, LIST_FILES_TIMEOUT_MS, LIST_FILES_ATTEMPTS, LIST_FILES_RETRY_MS, CheckoutFilePlane;
|
|
29586
29705
|
var init_checkout_plane = __esm({
|
|
29587
29706
|
"cli/commands/box/checkout-plane.ts"() {
|
|
29588
29707
|
"use strict";
|
|
29589
29708
|
import_node_child_process11 = require("node:child_process");
|
|
29590
|
-
|
|
29591
|
-
|
|
29709
|
+
import_node_fs23 = __toESM(require("node:fs"), 1);
|
|
29710
|
+
import_node_path24 = __toESM(require("node:path"), 1);
|
|
29592
29711
|
CheckoutRequiresGitError = class extends Error {
|
|
29593
29712
|
};
|
|
29594
29713
|
BINARY_SNIFF_BYTES = 8192;
|
|
@@ -29605,7 +29724,7 @@ var init_checkout_plane = __esm({
|
|
|
29605
29724
|
listTimeoutMs;
|
|
29606
29725
|
trackedOnly;
|
|
29607
29726
|
constructor(root, options = {}) {
|
|
29608
|
-
this.root =
|
|
29727
|
+
this.root = import_node_path24.default.resolve(root);
|
|
29609
29728
|
this.listTimeoutMs = options.listTimeoutMs ?? LIST_FILES_TIMEOUT_MS;
|
|
29610
29729
|
this.trackedOnly = options.trackedOnly ?? false;
|
|
29611
29730
|
}
|
|
@@ -29667,13 +29786,13 @@ var init_checkout_plane = __esm({
|
|
|
29667
29786
|
if (!relative3) continue;
|
|
29668
29787
|
let stat2;
|
|
29669
29788
|
try {
|
|
29670
|
-
stat2 =
|
|
29789
|
+
stat2 = import_node_fs23.default.statSync(import_node_path24.default.join(this.root, relative3));
|
|
29671
29790
|
} catch {
|
|
29672
29791
|
continue;
|
|
29673
29792
|
}
|
|
29674
29793
|
if (!stat2.isFile()) continue;
|
|
29675
29794
|
const seen = this.sniffed.get(relative3);
|
|
29676
|
-
const binary = seen && seen.size === stat2.size && seen.mtimeMs === stat2.mtimeMs ? seen.binary : looksBinary(
|
|
29795
|
+
const binary = seen && seen.size === stat2.size && seen.mtimeMs === stat2.mtimeMs ? seen.binary : looksBinary(import_node_path24.default.join(this.root, relative3), stat2.size);
|
|
29677
29796
|
nextSniffed.set(relative3, { size: stat2.size, mtimeMs: stat2.mtimeMs, binary });
|
|
29678
29797
|
next.set(relative3, {
|
|
29679
29798
|
size: stat2.size,
|
|
@@ -29687,22 +29806,22 @@ var init_checkout_plane = __esm({
|
|
|
29687
29806
|
this.sniffed = nextSniffed;
|
|
29688
29807
|
}
|
|
29689
29808
|
absolute(planePath) {
|
|
29690
|
-
const resolved =
|
|
29691
|
-
if (resolved !== this.root && !resolved.startsWith(`${this.root}${
|
|
29809
|
+
const resolved = import_node_path24.default.resolve(this.root, planePath);
|
|
29810
|
+
if (resolved !== this.root && !resolved.startsWith(`${this.root}${import_node_path24.default.sep}`)) {
|
|
29692
29811
|
throw new Error(`path escapes the project: ${planePath}`);
|
|
29693
29812
|
}
|
|
29694
29813
|
return resolved;
|
|
29695
29814
|
}
|
|
29696
29815
|
async read(planePath) {
|
|
29697
|
-
return
|
|
29816
|
+
return import_node_fs23.default.promises.readFile(this.absolute(planePath), "utf8");
|
|
29698
29817
|
}
|
|
29699
29818
|
async readBytes(planePath) {
|
|
29700
|
-
return
|
|
29819
|
+
return import_node_fs23.default.promises.readFile(this.absolute(planePath));
|
|
29701
29820
|
}
|
|
29702
29821
|
async write(planePath, content) {
|
|
29703
29822
|
const absolute = this.absolute(planePath);
|
|
29704
|
-
await
|
|
29705
|
-
await
|
|
29823
|
+
await import_node_fs23.default.promises.mkdir(import_node_path24.default.dirname(absolute), { recursive: true });
|
|
29824
|
+
await import_node_fs23.default.promises.writeFile(absolute, content);
|
|
29706
29825
|
this.entries.set(planePath, {
|
|
29707
29826
|
size: content.byteLength,
|
|
29708
29827
|
readOnly: false,
|
|
@@ -29711,7 +29830,7 @@ var init_checkout_plane = __esm({
|
|
|
29711
29830
|
});
|
|
29712
29831
|
}
|
|
29713
29832
|
async delete(planePath) {
|
|
29714
|
-
await
|
|
29833
|
+
await import_node_fs23.default.promises.rm(this.absolute(planePath), { force: true });
|
|
29715
29834
|
this.entries.delete(planePath);
|
|
29716
29835
|
}
|
|
29717
29836
|
};
|
|
@@ -29719,12 +29838,12 @@ var init_checkout_plane = __esm({
|
|
|
29719
29838
|
});
|
|
29720
29839
|
|
|
29721
29840
|
// src/host/plane-host.ts
|
|
29722
|
-
var
|
|
29841
|
+
var import_node_fs24, import_node_path25, WS_OPEN2, PlaneNotRegisteredError, PlaneHost;
|
|
29723
29842
|
var init_plane_host = __esm({
|
|
29724
29843
|
"src/host/plane-host.ts"() {
|
|
29725
29844
|
"use strict";
|
|
29726
|
-
|
|
29727
|
-
|
|
29845
|
+
import_node_fs24 = __toESM(require("node:fs"), 1);
|
|
29846
|
+
import_node_path25 = __toESM(require("node:path"), 1);
|
|
29728
29847
|
init_plane();
|
|
29729
29848
|
init_checkout_plane();
|
|
29730
29849
|
WS_OPEN2 = 1;
|
|
@@ -29847,14 +29966,14 @@ var init_plane_host = __esm({
|
|
|
29847
29966
|
// root and an opened one cannot disagree about the same directory.
|
|
29848
29967
|
realRoot(root) {
|
|
29849
29968
|
if (!root) throw new Error("root is required");
|
|
29850
|
-
const resolved =
|
|
29969
|
+
const resolved = import_node_path25.default.resolve(root);
|
|
29851
29970
|
let real;
|
|
29852
29971
|
try {
|
|
29853
|
-
real =
|
|
29972
|
+
real = import_node_fs24.default.realpathSync(resolved);
|
|
29854
29973
|
} catch {
|
|
29855
29974
|
throw new Error(`no such directory: ${resolved}`);
|
|
29856
29975
|
}
|
|
29857
|
-
if (!
|
|
29976
|
+
if (!import_node_fs24.default.statSync(real).isDirectory()) throw new Error(`not a directory: ${real}`);
|
|
29858
29977
|
return real;
|
|
29859
29978
|
}
|
|
29860
29979
|
respond(ws, id, result) {
|
|
@@ -30210,16 +30329,16 @@ function sendJavaScript(req, res, source) {
|
|
|
30210
30329
|
res.end(req.method === "HEAD" ? void 0 : source);
|
|
30211
30330
|
}
|
|
30212
30331
|
function resolveReplacementModuleFile(fromFile, specifier) {
|
|
30213
|
-
const base =
|
|
30332
|
+
const base = import_node_path26.default.resolve(import_node_path26.default.dirname(fromFile), specifier);
|
|
30214
30333
|
const candidates = [
|
|
30215
30334
|
...REPLACEMENT_MODULE_EXTENSIONS.some(
|
|
30216
|
-
(ext) => ext ===
|
|
30335
|
+
(ext) => ext === import_node_path26.default.extname(base).toLowerCase()
|
|
30217
30336
|
) ? [base] : [],
|
|
30218
30337
|
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => base + ext),
|
|
30219
|
-
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) =>
|
|
30338
|
+
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => import_node_path26.default.join(base, `index${ext}`))
|
|
30220
30339
|
];
|
|
30221
30340
|
const found = candidates.find(
|
|
30222
|
-
(candidate) => (0,
|
|
30341
|
+
(candidate) => (0, import_node_fs25.statSync)(candidate, { throwIfNoEntry: false })?.isFile()
|
|
30223
30342
|
);
|
|
30224
30343
|
if (!found) {
|
|
30225
30344
|
throw new Error(
|
|
@@ -30274,13 +30393,13 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
30274
30393
|
res.end("missing path param");
|
|
30275
30394
|
return true;
|
|
30276
30395
|
}
|
|
30277
|
-
const extension =
|
|
30396
|
+
const extension = import_node_path26.default.extname(targetPath).toLowerCase();
|
|
30278
30397
|
if (!REPLACEMENT_MODULE_EXTENSIONS.some((allowed) => allowed === extension)) {
|
|
30279
30398
|
res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
30280
30399
|
res.end(`replacement files must be ${REPLACEMENT_MODULE_EXTENSIONS.join(", ")}`);
|
|
30281
30400
|
return true;
|
|
30282
30401
|
}
|
|
30283
|
-
if (!
|
|
30402
|
+
if (!import_node_path26.default.isAbsolute(targetPath)) {
|
|
30284
30403
|
res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
30285
30404
|
res.end("replacement file path must be absolute");
|
|
30286
30405
|
return true;
|
|
@@ -30288,10 +30407,10 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
30288
30407
|
const runtimePackages = new Set(url.searchParams.getAll("runtimePackage"));
|
|
30289
30408
|
let resolvedProjectRoot;
|
|
30290
30409
|
if (options.projectRoot) {
|
|
30291
|
-
const lexicalProjectRoot =
|
|
30410
|
+
const lexicalProjectRoot = import_node_path26.default.resolve(options.projectRoot);
|
|
30292
30411
|
resolvedProjectRoot = await import_promises5.default.realpath(options.projectRoot);
|
|
30293
|
-
const lexicalTarget =
|
|
30294
|
-
if (lexicalTarget.startsWith("..") ||
|
|
30412
|
+
const lexicalTarget = import_node_path26.default.relative(lexicalProjectRoot, targetPath);
|
|
30413
|
+
if (lexicalTarget.startsWith("..") || import_node_path26.default.isAbsolute(lexicalTarget)) {
|
|
30295
30414
|
res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
|
|
30296
30415
|
res.end("replacement file must be inside the project root");
|
|
30297
30416
|
return true;
|
|
@@ -30307,8 +30426,8 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
30307
30426
|
return true;
|
|
30308
30427
|
}
|
|
30309
30428
|
if (resolvedProjectRoot) {
|
|
30310
|
-
const relativeTarget =
|
|
30311
|
-
if (relativeTarget.startsWith("..") ||
|
|
30429
|
+
const relativeTarget = import_node_path26.default.relative(resolvedProjectRoot, resolvedTargetPath);
|
|
30430
|
+
if (relativeTarget.startsWith("..") || import_node_path26.default.isAbsolute(relativeTarget)) {
|
|
30312
30431
|
res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
|
|
30313
30432
|
res.end("replacement file must be inside the project root");
|
|
30314
30433
|
return true;
|
|
@@ -30343,13 +30462,13 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
30343
30462
|
}
|
|
30344
30463
|
return true;
|
|
30345
30464
|
}
|
|
30346
|
-
var
|
|
30465
|
+
var import_node_fs25, import_promises5, import_node_path26, REPLACEMENT_MODULE_ROUTE;
|
|
30347
30466
|
var init_replacement_module_handler = __esm({
|
|
30348
30467
|
"src/host/replacement-module-handler.ts"() {
|
|
30349
30468
|
"use strict";
|
|
30350
|
-
|
|
30469
|
+
import_node_fs25 = require("node:fs");
|
|
30351
30470
|
import_promises5 = __toESM(require("node:fs/promises"), 1);
|
|
30352
|
-
|
|
30471
|
+
import_node_path26 = __toESM(require("node:path"), 1);
|
|
30353
30472
|
init_replacementModule();
|
|
30354
30473
|
init_backend_origin();
|
|
30355
30474
|
REPLACEMENT_MODULE_ROUTE = "/__sootsim-replacement-module";
|
|
@@ -32325,8 +32444,8 @@ function metroIosAssetDestRelatives(httpServerLocation, filename) {
|
|
|
32325
32444
|
}
|
|
32326
32445
|
const out = [];
|
|
32327
32446
|
for (const dir of dirs) {
|
|
32328
|
-
const
|
|
32329
|
-
if (!out.includes(
|
|
32447
|
+
const path36 = `${dir}/${filename}`;
|
|
32448
|
+
if (!out.includes(path36)) out.push(path36);
|
|
32330
32449
|
}
|
|
32331
32450
|
if (!out.includes(filename)) out.push(filename);
|
|
32332
32451
|
return out;
|
|
@@ -33280,13 +33399,13 @@ function readFactoryStringLiterals(factory) {
|
|
|
33280
33399
|
return literals;
|
|
33281
33400
|
}
|
|
33282
33401
|
function normalizeFingerprintLiteral(literal) {
|
|
33283
|
-
const
|
|
33402
|
+
const path36 = literal.replaceAll("\\\\", "/").replaceAll("\\/", "/");
|
|
33284
33403
|
const nodeModulesMarker = "/node_modules/";
|
|
33285
|
-
const nodeModulesIndex =
|
|
33404
|
+
const nodeModulesIndex = path36.lastIndexOf(nodeModulesMarker);
|
|
33286
33405
|
if (nodeModulesIndex >= 0) {
|
|
33287
|
-
return `node_modules/${
|
|
33406
|
+
return `node_modules/${path36.slice(nodeModulesIndex + nodeModulesMarker.length)}`;
|
|
33288
33407
|
}
|
|
33289
|
-
if ((
|
|
33408
|
+
if ((path36.startsWith("/") || /^[A-Za-z]:\//.test(path36) || path36.startsWith("file:/")) && /\.[cm]?[jt]sx?(?::\d+(?::\d+)?)?$/.test(path36)) {
|
|
33290
33409
|
return null;
|
|
33291
33410
|
}
|
|
33292
33411
|
return literal;
|
|
@@ -33524,10 +33643,10 @@ function templateAssignment(template, embeddings) {
|
|
|
33524
33643
|
if (existingNode !== void 0 && existingNode !== nodeIndex) return null;
|
|
33525
33644
|
nodesByModuleId.set(moduleId, nodeIndex);
|
|
33526
33645
|
const node = template.nodes[nodeIndex];
|
|
33527
|
-
const
|
|
33646
|
+
const path36 = node.landmarkPath ?? `node_modules/${template.packageName}/__rnx_inferred__/${moduleId}.js`;
|
|
33528
33647
|
const existingPath = pathsByModuleId.get(moduleId);
|
|
33529
|
-
if (existingPath !== void 0 && existingPath !==
|
|
33530
|
-
pathsByModuleId.set(moduleId,
|
|
33648
|
+
if (existingPath !== void 0 && existingPath !== path36) return null;
|
|
33649
|
+
pathsByModuleId.set(moduleId, path36);
|
|
33531
33650
|
}
|
|
33532
33651
|
}
|
|
33533
33652
|
return {
|
|
@@ -33689,14 +33808,14 @@ async function inferMetroModuleIdentity(args) {
|
|
|
33689
33808
|
const packageClaims = claimsByPackage.values().next().value;
|
|
33690
33809
|
if (!packageClaims) continue;
|
|
33691
33810
|
const exactClaims = packageClaims.filter((assignment2) => {
|
|
33692
|
-
const
|
|
33693
|
-
return
|
|
33811
|
+
const path36 = assignment2.pathsByModuleId.get(moduleId);
|
|
33812
|
+
return path36 !== void 0 && !path36.includes("/__rnx_inferred__/");
|
|
33694
33813
|
});
|
|
33695
33814
|
const preferredClaims = exactClaims.length > 0 ? exactClaims : packageClaims;
|
|
33696
33815
|
const routes = new Set(
|
|
33697
33816
|
preferredClaims.flatMap((assignment2) => {
|
|
33698
|
-
const
|
|
33699
|
-
return
|
|
33817
|
+
const path36 = assignment2.pathsByModuleId.get(moduleId);
|
|
33818
|
+
return path36 ? [metroFingerprintModuleClaimRoute(assignment2.packageName, path36)] : [];
|
|
33700
33819
|
})
|
|
33701
33820
|
);
|
|
33702
33821
|
if (routes.size !== 1) continue;
|
|
@@ -33991,8 +34110,8 @@ function detectFramework2(deps) {
|
|
|
33991
34110
|
return "unknown";
|
|
33992
34111
|
}
|
|
33993
34112
|
function detectProject(dir) {
|
|
33994
|
-
const pkgPath = (0,
|
|
33995
|
-
if (!(0,
|
|
34113
|
+
const pkgPath = (0, import_node_path27.join)(dir, "package.json");
|
|
34114
|
+
if (!(0, import_node_fs26.existsSync)(pkgPath)) return null;
|
|
33996
34115
|
const pkg = readProjectManifest(dir);
|
|
33997
34116
|
if (!pkg) return null;
|
|
33998
34117
|
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
@@ -34004,25 +34123,25 @@ function detectProject(dir) {
|
|
|
34004
34123
|
if (framework === "unknown") return null;
|
|
34005
34124
|
return {
|
|
34006
34125
|
dir,
|
|
34007
|
-
name: pkg.name || (0,
|
|
34126
|
+
name: pkg.name || (0, import_node_path27.basename)(dir),
|
|
34008
34127
|
framework,
|
|
34009
34128
|
// a config file is a config file whatever module system it declares. real
|
|
34010
34129
|
// apps write .cjs as often as .js, and missing one reads as "this project
|
|
34011
34130
|
// has no bundler config" and sends the user to create a second one.
|
|
34012
34131
|
hasViteConfig: CONFIG_EXTENSIONS.some(
|
|
34013
|
-
(ext) => (0,
|
|
34132
|
+
(ext) => (0, import_node_fs26.existsSync)((0, import_node_path27.join)(dir, `vite.config.${ext}`))
|
|
34014
34133
|
),
|
|
34015
34134
|
hasMetroConfig: CONFIG_EXTENSIONS.some(
|
|
34016
|
-
(ext) => (0,
|
|
34135
|
+
(ext) => (0, import_node_fs26.existsSync)((0, import_node_path27.join)(dir, `metro.config.${ext}`))
|
|
34017
34136
|
),
|
|
34018
34137
|
devCommand: typeof devCommand === "string" ? devCommand : null
|
|
34019
34138
|
};
|
|
34020
34139
|
}
|
|
34021
|
-
function readProjectMetadata(
|
|
34140
|
+
function readProjectMetadata(path36) {
|
|
34022
34141
|
try {
|
|
34023
|
-
const info = (0,
|
|
34142
|
+
const info = (0, import_node_fs26.lstatSync)(path36);
|
|
34024
34143
|
if (!info.isFile() || info.size > 4 * 1024 * 1024) return null;
|
|
34025
|
-
return (0,
|
|
34144
|
+
return (0, import_node_fs26.readFileSync)(path36, "utf8");
|
|
34026
34145
|
} catch {
|
|
34027
34146
|
return null;
|
|
34028
34147
|
}
|
|
@@ -34031,8 +34150,8 @@ function metadataValue(value, key) {
|
|
|
34031
34150
|
if (!value || typeof value !== "object") return void 0;
|
|
34032
34151
|
return Object.getOwnPropertyDescriptor(value, key)?.value;
|
|
34033
34152
|
}
|
|
34034
|
-
function readProjectJson(
|
|
34035
|
-
const text2 = readProjectMetadata(
|
|
34153
|
+
function readProjectJson(path36) {
|
|
34154
|
+
const text2 = readProjectMetadata(path36);
|
|
34036
34155
|
if (text2 === null) return null;
|
|
34037
34156
|
try {
|
|
34038
34157
|
const value = JSON.parse(text2);
|
|
@@ -34042,7 +34161,7 @@ function readProjectJson(path35) {
|
|
|
34042
34161
|
}
|
|
34043
34162
|
}
|
|
34044
34163
|
function readProjectManifest(dir) {
|
|
34045
|
-
const parsed = readProjectJson((0,
|
|
34164
|
+
const parsed = readProjectJson((0, import_node_path27.join)(dir, "package.json"));
|
|
34046
34165
|
if (!parsed || typeof parsed !== "object") return null;
|
|
34047
34166
|
const record2 = (value) => {
|
|
34048
34167
|
if (!value || typeof value !== "object") return {};
|
|
@@ -34059,12 +34178,12 @@ function readProjectManifest(dir) {
|
|
|
34059
34178
|
devDependencies: record2(metadataValue(parsed, "devDependencies"))
|
|
34060
34179
|
};
|
|
34061
34180
|
}
|
|
34062
|
-
var
|
|
34181
|
+
var import_node_fs26, import_node_path27, import_json52, import_yaml, CONFIG_EXTENSIONS;
|
|
34063
34182
|
var init_detect = __esm({
|
|
34064
34183
|
"cli/commands/detect.ts"() {
|
|
34065
34184
|
"use strict";
|
|
34066
|
-
|
|
34067
|
-
|
|
34185
|
+
import_node_fs26 = require("node:fs");
|
|
34186
|
+
import_node_path27 = require("node:path");
|
|
34068
34187
|
import_json52 = __toESM(require("json5"), 1);
|
|
34069
34188
|
import_yaml = require("yaml");
|
|
34070
34189
|
CONFIG_EXTENSIONS = ["ts", "js", "cjs", "mjs", "mts", "cts"];
|
|
@@ -34101,21 +34220,21 @@ function resolveCloudOrigin(value) {
|
|
|
34101
34220
|
return normalizeCloudOrigin(source);
|
|
34102
34221
|
}
|
|
34103
34222
|
function readImmutableBundleSource(bundlePath) {
|
|
34104
|
-
const filepath = (0,
|
|
34105
|
-
if ((0,
|
|
34223
|
+
const filepath = (0, import_node_path28.resolve)(bundlePath);
|
|
34224
|
+
if ((0, import_node_path28.extname)(filepath) !== ".js") {
|
|
34106
34225
|
throw new Error(`${REMOTE_COMMAND} requires one local Metro .js bundle`);
|
|
34107
34226
|
}
|
|
34108
|
-
const descriptor = (0,
|
|
34227
|
+
const descriptor = (0, import_node_fs27.openSync)(filepath, "r");
|
|
34109
34228
|
try {
|
|
34110
|
-
const before = (0,
|
|
34229
|
+
const before = (0, import_node_fs27.fstatSync)(descriptor, { bigint: true });
|
|
34111
34230
|
if (!before.isFile()) {
|
|
34112
34231
|
throw new Error(`${REMOTE_COMMAND} bundle must be a regular local file`);
|
|
34113
34232
|
}
|
|
34114
34233
|
if (before.size <= 0n) {
|
|
34115
34234
|
throw new Error(`${REMOTE_COMMAND} bundle is empty`);
|
|
34116
34235
|
}
|
|
34117
|
-
const bytes = (0,
|
|
34118
|
-
const after = (0,
|
|
34236
|
+
const bytes = (0, import_node_fs27.readFileSync)(descriptor);
|
|
34237
|
+
const after = (0, import_node_fs27.fstatSync)(descriptor, { bigint: true });
|
|
34119
34238
|
if (before.dev !== after.dev || before.ino !== after.ino || before.size !== after.size || before.mtimeNs !== after.mtimeNs || bytes.length !== Number(before.size)) {
|
|
34120
34239
|
throw new Error(`${REMOTE_COMMAND} bundle changed while it was being read`);
|
|
34121
34240
|
}
|
|
@@ -34130,7 +34249,7 @@ function readImmutableBundleSource(bundlePath) {
|
|
|
34130
34249
|
}
|
|
34131
34250
|
return source;
|
|
34132
34251
|
} finally {
|
|
34133
|
-
(0,
|
|
34252
|
+
(0, import_node_fs27.closeSync)(descriptor);
|
|
34134
34253
|
}
|
|
34135
34254
|
}
|
|
34136
34255
|
async function fetchBundleSource(bundleUrl) {
|
|
@@ -34177,15 +34296,15 @@ async function loadBundleSource(bundleInput) {
|
|
|
34177
34296
|
return readImmutableBundleSource(bundleInput);
|
|
34178
34297
|
}
|
|
34179
34298
|
function listMetroAssetDest(assetsPath) {
|
|
34180
|
-
const directory = (0,
|
|
34181
|
-
if (!(0,
|
|
34182
|
-
const skipNested = (0,
|
|
34299
|
+
const directory = (0, import_node_path28.resolve)(assetsPath);
|
|
34300
|
+
if (!(0, import_node_fs27.existsSync)(directory)) return { directory, files: [], truncated: false };
|
|
34301
|
+
const skipNested = (0, import_node_fs27.existsSync)((0, import_node_path28.join)(directory, "package.json"));
|
|
34183
34302
|
const files = [];
|
|
34184
34303
|
let truncated = false;
|
|
34185
34304
|
const walk2 = (dir, prefix) => {
|
|
34186
34305
|
let entries;
|
|
34187
34306
|
try {
|
|
34188
|
-
entries = (0,
|
|
34307
|
+
entries = (0, import_node_fs27.readdirSync)(dir, { withFileTypes: true });
|
|
34189
34308
|
} catch {
|
|
34190
34309
|
return;
|
|
34191
34310
|
}
|
|
@@ -34197,7 +34316,7 @@ function listMetroAssetDest(assetsPath) {
|
|
|
34197
34316
|
if (entry.isDirectory()) {
|
|
34198
34317
|
if (entry.name === ".git") continue;
|
|
34199
34318
|
if (skipNested && PROJECT_ONLY_DIRECTORIES.has(entry.name)) continue;
|
|
34200
|
-
walk2((0,
|
|
34319
|
+
walk2((0, import_node_path28.join)(dir, entry.name), prefix ? `${prefix}/${entry.name}` : entry.name);
|
|
34201
34320
|
} else if (entry.isFile()) {
|
|
34202
34321
|
files.push(prefix ? `${prefix}/${entry.name}` : entry.name);
|
|
34203
34322
|
}
|
|
@@ -34207,7 +34326,7 @@ function listMetroAssetDest(assetsPath) {
|
|
|
34207
34326
|
return { directory, files, truncated };
|
|
34208
34327
|
}
|
|
34209
34328
|
function metroDescriptorHash(scaleBytes) {
|
|
34210
|
-
const hasher = (0,
|
|
34329
|
+
const hasher = (0, import_node_crypto13.createHash)("md5");
|
|
34211
34330
|
for (const bytes of scaleBytes) hasher.update(bytes);
|
|
34212
34331
|
return hasher.digest("hex");
|
|
34213
34332
|
}
|
|
@@ -34232,11 +34351,11 @@ function distinctByContent(directory, options) {
|
|
|
34232
34351
|
for (const relative3 of options) {
|
|
34233
34352
|
let bytes;
|
|
34234
34353
|
try {
|
|
34235
|
-
bytes = (0,
|
|
34354
|
+
bytes = (0, import_node_fs27.readFileSync)((0, import_node_path28.join)(directory, relative3));
|
|
34236
34355
|
} catch {
|
|
34237
34356
|
continue;
|
|
34238
34357
|
}
|
|
34239
|
-
const digest = (0,
|
|
34358
|
+
const digest = (0, import_node_crypto13.createHash)("md5").update(bytes).digest("hex");
|
|
34240
34359
|
if (!byContent.has(digest)) byContent.set(digest, relative3);
|
|
34241
34360
|
}
|
|
34242
34361
|
return [...byContent.values()];
|
|
@@ -34264,13 +34383,13 @@ function placeMetroDescriptor(listing, descriptor) {
|
|
|
34264
34383
|
let bytes;
|
|
34265
34384
|
try {
|
|
34266
34385
|
bytes = combination.map(
|
|
34267
|
-
(relative3) => (0,
|
|
34386
|
+
(relative3) => (0, import_node_fs27.readFileSync)((0, import_node_path28.join)(listing.directory, relative3))
|
|
34268
34387
|
);
|
|
34269
34388
|
} catch {
|
|
34270
34389
|
continue;
|
|
34271
34390
|
}
|
|
34272
34391
|
const identical = fileHashes ? bytes.every((file, index) => {
|
|
34273
|
-
const digest = (0,
|
|
34392
|
+
const digest = (0, import_node_crypto13.createHash)("md5").update(file).digest("hex");
|
|
34274
34393
|
return descriptor.scales.some(
|
|
34275
34394
|
(scale, declared) => scale === scales[index] && fileHashes[declared] === digest
|
|
34276
34395
|
);
|
|
@@ -34292,10 +34411,10 @@ function unverifiedContentKey(dest, fileDigests) {
|
|
|
34292
34411
|
return JSON.stringify(
|
|
34293
34412
|
dest.placements.map(
|
|
34294
34413
|
(placement) => placement.verified ? null : [...placement.files].map(([scale, relative3]) => {
|
|
34295
|
-
const file = (0,
|
|
34414
|
+
const file = (0, import_node_path28.join)(dest.directory, relative3);
|
|
34296
34415
|
let digest = fileDigests.get(file);
|
|
34297
34416
|
if (digest === void 0) {
|
|
34298
|
-
digest = (0,
|
|
34417
|
+
digest = (0, import_node_crypto13.createHash)("sha256").update((0, import_node_fs27.readFileSync)(file)).digest("hex");
|
|
34299
34418
|
fileDigests.set(file, digest);
|
|
34300
34419
|
}
|
|
34301
34420
|
return [scale, digest];
|
|
@@ -34304,22 +34423,22 @@ function unverifiedContentKey(dest, fileDigests) {
|
|
|
34304
34423
|
);
|
|
34305
34424
|
}
|
|
34306
34425
|
function searchMetroAssetDest(bundlePath, descriptors) {
|
|
34307
|
-
const bundleDirectory = (0,
|
|
34426
|
+
const bundleDirectory = (0, import_node_path28.dirname)((0, import_node_path28.resolve)(bundlePath));
|
|
34308
34427
|
const candidates = [
|
|
34309
|
-
(0,
|
|
34428
|
+
(0, import_node_path28.join)(bundleDirectory, "assets"),
|
|
34310
34429
|
bundleDirectory,
|
|
34311
|
-
(0,
|
|
34430
|
+
(0, import_node_path28.resolve)(bundleDirectory, "..", "assets")
|
|
34312
34431
|
];
|
|
34313
34432
|
const cwd = process.cwd();
|
|
34314
34433
|
let projectDirectory = null;
|
|
34315
34434
|
for (const start of [bundleDirectory, cwd]) {
|
|
34316
|
-
let directory = (0,
|
|
34435
|
+
let directory = (0, import_node_path28.resolve)(start);
|
|
34317
34436
|
while (true) {
|
|
34318
34437
|
if (detectProject(directory)?.hasMetroConfig) {
|
|
34319
34438
|
projectDirectory = directory;
|
|
34320
34439
|
break;
|
|
34321
34440
|
}
|
|
34322
|
-
const parent = (0,
|
|
34441
|
+
const parent = (0, import_node_path28.dirname)(directory);
|
|
34323
34442
|
if (parent === directory) break;
|
|
34324
34443
|
directory = parent;
|
|
34325
34444
|
}
|
|
@@ -34327,11 +34446,11 @@ function searchMetroAssetDest(bundlePath, descriptors) {
|
|
|
34327
34446
|
}
|
|
34328
34447
|
if (projectDirectory) {
|
|
34329
34448
|
candidates.push(
|
|
34330
|
-
(0,
|
|
34331
|
-
(0,
|
|
34332
|
-
(0,
|
|
34333
|
-
(0,
|
|
34334
|
-
(0,
|
|
34449
|
+
(0, import_node_path28.join)(projectDirectory, "assets"),
|
|
34450
|
+
(0, import_node_path28.join)(projectDirectory, "dist"),
|
|
34451
|
+
(0, import_node_path28.join)(projectDirectory, "dist", "assets"),
|
|
34452
|
+
(0, import_node_path28.join)(projectDirectory, "build"),
|
|
34453
|
+
(0, import_node_path28.join)(projectDirectory, "build", "assets")
|
|
34335
34454
|
);
|
|
34336
34455
|
}
|
|
34337
34456
|
const searched = [];
|
|
@@ -34339,7 +34458,7 @@ function searchMetroAssetDest(bundlePath, descriptors) {
|
|
|
34339
34458
|
const stale = [];
|
|
34340
34459
|
let truncated = false;
|
|
34341
34460
|
for (const candidate of candidates) {
|
|
34342
|
-
const directory = (0,
|
|
34461
|
+
const directory = (0, import_node_path28.resolve)(candidate);
|
|
34343
34462
|
if (searched.includes(directory)) continue;
|
|
34344
34463
|
searched.push(directory);
|
|
34345
34464
|
const listing = listMetroAssetDest(directory);
|
|
@@ -34448,7 +34567,7 @@ async function embedBundleAssets(bundlePath, command, assetPolicy) {
|
|
|
34448
34567
|
);
|
|
34449
34568
|
}
|
|
34450
34569
|
const relative3 = placement?.files.get(variant.scale);
|
|
34451
|
-
if (relative3 && dest) return (0,
|
|
34570
|
+
if (relative3 && dest) return (0, import_node_fs27.readFileSync)((0, import_node_path28.join)(dest.directory, relative3));
|
|
34452
34571
|
if (placement && placement.files.size > 0) return null;
|
|
34453
34572
|
if (placement && placement.ambiguous.length > 0 && dest) {
|
|
34454
34573
|
throw new Error(
|
|
@@ -34477,7 +34596,7 @@ async function embedBundleAssets(bundlePath, command, assetPolicy) {
|
|
|
34477
34596
|
);
|
|
34478
34597
|
const classic = metroIosAssetDestRelatives(variant.descriptor.httpServerLocation, filename)[0] ?? filename;
|
|
34479
34598
|
throw new Error(
|
|
34480
|
-
`${command} could not read ${(0,
|
|
34599
|
+
`${command} could not read ${(0, import_node_path28.join)(dest?.directory ?? ".", classic)} for ${variant.descriptor.name}.${variant.descriptor.type} at scale ${variant.scale}, and has no stand-in for a .${variant.descriptor.type} asset. Rebuild with \`react-native bundle --assets-dest\`.`
|
|
34481
34600
|
);
|
|
34482
34601
|
});
|
|
34483
34602
|
return {
|
|
@@ -34518,7 +34637,7 @@ async function produceArtifact(bundlePath, maxBytes, command, assetPolicy) {
|
|
|
34518
34637
|
}
|
|
34519
34638
|
return {
|
|
34520
34639
|
bytes,
|
|
34521
|
-
sha256: (0,
|
|
34640
|
+
sha256: (0, import_node_crypto13.createHash)("sha256").update(bytes).digest("hex"),
|
|
34522
34641
|
receipt: artifact.receipt,
|
|
34523
34642
|
assetsDirectory: prepared.dest?.directory ?? null,
|
|
34524
34643
|
warnings
|
|
@@ -34663,13 +34782,13 @@ function createCloudBridgeForParsed(parsed) {
|
|
|
34663
34782
|
if (!session) return null;
|
|
34664
34783
|
return session.service === "box" ? new CloudBoxBridge(session) : new CloudBridge(session);
|
|
34665
34784
|
}
|
|
34666
|
-
var
|
|
34785
|
+
var import_node_crypto13, import_node_fs27, import_node_path28, DEFAULT_RNX_CLOUD_ORIGIN, MAX_RNX_CLOUD_BUNDLE_BYTES, REMOTE_COMMAND, MAX_ASSET_DEST_FILES, ACCOUNT_CHOICE_REFUSALS, PROJECT_ONLY_DIRECTORIES, MAX_PLACEMENT_COMBINATIONS, CloudBridge, CloudBoxBridge;
|
|
34667
34786
|
var init_cloud_client = __esm({
|
|
34668
34787
|
"cli/cloud-client.ts"() {
|
|
34669
34788
|
"use strict";
|
|
34670
|
-
|
|
34671
|
-
|
|
34672
|
-
|
|
34789
|
+
import_node_crypto13 = require("node:crypto");
|
|
34790
|
+
import_node_fs27 = require("node:fs");
|
|
34791
|
+
import_node_path28 = require("node:path");
|
|
34673
34792
|
init_metroAssetArtifact();
|
|
34674
34793
|
init_metroCloudArtifact();
|
|
34675
34794
|
init_metro_fingerprint_registry_client();
|
|
@@ -34709,7 +34828,7 @@ var init_cloud_client = __esm({
|
|
|
34709
34828
|
plane = "cloud";
|
|
34710
34829
|
async send(command, options) {
|
|
34711
34830
|
const body = {
|
|
34712
|
-
id: (0,
|
|
34831
|
+
id: (0, import_node_crypto13.randomUUID)(),
|
|
34713
34832
|
claimId: this.session.claimId,
|
|
34714
34833
|
command: cloudCommand(command)
|
|
34715
34834
|
};
|
|
@@ -34779,7 +34898,7 @@ var init_cloud_client = __esm({
|
|
|
34779
34898
|
}
|
|
34780
34899
|
plane = "cloud";
|
|
34781
34900
|
async send(command, options) {
|
|
34782
|
-
const id = (0,
|
|
34901
|
+
const id = (0, import_node_crypto13.randomUUID)();
|
|
34783
34902
|
const payload = {};
|
|
34784
34903
|
for (const [key, value] of Object.entries(command)) {
|
|
34785
34904
|
if (key !== "id" && key !== "simId") payload[key] = value;
|
|
@@ -37181,31 +37300,31 @@ var init_parent_pid = __esm({
|
|
|
37181
37300
|
|
|
37182
37301
|
// cli/secure-file.ts
|
|
37183
37302
|
function writeSecureJsonAtomic(filepath, value) {
|
|
37184
|
-
(0,
|
|
37185
|
-
const temporary = `${filepath}.tmp-${process.pid}-${(0,
|
|
37303
|
+
(0, import_node_fs28.mkdirSync)((0, import_node_path29.dirname)(filepath), { recursive: true });
|
|
37304
|
+
const temporary = `${filepath}.tmp-${process.pid}-${(0, import_node_crypto14.randomUUID)()}`;
|
|
37186
37305
|
let descriptor = null;
|
|
37187
37306
|
try {
|
|
37188
|
-
descriptor = (0,
|
|
37189
|
-
(0,
|
|
37190
|
-
(0,
|
|
37307
|
+
descriptor = (0, import_node_fs28.openSync)(temporary, "wx", 384);
|
|
37308
|
+
(0, import_node_fs28.fchmodSync)(descriptor, 384);
|
|
37309
|
+
(0, import_node_fs28.writeFileSync)(descriptor, `${JSON.stringify(value, null, 2)}
|
|
37191
37310
|
`);
|
|
37192
|
-
(0,
|
|
37193
|
-
(0,
|
|
37311
|
+
(0, import_node_fs28.fsyncSync)(descriptor);
|
|
37312
|
+
(0, import_node_fs28.closeSync)(descriptor);
|
|
37194
37313
|
descriptor = null;
|
|
37195
|
-
(0,
|
|
37314
|
+
(0, import_node_fs28.renameSync)(temporary, filepath);
|
|
37196
37315
|
} catch (error) {
|
|
37197
|
-
if (descriptor !== null) (0,
|
|
37198
|
-
(0,
|
|
37316
|
+
if (descriptor !== null) (0, import_node_fs28.closeSync)(descriptor);
|
|
37317
|
+
(0, import_node_fs28.rmSync)(temporary, { force: true });
|
|
37199
37318
|
throw error;
|
|
37200
37319
|
}
|
|
37201
37320
|
}
|
|
37202
|
-
var
|
|
37321
|
+
var import_node_crypto14, import_node_fs28, import_node_path29;
|
|
37203
37322
|
var init_secure_file = __esm({
|
|
37204
37323
|
"cli/secure-file.ts"() {
|
|
37205
37324
|
"use strict";
|
|
37206
|
-
|
|
37207
|
-
|
|
37208
|
-
|
|
37325
|
+
import_node_crypto14 = require("node:crypto");
|
|
37326
|
+
import_node_fs28 = require("node:fs");
|
|
37327
|
+
import_node_path29 = require("node:path");
|
|
37209
37328
|
}
|
|
37210
37329
|
});
|
|
37211
37330
|
|
|
@@ -37390,17 +37509,17 @@ function liveDevBridgeLockfiles() {
|
|
|
37390
37509
|
return readDevBridgeLockfiles().filter((lockfile) => isDevBridgeLockfileFresh(lockfile));
|
|
37391
37510
|
}
|
|
37392
37511
|
function checkoutRoot(cwd) {
|
|
37393
|
-
let current =
|
|
37512
|
+
let current = import_node_path30.default.resolve(cwd);
|
|
37394
37513
|
while (true) {
|
|
37395
|
-
if (
|
|
37396
|
-
const parent =
|
|
37514
|
+
if (import_node_fs29.default.existsSync(import_node_path30.default.join(current, ".git"))) return current;
|
|
37515
|
+
const parent = import_node_path30.default.dirname(current);
|
|
37397
37516
|
if (parent === current) return null;
|
|
37398
37517
|
current = parent;
|
|
37399
37518
|
}
|
|
37400
37519
|
}
|
|
37401
37520
|
function pathContains(parent, child) {
|
|
37402
|
-
const relative3 =
|
|
37403
|
-
return relative3 === "" || relative3 !== ".." && !relative3.startsWith(`..${
|
|
37521
|
+
const relative3 = import_node_path30.default.relative(parent, child);
|
|
37522
|
+
return relative3 === "" || relative3 !== ".." && !relative3.startsWith(`..${import_node_path30.default.sep}`) && !import_node_path30.default.isAbsolute(relative3);
|
|
37404
37523
|
}
|
|
37405
37524
|
function resolveDefaultDevBridgeLockfile() {
|
|
37406
37525
|
const lockfiles = liveDevBridgeLockfiles();
|
|
@@ -37900,18 +38019,18 @@ async function evalInBridge(bridge, code, opts = {}) {
|
|
|
37900
38019
|
if (opts.acquireLock) payload.acquireLock = true;
|
|
37901
38020
|
return bridge.send(payload);
|
|
37902
38021
|
}
|
|
37903
|
-
async function callInBridge(bridge,
|
|
37904
|
-
return bridge.send({ type: "call", path:
|
|
38022
|
+
async function callInBridge(bridge, path36, ...args) {
|
|
38023
|
+
return bridge.send({ type: "call", path: path36, args });
|
|
37905
38024
|
}
|
|
37906
|
-
async function callInBridgeWrite(bridge,
|
|
37907
|
-
return bridge.send({ type: "call", path:
|
|
38025
|
+
async function callInBridgeWrite(bridge, path36, ...args) {
|
|
38026
|
+
return bridge.send({ type: "call", path: path36, args, acquireLock: true });
|
|
37908
38027
|
}
|
|
37909
|
-
var
|
|
38028
|
+
var import_node_fs29, import_node_path30, import_ws2, PEACH_PLACEMENT_ENV, resolvedWorld, BridgeSimLockedError, BRIDGE_VALUE_FLAGS_TABLE, BRIDGE_VALUE_FLAGS;
|
|
37910
38029
|
var init_ws_bridge = __esm({
|
|
37911
38030
|
"cli/ws-bridge.ts"() {
|
|
37912
38031
|
"use strict";
|
|
37913
|
-
|
|
37914
|
-
|
|
38032
|
+
import_node_fs29 = __toESM(require("node:fs"), 1);
|
|
38033
|
+
import_node_path30 = __toESM(require("node:path"), 1);
|
|
37915
38034
|
import_ws2 = require("ws");
|
|
37916
38035
|
init_bridge_constants();
|
|
37917
38036
|
init_cli_constants();
|
|
@@ -38039,8 +38158,8 @@ function getDefaultPortForProtocol(protocol) {
|
|
|
38039
38158
|
return protocol === "https:" ? 443 : 80;
|
|
38040
38159
|
}
|
|
38041
38160
|
function isBaseServerUrl(url) {
|
|
38042
|
-
const
|
|
38043
|
-
return (
|
|
38161
|
+
const path36 = url.pathname || "/";
|
|
38162
|
+
return (path36 === "/" || path36 === "") && !url.search && !url.hash;
|
|
38044
38163
|
}
|
|
38045
38164
|
async function resolvePortViaServerScan(port) {
|
|
38046
38165
|
try {
|
|
@@ -38204,8 +38323,8 @@ var init_dev_bundle_resolution = __esm({
|
|
|
38204
38323
|
|
|
38205
38324
|
// src/dot-env.ts
|
|
38206
38325
|
function selectEnvFile(env, notices) {
|
|
38207
|
-
if (
|
|
38208
|
-
return { name:
|
|
38326
|
+
if (import_node_fs30.default.existsSync("/tmp/envfile")) {
|
|
38327
|
+
return { name: import_node_fs30.default.readFileSync("/tmp/envfile", "utf8").trim(), fromEnvfile: false };
|
|
38209
38328
|
}
|
|
38210
38329
|
const requested = env.ENVFILE;
|
|
38211
38330
|
if (!requested) return { name: DEFAULT_ENV_FILE, fromEnvfile: false };
|
|
@@ -38268,16 +38387,16 @@ function readProjectDotEnv(envsRoot, env = process.env) {
|
|
|
38268
38387
|
const notices = [];
|
|
38269
38388
|
const selection = selectEnvFile(env, notices);
|
|
38270
38389
|
const requestedPaths = [
|
|
38271
|
-
|
|
38272
|
-
|
|
38390
|
+
import_node_path31.default.resolve(import_node_path31.default.join(envsRoot, selection.name)),
|
|
38391
|
+
import_node_path31.default.resolve(selection.name)
|
|
38273
38392
|
];
|
|
38274
38393
|
const candidates = [
|
|
38275
38394
|
...requestedPaths,
|
|
38276
|
-
|
|
38395
|
+
import_node_path31.default.resolve(import_node_path31.default.join(envsRoot, DEFAULT_ENV_FILE))
|
|
38277
38396
|
];
|
|
38278
|
-
if (!
|
|
38397
|
+
if (!import_node_fs30.default.existsSync(candidates[2])) candidates.push(import_node_path31.default.resolve(DEFAULT_ENV_FILE));
|
|
38279
38398
|
const tried = [...new Set(candidates)];
|
|
38280
|
-
const resolved = tried.find((candidate) =>
|
|
38399
|
+
const resolved = tried.find((candidate) => import_node_fs30.default.existsSync(candidate));
|
|
38281
38400
|
if (!resolved) {
|
|
38282
38401
|
notices.push(
|
|
38283
38402
|
"*** Missing .env file ****",
|
|
@@ -38297,7 +38416,7 @@ function readProjectDotEnv(envsRoot, env = process.env) {
|
|
|
38297
38416
|
);
|
|
38298
38417
|
}
|
|
38299
38418
|
const config = {};
|
|
38300
|
-
for (const line of
|
|
38419
|
+
for (const line of import_node_fs30.default.readFileSync(resolved, "utf8").split("\n")) {
|
|
38301
38420
|
if (!line.trim()) continue;
|
|
38302
38421
|
if (/^[ \t\n\v\f\r]*#/.test(line)) continue;
|
|
38303
38422
|
const match = DOTENV_PATTERN.exec(line);
|
|
@@ -38307,12 +38426,12 @@ function readProjectDotEnv(envsRoot, env = process.env) {
|
|
|
38307
38426
|
}
|
|
38308
38427
|
return { config, notices };
|
|
38309
38428
|
}
|
|
38310
|
-
var
|
|
38429
|
+
var import_node_fs30, import_node_path31, DEFAULT_ENV_FILE, DOTENV_PATTERN, BUILD_SETTING_PATTERN, INVALID_ENTRY;
|
|
38311
38430
|
var init_dot_env = __esm({
|
|
38312
38431
|
"src/dot-env.ts"() {
|
|
38313
38432
|
"use strict";
|
|
38314
|
-
|
|
38315
|
-
|
|
38433
|
+
import_node_fs30 = __toESM(require("node:fs"), 1);
|
|
38434
|
+
import_node_path31 = __toESM(require("node:path"), 1);
|
|
38316
38435
|
DEFAULT_ENV_FILE = ".env";
|
|
38317
38436
|
DOTENV_PATTERN = /^(?:export[ \t\n\v\f\r]+|)(?<key>[\p{Alphabetic}\p{Nd}_]+)[ \t\n\v\f\r]*=[ \t\n\v\f\r]*((?<quote>["'])?(?<val>[^\n]*?[^\\\n])\k<quote>?|)$/u;
|
|
38318
38437
|
BUILD_SETTING_PATTERN = /\$[({]([A-Za-z_][A-Za-z0-9_]*)[)}]|\$([A-Za-z_][A-Za-z0-9_]*)/g;
|
|
@@ -38336,8 +38455,8 @@ var init_flow_timeout_scale = __esm({
|
|
|
38336
38455
|
function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
38337
38456
|
const result = {};
|
|
38338
38457
|
let config = {};
|
|
38339
|
-
const appJsonPath =
|
|
38340
|
-
const appJson =
|
|
38458
|
+
const appJsonPath = import_node_path32.default.join(projectRoot, "app.json");
|
|
38459
|
+
const appJson = import_node_fs31.default.existsSync(appJsonPath) ? JSON.parse(import_node_fs31.default.readFileSync(appJsonPath, "utf8")) : null;
|
|
38341
38460
|
const staticExpo = isRecord(appJson) && (isRecord(appJson.expo) || [appJson.ios, appJson.android].some(
|
|
38342
38461
|
(value) => isRecord(value) && typeof value.googleServicesFile === "string"
|
|
38343
38462
|
));
|
|
@@ -38346,9 +38465,9 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
38346
38465
|
"app.config.ts",
|
|
38347
38466
|
"app.config.cjs",
|
|
38348
38467
|
"app.config.mjs"
|
|
38349
|
-
].some((name2) =>
|
|
38468
|
+
].some((name2) => import_node_fs31.default.existsSync(import_node_path32.default.join(projectRoot, name2)));
|
|
38350
38469
|
if (staticExpo || dynamicExpo) {
|
|
38351
|
-
const require5 = (0, import_node_module2.createRequire)(
|
|
38470
|
+
const require5 = (0, import_node_module2.createRequire)(import_node_path32.default.join(projectRoot, "package.json"));
|
|
38352
38471
|
const configModule = require5("@expo/config");
|
|
38353
38472
|
if (!isRecord(configModule) || typeof configModule.getConfig !== "function")
|
|
38354
38473
|
throw new Error("Expo native configuration is unavailable.");
|
|
@@ -38360,23 +38479,23 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
38360
38479
|
}
|
|
38361
38480
|
const ios = config.ios;
|
|
38362
38481
|
if (platforms.includes("ios") && (!isRecord(ios) || typeof ios.googleServicesFile !== "string")) {
|
|
38363
|
-
const iosRoot =
|
|
38364
|
-
if (
|
|
38365
|
-
const projects2 =
|
|
38482
|
+
const iosRoot = import_node_path32.default.join(projectRoot, "ios");
|
|
38483
|
+
if (import_node_fs31.default.existsSync(iosRoot)) {
|
|
38484
|
+
const projects2 = import_node_fs31.default.readdirSync(iosRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory() && entry.name.endsWith(".xcodeproj"));
|
|
38366
38485
|
if (projects2.length > 1)
|
|
38367
38486
|
throw new Error("native Firebase configuration requires a selected Xcode project");
|
|
38368
38487
|
if (projects2.length === 1) {
|
|
38369
|
-
const xcodeproj =
|
|
38488
|
+
const xcodeproj = import_node_path32.default.join(iosRoot, projects2[0].name);
|
|
38370
38489
|
const appTargets = listXcodeAppTargets(xcodeproj);
|
|
38371
38490
|
if (appTargets.length > 1)
|
|
38372
38491
|
throw new Error("native Firebase configuration requires a selected app target");
|
|
38373
38492
|
if (appTargets.length === 1) {
|
|
38374
38493
|
const app = readXcodeAppTarget(xcodeproj, appTargets[0]);
|
|
38375
38494
|
const delegates = app.allSources.filter(
|
|
38376
|
-
(file) => /^AppDelegate\.(swift|mm|m)$/.test(
|
|
38495
|
+
(file) => /^AppDelegate\.(swift|mm|m)$/.test(import_node_path32.default.basename(file))
|
|
38377
38496
|
);
|
|
38378
38497
|
const defaultConfigured = delegates.some((file) => {
|
|
38379
|
-
const source =
|
|
38498
|
+
const source = import_node_fs31.default.readFileSync(file, "utf8").replace(
|
|
38380
38499
|
/\/\*[\s\S]*?\*\/|\/\/[^\n]*|"(?:\\.|[^"\\])*"/g,
|
|
38381
38500
|
(token) => token.startsWith('"') ? '""' : token.replace(/[^\n]/g, " ")
|
|
38382
38501
|
);
|
|
@@ -38404,15 +38523,15 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
38404
38523
|
});
|
|
38405
38524
|
if (defaultConfigured) {
|
|
38406
38525
|
const resources = app.resources.filter(
|
|
38407
|
-
(file) => /^GoogleService-Info\.plist$/.test(
|
|
38526
|
+
(file) => /^GoogleService-Info\.plist$/.test(import_node_path32.default.basename(file))
|
|
38408
38527
|
);
|
|
38409
38528
|
if (resources.length !== 1)
|
|
38410
38529
|
throw new Error(
|
|
38411
38530
|
"native Firebase default initialization requires one GoogleService-Info.plist build resource"
|
|
38412
38531
|
);
|
|
38413
38532
|
config.ios = {
|
|
38414
|
-
googleServicesFile:
|
|
38415
|
-
|
|
38533
|
+
googleServicesFile: import_node_path32.default.relative(
|
|
38534
|
+
import_node_fs31.default.realpathSync(projectRoot),
|
|
38416
38535
|
resources[0]
|
|
38417
38536
|
)
|
|
38418
38537
|
};
|
|
@@ -38425,8 +38544,8 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
38425
38544
|
const native = config[platform];
|
|
38426
38545
|
if (!isRecord(native) || typeof native.googleServicesFile !== "string") continue;
|
|
38427
38546
|
try {
|
|
38428
|
-
const source =
|
|
38429
|
-
|
|
38547
|
+
const source = import_node_fs31.default.readFileSync(
|
|
38548
|
+
import_node_path32.default.resolve(projectRoot, native.googleServicesFile),
|
|
38430
38549
|
"utf8"
|
|
38431
38550
|
);
|
|
38432
38551
|
const parsed = platform === "ios" ? parsePlistSource(source) : JSON.parse(source);
|
|
@@ -38478,13 +38597,13 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
38478
38597
|
}
|
|
38479
38598
|
return result;
|
|
38480
38599
|
}
|
|
38481
|
-
var
|
|
38600
|
+
var import_node_fs31, import_node_module2, import_node_path32;
|
|
38482
38601
|
var init_native_firebase_config = __esm({
|
|
38483
38602
|
"src/native-firebase-config.ts"() {
|
|
38484
38603
|
"use strict";
|
|
38485
|
-
|
|
38604
|
+
import_node_fs31 = __toESM(require("node:fs"), 1);
|
|
38486
38605
|
import_node_module2 = require("node:module");
|
|
38487
|
-
|
|
38606
|
+
import_node_path32 = __toESM(require("node:path"), 1);
|
|
38488
38607
|
init_is_record();
|
|
38489
38608
|
init_plist();
|
|
38490
38609
|
init_xcode_project();
|
|
@@ -38598,59 +38717,59 @@ var init_profiles = __esm({
|
|
|
38598
38717
|
// cli/app-catalog.ts
|
|
38599
38718
|
function listDir(dir) {
|
|
38600
38719
|
try {
|
|
38601
|
-
return
|
|
38720
|
+
return import_node_fs32.default.readdirSync(dir, { withFileTypes: true });
|
|
38602
38721
|
} catch {
|
|
38603
38722
|
return [];
|
|
38604
38723
|
}
|
|
38605
38724
|
}
|
|
38606
38725
|
function readText(file) {
|
|
38607
38726
|
try {
|
|
38608
|
-
return
|
|
38727
|
+
return import_node_fs32.default.readFileSync(file, "utf8");
|
|
38609
38728
|
} catch {
|
|
38610
38729
|
return null;
|
|
38611
38730
|
}
|
|
38612
38731
|
}
|
|
38613
38732
|
function catalogFiles(dir, found) {
|
|
38614
38733
|
for (const entry of listDir(dir)) {
|
|
38615
|
-
const full =
|
|
38734
|
+
const full = import_node_path33.default.join(dir, entry.name);
|
|
38616
38735
|
if (entry.isDirectory()) catalogFiles(full, found);
|
|
38617
38736
|
else if (entry.name === "Contents.json") found.push(full);
|
|
38618
38737
|
}
|
|
38619
38738
|
}
|
|
38620
38739
|
function discoverAppCatalog(appDir) {
|
|
38621
|
-
const iosDir =
|
|
38740
|
+
const iosDir = import_node_path33.default.join(appDir, "ios");
|
|
38622
38741
|
const target = listDir(iosDir).find(
|
|
38623
|
-
(entry) => entry.isDirectory() && entry.name !== "Pods" && listDir(
|
|
38742
|
+
(entry) => entry.isDirectory() && entry.name !== "Pods" && listDir(import_node_path33.default.join(iosDir, entry.name)).some(
|
|
38624
38743
|
(file) => /^AppDelegate\.(swift|mm|m)$/.test(file.name)
|
|
38625
38744
|
)
|
|
38626
38745
|
);
|
|
38627
38746
|
if (!target) return null;
|
|
38628
|
-
const targetDir =
|
|
38747
|
+
const targetDir = import_node_path33.default.join(iosDir, target.name);
|
|
38629
38748
|
const files = [];
|
|
38630
38749
|
for (const entry of listDir(targetDir)) {
|
|
38631
38750
|
if (entry.isDirectory() && entry.name.endsWith(".xcassets"))
|
|
38632
|
-
catalogFiles(
|
|
38751
|
+
catalogFiles(import_node_path33.default.join(targetDir, entry.name), files);
|
|
38633
38752
|
}
|
|
38634
38753
|
const relative3 = files.map(
|
|
38635
|
-
(file) =>
|
|
38754
|
+
(file) => import_node_path33.default.relative(targetDir, file).split(import_node_path33.default.sep).join(import_node_path33.default.posix.sep)
|
|
38636
38755
|
);
|
|
38637
38756
|
const colors = enumerateBundleColors(
|
|
38638
38757
|
relative3,
|
|
38639
|
-
(candidate) => candidate.endsWith("Contents.json") ? readText(
|
|
38758
|
+
(candidate) => candidate.endsWith("Contents.json") ? readText(import_node_path33.default.join(targetDir, candidate)) : null
|
|
38640
38759
|
);
|
|
38641
38760
|
const pbxproj = listDir(iosDir).find((entry) => entry.name.endsWith(".xcodeproj"));
|
|
38642
|
-
const accentName = readText(
|
|
38761
|
+
const accentName = readText(import_node_path33.default.join(targetDir, "Info.plist"))?.match(PLIST_ACCENT)?.[1] ?? (pbxproj ? readText(import_node_path33.default.join(iosDir, pbxproj.name, "project.pbxproj"))?.match(
|
|
38643
38762
|
ACCENT_BUILD_SETTING
|
|
38644
38763
|
)?.[1] : void 0) ?? null;
|
|
38645
38764
|
if (accentName === null && Object.keys(colors).length === 0) return null;
|
|
38646
38765
|
return { colors, accentName };
|
|
38647
38766
|
}
|
|
38648
|
-
var
|
|
38767
|
+
var import_node_fs32, import_node_path33, ACCENT_BUILD_SETTING, PLIST_ACCENT;
|
|
38649
38768
|
var init_app_catalog = __esm({
|
|
38650
38769
|
"cli/app-catalog.ts"() {
|
|
38651
38770
|
"use strict";
|
|
38652
|
-
|
|
38653
|
-
|
|
38771
|
+
import_node_fs32 = __toESM(require("node:fs"), 1);
|
|
38772
|
+
import_node_path33 = __toESM(require("node:path"), 1);
|
|
38654
38773
|
init_bundleAssets();
|
|
38655
38774
|
ACCENT_BUILD_SETTING = /ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = "?([^";]+)"?;/;
|
|
38656
38775
|
PLIST_ACCENT = /<key>NSAccentColorName<\/key>\s*<string>([^<]+)<\/string>/;
|
|
@@ -38660,9 +38779,9 @@ var init_app_catalog = __esm({
|
|
|
38660
38779
|
// cli/app-project.ts
|
|
38661
38780
|
function firstNamedFile(dir, names) {
|
|
38662
38781
|
for (const name2 of names) {
|
|
38663
|
-
const candidate =
|
|
38782
|
+
const candidate = import_node_path34.default.join(dir, name2);
|
|
38664
38783
|
try {
|
|
38665
|
-
if (
|
|
38784
|
+
if (import_node_fs33.default.statSync(candidate).isFile()) return candidate;
|
|
38666
38785
|
} catch {
|
|
38667
38786
|
}
|
|
38668
38787
|
}
|
|
@@ -38675,24 +38794,24 @@ function findRNXAppConfig(dir) {
|
|
|
38675
38794
|
return firstNamedFile(dir, PEACH_APP_CONFIG_NAMES);
|
|
38676
38795
|
}
|
|
38677
38796
|
function resolveAppProject(projectRoot) {
|
|
38678
|
-
const appDir =
|
|
38797
|
+
const appDir = import_node_path34.default.resolve(projectRoot);
|
|
38679
38798
|
try {
|
|
38680
|
-
if (!
|
|
38799
|
+
if (!import_node_fs33.default.statSync(appDir).isDirectory()) return null;
|
|
38681
38800
|
} catch {
|
|
38682
38801
|
return null;
|
|
38683
38802
|
}
|
|
38684
38803
|
const configPath = findRNXAppConfig(appDir);
|
|
38685
|
-
if (!configPath && !findExpoAppConfig(appDir) && !
|
|
38804
|
+
if (!configPath && !findExpoAppConfig(appDir) && !import_node_fs33.default.existsSync(import_node_path34.default.join(appDir, "package.json"))) {
|
|
38686
38805
|
return null;
|
|
38687
38806
|
}
|
|
38688
38807
|
return { appDir, configPath };
|
|
38689
38808
|
}
|
|
38690
|
-
var
|
|
38809
|
+
var import_node_fs33, import_node_path34, EXPO_APP_CONFIG_NAMES, PEACH_APP_CONFIG_NAMES;
|
|
38691
38810
|
var init_app_project = __esm({
|
|
38692
38811
|
"cli/app-project.ts"() {
|
|
38693
38812
|
"use strict";
|
|
38694
|
-
|
|
38695
|
-
|
|
38813
|
+
import_node_fs33 = __toESM(require("node:fs"), 1);
|
|
38814
|
+
import_node_path34 = __toESM(require("node:path"), 1);
|
|
38696
38815
|
EXPO_APP_CONFIG_NAMES = [
|
|
38697
38816
|
"app.config.js",
|
|
38698
38817
|
"app.config.ts",
|
|
@@ -38715,12 +38834,12 @@ function resolveFileEntries(entries, configDir) {
|
|
|
38715
38834
|
return Object.fromEntries(
|
|
38716
38835
|
Object.entries(entries).map(([name2, resolution]) => [
|
|
38717
38836
|
name2,
|
|
38718
|
-
resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file:
|
|
38837
|
+
resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file: import_node_path35.default.resolve(configDir, resolution.file) } : resolution
|
|
38719
38838
|
])
|
|
38720
38839
|
);
|
|
38721
38840
|
}
|
|
38722
38841
|
function resolveConfigReplacementFiles(config, configPath) {
|
|
38723
|
-
const configDir =
|
|
38842
|
+
const configDir = import_node_path35.default.dirname(configPath);
|
|
38724
38843
|
return {
|
|
38725
38844
|
...config,
|
|
38726
38845
|
modules: resolveFileEntries(config.modules, configDir),
|
|
@@ -38757,12 +38876,12 @@ async function resolveRNXAppConfig(startDir = process.cwd()) {
|
|
|
38757
38876
|
const project = resolveAppProject(startDir);
|
|
38758
38877
|
return { project, config: await loadRNXAppConfig(project) };
|
|
38759
38878
|
}
|
|
38760
|
-
var import_node_module3,
|
|
38879
|
+
var import_node_module3, import_node_path35, import_jiti, require2;
|
|
38761
38880
|
var init_app_config = __esm({
|
|
38762
38881
|
"cli/app-config.ts"() {
|
|
38763
38882
|
"use strict";
|
|
38764
38883
|
import_node_module3 = require("node:module");
|
|
38765
|
-
|
|
38884
|
+
import_node_path35 = __toESM(require("node:path"), 1);
|
|
38766
38885
|
import_jiti = require("jiti");
|
|
38767
38886
|
init_config();
|
|
38768
38887
|
init_public_brand();
|
|
@@ -38819,13 +38938,13 @@ function discoverNativeLinkedAppFonts(opts) {
|
|
|
38819
38938
|
scannedFontDirectories++;
|
|
38820
38939
|
let entries;
|
|
38821
38940
|
try {
|
|
38822
|
-
entries =
|
|
38941
|
+
entries = import_node_fs34.default.readdirSync(current.dir, { withFileTypes: true });
|
|
38823
38942
|
} catch {
|
|
38824
38943
|
continue;
|
|
38825
38944
|
}
|
|
38826
38945
|
for (const entry of entries) {
|
|
38827
38946
|
if (entry.isSymbolicLink()) continue;
|
|
38828
|
-
const fullPath =
|
|
38947
|
+
const fullPath = import_node_path36.default.join(current.dir, entry.name);
|
|
38829
38948
|
if (entry.isDirectory()) {
|
|
38830
38949
|
if (current.depth < 4 && pending.length < 64 && !entry.name.startsWith(".")) {
|
|
38831
38950
|
pending.push({ dir: fullPath, depth: current.depth + 1 });
|
|
@@ -38833,15 +38952,15 @@ function discoverNativeLinkedAppFonts(opts) {
|
|
|
38833
38952
|
continue;
|
|
38834
38953
|
}
|
|
38835
38954
|
if (!entry.isFile() || !/\.(ttf|otf|woff|woff2)$/i.test(entry.name)) continue;
|
|
38836
|
-
const relative3 =
|
|
38837
|
-
fontPaths.push(
|
|
38955
|
+
const relative3 = import_node_path36.default.relative(root, fullPath).split(import_node_path36.default.sep).join("/");
|
|
38956
|
+
fontPaths.push(import_node_path36.default.posix.join(metroPathPrefix, relative3));
|
|
38838
38957
|
if (fontPaths.length >= 256) break;
|
|
38839
38958
|
}
|
|
38840
38959
|
}
|
|
38841
38960
|
};
|
|
38842
38961
|
try {
|
|
38843
38962
|
const packageJson = JSON.parse(
|
|
38844
|
-
|
|
38963
|
+
import_node_fs34.default.readFileSync(import_node_path36.default.join(selectedAppDir, "package.json"), "utf8")
|
|
38845
38964
|
);
|
|
38846
38965
|
const dependencyNames = /* @__PURE__ */ new Set();
|
|
38847
38966
|
for (const field of ["dependencies", "devDependencies", "optionalDependencies"]) {
|
|
@@ -38856,32 +38975,32 @@ function discoverNativeLinkedAppFonts(opts) {
|
|
|
38856
38975
|
const config = Reflect.get(packageJson, "reactNativeVectorIcons");
|
|
38857
38976
|
const configuredFontDir = config && typeof config === "object" ? Reflect.get(config, "fontDir") : null;
|
|
38858
38977
|
const configuredDir = typeof configuredFontDir === "string" ? configuredFontDir : "rnvi-fonts";
|
|
38859
|
-
const root =
|
|
38860
|
-
const relativeRoot =
|
|
38861
|
-
if (!relativeRoot.startsWith("..") && !
|
|
38862
|
-
collectFontFiles(root, relativeRoot.split(
|
|
38978
|
+
const root = import_node_path36.default.resolve(selectedAppDir, configuredDir);
|
|
38979
|
+
const relativeRoot = import_node_path36.default.relative(selectedAppDir, root);
|
|
38980
|
+
if (!relativeRoot.startsWith("..") && !import_node_path36.default.isAbsolute(relativeRoot)) {
|
|
38981
|
+
collectFontFiles(root, relativeRoot.split(import_node_path36.default.sep).join("/"));
|
|
38863
38982
|
}
|
|
38864
|
-
const bundleDir =
|
|
38865
|
-
const appRelativeDir = bundleDir.split("/").join(
|
|
38983
|
+
const bundleDir = import_node_path36.default.posix.dirname(new URL(opts.bundleUrl).pathname).replace(/^\/+/, "");
|
|
38984
|
+
const appRelativeDir = bundleDir.split("/").join(import_node_path36.default.sep);
|
|
38866
38985
|
const metroRootCandidates = [selectedAppDir];
|
|
38867
|
-
if (bundleDir && selectedAppDir.endsWith(
|
|
38986
|
+
if (bundleDir && selectedAppDir.endsWith(import_node_path36.default.sep + appRelativeDir)) {
|
|
38868
38987
|
metroRootCandidates.push(selectedAppDir.slice(0, -appRelativeDir.length - 1));
|
|
38869
38988
|
}
|
|
38870
|
-
const vectorIconRequire = (0, import_node_module4.createRequire)(
|
|
38989
|
+
const vectorIconRequire = (0, import_node_module4.createRequire)(import_node_path36.default.join(selectedAppDir, "package.json"));
|
|
38871
38990
|
for (const dependencyName of vectorIconDependencies) {
|
|
38872
38991
|
try {
|
|
38873
38992
|
const entryPath = vectorIconRequire.resolve(dependencyName);
|
|
38874
|
-
const dependencyPath = dependencyName.split("/").join(
|
|
38875
|
-
const marker = `${
|
|
38993
|
+
const dependencyPath = dependencyName.split("/").join(import_node_path36.default.sep);
|
|
38994
|
+
const marker = `${import_node_path36.default.sep}node_modules${import_node_path36.default.sep}${dependencyPath}${import_node_path36.default.sep}`;
|
|
38876
38995
|
const markerIndex = entryPath.lastIndexOf(marker);
|
|
38877
38996
|
if (markerIndex === -1) continue;
|
|
38878
38997
|
const packageRoot = entryPath.slice(0, markerIndex + marker.length - 1);
|
|
38879
38998
|
const fontsDir = dependencyName === "react-native-vector-icons" ? "Fonts" : "fonts";
|
|
38880
|
-
const fontsRoot =
|
|
38999
|
+
const fontsRoot = import_node_path36.default.join(packageRoot, fontsDir);
|
|
38881
39000
|
for (const metroRoot of metroRootCandidates) {
|
|
38882
39001
|
collectFontFiles(
|
|
38883
39002
|
fontsRoot,
|
|
38884
|
-
|
|
39003
|
+
import_node_path36.default.relative(metroRoot, fontsRoot).split(import_node_path36.default.sep).join("/")
|
|
38885
39004
|
);
|
|
38886
39005
|
}
|
|
38887
39006
|
} catch {
|
|
@@ -38891,37 +39010,37 @@ function discoverNativeLinkedAppFonts(opts) {
|
|
|
38891
39010
|
} catch {
|
|
38892
39011
|
}
|
|
38893
39012
|
try {
|
|
38894
|
-
const configPath =
|
|
38895
|
-
if (
|
|
38896
|
-
const appConfigRequire = (0, import_node_module4.createRequire)(
|
|
39013
|
+
const configPath = import_node_path36.default.join(selectedAppDir, "react-native.config.js");
|
|
39014
|
+
if (import_node_fs34.default.statSync(configPath).isFile()) {
|
|
39015
|
+
const appConfigRequire = (0, import_node_module4.createRequire)(import_node_path36.default.join(selectedAppDir, "package.json"));
|
|
38897
39016
|
const rnConfig = appConfigRequire(configPath);
|
|
38898
39017
|
const assets2 = rnConfig && typeof rnConfig === "object" ? Reflect.get(rnConfig, "assets") : null;
|
|
38899
39018
|
if (Array.isArray(assets2)) {
|
|
38900
39019
|
for (const assetDir of assets2) {
|
|
38901
39020
|
if (typeof assetDir !== "string") continue;
|
|
38902
|
-
const root =
|
|
38903
|
-
const relativeRoot =
|
|
38904
|
-
if (relativeRoot.startsWith("..") ||
|
|
38905
|
-
collectFontFiles(root, relativeRoot.split(
|
|
39021
|
+
const root = import_node_path36.default.resolve(selectedAppDir, assetDir);
|
|
39022
|
+
const relativeRoot = import_node_path36.default.relative(selectedAppDir, root);
|
|
39023
|
+
if (relativeRoot.startsWith("..") || import_node_path36.default.isAbsolute(relativeRoot)) continue;
|
|
39024
|
+
collectFontFiles(root, relativeRoot.split(import_node_path36.default.sep).join("/"));
|
|
38906
39025
|
}
|
|
38907
39026
|
}
|
|
38908
39027
|
}
|
|
38909
39028
|
} catch {
|
|
38910
39029
|
}
|
|
38911
39030
|
if (platform === "ios") {
|
|
38912
|
-
const iosDir =
|
|
39031
|
+
const iosDir = import_node_path36.default.join(selectedAppDir, "ios");
|
|
38913
39032
|
try {
|
|
38914
|
-
const targetDirs =
|
|
39033
|
+
const targetDirs = import_node_fs34.default.readdirSync(iosDir, { withFileTypes: true }).filter(
|
|
38915
39034
|
(entry) => entry.isDirectory() && !entry.isSymbolicLink() && entry.name !== "Pods" && entry.name !== "build" && !entry.name.startsWith(".")
|
|
38916
39035
|
).slice(0, 64);
|
|
38917
|
-
const plistPaths = [
|
|
39036
|
+
const plistPaths = [import_node_path36.default.join(iosDir, "Info.plist")];
|
|
38918
39037
|
for (const entry of targetDirs) {
|
|
38919
|
-
plistPaths.push(
|
|
39038
|
+
plistPaths.push(import_node_path36.default.join(iosDir, entry.name, "Info.plist"));
|
|
38920
39039
|
}
|
|
38921
39040
|
for (const plistPath of plistPaths) {
|
|
38922
39041
|
let parsed;
|
|
38923
39042
|
try {
|
|
38924
|
-
parsed = parsePlistSource(
|
|
39043
|
+
parsed = parsePlistSource(import_node_fs34.default.readFileSync(plistPath, "utf8"));
|
|
38925
39044
|
} catch {
|
|
38926
39045
|
continue;
|
|
38927
39046
|
}
|
|
@@ -38931,21 +39050,21 @@ function discoverNativeLinkedAppFonts(opts) {
|
|
|
38931
39050
|
for (const declaredFont of declaredFonts) {
|
|
38932
39051
|
if (typeof declaredFont !== "string") continue;
|
|
38933
39052
|
const candidates = [
|
|
38934
|
-
|
|
38935
|
-
|
|
39053
|
+
import_node_path36.default.resolve(import_node_path36.default.dirname(plistPath), declaredFont),
|
|
39054
|
+
import_node_path36.default.resolve(iosDir, declaredFont)
|
|
38936
39055
|
];
|
|
38937
39056
|
const fontPath = candidates.find((candidate) => {
|
|
38938
|
-
const relative3 =
|
|
38939
|
-
if (relative3.startsWith("..") ||
|
|
39057
|
+
const relative3 = import_node_path36.default.relative(selectedAppDir, candidate);
|
|
39058
|
+
if (relative3.startsWith("..") || import_node_path36.default.isAbsolute(relative3)) return false;
|
|
38940
39059
|
try {
|
|
38941
|
-
return
|
|
39060
|
+
return import_node_fs34.default.statSync(candidate).isFile();
|
|
38942
39061
|
} catch {
|
|
38943
39062
|
return false;
|
|
38944
39063
|
}
|
|
38945
39064
|
});
|
|
38946
39065
|
if (!fontPath) continue;
|
|
38947
39066
|
fontPaths.push(
|
|
38948
|
-
|
|
39067
|
+
import_node_path36.default.relative(selectedAppDir, fontPath).split(import_node_path36.default.sep).join("/")
|
|
38949
39068
|
);
|
|
38950
39069
|
}
|
|
38951
39070
|
}
|
|
@@ -38987,13 +39106,13 @@ async function resolveMetroProjectRoot(bundleUrl, opts) {
|
|
|
38987
39106
|
function encodeAppFontsWire(specs) {
|
|
38988
39107
|
return specs.map((spec) => `${encodeURIComponent(spec.url)}::${encodeURIComponent(spec.family)}`).join(",");
|
|
38989
39108
|
}
|
|
38990
|
-
var
|
|
39109
|
+
var import_node_fs34, import_node_module4, import_node_path36, import_config_plugin_fonts, require3;
|
|
38991
39110
|
var init_app_fonts = __esm({
|
|
38992
39111
|
"cli/app-fonts.ts"() {
|
|
38993
39112
|
"use strict";
|
|
38994
|
-
|
|
39113
|
+
import_node_fs34 = __toESM(require("node:fs"), 1);
|
|
38995
39114
|
import_node_module4 = require("node:module");
|
|
38996
|
-
|
|
39115
|
+
import_node_path36 = __toESM(require("node:path"), 1);
|
|
38997
39116
|
import_config_plugin_fonts = require("peach-engine/engine/config-plugin-fonts");
|
|
38998
39117
|
init_dev_server_scanner();
|
|
38999
39118
|
init_backend_origin();
|
|
@@ -39925,7 +40044,7 @@ var init_bridge_diagnostics = __esm({
|
|
|
39925
40044
|
function bundleValue(app, key) {
|
|
39926
40045
|
const read = (0, import_node_child_process12.spawnSync)(
|
|
39927
40046
|
"plutil",
|
|
39928
|
-
["-extract", key, "raw", "-o", "-",
|
|
40047
|
+
["-extract", key, "raw", "-o", "-", import_node_path37.default.join(app, "Contents/Info.plist")],
|
|
39929
40048
|
{ encoding: "utf8" }
|
|
39930
40049
|
);
|
|
39931
40050
|
return read.status === 0 ? read.stdout.trim() : null;
|
|
@@ -39939,12 +40058,12 @@ function placedHostVersion() {
|
|
|
39939
40058
|
function activeDesktopHostApp() {
|
|
39940
40059
|
return placedHostVersion() ? MAC_HOST_APP : null;
|
|
39941
40060
|
}
|
|
39942
|
-
var import_node_child_process12,
|
|
40061
|
+
var import_node_child_process12, import_node_path37, MAC_HOST_APP, HOST_BUNDLE_ID;
|
|
39943
40062
|
var init_desktop_host_delivery = __esm({
|
|
39944
40063
|
"src/desktop-host-delivery.ts"() {
|
|
39945
40064
|
"use strict";
|
|
39946
40065
|
import_node_child_process12 = require("node:child_process");
|
|
39947
|
-
|
|
40066
|
+
import_node_path37 = __toESM(require("node:path"), 1);
|
|
39948
40067
|
init_src();
|
|
39949
40068
|
init_home_paths();
|
|
39950
40069
|
MAC_HOST_APP = "/Applications/Peach.app";
|
|
@@ -41491,8 +41610,8 @@ async function ensureLinuxBrowserLibraries(executablePath, browser) {
|
|
|
41491
41610
|
};
|
|
41492
41611
|
}
|
|
41493
41612
|
const lock = parseLinuxBrowserLibsLock(linux_browser_libs_lock_default);
|
|
41494
|
-
const dir = (0,
|
|
41495
|
-
if (!(0,
|
|
41613
|
+
const dir = (0, import_node_path38.join)(rnxHomeDir(), "linux-libs", `${lock.id}-${arch}`);
|
|
41614
|
+
if (!(0, import_node_fs35.existsSync)((0, import_node_path38.join)(dir, LINUX_BROWSER_LIBS_MARKER))) {
|
|
41496
41615
|
const url = `${DEFAULT_CLI_RELEASE_ORIGIN}/${linuxBrowserLibsKey(lock.id, arch)}`;
|
|
41497
41616
|
process.stderr.write(
|
|
41498
41617
|
`peach: this system lacks ${missing.length} shared libraries ${browser} links; downloading them\u2026
|
|
@@ -41520,7 +41639,7 @@ async function ensureLinuxBrowserLibraries(executablePath, browser) {
|
|
|
41520
41639
|
};
|
|
41521
41640
|
}
|
|
41522
41641
|
}
|
|
41523
|
-
const libraryPath = [(0,
|
|
41642
|
+
const libraryPath = [(0, import_node_path38.join)(dir, "lib"), (0, import_node_path38.join)(dir, "lib", "nss")].join(":");
|
|
41524
41643
|
const stillMissing = missingLibraries(executablePath, libraryPath);
|
|
41525
41644
|
if (stillMissing.length) {
|
|
41526
41645
|
return {
|
|
@@ -41530,13 +41649,13 @@ async function ensureLinuxBrowserLibraries(executablePath, browser) {
|
|
|
41530
41649
|
}
|
|
41531
41650
|
return { ok: true, libraryPath };
|
|
41532
41651
|
}
|
|
41533
|
-
var import_node_child_process13,
|
|
41652
|
+
var import_node_child_process13, import_node_fs35, import_node_path38, LINUX_BROWSER_LIBS_ARCHES, LINUX_BROWSER_LIBS_MARKER;
|
|
41534
41653
|
var init_linux_browser_libs = __esm({
|
|
41535
41654
|
"cli/drivers/linux-browser-libs.ts"() {
|
|
41536
41655
|
"use strict";
|
|
41537
41656
|
import_node_child_process13 = require("node:child_process");
|
|
41538
|
-
|
|
41539
|
-
|
|
41657
|
+
import_node_fs35 = require("node:fs");
|
|
41658
|
+
import_node_path38 = require("node:path");
|
|
41540
41659
|
init_src();
|
|
41541
41660
|
init_home_paths();
|
|
41542
41661
|
init_is_record();
|
|
@@ -41560,13 +41679,13 @@ function resolvePlaywright() {
|
|
|
41560
41679
|
try {
|
|
41561
41680
|
const modulePath = requireFromRoot.resolve(spec);
|
|
41562
41681
|
const packageJsonPath = requireFromRoot.resolve(`${spec}/package.json`);
|
|
41563
|
-
const parsed = JSON.parse((0,
|
|
41682
|
+
const parsed = JSON.parse((0, import_node_fs36.readFileSync)(packageJsonPath, "utf8"));
|
|
41564
41683
|
if (!isRecord(parsed) || typeof parsed.version !== "string") continue;
|
|
41565
41684
|
const corePackagePath = (0, import_node_module6.createRequire)(modulePath).resolve(
|
|
41566
41685
|
"playwright-core/package.json"
|
|
41567
41686
|
);
|
|
41568
|
-
const cliPath = (0,
|
|
41569
|
-
if (!(0,
|
|
41687
|
+
const cliPath = (0, import_node_path39.join)((0, import_node_path39.dirname)(corePackagePath), "cli.js");
|
|
41688
|
+
if (!(0, import_node_fs36.existsSync)(cliPath)) continue;
|
|
41570
41689
|
return {
|
|
41571
41690
|
spec,
|
|
41572
41691
|
modulePath,
|
|
@@ -41594,7 +41713,7 @@ async function provisionPlaywright() {
|
|
|
41594
41713
|
await installVerifiedTarball({
|
|
41595
41714
|
url: `https://registry.npmjs.org/playwright-core/-/playwright-core-${version}.tgz`,
|
|
41596
41715
|
digest: { algorithm, encoding: "base64", value: digest },
|
|
41597
|
-
destDir: (0,
|
|
41716
|
+
destDir: (0, import_node_path39.join)(playwrightCoreDir(version), "node_modules", "playwright-core"),
|
|
41598
41717
|
installedMarker: "package.json",
|
|
41599
41718
|
// npm tarballs hold the package under a leading `package/`
|
|
41600
41719
|
stripComponents: 1,
|
|
@@ -41637,7 +41756,7 @@ function probeBrowser(resolved, env) {
|
|
|
41637
41756
|
return {
|
|
41638
41757
|
ok: true,
|
|
41639
41758
|
executablePath: parsed.executablePath,
|
|
41640
|
-
exists: parsed.exists && (0,
|
|
41759
|
+
exists: parsed.exists && (0, import_node_fs36.existsSync)(parsed.executablePath)
|
|
41641
41760
|
};
|
|
41642
41761
|
} catch (error) {
|
|
41643
41762
|
return {
|
|
@@ -41705,14 +41824,14 @@ ${detail}` : ""}`
|
|
|
41705
41824
|
libraryPath: libraries.libraryPath
|
|
41706
41825
|
};
|
|
41707
41826
|
}
|
|
41708
|
-
var import_node_child_process14,
|
|
41827
|
+
var import_node_child_process14, import_node_fs36, import_node_module6, import_node_path39;
|
|
41709
41828
|
var init_playwright_provisioning = __esm({
|
|
41710
41829
|
"cli/drivers/playwright-provisioning.ts"() {
|
|
41711
41830
|
"use strict";
|
|
41712
41831
|
import_node_child_process14 = require("node:child_process");
|
|
41713
|
-
|
|
41832
|
+
import_node_fs36 = require("node:fs");
|
|
41714
41833
|
import_node_module6 = require("node:module");
|
|
41715
|
-
|
|
41834
|
+
import_node_path39 = require("node:path");
|
|
41716
41835
|
init_src();
|
|
41717
41836
|
init_home_paths();
|
|
41718
41837
|
init_is_record();
|
|
@@ -42099,7 +42218,7 @@ var init_parse_args = __esm({
|
|
|
42099
42218
|
// cli/telemetry.ts
|
|
42100
42219
|
function sanitizeDiagnosticMessage(value) {
|
|
42101
42220
|
const firstLine = value.slice(0, 2048).split(/[\r\n\u2028\u2029]/, 1)[0] ?? "";
|
|
42102
|
-
return firstLine.split((0,
|
|
42221
|
+
return firstLine.split((0, import_node_os9.homedir)()).join("<home>").replace(
|
|
42103
42222
|
/<package:(?:@[\w.-]+\/)?[\w.-]+>|(?:https?:\/\/|file:\/\/|[A-Za-z]:[\\/]|<home>[\\/]|\/|\.{1,2}[\\/]|\b[\w.-]+[\\/])(?:[^\s"'<>]|\s(?=[^"'<>]*[\\/]))+/g,
|
|
42104
42223
|
(location2) => {
|
|
42105
42224
|
if (location2.startsWith("<package:")) return location2;
|
|
@@ -42126,11 +42245,11 @@ function trackCliDiagnostic(diagnostic) {
|
|
|
42126
42245
|
if (queue.some((queued) => JSON.stringify(queued) === JSON.stringify(entry))) return;
|
|
42127
42246
|
queue.push(entry);
|
|
42128
42247
|
}
|
|
42129
|
-
var
|
|
42248
|
+
var import_node_os9, import_crash_fingerprint, observedRuntimeVersion, queue, CRASH_REPORT_EVERY_MS;
|
|
42130
42249
|
var init_telemetry = __esm({
|
|
42131
42250
|
"cli/telemetry.ts"() {
|
|
42132
42251
|
"use strict";
|
|
42133
|
-
|
|
42252
|
+
import_node_os9 = require("node:os");
|
|
42134
42253
|
import_crash_fingerprint = require("peach-engine/crash-fingerprint");
|
|
42135
42254
|
init_cli_version();
|
|
42136
42255
|
init_home_paths();
|
|
@@ -42196,12 +42315,12 @@ var init_runtime_diagnostics = __esm({
|
|
|
42196
42315
|
// cli/commands/skills.ts
|
|
42197
42316
|
function getSkillsDir() {
|
|
42198
42317
|
if (typeof __PEACH_BUNDLED_SKILLS__ !== "undefined") {
|
|
42199
|
-
const dir =
|
|
42318
|
+
const dir = path32.join(rnxHomeDir(), "skills", getCliVersion());
|
|
42200
42319
|
for (const [file, body] of Object.entries(__PEACH_BUNDLED_SKILLS__)) {
|
|
42201
|
-
const target =
|
|
42202
|
-
if (
|
|
42203
|
-
|
|
42204
|
-
|
|
42320
|
+
const target = path32.join(dir, file);
|
|
42321
|
+
if (fs27.existsSync(target)) continue;
|
|
42322
|
+
fs27.mkdirSync(path32.dirname(target), { recursive: true });
|
|
42323
|
+
fs27.writeFileSync(target, body);
|
|
42205
42324
|
}
|
|
42206
42325
|
return dir;
|
|
42207
42326
|
}
|
|
@@ -42209,10 +42328,10 @@ function getSkillsDir() {
|
|
|
42209
42328
|
const pkgPath = (0, import_url3.fileURLToPath)(
|
|
42210
42329
|
import_meta4.resolve(`${rnxPublicBrand.packageName}/package.json`)
|
|
42211
42330
|
);
|
|
42212
|
-
return primaryCheckoutPath(
|
|
42331
|
+
return primaryCheckoutPath(path32.join(path32.dirname(pkgPath), "skills"));
|
|
42213
42332
|
} catch {
|
|
42214
|
-
const __dirname =
|
|
42215
|
-
return primaryCheckoutPath(
|
|
42333
|
+
const __dirname = path32.dirname((0, import_url3.fileURLToPath)(__sootsim_import_meta_url));
|
|
42334
|
+
return primaryCheckoutPath(path32.resolve(__dirname, "../../skills"));
|
|
42216
42335
|
}
|
|
42217
42336
|
}
|
|
42218
42337
|
function primaryCheckoutPath(dir) {
|
|
@@ -42235,17 +42354,17 @@ function primaryCheckoutPath(dir) {
|
|
|
42235
42354
|
} catch {
|
|
42236
42355
|
return dir;
|
|
42237
42356
|
}
|
|
42238
|
-
if (
|
|
42239
|
-
const primary =
|
|
42240
|
-
return
|
|
42357
|
+
if (path32.basename(common) !== ".git") return dir;
|
|
42358
|
+
const primary = path32.join(path32.dirname(common), path32.relative(top, dir));
|
|
42359
|
+
return fs27.existsSync(primary) ? primary : dir;
|
|
42241
42360
|
}
|
|
42242
42361
|
function skillsDir() {
|
|
42243
42362
|
skillsDirPath ??= getSkillsDir();
|
|
42244
42363
|
return skillsDirPath;
|
|
42245
42364
|
}
|
|
42246
42365
|
function targetFromHome(envName, fallbackDir) {
|
|
42247
|
-
const home = process.env[envName] ||
|
|
42248
|
-
return
|
|
42366
|
+
const home = process.env[envName] || path32.join(os8.homedir(), fallbackDir);
|
|
42367
|
+
return path32.join(home, "skills");
|
|
42249
42368
|
}
|
|
42250
42369
|
function defaultAgentTargets() {
|
|
42251
42370
|
return [
|
|
@@ -42258,7 +42377,7 @@ function hasInstalledPeachSkills() {
|
|
|
42258
42377
|
(file) => /^([^/]+)\/SKILL\.md$/.exec(file)?.[1] ?? []
|
|
42259
42378
|
) : listSkills().map((skill7) => skill7.name);
|
|
42260
42379
|
return defaultAgentTargets().some(
|
|
42261
|
-
({ dir }) => names.some((name2) =>
|
|
42380
|
+
({ dir }) => names.some((name2) => fs27.existsSync(path32.join(dir, name2, "SKILL.md")))
|
|
42262
42381
|
);
|
|
42263
42382
|
}
|
|
42264
42383
|
function parseSkillFrontmatter(content) {
|
|
@@ -42301,26 +42420,26 @@ function readFrontmatterField(frontmatter, field) {
|
|
|
42301
42420
|
return null;
|
|
42302
42421
|
}
|
|
42303
42422
|
function listSkills() {
|
|
42304
|
-
if (!
|
|
42423
|
+
if (!fs27.existsSync(skillsDir())) return [];
|
|
42305
42424
|
const skills = [];
|
|
42306
|
-
for (const entry of
|
|
42307
|
-
const skillMd =
|
|
42308
|
-
if (!
|
|
42309
|
-
const meta = parseSkillFrontmatter(
|
|
42425
|
+
for (const entry of fs27.readdirSync(skillsDir())) {
|
|
42426
|
+
const skillMd = path32.join(skillsDir(), entry, "SKILL.md");
|
|
42427
|
+
if (!fs27.existsSync(skillMd)) continue;
|
|
42428
|
+
const meta = parseSkillFrontmatter(fs27.readFileSync(skillMd, "utf8"));
|
|
42310
42429
|
if (meta) {
|
|
42311
42430
|
skills.push({ name: entry, description: meta.description });
|
|
42312
42431
|
}
|
|
42313
42432
|
}
|
|
42314
42433
|
return skills.sort((a, b) => a.name.localeCompare(b.name));
|
|
42315
42434
|
}
|
|
42316
|
-
var import_child_process7,
|
|
42435
|
+
var import_child_process7, fs27, os8, path32, import_url3, import_meta4, skillsDirPath;
|
|
42317
42436
|
var init_skills = __esm({
|
|
42318
42437
|
"cli/commands/skills.ts"() {
|
|
42319
42438
|
"use strict";
|
|
42320
42439
|
import_child_process7 = require("child_process");
|
|
42321
|
-
|
|
42322
|
-
|
|
42323
|
-
|
|
42440
|
+
fs27 = __toESM(require("fs"), 1);
|
|
42441
|
+
os8 = __toESM(require("os"), 1);
|
|
42442
|
+
path32 = __toESM(require("path"), 1);
|
|
42324
42443
|
import_url3 = require("url");
|
|
42325
42444
|
init_cli_version();
|
|
42326
42445
|
init_home_paths();
|
|
@@ -42807,7 +42926,7 @@ function assertExplicitBridgeLock(preferredPort, explicitPort, lock) {
|
|
|
42807
42926
|
async function ensureRuntimeForOpen() {
|
|
42808
42927
|
if (resolveDevCheckoutRuntimeRoot()) return;
|
|
42809
42928
|
const active = readActiveRuntime();
|
|
42810
|
-
if (active &&
|
|
42929
|
+
if (active && import_node_fs37.default.existsSync(runtimeDir(active))) return;
|
|
42811
42930
|
console.error(" installing peach engine runtime...");
|
|
42812
42931
|
const { runRuntime: runRuntime2 } = await Promise.resolve().then(() => (init_runtime(), runtime_exports));
|
|
42813
42932
|
await runRuntime2(["install"], {});
|
|
@@ -42961,10 +43080,10 @@ async function buildResolvedBundleOpenUrl(target, baseUrl, opts = {}) {
|
|
|
42961
43080
|
}
|
|
42962
43081
|
function normalizeReplacementPath(filePath) {
|
|
42963
43082
|
if (filePath.startsWith("~/")) {
|
|
42964
|
-
return
|
|
43083
|
+
return import_node_path40.default.join(import_node_os10.default.homedir(), filePath.slice(2));
|
|
42965
43084
|
}
|
|
42966
|
-
if (
|
|
42967
|
-
return
|
|
43085
|
+
if (import_node_path40.default.isAbsolute(filePath)) return filePath;
|
|
43086
|
+
return import_node_path40.default.resolve(process.cwd(), filePath);
|
|
42968
43087
|
}
|
|
42969
43088
|
function parseOpenRuntimeConfig(args) {
|
|
42970
43089
|
const modules = {};
|
|
@@ -42983,7 +43102,7 @@ function parseOpenRuntimeConfig(args) {
|
|
|
42983
43102
|
}
|
|
42984
43103
|
const moduleName = raw2.slice(0, eqIndex).trim();
|
|
42985
43104
|
const filePath = normalizeReplacementPath(raw2.slice(eqIndex + 1).trim());
|
|
42986
|
-
if (!
|
|
43105
|
+
if (!import_node_fs37.default.existsSync(filePath)) {
|
|
42987
43106
|
console.error(` peach open: replacement file not found: ${filePath}`);
|
|
42988
43107
|
rnxExit(1);
|
|
42989
43108
|
}
|
|
@@ -43014,7 +43133,7 @@ async function resolveAppProjectForBundleUrl(bundleUrl) {
|
|
|
43014
43133
|
return advertisedRoot ? resolveAppProject(advertisedRoot) : null;
|
|
43015
43134
|
}
|
|
43016
43135
|
async function ensureConfiguredRuntime(version) {
|
|
43017
|
-
if (
|
|
43136
|
+
if (import_node_fs37.default.existsSync(import_node_path40.default.join(runtimeDir(version), "index.html"))) return;
|
|
43018
43137
|
console.error(` installing configured engine runtime ${version}...`);
|
|
43019
43138
|
const result = await rnxRuntime.install({
|
|
43020
43139
|
version,
|
|
@@ -43350,7 +43469,7 @@ function playwrightHostPidForSim(sim) {
|
|
|
43350
43469
|
function signalDriverLaunchConnected(result) {
|
|
43351
43470
|
if (!result.connectAckFile) return false;
|
|
43352
43471
|
try {
|
|
43353
|
-
|
|
43472
|
+
import_node_fs37.default.writeFileSync(
|
|
43354
43473
|
result.connectAckFile,
|
|
43355
43474
|
`${JSON.stringify({ connectedAt: Date.now(), pid: result.pid ?? null })}
|
|
43356
43475
|
`,
|
|
@@ -43364,7 +43483,7 @@ function signalDriverLaunchConnected(result) {
|
|
|
43364
43483
|
function readUnservedUrl(result) {
|
|
43365
43484
|
if (!result.diagnosticLogPath) return null;
|
|
43366
43485
|
try {
|
|
43367
|
-
const detail =
|
|
43486
|
+
const detail = import_node_fs37.default.readFileSync(result.diagnosticLogPath, "utf8");
|
|
43368
43487
|
const match = detail.match(/\[unserved\] nothing serves (\S+)/);
|
|
43369
43488
|
return match ? match[1] : null;
|
|
43370
43489
|
} catch {
|
|
@@ -43374,19 +43493,19 @@ function readUnservedUrl(result) {
|
|
|
43374
43493
|
function printDriverDiagnosticLogTail(result) {
|
|
43375
43494
|
if (!result.diagnosticLogPath) return;
|
|
43376
43495
|
try {
|
|
43377
|
-
const detail =
|
|
43496
|
+
const detail = import_node_fs37.default.readFileSync(result.diagnosticLogPath, "utf8").trim();
|
|
43378
43497
|
if (!detail) {
|
|
43379
|
-
console.error(` ${
|
|
43498
|
+
console.error(` ${import_node_path40.default.basename(result.diagnosticLogPath)} was empty`);
|
|
43380
43499
|
return;
|
|
43381
43500
|
}
|
|
43382
43501
|
const shown = detail.length > 4e3 ? `\u2026
|
|
43383
43502
|
${detail.slice(-4e3)}` : detail;
|
|
43384
|
-
console.error(` ${
|
|
43503
|
+
console.error(` ${import_node_path40.default.basename(result.diagnosticLogPath)}:`);
|
|
43385
43504
|
console.error(shown);
|
|
43386
43505
|
} catch (err) {
|
|
43387
43506
|
const message = err instanceof Error ? err.message : String(err);
|
|
43388
43507
|
console.error(
|
|
43389
|
-
` failed to read ${
|
|
43508
|
+
` failed to read ${import_node_path40.default.basename(result.diagnosticLogPath)}: ${message}`
|
|
43390
43509
|
);
|
|
43391
43510
|
}
|
|
43392
43511
|
}
|
|
@@ -44385,14 +44504,14 @@ async function runCloseCommand(args, opts = {}) {
|
|
|
44385
44504
|
bridge.close();
|
|
44386
44505
|
}
|
|
44387
44506
|
}
|
|
44388
|
-
var import_node_child_process15,
|
|
44507
|
+
var import_node_child_process15, import_node_fs37, import_node_os10, import_node_path40, import_app_catalog_wire, import_devices2, import_ws4, DEFAULT_DRIVER_CONNECT_TIMEOUT_MS, DRIVER_CONNECT_INTERVAL_MS, DRIVER_CONNECT_HOST_GRACE_MS, OPEN_BRIDGE_SPAWN_TIMEOUT_MS, SHELL_APPS, DEV_BUNDLE_RESOLVE_ATTEMPTS, DEV_BUNDLE_RESOLVE_INTERVAL_MS;
|
|
44389
44508
|
var init_control = __esm({
|
|
44390
44509
|
"cli/commands/control.ts"() {
|
|
44391
44510
|
"use strict";
|
|
44392
44511
|
import_node_child_process15 = require("node:child_process");
|
|
44393
|
-
|
|
44394
|
-
|
|
44395
|
-
|
|
44512
|
+
import_node_fs37 = __toESM(require("node:fs"), 1);
|
|
44513
|
+
import_node_os10 = __toESM(require("node:os"), 1);
|
|
44514
|
+
import_node_path40 = __toESM(require("node:path"), 1);
|
|
44396
44515
|
import_app_catalog_wire = require("peach-engine/engine/app-catalog-wire");
|
|
44397
44516
|
import_devices2 = require("peach-engine/settings/devices");
|
|
44398
44517
|
import_ws4 = require("ws");
|
|
@@ -45847,16 +45966,16 @@ function readRecentShellAppId(state) {
|
|
|
45847
45966
|
}
|
|
45848
45967
|
function resolveProjectRelativeFlowBase(flowDir) {
|
|
45849
45968
|
if (!flowDir) return process.cwd();
|
|
45850
|
-
return
|
|
45969
|
+
return path34.basename(flowDir) === ".maestro" ? path34.dirname(flowDir) : flowDir;
|
|
45851
45970
|
}
|
|
45852
45971
|
function resolveFlowScreenshotPathWithMode(screenshotDir, name2, opts) {
|
|
45853
45972
|
const normalizedName = name2.endsWith(".png") ? name2 : `${name2}.png`;
|
|
45854
|
-
if (
|
|
45973
|
+
if (path34.isAbsolute(normalizedName)) return normalizedName;
|
|
45855
45974
|
if (opts.mode === "flow" && /[\\/]/.test(normalizedName)) {
|
|
45856
45975
|
const baseDir = normalizedName.startsWith("./") || normalizedName.startsWith("../") ? opts.flowDir ?? process.cwd() : resolveProjectRelativeFlowBase(opts.flowDir);
|
|
45857
|
-
return
|
|
45976
|
+
return path34.resolve(baseDir, normalizedName);
|
|
45858
45977
|
}
|
|
45859
|
-
return
|
|
45978
|
+
return path34.join(screenshotDir, normalizedName);
|
|
45860
45979
|
}
|
|
45861
45980
|
function normalizeFlowScreenshotSpec(step) {
|
|
45862
45981
|
if (typeof step === "string") {
|
|
@@ -45910,12 +46029,12 @@ function normalizeBareStringStep(verb) {
|
|
|
45910
46029
|
function parseFlowSteps(content) {
|
|
45911
46030
|
return parseFlowFile(content).steps;
|
|
45912
46031
|
}
|
|
45913
|
-
var
|
|
46032
|
+
var fs30, path34, import_devices4, import_proof_frame, DEFAULT_TIMEOUT, ASSERTION_LOOKUP_MS, FLOW_TIMEOUT_SCALE, scaledTimeout, MAESTRO_SELECTOR_KEYS, SELECTOR_FILTER_KEYS, UNSUPPORTED_SELECTOR_KEYS, ACCESSIBILITY_SELECTOR_KEYS, ACCESSIBILITY_TRAIT_FILTERS, MAESTRO_PERMISSION_KINDS, MAESTRO_PERMISSION_STATUS, SootSimBridgeFlowRunner;
|
|
45914
46033
|
var init_bridge_flow_runner = __esm({
|
|
45915
46034
|
"cli/bridge-flow-runner.ts"() {
|
|
45916
46035
|
"use strict";
|
|
45917
|
-
|
|
45918
|
-
|
|
46036
|
+
fs30 = __toESM(require("fs"), 1);
|
|
46037
|
+
path34 = __toESM(require("path"), 1);
|
|
45919
46038
|
import_devices4 = require("peach-engine/settings/devices");
|
|
45920
46039
|
import_proof_frame = __toESM(require_proof_frame(), 1);
|
|
45921
46040
|
init_flow_timeout_scale();
|
|
@@ -46240,14 +46359,14 @@ var init_bridge_flow_runner = __esm({
|
|
|
46240
46359
|
if (chunks.length === 0) {
|
|
46241
46360
|
throw new Error("recording requested but no video buffer was produced");
|
|
46242
46361
|
}
|
|
46243
|
-
|
|
46362
|
+
fs30.mkdirSync(this.opts.recordingOutputDir, { recursive: true });
|
|
46244
46363
|
const videoMime = stopped.mime || this.opts.recordingFormat || "video/webm";
|
|
46245
46364
|
const extension = videoMime.includes("mp4") ? "mp4" : "webm";
|
|
46246
|
-
const outputPath =
|
|
46365
|
+
const outputPath = path34.join(
|
|
46247
46366
|
this.opts.recordingOutputDir,
|
|
46248
46367
|
`peach-${Date.now()}.${extension}`
|
|
46249
46368
|
);
|
|
46250
|
-
|
|
46369
|
+
fs30.writeFileSync(outputPath, Buffer.concat(chunks));
|
|
46251
46370
|
return outputPath;
|
|
46252
46371
|
}
|
|
46253
46372
|
async waitForRecordingTail(opts) {
|
|
@@ -46923,7 +47042,7 @@ var init_bridge_flow_runner = __esm({
|
|
|
46923
47042
|
flowDir: this.opts.flowDir
|
|
46924
47043
|
}
|
|
46925
47044
|
);
|
|
46926
|
-
|
|
47045
|
+
fs30.mkdirSync(path34.dirname(outputPath), { recursive: true });
|
|
46927
47046
|
const layers = spec.layers ?? this.opts.screenshotLayers;
|
|
46928
47047
|
const screenshotRequest = {
|
|
46929
47048
|
type: "screenshot",
|
|
@@ -46958,11 +47077,11 @@ var init_bridge_flow_runner = __esm({
|
|
|
46958
47077
|
throw new Error("could not read current device model for framed screenshot");
|
|
46959
47078
|
}
|
|
46960
47079
|
const framed = await composeFramedScreenshot(rawBuffer, model);
|
|
46961
|
-
|
|
47080
|
+
fs30.writeFileSync(outputPath, framed);
|
|
46962
47081
|
console.log(`[flow] screenshot: ${outputPath} (frame: ${model})`);
|
|
46963
47082
|
return outputPath;
|
|
46964
47083
|
}
|
|
46965
|
-
|
|
47084
|
+
fs30.writeFileSync(outputPath, rawBuffer);
|
|
46966
47085
|
console.log(`[flow] screenshot: ${outputPath}`);
|
|
46967
47086
|
return outputPath;
|
|
46968
47087
|
}
|
|
@@ -46984,10 +47103,10 @@ var init_bridge_flow_runner = __esm({
|
|
|
46984
47103
|
// + a11y tree + console errors/warnings + failed network requests +
|
|
46985
47104
|
// shell state, all under one directory so post-mortem is one grep away.
|
|
46986
47105
|
async captureFailureBundle(outputDir, context) {
|
|
46987
|
-
|
|
47106
|
+
fs30.mkdirSync(outputDir, { recursive: true });
|
|
46988
47107
|
const write = (name2, content) => {
|
|
46989
47108
|
try {
|
|
46990
|
-
|
|
47109
|
+
fs30.writeFileSync(path34.join(outputDir, name2), content);
|
|
46991
47110
|
} catch {
|
|
46992
47111
|
}
|
|
46993
47112
|
};
|
|
@@ -47580,8 +47699,8 @@ var init_bridge_flow_runner = __esm({
|
|
|
47580
47699
|
runScript(target) {
|
|
47581
47700
|
const spec = typeof target === "string" ? { file: target } : target;
|
|
47582
47701
|
if (!spec.file) throw new Error("runScript requires a file");
|
|
47583
|
-
const scriptPath =
|
|
47584
|
-
const source =
|
|
47702
|
+
const scriptPath = path34.resolve(this.opts.flowDir, spec.file);
|
|
47703
|
+
const source = fs30.readFileSync(scriptPath, "utf8");
|
|
47585
47704
|
this.js.evaluate(source, { env: spec.env });
|
|
47586
47705
|
console.log(`[flow] runScript: ${spec.file} done`);
|
|
47587
47706
|
}
|
|
@@ -47941,14 +48060,14 @@ var init_bridge_flow_runner = __esm({
|
|
|
47941
48060
|
for (const [k, v] of Object.entries(env)) this.js.putEnv(k, v);
|
|
47942
48061
|
}
|
|
47943
48062
|
if (file) {
|
|
47944
|
-
const flowPath =
|
|
47945
|
-
const flowContent =
|
|
48063
|
+
const flowPath = path34.resolve(this.opts.flowDir, file);
|
|
48064
|
+
const flowContent = fs30.readFileSync(flowPath, "utf8");
|
|
47946
48065
|
const { frontmatter } = parseFlowFile(flowContent);
|
|
47947
48066
|
if (frontmatter.env && typeof frontmatter.env === "object") {
|
|
47948
48067
|
this.js.defineVariables(frontmatter.env);
|
|
47949
48068
|
}
|
|
47950
48069
|
const previousDir = this.opts.flowDir;
|
|
47951
|
-
this.opts.flowDir =
|
|
48070
|
+
this.opts.flowDir = path34.dirname(flowPath);
|
|
47952
48071
|
try {
|
|
47953
48072
|
await this.runFlow(parseFlowSteps(flowContent));
|
|
47954
48073
|
} finally {
|
|
@@ -48119,8 +48238,8 @@ __export(registry_exports, {
|
|
|
48119
48238
|
skillRegistry: () => skillRegistry
|
|
48120
48239
|
});
|
|
48121
48240
|
module.exports = __toCommonJS(registry_exports);
|
|
48122
|
-
var
|
|
48123
|
-
var
|
|
48241
|
+
var fs31 = __toESM(require("fs"), 1);
|
|
48242
|
+
var path35 = __toESM(require("path"), 1);
|
|
48124
48243
|
|
|
48125
48244
|
// src/skills/builtin/a11y-review.ts
|
|
48126
48245
|
init_reap_browser();
|
|
@@ -48139,8 +48258,8 @@ var skill = {
|
|
|
48139
48258
|
},
|
|
48140
48259
|
async execute(params, context) {
|
|
48141
48260
|
const { chromium } = await import("playwright");
|
|
48142
|
-
const
|
|
48143
|
-
const
|
|
48261
|
+
const path36 = await import("path");
|
|
48262
|
+
const fs32 = await import("fs");
|
|
48144
48263
|
const browser = await launchReapedChrome((options) => chromium.launch(options), {
|
|
48145
48264
|
headless: true
|
|
48146
48265
|
});
|
|
@@ -48197,9 +48316,9 @@ var skill = {
|
|
|
48197
48316
|
warnings: issues.filter((i) => i.severity === "warning").length,
|
|
48198
48317
|
tree: typeof tree === "string" ? tree : JSON.stringify(tree)
|
|
48199
48318
|
};
|
|
48200
|
-
const reportPath =
|
|
48201
|
-
|
|
48202
|
-
|
|
48319
|
+
const reportPath = path36.join(context.outputDir, "a11y-report.json");
|
|
48320
|
+
fs32.mkdirSync(path36.dirname(reportPath), { recursive: true });
|
|
48321
|
+
fs32.writeFileSync(reportPath, JSON.stringify(report, null, 2));
|
|
48203
48322
|
return {
|
|
48204
48323
|
success: issues.filter((i) => i.severity === "error").length === 0,
|
|
48205
48324
|
message: `${report.errors} errors, ${report.warnings} warnings across ${report.nodeCount} nodes`,
|
|
@@ -48232,14 +48351,14 @@ var skill2 = {
|
|
|
48232
48351
|
}
|
|
48233
48352
|
},
|
|
48234
48353
|
async execute(params, context) {
|
|
48235
|
-
const
|
|
48236
|
-
const
|
|
48354
|
+
const fs32 = await import("node:fs");
|
|
48355
|
+
const path36 = await import("node:path");
|
|
48237
48356
|
const { COMPAT_RESULT_CAVEAT: COMPAT_RESULT_CAVEAT2, formatPackageStatus: formatPackageStatus2, formatScanCounts: formatScanCounts2, scanDeps: scanDeps2 } = await Promise.resolve().then(() => (init_web(), web_exports));
|
|
48238
|
-
const packagePath =
|
|
48239
|
-
if (!
|
|
48357
|
+
const packagePath = path36.join(context.projectDir, "package.json");
|
|
48358
|
+
if (!fs32.existsSync(packagePath)) {
|
|
48240
48359
|
return { success: false, message: "No package.json found" };
|
|
48241
48360
|
}
|
|
48242
|
-
const parsed = JSON.parse(
|
|
48361
|
+
const parsed = JSON.parse(fs32.readFileSync(packagePath, "utf8"));
|
|
48243
48362
|
if (!parsed || typeof parsed !== "object") {
|
|
48244
48363
|
return { success: false, message: "package.json is not an object" };
|
|
48245
48364
|
}
|
|
@@ -48251,9 +48370,9 @@ var skill2 = {
|
|
|
48251
48370
|
}) : scanDeps2(parsed);
|
|
48252
48371
|
const packageResult = params.packageName ? scan.packages[0] : void 0;
|
|
48253
48372
|
const message = packageResult ? `${params.packageName}: ${formatPackageStatus2(packageResult)}. ${COMPAT_RESULT_CAVEAT2}` : `${formatScanCounts2(scan)}. ${COMPAT_RESULT_CAVEAT2}`;
|
|
48254
|
-
const reportPath =
|
|
48255
|
-
|
|
48256
|
-
|
|
48373
|
+
const reportPath = path36.join(context.outputDir, "compat-report.json");
|
|
48374
|
+
fs32.mkdirSync(path36.dirname(reportPath), { recursive: true });
|
|
48375
|
+
fs32.writeFileSync(reportPath, `${JSON.stringify(scan, null, 2)}
|
|
48257
48376
|
`);
|
|
48258
48377
|
return {
|
|
48259
48378
|
success: true,
|
|
@@ -48295,8 +48414,8 @@ var skill3 = {
|
|
|
48295
48414
|
record: { type: "boolean", description: "Record video of the flow" }
|
|
48296
48415
|
},
|
|
48297
48416
|
async execute(params, context) {
|
|
48298
|
-
const
|
|
48299
|
-
const
|
|
48417
|
+
const fs32 = await import("fs");
|
|
48418
|
+
const path36 = await import("path");
|
|
48300
48419
|
const yaml2 = await import("yaml");
|
|
48301
48420
|
const { DEFAULT_SOOTSIM_BRIDGE_PORT: DEFAULT_SOOTSIM_BRIDGE_PORT3 } = await Promise.resolve().then(() => (init_bridge_constants(), bridge_constants_exports));
|
|
48302
48421
|
const { SootSimBridgeHost: SootSimBridgeHost2 } = await Promise.resolve().then(() => (init_bridge_host(), bridge_host_exports));
|
|
@@ -48306,7 +48425,7 @@ var skill3 = {
|
|
|
48306
48425
|
const host2 = new SootSimBridgeHost2({ port: DEFAULT_SOOTSIM_BRIDGE_PORT3 });
|
|
48307
48426
|
host2.start({ silent: true });
|
|
48308
48427
|
try {
|
|
48309
|
-
const flowContent =
|
|
48428
|
+
const flowContent = fs32.readFileSync(params.flowPath, "utf8");
|
|
48310
48429
|
const fmMatch = flowContent.match(/^---\n([\s\S]*?)\n---\n?/);
|
|
48311
48430
|
const stepsBody = fmMatch ? flowContent.slice(fmMatch[0].length) : flowContent;
|
|
48312
48431
|
const steps = yaml2.parse(stepsBody);
|
|
@@ -48333,7 +48452,7 @@ var skill3 = {
|
|
|
48333
48452
|
});
|
|
48334
48453
|
const driver = new SootSimBridgeFlowRunner2(bridge, {
|
|
48335
48454
|
screenshotDir: context.outputDir,
|
|
48336
|
-
flowDir:
|
|
48455
|
+
flowDir: path36.dirname(path36.resolve(params.flowPath)),
|
|
48337
48456
|
simId,
|
|
48338
48457
|
recordingOutputDir: params.record ? context.outputDir : void 0
|
|
48339
48458
|
});
|
|
@@ -48355,7 +48474,7 @@ var skill3 = {
|
|
|
48355
48474
|
simId,
|
|
48356
48475
|
videoPath: videoPath || void 0
|
|
48357
48476
|
},
|
|
48358
|
-
artifacts: videoPath ? [{ type: "video", name:
|
|
48477
|
+
artifacts: videoPath ? [{ type: "video", name: path36.basename(videoPath), path: videoPath }] : void 0
|
|
48359
48478
|
};
|
|
48360
48479
|
} finally {
|
|
48361
48480
|
try {
|
|
@@ -48402,8 +48521,8 @@ var skill4 = {
|
|
|
48402
48521
|
},
|
|
48403
48522
|
async execute(params, context) {
|
|
48404
48523
|
const { chromium } = await import("playwright");
|
|
48405
|
-
const
|
|
48406
|
-
const
|
|
48524
|
+
const path36 = await import("path");
|
|
48525
|
+
const fs32 = await import("fs");
|
|
48407
48526
|
const browser = await launchReapedChrome((options) => chromium.launch(options), {
|
|
48408
48527
|
headless: true
|
|
48409
48528
|
});
|
|
@@ -48431,9 +48550,9 @@ var skill4 = {
|
|
|
48431
48550
|
...profile,
|
|
48432
48551
|
fps: syncCount > 0 ? (syncCount / (duration / 1e3)).toFixed(1) : "0"
|
|
48433
48552
|
};
|
|
48434
|
-
const reportPath =
|
|
48435
|
-
|
|
48436
|
-
|
|
48553
|
+
const reportPath = path36.join(context.outputDir, "perf-report.json");
|
|
48554
|
+
fs32.mkdirSync(path36.dirname(reportPath), { recursive: true });
|
|
48555
|
+
fs32.writeFileSync(reportPath, JSON.stringify(report, null, 2));
|
|
48437
48556
|
return {
|
|
48438
48557
|
success: true,
|
|
48439
48558
|
message: `${report.fps} fps, ${profile.avgSyncMs?.toFixed(1)}ms avg sync, ${nodeCount} nodes`,
|
|
@@ -48466,8 +48585,8 @@ var skill5 = {
|
|
|
48466
48585
|
},
|
|
48467
48586
|
async execute(params, context) {
|
|
48468
48587
|
const { chromium } = await import("playwright");
|
|
48469
|
-
const
|
|
48470
|
-
const
|
|
48588
|
+
const path36 = await import("path");
|
|
48589
|
+
const fs32 = await import("fs");
|
|
48471
48590
|
const browser = await launchReapedChrome((options) => chromium.launch(options), {
|
|
48472
48591
|
headless: true
|
|
48473
48592
|
});
|
|
@@ -48475,8 +48594,8 @@ var skill5 = {
|
|
|
48475
48594
|
try {
|
|
48476
48595
|
await page.goto(context.url, { waitUntil: "networkidle" });
|
|
48477
48596
|
await page.waitForTimeout(2e3);
|
|
48478
|
-
const outputPath =
|
|
48479
|
-
|
|
48597
|
+
const outputPath = path36.join(context.outputDir, `${params.name}.png`);
|
|
48598
|
+
fs32.mkdirSync(path36.dirname(outputPath), { recursive: true });
|
|
48480
48599
|
await page.screenshot({ path: outputPath });
|
|
48481
48600
|
return {
|
|
48482
48601
|
success: true,
|
|
@@ -48517,8 +48636,8 @@ var skill6 = {
|
|
|
48517
48636
|
},
|
|
48518
48637
|
async execute(params, context) {
|
|
48519
48638
|
const { chromium } = await import("playwright");
|
|
48520
|
-
const
|
|
48521
|
-
const
|
|
48639
|
+
const path36 = await import("path");
|
|
48640
|
+
const fs32 = await import("fs");
|
|
48522
48641
|
const browser = await launchReapedChrome((options) => chromium.launch(options), {
|
|
48523
48642
|
headless: true
|
|
48524
48643
|
});
|
|
@@ -48526,14 +48645,14 @@ var skill6 = {
|
|
|
48526
48645
|
try {
|
|
48527
48646
|
await page.goto(context.url, { waitUntil: "networkidle" });
|
|
48528
48647
|
await page.waitForTimeout(2e3);
|
|
48529
|
-
const currentPath =
|
|
48530
|
-
|
|
48648
|
+
const currentPath = path36.join(context.outputDir, `${params.name}-current.png`);
|
|
48649
|
+
fs32.mkdirSync(path36.dirname(currentPath), { recursive: true });
|
|
48531
48650
|
await page.screenshot({ path: currentPath });
|
|
48532
48651
|
try {
|
|
48533
48652
|
const { PNG } = await import("pngjs");
|
|
48534
48653
|
const pixelmatch = (await import("pixelmatch")).default;
|
|
48535
|
-
const baseline = PNG.sync.read(
|
|
48536
|
-
const current = PNG.sync.read(
|
|
48654
|
+
const baseline = PNG.sync.read(fs32.readFileSync(params.baseline));
|
|
48655
|
+
const current = PNG.sync.read(fs32.readFileSync(currentPath));
|
|
48537
48656
|
const { width, height } = baseline;
|
|
48538
48657
|
const diff = new PNG({ width, height });
|
|
48539
48658
|
const numDiffPixels = pixelmatch(
|
|
@@ -48544,8 +48663,8 @@ var skill6 = {
|
|
|
48544
48663
|
height,
|
|
48545
48664
|
{ threshold: params.threshold || 0.1 }
|
|
48546
48665
|
);
|
|
48547
|
-
const diffPath =
|
|
48548
|
-
|
|
48666
|
+
const diffPath = path36.join(context.outputDir, `${params.name}-diff.png`);
|
|
48667
|
+
fs32.writeFileSync(diffPath, PNG.sync.write(diff));
|
|
48549
48668
|
const totalPixels = width * height;
|
|
48550
48669
|
const diffPercent = (numDiffPixels / totalPixels * 100).toFixed(2);
|
|
48551
48670
|
return {
|
|
@@ -48609,10 +48728,10 @@ var skillRegistry = {
|
|
|
48609
48728
|
},
|
|
48610
48729
|
// load skills from a project manifest (rnx-skills.json)
|
|
48611
48730
|
async loadFromManifest(projectDir) {
|
|
48612
|
-
const manifestPath =
|
|
48613
|
-
if (!
|
|
48731
|
+
const manifestPath = path35.join(projectDir, "rnx-skills.json");
|
|
48732
|
+
if (!fs31.existsSync(manifestPath)) return;
|
|
48614
48733
|
try {
|
|
48615
|
-
const manifest = JSON.parse(
|
|
48734
|
+
const manifest = JSON.parse(fs31.readFileSync(manifestPath, "utf8"));
|
|
48616
48735
|
if (Array.isArray(manifest.skills)) {
|
|
48617
48736
|
for (const entry of manifest.skills) {
|
|
48618
48737
|
if (typeof entry === "string") {
|
|
@@ -48623,7 +48742,7 @@ var skillRegistry = {
|
|
|
48623
48742
|
}
|
|
48624
48743
|
} else if (entry.file) {
|
|
48625
48744
|
try {
|
|
48626
|
-
const mod = await import(
|
|
48745
|
+
const mod = await import(path35.resolve(projectDir, entry.file));
|
|
48627
48746
|
if (mod.skill) this.register(mod.skill);
|
|
48628
48747
|
} catch {
|
|
48629
48748
|
}
|
|
@@ -48636,10 +48755,10 @@ var skillRegistry = {
|
|
|
48636
48755
|
// auto-discover skills based on project dependencies
|
|
48637
48756
|
suggestSkills(projectDir) {
|
|
48638
48757
|
const suggestions = [];
|
|
48639
|
-
const pkgPath =
|
|
48640
|
-
if (!
|
|
48758
|
+
const pkgPath = path35.join(projectDir, "package.json");
|
|
48759
|
+
if (!fs31.existsSync(pkgPath)) return suggestions;
|
|
48641
48760
|
try {
|
|
48642
|
-
const pkg = JSON.parse(
|
|
48761
|
+
const pkg = JSON.parse(fs31.readFileSync(pkgPath, "utf8"));
|
|
48643
48762
|
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
48644
48763
|
if (deps["detox"] || deps["maestro"]) {
|
|
48645
48764
|
suggestions.push("maestro-test");
|