peachsim 0.1.759 → 0.1.760
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/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 +823 -728
- 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 +37 -220
- 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 +37 -220
- 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 +1120 -1019
- package/dist-lib/swift-compile.cjs +1 -1
- package/dist-lib/swift-compile.mjs +1 -1
- package/dist-lib/swift-package.cjs +1 -110
- package/dist-lib/swift-package.mjs +1 -109
- 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 +607 -512
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/src/native-seam-manifest.ts +8 -0
- package/src/swift-host.ts +64 -64
- package/src/swift-package-manifest.ts +307 -0
- package/src/swift-package.ts +2 -135
- package/src/swift-packages.ts +341 -0
- package/src/xcode-project.ts +57 -70
- package/src/swift-remote-packages.ts +0 -255
package/dist-lib/skills.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.760 | (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;
|
|
@@ -108,8 +108,8 @@ function assertGpuBrowserCommand(command, runtime = currentRuntime()) {
|
|
|
108
108
|
}
|
|
109
109
|
function collectGpuRendererStrings(info) {
|
|
110
110
|
if (!info || typeof info !== "object") return [];
|
|
111
|
-
const
|
|
112
|
-
const gpu =
|
|
111
|
+
const record2 = info;
|
|
112
|
+
const gpu = record2.gpu;
|
|
113
113
|
if (!gpu || typeof gpu !== "object") return [];
|
|
114
114
|
const gpuRecord = gpu;
|
|
115
115
|
const values = [];
|
|
@@ -132,9 +132,9 @@ function collectGpuRendererStrings(info) {
|
|
|
132
132
|
}
|
|
133
133
|
function browserProcessPid(info) {
|
|
134
134
|
if (!info || typeof info !== "object") return null;
|
|
135
|
-
const
|
|
136
|
-
if (!Array.isArray(
|
|
137
|
-
for (const entry of
|
|
135
|
+
const record2 = info;
|
|
136
|
+
if (!Array.isArray(record2.processInfo)) return null;
|
|
137
|
+
for (const entry of record2.processInfo) {
|
|
138
138
|
if (!entry || typeof entry !== "object") continue;
|
|
139
139
|
const processInfo = entry;
|
|
140
140
|
if (processInfo.type === "browser" && typeof processInfo.id === "number" && Number.isInteger(processInfo.id) && processInfo.id > 0) {
|
|
@@ -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(path35) {
|
|
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)(path35, "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(path35) {
|
|
19853
19853
|
try {
|
|
19854
|
-
const metadata = await (0, import_promises.stat)(
|
|
19854
|
+
const metadata = await (0, import_promises.stat)(path35);
|
|
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)(path35, "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, path35, 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, path34, 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: path35, method, headers }, (res) => {
|
|
20190
20190
|
let body = "";
|
|
20191
20191
|
res.on("data", (c) => body += c.toString());
|
|
20192
20192
|
const contentType = (() => {
|
|
@@ -21710,115 +21710,9 @@ function manifestCalls(manifest, kinds) {
|
|
|
21710
21710
|
}
|
|
21711
21711
|
return calls;
|
|
21712
21712
|
}
|
|
21713
|
-
function listArgument(call, label) {
|
|
21714
|
-
const start = new RegExp(`\\b${label}\\s*:\\s*\\[`).exec(call);
|
|
21715
|
-
if (!start) return [];
|
|
21716
|
-
const items2 = [];
|
|
21717
|
-
let depth = 0;
|
|
21718
|
-
let inString = false;
|
|
21719
|
-
let item = "";
|
|
21720
|
-
for (let i = start.index + start[0].length; i < call.length; i++) {
|
|
21721
|
-
const ch = call[i];
|
|
21722
|
-
if (inString) {
|
|
21723
|
-
item += ch;
|
|
21724
|
-
if (ch === '"' && call[i - 1] !== "\\") inString = false;
|
|
21725
|
-
continue;
|
|
21726
|
-
}
|
|
21727
|
-
if (ch === '"') inString = true;
|
|
21728
|
-
else if (ch === "(" || ch === "[") depth++;
|
|
21729
|
-
else if (ch === ")" || ch === "]") {
|
|
21730
|
-
if (depth === 0) break;
|
|
21731
|
-
depth--;
|
|
21732
|
-
} else if (ch === "," && depth === 0) {
|
|
21733
|
-
items2.push(item.trim());
|
|
21734
|
-
item = "";
|
|
21735
|
-
continue;
|
|
21736
|
-
}
|
|
21737
|
-
item += ch;
|
|
21738
|
-
}
|
|
21739
|
-
if (item.trim()) items2.push(item.trim());
|
|
21740
|
-
return items2;
|
|
21741
|
-
}
|
|
21742
21713
|
function swiftPackageIdentity(url) {
|
|
21743
21714
|
return (url.split("/").pop() ?? url).replace(/\.git$/, "").toLowerCase();
|
|
21744
21715
|
}
|
|
21745
|
-
function swiftManifestGraph(manifest) {
|
|
21746
|
-
const graph = {
|
|
21747
|
-
products: /* @__PURE__ */ new Map(),
|
|
21748
|
-
dependencies: /* @__PURE__ */ new Map(),
|
|
21749
|
-
binaryTargets: /* @__PURE__ */ new Set(),
|
|
21750
|
-
systemLibraries: /* @__PURE__ */ new Set(),
|
|
21751
|
-
packageURLs: /* @__PURE__ */ new Map(),
|
|
21752
|
-
packagePaths: []
|
|
21753
|
-
};
|
|
21754
|
-
for (const { kind, flat, call } of manifestCalls(manifest, [
|
|
21755
|
-
"library",
|
|
21756
|
-
"executableTarget",
|
|
21757
|
-
"target",
|
|
21758
|
-
"binaryTarget",
|
|
21759
|
-
"systemLibrary",
|
|
21760
|
-
"package"
|
|
21761
|
-
])) {
|
|
21762
|
-
if (kind === "package") {
|
|
21763
|
-
const local = /\bpath\s*:\s*"([^"]+)"/.exec(flat)?.[1];
|
|
21764
|
-
if (local) graph.packagePaths.push(local);
|
|
21765
|
-
const url = /\burl\s*:\s*"([^"]+)"/.exec(flat)?.[1];
|
|
21766
|
-
if (!url) continue;
|
|
21767
|
-
graph.packageURLs.set(swiftPackageIdentity(url), url);
|
|
21768
|
-
const name3 = NAME.exec(flat)?.[1];
|
|
21769
|
-
if (name3) graph.packageURLs.set(name3.toLowerCase(), url);
|
|
21770
|
-
continue;
|
|
21771
|
-
}
|
|
21772
|
-
const name2 = NAME.exec(flat)?.[1];
|
|
21773
|
-
if (!name2) continue;
|
|
21774
|
-
if (kind === "library") {
|
|
21775
|
-
graph.products.set(
|
|
21776
|
-
name2,
|
|
21777
|
-
listArgument(call, "targets").flatMap(
|
|
21778
|
-
(item) => /^"([^"]+)"$/.exec(item)?.[1] ?? []
|
|
21779
|
-
)
|
|
21780
|
-
);
|
|
21781
|
-
continue;
|
|
21782
|
-
}
|
|
21783
|
-
if (kind === "binaryTarget") graph.binaryTargets.add(name2);
|
|
21784
|
-
if (kind === "systemLibrary") graph.systemLibraries.add(name2);
|
|
21785
|
-
const dependencies = [];
|
|
21786
|
-
for (const item of listArgument(call, "dependencies")) {
|
|
21787
|
-
const platforms = /condition\s*:\s*\.when\(\s*platforms\s*:\s*\[([^\]]*)\]/.exec(
|
|
21788
|
-
item
|
|
21789
|
-
)?.[1];
|
|
21790
|
-
if (platforms !== void 0 && !/\.iOS\b/.test(platforms)) continue;
|
|
21791
|
-
if (/condition\s*:\s*\.when\([^)]*\btraits\s*:/.test(item)) continue;
|
|
21792
|
-
const plain = /^"([^"]+)"$/.exec(item)?.[1];
|
|
21793
|
-
const product = /^\.product(?:Item)?\(\s*name\s*:\s*"([^"]+)"\s*,\s*package\s*:\s*"([^"]+)"/.exec(
|
|
21794
|
-
item
|
|
21795
|
-
);
|
|
21796
|
-
const target = /^\.(?:target|byName)(?:Item)?\(\s*name\s*:\s*"([^"]+)"/.exec(
|
|
21797
|
-
item
|
|
21798
|
-
)?.[1];
|
|
21799
|
-
if (plain) dependencies.push({ kind: "target", name: plain });
|
|
21800
|
-
else if (product)
|
|
21801
|
-
dependencies.push({
|
|
21802
|
-
kind: "product",
|
|
21803
|
-
name: product[1],
|
|
21804
|
-
package: product[2].toLowerCase()
|
|
21805
|
-
});
|
|
21806
|
-
else if (target) dependencies.push({ kind: "target", name: target });
|
|
21807
|
-
}
|
|
21808
|
-
graph.dependencies.set(name2, dependencies);
|
|
21809
|
-
}
|
|
21810
|
-
for (const dependencies of graph.dependencies.values()) {
|
|
21811
|
-
for (const [index, dependency] of dependencies.entries()) {
|
|
21812
|
-
if (dependency.kind === "target" && !graph.dependencies.has(dependency.name))
|
|
21813
|
-
dependencies[index] = {
|
|
21814
|
-
kind: "product",
|
|
21815
|
-
name: dependency.name,
|
|
21816
|
-
package: dependency.name.toLowerCase()
|
|
21817
|
-
};
|
|
21818
|
-
}
|
|
21819
|
-
}
|
|
21820
|
-
return graph;
|
|
21821
|
-
}
|
|
21822
21716
|
function swiftManifestTargets(manifest, resourcePaths = []) {
|
|
21823
21717
|
const implicitResources = swiftImplicitResourcePaths(resourcePaths);
|
|
21824
21718
|
const targets = [];
|
|
@@ -21863,7 +21757,7 @@ function swiftPackagePartition(manifest, resourcePaths = []) {
|
|
|
21863
21757
|
const targets = swiftManifestTargets(manifest, resourcePaths);
|
|
21864
21758
|
return targets.length === 1 && targets[0].executable && targets[0].path === "." ? [] : targets;
|
|
21865
21759
|
}
|
|
21866
|
-
var MANIFEST_DECLARATIONS
|
|
21760
|
+
var MANIFEST_DECLARATIONS;
|
|
21867
21761
|
var init_swift_package = __esm({
|
|
21868
21762
|
"src/swift-package.ts"() {
|
|
21869
21763
|
"use strict";
|
|
@@ -21879,7 +21773,6 @@ var init_swift_package = __esm({
|
|
|
21879
21773
|
"executable",
|
|
21880
21774
|
"package"
|
|
21881
21775
|
];
|
|
21882
|
-
NAME = /\bname\s*:\s*"([^"]+)"/;
|
|
21883
21776
|
}
|
|
21884
21777
|
});
|
|
21885
21778
|
|
|
@@ -22235,21 +22128,21 @@ function scanObjCExtensionMembers(source, tokens, records) {
|
|
|
22235
22128
|
const masked = swiftCodeMask(source);
|
|
22236
22129
|
const found = /* @__PURE__ */ new Map();
|
|
22237
22130
|
const member = /\b(func|var)\s+([A-Za-z_]\w*)/g;
|
|
22238
|
-
for (const
|
|
22239
|
-
const close = closingBrace(source, tokens,
|
|
22240
|
-
const body = masked.slice(
|
|
22131
|
+
for (const record2 of records) {
|
|
22132
|
+
const close = closingBrace(source, tokens, record2.open);
|
|
22133
|
+
const body = masked.slice(record2.open, close);
|
|
22241
22134
|
member.lastIndex = 0;
|
|
22242
22135
|
for (let match = member.exec(body); match; match = member.exec(body)) {
|
|
22243
|
-
const at =
|
|
22136
|
+
const at = record2.open + match.index + match[0].indexOf(match[1]);
|
|
22244
22137
|
let depth = 0;
|
|
22245
22138
|
for (const token of tokens) {
|
|
22246
|
-
if (token <=
|
|
22139
|
+
if (token <= record2.open) continue;
|
|
22247
22140
|
if (token >= at) break;
|
|
22248
22141
|
if (source[token] === "{") depth++;
|
|
22249
22142
|
else if (source[token] === "}") depth--;
|
|
22250
22143
|
}
|
|
22251
22144
|
if (depth > 0) continue;
|
|
22252
|
-
const head = masked.slice(
|
|
22145
|
+
const head = masked.slice(record2.open, at);
|
|
22253
22146
|
const bound = Math.max(
|
|
22254
22147
|
head.lastIndexOf(";"),
|
|
22255
22148
|
head.lastIndexOf("{"),
|
|
@@ -22260,11 +22153,11 @@ function scanObjCExtensionMembers(source, tokens, records) {
|
|
|
22260
22153
|
prefix
|
|
22261
22154
|
))
|
|
22262
22155
|
continue;
|
|
22263
|
-
if (!/@objc\b/.test(prefix) && !/@IBAction\b/.test(prefix) && !
|
|
22156
|
+
if (!/@objc\b/.test(prefix) && !/@IBAction\b/.test(prefix) && !record2.objcMembers)
|
|
22264
22157
|
continue;
|
|
22265
|
-
const members = found.get(
|
|
22158
|
+
const members = found.get(record2.type) ?? /* @__PURE__ */ new Set();
|
|
22266
22159
|
members.add(match[2]);
|
|
22267
|
-
found.set(
|
|
22160
|
+
found.set(record2.type, members);
|
|
22268
22161
|
}
|
|
22269
22162
|
}
|
|
22270
22163
|
return found;
|
|
@@ -23860,8 +23753,8 @@ function pickImagesetFile(images) {
|
|
|
23860
23753
|
scale: pick.scale === "2x" ? 2 : pick.scale === "3x" ? 3 : 1
|
|
23861
23754
|
};
|
|
23862
23755
|
}
|
|
23863
|
-
function flatScale(
|
|
23864
|
-
const match = /@([23])x\.[^./]+$/.exec(
|
|
23756
|
+
function flatScale(path35) {
|
|
23757
|
+
const match = /@([23])x\.[^./]+$/.exec(path35);
|
|
23865
23758
|
return match ? Number(match[1]) : 1;
|
|
23866
23759
|
}
|
|
23867
23760
|
function providesNamespace(text2) {
|
|
@@ -23888,13 +23781,13 @@ function catalogEntryName(contentsPath, kind, readText2) {
|
|
|
23888
23781
|
}
|
|
23889
23782
|
return segments.join("/");
|
|
23890
23783
|
}
|
|
23891
|
-
function isFlatResourceImage(
|
|
23892
|
-
return
|
|
23784
|
+
function isFlatResourceImage(path35) {
|
|
23785
|
+
return path35.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path35));
|
|
23893
23786
|
}
|
|
23894
23787
|
function enumerateBundleImages(paths, readText2) {
|
|
23895
23788
|
const table = [];
|
|
23896
23789
|
const seen = /* @__PURE__ */ new Set();
|
|
23897
|
-
const catalogs = paths.filter((
|
|
23790
|
+
const catalogs = paths.filter((path35) => baseOf(path35) === "Contents.json");
|
|
23898
23791
|
for (const contentsPath of catalogs) {
|
|
23899
23792
|
const name2 = catalogEntryName(contentsPath, ".imageset", readText2);
|
|
23900
23793
|
if (name2 === null || seen.has(name2)) continue;
|
|
@@ -23915,12 +23808,12 @@ function enumerateBundleImages(paths, readText2) {
|
|
|
23915
23808
|
seen.add(name2);
|
|
23916
23809
|
table.push({ name: name2, file: `${dir}/${pick.filename}`, scale: pick.scale });
|
|
23917
23810
|
}
|
|
23918
|
-
for (const
|
|
23919
|
-
if (!isFlatResourceImage(
|
|
23920
|
-
const name2 = baseOf(
|
|
23811
|
+
for (const path35 of paths) {
|
|
23812
|
+
if (!isFlatResourceImage(path35)) continue;
|
|
23813
|
+
const name2 = baseOf(path35).slice(0, -extOf(path35).length);
|
|
23921
23814
|
if (name2 === "" || seen.has(name2)) continue;
|
|
23922
23815
|
seen.add(name2);
|
|
23923
|
-
table.push({ name: name2, file:
|
|
23816
|
+
table.push({ name: name2, file: path35, scale: flatScale(path35) });
|
|
23924
23817
|
}
|
|
23925
23818
|
return table;
|
|
23926
23819
|
}
|
|
@@ -23949,7 +23842,7 @@ function colorsetValue(color) {
|
|
|
23949
23842
|
}
|
|
23950
23843
|
function enumerateBundleColors(paths, readText2) {
|
|
23951
23844
|
const table = {};
|
|
23952
|
-
for (const contentsPath of paths.filter((
|
|
23845
|
+
for (const contentsPath of paths.filter((path35) => baseOf(path35) === "Contents.json")) {
|
|
23953
23846
|
const name2 = catalogEntryName(contentsPath, ".colorset", readText2);
|
|
23954
23847
|
if (name2 === null || name2 in table) continue;
|
|
23955
23848
|
let colors;
|
|
@@ -23988,11 +23881,11 @@ function enumerateBundleColors(paths, readText2) {
|
|
|
23988
23881
|
function axisExtremes(points) {
|
|
23989
23882
|
const [a = 0, b = 0, c = 0, d] = points;
|
|
23990
23883
|
const out = [a, d ?? c];
|
|
23991
|
-
const
|
|
23884
|
+
const within2 = (t) => t > 0 && t < 1;
|
|
23992
23885
|
if (d === void 0) {
|
|
23993
23886
|
const denom = a - 2 * b + c;
|
|
23994
23887
|
const t = denom === 0 ? -1 : (a - b) / denom;
|
|
23995
|
-
if (
|
|
23888
|
+
if (within2(t)) out.push((1 - t) ** 2 * a + 2 * (1 - t) * t * b + t ** 2 * c);
|
|
23996
23889
|
return out;
|
|
23997
23890
|
}
|
|
23998
23891
|
const qa = 3 * (-a + 3 * b - 3 * c + d);
|
|
@@ -24004,7 +23897,7 @@ function axisExtremes(points) {
|
|
|
24004
23897
|
const root = Math.sqrt(disc);
|
|
24005
23898
|
return [(-qb + root) / (2 * qa), (-qb - root) / (2 * qa)];
|
|
24006
23899
|
})();
|
|
24007
|
-
for (const t of roots.filter(
|
|
23900
|
+
for (const t of roots.filter(within2))
|
|
24008
23901
|
out.push(
|
|
24009
23902
|
(1 - t) ** 3 * a + 3 * (1 - t) ** 2 * t * b + 3 * (1 - t) * t ** 2 * c + t ** 3 * d
|
|
24010
23903
|
);
|
|
@@ -24013,8 +23906,8 @@ function axisExtremes(points) {
|
|
|
24013
23906
|
function pathBounds(d) {
|
|
24014
23907
|
const xs = [];
|
|
24015
23908
|
const ys = [];
|
|
24016
|
-
for (const
|
|
24017
|
-
(0, import_svgpath.default)(
|
|
23909
|
+
for (const path35 of d)
|
|
23910
|
+
(0, import_svgpath.default)(path35).abs().unshort().unarc().iterate((segment, _index, x, y) => {
|
|
24018
23911
|
const [command, ...args] = segment;
|
|
24019
23912
|
if (command === "M" || command === "L") {
|
|
24020
23913
|
xs.push(Number(args[0]));
|
|
@@ -24041,7 +23934,7 @@ function guide(svg, id, axis) {
|
|
|
24041
23934
|
}
|
|
24042
23935
|
function enumerateBundleSymbols(paths, readText2) {
|
|
24043
23936
|
const table = {};
|
|
24044
|
-
for (const contentsPath of paths.filter((
|
|
23937
|
+
for (const contentsPath of paths.filter((path35) => baseOf(path35) === "Contents.json")) {
|
|
24045
23938
|
const name2 = catalogEntryName(contentsPath, ".symbolset", readText2);
|
|
24046
23939
|
if (name2 === null || name2 in table) continue;
|
|
24047
23940
|
let symbols;
|
|
@@ -24074,8 +23967,8 @@ function enumerateBundleSymbols(paths, readText2) {
|
|
|
24074
23967
|
viewBox: "0 0 24 24",
|
|
24075
23968
|
advance,
|
|
24076
23969
|
box: [12 - advance / 2, 12 - tall / 2, advance, tall],
|
|
24077
|
-
layers: d.map((
|
|
24078
|
-
d: (0, import_svgpath.default)(
|
|
23970
|
+
layers: d.map((path35) => ({
|
|
23971
|
+
d: (0, import_svgpath.default)(path35).abs().scale(scale).translate(translateX, translateY).round(3).toString()
|
|
24079
23972
|
}))
|
|
24080
23973
|
};
|
|
24081
23974
|
}
|
|
@@ -24085,7 +23978,7 @@ function enumerateBundleJson(paths) {
|
|
|
24085
23978
|
const found = [];
|
|
24086
23979
|
const seen = /* @__PURE__ */ new Set();
|
|
24087
23980
|
const ordered = [...paths].filter(
|
|
24088
|
-
(
|
|
23981
|
+
(path35) => path35.split("/").includes("Resources") && path35.split("/").every((segment) => segment !== "" && segment !== "..") && (extOf(path35) === ".json" || extOf(path35) === ".xcstrings")
|
|
24089
23982
|
).sort((a, b) => {
|
|
24090
23983
|
const aDepth = a.split("/").length;
|
|
24091
23984
|
const bDepth = b.split("/").length;
|
|
@@ -24354,9 +24247,226 @@ var init_auth = __esm({
|
|
|
24354
24247
|
}
|
|
24355
24248
|
});
|
|
24356
24249
|
|
|
24357
|
-
// src/swift-
|
|
24250
|
+
// src/swift-package-manifest.ts
|
|
24251
|
+
function swiftCommand() {
|
|
24252
|
+
return process.platform === "darwin" ? { file: "xcrun", args: ["swift"] } : { file: import_node_path13.default.join(swiftToolchainBin(swift_distribution_lock_default.release), "swift"), args: [] };
|
|
24253
|
+
}
|
|
24254
|
+
function dump(dir) {
|
|
24255
|
+
const manifests = import_node_fs13.default.readdirSync(dir).filter((name2) => /^Package(@swift-[\d.]+)?\.swift$/.test(name2)).sort();
|
|
24256
|
+
const command = swiftCommand();
|
|
24257
|
+
const key = (0, import_node_crypto5.createHash)("sha256").update(JSON.stringify([command, import_node_path13.default.resolve(dir)])).update(
|
|
24258
|
+
manifests.map((name2) => `${name2}\0${import_node_fs13.default.readFileSync(import_node_path13.default.join(dir, name2), "utf8")}`).join("\0")
|
|
24259
|
+
).digest("hex").slice(0, 32);
|
|
24260
|
+
const cached4 = import_node_path13.default.join(cacheDir2, `${key}.json`);
|
|
24261
|
+
if (import_node_fs13.default.existsSync(cached4))
|
|
24262
|
+
return { key, raw: record(JSON.parse(import_node_fs13.default.readFileSync(cached4, "utf8"))) };
|
|
24263
|
+
let output;
|
|
24264
|
+
try {
|
|
24265
|
+
output = (0, import_node_child_process7.execFileSync)(
|
|
24266
|
+
command.file,
|
|
24267
|
+
[
|
|
24268
|
+
...command.args,
|
|
24269
|
+
"package",
|
|
24270
|
+
"--package-path",
|
|
24271
|
+
dir,
|
|
24272
|
+
// swiftpm's scratch files never land in the app's own package
|
|
24273
|
+
"--scratch-path",
|
|
24274
|
+
import_node_path13.default.join(cacheDir2, `${key}.build`),
|
|
24275
|
+
"dump-package"
|
|
24276
|
+
],
|
|
24277
|
+
{
|
|
24278
|
+
encoding: "utf8",
|
|
24279
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
24280
|
+
maxBuffer: 64 * 1024 * 1024
|
|
24281
|
+
}
|
|
24282
|
+
);
|
|
24283
|
+
} catch (error) {
|
|
24284
|
+
const stderr = error instanceof Error && "stderr" in error ? String(error.stderr).trim() : "";
|
|
24285
|
+
throw new Error(
|
|
24286
|
+
`swiftpm could not evaluate ${import_node_path13.default.join(dir, "Package.swift")}${stderr ? `: ${stderr}` : ""}`
|
|
24287
|
+
);
|
|
24288
|
+
}
|
|
24289
|
+
import_node_fs13.default.mkdirSync(cacheDir2, { recursive: true });
|
|
24290
|
+
import_node_fs13.default.writeFileSync(cached4, output);
|
|
24291
|
+
return { key, raw: record(JSON.parse(output)) };
|
|
24292
|
+
}
|
|
24293
|
+
function defaultTraits(manifest) {
|
|
24294
|
+
const traits = new Map(
|
|
24295
|
+
array(manifest.traits).map((trait) => [
|
|
24296
|
+
string(record(trait).name) ?? "",
|
|
24297
|
+
array(record(trait).enabledTraits).flatMap((name2) => string(name2) ?? [])
|
|
24298
|
+
])
|
|
24299
|
+
);
|
|
24300
|
+
const enabled = /* @__PURE__ */ new Set();
|
|
24301
|
+
const pending = [...traits.get("default") ?? []];
|
|
24302
|
+
while (pending.length > 0) {
|
|
24303
|
+
const name2 = pending.pop();
|
|
24304
|
+
if (enabled.has(name2)) continue;
|
|
24305
|
+
enabled.add(name2);
|
|
24306
|
+
pending.push(...traits.get(name2) ?? []);
|
|
24307
|
+
}
|
|
24308
|
+
return enabled;
|
|
24309
|
+
}
|
|
24310
|
+
function linksOnIOS(condition, traits) {
|
|
24311
|
+
const { platformNames, traits: needed } = record(condition);
|
|
24312
|
+
const platforms = array(platformNames);
|
|
24313
|
+
if (platforms.length > 0 && !platforms.includes("ios")) return false;
|
|
24314
|
+
const gates = array(needed);
|
|
24315
|
+
return gates.length === 0 || gates.some((name2) => traits.has(string(name2) ?? ""));
|
|
24316
|
+
}
|
|
24317
|
+
function swiftPackageManifest(dir) {
|
|
24318
|
+
dir = import_node_fs13.default.realpathSync(dir);
|
|
24319
|
+
const { key, raw: raw2 } = dump(dir);
|
|
24320
|
+
const known = evaluated.get(key);
|
|
24321
|
+
if (known) return known;
|
|
24322
|
+
const traits = defaultTraits(raw2);
|
|
24323
|
+
const tools = Number(
|
|
24324
|
+
/^(\d+)/.exec(string(record(raw2.toolsVersion)._version) ?? "5")?.[1] ?? 5
|
|
24325
|
+
);
|
|
24326
|
+
const declaredModes = array(raw2.swiftLanguageVersions).flatMap((mode) => {
|
|
24327
|
+
const major = Number(/^(\d+)/.exec(string(mode) ?? "")?.[1]);
|
|
24328
|
+
return Number.isFinite(major) ? [major] : [];
|
|
24329
|
+
});
|
|
24330
|
+
const packageMode = Math.max(
|
|
24331
|
+
5,
|
|
24332
|
+
declaredModes.length > 0 ? Math.max(...declaredModes) : tools >= 6 ? 6 : 5
|
|
24333
|
+
);
|
|
24334
|
+
const packages = /* @__PURE__ */ new Map();
|
|
24335
|
+
for (const entry of array(raw2.dependencies)) {
|
|
24336
|
+
const { sourceControl, fileSystem } = record(entry);
|
|
24337
|
+
const source = record(array(sourceControl ?? fileSystem)[0]);
|
|
24338
|
+
const identity = string(source.identity);
|
|
24339
|
+
if (!identity) continue;
|
|
24340
|
+
const url = string(record(array(record(source.location).remote)[0]).urlString);
|
|
24341
|
+
const local = string(source.path);
|
|
24342
|
+
const value = url ? { url } : local ? { dir: local } : null;
|
|
24343
|
+
if (!value) continue;
|
|
24344
|
+
packages.set(identity, value);
|
|
24345
|
+
const alias = string(source.nameForTargetDependencyResolutionOnly);
|
|
24346
|
+
if (alias) packages.set(alias.toLowerCase(), value);
|
|
24347
|
+
}
|
|
24348
|
+
const products = /* @__PURE__ */ new Map();
|
|
24349
|
+
for (const product of array(raw2.products)) {
|
|
24350
|
+
const { name: name2, targets: targets2, type } = record(product);
|
|
24351
|
+
if (!string(name2) || !("library" in record(type))) continue;
|
|
24352
|
+
products.set(
|
|
24353
|
+
string(name2),
|
|
24354
|
+
array(targets2).flatMap((target) => string(target) ?? [])
|
|
24355
|
+
);
|
|
24356
|
+
}
|
|
24357
|
+
const targets = /* @__PURE__ */ new Map();
|
|
24358
|
+
const names = new Set(array(raw2.targets).map((target) => string(record(target).name)));
|
|
24359
|
+
for (const entry of array(raw2.targets)) {
|
|
24360
|
+
const target = record(entry);
|
|
24361
|
+
const name2 = string(target.name);
|
|
24362
|
+
const kind = string(target.type);
|
|
24363
|
+
if (!name2 || !isTargetType(kind)) continue;
|
|
24364
|
+
const declared = string(target.path);
|
|
24365
|
+
const roots = kind === "test" ? ["Tests"] : ["Sources", "Source", "src", "srcs"];
|
|
24366
|
+
const targetDir = declared ? import_node_path13.default.resolve(dir, declared) : roots.map((root) => import_node_path13.default.join(dir, root, name2)).find((candidate) => import_node_fs13.default.existsSync(candidate)) ?? import_node_path13.default.join(dir, roots[0], name2);
|
|
24367
|
+
const dependencies = [];
|
|
24368
|
+
for (const dependency of array(target.dependencies)) {
|
|
24369
|
+
const { target: local, product, byName } = record(dependency);
|
|
24370
|
+
const payload = array(local ?? product ?? byName);
|
|
24371
|
+
if (!linksOnIOS(payload[payload.length - 1], traits)) continue;
|
|
24372
|
+
const dependencyName = string(payload[0]);
|
|
24373
|
+
if (!dependencyName) continue;
|
|
24374
|
+
if (product)
|
|
24375
|
+
dependencies.push({
|
|
24376
|
+
kind: "product",
|
|
24377
|
+
name: dependencyName,
|
|
24378
|
+
package: (string(payload[1]) ?? "").toLowerCase()
|
|
24379
|
+
});
|
|
24380
|
+
else if (local || names.has(dependencyName))
|
|
24381
|
+
dependencies.push({ kind: "target", name: dependencyName });
|
|
24382
|
+
else
|
|
24383
|
+
dependencies.push({
|
|
24384
|
+
kind: "product",
|
|
24385
|
+
name: dependencyName,
|
|
24386
|
+
package: dependencyName.toLowerCase()
|
|
24387
|
+
});
|
|
24388
|
+
}
|
|
24389
|
+
let languageMode = packageMode;
|
|
24390
|
+
let mainActorIsolation = false;
|
|
24391
|
+
for (const setting of array(target.settings)) {
|
|
24392
|
+
const settingKind = record(record(setting).kind);
|
|
24393
|
+
const mode = string(record(settingKind.swiftLanguageMode)._0);
|
|
24394
|
+
if (mode)
|
|
24395
|
+
languageMode = Math.max(5, Number(/^(\d+)/.exec(mode)?.[1] ?? languageMode));
|
|
24396
|
+
if (string(record(settingKind.defaultIsolation)._0) === "MainActor")
|
|
24397
|
+
mainActorIsolation = true;
|
|
24398
|
+
}
|
|
24399
|
+
targets.set(name2, {
|
|
24400
|
+
name: name2,
|
|
24401
|
+
type: kind,
|
|
24402
|
+
dir: targetDir,
|
|
24403
|
+
sources: target.sources == null ? null : array(target.sources).flatMap((file) => string(file) ?? []),
|
|
24404
|
+
exclude: array(target.exclude).flatMap((file) => string(file) ?? []),
|
|
24405
|
+
dependencies,
|
|
24406
|
+
languageMode,
|
|
24407
|
+
mainActorIsolation,
|
|
24408
|
+
declaresResources: array(target.resources).length > 0
|
|
24409
|
+
});
|
|
24410
|
+
}
|
|
24411
|
+
const manifest = { dir, products, targets, packages };
|
|
24412
|
+
evaluated.set(key, manifest);
|
|
24413
|
+
return manifest;
|
|
24414
|
+
}
|
|
24415
|
+
function walk(dir) {
|
|
24416
|
+
if (!import_node_fs13.default.existsSync(dir)) return [];
|
|
24417
|
+
if (import_node_fs13.default.statSync(dir).isFile()) return [dir];
|
|
24418
|
+
const out = [];
|
|
24419
|
+
for (const entry of import_node_fs13.default.readdirSync(dir, { withFileTypes: true })) {
|
|
24420
|
+
if (entry.name.startsWith(".")) continue;
|
|
24421
|
+
const full = import_node_path13.default.join(dir, entry.name);
|
|
24422
|
+
if (entry.isDirectory()) out.push(...walk(full));
|
|
24423
|
+
else if (entry.isFile()) out.push(full);
|
|
24424
|
+
}
|
|
24425
|
+
return out;
|
|
24426
|
+
}
|
|
24427
|
+
function swiftTargetFiles(manifest, target) {
|
|
24428
|
+
const included = target.sources ? target.sources.map((source) => import_node_path13.default.resolve(target.dir, source)) : [target.dir];
|
|
24429
|
+
const excluded = [
|
|
24430
|
+
...target.exclude.map((file) => import_node_path13.default.resolve(target.dir, file)),
|
|
24431
|
+
...[...manifest.targets.values()].flatMap(
|
|
24432
|
+
(other) => other !== target && within(other.dir, [target.dir]) && other.dir !== target.dir ? [other.dir] : []
|
|
24433
|
+
)
|
|
24434
|
+
];
|
|
24435
|
+
return included.flatMap(walk).filter((file) => !within(file, excluded)).sort();
|
|
24436
|
+
}
|
|
24437
|
+
var import_node_child_process7, import_node_crypto5, import_node_fs13, import_node_os5, import_node_path13, TARGET_TYPES, isTargetType, record, array, string, cacheDir2, evaluated, within;
|
|
24438
|
+
var init_swift_package_manifest = __esm({
|
|
24439
|
+
"src/swift-package-manifest.ts"() {
|
|
24440
|
+
"use strict";
|
|
24441
|
+
import_node_child_process7 = require("node:child_process");
|
|
24442
|
+
import_node_crypto5 = require("node:crypto");
|
|
24443
|
+
import_node_fs13 = __toESM(require("node:fs"), 1);
|
|
24444
|
+
import_node_os5 = __toESM(require("node:os"), 1);
|
|
24445
|
+
import_node_path13 = __toESM(require("node:path"), 1);
|
|
24446
|
+
init_swift_distribution_lock();
|
|
24447
|
+
init_swift_toolchain();
|
|
24448
|
+
TARGET_TYPES = [
|
|
24449
|
+
"regular",
|
|
24450
|
+
"executable",
|
|
24451
|
+
"test",
|
|
24452
|
+
"binary",
|
|
24453
|
+
"system",
|
|
24454
|
+
"macro",
|
|
24455
|
+
"plugin"
|
|
24456
|
+
];
|
|
24457
|
+
isTargetType = (value) => TARGET_TYPES.some((type) => type === value);
|
|
24458
|
+
record = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
24459
|
+
array = (value) => Array.isArray(value) ? value : [];
|
|
24460
|
+
string = (value) => typeof value === "string" ? value : void 0;
|
|
24461
|
+
cacheDir2 = import_node_path13.default.join(import_node_os5.default.tmpdir(), "peach-swift-manifests");
|
|
24462
|
+
evaluated = /* @__PURE__ */ new Map();
|
|
24463
|
+
within = (file, roots) => roots.some((root) => file === root || file.startsWith(`${root}${import_node_path13.default.sep}`));
|
|
24464
|
+
}
|
|
24465
|
+
});
|
|
24466
|
+
|
|
24467
|
+
// src/swift-packages.ts
|
|
24358
24468
|
function readPins(resolved) {
|
|
24359
|
-
const data = JSON.parse(
|
|
24469
|
+
const data = JSON.parse(import_node_fs14.default.readFileSync(resolved, "utf8"));
|
|
24360
24470
|
const pins = data && typeof data === "object" && "pins" in data && Array.isArray(data.pins) ? data.pins : null;
|
|
24361
24471
|
if (!pins)
|
|
24362
24472
|
throw new Error(`${resolved} has no pins; resolve packages in a current Xcode`);
|
|
@@ -24370,35 +24480,24 @@ function readPins(resolved) {
|
|
|
24370
24480
|
}
|
|
24371
24481
|
return out;
|
|
24372
24482
|
}
|
|
24373
|
-
function walk(dir) {
|
|
24374
|
-
if (!import_node_fs13.default.existsSync(dir)) return [];
|
|
24375
|
-
const out = [];
|
|
24376
|
-
for (const entry of import_node_fs13.default.readdirSync(dir, { withFileTypes: true })) {
|
|
24377
|
-
if (entry.name.startsWith(".")) continue;
|
|
24378
|
-
const full = import_node_path13.default.join(dir, entry.name);
|
|
24379
|
-
if (entry.isDirectory()) out.push(...walk(full));
|
|
24380
|
-
else if (entry.isFile()) out.push(full);
|
|
24381
|
-
}
|
|
24382
|
-
return out.sort();
|
|
24383
|
-
}
|
|
24384
24483
|
function checkout(checkouts, identity, pin) {
|
|
24385
|
-
const dir =
|
|
24484
|
+
const dir = import_node_path14.default.join(checkouts, identity);
|
|
24386
24485
|
const key = `${dir}\0${pin.revision}`;
|
|
24387
24486
|
if (verified2.has(key)) return dir;
|
|
24388
|
-
const git = (...args) => (0,
|
|
24487
|
+
const git = (...args) => (0, import_node_child_process8.execFileSync)("git", ["-C", dir, ...args], {
|
|
24389
24488
|
encoding: "utf8",
|
|
24390
24489
|
stdio: ["ignore", "pipe", "pipe"]
|
|
24391
24490
|
}).trim();
|
|
24392
|
-
const current =
|
|
24491
|
+
const current = import_node_fs14.default.existsSync(import_node_path14.default.join(dir, ".git")) ? git("rev-parse", "HEAD") : "";
|
|
24393
24492
|
if (current !== pin.revision) {
|
|
24394
|
-
|
|
24395
|
-
|
|
24493
|
+
import_node_fs14.default.rmSync(dir, { recursive: true, force: true });
|
|
24494
|
+
import_node_fs14.default.mkdirSync(dir, { recursive: true });
|
|
24396
24495
|
try {
|
|
24397
24496
|
git("init", "-q");
|
|
24398
24497
|
git("fetch", "-q", "--depth", "1", pin.location, pin.revision);
|
|
24399
24498
|
git("checkout", "-q", "FETCH_HEAD");
|
|
24400
24499
|
} catch (error) {
|
|
24401
|
-
|
|
24500
|
+
import_node_fs14.default.rmSync(dir, { recursive: true, force: true });
|
|
24402
24501
|
const stderr = error instanceof Error && "stderr" in error ? String(error.stderr).trim() : "";
|
|
24403
24502
|
throw new Error(
|
|
24404
24503
|
`could not fetch ${pin.location} at ${pin.revision}${stderr ? `: ${stderr}` : ""}`
|
|
@@ -24408,138 +24507,165 @@ function checkout(checkouts, identity, pin) {
|
|
|
24408
24507
|
verified2.add(key);
|
|
24409
24508
|
return dir;
|
|
24410
24509
|
}
|
|
24411
|
-
function
|
|
24412
|
-
const
|
|
24413
|
-
const
|
|
24414
|
-
|
|
24415
|
-
|
|
24416
|
-
|
|
24417
|
-
|
|
24418
|
-
|
|
24419
|
-
|
|
24420
|
-
|
|
24421
|
-
return result;
|
|
24422
|
-
}
|
|
24423
|
-
const pins = readPins(resolved);
|
|
24424
|
-
const checkouts = import_node_path13.default.join(projectDir, REMOTE_CHECKOUTS);
|
|
24425
|
-
import_node_fs13.default.mkdirSync(checkouts, { recursive: true });
|
|
24426
|
-
import_node_fs13.default.writeFileSync(import_node_path13.default.join(import_node_path13.default.dirname(checkouts), ".gitignore"), "*\n");
|
|
24510
|
+
function resolveSwiftPackages(options) {
|
|
24511
|
+
const { rootDir, resolved, products, localDirs } = options;
|
|
24512
|
+
const provided = options.provided ?? /* @__PURE__ */ new Set();
|
|
24513
|
+
const result = {
|
|
24514
|
+
targets: [],
|
|
24515
|
+
unavailable: /* @__PURE__ */ new Map(),
|
|
24516
|
+
modules: /* @__PURE__ */ new Map()
|
|
24517
|
+
};
|
|
24518
|
+
const pins = resolved ? readPins(resolved) : null;
|
|
24519
|
+
const checkouts = import_node_path14.default.join(rootDir, REMOTE_CHECKOUTS);
|
|
24427
24520
|
const packages = /* @__PURE__ */ new Map();
|
|
24428
|
-
const load2 = (
|
|
24429
|
-
const
|
|
24430
|
-
|
|
24431
|
-
|
|
24432
|
-
|
|
24433
|
-
|
|
24434
|
-
|
|
24435
|
-
|
|
24436
|
-
|
|
24521
|
+
const load2 = (source) => {
|
|
24522
|
+
const key = source.kind === "local" ? import_node_path14.default.resolve(source.dir) : source.url;
|
|
24523
|
+
const cached4 = packages.get(key);
|
|
24524
|
+
if (cached4 !== void 0) return cached4;
|
|
24525
|
+
let loaded2;
|
|
24526
|
+
if (source.kind === "local") {
|
|
24527
|
+
loaded2 = { source: key, remote: false, manifest: swiftPackageManifest(key) };
|
|
24528
|
+
} else {
|
|
24529
|
+
const identity = swiftPackageIdentity(source.url);
|
|
24530
|
+
const pin = pins?.get(identity);
|
|
24531
|
+
if (!pin) {
|
|
24532
|
+
loaded2 = pins ? `package ${identity} is not pinned in Package.resolved` : "no Package.resolved pins it; resolve packages in Xcode once";
|
|
24533
|
+
} else {
|
|
24534
|
+
import_node_fs14.default.mkdirSync(checkouts, { recursive: true });
|
|
24535
|
+
import_node_fs14.default.writeFileSync(import_node_path14.default.join(import_node_path14.default.dirname(checkouts), ".gitignore"), "*\n");
|
|
24536
|
+
loaded2 = {
|
|
24537
|
+
source: source.url,
|
|
24538
|
+
remote: true,
|
|
24539
|
+
manifest: swiftPackageManifest(checkout(checkouts, identity, pin))
|
|
24540
|
+
};
|
|
24541
|
+
}
|
|
24542
|
+
}
|
|
24543
|
+
packages.set(key, loaded2);
|
|
24437
24544
|
return loaded2;
|
|
24438
24545
|
};
|
|
24439
24546
|
const targets = /* @__PURE__ */ new Map();
|
|
24440
|
-
const
|
|
24441
|
-
const
|
|
24442
|
-
const key = `${
|
|
24443
|
-
if (
|
|
24444
|
-
|
|
24445
|
-
const
|
|
24446
|
-
|
|
24447
|
-
|
|
24448
|
-
return
|
|
24449
|
-
|
|
24450
|
-
|
|
24451
|
-
|
|
24452
|
-
|
|
24453
|
-
|
|
24454
|
-
|
|
24455
|
-
|
|
24456
|
-
|
|
24457
|
-
|
|
24458
|
-
|
|
24459
|
-
|
|
24460
|
-
const pending = [...roots];
|
|
24461
|
-
let reason = null;
|
|
24462
|
-
while (pending.length > 0 && !reason) {
|
|
24463
|
-
const name2 = pending.pop();
|
|
24464
|
-
if (seen.has(name2) || provided.has(name2)) continue;
|
|
24465
|
-
seen.add(name2);
|
|
24466
|
-
if (pkg.graph.binaryTargets.has(name2)) {
|
|
24467
|
-
reason = `${name2} is a binary framework`;
|
|
24468
|
-
break;
|
|
24469
|
-
}
|
|
24470
|
-
if (pkg.graph.systemLibraries.has(name2)) {
|
|
24471
|
-
reason = `${name2} is a system C library`;
|
|
24472
|
-
break;
|
|
24473
|
-
}
|
|
24474
|
-
const target = declared.get(name2);
|
|
24475
|
-
if (!target) {
|
|
24476
|
-
reason = `${identity} declares no target ${name2}`;
|
|
24477
|
-
break;
|
|
24478
|
-
}
|
|
24479
|
-
const files = walk(import_node_path13.default.join(pkg.dir, target.path));
|
|
24480
|
-
if (files.some((file) => C_FAMILY.test(file))) {
|
|
24481
|
-
reason = `${name2} is a C or Objective-C target`;
|
|
24482
|
-
break;
|
|
24483
|
-
}
|
|
24484
|
-
reached.push(target);
|
|
24485
|
-
for (const dependency of pkg.graph.dependencies.get(name2) ?? []) {
|
|
24486
|
-
if (dependency.kind === "target") pending.push(dependency.name);
|
|
24487
|
-
else if (!provided.has(dependency.name)) {
|
|
24488
|
-
const url = pkg.graph.packageURLs.get(dependency.package);
|
|
24489
|
-
const nested = resolveProduct(
|
|
24490
|
-
url ? swiftPackageIdentity(url) : dependency.package,
|
|
24491
|
-
dependency.name
|
|
24492
|
-
);
|
|
24493
|
-
if (nested) reason = `${dependency.name}: ${nested}`;
|
|
24547
|
+
const targetOutcomes = /* @__PURE__ */ new Map();
|
|
24548
|
+
const resolveTarget = (pkg, name2) => {
|
|
24549
|
+
const key = `${pkg.manifest.dir}\0${name2}`;
|
|
24550
|
+
if (targetOutcomes.has(key)) return targetOutcomes.get(key);
|
|
24551
|
+
targetOutcomes.set(key, null);
|
|
24552
|
+
const outcome = (() => {
|
|
24553
|
+
if (provided.has(name2)) return null;
|
|
24554
|
+
const target = pkg.manifest.targets.get(name2);
|
|
24555
|
+
if (!target) return `${import_node_path14.default.basename(pkg.manifest.dir)} declares no target ${name2}`;
|
|
24556
|
+
if (target.type === "binary") return `${name2} is a binary framework`;
|
|
24557
|
+
if (target.type === "system") return `${name2} is a system C library`;
|
|
24558
|
+
if (target.type !== "regular") return `${name2} is a ${target.type} target`;
|
|
24559
|
+
const files = swiftTargetFiles(pkg.manifest, target);
|
|
24560
|
+
if (files.some((file) => C_FAMILY.test(file)))
|
|
24561
|
+
return `${name2} is a C or Objective-C target`;
|
|
24562
|
+
for (const dependency of target.dependencies) {
|
|
24563
|
+
if (dependency.kind === "target") {
|
|
24564
|
+
const nested2 = resolveTarget(pkg, dependency.name);
|
|
24565
|
+
if (nested2) return nested2;
|
|
24566
|
+
continue;
|
|
24494
24567
|
}
|
|
24568
|
+
const nested = resolveDependencyProduct(pkg, dependency.package, dependency.name);
|
|
24569
|
+
if (nested) return `${dependency.name}: ${nested}`;
|
|
24495
24570
|
}
|
|
24496
|
-
|
|
24497
|
-
|
|
24498
|
-
|
|
24499
|
-
|
|
24500
|
-
|
|
24501
|
-
|
|
24502
|
-
|
|
24503
|
-
|
|
24504
|
-
)
|
|
24505
|
-
);
|
|
24506
|
-
const withResources = new Map(
|
|
24507
|
-
swiftManifestTargets(pkg.manifest, relative3).map((target) => [target.name, target])
|
|
24508
|
-
);
|
|
24509
|
-
for (const target of reached) {
|
|
24510
|
-
const dir = import_node_path13.default.join(pkg.dir, target.path);
|
|
24511
|
-
targets.set(target.name, {
|
|
24512
|
-
...withResources.get(target.name) ?? target,
|
|
24571
|
+
const relative3 = files.map((file) => import_node_path14.default.relative(target.dir, file));
|
|
24572
|
+
targets.set(`${pkg.manifest.dir}\0${name2}`, {
|
|
24573
|
+
name: name2,
|
|
24574
|
+
path: "",
|
|
24575
|
+
dir: target.dir,
|
|
24576
|
+
files,
|
|
24577
|
+
packageDir: pkg.manifest.dir,
|
|
24578
|
+
remote: pkg.remote,
|
|
24513
24579
|
executable: false,
|
|
24514
|
-
|
|
24515
|
-
|
|
24580
|
+
languageMode: target.languageMode,
|
|
24581
|
+
mainActorIsolation: target.mainActorIsolation,
|
|
24582
|
+
resources: target.declaresResources || swiftImplicitResourcePaths(relative3).length > 0
|
|
24516
24583
|
});
|
|
24584
|
+
return null;
|
|
24585
|
+
})();
|
|
24586
|
+
targetOutcomes.set(key, outcome);
|
|
24587
|
+
return outcome;
|
|
24588
|
+
};
|
|
24589
|
+
const resolveProduct = (pkg, product) => {
|
|
24590
|
+
if (provided.has(product)) return null;
|
|
24591
|
+
const roots = pkg.manifest.products.get(product);
|
|
24592
|
+
if (!roots) return `${import_node_path14.default.basename(pkg.manifest.dir)} has no library ${product}`;
|
|
24593
|
+
for (const name2 of roots) {
|
|
24594
|
+
const reason = resolveTarget(pkg, name2);
|
|
24595
|
+
if (reason) return reason;
|
|
24517
24596
|
}
|
|
24518
24597
|
return null;
|
|
24519
24598
|
};
|
|
24520
|
-
|
|
24521
|
-
|
|
24522
|
-
|
|
24523
|
-
|
|
24524
|
-
|
|
24599
|
+
const resolveDependencyProduct = (pkg, packageName, product) => {
|
|
24600
|
+
if (provided.has(product)) return null;
|
|
24601
|
+
const dependency = pkg.manifest.packages.get(packageName);
|
|
24602
|
+
if (!dependency)
|
|
24603
|
+
return `${import_node_path14.default.basename(pkg.manifest.dir)} names no package ${packageName}`;
|
|
24604
|
+
if ("dir" in dependency) {
|
|
24605
|
+
const loaded3 = load2({ kind: "local", dir: dependency.dir });
|
|
24606
|
+
return typeof loaded3 === "string" ? loaded3 : resolveProduct(loaded3, product);
|
|
24607
|
+
}
|
|
24608
|
+
if (!options.provided) return null;
|
|
24609
|
+
const loaded2 = load2({ kind: "remote", url: dependency.url });
|
|
24610
|
+
return typeof loaded2 === "string" ? loaded2 : resolveProduct(loaded2, product);
|
|
24611
|
+
};
|
|
24612
|
+
const unnamed = () => localDirs.map((dir) => load2({ kind: "local", dir })).filter((pkg) => typeof pkg !== "string");
|
|
24613
|
+
for (const { product, source } of products) {
|
|
24614
|
+
if (provided.has(product)) continue;
|
|
24615
|
+
if (source.kind === "remote" && !options.provided) continue;
|
|
24616
|
+
const pkg = source.kind === "unnamed" ? unnamed().find((candidate) => candidate.manifest.products.has(product)) : load2(source);
|
|
24617
|
+
const reason = pkg === void 0 ? "no package the workspace references vends it" : typeof pkg === "string" ? pkg : resolveProduct(pkg, product);
|
|
24525
24618
|
if (reason)
|
|
24526
|
-
result.unavailable.set(
|
|
24527
|
-
|
|
24619
|
+
result.unavailable.set(product, {
|
|
24620
|
+
source: source.kind === "remote" ? source.url : typeof pkg === "object" ? pkg.source : source.kind === "local" ? source.dir : "the workspace",
|
|
24528
24621
|
reason
|
|
24529
24622
|
});
|
|
24530
24623
|
}
|
|
24531
|
-
|
|
24624
|
+
for (const pkg of packages.values()) {
|
|
24625
|
+
if (typeof pkg === "string") continue;
|
|
24626
|
+
for (const [name2, target] of pkg.manifest.targets) {
|
|
24627
|
+
if (target.type === "test" || target.type === "plugin" || target.type === "macro")
|
|
24628
|
+
continue;
|
|
24629
|
+
if (target.type === "executable") continue;
|
|
24630
|
+
const reason = resolveTarget(pkg, name2);
|
|
24631
|
+
if (reason && !result.modules.has(name2))
|
|
24632
|
+
result.modules.set(name2, { source: pkg.source, reason });
|
|
24633
|
+
}
|
|
24634
|
+
}
|
|
24635
|
+
const reached = /* @__PURE__ */ new Set();
|
|
24636
|
+
const reach = (pkg, name2) => {
|
|
24637
|
+
const key = `${pkg.manifest.dir}\0${name2}`;
|
|
24638
|
+
if (reached.has(key) || !targets.has(key)) return;
|
|
24639
|
+
reached.add(key);
|
|
24640
|
+
for (const dependency of pkg.manifest.targets.get(name2)?.dependencies ?? []) {
|
|
24641
|
+
if (dependency.kind === "target") reach(pkg, dependency.name);
|
|
24642
|
+
else {
|
|
24643
|
+
const source = pkg.manifest.packages.get(dependency.package);
|
|
24644
|
+
const nested = source && ("dir" in source ? packages.get(import_node_path14.default.resolve(source.dir)) : packages.get(source.url));
|
|
24645
|
+
if (nested && typeof nested !== "string")
|
|
24646
|
+
for (const root of nested.manifest.products.get(dependency.name) ?? [])
|
|
24647
|
+
reach(nested, root);
|
|
24648
|
+
}
|
|
24649
|
+
}
|
|
24650
|
+
};
|
|
24651
|
+
for (const { product, source } of products) {
|
|
24652
|
+
const pkg = source.kind === "unnamed" ? unnamed().find((candidate) => candidate.manifest.products.has(product)) : packages.get(source.kind === "local" ? import_node_path14.default.resolve(source.dir) : source.url);
|
|
24653
|
+
if (!pkg || typeof pkg === "string" || result.unavailable.has(product)) continue;
|
|
24654
|
+
for (const root of pkg.manifest.products.get(product) ?? []) reach(pkg, root);
|
|
24655
|
+
}
|
|
24656
|
+
result.targets = [...targets.entries()].filter(([key]) => reached.has(key)).map(([, target]) => target);
|
|
24532
24657
|
return result;
|
|
24533
24658
|
}
|
|
24534
|
-
var
|
|
24535
|
-
var
|
|
24536
|
-
"src/swift-
|
|
24659
|
+
var import_node_child_process8, import_node_fs14, import_node_path14, REMOTE_CHECKOUTS, C_FAMILY, verified2;
|
|
24660
|
+
var init_swift_packages = __esm({
|
|
24661
|
+
"src/swift-packages.ts"() {
|
|
24537
24662
|
"use strict";
|
|
24538
|
-
|
|
24539
|
-
|
|
24540
|
-
|
|
24663
|
+
import_node_child_process8 = require("node:child_process");
|
|
24664
|
+
import_node_fs14 = __toESM(require("node:fs"), 1);
|
|
24665
|
+
import_node_path14 = __toESM(require("node:path"), 1);
|
|
24541
24666
|
init_swift_package();
|
|
24542
|
-
|
|
24667
|
+
init_swift_package_manifest();
|
|
24668
|
+
REMOTE_CHECKOUTS = import_node_path14.default.join(".build", "peach", "checkouts");
|
|
24543
24669
|
C_FAMILY = /\.(c|cc|cpp|cxx|m|mm|s|S)$/;
|
|
24544
24670
|
verified2 = /* @__PURE__ */ new Set();
|
|
24545
24671
|
}
|
|
@@ -24681,7 +24807,7 @@ var init_swift_submit = __esm({
|
|
|
24681
24807
|
function readXcodeJsonProject(xcodeproj, source) {
|
|
24682
24808
|
const json = import_json5.default.parse(source);
|
|
24683
24809
|
if (!isJsonObject(json)) throw new Error(`${xcodeproj}/project.xcproj is not an object`);
|
|
24684
|
-
const projectDir =
|
|
24810
|
+
const projectDir = import_node_path15.default.dirname(xcodeproj);
|
|
24685
24811
|
const objects = {};
|
|
24686
24812
|
let next = 0;
|
|
24687
24813
|
const add = (entry, id) => {
|
|
@@ -24694,7 +24820,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
24694
24820
|
const base = /^<([A-Z]+)>\/(.*)$/.exec(raw2);
|
|
24695
24821
|
if (base) {
|
|
24696
24822
|
if (base[1] === "PROJECT")
|
|
24697
|
-
return { sourceTree: "<absolute>", path:
|
|
24823
|
+
return { sourceTree: "<absolute>", path: import_node_path15.default.join(projectDir, base[2]) };
|
|
24698
24824
|
if (base[1] === "PRODUCTS")
|
|
24699
24825
|
return { sourceTree: "BUILT_PRODUCTS_DIR", path: base[2] };
|
|
24700
24826
|
return null;
|
|
@@ -24702,7 +24828,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
24702
24828
|
const unescaped = raw2.replaceAll("\\<", "<");
|
|
24703
24829
|
if (unescaped.startsWith("/")) return { sourceTree: "<absolute>", path: unescaped };
|
|
24704
24830
|
if (unescaped.startsWith("~")) return null;
|
|
24705
|
-
return groupDir === null ? null : { sourceTree: "<absolute>", path:
|
|
24831
|
+
return groupDir === null ? null : { sourceTree: "<absolute>", path: import_node_path15.default.join(groupDir, unescaped) };
|
|
24706
24832
|
};
|
|
24707
24833
|
const memberships = [];
|
|
24708
24834
|
const folders = [];
|
|
@@ -24713,7 +24839,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
24713
24839
|
const kind = text(entry.kind) ?? "file-reference";
|
|
24714
24840
|
const raw2 = text(entry.path) ?? "";
|
|
24715
24841
|
const located = raw2 === "" ? null : locate(raw2, parent.dir);
|
|
24716
|
-
const name2 = text(entry.name) ??
|
|
24842
|
+
const name2 = text(entry.name) ?? import_node_path15.default.basename(raw2);
|
|
24717
24843
|
const node = { id: "", name: name2, dir: null, parent, children: [] };
|
|
24718
24844
|
if (kind === "group" || kind === "variant-group" || kind === "version-group") {
|
|
24719
24845
|
node.dir = raw2 === "" ? parent.dir : located?.sourceTree === "<absolute>" ? located.path : null;
|
|
@@ -24828,7 +24954,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
24828
24954
|
if (!isObject(entry)) continue;
|
|
24829
24955
|
const repository = text(entry.repository);
|
|
24830
24956
|
const local = text(entry.path);
|
|
24831
|
-
const name2 = local !== void 0 ?
|
|
24957
|
+
const name2 = local !== void 0 ? import_node_path15.default.basename(import_node_path15.default.resolve(import_node_path15.default.dirname(xcodeproj), local)) : import_node_path15.default.basename(repository ?? "").replace(/\.git$/, "");
|
|
24832
24958
|
const id = text(entry.kind) === "local" && local !== void 0 ? add({ isa: "XCLocalSwiftPackageReference", relativePath: local }) : add({ isa: "XCRemoteSwiftPackageReference", repositoryURL: repository ?? "" });
|
|
24833
24959
|
packageIds.set(name2.toLowerCase(), id);
|
|
24834
24960
|
}
|
|
@@ -24996,11 +25122,11 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
24996
25122
|
function isJsonObject(value) {
|
|
24997
25123
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
24998
25124
|
}
|
|
24999
|
-
var
|
|
25125
|
+
var import_node_path15, import_json5, isObject, text, items, PHASE_ISA;
|
|
25000
25126
|
var init_xcode_json_project = __esm({
|
|
25001
25127
|
"src/xcode-json-project.ts"() {
|
|
25002
25128
|
"use strict";
|
|
25003
|
-
|
|
25129
|
+
import_node_path15 = __toESM(require("node:path"), 1);
|
|
25004
25130
|
import_json5 = __toESM(require("json5"), 1);
|
|
25005
25131
|
isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
25006
25132
|
text = (value) => typeof value === "string" ? value : void 0;
|
|
@@ -25107,27 +25233,27 @@ function parseOpenStepPlist(text2) {
|
|
|
25107
25233
|
return root;
|
|
25108
25234
|
}
|
|
25109
25235
|
function walkFiles(dir) {
|
|
25110
|
-
if (!
|
|
25236
|
+
if (!import_node_fs15.default.existsSync(dir)) return [];
|
|
25111
25237
|
const out = [];
|
|
25112
|
-
for (const entry of
|
|
25238
|
+
for (const entry of import_node_fs15.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
|
|
25113
25239
|
if (entry.name.startsWith(".")) continue;
|
|
25114
|
-
const full =
|
|
25240
|
+
const full = import_node_path16.default.join(dir, entry.name);
|
|
25115
25241
|
if (entry.isDirectory()) out.push(...walkFiles(full));
|
|
25116
25242
|
else if (entry.isFile()) out.push(full);
|
|
25117
25243
|
}
|
|
25118
25244
|
return out;
|
|
25119
25245
|
}
|
|
25120
25246
|
function readXcconfig(file, seen = /* @__PURE__ */ new Set()) {
|
|
25121
|
-
if (seen.has(file) || !
|
|
25247
|
+
if (seen.has(file) || !import_node_fs15.default.existsSync(file)) return {};
|
|
25122
25248
|
seen.add(file);
|
|
25123
25249
|
const settings = {};
|
|
25124
|
-
for (const raw2 of
|
|
25250
|
+
for (const raw2 of import_node_fs15.default.readFileSync(file, "utf8").split("\n")) {
|
|
25125
25251
|
const line = raw2.replace(/\/\/.*$/, "").trim();
|
|
25126
25252
|
const include = /^#include\??\s+"([^"]+)"/.exec(line);
|
|
25127
25253
|
if (include) {
|
|
25128
25254
|
Object.assign(
|
|
25129
25255
|
settings,
|
|
25130
|
-
readXcconfig(
|
|
25256
|
+
readXcconfig(import_node_path16.default.resolve(import_node_path16.default.dirname(file), include[1]), seen)
|
|
25131
25257
|
);
|
|
25132
25258
|
continue;
|
|
25133
25259
|
}
|
|
@@ -25177,22 +25303,22 @@ function decodeXml(text2) {
|
|
|
25177
25303
|
return text2.replaceAll(""", '"').replaceAll("'", "'").replaceAll("<", "<").replaceAll(">", ">").replaceAll("&", "&");
|
|
25178
25304
|
}
|
|
25179
25305
|
function workspaceReferences(workspace) {
|
|
25180
|
-
const data =
|
|
25181
|
-
if (!
|
|
25306
|
+
const data = import_node_path16.default.join(workspace, "contents.xcworkspacedata");
|
|
25307
|
+
if (!import_node_fs15.default.existsSync(data))
|
|
25182
25308
|
throw new Error(`${workspace} has no contents.xcworkspacedata`);
|
|
25183
|
-
const container =
|
|
25309
|
+
const container = import_node_path16.default.dirname(workspace);
|
|
25184
25310
|
const locate = (location2, base) => {
|
|
25185
25311
|
const colon = location2.indexOf(":");
|
|
25186
25312
|
const kind = location2.slice(0, colon);
|
|
25187
25313
|
const rest = location2.slice(colon + 1);
|
|
25188
|
-
if (kind === "group") return
|
|
25189
|
-
if (kind === "container" || kind === "self") return
|
|
25190
|
-
if (kind === "absolute") return
|
|
25191
|
-
throw new Error(`${
|
|
25314
|
+
if (kind === "group") return import_node_path16.default.resolve(base, rest);
|
|
25315
|
+
if (kind === "container" || kind === "self") return import_node_path16.default.resolve(container, rest);
|
|
25316
|
+
if (kind === "absolute") return import_node_path16.default.resolve(rest);
|
|
25317
|
+
throw new Error(`${import_node_path16.default.basename(workspace)} has an unsupported location ${location2}`);
|
|
25192
25318
|
};
|
|
25193
25319
|
const groups = [container];
|
|
25194
25320
|
const references = [];
|
|
25195
|
-
for (const [, closing, tag, attributes, selfClosing] of
|
|
25321
|
+
for (const [, closing, tag, attributes, selfClosing] of import_node_fs15.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
|
|
25196
25322
|
if (closing) {
|
|
25197
25323
|
if (tag === "Group") groups.pop();
|
|
25198
25324
|
continue;
|
|
@@ -25207,8 +25333,8 @@ function workspaceReferences(workspace) {
|
|
|
25207
25333
|
}
|
|
25208
25334
|
function xcodeProjectFile(xcodeproj) {
|
|
25209
25335
|
for (const name2 of ["project.pbxproj", "project.xcproj"]) {
|
|
25210
|
-
const file =
|
|
25211
|
-
if (
|
|
25336
|
+
const file = import_node_path16.default.join(xcodeproj, name2);
|
|
25337
|
+
if (import_node_fs15.default.existsSync(file)) return file;
|
|
25212
25338
|
}
|
|
25213
25339
|
return null;
|
|
25214
25340
|
}
|
|
@@ -25216,10 +25342,10 @@ function loadProject(xcodeproj) {
|
|
|
25216
25342
|
const projectFile = xcodeProjectFile(xcodeproj);
|
|
25217
25343
|
if (!projectFile)
|
|
25218
25344
|
throw new Error(`${xcodeproj} has no project.pbxproj or project.xcproj`);
|
|
25219
|
-
const mtimeMs =
|
|
25345
|
+
const mtimeMs = import_node_fs15.default.statSync(projectFile).mtimeMs;
|
|
25220
25346
|
const cached4 = loaded.get(projectFile);
|
|
25221
25347
|
if (cached4?.mtimeMs === mtimeMs) return cached4.project;
|
|
25222
|
-
const source =
|
|
25348
|
+
const source = import_node_fs15.default.readFileSync(projectFile, "utf8");
|
|
25223
25349
|
const root = projectFile.endsWith(".xcproj") ? readXcodeJsonProject(xcodeproj, source) : parseOpenStepPlist(source);
|
|
25224
25350
|
if (!isDict(root) || !isDict(root.objects)) {
|
|
25225
25351
|
throw new Error(`${projectFile} has no objects table`);
|
|
@@ -25233,8 +25359,8 @@ function loadProject(xcodeproj) {
|
|
|
25233
25359
|
if (!project || project.isa !== "PBXProject") {
|
|
25234
25360
|
throw new Error(`${projectFile} has no PBXProject root`);
|
|
25235
25361
|
}
|
|
25236
|
-
const projectDir =
|
|
25237
|
-
|
|
25362
|
+
const projectDir = import_node_fs15.default.realpathSync(
|
|
25363
|
+
import_node_path16.default.resolve(import_node_path16.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
|
|
25238
25364
|
);
|
|
25239
25365
|
const parent = /* @__PURE__ */ new Map();
|
|
25240
25366
|
for (const [id, entry] of Object.entries(objects)) {
|
|
@@ -25252,11 +25378,11 @@ function loadProject(xcodeproj) {
|
|
|
25252
25378
|
const own = str(entry.path) ?? "";
|
|
25253
25379
|
const tree = str(entry.sourceTree) ?? "<group>";
|
|
25254
25380
|
if (tree === "<absolute>") result2 = own;
|
|
25255
|
-
else if (tree === "SOURCE_ROOT") result2 =
|
|
25381
|
+
else if (tree === "SOURCE_ROOT") result2 = import_node_path16.default.join(projectDir, own);
|
|
25256
25382
|
else if (tree === "<group>") {
|
|
25257
25383
|
const up = parent.get(id);
|
|
25258
25384
|
const base = up ? resolvePath(up) : projectDir;
|
|
25259
|
-
result2 = base === null ? null :
|
|
25385
|
+
result2 = base === null ? null : import_node_path16.default.join(base, own);
|
|
25260
25386
|
}
|
|
25261
25387
|
}
|
|
25262
25388
|
resolvedPaths.set(id, result2);
|
|
@@ -25356,7 +25482,7 @@ function targetMembers(ref) {
|
|
|
25356
25482
|
const addResource = (file) => {
|
|
25357
25483
|
if (isDirectory(file)) {
|
|
25358
25484
|
for (const inner of walkFiles(file)) resources.add(inner);
|
|
25359
|
-
} else if (
|
|
25485
|
+
} else if (import_node_fs15.default.existsSync(file)) resources.add(file);
|
|
25360
25486
|
};
|
|
25361
25487
|
const fileRefPaths = (refId) => {
|
|
25362
25488
|
const entry = project.object(refId);
|
|
@@ -25377,7 +25503,7 @@ function targetMembers(ref) {
|
|
|
25377
25503
|
for (const buildFileId of list(phase.files)) {
|
|
25378
25504
|
for (const file of fileRefPaths(str(project.object(buildFileId)?.fileRef) ?? "")) {
|
|
25379
25505
|
if (phase.isa === "PBXSourcesBuildPhase") {
|
|
25380
|
-
if (!
|
|
25506
|
+
if (!import_node_fs15.default.existsSync(file)) continue;
|
|
25381
25507
|
allSources.add(file);
|
|
25382
25508
|
if (file.endsWith(".swift")) sources.add(file);
|
|
25383
25509
|
} else if (phase.isa === "PBXResourcesBuildPhase") addResource(file);
|
|
@@ -25385,7 +25511,7 @@ function targetMembers(ref) {
|
|
|
25385
25511
|
}
|
|
25386
25512
|
}
|
|
25387
25513
|
const addSynchronized = (folder, relative3) => {
|
|
25388
|
-
const file =
|
|
25514
|
+
const file = import_node_path16.default.join(folder, relative3);
|
|
25389
25515
|
if (NEVER_MEMBER.test(relative3)) return;
|
|
25390
25516
|
if (file.endsWith(".swift")) {
|
|
25391
25517
|
if (!relative3.split("/").some((segment) => BUNDLE_DIR.test(segment))) {
|
|
@@ -25410,7 +25536,7 @@ function targetMembers(ref) {
|
|
|
25410
25536
|
}
|
|
25411
25537
|
if (owned.has(groupId)) {
|
|
25412
25538
|
for (const file of walkFiles(folder)) {
|
|
25413
|
-
const relative3 =
|
|
25539
|
+
const relative3 = import_node_path16.default.relative(folder, file).split(import_node_path16.default.sep).join("/");
|
|
25414
25540
|
if ([...exceptions].some(
|
|
25415
25541
|
(exception) => relative3 === exception || relative3.startsWith(`${exception}/`)
|
|
25416
25542
|
))
|
|
@@ -25419,14 +25545,14 @@ function targetMembers(ref) {
|
|
|
25419
25545
|
}
|
|
25420
25546
|
} else {
|
|
25421
25547
|
for (const relative3 of exceptions) {
|
|
25422
|
-
const file =
|
|
25548
|
+
const file = import_node_path16.default.join(folder, relative3);
|
|
25423
25549
|
if (isDirectory(file)) {
|
|
25424
25550
|
for (const inner of walkFiles(file))
|
|
25425
25551
|
addSynchronized(
|
|
25426
25552
|
folder,
|
|
25427
|
-
|
|
25553
|
+
import_node_path16.default.relative(folder, inner).split(import_node_path16.default.sep).join("/")
|
|
25428
25554
|
);
|
|
25429
|
-
} else if (
|
|
25555
|
+
} else if (import_node_fs15.default.existsSync(file)) addSynchronized(folder, relative3);
|
|
25430
25556
|
}
|
|
25431
25557
|
}
|
|
25432
25558
|
}
|
|
@@ -25439,8 +25565,8 @@ function targetMembers(ref) {
|
|
|
25439
25565
|
function commonAncestor(dirs) {
|
|
25440
25566
|
let common = dirs[0];
|
|
25441
25567
|
for (const dir of dirs) {
|
|
25442
|
-
while (common !==
|
|
25443
|
-
common =
|
|
25568
|
+
while (common !== import_node_path16.default.dirname(common) && import_node_path16.default.relative(common, dir).startsWith(".."))
|
|
25569
|
+
common = import_node_path16.default.dirname(common);
|
|
25444
25570
|
}
|
|
25445
25571
|
return common;
|
|
25446
25572
|
}
|
|
@@ -25449,8 +25575,8 @@ function workspaceProjects(xcodeprojOrWorkspace) {
|
|
|
25449
25575
|
const projects2 = [];
|
|
25450
25576
|
const projectAt = /* @__PURE__ */ new Map();
|
|
25451
25577
|
const addProject = (xcodeproj) => {
|
|
25452
|
-
const key =
|
|
25453
|
-
if (projectAt.has(key) || key.split(
|
|
25578
|
+
const key = import_node_path16.default.resolve(xcodeproj);
|
|
25579
|
+
if (projectAt.has(key) || key.split(import_node_path16.default.sep).includes("Pods")) return;
|
|
25454
25580
|
if (!xcodeProjectFile(key)) return;
|
|
25455
25581
|
const project = loadProject(key);
|
|
25456
25582
|
projectAt.set(key, project);
|
|
@@ -25467,7 +25593,7 @@ function workspaceProjects(xcodeprojOrWorkspace) {
|
|
|
25467
25593
|
for (const reference of listed)
|
|
25468
25594
|
if (reference.endsWith(".xcodeproj")) addProject(reference);
|
|
25469
25595
|
if (projects2.length === 0) {
|
|
25470
|
-
throw new Error(`${
|
|
25596
|
+
throw new Error(`${import_node_path16.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
|
|
25471
25597
|
}
|
|
25472
25598
|
return { listed, projects: projects2, projectAt };
|
|
25473
25599
|
}
|
|
@@ -25491,7 +25617,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
25491
25617
|
const allTargets = projects2.flatMap(nativeTargets);
|
|
25492
25618
|
const appTargets = allTargets.filter((ref) => ref.target.productType === APPLICATION);
|
|
25493
25619
|
const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
|
|
25494
|
-
const container =
|
|
25620
|
+
const container = import_node_path16.default.basename(xcodeprojOrWorkspace);
|
|
25495
25621
|
const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
|
|
25496
25622
|
if (named.length !== 1) {
|
|
25497
25623
|
throw new Error(
|
|
@@ -25503,14 +25629,14 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
25503
25629
|
for (const ref of allTargets) {
|
|
25504
25630
|
const product = ref.project.object(str(ref.target.productReference));
|
|
25505
25631
|
const file = str(product?.path);
|
|
25506
|
-
if (file && !byProduct.has(
|
|
25507
|
-
byProduct.set(
|
|
25632
|
+
if (file && !byProduct.has(import_node_path16.default.basename(file)))
|
|
25633
|
+
byProduct.set(import_node_path16.default.basename(file), ref);
|
|
25508
25634
|
}
|
|
25509
25635
|
const proxied = (project, proxyId) => {
|
|
25510
25636
|
const proxy = project.object(proxyId);
|
|
25511
25637
|
if (proxy?.isa !== "PBXContainerItemProxy") return void 0;
|
|
25512
25638
|
const portal = str(proxy.containerPortal);
|
|
25513
|
-
const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(
|
|
25639
|
+
const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path16.default.resolve(project.resolvePath(portal ?? "") ?? ""));
|
|
25514
25640
|
const remote = str(proxy.remoteGlobalIDString);
|
|
25515
25641
|
if (!owner || !remote) return void 0;
|
|
25516
25642
|
return nativeTargets(owner).find(
|
|
@@ -25531,7 +25657,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
25531
25657
|
if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
|
|
25532
25658
|
for (const buildFileId of list(phase.files)) {
|
|
25533
25659
|
const file = project.object(str(project.object(buildFileId)?.fileRef));
|
|
25534
|
-
const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(
|
|
25660
|
+
const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path16.default.basename(str(file.path) ?? "")) : void 0;
|
|
25535
25661
|
if (resolved) found.push(resolved);
|
|
25536
25662
|
}
|
|
25537
25663
|
}
|
|
@@ -25552,7 +25678,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
25552
25678
|
const name2 = str(ref.target.name) ?? ref.id;
|
|
25553
25679
|
const { get: settings2, keys } = targetSettings(ref, {
|
|
25554
25680
|
TARGET_NAME: name2,
|
|
25555
|
-
PROJECT_NAME:
|
|
25681
|
+
PROJECT_NAME: import_node_path16.default.basename(ref.project.xcodeproj, ".xcodeproj"),
|
|
25556
25682
|
SRCROOT: ref.project.projectDir,
|
|
25557
25683
|
SOURCE_ROOT: ref.project.projectDir,
|
|
25558
25684
|
PROJECT_DIR: ref.project.projectDir,
|
|
@@ -25583,8 +25709,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
25583
25709
|
}
|
|
25584
25710
|
return value;
|
|
25585
25711
|
};
|
|
25586
|
-
const infoPlistFile = settings("INFOPLIST_FILE") ?
|
|
25587
|
-
const sourceInfo = infoPlistFile ? import_plist3.default.parse(
|
|
25712
|
+
const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path16.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
|
|
25713
|
+
const sourceInfo = infoPlistFile ? import_plist3.default.parse(import_node_fs15.default.readFileSync(infoPlistFile, "utf8")) : {};
|
|
25588
25714
|
if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
|
|
25589
25715
|
throw new Error(`${module2.name} Info.plist must contain a dictionary`);
|
|
25590
25716
|
}
|
|
@@ -25602,34 +25728,17 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
25602
25728
|
};
|
|
25603
25729
|
}
|
|
25604
25730
|
const localPackageDirs = [
|
|
25605
|
-
...listed.filter((reference) =>
|
|
25731
|
+
...listed.filter((reference) => import_node_fs15.default.existsSync(import_node_path16.default.join(reference, "Package.swift"))),
|
|
25606
25732
|
...projects2.flatMap(
|
|
25607
25733
|
(project) => Object.entries(project.objects).flatMap(([id, entry]) => {
|
|
25608
25734
|
if (!isDict(entry)) return [];
|
|
25609
|
-
const candidate = entry.isa === "XCLocalSwiftPackageReference" ?
|
|
25610
|
-
return candidate &&
|
|
25735
|
+
const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path16.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
|
|
25736
|
+
return candidate && import_node_fs15.default.existsSync(import_node_path16.default.join(candidate, "Package.swift")) ? [candidate] : [];
|
|
25611
25737
|
})
|
|
25612
25738
|
)
|
|
25613
25739
|
];
|
|
25614
|
-
const
|
|
25615
|
-
const
|
|
25616
|
-
const cached4 = graphs.get(dir);
|
|
25617
|
-
if (cached4) return cached4;
|
|
25618
|
-
const graph = swiftManifestGraph(
|
|
25619
|
-
import_node_fs14.default.readFileSync(import_node_path15.default.join(dir, "Package.swift"), "utf8")
|
|
25620
|
-
);
|
|
25621
|
-
graphs.set(dir, graph);
|
|
25622
|
-
return graph;
|
|
25623
|
-
};
|
|
25624
|
-
const localProducts = /* @__PURE__ */ new Map();
|
|
25625
|
-
for (const dir of localPackageDirs) {
|
|
25626
|
-
for (const product of graphOf(dir).products.keys()) {
|
|
25627
|
-
if (!localProducts.has(product)) localProducts.set(product, dir);
|
|
25628
|
-
}
|
|
25629
|
-
}
|
|
25630
|
-
const localPackages = /* @__PURE__ */ new Set();
|
|
25631
|
-
const remoteProducts = [];
|
|
25632
|
-
const unresolvedProducts = [];
|
|
25740
|
+
const linkedProducts = [];
|
|
25741
|
+
const binaryFrameworks = /* @__PURE__ */ new Set();
|
|
25633
25742
|
for (const { project, target } of order) {
|
|
25634
25743
|
const productDependencies = [
|
|
25635
25744
|
...list(target.packageProductDependencies),
|
|
@@ -25641,45 +25750,37 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
25641
25750
|
for (const dependencyId of productDependencies) {
|
|
25642
25751
|
const dependency = project.object(dependencyId);
|
|
25643
25752
|
const product = str(dependency?.productName)?.replace(/^plugin:/, "");
|
|
25644
|
-
if (!dependency || !product)
|
|
25645
|
-
const reference = project.object(str(dependency.package));
|
|
25646
|
-
if (reference?.isa === "XCRemoteSwiftPackageReference") {
|
|
25647
|
-
if (!remoteProducts.some((entry) => entry.product === product))
|
|
25648
|
-
remoteProducts.push({
|
|
25649
|
-
product,
|
|
25650
|
-
repositoryURL: str(reference.repositoryURL) ?? ""
|
|
25651
|
-
});
|
|
25652
|
-
} else if (reference?.isa === "XCLocalSwiftPackageReference") {
|
|
25653
|
-
localPackages.add(
|
|
25654
|
-
import_node_path15.default.resolve(project.projectDir, str(reference.relativePath) ?? "")
|
|
25655
|
-
);
|
|
25656
|
-
} else if (localProducts.has(product)) {
|
|
25657
|
-
localPackages.add(localProducts.get(product));
|
|
25658
|
-
} else if (!unresolvedProducts.includes(product)) unresolvedProducts.push(product);
|
|
25659
|
-
}
|
|
25660
|
-
}
|
|
25661
|
-
const pending = [...localPackages];
|
|
25662
|
-
while (pending.length > 0) {
|
|
25663
|
-
const dir = pending.pop();
|
|
25664
|
-
const graph = graphOf(dir);
|
|
25665
|
-
for (const relative3 of graph.packagePaths) {
|
|
25666
|
-
const next = import_node_path15.default.resolve(dir, relative3);
|
|
25667
|
-
if (localPackages.has(next) || !import_node_fs14.default.existsSync(import_node_path15.default.join(next, "Package.swift")))
|
|
25753
|
+
if (!dependency || !product || linkedProducts.some((entry) => entry.product === product))
|
|
25668
25754
|
continue;
|
|
25669
|
-
|
|
25670
|
-
|
|
25755
|
+
const reference = project.object(str(dependency.package));
|
|
25756
|
+
linkedProducts.push({
|
|
25757
|
+
product,
|
|
25758
|
+
source: reference?.isa === "XCRemoteSwiftPackageReference" ? { kind: "remote", url: str(reference.repositoryURL) ?? "" } : reference?.isa === "XCLocalSwiftPackageReference" ? {
|
|
25759
|
+
kind: "local",
|
|
25760
|
+
dir: import_node_path16.default.resolve(
|
|
25761
|
+
project.projectDir,
|
|
25762
|
+
str(reference.relativePath) ?? ""
|
|
25763
|
+
)
|
|
25764
|
+
} : { kind: "unnamed" }
|
|
25765
|
+
});
|
|
25671
25766
|
}
|
|
25672
|
-
for (const
|
|
25673
|
-
|
|
25674
|
-
|
|
25675
|
-
|
|
25676
|
-
|
|
25677
|
-
|
|
25767
|
+
for (const phaseId of list(target.buildPhases)) {
|
|
25768
|
+
const phase = project.object(phaseId);
|
|
25769
|
+
if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
|
|
25770
|
+
for (const buildFileId of list(phase.files)) {
|
|
25771
|
+
const fileId = str(project.object(buildFileId)?.fileRef);
|
|
25772
|
+
const file = project.object(fileId);
|
|
25773
|
+
const tree = str(file?.sourceTree);
|
|
25774
|
+
const name2 = /([^/]+)\.(xc)?framework$/.exec(str(file?.path) ?? "")?.[1];
|
|
25775
|
+
if (file?.isa !== "PBXFileReference" || !name2) continue;
|
|
25776
|
+
if (tree === "BUILT_PRODUCTS_DIR" || tree === "SDKROOT" || tree === "DEVELOPER_DIR")
|
|
25777
|
+
continue;
|
|
25778
|
+
binaryFrameworks.add(name2);
|
|
25678
25779
|
}
|
|
25679
25780
|
}
|
|
25680
25781
|
}
|
|
25681
|
-
const resolvedFile =
|
|
25682
|
-
workspace ??
|
|
25782
|
+
const resolvedFile = import_node_path16.default.join(
|
|
25783
|
+
workspace ?? import_node_path16.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
|
|
25683
25784
|
"xcshareddata",
|
|
25684
25785
|
"swiftpm",
|
|
25685
25786
|
"Package.resolved"
|
|
@@ -25689,30 +25790,34 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
25689
25790
|
...module2,
|
|
25690
25791
|
rootDir: commonAncestor(
|
|
25691
25792
|
[
|
|
25692
|
-
workspace ?
|
|
25793
|
+
workspace ? import_node_path16.default.dirname(workspace) : app.project.projectDir,
|
|
25693
25794
|
...used.map((project) => project.projectDir),
|
|
25694
|
-
...
|
|
25695
|
-
|
|
25795
|
+
...localPackageDirs,
|
|
25796
|
+
...linkedProducts.flatMap(
|
|
25797
|
+
({ source }) => source.kind === "local" && import_node_fs15.default.existsSync(source.dir) ? [source.dir] : []
|
|
25798
|
+
)
|
|
25799
|
+
].map((dir) => import_node_fs15.default.realpathSync(dir))
|
|
25696
25800
|
),
|
|
25697
25801
|
projectFiles: [...new Set(used.map((project) => project.projectFile))].sort(),
|
|
25698
25802
|
infoPlist: import_plist3.default.build(info),
|
|
25699
25803
|
infoPlistFile,
|
|
25700
25804
|
frameworks,
|
|
25701
|
-
|
|
25702
|
-
|
|
25703
|
-
|
|
25704
|
-
|
|
25805
|
+
linkedProducts,
|
|
25806
|
+
localPackageDirs: [
|
|
25807
|
+
...new Set(localPackageDirs.map((dir) => import_node_fs15.default.realpathSync(dir)))
|
|
25808
|
+
].sort(),
|
|
25809
|
+
binaryFrameworks: [...binaryFrameworks].sort(),
|
|
25810
|
+
packageResolved: import_node_fs15.default.existsSync(resolvedFile) ? resolvedFile : null,
|
|
25705
25811
|
appTargets: appTargetNames
|
|
25706
25812
|
};
|
|
25707
25813
|
}
|
|
25708
|
-
var
|
|
25814
|
+
var import_node_fs15, import_node_path16, import_plist3, isDict, str, list, APPLICATION, MODULE_PRODUCTS, NEVER_MEMBER, BUNDLE_DIR, CONDITIONS, isDirectory, loaded, targetRefs;
|
|
25709
25815
|
var init_xcode_project = __esm({
|
|
25710
25816
|
"src/xcode-project.ts"() {
|
|
25711
25817
|
"use strict";
|
|
25712
|
-
|
|
25713
|
-
|
|
25818
|
+
import_node_fs15 = __toESM(require("node:fs"), 1);
|
|
25819
|
+
import_node_path16 = __toESM(require("node:path"), 1);
|
|
25714
25820
|
import_plist3 = __toESM(require_plist(), 1);
|
|
25715
|
-
init_swift_package();
|
|
25716
25821
|
init_xcode_json_project();
|
|
25717
25822
|
isDict = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
25718
25823
|
str = (value) => typeof value === "string" ? value : void 0;
|
|
@@ -25731,7 +25836,7 @@ var init_xcode_project = __esm({
|
|
|
25731
25836
|
arch: "arm64",
|
|
25732
25837
|
variant: "normal"
|
|
25733
25838
|
};
|
|
25734
|
-
isDirectory = (dir) =>
|
|
25839
|
+
isDirectory = (dir) => import_node_fs15.default.existsSync(dir) && import_node_fs15.default.statSync(dir).isDirectory();
|
|
25735
25840
|
loaded = /* @__PURE__ */ new Map();
|
|
25736
25841
|
targetRefs = /* @__PURE__ */ new WeakMap();
|
|
25737
25842
|
}
|
|
@@ -25739,17 +25844,17 @@ var init_xcode_project = __esm({
|
|
|
25739
25844
|
|
|
25740
25845
|
// src/swift-host.ts
|
|
25741
25846
|
function swiftPackageId(packagePath) {
|
|
25742
|
-
return
|
|
25847
|
+
return import_node_path17.default.basename(packagePath).replace(/[^A-Za-z0-9_]/g, "_").replace(/^(\d)/, "_$1");
|
|
25743
25848
|
}
|
|
25744
25849
|
function nativeSourceDescriptor(packagePath) {
|
|
25745
|
-
packagePath =
|
|
25746
|
-
const file =
|
|
25747
|
-
if (!
|
|
25850
|
+
packagePath = import_node_fs16.default.realpathSync(packagePath);
|
|
25851
|
+
const file = import_node_path17.default.join(packagePath, NATIVE_DESCRIPTOR);
|
|
25852
|
+
if (!import_node_fs16.default.existsSync(file)) return null;
|
|
25748
25853
|
const value = JSON.parse(
|
|
25749
25854
|
readPackageFile(packagePath, file, MAX_SWIFT_COMPILE_SOURCE_BYTES).toString("utf8")
|
|
25750
25855
|
);
|
|
25751
25856
|
const invalid = () => new Error(`${file}: invalid One native source descriptor; run one typegen`);
|
|
25752
|
-
if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !
|
|
25857
|
+
if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !import_node_fs16.default.existsSync(import_node_path17.default.join(packagePath, NATIVE_GLUE))) {
|
|
25753
25858
|
throw invalid();
|
|
25754
25859
|
}
|
|
25755
25860
|
if (!isSwiftNativeModules(value) || value.packageId !== swiftPackageId(packagePath)) {
|
|
@@ -25758,7 +25863,7 @@ function nativeSourceDescriptor(packagePath) {
|
|
|
25758
25863
|
return value;
|
|
25759
25864
|
}
|
|
25760
25865
|
function projectFor(packagePath, hosted) {
|
|
25761
|
-
packagePath =
|
|
25866
|
+
packagePath = import_node_fs16.default.realpathSync(packagePath);
|
|
25762
25867
|
const existing = projects.get(packagePath);
|
|
25763
25868
|
if (existing) {
|
|
25764
25869
|
if (hosted && !existing.hosted) {
|
|
@@ -25778,30 +25883,35 @@ function projectFor(packagePath, hosted) {
|
|
|
25778
25883
|
projects.set(packagePath, created);
|
|
25779
25884
|
return created;
|
|
25780
25885
|
}
|
|
25781
|
-
function
|
|
25782
|
-
|
|
25886
|
+
function swiftPackages(entry, app) {
|
|
25887
|
+
const stamp = (file) => file && import_node_fs16.default.existsSync(file) ? import_node_fs16.default.statSync(file).mtimeMs : 0;
|
|
25783
25888
|
const key = JSON.stringify([
|
|
25784
|
-
app.
|
|
25889
|
+
app.linkedProducts,
|
|
25785
25890
|
app.packageResolved,
|
|
25786
|
-
|
|
25891
|
+
stamp(app.packageResolved),
|
|
25892
|
+
app.localPackageDirs.map((dir) => stamp(import_node_path17.default.join(dir, "Package.swift"))),
|
|
25893
|
+
app.linkedProducts.map(
|
|
25894
|
+
({ source }) => source.kind === "local" ? stamp(import_node_path17.default.join(source.dir, "Package.swift")) : 0
|
|
25895
|
+
)
|
|
25787
25896
|
]);
|
|
25788
|
-
if (entry.
|
|
25789
|
-
entry.
|
|
25897
|
+
if (entry.packages?.key !== key) {
|
|
25898
|
+
entry.packages = {
|
|
25790
25899
|
key,
|
|
25791
|
-
packages:
|
|
25792
|
-
app.rootDir,
|
|
25793
|
-
app.packageResolved,
|
|
25794
|
-
app.
|
|
25795
|
-
|
|
25796
|
-
|
|
25900
|
+
packages: resolveSwiftPackages({
|
|
25901
|
+
rootDir: app.rootDir,
|
|
25902
|
+
resolved: app.packageResolved,
|
|
25903
|
+
products: app.linkedProducts,
|
|
25904
|
+
localDirs: app.localPackageDirs,
|
|
25905
|
+
provided: entry.provided
|
|
25906
|
+
})
|
|
25797
25907
|
};
|
|
25798
25908
|
}
|
|
25799
|
-
return entry.
|
|
25909
|
+
return entry.packages.packages;
|
|
25800
25910
|
}
|
|
25801
25911
|
function xcodeInputKey(layout, file, relative3) {
|
|
25802
25912
|
const owner = layout.targetDirs.get(file);
|
|
25803
|
-
if (owner) return
|
|
25804
|
-
return relative3.startsWith(CHECKOUTS_PREFIX) ?
|
|
25913
|
+
if (owner) return import_node_path17.default.posix.join(owner, relative3);
|
|
25914
|
+
return relative3.startsWith(CHECKOUTS_PREFIX) ? import_node_path17.default.posix.join(XCODE_PACKAGES_DIR, relative3.slice(CHECKOUTS_PREFIX.length)) : relative3;
|
|
25805
25915
|
}
|
|
25806
25916
|
function xcodeLayout(root) {
|
|
25807
25917
|
const registered = xcodeProjects.get(root);
|
|
@@ -25812,7 +25922,7 @@ function xcodeLayout(root) {
|
|
|
25812
25922
|
const targetDirs = new Map(app.sources.map((file) => [file, XCODE_APP_DIR]));
|
|
25813
25923
|
const targets = [];
|
|
25814
25924
|
for (const framework of app.frameworks) {
|
|
25815
|
-
const dir =
|
|
25925
|
+
const dir = import_node_path17.default.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName);
|
|
25816
25926
|
for (const file of framework.sources) {
|
|
25817
25927
|
if (targetDirs.has(file)) continue;
|
|
25818
25928
|
targetDirs.set(file, dir);
|
|
@@ -25823,44 +25933,35 @@ function xcodeLayout(root) {
|
|
|
25823
25933
|
path: dir,
|
|
25824
25934
|
executable: false,
|
|
25825
25935
|
resources: false,
|
|
25936
|
+
exclude: [],
|
|
25826
25937
|
languageMode: framework.languageMode,
|
|
25827
25938
|
mainActorIsolation: framework.mainActorIsolation
|
|
25828
25939
|
});
|
|
25829
25940
|
}
|
|
25830
|
-
|
|
25831
|
-
|
|
25832
|
-
|
|
25833
|
-
|
|
25834
|
-
|
|
25835
|
-
const declared = swiftManifestTargets(manifest).filter((target) => !target.executable);
|
|
25836
|
-
const all = declared.flatMap(
|
|
25837
|
-
(target) => sourceTreeFiles(import_node_path16.default.join(dir, target.path), root).map(
|
|
25838
|
-
(file) => import_node_path16.default.relative(dir, file).split(import_node_path16.default.sep).join(import_node_path16.default.posix.sep)
|
|
25839
|
-
)
|
|
25941
|
+
const packages = swiftPackages(registered, app);
|
|
25942
|
+
for (const target of packages.targets) {
|
|
25943
|
+
const relative3 = import_node_path17.default.relative(
|
|
25944
|
+
target.remote ? import_node_path17.default.join(root, REMOTE_CHECKOUTS) : root,
|
|
25945
|
+
target.dir
|
|
25840
25946
|
);
|
|
25841
|
-
|
|
25842
|
-
|
|
25843
|
-
|
|
25844
|
-
for (const relative3 of all) {
|
|
25845
|
-
if (relative3.startsWith(`${target.path}/`)) files.add(import_node_path16.default.join(dir, relative3));
|
|
25846
|
-
}
|
|
25847
|
-
}
|
|
25848
|
-
}
|
|
25849
|
-
const remote = remotePackages(registered, app);
|
|
25850
|
-
for (const target of remote.targets) {
|
|
25947
|
+
if (relative3 === ".." || relative3.startsWith(`..${import_node_path17.default.sep}`) || import_node_path17.default.isAbsolute(relative3))
|
|
25948
|
+
throw new Error(`swift input escapes the selected package: ${target.dir}`);
|
|
25949
|
+
const posix2 = relative3.split(import_node_path17.default.sep).join(import_node_path17.default.posix.sep);
|
|
25851
25950
|
targets.push({
|
|
25852
25951
|
...target,
|
|
25853
|
-
path:
|
|
25854
|
-
|
|
25855
|
-
import_node_path16.default.relative(import_node_path16.default.join(root, REMOTE_CHECKOUTS), target.dir).split(import_node_path16.default.sep).join(import_node_path16.default.posix.sep)
|
|
25856
|
-
)
|
|
25952
|
+
path: target.remote ? import_node_path17.default.posix.join(XCODE_PACKAGES_DIR, posix2) : posix2,
|
|
25953
|
+
exclude: []
|
|
25857
25954
|
});
|
|
25955
|
+
if (!target.remote) files.add(import_node_path17.default.join(target.packageDir, "Package.swift"));
|
|
25858
25956
|
for (const file of target.files) files.add(file);
|
|
25859
25957
|
}
|
|
25958
|
+
for (const target of targets) {
|
|
25959
|
+
target.exclude = targets.filter((other) => other.path.startsWith(`${target.path}/`)).map((other) => other.path.slice(target.path.length + 1));
|
|
25960
|
+
}
|
|
25860
25961
|
return {
|
|
25861
25962
|
app,
|
|
25862
25963
|
targets,
|
|
25863
|
-
|
|
25964
|
+
packages,
|
|
25864
25965
|
targetDirs,
|
|
25865
25966
|
files: [...files].sort()
|
|
25866
25967
|
};
|
|
@@ -25873,32 +25974,32 @@ function xcodeManifest(layout) {
|
|
|
25873
25974
|
'let package = Package(name: "app", targets: [',
|
|
25874
25975
|
` .executableTarget(name: "${layout.app.moduleName}", path: "${XCODE_APP_DIR}", ${settings(layout.app.languageMode, layout.app.mainActorIsolation)}),`,
|
|
25875
25976
|
...layout.targets.map(
|
|
25876
|
-
(target) => ` .target(name: "${target.name}", path: "${target.path}", ${target.resources ? "resources: [], " : ""}${settings(target.languageMode, target.mainActorIsolation)}),`
|
|
25977
|
+
(target) => ` .target(name: "${target.name}", path: "${target.path}", ${target.exclude.length > 0 ? `exclude: ${JSON.stringify(target.exclude)}, ` : ""}${target.resources ? "resources: [], " : ""}${settings(target.languageMode, target.mainActorIsolation)}),`
|
|
25877
25978
|
),
|
|
25878
25979
|
"])",
|
|
25879
25980
|
""
|
|
25880
25981
|
].join("\n");
|
|
25881
25982
|
}
|
|
25882
25983
|
function packageFiles(root) {
|
|
25883
|
-
const canonicalRoot =
|
|
25984
|
+
const canonicalRoot = import_node_fs16.default.realpathSync(root);
|
|
25884
25985
|
const xcode = xcodeLayout(canonicalRoot);
|
|
25885
25986
|
return xcode ? xcode.files : sourceTreeFiles(canonicalRoot, canonicalRoot);
|
|
25886
25987
|
}
|
|
25887
25988
|
function sourceTreeFiles(dir, canonicalRoot) {
|
|
25888
25989
|
const found = [];
|
|
25889
25990
|
const walk2 = (dir2) => {
|
|
25890
|
-
for (const entry of
|
|
25991
|
+
for (const entry of import_node_fs16.default.readdirSync(dir2, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
|
|
25891
25992
|
if (entry.name.startsWith(".") && entry.name !== NATIVE_DESCRIPTOR && entry.name !== NATIVE_GLUE || SKIP_SOURCE_DIRS.has(entry.name))
|
|
25892
25993
|
continue;
|
|
25893
|
-
const full =
|
|
25994
|
+
const full = import_node_path17.default.join(dir2, entry.name);
|
|
25894
25995
|
if (entry.isSymbolicLink()) throw new Error(`swift input is a symlink: ${full}`);
|
|
25895
|
-
const real =
|
|
25896
|
-
const relative3 =
|
|
25897
|
-
if (relative3.startsWith(`..${
|
|
25996
|
+
const real = import_node_fs16.default.realpathSync(full);
|
|
25997
|
+
const relative3 = import_node_path17.default.relative(canonicalRoot, real);
|
|
25998
|
+
if (relative3.startsWith(`..${import_node_path17.default.sep}`) || relative3 === ".." || import_node_path17.default.isAbsolute(relative3)) {
|
|
25898
25999
|
throw new Error(`swift input escapes the selected package: ${full}`);
|
|
25899
26000
|
}
|
|
25900
26001
|
if (entry.isDirectory()) {
|
|
25901
|
-
if (
|
|
26002
|
+
if (import_node_fs16.default.existsSync(import_node_path17.default.join(full, "Package.swift"))) continue;
|
|
25902
26003
|
walk2(full);
|
|
25903
26004
|
} else if (entry.isFile()) {
|
|
25904
26005
|
found.push(full);
|
|
@@ -25906,29 +26007,29 @@ function sourceTreeFiles(dir, canonicalRoot) {
|
|
|
25906
26007
|
}
|
|
25907
26008
|
}
|
|
25908
26009
|
};
|
|
25909
|
-
if (
|
|
26010
|
+
if (import_node_fs16.default.existsSync(dir)) walk2(import_node_fs16.default.realpathSync(dir));
|
|
25910
26011
|
return found;
|
|
25911
26012
|
}
|
|
25912
26013
|
function readPackageFile(root, file, maxBytes) {
|
|
25913
|
-
const canonicalRoot =
|
|
25914
|
-
const relative3 =
|
|
25915
|
-
if (relative3 === ".." || relative3.startsWith(`..${
|
|
26014
|
+
const canonicalRoot = import_node_fs16.default.realpathSync(root);
|
|
26015
|
+
const relative3 = import_node_path17.default.relative(canonicalRoot, import_node_fs16.default.realpathSync(file));
|
|
26016
|
+
if (relative3 === ".." || relative3.startsWith(`..${import_node_path17.default.sep}`) || import_node_path17.default.isAbsolute(relative3)) {
|
|
25916
26017
|
throw new Error(`swift input escapes the selected package: ${file}`);
|
|
25917
26018
|
}
|
|
25918
|
-
let ancestor =
|
|
26019
|
+
let ancestor = import_node_path17.default.resolve(file);
|
|
25919
26020
|
while (ancestor !== canonicalRoot) {
|
|
25920
|
-
if (
|
|
26021
|
+
if (import_node_fs16.default.lstatSync(ancestor).isSymbolicLink()) {
|
|
25921
26022
|
throw new Error(`swift input is a symlink: ${ancestor}`);
|
|
25922
26023
|
}
|
|
25923
|
-
const parent =
|
|
26024
|
+
const parent = import_node_path17.default.dirname(ancestor);
|
|
25924
26025
|
if (parent === ancestor)
|
|
25925
26026
|
throw new Error(`swift input escapes the selected package: ${file}`);
|
|
25926
26027
|
ancestor = parent;
|
|
25927
26028
|
}
|
|
25928
|
-
const expected =
|
|
25929
|
-
const fd =
|
|
26029
|
+
const expected = import_node_fs16.default.statSync(file);
|
|
26030
|
+
const fd = import_node_fs16.default.openSync(file, import_node_fs16.default.constants.O_RDONLY | import_node_fs16.default.constants.O_NOFOLLOW);
|
|
25930
26031
|
try {
|
|
25931
|
-
const stat2 =
|
|
26032
|
+
const stat2 = import_node_fs16.default.fstatSync(fd);
|
|
25932
26033
|
if (stat2.dev !== expected.dev || stat2.ino !== expected.ino) {
|
|
25933
26034
|
throw new Error(`swift input changed while opening: ${file}`);
|
|
25934
26035
|
}
|
|
@@ -25938,16 +26039,16 @@ function readPackageFile(root, file, maxBytes) {
|
|
|
25938
26039
|
const bytes = Buffer.alloc(stat2.size + 1);
|
|
25939
26040
|
let offset = 0;
|
|
25940
26041
|
while (offset < bytes.length) {
|
|
25941
|
-
const count =
|
|
26042
|
+
const count = import_node_fs16.default.readSync(fd, bytes, offset, bytes.length - offset, null);
|
|
25942
26043
|
if (count === 0) break;
|
|
25943
26044
|
offset += count;
|
|
25944
26045
|
}
|
|
25945
|
-
if (offset !== stat2.size ||
|
|
26046
|
+
if (offset !== stat2.size || import_node_fs16.default.fstatSync(fd).size !== stat2.size) {
|
|
25946
26047
|
throw new Error(`swift input changed while reading: ${file}`);
|
|
25947
26048
|
}
|
|
25948
26049
|
return bytes.subarray(0, offset);
|
|
25949
26050
|
} finally {
|
|
25950
|
-
|
|
26051
|
+
import_node_fs16.default.closeSync(fd);
|
|
25951
26052
|
}
|
|
25952
26053
|
}
|
|
25953
26054
|
function sourceFiles(root) {
|
|
@@ -25955,14 +26056,14 @@ function sourceFiles(root) {
|
|
|
25955
26056
|
}
|
|
25956
26057
|
function resourceCandidateFiles(root) {
|
|
25957
26058
|
return packageFiles(root).filter(
|
|
25958
|
-
(file) => !file.endsWith(".swift") && !["project.pbxproj", "project.xcproj"].includes(
|
|
26059
|
+
(file) => !file.endsWith(".swift") && !["project.pbxproj", "project.xcproj"].includes(import_node_path17.default.basename(file))
|
|
25959
26060
|
);
|
|
25960
26061
|
}
|
|
25961
26062
|
function buildSwiftResourceTable(project, baseUrl) {
|
|
25962
26063
|
const limits = inputLimits(Boolean(project.hosted));
|
|
25963
26064
|
const absolute = resourceCandidateFiles(project.packagePath);
|
|
25964
26065
|
const relative3 = absolute.map(
|
|
25965
|
-
(file) =>
|
|
26066
|
+
(file) => import_node_path17.default.relative(project.packagePath, file).split(import_node_path17.default.sep).join(import_node_path17.default.posix.sep)
|
|
25966
26067
|
);
|
|
25967
26068
|
const byRelative = new Map(absolute.map((file, index) => [relative3[index], file]));
|
|
25968
26069
|
const readContents = (candidate) => {
|
|
@@ -25984,16 +26085,16 @@ function buildSwiftResourceTable(project, baseUrl) {
|
|
|
25984
26085
|
for (const { name: name2, file, scale } of found) {
|
|
25985
26086
|
const disk = byRelative.get(file);
|
|
25986
26087
|
if (!disk) continue;
|
|
25987
|
-
if (Object.keys(images).length >= limits.images || imageBytes +
|
|
26088
|
+
if (Object.keys(images).length >= limits.images || imageBytes + import_node_fs16.default.statSync(disk).size > limits.imageTotalBytes) {
|
|
25988
26089
|
throw new Error("swift image pack exceeds the compile service caps");
|
|
25989
26090
|
}
|
|
25990
26091
|
const bytes = readPackageFile(project.packagePath, disk, limits.imageBytes);
|
|
25991
26092
|
imageBytes += bytes.length;
|
|
25992
|
-
const hash = (0,
|
|
25993
|
-
const ext =
|
|
26093
|
+
const hash = (0, import_node_crypto6.createHash)("sha256").update(bytes).digest("hex").slice(0, 16);
|
|
26094
|
+
const ext = import_node_path17.default.posix.extname(file).toLowerCase();
|
|
25994
26095
|
table[name2] = { uri: `${baseUrl}${RESOURCE_PATH}${hash}${ext}`, scale };
|
|
25995
26096
|
images[name2] = {
|
|
25996
|
-
file:
|
|
26097
|
+
file: import_node_path17.default.posix.basename(file),
|
|
25997
26098
|
data: bytes.toString("base64")
|
|
25998
26099
|
};
|
|
25999
26100
|
watched.push(file);
|
|
@@ -26017,10 +26118,10 @@ function buildSwiftResourceTable(project, baseUrl) {
|
|
|
26017
26118
|
return { table, images, colors, symbols, watched };
|
|
26018
26119
|
}
|
|
26019
26120
|
function buildSwiftBundleFiles(packagePath, hosted) {
|
|
26020
|
-
packagePath =
|
|
26121
|
+
packagePath = import_node_fs16.default.realpathSync(packagePath);
|
|
26021
26122
|
const limits = inputLimits(hosted);
|
|
26022
26123
|
const relative3 = resourceCandidateFiles(packagePath).map(
|
|
26023
|
-
(file) =>
|
|
26124
|
+
(file) => import_node_path17.default.relative(packagePath, file).split(import_node_path17.default.sep).join(import_node_path17.default.posix.sep)
|
|
26024
26125
|
);
|
|
26025
26126
|
const files = {};
|
|
26026
26127
|
const watched = [];
|
|
@@ -26034,13 +26135,13 @@ function buildSwiftBundleFiles(packagePath, hosted) {
|
|
|
26034
26135
|
total += bytes.length;
|
|
26035
26136
|
if (xcode.app.infoPlistFile)
|
|
26036
26137
|
watched.push(
|
|
26037
|
-
|
|
26138
|
+
import_node_path17.default.relative(packagePath, xcode.app.infoPlistFile).split(import_node_path17.default.sep).join("/")
|
|
26038
26139
|
);
|
|
26039
26140
|
}
|
|
26040
26141
|
for (const { base, file } of enumerateBundleJson(relative3)) {
|
|
26041
26142
|
watched.push(file);
|
|
26042
|
-
const disk =
|
|
26043
|
-
if (Object.keys(files).length >= limits.resources || total +
|
|
26143
|
+
const disk = import_node_path17.default.join(packagePath, ...file.split("/"));
|
|
26144
|
+
if (Object.keys(files).length >= limits.resources || total + import_node_fs16.default.statSync(disk).size > limits.resourceTotalBytes) {
|
|
26044
26145
|
throw new Error(
|
|
26045
26146
|
`swift bundle pack exceeds ${limits.resources} files / ${limits.resourceTotalBytes} bytes`
|
|
26046
26147
|
);
|
|
@@ -26055,12 +26156,12 @@ function serveSwiftResource(project, key) {
|
|
|
26055
26156
|
return project.resourceFiles.get(key) ?? project.resourcesPrevious.get(key) ?? null;
|
|
26056
26157
|
}
|
|
26057
26158
|
function linkedModuleRoots(packagePath) {
|
|
26058
|
-
packagePath =
|
|
26159
|
+
packagePath = import_node_fs16.default.realpathSync(packagePath);
|
|
26059
26160
|
let manifest;
|
|
26060
26161
|
try {
|
|
26061
26162
|
manifest = readPackageFile(
|
|
26062
26163
|
packagePath,
|
|
26063
|
-
|
|
26164
|
+
import_node_path17.default.join(packagePath, "Package.swift"),
|
|
26064
26165
|
MAX_SWIFT_COMPILE_SOURCE_BYTES
|
|
26065
26166
|
).toString("utf8");
|
|
26066
26167
|
} catch {
|
|
@@ -26069,28 +26170,28 @@ function linkedModuleRoots(packagePath) {
|
|
|
26069
26170
|
const roots = /* @__PURE__ */ new Set();
|
|
26070
26171
|
const dependency = /\.package\(\s*path:\s*"([^"]+)"\s*\)/g;
|
|
26071
26172
|
for (const match of manifest.replace(/^\s*\/\/.*$/gm, "").matchAll(dependency)) {
|
|
26072
|
-
const root =
|
|
26073
|
-
if (
|
|
26173
|
+
const root = import_node_path17.default.resolve(packagePath, match[1]);
|
|
26174
|
+
if (import_node_fs16.default.existsSync(import_node_path17.default.join(root, "Package.swift"))) roots.add(root);
|
|
26074
26175
|
}
|
|
26075
26176
|
return [...roots].sort();
|
|
26076
26177
|
}
|
|
26077
26178
|
function sourceStamp(packagePath, moduleRootOverride, hosted = false) {
|
|
26078
|
-
const hash = (0,
|
|
26179
|
+
const hash = (0, import_node_crypto6.createHash)("sha256");
|
|
26079
26180
|
hash.update(packagePath);
|
|
26080
26181
|
const projectInputs = new Set(packageFiles(packagePath));
|
|
26081
26182
|
for (const file of [...projectInputs].sort()) {
|
|
26082
|
-
hash.update(
|
|
26083
|
-
const stat2 =
|
|
26183
|
+
hash.update(import_node_path17.default.relative(packagePath, file));
|
|
26184
|
+
const stat2 = import_node_fs16.default.statSync(file);
|
|
26084
26185
|
hash.update(`${stat2.mtimeMs}/${stat2.ctimeMs}/${stat2.size}`);
|
|
26085
26186
|
}
|
|
26086
26187
|
const moduleRoot = hosted ? void 0 : moduleRootOverride ?? linkedModuleRoots(packagePath).find(
|
|
26087
|
-
(root) =>
|
|
26188
|
+
(root) => import_node_fs16.default.existsSync(import_node_path17.default.join(root, "toolchain.json"))
|
|
26088
26189
|
);
|
|
26089
26190
|
if (moduleRoot) {
|
|
26090
26191
|
hash.update(moduleRoot);
|
|
26091
26192
|
for (const relative3 of swiftModuleInputFiles(moduleRoot)) {
|
|
26092
26193
|
hash.update(relative3);
|
|
26093
|
-
hash.update(String(
|
|
26194
|
+
hash.update(String(import_node_fs16.default.statSync(import_node_path17.default.join(moduleRoot, relative3)).mtimeMs));
|
|
26094
26195
|
}
|
|
26095
26196
|
}
|
|
26096
26197
|
return hash.digest("hex").slice(0, 16);
|
|
@@ -26102,8 +26203,8 @@ function packageSources(packagePath) {
|
|
|
26102
26203
|
const xcode = xcodeLayout(packagePath);
|
|
26103
26204
|
const files = {};
|
|
26104
26205
|
for (const file of sourceFiles(packagePath)) {
|
|
26105
|
-
const relative3 =
|
|
26106
|
-
if (xcode &&
|
|
26206
|
+
const relative3 = import_node_path17.default.relative(packagePath, file).split(import_node_path17.default.sep).join(import_node_path17.default.posix.sep);
|
|
26207
|
+
if (xcode && import_node_path17.default.basename(file) === "Package.swift") continue;
|
|
26107
26208
|
files[xcode ? xcodeInputKey(xcode, file, relative3) : relative3] = readPackageFile(
|
|
26108
26209
|
packagePath,
|
|
26109
26210
|
file,
|
|
@@ -26120,7 +26221,7 @@ function packageSnapshot(project) {
|
|
|
26120
26221
|
files,
|
|
26121
26222
|
resourcePaths: swiftImplicitResourcePaths(
|
|
26122
26223
|
resourceCandidateFiles(project.packagePath).map(
|
|
26123
|
-
(file) =>
|
|
26224
|
+
(file) => import_node_path17.default.relative(project.packagePath, file).split(import_node_path17.default.sep).join(import_node_path17.default.posix.sep)
|
|
26124
26225
|
)
|
|
26125
26226
|
),
|
|
26126
26227
|
resources: buildSwiftResourceTable(project, ""),
|
|
@@ -26129,7 +26230,7 @@ function packageSnapshot(project) {
|
|
|
26129
26230
|
...native ? {
|
|
26130
26231
|
glue: readPackageFile(
|
|
26131
26232
|
project.packagePath,
|
|
26132
|
-
|
|
26233
|
+
import_node_path17.default.join(project.packagePath, NATIVE_GLUE),
|
|
26133
26234
|
MAX_SWIFT_COMPILE_SOURCE_BYTES
|
|
26134
26235
|
).toString("utf8")
|
|
26135
26236
|
} : {}
|
|
@@ -26165,7 +26266,7 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
|
|
|
26165
26266
|
package: content
|
|
26166
26267
|
};
|
|
26167
26268
|
const moduleRoot = moduleRootOverride ?? linkedModuleRoots(packagePath).find(
|
|
26168
|
-
(root) =>
|
|
26269
|
+
(root) => import_node_fs16.default.existsSync(import_node_path17.default.join(root, "toolchain.json"))
|
|
26169
26270
|
) ?? await swiftDistributionRoot();
|
|
26170
26271
|
if (!moduleRoot)
|
|
26171
26272
|
return {
|
|
@@ -26191,10 +26292,10 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
|
|
|
26191
26292
|
// server and a capture, or two checkouts) build each other's sources. so
|
|
26192
26293
|
// each app and module checkout gets its own root, which keeps the same
|
|
26193
26294
|
// app's incremental build across restarts.
|
|
26194
|
-
buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ??
|
|
26195
|
-
|
|
26295
|
+
buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ?? import_node_path17.default.join(
|
|
26296
|
+
import_node_os6.default.tmpdir(),
|
|
26196
26297
|
"contrast-swift-build",
|
|
26197
|
-
(0,
|
|
26298
|
+
(0, import_node_crypto6.createHash)("sha256").update(`${moduleRoot}\0${import_node_path17.default.resolve(packagePath)}`).digest("hex").slice(0, 16)
|
|
26198
26299
|
),
|
|
26199
26300
|
moduleRoot,
|
|
26200
26301
|
...toolchain
|
|
@@ -26245,19 +26346,19 @@ function swiftApiGapReport(output) {
|
|
|
26245
26346
|
}
|
|
26246
26347
|
function missingModulesMessage(packagePath, missing) {
|
|
26247
26348
|
const layout = xcodeLayout(packagePath);
|
|
26248
|
-
const
|
|
26249
|
-
(layout?.app.
|
|
26250
|
-
|
|
26251
|
-
|
|
26252
|
-
]
|
|
26253
|
-
|
|
26349
|
+
const gaps = new Map([
|
|
26350
|
+
...(layout?.app.binaryFrameworks ?? []).map(
|
|
26351
|
+
(name2) => [name2, { source: "the project", reason: "a vendored binary framework" }]
|
|
26352
|
+
),
|
|
26353
|
+
...layout?.packages.modules ?? [],
|
|
26354
|
+
...layout?.packages.unavailable ?? []
|
|
26355
|
+
]);
|
|
26254
26356
|
const width = Math.max(...[...missing.keys()].map((name2) => name2.length));
|
|
26255
26357
|
return [
|
|
26256
26358
|
`Peach does not provide ${missing.size} module${missing.size === 1 ? "" : "s"} this app imports:`,
|
|
26257
26359
|
...[...missing].map(([name2, files]) => {
|
|
26258
|
-
const
|
|
26259
|
-
|
|
26260
|
-
return ` ${name2.padEnd(width)} ${files.length} file${files.length === 1 ? "" : "s"}${source ? `, package ${source}` : ""}${reason ? ` (${reason})` : ""}`;
|
|
26360
|
+
const gap = gaps.get(name2);
|
|
26361
|
+
return ` ${name2.padEnd(width)} ${files.length} file${files.length === 1 ? "" : "s"}${gap ? `, ${gap.source.includes("://") ? `package ${gap.source}` : gap.source.startsWith("/") ? `package ${import_node_path17.default.relative(packagePath, gap.source) || "."}` : gap.source} (${gap.reason})` : ""}`;
|
|
26261
26362
|
})
|
|
26262
26363
|
].join("\n");
|
|
26263
26364
|
}
|
|
@@ -26265,7 +26366,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
|
|
|
26265
26366
|
const auth = hosted ? null : resolveCliAuth();
|
|
26266
26367
|
if (!hosted && (!auth || auth.kind === "github")) {
|
|
26267
26368
|
throw new Error(
|
|
26268
|
-
`compiling ${
|
|
26369
|
+
`compiling ${import_node_path17.default.basename(packagePath)} for Peach needs \`peach login\` or PEACH_API_KEY: this peachsim has no local SwiftUI module, so Contrast compiles it`
|
|
26269
26370
|
);
|
|
26270
26371
|
}
|
|
26271
26372
|
const origin = hosted?.origin ?? resolveContrastBackendOrigin(auth?.kind === "session" ? auth.origin : null);
|
|
@@ -26284,7 +26385,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
|
|
|
26284
26385
|
const bytes = sources.reduce((total2, text2) => total2 + Buffer.byteLength(text2), 0);
|
|
26285
26386
|
if (sources.length > MAX_SWIFT_COMPILE_FILES || bytes > MAX_SWIFT_COMPILE_SOURCE_BYTES) {
|
|
26286
26387
|
throw new Error(
|
|
26287
|
-
`${
|
|
26388
|
+
`${import_node_path17.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`
|
|
26288
26389
|
);
|
|
26289
26390
|
}
|
|
26290
26391
|
const descriptor = snapshot.native;
|
|
@@ -26303,7 +26404,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
|
|
|
26303
26404
|
);
|
|
26304
26405
|
if (descriptor && address.native?.hash !== descriptor.hash) {
|
|
26305
26406
|
throw new Error(
|
|
26306
|
-
`${
|
|
26407
|
+
`${import_node_path17.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`
|
|
26307
26408
|
);
|
|
26308
26409
|
}
|
|
26309
26410
|
const response = await fetch(address.url, { signal });
|
|
@@ -26420,21 +26521,21 @@ function serveSwiftPackageAsset(pathname, res) {
|
|
|
26420
26521
|
res.end("swift artifact is stale");
|
|
26421
26522
|
return true;
|
|
26422
26523
|
}
|
|
26423
|
-
var
|
|
26524
|
+
var import_node_crypto6, import_node_fs16, import_node_os6, import_node_path17, 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;
|
|
26424
26525
|
var init_swift_host = __esm({
|
|
26425
26526
|
"src/swift-host.ts"() {
|
|
26426
26527
|
"use strict";
|
|
26427
|
-
|
|
26428
|
-
|
|
26429
|
-
|
|
26430
|
-
|
|
26528
|
+
import_node_crypto6 = require("node:crypto");
|
|
26529
|
+
import_node_fs16 = __toESM(require("node:fs"), 1);
|
|
26530
|
+
import_node_os6 = __toESM(require("node:os"), 1);
|
|
26531
|
+
import_node_path17 = __toESM(require("node:path"), 1);
|
|
26431
26532
|
init_bundleAssets();
|
|
26432
26533
|
init_auth();
|
|
26433
26534
|
init_backend_origin();
|
|
26434
26535
|
init_swift_compile();
|
|
26435
26536
|
init_swift_distribution();
|
|
26436
26537
|
init_swift_package();
|
|
26437
|
-
|
|
26538
|
+
init_swift_packages();
|
|
26438
26539
|
init_swift_submit();
|
|
26439
26540
|
init_xcode_project();
|
|
26440
26541
|
ARTIFACT_PATH = "/__peach/swift/";
|
|
@@ -26455,7 +26556,7 @@ var init_swift_host = __esm({
|
|
|
26455
26556
|
XCODE_APP_DIR = "__app__";
|
|
26456
26557
|
XCODE_FRAMEWORKS_DIR = "__frameworks__";
|
|
26457
26558
|
XCODE_PACKAGES_DIR = "__packages__";
|
|
26458
|
-
CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(
|
|
26559
|
+
CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(import_node_path17.default.sep).join(import_node_path17.default.posix.sep)}/`;
|
|
26459
26560
|
HOSTED_LIMITS = {
|
|
26460
26561
|
resources: MAX_SWIFT_COMPILE_RESOURCES,
|
|
26461
26562
|
resourceBytes: MAX_SWIFT_COMPILE_RESOURCE_BYTES,
|
|
@@ -26502,8 +26603,8 @@ var init_swift_host = __esm({
|
|
|
26502
26603
|
|
|
26503
26604
|
// src/expo-swift-host.ts
|
|
26504
26605
|
async function collectExpoSwiftSources(appRoot) {
|
|
26505
|
-
appRoot =
|
|
26506
|
-
const appRequire = (0, import_node_module.createRequire)(
|
|
26606
|
+
appRoot = import_node_fs17.default.realpathSync(appRoot);
|
|
26607
|
+
const appRequire = (0, import_node_module.createRequire)(import_node_path18.default.join(appRoot, "package.json"));
|
|
26507
26608
|
let autolinker;
|
|
26508
26609
|
try {
|
|
26509
26610
|
autolinker = appRequire.resolve("expo-modules-autolinking/package.json");
|
|
@@ -26517,7 +26618,7 @@ async function collectExpoSwiftSources(appRoot) {
|
|
|
26517
26618
|
(command) => run3(
|
|
26518
26619
|
process.execPath,
|
|
26519
26620
|
[
|
|
26520
|
-
|
|
26621
|
+
import_node_path18.default.join(import_node_path18.default.dirname(autolinker), "bin/expo-modules-autolinking.js"),
|
|
26521
26622
|
command,
|
|
26522
26623
|
"--platform",
|
|
26523
26624
|
"apple",
|
|
@@ -26548,8 +26649,8 @@ async function collectExpoSwiftSources(appRoot) {
|
|
|
26548
26649
|
const sourceRoot = Reflect.get(entry, "path");
|
|
26549
26650
|
if (typeof sourceRoot !== "string")
|
|
26550
26651
|
throw new Error("Expo autolinking entry has no path");
|
|
26551
|
-
const canonical =
|
|
26552
|
-
if (canonical.split(
|
|
26652
|
+
const canonical = import_node_fs17.default.realpathSync(sourceRoot);
|
|
26653
|
+
if (canonical.split(import_node_path18.default.sep).includes("node_modules")) continue;
|
|
26553
26654
|
const resolution = resolutions.find(
|
|
26554
26655
|
(candidate) => candidate && typeof candidate === "object" && Reflect.get(candidate, "packageName") === Reflect.get(entry, "name")
|
|
26555
26656
|
);
|
|
@@ -26575,12 +26676,12 @@ async function collectExpoSwiftSources(appRoot) {
|
|
|
26575
26676
|
`(${className.includes(".") ? className : `${namespace}.${className}`}.self, ${name2 === null ? "nil" : JSON.stringify(name2)})`
|
|
26576
26677
|
);
|
|
26577
26678
|
}
|
|
26578
|
-
const ios =
|
|
26579
|
-
if (
|
|
26679
|
+
const ios = import_node_path18.default.join(canonical, "ios");
|
|
26680
|
+
if (import_node_fs17.default.lstatSync(ios).isSymbolicLink())
|
|
26580
26681
|
throw new Error(`Expo Swift source directory is a symlink: ${ios}`);
|
|
26581
26682
|
const walk2 = (dir) => {
|
|
26582
|
-
for (const child of
|
|
26583
|
-
const file =
|
|
26683
|
+
for (const child of import_node_fs17.default.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
26684
|
+
const file = import_node_path18.default.join(dir, child.name);
|
|
26584
26685
|
if (child.isSymbolicLink())
|
|
26585
26686
|
throw new Error(`Expo Swift source is a symlink: ${file}`);
|
|
26586
26687
|
if (child.isDirectory()) {
|
|
@@ -26588,13 +26689,13 @@ async function collectExpoSwiftSources(appRoot) {
|
|
|
26588
26689
|
continue;
|
|
26589
26690
|
}
|
|
26590
26691
|
if (!child.name.endsWith(".swift")) continue;
|
|
26591
|
-
const size =
|
|
26692
|
+
const size = import_node_fs17.default.statSync(file).size;
|
|
26592
26693
|
bytes += size;
|
|
26593
26694
|
fileCount++;
|
|
26594
26695
|
if (fileCount > MAX_SWIFT_COMPILE_FILES - 2 || bytes > MAX_SWIFT_COMPILE_SOURCE_BYTES)
|
|
26595
26696
|
throw new Error("Expo Swift sources exceed compile service caps");
|
|
26596
|
-
files[`Sources/${namespace}/${
|
|
26597
|
-
${
|
|
26697
|
+
files[`Sources/${namespace}/${import_node_path18.default.relative(ios, file).split(import_node_path18.default.sep).join("/")}`] = `#sourceLocation(file: ${JSON.stringify(file)}, line: 1)
|
|
26698
|
+
${import_node_fs17.default.readFileSync(file, "utf8")}`;
|
|
26598
26699
|
}
|
|
26599
26700
|
};
|
|
26600
26701
|
walk2(ios);
|
|
@@ -26677,7 +26778,7 @@ async function handleExpoSwiftRequest(req, res) {
|
|
|
26677
26778
|
return true;
|
|
26678
26779
|
}
|
|
26679
26780
|
const root = url.searchParams.get("root");
|
|
26680
|
-
if (!root || !
|
|
26781
|
+
if (!root || !import_node_path18.default.isAbsolute(root)) {
|
|
26681
26782
|
res.writeHead(400);
|
|
26682
26783
|
res.end("missing absolute app root");
|
|
26683
26784
|
return true;
|
|
@@ -26694,7 +26795,7 @@ async function handleExpoSwiftRequest(req, res) {
|
|
|
26694
26795
|
modules: [],
|
|
26695
26796
|
failures: []
|
|
26696
26797
|
};
|
|
26697
|
-
const key = (0,
|
|
26798
|
+
const key = (0, import_node_crypto7.createHash)("sha256").update(import_node_fs17.default.realpathSync(root)).digest("hex");
|
|
26698
26799
|
const host2 = req.headers.host;
|
|
26699
26800
|
if (!host2) throw new Error("Expo Swift request has no host");
|
|
26700
26801
|
const base = `http://${host2}`;
|
|
@@ -26708,8 +26809,8 @@ async function handleExpoSwiftRequest(req, res) {
|
|
|
26708
26809
|
continue;
|
|
26709
26810
|
}
|
|
26710
26811
|
try {
|
|
26711
|
-
const packagePath =
|
|
26712
|
-
|
|
26812
|
+
const packagePath = import_node_path18.default.join(
|
|
26813
|
+
import_node_os7.default.tmpdir(),
|
|
26713
26814
|
"peach-expo-swift",
|
|
26714
26815
|
key,
|
|
26715
26816
|
unit.namespace
|
|
@@ -26718,7 +26819,7 @@ async function handleExpoSwiftRequest(req, res) {
|
|
|
26718
26819
|
packagePath,
|
|
26719
26820
|
new Map(
|
|
26720
26821
|
Object.entries(unit.files).map(([name2, source]) => [
|
|
26721
|
-
|
|
26822
|
+
import_node_path18.default.join(packagePath, name2),
|
|
26722
26823
|
source
|
|
26723
26824
|
])
|
|
26724
26825
|
)
|
|
@@ -26769,8 +26870,8 @@ async function handleExpoSwiftRequest(req, res) {
|
|
|
26769
26870
|
import PackageDescription
|
|
26770
26871
|
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")])
|
|
26771
26872
|
`;
|
|
26772
|
-
const packagePath =
|
|
26773
|
-
|
|
26873
|
+
const packagePath = import_node_path18.default.join(
|
|
26874
|
+
import_node_os7.default.tmpdir(),
|
|
26774
26875
|
"peach-expo-swift",
|
|
26775
26876
|
key,
|
|
26776
26877
|
"linked-app"
|
|
@@ -26779,7 +26880,7 @@ let package = Package(name: "PeachExpo", targets: [${targets.map((name2) => `.ta
|
|
|
26779
26880
|
packagePath,
|
|
26780
26881
|
new Map(
|
|
26781
26882
|
Object.entries(files).map(([name2, source]) => [
|
|
26782
|
-
|
|
26883
|
+
import_node_path18.default.join(packagePath, name2),
|
|
26783
26884
|
source
|
|
26784
26885
|
])
|
|
26785
26886
|
)
|
|
@@ -26815,16 +26916,16 @@ let package = Package(name: "PeachExpo", targets: [${targets.map((name2) => `.ta
|
|
|
26815
26916
|
}
|
|
26816
26917
|
return true;
|
|
26817
26918
|
}
|
|
26818
|
-
var
|
|
26919
|
+
var import_node_child_process9, import_node_crypto7, import_node_fs17, import_node_module, import_node_os7, import_node_path18, import_node_util3, run3, scriptEnv, EXPO_SWIFT_ROUTE, EXPO_SWIFT_ENTRY, compiling, failedCompilations;
|
|
26819
26920
|
var init_expo_swift_host = __esm({
|
|
26820
26921
|
"src/expo-swift-host.ts"() {
|
|
26821
26922
|
"use strict";
|
|
26822
|
-
|
|
26823
|
-
|
|
26824
|
-
|
|
26923
|
+
import_node_child_process9 = require("node:child_process");
|
|
26924
|
+
import_node_crypto7 = require("node:crypto");
|
|
26925
|
+
import_node_fs17 = __toESM(require("node:fs"), 1);
|
|
26825
26926
|
import_node_module = require("node:module");
|
|
26826
|
-
|
|
26827
|
-
|
|
26927
|
+
import_node_os7 = __toESM(require("node:os"), 1);
|
|
26928
|
+
import_node_path18 = __toESM(require("node:path"), 1);
|
|
26828
26929
|
import_node_util3 = require("node:util");
|
|
26829
26930
|
init_internal_child();
|
|
26830
26931
|
init_backend_origin();
|
|
@@ -26832,7 +26933,7 @@ var init_expo_swift_host = __esm({
|
|
|
26832
26933
|
init_swift_distribution();
|
|
26833
26934
|
init_swift_host();
|
|
26834
26935
|
init_swift_submit();
|
|
26835
|
-
run3 = (0, import_node_util3.promisify)(
|
|
26936
|
+
run3 = (0, import_node_util3.promisify)(import_node_child_process9.execFile);
|
|
26836
26937
|
scriptEnv = { ...process.env, [RNX_FORKED_SCRIPT_ENV]: "1" };
|
|
26837
26938
|
EXPO_SWIFT_ROUTE = "/__peach/expo-swift";
|
|
26838
26939
|
EXPO_SWIFT_ENTRY = "Sources/PeachExpoApp/PeachExpoEntry.swift";
|
|
@@ -27008,14 +27109,14 @@ var init_standalone = __esm({
|
|
|
27008
27109
|
// cli/self-invocation.ts
|
|
27009
27110
|
function sourceEntryPath() {
|
|
27010
27111
|
try {
|
|
27011
|
-
const candidate = (0,
|
|
27012
|
-
return (0,
|
|
27112
|
+
const candidate = (0, import_node_path19.join)((0, import_node_path19.dirname)((0, import_node_url3.fileURLToPath)(__sootsim_import_meta_url)), "bin.ts");
|
|
27113
|
+
return (0, import_node_fs18.existsSync)(candidate) ? candidate : null;
|
|
27013
27114
|
} catch {
|
|
27014
27115
|
return null;
|
|
27015
27116
|
}
|
|
27016
27117
|
}
|
|
27017
|
-
function isCliEntry(
|
|
27018
|
-
const name2 = (0,
|
|
27118
|
+
function isCliEntry(path35) {
|
|
27119
|
+
const name2 = (0, import_node_path19.basename)(path35);
|
|
27019
27120
|
return name2 === "bin.ts" || name2 === "bin.js";
|
|
27020
27121
|
}
|
|
27021
27122
|
function rnxSelfInvocation() {
|
|
@@ -27033,12 +27134,12 @@ function rnxSelfInvocation() {
|
|
|
27033
27134
|
}
|
|
27034
27135
|
return { executable: process.execPath, prefixArgs: [entry] };
|
|
27035
27136
|
}
|
|
27036
|
-
var
|
|
27137
|
+
var import_node_fs18, import_node_path19, import_node_url3;
|
|
27037
27138
|
var init_self_invocation = __esm({
|
|
27038
27139
|
"cli/self-invocation.ts"() {
|
|
27039
27140
|
"use strict";
|
|
27040
|
-
|
|
27041
|
-
|
|
27141
|
+
import_node_fs18 = require("node:fs");
|
|
27142
|
+
import_node_path19 = require("node:path");
|
|
27042
27143
|
import_node_url3 = require("node:url");
|
|
27043
27144
|
init_public_brand();
|
|
27044
27145
|
init_standalone();
|
|
@@ -27106,7 +27207,7 @@ function getUserDataDir() {
|
|
|
27106
27207
|
return userDataDir();
|
|
27107
27208
|
}
|
|
27108
27209
|
function storeFile() {
|
|
27109
|
-
return
|
|
27210
|
+
return import_node_path20.default.join(userDataDir(), "attached-projects.json");
|
|
27110
27211
|
}
|
|
27111
27212
|
function cloneEmpty() {
|
|
27112
27213
|
return {
|
|
@@ -27120,7 +27221,7 @@ function loadStore() {
|
|
|
27120
27221
|
const file = storeFile();
|
|
27121
27222
|
let raw2;
|
|
27122
27223
|
try {
|
|
27123
|
-
raw2 =
|
|
27224
|
+
raw2 = import_node_fs19.default.readFileSync(file, "utf8");
|
|
27124
27225
|
} catch (err) {
|
|
27125
27226
|
if (err.code === "ENOENT") return cloneEmpty();
|
|
27126
27227
|
throw err;
|
|
@@ -27137,7 +27238,7 @@ function loadStore() {
|
|
|
27137
27238
|
} catch (err) {
|
|
27138
27239
|
const quarantine = `${file}.corrupt-${Date.now()}`;
|
|
27139
27240
|
try {
|
|
27140
|
-
|
|
27241
|
+
import_node_fs19.default.renameSync(file, quarantine);
|
|
27141
27242
|
console.warn(
|
|
27142
27243
|
`[sootsim] attached-projects.json was unparseable; quarantined to ${quarantine}. original error: ${err.message}`
|
|
27143
27244
|
);
|
|
@@ -27148,16 +27249,16 @@ function loadStore() {
|
|
|
27148
27249
|
}
|
|
27149
27250
|
function writeStore(store) {
|
|
27150
27251
|
const file = storeFile();
|
|
27151
|
-
|
|
27252
|
+
import_node_fs19.default.mkdirSync(import_node_path20.default.dirname(file), { recursive: true });
|
|
27152
27253
|
const tmp = `${file}.tmp-${process.pid}-${Date.now()}`;
|
|
27153
|
-
const fd =
|
|
27254
|
+
const fd = import_node_fs19.default.openSync(tmp, "w", 384);
|
|
27154
27255
|
try {
|
|
27155
|
-
|
|
27156
|
-
|
|
27256
|
+
import_node_fs19.default.writeFileSync(fd, JSON.stringify(store, null, 2));
|
|
27257
|
+
import_node_fs19.default.fsyncSync(fd);
|
|
27157
27258
|
} finally {
|
|
27158
|
-
|
|
27259
|
+
import_node_fs19.default.closeSync(fd);
|
|
27159
27260
|
}
|
|
27160
|
-
|
|
27261
|
+
import_node_fs19.default.renameSync(tmp, file);
|
|
27161
27262
|
}
|
|
27162
27263
|
function mutateStore(fn) {
|
|
27163
27264
|
const store = loadStore();
|
|
@@ -27166,13 +27267,13 @@ function mutateStore(fn) {
|
|
|
27166
27267
|
return store;
|
|
27167
27268
|
}
|
|
27168
27269
|
function projectIdForCwd(cwd) {
|
|
27169
|
-
return (0,
|
|
27270
|
+
return (0, import_node_crypto8.createHash)("sha256").update(import_node_path20.default.resolve(cwd)).digest("hex").slice(0, 16);
|
|
27170
27271
|
}
|
|
27171
27272
|
function newSessionId() {
|
|
27172
|
-
return `s_${(0,
|
|
27273
|
+
return `s_${(0, import_node_crypto8.randomBytes)(10).toString("hex")}`;
|
|
27173
27274
|
}
|
|
27174
27275
|
function upsertProject(input) {
|
|
27175
|
-
const cwd =
|
|
27276
|
+
const cwd = import_node_path20.default.resolve(input.cwd);
|
|
27176
27277
|
const id = projectIdForCwd(cwd);
|
|
27177
27278
|
let result;
|
|
27178
27279
|
mutateStore((store) => {
|
|
@@ -27198,7 +27299,7 @@ function upsertProject(input) {
|
|
|
27198
27299
|
const now = Date.now();
|
|
27199
27300
|
const created = {
|
|
27200
27301
|
id,
|
|
27201
|
-
name: input.name ??
|
|
27302
|
+
name: input.name ?? import_node_path20.default.basename(cwd),
|
|
27202
27303
|
cwd,
|
|
27203
27304
|
repoRoot: input.repoRoot,
|
|
27204
27305
|
sourceRoots: input.sourceRoots ?? [cwd],
|
|
@@ -27343,8 +27444,8 @@ async function seedFromDemoAppRegistry() {
|
|
|
27343
27444
|
if (apps.length === 0) return;
|
|
27344
27445
|
mutateStore((store) => {
|
|
27345
27446
|
for (const app of apps) {
|
|
27346
|
-
if (!
|
|
27347
|
-
const cwd =
|
|
27447
|
+
if (!import_node_fs19.default.existsSync(app.dir)) continue;
|
|
27448
|
+
const cwd = import_node_path20.default.resolve(app.dir);
|
|
27348
27449
|
const id = projectIdForCwd(cwd);
|
|
27349
27450
|
if (store.attachedProjects.some((p) => p.id === id)) continue;
|
|
27350
27451
|
const now = Date.now();
|
|
@@ -27365,13 +27466,13 @@ async function seedFromDemoAppRegistry() {
|
|
|
27365
27466
|
}
|
|
27366
27467
|
});
|
|
27367
27468
|
}
|
|
27368
|
-
var
|
|
27469
|
+
var import_node_crypto8, import_node_fs19, import_node_path20, overrideDir, COST_HISTORY_MAX_AGE_MS;
|
|
27369
27470
|
var init_attached_projects = __esm({
|
|
27370
27471
|
"src/attached-projects.ts"() {
|
|
27371
27472
|
"use strict";
|
|
27372
|
-
|
|
27373
|
-
|
|
27374
|
-
|
|
27473
|
+
import_node_crypto8 = require("node:crypto");
|
|
27474
|
+
import_node_fs19 = __toESM(require("node:fs"), 1);
|
|
27475
|
+
import_node_path20 = __toESM(require("node:path"), 1);
|
|
27375
27476
|
init_home_paths();
|
|
27376
27477
|
overrideDir = null;
|
|
27377
27478
|
COST_HISTORY_MAX_AGE_MS = 14 * 24 * 60 * 60 * 1e3;
|
|
@@ -27380,16 +27481,16 @@ var init_attached_projects = __esm({
|
|
|
27380
27481
|
|
|
27381
27482
|
// src/agent-sessions.ts
|
|
27382
27483
|
function sessionDir(sessionId) {
|
|
27383
|
-
return
|
|
27484
|
+
return import_node_path21.default.join(getUserDataDir(), "sessions", sessionId);
|
|
27384
27485
|
}
|
|
27385
27486
|
function promptFifoPath(sessionId) {
|
|
27386
|
-
return
|
|
27487
|
+
return import_node_path21.default.join(sessionDir(sessionId), "prompt.in");
|
|
27387
27488
|
}
|
|
27388
27489
|
function eventsFifoPath(sessionId) {
|
|
27389
|
-
return
|
|
27490
|
+
return import_node_path21.default.join(sessionDir(sessionId), "events.out");
|
|
27390
27491
|
}
|
|
27391
27492
|
function transcriptPath(sessionId) {
|
|
27392
|
-
return
|
|
27493
|
+
return import_node_path21.default.join(getUserDataDir(), "transcripts", `${sessionId}.log`);
|
|
27393
27494
|
}
|
|
27394
27495
|
function pidIsAlive(pid, sessionId) {
|
|
27395
27496
|
if (!pid) return false;
|
|
@@ -27399,7 +27500,7 @@ function pidIsAlive(pid, sessionId) {
|
|
|
27399
27500
|
return false;
|
|
27400
27501
|
}
|
|
27401
27502
|
if (sessionId) {
|
|
27402
|
-
if (!
|
|
27503
|
+
if (!import_node_fs20.default.existsSync(sessionDir(sessionId))) return false;
|
|
27403
27504
|
}
|
|
27404
27505
|
return true;
|
|
27405
27506
|
}
|
|
@@ -27412,11 +27513,11 @@ function resolveSootsimInvocation() {
|
|
|
27412
27513
|
const resourcesPath = process.resourcesPath;
|
|
27413
27514
|
if (resourcesPath) {
|
|
27414
27515
|
const candidates = [
|
|
27415
|
-
|
|
27416
|
-
|
|
27516
|
+
import_node_path21.default.join(resourcesPath, "bin", "sootsim"),
|
|
27517
|
+
import_node_path21.default.join(resourcesPath, "bin", `sootsim-${process.platform}-${process.arch}`)
|
|
27417
27518
|
];
|
|
27418
27519
|
for (const c of candidates) {
|
|
27419
|
-
if (
|
|
27520
|
+
if (import_node_fs20.default.existsSync(c)) return { executable: c, prefixArgs: [] };
|
|
27420
27521
|
}
|
|
27421
27522
|
}
|
|
27422
27523
|
}
|
|
@@ -27435,15 +27536,15 @@ function tryWorkspaceSootsim() {
|
|
|
27435
27536
|
const sootsimDir = resolveSootsimPackageDir();
|
|
27436
27537
|
if (!sootsimDir) return null;
|
|
27437
27538
|
const binaryName = `peach-${process.platform === "win32" ? "windows" : process.platform}-${process.arch}${process.platform === "win32" ? ".exe" : ""}`;
|
|
27438
|
-
const distBinary =
|
|
27439
|
-
if (
|
|
27440
|
-
const distBin =
|
|
27441
|
-
if (
|
|
27539
|
+
const distBinary = import_node_path21.default.join(sootsimDir, "dist-bin", binaryName);
|
|
27540
|
+
if (import_node_fs20.default.existsSync(distBinary)) return { executable: distBinary, prefixArgs: [] };
|
|
27541
|
+
const distBin = import_node_path21.default.join(sootsimDir, "dist-cli", "bin.js");
|
|
27542
|
+
if (import_node_fs20.default.existsSync(distBin)) {
|
|
27442
27543
|
try {
|
|
27443
|
-
const src =
|
|
27444
|
-
if (
|
|
27445
|
-
const srcMtime =
|
|
27446
|
-
const buildMtime =
|
|
27544
|
+
const src = import_node_path21.default.join(sootsimDir, "cli", "commands", "agent-wrapper.ts");
|
|
27545
|
+
if (import_node_fs20.default.existsSync(src)) {
|
|
27546
|
+
const srcMtime = import_node_fs20.default.statSync(src).mtimeMs;
|
|
27547
|
+
const buildMtime = import_node_fs20.default.statSync(distBin).mtimeMs;
|
|
27447
27548
|
if (buildMtime < srcMtime) {
|
|
27448
27549
|
console.warn(
|
|
27449
27550
|
`[peach] dist-cli/bin.js is older than agent-wrapper.ts \u2014 rebuild with \`bun run --cwd packages/peachsim build:cli\`.`
|
|
@@ -27462,22 +27563,22 @@ function tryWorkspaceSootsim() {
|
|
|
27462
27563
|
function resolveSootsimPackageDir() {
|
|
27463
27564
|
try {
|
|
27464
27565
|
const resolved = require.resolve(`${rnxPublicBrand.packageName}/package.json`);
|
|
27465
|
-
return
|
|
27566
|
+
return import_node_path21.default.dirname(resolved);
|
|
27466
27567
|
} catch {
|
|
27467
27568
|
}
|
|
27468
27569
|
const here = fileFromImportMeta();
|
|
27469
27570
|
if (!here) return null;
|
|
27470
|
-
let cur =
|
|
27571
|
+
let cur = import_node_path21.default.dirname(here);
|
|
27471
27572
|
for (let i = 0; i < 8; i++) {
|
|
27472
|
-
const pkg =
|
|
27573
|
+
const pkg = import_node_path21.default.join(cur, "package.json");
|
|
27473
27574
|
try {
|
|
27474
|
-
if (
|
|
27475
|
-
const parsed = JSON.parse(
|
|
27575
|
+
if (import_node_fs20.default.existsSync(pkg)) {
|
|
27576
|
+
const parsed = JSON.parse(import_node_fs20.default.readFileSync(pkg, "utf8"));
|
|
27476
27577
|
if (parsed.name === rnxPublicBrand.packageName) return cur;
|
|
27477
27578
|
}
|
|
27478
27579
|
} catch {
|
|
27479
27580
|
}
|
|
27480
|
-
const parent =
|
|
27581
|
+
const parent = import_node_path21.default.dirname(cur);
|
|
27481
27582
|
if (parent === cur) break;
|
|
27482
27583
|
cur = parent;
|
|
27483
27584
|
}
|
|
@@ -27493,28 +27594,28 @@ function fileFromImportMeta() {
|
|
|
27493
27594
|
}
|
|
27494
27595
|
}
|
|
27495
27596
|
async function withStartLock(projectId, provider, fn) {
|
|
27496
|
-
const lockDir =
|
|
27497
|
-
|
|
27597
|
+
const lockDir = import_node_path21.default.join(getUserDataDir(), "locks");
|
|
27598
|
+
import_node_fs20.default.mkdirSync(lockDir, { recursive: true });
|
|
27498
27599
|
try {
|
|
27499
|
-
|
|
27600
|
+
import_node_fs20.default.chmodSync(lockDir, 448);
|
|
27500
27601
|
} catch {
|
|
27501
27602
|
}
|
|
27502
|
-
const lockPath =
|
|
27603
|
+
const lockPath = import_node_path21.default.join(lockDir, `start-${projectId}-${provider}.lock`);
|
|
27503
27604
|
const deadline = Date.now() + 4e3;
|
|
27504
27605
|
let fd = null;
|
|
27505
27606
|
while (fd === null) {
|
|
27506
27607
|
try {
|
|
27507
|
-
fd =
|
|
27608
|
+
fd = import_node_fs20.default.openSync(
|
|
27508
27609
|
lockPath,
|
|
27509
|
-
|
|
27610
|
+
import_node_fs20.constants.O_WRONLY | import_node_fs20.constants.O_CREAT | import_node_fs20.constants.O_EXCL,
|
|
27510
27611
|
384
|
|
27511
27612
|
);
|
|
27512
27613
|
} catch (err) {
|
|
27513
27614
|
if (err.code !== "EEXIST") throw err;
|
|
27514
27615
|
try {
|
|
27515
|
-
const stale = Number(
|
|
27616
|
+
const stale = Number(import_node_fs20.default.readFileSync(lockPath, "utf8").trim());
|
|
27516
27617
|
if (stale && !isProcessAlive(stale)) {
|
|
27517
|
-
|
|
27618
|
+
import_node_fs20.default.unlinkSync(lockPath);
|
|
27518
27619
|
continue;
|
|
27519
27620
|
}
|
|
27520
27621
|
} catch {
|
|
@@ -27528,15 +27629,15 @@ async function withStartLock(projectId, provider, fn) {
|
|
|
27528
27629
|
}
|
|
27529
27630
|
}
|
|
27530
27631
|
try {
|
|
27531
|
-
|
|
27632
|
+
import_node_fs20.default.writeFileSync(fd, String(process.pid));
|
|
27532
27633
|
return await fn();
|
|
27533
27634
|
} finally {
|
|
27534
27635
|
try {
|
|
27535
|
-
|
|
27636
|
+
import_node_fs20.default.closeSync(fd);
|
|
27536
27637
|
} catch {
|
|
27537
27638
|
}
|
|
27538
27639
|
try {
|
|
27539
|
-
|
|
27640
|
+
import_node_fs20.default.unlinkSync(lockPath);
|
|
27540
27641
|
} catch {
|
|
27541
27642
|
}
|
|
27542
27643
|
}
|
|
@@ -27550,28 +27651,28 @@ function isProcessAlive(pid) {
|
|
|
27550
27651
|
}
|
|
27551
27652
|
}
|
|
27552
27653
|
function mkfifoSync(p) {
|
|
27553
|
-
const parent =
|
|
27554
|
-
|
|
27654
|
+
const parent = import_node_path21.default.dirname(p);
|
|
27655
|
+
import_node_fs20.default.mkdirSync(parent, { recursive: true });
|
|
27555
27656
|
try {
|
|
27556
|
-
|
|
27657
|
+
import_node_fs20.default.chmodSync(parent, 448);
|
|
27557
27658
|
} catch {
|
|
27558
27659
|
}
|
|
27559
|
-
if (
|
|
27660
|
+
if (import_node_fs20.default.existsSync(p)) {
|
|
27560
27661
|
try {
|
|
27561
|
-
const stat2 =
|
|
27662
|
+
const stat2 = import_node_fs20.default.statSync(p);
|
|
27562
27663
|
if (stat2.isFIFO()) {
|
|
27563
27664
|
try {
|
|
27564
|
-
|
|
27665
|
+
import_node_fs20.default.chmodSync(p, 384);
|
|
27565
27666
|
} catch {
|
|
27566
27667
|
}
|
|
27567
27668
|
return;
|
|
27568
27669
|
}
|
|
27569
|
-
|
|
27670
|
+
import_node_fs20.default.unlinkSync(p);
|
|
27570
27671
|
} catch {
|
|
27571
|
-
|
|
27672
|
+
import_node_fs20.default.unlinkSync(p);
|
|
27572
27673
|
}
|
|
27573
27674
|
}
|
|
27574
|
-
const result = (0,
|
|
27675
|
+
const result = (0, import_node_child_process10.spawnSync)("mkfifo", ["-m", "600", p]);
|
|
27575
27676
|
if (result.status !== 0) {
|
|
27576
27677
|
throw new Error(
|
|
27577
27678
|
`mkfifo(${p}) failed: ${result.stderr?.toString().trim() || "unknown error"}`
|
|
@@ -27594,7 +27695,7 @@ async function startSession(opts) {
|
|
|
27594
27695
|
`session already running for project=${project.id} provider=${provider} (session ${existingLive.id}, pid ${existingLive.wrapperPid}). end it first with \`peach agent end <sessionId>\`.`
|
|
27595
27696
|
);
|
|
27596
27697
|
}
|
|
27597
|
-
const claudeSessionUuid = provider === "claude" ? (0,
|
|
27698
|
+
const claudeSessionUuid = provider === "claude" ? (0, import_node_crypto9.randomUUID)() : void 0;
|
|
27598
27699
|
const session = upsertSession({
|
|
27599
27700
|
projectId: project.id,
|
|
27600
27701
|
provider,
|
|
@@ -27608,10 +27709,10 @@ async function startSession(opts) {
|
|
|
27608
27709
|
const transcript = transcriptPath(session.id);
|
|
27609
27710
|
mkfifoSync(promptIn);
|
|
27610
27711
|
mkfifoSync(eventsOut);
|
|
27611
|
-
const transcriptDir =
|
|
27612
|
-
|
|
27712
|
+
const transcriptDir = import_node_path21.default.dirname(transcript);
|
|
27713
|
+
import_node_fs20.default.mkdirSync(transcriptDir, { recursive: true });
|
|
27613
27714
|
try {
|
|
27614
|
-
|
|
27715
|
+
import_node_fs20.default.chmodSync(transcriptDir, 448);
|
|
27615
27716
|
} catch {
|
|
27616
27717
|
}
|
|
27617
27718
|
const { executable, prefixArgs } = resolveSootsimInvocation();
|
|
@@ -27639,7 +27740,7 @@ async function startSession(opts) {
|
|
|
27639
27740
|
if (claudeSessionUuid) {
|
|
27640
27741
|
wrapperArgs.push("--claude-session-uuid", claudeSessionUuid);
|
|
27641
27742
|
}
|
|
27642
|
-
const child = (0,
|
|
27743
|
+
const child = (0, import_node_child_process10.spawn)(executable, wrapperArgs, {
|
|
27643
27744
|
detached: true,
|
|
27644
27745
|
stdio: "ignore",
|
|
27645
27746
|
env: {
|
|
@@ -27662,7 +27763,7 @@ async function startSession(opts) {
|
|
|
27662
27763
|
}
|
|
27663
27764
|
}
|
|
27664
27765
|
try {
|
|
27665
|
-
|
|
27766
|
+
import_node_fs20.default.rmSync(sessionDir(session.id), { recursive: true, force: true });
|
|
27666
27767
|
} catch {
|
|
27667
27768
|
}
|
|
27668
27769
|
updateSessionStatus(session.id, { status: "ended" });
|
|
@@ -27690,18 +27791,18 @@ async function sendPrompt(sessionId, prompt) {
|
|
|
27690
27791
|
);
|
|
27691
27792
|
}
|
|
27692
27793
|
const fifo = promptFifoPath(sessionId);
|
|
27693
|
-
if (!
|
|
27794
|
+
if (!import_node_fs20.default.existsSync(fifo)) {
|
|
27694
27795
|
throw new AgentSessionError("NO_FIFO", `prompt FIFO missing: ${fifo}`);
|
|
27695
27796
|
}
|
|
27696
|
-
const fd =
|
|
27797
|
+
const fd = import_node_fs20.default.openSync(fifo, import_node_fs20.constants.O_WRONLY);
|
|
27697
27798
|
try {
|
|
27698
27799
|
const wireText = encodeAgentPromptEnvelope(prompt);
|
|
27699
27800
|
if (!wireText) {
|
|
27700
27801
|
throw new AgentSessionError("EMPTY_PROMPT", "prompt text is empty");
|
|
27701
27802
|
}
|
|
27702
|
-
|
|
27803
|
+
import_node_fs20.default.writeSync(fd, wireText + "\n");
|
|
27703
27804
|
} finally {
|
|
27704
|
-
|
|
27805
|
+
import_node_fs20.default.closeSync(fd);
|
|
27705
27806
|
}
|
|
27706
27807
|
updateSessionStatus(sessionId, {
|
|
27707
27808
|
lastPrompt: prompt.displayText ?? prompt.text,
|
|
@@ -27723,7 +27824,7 @@ async function endSession(sessionId) {
|
|
|
27723
27824
|
const base = getUserDataDir();
|
|
27724
27825
|
if (dir.startsWith(base)) {
|
|
27725
27826
|
try {
|
|
27726
|
-
|
|
27827
|
+
import_node_fs20.default.rmSync(dir, { recursive: true, force: true });
|
|
27727
27828
|
} catch {
|
|
27728
27829
|
}
|
|
27729
27830
|
}
|
|
@@ -27731,11 +27832,11 @@ async function endSession(sessionId) {
|
|
|
27731
27832
|
}
|
|
27732
27833
|
function subscribeEvents(sessionId, onEvent) {
|
|
27733
27834
|
const fifo = eventsFifoPath(sessionId);
|
|
27734
|
-
if (!
|
|
27835
|
+
if (!import_node_fs20.default.existsSync(fifo)) {
|
|
27735
27836
|
throw new AgentSessionError("NO_FIFO", `events FIFO missing: ${fifo}`);
|
|
27736
27837
|
}
|
|
27737
|
-
const fd =
|
|
27738
|
-
const stream =
|
|
27838
|
+
const fd = import_node_fs20.default.openSync(fifo, import_node_fs20.constants.O_RDWR);
|
|
27839
|
+
const stream = import_node_fs20.default.createReadStream("", { fd, autoClose: true });
|
|
27739
27840
|
const rl = import_node_readline.default.createInterface({ input: stream, crlfDelay: Infinity });
|
|
27740
27841
|
rl.on("line", (line) => {
|
|
27741
27842
|
const event = parseAgentEventLine(line);
|
|
@@ -27746,7 +27847,7 @@ function subscribeEvents(sessionId, onEvent) {
|
|
|
27746
27847
|
if (closed) return;
|
|
27747
27848
|
closed = true;
|
|
27748
27849
|
try {
|
|
27749
|
-
|
|
27850
|
+
import_node_fs20.default.writeSync(fd, "\n");
|
|
27750
27851
|
} catch {
|
|
27751
27852
|
}
|
|
27752
27853
|
try {
|
|
@@ -27760,7 +27861,7 @@ function subscribeEvents(sessionId, onEvent) {
|
|
|
27760
27861
|
};
|
|
27761
27862
|
}
|
|
27762
27863
|
async function waitForFirstEvent(fifo, predicate, timeoutMs) {
|
|
27763
|
-
const fd =
|
|
27864
|
+
const fd = import_node_fs20.default.openSync(fifo, import_node_fs20.constants.O_RDWR | import_node_fs20.constants.O_NONBLOCK);
|
|
27764
27865
|
const buf = Buffer.alloc(8192);
|
|
27765
27866
|
let leftover = "";
|
|
27766
27867
|
const deadline = Date.now() + timeoutMs;
|
|
@@ -27768,7 +27869,7 @@ async function waitForFirstEvent(fifo, predicate, timeoutMs) {
|
|
|
27768
27869
|
while (Date.now() < deadline) {
|
|
27769
27870
|
let n = 0;
|
|
27770
27871
|
try {
|
|
27771
|
-
n =
|
|
27872
|
+
n = import_node_fs20.default.readSync(fd, buf, 0, buf.length, null);
|
|
27772
27873
|
} catch (err) {
|
|
27773
27874
|
if (err.code !== "EAGAIN") throw err;
|
|
27774
27875
|
n = 0;
|
|
@@ -27788,17 +27889,17 @@ async function waitForFirstEvent(fifo, predicate, timeoutMs) {
|
|
|
27788
27889
|
}
|
|
27789
27890
|
return null;
|
|
27790
27891
|
} finally {
|
|
27791
|
-
|
|
27892
|
+
import_node_fs20.default.closeSync(fd);
|
|
27792
27893
|
}
|
|
27793
27894
|
}
|
|
27794
|
-
var
|
|
27895
|
+
var import_node_child_process10, import_node_crypto9, import_node_fs20, import_node_path21, import_node_readline, AgentSessionError;
|
|
27795
27896
|
var init_agent_sessions = __esm({
|
|
27796
27897
|
"src/agent-sessions.ts"() {
|
|
27797
27898
|
"use strict";
|
|
27798
|
-
|
|
27799
|
-
|
|
27800
|
-
|
|
27801
|
-
|
|
27899
|
+
import_node_child_process10 = require("node:child_process");
|
|
27900
|
+
import_node_crypto9 = require("node:crypto");
|
|
27901
|
+
import_node_fs20 = __toESM(require("node:fs"), 1);
|
|
27902
|
+
import_node_path21 = __toESM(require("node:path"), 1);
|
|
27802
27903
|
import_node_readline = __toESM(require("node:readline"), 1);
|
|
27803
27904
|
init_self_invocation();
|
|
27804
27905
|
init_standalone();
|
|
@@ -27829,13 +27930,13 @@ function mapFrameworkToProjectFramework(fw) {
|
|
|
27829
27930
|
if (fw === "one" || fw === "vxrn") return "one";
|
|
27830
27931
|
return "unknown";
|
|
27831
27932
|
}
|
|
27832
|
-
var
|
|
27933
|
+
var import_node_crypto10, import_node_fs21, import_node_path22, WS_OPEN, SESSION_STATUS_PERSIST_DELAY_MS, AgentHost;
|
|
27833
27934
|
var init_agent_host = __esm({
|
|
27834
27935
|
"src/host/agent-host.ts"() {
|
|
27835
27936
|
"use strict";
|
|
27836
|
-
|
|
27837
|
-
|
|
27838
|
-
|
|
27937
|
+
import_node_crypto10 = require("node:crypto");
|
|
27938
|
+
import_node_fs21 = __toESM(require("node:fs"), 1);
|
|
27939
|
+
import_node_path22 = __toESM(require("node:path"), 1);
|
|
27839
27940
|
init_dev_server_scanner();
|
|
27840
27941
|
init_agent_sessions();
|
|
27841
27942
|
init_attached_projects();
|
|
@@ -28035,7 +28136,7 @@ var init_agent_host = __esm({
|
|
|
28035
28136
|
throw new AgentSessionError("EMPTY_PROMPT", "inspect message cannot be empty");
|
|
28036
28137
|
}
|
|
28037
28138
|
const message = {
|
|
28038
|
-
id: `inspect-${(0,
|
|
28139
|
+
id: `inspect-${(0, import_node_crypto10.randomUUID)()}`,
|
|
28039
28140
|
simId,
|
|
28040
28141
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
28041
28142
|
prompt
|
|
@@ -28081,7 +28182,7 @@ var init_agent_host = __esm({
|
|
|
28081
28182
|
);
|
|
28082
28183
|
const project = upsertProject({
|
|
28083
28184
|
cwd: match.cwd,
|
|
28084
|
-
name: match.projectName ??
|
|
28185
|
+
name: match.projectName ?? import_node_path22.default.basename(match.cwd),
|
|
28085
28186
|
preferredProvider: input.provider ?? existing?.preferredProvider,
|
|
28086
28187
|
sourceRoots: existing?.sourceRoots ?? [match.cwd],
|
|
28087
28188
|
knownBundleUrls,
|
|
@@ -28092,18 +28193,18 @@ var init_agent_host = __esm({
|
|
|
28092
28193
|
}
|
|
28093
28194
|
getTranscript(sessionId) {
|
|
28094
28195
|
const p = transcriptPath(sessionId);
|
|
28095
|
-
if (!
|
|
28196
|
+
if (!import_node_fs21.default.existsSync(p)) {
|
|
28096
28197
|
return { error: "transcript not found", code: "NO_TRANSCRIPT" };
|
|
28097
28198
|
}
|
|
28098
|
-
return
|
|
28199
|
+
return import_node_fs21.default.readFileSync(p, "utf8");
|
|
28099
28200
|
}
|
|
28100
28201
|
getPaths() {
|
|
28101
28202
|
const dir = getUserDataDir();
|
|
28102
28203
|
return {
|
|
28103
28204
|
userDataDir: dir,
|
|
28104
|
-
storeFile:
|
|
28105
|
-
sessionsDir:
|
|
28106
|
-
transcriptsDir:
|
|
28205
|
+
storeFile: import_node_path22.default.join(dir, "attached-projects.json"),
|
|
28206
|
+
sessionsDir: import_node_path22.default.join(dir, "sessions"),
|
|
28207
|
+
transcriptsDir: import_node_path22.default.join(dir, "transcripts")
|
|
28107
28208
|
};
|
|
28108
28209
|
}
|
|
28109
28210
|
// --- subscription management ---
|
|
@@ -28817,7 +28918,7 @@ async function startFetchProxyTransport() {
|
|
|
28817
28918
|
const keys = await crypto.subtle.generateKey(algorithm, true, ["sign", "verify"]);
|
|
28818
28919
|
const certificate = await import_x509.X509CertificateGenerator.createSelfSigned(
|
|
28819
28920
|
{
|
|
28820
|
-
serialNumber: (0,
|
|
28921
|
+
serialNumber: (0, import_node_crypto11.randomBytes)(16).toString("hex"),
|
|
28821
28922
|
name: "CN=localhost",
|
|
28822
28923
|
notBefore: new Date(Date.now() - 6e4),
|
|
28823
28924
|
notAfter: new Date(Date.now() + 365 * 24 * 60 * 6e4),
|
|
@@ -28830,7 +28931,7 @@ async function startFetchProxyTransport() {
|
|
|
28830
28931
|
crypto
|
|
28831
28932
|
);
|
|
28832
28933
|
const privateKey = Buffer.from(await crypto.subtle.exportKey("pkcs8", keys.privateKey));
|
|
28833
|
-
const spki = (0,
|
|
28934
|
+
const spki = (0, import_node_crypto11.createHash)("sha256").update(Buffer.from(await crypto.subtle.exportKey("spki", keys.publicKey))).digest("base64");
|
|
28834
28935
|
const sessions = /* @__PURE__ */ new Set();
|
|
28835
28936
|
const server = (0, import_node_http22.createSecureServer)(
|
|
28836
28937
|
{
|
|
@@ -28876,11 +28977,11 @@ ${privateKey.toString("base64").match(/.{1,64}/g)?.join("\n")}
|
|
|
28876
28977
|
}
|
|
28877
28978
|
};
|
|
28878
28979
|
}
|
|
28879
|
-
var
|
|
28980
|
+
var import_node_crypto11, import_node_http22, import_x509;
|
|
28880
28981
|
var init_fetch_proxy_transport = __esm({
|
|
28881
28982
|
"src/host/fetch-proxy-transport.ts"() {
|
|
28882
28983
|
"use strict";
|
|
28883
|
-
|
|
28984
|
+
import_node_crypto11 = require("node:crypto");
|
|
28884
28985
|
import_node_http22 = require("node:http2");
|
|
28885
28986
|
import_x509 = require("@peculiar/x509");
|
|
28886
28987
|
init_fetch_proxy_handler();
|
|
@@ -29097,23 +29198,23 @@ function looksBinary(filePath, size) {
|
|
|
29097
29198
|
if (size === 0) return false;
|
|
29098
29199
|
let fd;
|
|
29099
29200
|
try {
|
|
29100
|
-
fd =
|
|
29201
|
+
fd = import_node_fs22.default.openSync(filePath, "r");
|
|
29101
29202
|
const buffer = Buffer.alloc(Math.min(BINARY_SNIFF_BYTES, size));
|
|
29102
|
-
const read =
|
|
29203
|
+
const read = import_node_fs22.default.readSync(fd, buffer, 0, buffer.length, 0);
|
|
29103
29204
|
return buffer.subarray(0, read).includes(0);
|
|
29104
29205
|
} catch {
|
|
29105
29206
|
return false;
|
|
29106
29207
|
} finally {
|
|
29107
|
-
if (fd !== void 0)
|
|
29208
|
+
if (fd !== void 0) import_node_fs22.default.closeSync(fd);
|
|
29108
29209
|
}
|
|
29109
29210
|
}
|
|
29110
|
-
var
|
|
29211
|
+
var import_node_child_process11, import_node_fs22, import_node_path23, CheckoutRequiresGitError, BINARY_SNIFF_BYTES, LIST_FILES_TIMEOUT_MS, LIST_FILES_ATTEMPTS, LIST_FILES_RETRY_MS, CheckoutFilePlane;
|
|
29111
29212
|
var init_checkout_plane = __esm({
|
|
29112
29213
|
"cli/commands/box/checkout-plane.ts"() {
|
|
29113
29214
|
"use strict";
|
|
29114
|
-
|
|
29115
|
-
|
|
29116
|
-
|
|
29215
|
+
import_node_child_process11 = require("node:child_process");
|
|
29216
|
+
import_node_fs22 = __toESM(require("node:fs"), 1);
|
|
29217
|
+
import_node_path23 = __toESM(require("node:path"), 1);
|
|
29117
29218
|
CheckoutRequiresGitError = class extends Error {
|
|
29118
29219
|
};
|
|
29119
29220
|
BINARY_SNIFF_BYTES = 8192;
|
|
@@ -29130,7 +29231,7 @@ var init_checkout_plane = __esm({
|
|
|
29130
29231
|
listTimeoutMs;
|
|
29131
29232
|
trackedOnly;
|
|
29132
29233
|
constructor(root, options = {}) {
|
|
29133
|
-
this.root =
|
|
29234
|
+
this.root = import_node_path23.default.resolve(root);
|
|
29134
29235
|
this.listTimeoutMs = options.listTimeoutMs ?? LIST_FILES_TIMEOUT_MS;
|
|
29135
29236
|
this.trackedOnly = options.trackedOnly ?? false;
|
|
29136
29237
|
}
|
|
@@ -29139,7 +29240,7 @@ var init_checkout_plane = __esm({
|
|
|
29139
29240
|
}
|
|
29140
29241
|
listFiles() {
|
|
29141
29242
|
const args = this.trackedOnly ? ["ls-files", "-z"] : ["ls-files", "-co", "--exclude-standard", "-z"];
|
|
29142
|
-
const stdout = (0,
|
|
29243
|
+
const stdout = (0, import_node_child_process11.execFileSync)("git", args, {
|
|
29143
29244
|
cwd: this.root,
|
|
29144
29245
|
encoding: "utf8",
|
|
29145
29246
|
maxBuffer: 64 * 1024 * 1024,
|
|
@@ -29192,13 +29293,13 @@ var init_checkout_plane = __esm({
|
|
|
29192
29293
|
if (!relative3) continue;
|
|
29193
29294
|
let stat2;
|
|
29194
29295
|
try {
|
|
29195
|
-
stat2 =
|
|
29296
|
+
stat2 = import_node_fs22.default.statSync(import_node_path23.default.join(this.root, relative3));
|
|
29196
29297
|
} catch {
|
|
29197
29298
|
continue;
|
|
29198
29299
|
}
|
|
29199
29300
|
if (!stat2.isFile()) continue;
|
|
29200
29301
|
const seen = this.sniffed.get(relative3);
|
|
29201
|
-
const binary = seen && seen.size === stat2.size && seen.mtimeMs === stat2.mtimeMs ? seen.binary : looksBinary(
|
|
29302
|
+
const binary = seen && seen.size === stat2.size && seen.mtimeMs === stat2.mtimeMs ? seen.binary : looksBinary(import_node_path23.default.join(this.root, relative3), stat2.size);
|
|
29202
29303
|
nextSniffed.set(relative3, { size: stat2.size, mtimeMs: stat2.mtimeMs, binary });
|
|
29203
29304
|
next.set(relative3, {
|
|
29204
29305
|
size: stat2.size,
|
|
@@ -29212,22 +29313,22 @@ var init_checkout_plane = __esm({
|
|
|
29212
29313
|
this.sniffed = nextSniffed;
|
|
29213
29314
|
}
|
|
29214
29315
|
absolute(planePath) {
|
|
29215
|
-
const resolved =
|
|
29216
|
-
if (resolved !== this.root && !resolved.startsWith(`${this.root}${
|
|
29316
|
+
const resolved = import_node_path23.default.resolve(this.root, planePath);
|
|
29317
|
+
if (resolved !== this.root && !resolved.startsWith(`${this.root}${import_node_path23.default.sep}`)) {
|
|
29217
29318
|
throw new Error(`path escapes the project: ${planePath}`);
|
|
29218
29319
|
}
|
|
29219
29320
|
return resolved;
|
|
29220
29321
|
}
|
|
29221
29322
|
async read(planePath) {
|
|
29222
|
-
return
|
|
29323
|
+
return import_node_fs22.default.promises.readFile(this.absolute(planePath), "utf8");
|
|
29223
29324
|
}
|
|
29224
29325
|
async readBytes(planePath) {
|
|
29225
|
-
return
|
|
29326
|
+
return import_node_fs22.default.promises.readFile(this.absolute(planePath));
|
|
29226
29327
|
}
|
|
29227
29328
|
async write(planePath, content) {
|
|
29228
29329
|
const absolute = this.absolute(planePath);
|
|
29229
|
-
await
|
|
29230
|
-
await
|
|
29330
|
+
await import_node_fs22.default.promises.mkdir(import_node_path23.default.dirname(absolute), { recursive: true });
|
|
29331
|
+
await import_node_fs22.default.promises.writeFile(absolute, content);
|
|
29231
29332
|
this.entries.set(planePath, {
|
|
29232
29333
|
size: content.byteLength,
|
|
29233
29334
|
readOnly: false,
|
|
@@ -29236,7 +29337,7 @@ var init_checkout_plane = __esm({
|
|
|
29236
29337
|
});
|
|
29237
29338
|
}
|
|
29238
29339
|
async delete(planePath) {
|
|
29239
|
-
await
|
|
29340
|
+
await import_node_fs22.default.promises.rm(this.absolute(planePath), { force: true });
|
|
29240
29341
|
this.entries.delete(planePath);
|
|
29241
29342
|
}
|
|
29242
29343
|
};
|
|
@@ -29244,12 +29345,12 @@ var init_checkout_plane = __esm({
|
|
|
29244
29345
|
});
|
|
29245
29346
|
|
|
29246
29347
|
// src/host/plane-host.ts
|
|
29247
|
-
var
|
|
29348
|
+
var import_node_fs23, import_node_path24, WS_OPEN2, PlaneNotRegisteredError, PlaneHost;
|
|
29248
29349
|
var init_plane_host = __esm({
|
|
29249
29350
|
"src/host/plane-host.ts"() {
|
|
29250
29351
|
"use strict";
|
|
29251
|
-
|
|
29252
|
-
|
|
29352
|
+
import_node_fs23 = __toESM(require("node:fs"), 1);
|
|
29353
|
+
import_node_path24 = __toESM(require("node:path"), 1);
|
|
29253
29354
|
init_plane();
|
|
29254
29355
|
init_checkout_plane();
|
|
29255
29356
|
WS_OPEN2 = 1;
|
|
@@ -29264,12 +29365,12 @@ var init_plane_host = __esm({
|
|
|
29264
29365
|
/** handle a plane:* message. returns true iff it was one. */
|
|
29265
29366
|
async handleMessage(ws, msg) {
|
|
29266
29367
|
if (typeof msg !== "object" || msg === null) return false;
|
|
29267
|
-
const
|
|
29268
|
-
const type =
|
|
29368
|
+
const record2 = { ...msg };
|
|
29369
|
+
const type = record2.type;
|
|
29269
29370
|
if (typeof type !== "string" || !type.startsWith("plane:")) return false;
|
|
29270
|
-
const id =
|
|
29371
|
+
const id = record2.id;
|
|
29271
29372
|
try {
|
|
29272
|
-
this.respond(ws, id, await this.dispatch(ws, type,
|
|
29373
|
+
this.respond(ws, id, await this.dispatch(ws, type, record2));
|
|
29273
29374
|
} catch (err) {
|
|
29274
29375
|
const code = err instanceof PlaneNotRegisteredError ? "plane-not-registered" : void 0;
|
|
29275
29376
|
this.respondError(ws, id, err instanceof Error ? err.message : String(err), code);
|
|
@@ -29372,14 +29473,14 @@ var init_plane_host = __esm({
|
|
|
29372
29473
|
// root and an opened one cannot disagree about the same directory.
|
|
29373
29474
|
realRoot(root) {
|
|
29374
29475
|
if (!root) throw new Error("root is required");
|
|
29375
|
-
const resolved =
|
|
29476
|
+
const resolved = import_node_path24.default.resolve(root);
|
|
29376
29477
|
let real;
|
|
29377
29478
|
try {
|
|
29378
|
-
real =
|
|
29479
|
+
real = import_node_fs23.default.realpathSync(resolved);
|
|
29379
29480
|
} catch {
|
|
29380
29481
|
throw new Error(`no such directory: ${resolved}`);
|
|
29381
29482
|
}
|
|
29382
|
-
if (!
|
|
29483
|
+
if (!import_node_fs23.default.statSync(real).isDirectory()) throw new Error(`not a directory: ${real}`);
|
|
29383
29484
|
return real;
|
|
29384
29485
|
}
|
|
29385
29486
|
respond(ws, id, result) {
|
|
@@ -29735,16 +29836,16 @@ function sendJavaScript(req, res, source) {
|
|
|
29735
29836
|
res.end(req.method === "HEAD" ? void 0 : source);
|
|
29736
29837
|
}
|
|
29737
29838
|
function resolveReplacementModuleFile(fromFile, specifier) {
|
|
29738
|
-
const base =
|
|
29839
|
+
const base = import_node_path25.default.resolve(import_node_path25.default.dirname(fromFile), specifier);
|
|
29739
29840
|
const candidates = [
|
|
29740
29841
|
...REPLACEMENT_MODULE_EXTENSIONS.some(
|
|
29741
|
-
(ext) => ext ===
|
|
29842
|
+
(ext) => ext === import_node_path25.default.extname(base).toLowerCase()
|
|
29742
29843
|
) ? [base] : [],
|
|
29743
29844
|
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => base + ext),
|
|
29744
|
-
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) =>
|
|
29845
|
+
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => import_node_path25.default.join(base, `index${ext}`))
|
|
29745
29846
|
];
|
|
29746
29847
|
const found = candidates.find(
|
|
29747
|
-
(candidate) => (0,
|
|
29848
|
+
(candidate) => (0, import_node_fs24.statSync)(candidate, { throwIfNoEntry: false })?.isFile()
|
|
29748
29849
|
);
|
|
29749
29850
|
if (!found) {
|
|
29750
29851
|
throw new Error(
|
|
@@ -29799,13 +29900,13 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
29799
29900
|
res.end("missing path param");
|
|
29800
29901
|
return true;
|
|
29801
29902
|
}
|
|
29802
|
-
const extension =
|
|
29903
|
+
const extension = import_node_path25.default.extname(targetPath).toLowerCase();
|
|
29803
29904
|
if (!REPLACEMENT_MODULE_EXTENSIONS.some((allowed) => allowed === extension)) {
|
|
29804
29905
|
res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
29805
29906
|
res.end(`replacement files must be ${REPLACEMENT_MODULE_EXTENSIONS.join(", ")}`);
|
|
29806
29907
|
return true;
|
|
29807
29908
|
}
|
|
29808
|
-
if (!
|
|
29909
|
+
if (!import_node_path25.default.isAbsolute(targetPath)) {
|
|
29809
29910
|
res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
29810
29911
|
res.end("replacement file path must be absolute");
|
|
29811
29912
|
return true;
|
|
@@ -29813,10 +29914,10 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
29813
29914
|
const runtimePackages = new Set(url.searchParams.getAll("runtimePackage"));
|
|
29814
29915
|
let resolvedProjectRoot;
|
|
29815
29916
|
if (options.projectRoot) {
|
|
29816
|
-
const lexicalProjectRoot =
|
|
29917
|
+
const lexicalProjectRoot = import_node_path25.default.resolve(options.projectRoot);
|
|
29817
29918
|
resolvedProjectRoot = await import_promises5.default.realpath(options.projectRoot);
|
|
29818
|
-
const lexicalTarget =
|
|
29819
|
-
if (lexicalTarget.startsWith("..") ||
|
|
29919
|
+
const lexicalTarget = import_node_path25.default.relative(lexicalProjectRoot, targetPath);
|
|
29920
|
+
if (lexicalTarget.startsWith("..") || import_node_path25.default.isAbsolute(lexicalTarget)) {
|
|
29820
29921
|
res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
|
|
29821
29922
|
res.end("replacement file must be inside the project root");
|
|
29822
29923
|
return true;
|
|
@@ -29832,8 +29933,8 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
29832
29933
|
return true;
|
|
29833
29934
|
}
|
|
29834
29935
|
if (resolvedProjectRoot) {
|
|
29835
|
-
const relativeTarget =
|
|
29836
|
-
if (relativeTarget.startsWith("..") ||
|
|
29936
|
+
const relativeTarget = import_node_path25.default.relative(resolvedProjectRoot, resolvedTargetPath);
|
|
29937
|
+
if (relativeTarget.startsWith("..") || import_node_path25.default.isAbsolute(relativeTarget)) {
|
|
29837
29938
|
res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
|
|
29838
29939
|
res.end("replacement file must be inside the project root");
|
|
29839
29940
|
return true;
|
|
@@ -29868,13 +29969,13 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
29868
29969
|
}
|
|
29869
29970
|
return true;
|
|
29870
29971
|
}
|
|
29871
|
-
var
|
|
29972
|
+
var import_node_fs24, import_promises5, import_node_path25, REPLACEMENT_MODULE_ROUTE;
|
|
29872
29973
|
var init_replacement_module_handler = __esm({
|
|
29873
29974
|
"src/host/replacement-module-handler.ts"() {
|
|
29874
29975
|
"use strict";
|
|
29875
|
-
|
|
29976
|
+
import_node_fs24 = require("node:fs");
|
|
29876
29977
|
import_promises5 = __toESM(require("node:fs/promises"), 1);
|
|
29877
|
-
|
|
29978
|
+
import_node_path25 = __toESM(require("node:path"), 1);
|
|
29878
29979
|
init_replacementModule();
|
|
29879
29980
|
init_backend_origin();
|
|
29880
29981
|
REPLACEMENT_MODULE_ROUTE = "/__sootsim-replacement-module";
|
|
@@ -31843,8 +31944,8 @@ function metroIosAssetDestRelatives(httpServerLocation, filename) {
|
|
|
31843
31944
|
}
|
|
31844
31945
|
const out = [];
|
|
31845
31946
|
for (const dir of dirs) {
|
|
31846
|
-
const
|
|
31847
|
-
if (!out.includes(
|
|
31947
|
+
const path35 = `${dir}/${filename}`;
|
|
31948
|
+
if (!out.includes(path35)) out.push(path35);
|
|
31848
31949
|
}
|
|
31849
31950
|
if (!out.includes(filename)) out.push(filename);
|
|
31850
31951
|
return out;
|
|
@@ -32798,13 +32899,13 @@ function readFactoryStringLiterals(factory) {
|
|
|
32798
32899
|
return literals;
|
|
32799
32900
|
}
|
|
32800
32901
|
function normalizeFingerprintLiteral(literal) {
|
|
32801
|
-
const
|
|
32902
|
+
const path35 = literal.replaceAll("\\\\", "/").replaceAll("\\/", "/");
|
|
32802
32903
|
const nodeModulesMarker = "/node_modules/";
|
|
32803
|
-
const nodeModulesIndex =
|
|
32904
|
+
const nodeModulesIndex = path35.lastIndexOf(nodeModulesMarker);
|
|
32804
32905
|
if (nodeModulesIndex >= 0) {
|
|
32805
|
-
return `node_modules/${
|
|
32906
|
+
return `node_modules/${path35.slice(nodeModulesIndex + nodeModulesMarker.length)}`;
|
|
32806
32907
|
}
|
|
32807
|
-
if ((
|
|
32908
|
+
if ((path35.startsWith("/") || /^[A-Za-z]:\//.test(path35) || path35.startsWith("file:/")) && /\.[cm]?[jt]sx?(?::\d+(?::\d+)?)?$/.test(path35)) {
|
|
32808
32909
|
return null;
|
|
32809
32910
|
}
|
|
32810
32911
|
return literal;
|
|
@@ -33042,10 +33143,10 @@ function templateAssignment(template, embeddings) {
|
|
|
33042
33143
|
if (existingNode !== void 0 && existingNode !== nodeIndex) return null;
|
|
33043
33144
|
nodesByModuleId.set(moduleId, nodeIndex);
|
|
33044
33145
|
const node = template.nodes[nodeIndex];
|
|
33045
|
-
const
|
|
33146
|
+
const path35 = node.landmarkPath ?? `node_modules/${template.packageName}/__rnx_inferred__/${moduleId}.js`;
|
|
33046
33147
|
const existingPath = pathsByModuleId.get(moduleId);
|
|
33047
|
-
if (existingPath !== void 0 && existingPath !==
|
|
33048
|
-
pathsByModuleId.set(moduleId,
|
|
33148
|
+
if (existingPath !== void 0 && existingPath !== path35) return null;
|
|
33149
|
+
pathsByModuleId.set(moduleId, path35);
|
|
33049
33150
|
}
|
|
33050
33151
|
}
|
|
33051
33152
|
return {
|
|
@@ -33207,14 +33308,14 @@ async function inferMetroModuleIdentity(args) {
|
|
|
33207
33308
|
const packageClaims = claimsByPackage.values().next().value;
|
|
33208
33309
|
if (!packageClaims) continue;
|
|
33209
33310
|
const exactClaims = packageClaims.filter((assignment2) => {
|
|
33210
|
-
const
|
|
33211
|
-
return
|
|
33311
|
+
const path35 = assignment2.pathsByModuleId.get(moduleId);
|
|
33312
|
+
return path35 !== void 0 && !path35.includes("/__rnx_inferred__/");
|
|
33212
33313
|
});
|
|
33213
33314
|
const preferredClaims = exactClaims.length > 0 ? exactClaims : packageClaims;
|
|
33214
33315
|
const routes = new Set(
|
|
33215
33316
|
preferredClaims.flatMap((assignment2) => {
|
|
33216
|
-
const
|
|
33217
|
-
return
|
|
33317
|
+
const path35 = assignment2.pathsByModuleId.get(moduleId);
|
|
33318
|
+
return path35 ? [metroFingerprintModuleClaimRoute(assignment2.packageName, path35)] : [];
|
|
33218
33319
|
})
|
|
33219
33320
|
);
|
|
33220
33321
|
if (routes.size !== 1) continue;
|
|
@@ -33509,8 +33610,8 @@ function detectFramework2(deps) {
|
|
|
33509
33610
|
return "unknown";
|
|
33510
33611
|
}
|
|
33511
33612
|
function detectProject(dir) {
|
|
33512
|
-
const pkgPath = (0,
|
|
33513
|
-
if (!(0,
|
|
33613
|
+
const pkgPath = (0, import_node_path26.join)(dir, "package.json");
|
|
33614
|
+
if (!(0, import_node_fs25.existsSync)(pkgPath)) return null;
|
|
33514
33615
|
const pkg = readProjectManifest(dir);
|
|
33515
33616
|
if (!pkg) return null;
|
|
33516
33617
|
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
@@ -33522,25 +33623,25 @@ function detectProject(dir) {
|
|
|
33522
33623
|
if (framework === "unknown") return null;
|
|
33523
33624
|
return {
|
|
33524
33625
|
dir,
|
|
33525
|
-
name: pkg.name || (0,
|
|
33626
|
+
name: pkg.name || (0, import_node_path26.basename)(dir),
|
|
33526
33627
|
framework,
|
|
33527
33628
|
// a config file is a config file whatever module system it declares. real
|
|
33528
33629
|
// apps write .cjs as often as .js, and missing one reads as "this project
|
|
33529
33630
|
// has no bundler config" and sends the user to create a second one.
|
|
33530
33631
|
hasViteConfig: CONFIG_EXTENSIONS.some(
|
|
33531
|
-
(ext) => (0,
|
|
33632
|
+
(ext) => (0, import_node_fs25.existsSync)((0, import_node_path26.join)(dir, `vite.config.${ext}`))
|
|
33532
33633
|
),
|
|
33533
33634
|
hasMetroConfig: CONFIG_EXTENSIONS.some(
|
|
33534
|
-
(ext) => (0,
|
|
33635
|
+
(ext) => (0, import_node_fs25.existsSync)((0, import_node_path26.join)(dir, `metro.config.${ext}`))
|
|
33535
33636
|
),
|
|
33536
33637
|
devCommand: typeof devCommand === "string" ? devCommand : null
|
|
33537
33638
|
};
|
|
33538
33639
|
}
|
|
33539
|
-
function readProjectMetadata(
|
|
33640
|
+
function readProjectMetadata(path35) {
|
|
33540
33641
|
try {
|
|
33541
|
-
const info = (0,
|
|
33642
|
+
const info = (0, import_node_fs25.lstatSync)(path35);
|
|
33542
33643
|
if (!info.isFile() || info.size > 4 * 1024 * 1024) return null;
|
|
33543
|
-
return (0,
|
|
33644
|
+
return (0, import_node_fs25.readFileSync)(path35, "utf8");
|
|
33544
33645
|
} catch {
|
|
33545
33646
|
return null;
|
|
33546
33647
|
}
|
|
@@ -33549,8 +33650,8 @@ function metadataValue(value, key) {
|
|
|
33549
33650
|
if (!value || typeof value !== "object") return void 0;
|
|
33550
33651
|
return Object.getOwnPropertyDescriptor(value, key)?.value;
|
|
33551
33652
|
}
|
|
33552
|
-
function readProjectJson(
|
|
33553
|
-
const text2 = readProjectMetadata(
|
|
33653
|
+
function readProjectJson(path35) {
|
|
33654
|
+
const text2 = readProjectMetadata(path35);
|
|
33554
33655
|
if (text2 === null) return null;
|
|
33555
33656
|
try {
|
|
33556
33657
|
const value = JSON.parse(text2);
|
|
@@ -33560,9 +33661,9 @@ function readProjectJson(path34) {
|
|
|
33560
33661
|
}
|
|
33561
33662
|
}
|
|
33562
33663
|
function readProjectManifest(dir) {
|
|
33563
|
-
const parsed = readProjectJson((0,
|
|
33664
|
+
const parsed = readProjectJson((0, import_node_path26.join)(dir, "package.json"));
|
|
33564
33665
|
if (!parsed || typeof parsed !== "object") return null;
|
|
33565
|
-
const
|
|
33666
|
+
const record2 = (value) => {
|
|
33566
33667
|
if (!value || typeof value !== "object") return {};
|
|
33567
33668
|
return Object.fromEntries(
|
|
33568
33669
|
Object.entries(value).filter(
|
|
@@ -33573,16 +33674,16 @@ function readProjectManifest(dir) {
|
|
|
33573
33674
|
const name2 = metadataValue(parsed, "name");
|
|
33574
33675
|
return {
|
|
33575
33676
|
...typeof name2 === "string" ? { name: name2 } : {},
|
|
33576
|
-
dependencies:
|
|
33577
|
-
devDependencies:
|
|
33677
|
+
dependencies: record2(metadataValue(parsed, "dependencies")),
|
|
33678
|
+
devDependencies: record2(metadataValue(parsed, "devDependencies"))
|
|
33578
33679
|
};
|
|
33579
33680
|
}
|
|
33580
|
-
var
|
|
33681
|
+
var import_node_fs25, import_node_path26, import_json52, import_yaml, CONFIG_EXTENSIONS;
|
|
33581
33682
|
var init_detect = __esm({
|
|
33582
33683
|
"cli/commands/detect.ts"() {
|
|
33583
33684
|
"use strict";
|
|
33584
|
-
|
|
33585
|
-
|
|
33685
|
+
import_node_fs25 = require("node:fs");
|
|
33686
|
+
import_node_path26 = require("node:path");
|
|
33586
33687
|
import_json52 = __toESM(require("json5"), 1);
|
|
33587
33688
|
import_yaml = require("yaml");
|
|
33588
33689
|
CONFIG_EXTENSIONS = ["ts", "js", "cjs", "mjs", "mts", "cts"];
|
|
@@ -33619,21 +33720,21 @@ function resolveCloudOrigin(value) {
|
|
|
33619
33720
|
return normalizeCloudOrigin(source);
|
|
33620
33721
|
}
|
|
33621
33722
|
function readImmutableBundleSource(bundlePath) {
|
|
33622
|
-
const filepath = (0,
|
|
33623
|
-
if ((0,
|
|
33723
|
+
const filepath = (0, import_node_path27.resolve)(bundlePath);
|
|
33724
|
+
if ((0, import_node_path27.extname)(filepath) !== ".js") {
|
|
33624
33725
|
throw new Error(`${REMOTE_COMMAND} requires one local Metro .js bundle`);
|
|
33625
33726
|
}
|
|
33626
|
-
const descriptor = (0,
|
|
33727
|
+
const descriptor = (0, import_node_fs26.openSync)(filepath, "r");
|
|
33627
33728
|
try {
|
|
33628
|
-
const before = (0,
|
|
33729
|
+
const before = (0, import_node_fs26.fstatSync)(descriptor, { bigint: true });
|
|
33629
33730
|
if (!before.isFile()) {
|
|
33630
33731
|
throw new Error(`${REMOTE_COMMAND} bundle must be a regular local file`);
|
|
33631
33732
|
}
|
|
33632
33733
|
if (before.size <= 0n) {
|
|
33633
33734
|
throw new Error(`${REMOTE_COMMAND} bundle is empty`);
|
|
33634
33735
|
}
|
|
33635
|
-
const bytes = (0,
|
|
33636
|
-
const after = (0,
|
|
33736
|
+
const bytes = (0, import_node_fs26.readFileSync)(descriptor);
|
|
33737
|
+
const after = (0, import_node_fs26.fstatSync)(descriptor, { bigint: true });
|
|
33637
33738
|
if (before.dev !== after.dev || before.ino !== after.ino || before.size !== after.size || before.mtimeNs !== after.mtimeNs || bytes.length !== Number(before.size)) {
|
|
33638
33739
|
throw new Error(`${REMOTE_COMMAND} bundle changed while it was being read`);
|
|
33639
33740
|
}
|
|
@@ -33648,7 +33749,7 @@ function readImmutableBundleSource(bundlePath) {
|
|
|
33648
33749
|
}
|
|
33649
33750
|
return source;
|
|
33650
33751
|
} finally {
|
|
33651
|
-
(0,
|
|
33752
|
+
(0, import_node_fs26.closeSync)(descriptor);
|
|
33652
33753
|
}
|
|
33653
33754
|
}
|
|
33654
33755
|
async function fetchBundleSource(bundleUrl) {
|
|
@@ -33695,15 +33796,15 @@ async function loadBundleSource(bundleInput) {
|
|
|
33695
33796
|
return readImmutableBundleSource(bundleInput);
|
|
33696
33797
|
}
|
|
33697
33798
|
function listMetroAssetDest(assetsPath) {
|
|
33698
|
-
const directory = (0,
|
|
33699
|
-
if (!(0,
|
|
33700
|
-
const skipNested = (0,
|
|
33799
|
+
const directory = (0, import_node_path27.resolve)(assetsPath);
|
|
33800
|
+
if (!(0, import_node_fs26.existsSync)(directory)) return { directory, files: [], truncated: false };
|
|
33801
|
+
const skipNested = (0, import_node_fs26.existsSync)((0, import_node_path27.join)(directory, "package.json"));
|
|
33701
33802
|
const files = [];
|
|
33702
33803
|
let truncated = false;
|
|
33703
33804
|
const walk2 = (dir, prefix) => {
|
|
33704
33805
|
let entries;
|
|
33705
33806
|
try {
|
|
33706
|
-
entries = (0,
|
|
33807
|
+
entries = (0, import_node_fs26.readdirSync)(dir, { withFileTypes: true });
|
|
33707
33808
|
} catch {
|
|
33708
33809
|
return;
|
|
33709
33810
|
}
|
|
@@ -33715,7 +33816,7 @@ function listMetroAssetDest(assetsPath) {
|
|
|
33715
33816
|
if (entry.isDirectory()) {
|
|
33716
33817
|
if (entry.name === ".git") continue;
|
|
33717
33818
|
if (skipNested && PROJECT_ONLY_DIRECTORIES.has(entry.name)) continue;
|
|
33718
|
-
walk2((0,
|
|
33819
|
+
walk2((0, import_node_path27.join)(dir, entry.name), prefix ? `${prefix}/${entry.name}` : entry.name);
|
|
33719
33820
|
} else if (entry.isFile()) {
|
|
33720
33821
|
files.push(prefix ? `${prefix}/${entry.name}` : entry.name);
|
|
33721
33822
|
}
|
|
@@ -33725,7 +33826,7 @@ function listMetroAssetDest(assetsPath) {
|
|
|
33725
33826
|
return { directory, files, truncated };
|
|
33726
33827
|
}
|
|
33727
33828
|
function metroDescriptorHash(scaleBytes) {
|
|
33728
|
-
const hasher = (0,
|
|
33829
|
+
const hasher = (0, import_node_crypto12.createHash)("md5");
|
|
33729
33830
|
for (const bytes of scaleBytes) hasher.update(bytes);
|
|
33730
33831
|
return hasher.digest("hex");
|
|
33731
33832
|
}
|
|
@@ -33750,11 +33851,11 @@ function distinctByContent(directory, options) {
|
|
|
33750
33851
|
for (const relative3 of options) {
|
|
33751
33852
|
let bytes;
|
|
33752
33853
|
try {
|
|
33753
|
-
bytes = (0,
|
|
33854
|
+
bytes = (0, import_node_fs26.readFileSync)((0, import_node_path27.join)(directory, relative3));
|
|
33754
33855
|
} catch {
|
|
33755
33856
|
continue;
|
|
33756
33857
|
}
|
|
33757
|
-
const digest = (0,
|
|
33858
|
+
const digest = (0, import_node_crypto12.createHash)("md5").update(bytes).digest("hex");
|
|
33758
33859
|
if (!byContent.has(digest)) byContent.set(digest, relative3);
|
|
33759
33860
|
}
|
|
33760
33861
|
return [...byContent.values()];
|
|
@@ -33782,13 +33883,13 @@ function placeMetroDescriptor(listing, descriptor) {
|
|
|
33782
33883
|
let bytes;
|
|
33783
33884
|
try {
|
|
33784
33885
|
bytes = combination.map(
|
|
33785
|
-
(relative3) => (0,
|
|
33886
|
+
(relative3) => (0, import_node_fs26.readFileSync)((0, import_node_path27.join)(listing.directory, relative3))
|
|
33786
33887
|
);
|
|
33787
33888
|
} catch {
|
|
33788
33889
|
continue;
|
|
33789
33890
|
}
|
|
33790
33891
|
const identical = fileHashes ? bytes.every((file, index) => {
|
|
33791
|
-
const digest = (0,
|
|
33892
|
+
const digest = (0, import_node_crypto12.createHash)("md5").update(file).digest("hex");
|
|
33792
33893
|
return descriptor.scales.some(
|
|
33793
33894
|
(scale, declared) => scale === scales[index] && fileHashes[declared] === digest
|
|
33794
33895
|
);
|
|
@@ -33810,10 +33911,10 @@ function unverifiedContentKey(dest, fileDigests) {
|
|
|
33810
33911
|
return JSON.stringify(
|
|
33811
33912
|
dest.placements.map(
|
|
33812
33913
|
(placement) => placement.verified ? null : [...placement.files].map(([scale, relative3]) => {
|
|
33813
|
-
const file = (0,
|
|
33914
|
+
const file = (0, import_node_path27.join)(dest.directory, relative3);
|
|
33814
33915
|
let digest = fileDigests.get(file);
|
|
33815
33916
|
if (digest === void 0) {
|
|
33816
|
-
digest = (0,
|
|
33917
|
+
digest = (0, import_node_crypto12.createHash)("sha256").update((0, import_node_fs26.readFileSync)(file)).digest("hex");
|
|
33817
33918
|
fileDigests.set(file, digest);
|
|
33818
33919
|
}
|
|
33819
33920
|
return [scale, digest];
|
|
@@ -33822,22 +33923,22 @@ function unverifiedContentKey(dest, fileDigests) {
|
|
|
33822
33923
|
);
|
|
33823
33924
|
}
|
|
33824
33925
|
function searchMetroAssetDest(bundlePath, descriptors) {
|
|
33825
|
-
const bundleDirectory = (0,
|
|
33926
|
+
const bundleDirectory = (0, import_node_path27.dirname)((0, import_node_path27.resolve)(bundlePath));
|
|
33826
33927
|
const candidates = [
|
|
33827
|
-
(0,
|
|
33928
|
+
(0, import_node_path27.join)(bundleDirectory, "assets"),
|
|
33828
33929
|
bundleDirectory,
|
|
33829
|
-
(0,
|
|
33930
|
+
(0, import_node_path27.resolve)(bundleDirectory, "..", "assets")
|
|
33830
33931
|
];
|
|
33831
33932
|
const cwd = process.cwd();
|
|
33832
33933
|
let projectDirectory = null;
|
|
33833
33934
|
for (const start of [bundleDirectory, cwd]) {
|
|
33834
|
-
let directory = (0,
|
|
33935
|
+
let directory = (0, import_node_path27.resolve)(start);
|
|
33835
33936
|
while (true) {
|
|
33836
33937
|
if (detectProject(directory)?.hasMetroConfig) {
|
|
33837
33938
|
projectDirectory = directory;
|
|
33838
33939
|
break;
|
|
33839
33940
|
}
|
|
33840
|
-
const parent = (0,
|
|
33941
|
+
const parent = (0, import_node_path27.dirname)(directory);
|
|
33841
33942
|
if (parent === directory) break;
|
|
33842
33943
|
directory = parent;
|
|
33843
33944
|
}
|
|
@@ -33845,11 +33946,11 @@ function searchMetroAssetDest(bundlePath, descriptors) {
|
|
|
33845
33946
|
}
|
|
33846
33947
|
if (projectDirectory) {
|
|
33847
33948
|
candidates.push(
|
|
33848
|
-
(0,
|
|
33849
|
-
(0,
|
|
33850
|
-
(0,
|
|
33851
|
-
(0,
|
|
33852
|
-
(0,
|
|
33949
|
+
(0, import_node_path27.join)(projectDirectory, "assets"),
|
|
33950
|
+
(0, import_node_path27.join)(projectDirectory, "dist"),
|
|
33951
|
+
(0, import_node_path27.join)(projectDirectory, "dist", "assets"),
|
|
33952
|
+
(0, import_node_path27.join)(projectDirectory, "build"),
|
|
33953
|
+
(0, import_node_path27.join)(projectDirectory, "build", "assets")
|
|
33853
33954
|
);
|
|
33854
33955
|
}
|
|
33855
33956
|
const searched = [];
|
|
@@ -33857,7 +33958,7 @@ function searchMetroAssetDest(bundlePath, descriptors) {
|
|
|
33857
33958
|
const stale = [];
|
|
33858
33959
|
let truncated = false;
|
|
33859
33960
|
for (const candidate of candidates) {
|
|
33860
|
-
const directory = (0,
|
|
33961
|
+
const directory = (0, import_node_path27.resolve)(candidate);
|
|
33861
33962
|
if (searched.includes(directory)) continue;
|
|
33862
33963
|
searched.push(directory);
|
|
33863
33964
|
const listing = listMetroAssetDest(directory);
|
|
@@ -33966,7 +34067,7 @@ async function embedBundleAssets(bundlePath, command, assetPolicy) {
|
|
|
33966
34067
|
);
|
|
33967
34068
|
}
|
|
33968
34069
|
const relative3 = placement?.files.get(variant.scale);
|
|
33969
|
-
if (relative3 && dest) return (0,
|
|
34070
|
+
if (relative3 && dest) return (0, import_node_fs26.readFileSync)((0, import_node_path27.join)(dest.directory, relative3));
|
|
33970
34071
|
if (placement && placement.files.size > 0) return null;
|
|
33971
34072
|
if (placement && placement.ambiguous.length > 0 && dest) {
|
|
33972
34073
|
throw new Error(
|
|
@@ -33995,7 +34096,7 @@ async function embedBundleAssets(bundlePath, command, assetPolicy) {
|
|
|
33995
34096
|
);
|
|
33996
34097
|
const classic = metroIosAssetDestRelatives(variant.descriptor.httpServerLocation, filename)[0] ?? filename;
|
|
33997
34098
|
throw new Error(
|
|
33998
|
-
`${command} could not read ${(0,
|
|
34099
|
+
`${command} could not read ${(0, import_node_path27.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\`.`
|
|
33999
34100
|
);
|
|
34000
34101
|
});
|
|
34001
34102
|
return {
|
|
@@ -34036,7 +34137,7 @@ async function produceArtifact(bundlePath, maxBytes, command, assetPolicy) {
|
|
|
34036
34137
|
}
|
|
34037
34138
|
return {
|
|
34038
34139
|
bytes,
|
|
34039
|
-
sha256: (0,
|
|
34140
|
+
sha256: (0, import_node_crypto12.createHash)("sha256").update(bytes).digest("hex"),
|
|
34040
34141
|
receipt: artifact.receipt,
|
|
34041
34142
|
assetsDirectory: prepared.dest?.directory ?? null,
|
|
34042
34143
|
warnings
|
|
@@ -34181,13 +34282,13 @@ function createCloudBridgeForParsed(parsed) {
|
|
|
34181
34282
|
if (!session) return null;
|
|
34182
34283
|
return session.service === "box" ? new CloudBoxBridge(session) : new CloudBridge(session);
|
|
34183
34284
|
}
|
|
34184
|
-
var
|
|
34285
|
+
var import_node_crypto12, import_node_fs26, import_node_path27, 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;
|
|
34185
34286
|
var init_cloud_client = __esm({
|
|
34186
34287
|
"cli/cloud-client.ts"() {
|
|
34187
34288
|
"use strict";
|
|
34188
|
-
|
|
34189
|
-
|
|
34190
|
-
|
|
34289
|
+
import_node_crypto12 = require("node:crypto");
|
|
34290
|
+
import_node_fs26 = require("node:fs");
|
|
34291
|
+
import_node_path27 = require("node:path");
|
|
34191
34292
|
init_metroAssetArtifact();
|
|
34192
34293
|
init_metroCloudArtifact();
|
|
34193
34294
|
init_metro_fingerprint_registry_client();
|
|
@@ -34227,7 +34328,7 @@ var init_cloud_client = __esm({
|
|
|
34227
34328
|
plane = "cloud";
|
|
34228
34329
|
async send(command, options) {
|
|
34229
34330
|
const body = {
|
|
34230
|
-
id: (0,
|
|
34331
|
+
id: (0, import_node_crypto12.randomUUID)(),
|
|
34231
34332
|
claimId: this.session.claimId,
|
|
34232
34333
|
command: cloudCommand(command)
|
|
34233
34334
|
};
|
|
@@ -34297,7 +34398,7 @@ var init_cloud_client = __esm({
|
|
|
34297
34398
|
}
|
|
34298
34399
|
plane = "cloud";
|
|
34299
34400
|
async send(command, options) {
|
|
34300
|
-
const id = (0,
|
|
34401
|
+
const id = (0, import_node_crypto12.randomUUID)();
|
|
34301
34402
|
const payload = {};
|
|
34302
34403
|
for (const [key, value] of Object.entries(command)) {
|
|
34303
34404
|
if (key !== "id" && key !== "simId") payload[key] = value;
|
|
@@ -36699,31 +36800,31 @@ var init_parent_pid = __esm({
|
|
|
36699
36800
|
|
|
36700
36801
|
// cli/secure-file.ts
|
|
36701
36802
|
function writeSecureJsonAtomic(filepath, value) {
|
|
36702
|
-
(0,
|
|
36703
|
-
const temporary = `${filepath}.tmp-${process.pid}-${(0,
|
|
36803
|
+
(0, import_node_fs27.mkdirSync)((0, import_node_path28.dirname)(filepath), { recursive: true });
|
|
36804
|
+
const temporary = `${filepath}.tmp-${process.pid}-${(0, import_node_crypto13.randomUUID)()}`;
|
|
36704
36805
|
let descriptor = null;
|
|
36705
36806
|
try {
|
|
36706
|
-
descriptor = (0,
|
|
36707
|
-
(0,
|
|
36708
|
-
(0,
|
|
36807
|
+
descriptor = (0, import_node_fs27.openSync)(temporary, "wx", 384);
|
|
36808
|
+
(0, import_node_fs27.fchmodSync)(descriptor, 384);
|
|
36809
|
+
(0, import_node_fs27.writeFileSync)(descriptor, `${JSON.stringify(value, null, 2)}
|
|
36709
36810
|
`);
|
|
36710
|
-
(0,
|
|
36711
|
-
(0,
|
|
36811
|
+
(0, import_node_fs27.fsyncSync)(descriptor);
|
|
36812
|
+
(0, import_node_fs27.closeSync)(descriptor);
|
|
36712
36813
|
descriptor = null;
|
|
36713
|
-
(0,
|
|
36814
|
+
(0, import_node_fs27.renameSync)(temporary, filepath);
|
|
36714
36815
|
} catch (error) {
|
|
36715
|
-
if (descriptor !== null) (0,
|
|
36716
|
-
(0,
|
|
36816
|
+
if (descriptor !== null) (0, import_node_fs27.closeSync)(descriptor);
|
|
36817
|
+
(0, import_node_fs27.rmSync)(temporary, { force: true });
|
|
36717
36818
|
throw error;
|
|
36718
36819
|
}
|
|
36719
36820
|
}
|
|
36720
|
-
var
|
|
36821
|
+
var import_node_crypto13, import_node_fs27, import_node_path28;
|
|
36721
36822
|
var init_secure_file = __esm({
|
|
36722
36823
|
"cli/secure-file.ts"() {
|
|
36723
36824
|
"use strict";
|
|
36724
|
-
|
|
36725
|
-
|
|
36726
|
-
|
|
36825
|
+
import_node_crypto13 = require("node:crypto");
|
|
36826
|
+
import_node_fs27 = require("node:fs");
|
|
36827
|
+
import_node_path28 = require("node:path");
|
|
36727
36828
|
}
|
|
36728
36829
|
});
|
|
36729
36830
|
|
|
@@ -36908,17 +37009,17 @@ function liveDevBridgeLockfiles() {
|
|
|
36908
37009
|
return readDevBridgeLockfiles().filter((lockfile) => isDevBridgeLockfileFresh(lockfile));
|
|
36909
37010
|
}
|
|
36910
37011
|
function checkoutRoot(cwd) {
|
|
36911
|
-
let current =
|
|
37012
|
+
let current = import_node_path29.default.resolve(cwd);
|
|
36912
37013
|
while (true) {
|
|
36913
|
-
if (
|
|
36914
|
-
const parent =
|
|
37014
|
+
if (import_node_fs28.default.existsSync(import_node_path29.default.join(current, ".git"))) return current;
|
|
37015
|
+
const parent = import_node_path29.default.dirname(current);
|
|
36915
37016
|
if (parent === current) return null;
|
|
36916
37017
|
current = parent;
|
|
36917
37018
|
}
|
|
36918
37019
|
}
|
|
36919
37020
|
function pathContains(parent, child) {
|
|
36920
|
-
const relative3 =
|
|
36921
|
-
return relative3 === "" || relative3 !== ".." && !relative3.startsWith(`..${
|
|
37021
|
+
const relative3 = import_node_path29.default.relative(parent, child);
|
|
37022
|
+
return relative3 === "" || relative3 !== ".." && !relative3.startsWith(`..${import_node_path29.default.sep}`) && !import_node_path29.default.isAbsolute(relative3);
|
|
36922
37023
|
}
|
|
36923
37024
|
function resolveDefaultDevBridgeLockfile() {
|
|
36924
37025
|
const lockfiles = liveDevBridgeLockfiles();
|
|
@@ -37418,18 +37519,18 @@ async function evalInBridge(bridge, code, opts = {}) {
|
|
|
37418
37519
|
if (opts.acquireLock) payload.acquireLock = true;
|
|
37419
37520
|
return bridge.send(payload);
|
|
37420
37521
|
}
|
|
37421
|
-
async function callInBridge(bridge,
|
|
37422
|
-
return bridge.send({ type: "call", path:
|
|
37522
|
+
async function callInBridge(bridge, path35, ...args) {
|
|
37523
|
+
return bridge.send({ type: "call", path: path35, args });
|
|
37423
37524
|
}
|
|
37424
|
-
async function callInBridgeWrite(bridge,
|
|
37425
|
-
return bridge.send({ type: "call", path:
|
|
37525
|
+
async function callInBridgeWrite(bridge, path35, ...args) {
|
|
37526
|
+
return bridge.send({ type: "call", path: path35, args, acquireLock: true });
|
|
37426
37527
|
}
|
|
37427
|
-
var
|
|
37528
|
+
var import_node_fs28, import_node_path29, import_ws2, PEACH_PLACEMENT_ENV, resolvedWorld, BridgeSimLockedError, BRIDGE_VALUE_FLAGS_TABLE, BRIDGE_VALUE_FLAGS;
|
|
37428
37529
|
var init_ws_bridge = __esm({
|
|
37429
37530
|
"cli/ws-bridge.ts"() {
|
|
37430
37531
|
"use strict";
|
|
37431
|
-
|
|
37432
|
-
|
|
37532
|
+
import_node_fs28 = __toESM(require("node:fs"), 1);
|
|
37533
|
+
import_node_path29 = __toESM(require("node:path"), 1);
|
|
37433
37534
|
import_ws2 = require("ws");
|
|
37434
37535
|
init_bridge_constants();
|
|
37435
37536
|
init_cli_constants();
|
|
@@ -37557,8 +37658,8 @@ function getDefaultPortForProtocol(protocol) {
|
|
|
37557
37658
|
return protocol === "https:" ? 443 : 80;
|
|
37558
37659
|
}
|
|
37559
37660
|
function isBaseServerUrl(url) {
|
|
37560
|
-
const
|
|
37561
|
-
return (
|
|
37661
|
+
const path35 = url.pathname || "/";
|
|
37662
|
+
return (path35 === "/" || path35 === "") && !url.search && !url.hash;
|
|
37562
37663
|
}
|
|
37563
37664
|
async function resolvePortViaServerScan(port) {
|
|
37564
37665
|
try {
|
|
@@ -37722,8 +37823,8 @@ var init_dev_bundle_resolution = __esm({
|
|
|
37722
37823
|
|
|
37723
37824
|
// src/dot-env.ts
|
|
37724
37825
|
function selectEnvFile(env, notices) {
|
|
37725
|
-
if (
|
|
37726
|
-
return { name:
|
|
37826
|
+
if (import_node_fs29.default.existsSync("/tmp/envfile")) {
|
|
37827
|
+
return { name: import_node_fs29.default.readFileSync("/tmp/envfile", "utf8").trim(), fromEnvfile: false };
|
|
37727
37828
|
}
|
|
37728
37829
|
const requested = env.ENVFILE;
|
|
37729
37830
|
if (!requested) return { name: DEFAULT_ENV_FILE, fromEnvfile: false };
|
|
@@ -37786,16 +37887,16 @@ function readProjectDotEnv(envsRoot, env = process.env) {
|
|
|
37786
37887
|
const notices = [];
|
|
37787
37888
|
const selection = selectEnvFile(env, notices);
|
|
37788
37889
|
const requestedPaths = [
|
|
37789
|
-
|
|
37790
|
-
|
|
37890
|
+
import_node_path30.default.resolve(import_node_path30.default.join(envsRoot, selection.name)),
|
|
37891
|
+
import_node_path30.default.resolve(selection.name)
|
|
37791
37892
|
];
|
|
37792
37893
|
const candidates = [
|
|
37793
37894
|
...requestedPaths,
|
|
37794
|
-
|
|
37895
|
+
import_node_path30.default.resolve(import_node_path30.default.join(envsRoot, DEFAULT_ENV_FILE))
|
|
37795
37896
|
];
|
|
37796
|
-
if (!
|
|
37897
|
+
if (!import_node_fs29.default.existsSync(candidates[2])) candidates.push(import_node_path30.default.resolve(DEFAULT_ENV_FILE));
|
|
37797
37898
|
const tried = [...new Set(candidates)];
|
|
37798
|
-
const resolved = tried.find((candidate) =>
|
|
37899
|
+
const resolved = tried.find((candidate) => import_node_fs29.default.existsSync(candidate));
|
|
37799
37900
|
if (!resolved) {
|
|
37800
37901
|
notices.push(
|
|
37801
37902
|
"*** Missing .env file ****",
|
|
@@ -37815,7 +37916,7 @@ function readProjectDotEnv(envsRoot, env = process.env) {
|
|
|
37815
37916
|
);
|
|
37816
37917
|
}
|
|
37817
37918
|
const config = {};
|
|
37818
|
-
for (const line of
|
|
37919
|
+
for (const line of import_node_fs29.default.readFileSync(resolved, "utf8").split("\n")) {
|
|
37819
37920
|
if (!line.trim()) continue;
|
|
37820
37921
|
if (/^[ \t\n\v\f\r]*#/.test(line)) continue;
|
|
37821
37922
|
const match = DOTENV_PATTERN.exec(line);
|
|
@@ -37825,12 +37926,12 @@ function readProjectDotEnv(envsRoot, env = process.env) {
|
|
|
37825
37926
|
}
|
|
37826
37927
|
return { config, notices };
|
|
37827
37928
|
}
|
|
37828
|
-
var
|
|
37929
|
+
var import_node_fs29, import_node_path30, DEFAULT_ENV_FILE, DOTENV_PATTERN, BUILD_SETTING_PATTERN, INVALID_ENTRY;
|
|
37829
37930
|
var init_dot_env = __esm({
|
|
37830
37931
|
"src/dot-env.ts"() {
|
|
37831
37932
|
"use strict";
|
|
37832
|
-
|
|
37833
|
-
|
|
37933
|
+
import_node_fs29 = __toESM(require("node:fs"), 1);
|
|
37934
|
+
import_node_path30 = __toESM(require("node:path"), 1);
|
|
37834
37935
|
DEFAULT_ENV_FILE = ".env";
|
|
37835
37936
|
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;
|
|
37836
37937
|
BUILD_SETTING_PATTERN = /\$[({]([A-Za-z_][A-Za-z0-9_]*)[)}]|\$([A-Za-z_][A-Za-z0-9_]*)/g;
|
|
@@ -37854,8 +37955,8 @@ var init_flow_timeout_scale = __esm({
|
|
|
37854
37955
|
function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
37855
37956
|
const result = {};
|
|
37856
37957
|
let config = {};
|
|
37857
|
-
const appJsonPath =
|
|
37858
|
-
const appJson =
|
|
37958
|
+
const appJsonPath = import_node_path31.default.join(projectRoot, "app.json");
|
|
37959
|
+
const appJson = import_node_fs30.default.existsSync(appJsonPath) ? JSON.parse(import_node_fs30.default.readFileSync(appJsonPath, "utf8")) : null;
|
|
37859
37960
|
const staticExpo = isRecord(appJson) && (isRecord(appJson.expo) || [appJson.ios, appJson.android].some(
|
|
37860
37961
|
(value) => isRecord(value) && typeof value.googleServicesFile === "string"
|
|
37861
37962
|
));
|
|
@@ -37864,9 +37965,9 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
37864
37965
|
"app.config.ts",
|
|
37865
37966
|
"app.config.cjs",
|
|
37866
37967
|
"app.config.mjs"
|
|
37867
|
-
].some((name2) =>
|
|
37968
|
+
].some((name2) => import_node_fs30.default.existsSync(import_node_path31.default.join(projectRoot, name2)));
|
|
37868
37969
|
if (staticExpo || dynamicExpo) {
|
|
37869
|
-
const require5 = (0, import_node_module2.createRequire)(
|
|
37970
|
+
const require5 = (0, import_node_module2.createRequire)(import_node_path31.default.join(projectRoot, "package.json"));
|
|
37870
37971
|
const configModule = require5("@expo/config");
|
|
37871
37972
|
if (!isRecord(configModule) || typeof configModule.getConfig !== "function")
|
|
37872
37973
|
throw new Error("Expo native configuration is unavailable.");
|
|
@@ -37878,23 +37979,23 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
37878
37979
|
}
|
|
37879
37980
|
const ios = config.ios;
|
|
37880
37981
|
if (platforms.includes("ios") && (!isRecord(ios) || typeof ios.googleServicesFile !== "string")) {
|
|
37881
|
-
const iosRoot =
|
|
37882
|
-
if (
|
|
37883
|
-
const projects2 =
|
|
37982
|
+
const iosRoot = import_node_path31.default.join(projectRoot, "ios");
|
|
37983
|
+
if (import_node_fs30.default.existsSync(iosRoot)) {
|
|
37984
|
+
const projects2 = import_node_fs30.default.readdirSync(iosRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory() && entry.name.endsWith(".xcodeproj"));
|
|
37884
37985
|
if (projects2.length > 1)
|
|
37885
37986
|
throw new Error("native Firebase configuration requires a selected Xcode project");
|
|
37886
37987
|
if (projects2.length === 1) {
|
|
37887
|
-
const xcodeproj =
|
|
37988
|
+
const xcodeproj = import_node_path31.default.join(iosRoot, projects2[0].name);
|
|
37888
37989
|
const appTargets = listXcodeAppTargets(xcodeproj);
|
|
37889
37990
|
if (appTargets.length > 1)
|
|
37890
37991
|
throw new Error("native Firebase configuration requires a selected app target");
|
|
37891
37992
|
if (appTargets.length === 1) {
|
|
37892
37993
|
const app = readXcodeAppTarget(xcodeproj, appTargets[0]);
|
|
37893
37994
|
const delegates = app.allSources.filter(
|
|
37894
|
-
(file) => /^AppDelegate\.(swift|mm|m)$/.test(
|
|
37995
|
+
(file) => /^AppDelegate\.(swift|mm|m)$/.test(import_node_path31.default.basename(file))
|
|
37895
37996
|
);
|
|
37896
37997
|
const defaultConfigured = delegates.some((file) => {
|
|
37897
|
-
const source =
|
|
37998
|
+
const source = import_node_fs30.default.readFileSync(file, "utf8").replace(
|
|
37898
37999
|
/\/\*[\s\S]*?\*\/|\/\/[^\n]*|"(?:\\.|[^"\\])*"/g,
|
|
37899
38000
|
(token) => token.startsWith('"') ? '""' : token.replace(/[^\n]/g, " ")
|
|
37900
38001
|
);
|
|
@@ -37922,15 +38023,15 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
37922
38023
|
});
|
|
37923
38024
|
if (defaultConfigured) {
|
|
37924
38025
|
const resources = app.resources.filter(
|
|
37925
|
-
(file) => /^GoogleService-Info\.plist$/.test(
|
|
38026
|
+
(file) => /^GoogleService-Info\.plist$/.test(import_node_path31.default.basename(file))
|
|
37926
38027
|
);
|
|
37927
38028
|
if (resources.length !== 1)
|
|
37928
38029
|
throw new Error(
|
|
37929
38030
|
"native Firebase default initialization requires one GoogleService-Info.plist build resource"
|
|
37930
38031
|
);
|
|
37931
38032
|
config.ios = {
|
|
37932
|
-
googleServicesFile:
|
|
37933
|
-
|
|
38033
|
+
googleServicesFile: import_node_path31.default.relative(
|
|
38034
|
+
import_node_fs30.default.realpathSync(projectRoot),
|
|
37934
38035
|
resources[0]
|
|
37935
38036
|
)
|
|
37936
38037
|
};
|
|
@@ -37943,8 +38044,8 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
37943
38044
|
const native = config[platform];
|
|
37944
38045
|
if (!isRecord(native) || typeof native.googleServicesFile !== "string") continue;
|
|
37945
38046
|
try {
|
|
37946
|
-
const source =
|
|
37947
|
-
|
|
38047
|
+
const source = import_node_fs30.default.readFileSync(
|
|
38048
|
+
import_node_path31.default.resolve(projectRoot, native.googleServicesFile),
|
|
37948
38049
|
"utf8"
|
|
37949
38050
|
);
|
|
37950
38051
|
const parsed = platform === "ios" ? parsePlistSource(source) : JSON.parse(source);
|
|
@@ -37996,13 +38097,13 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
37996
38097
|
}
|
|
37997
38098
|
return result;
|
|
37998
38099
|
}
|
|
37999
|
-
var
|
|
38100
|
+
var import_node_fs30, import_node_module2, import_node_path31;
|
|
38000
38101
|
var init_native_firebase_config = __esm({
|
|
38001
38102
|
"src/native-firebase-config.ts"() {
|
|
38002
38103
|
"use strict";
|
|
38003
|
-
|
|
38104
|
+
import_node_fs30 = __toESM(require("node:fs"), 1);
|
|
38004
38105
|
import_node_module2 = require("node:module");
|
|
38005
|
-
|
|
38106
|
+
import_node_path31 = __toESM(require("node:path"), 1);
|
|
38006
38107
|
init_is_record();
|
|
38007
38108
|
init_plist();
|
|
38008
38109
|
init_xcode_project();
|
|
@@ -38116,59 +38217,59 @@ var init_profiles = __esm({
|
|
|
38116
38217
|
// cli/app-catalog.ts
|
|
38117
38218
|
function listDir(dir) {
|
|
38118
38219
|
try {
|
|
38119
|
-
return
|
|
38220
|
+
return import_node_fs31.default.readdirSync(dir, { withFileTypes: true });
|
|
38120
38221
|
} catch {
|
|
38121
38222
|
return [];
|
|
38122
38223
|
}
|
|
38123
38224
|
}
|
|
38124
38225
|
function readText(file) {
|
|
38125
38226
|
try {
|
|
38126
|
-
return
|
|
38227
|
+
return import_node_fs31.default.readFileSync(file, "utf8");
|
|
38127
38228
|
} catch {
|
|
38128
38229
|
return null;
|
|
38129
38230
|
}
|
|
38130
38231
|
}
|
|
38131
38232
|
function catalogFiles(dir, found) {
|
|
38132
38233
|
for (const entry of listDir(dir)) {
|
|
38133
|
-
const full =
|
|
38234
|
+
const full = import_node_path32.default.join(dir, entry.name);
|
|
38134
38235
|
if (entry.isDirectory()) catalogFiles(full, found);
|
|
38135
38236
|
else if (entry.name === "Contents.json") found.push(full);
|
|
38136
38237
|
}
|
|
38137
38238
|
}
|
|
38138
38239
|
function discoverAppCatalog(appDir) {
|
|
38139
|
-
const iosDir =
|
|
38240
|
+
const iosDir = import_node_path32.default.join(appDir, "ios");
|
|
38140
38241
|
const target = listDir(iosDir).find(
|
|
38141
|
-
(entry) => entry.isDirectory() && entry.name !== "Pods" && listDir(
|
|
38242
|
+
(entry) => entry.isDirectory() && entry.name !== "Pods" && listDir(import_node_path32.default.join(iosDir, entry.name)).some(
|
|
38142
38243
|
(file) => /^AppDelegate\.(swift|mm|m)$/.test(file.name)
|
|
38143
38244
|
)
|
|
38144
38245
|
);
|
|
38145
38246
|
if (!target) return null;
|
|
38146
|
-
const targetDir =
|
|
38247
|
+
const targetDir = import_node_path32.default.join(iosDir, target.name);
|
|
38147
38248
|
const files = [];
|
|
38148
38249
|
for (const entry of listDir(targetDir)) {
|
|
38149
38250
|
if (entry.isDirectory() && entry.name.endsWith(".xcassets"))
|
|
38150
|
-
catalogFiles(
|
|
38251
|
+
catalogFiles(import_node_path32.default.join(targetDir, entry.name), files);
|
|
38151
38252
|
}
|
|
38152
38253
|
const relative3 = files.map(
|
|
38153
|
-
(file) =>
|
|
38254
|
+
(file) => import_node_path32.default.relative(targetDir, file).split(import_node_path32.default.sep).join(import_node_path32.default.posix.sep)
|
|
38154
38255
|
);
|
|
38155
38256
|
const colors = enumerateBundleColors(
|
|
38156
38257
|
relative3,
|
|
38157
|
-
(candidate) => candidate.endsWith("Contents.json") ? readText(
|
|
38258
|
+
(candidate) => candidate.endsWith("Contents.json") ? readText(import_node_path32.default.join(targetDir, candidate)) : null
|
|
38158
38259
|
);
|
|
38159
38260
|
const pbxproj = listDir(iosDir).find((entry) => entry.name.endsWith(".xcodeproj"));
|
|
38160
|
-
const accentName = readText(
|
|
38261
|
+
const accentName = readText(import_node_path32.default.join(targetDir, "Info.plist"))?.match(PLIST_ACCENT)?.[1] ?? (pbxproj ? readText(import_node_path32.default.join(iosDir, pbxproj.name, "project.pbxproj"))?.match(
|
|
38161
38262
|
ACCENT_BUILD_SETTING
|
|
38162
38263
|
)?.[1] : void 0) ?? null;
|
|
38163
38264
|
if (accentName === null && Object.keys(colors).length === 0) return null;
|
|
38164
38265
|
return { colors, accentName };
|
|
38165
38266
|
}
|
|
38166
|
-
var
|
|
38267
|
+
var import_node_fs31, import_node_path32, ACCENT_BUILD_SETTING, PLIST_ACCENT;
|
|
38167
38268
|
var init_app_catalog = __esm({
|
|
38168
38269
|
"cli/app-catalog.ts"() {
|
|
38169
38270
|
"use strict";
|
|
38170
|
-
|
|
38171
|
-
|
|
38271
|
+
import_node_fs31 = __toESM(require("node:fs"), 1);
|
|
38272
|
+
import_node_path32 = __toESM(require("node:path"), 1);
|
|
38172
38273
|
init_bundleAssets();
|
|
38173
38274
|
ACCENT_BUILD_SETTING = /ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = "?([^";]+)"?;/;
|
|
38174
38275
|
PLIST_ACCENT = /<key>NSAccentColorName<\/key>\s*<string>([^<]+)<\/string>/;
|
|
@@ -38178,9 +38279,9 @@ var init_app_catalog = __esm({
|
|
|
38178
38279
|
// cli/app-project.ts
|
|
38179
38280
|
function firstNamedFile(dir, names) {
|
|
38180
38281
|
for (const name2 of names) {
|
|
38181
|
-
const candidate =
|
|
38282
|
+
const candidate = import_node_path33.default.join(dir, name2);
|
|
38182
38283
|
try {
|
|
38183
|
-
if (
|
|
38284
|
+
if (import_node_fs32.default.statSync(candidate).isFile()) return candidate;
|
|
38184
38285
|
} catch {
|
|
38185
38286
|
}
|
|
38186
38287
|
}
|
|
@@ -38193,24 +38294,24 @@ function findRNXAppConfig(dir) {
|
|
|
38193
38294
|
return firstNamedFile(dir, PEACH_APP_CONFIG_NAMES);
|
|
38194
38295
|
}
|
|
38195
38296
|
function resolveAppProject(projectRoot) {
|
|
38196
|
-
const appDir =
|
|
38297
|
+
const appDir = import_node_path33.default.resolve(projectRoot);
|
|
38197
38298
|
try {
|
|
38198
|
-
if (!
|
|
38299
|
+
if (!import_node_fs32.default.statSync(appDir).isDirectory()) return null;
|
|
38199
38300
|
} catch {
|
|
38200
38301
|
return null;
|
|
38201
38302
|
}
|
|
38202
38303
|
const configPath = findRNXAppConfig(appDir);
|
|
38203
|
-
if (!configPath && !findExpoAppConfig(appDir) && !
|
|
38304
|
+
if (!configPath && !findExpoAppConfig(appDir) && !import_node_fs32.default.existsSync(import_node_path33.default.join(appDir, "package.json"))) {
|
|
38204
38305
|
return null;
|
|
38205
38306
|
}
|
|
38206
38307
|
return { appDir, configPath };
|
|
38207
38308
|
}
|
|
38208
|
-
var
|
|
38309
|
+
var import_node_fs32, import_node_path33, EXPO_APP_CONFIG_NAMES, PEACH_APP_CONFIG_NAMES;
|
|
38209
38310
|
var init_app_project = __esm({
|
|
38210
38311
|
"cli/app-project.ts"() {
|
|
38211
38312
|
"use strict";
|
|
38212
|
-
|
|
38213
|
-
|
|
38313
|
+
import_node_fs32 = __toESM(require("node:fs"), 1);
|
|
38314
|
+
import_node_path33 = __toESM(require("node:path"), 1);
|
|
38214
38315
|
EXPO_APP_CONFIG_NAMES = [
|
|
38215
38316
|
"app.config.js",
|
|
38216
38317
|
"app.config.ts",
|
|
@@ -38233,12 +38334,12 @@ function resolveFileEntries(entries, configDir) {
|
|
|
38233
38334
|
return Object.fromEntries(
|
|
38234
38335
|
Object.entries(entries).map(([name2, resolution]) => [
|
|
38235
38336
|
name2,
|
|
38236
|
-
resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file:
|
|
38337
|
+
resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file: import_node_path34.default.resolve(configDir, resolution.file) } : resolution
|
|
38237
38338
|
])
|
|
38238
38339
|
);
|
|
38239
38340
|
}
|
|
38240
38341
|
function resolveConfigReplacementFiles(config, configPath) {
|
|
38241
|
-
const configDir =
|
|
38342
|
+
const configDir = import_node_path34.default.dirname(configPath);
|
|
38242
38343
|
return {
|
|
38243
38344
|
...config,
|
|
38244
38345
|
modules: resolveFileEntries(config.modules, configDir),
|
|
@@ -38275,12 +38376,12 @@ async function resolveRNXAppConfig(startDir = process.cwd()) {
|
|
|
38275
38376
|
const project = resolveAppProject(startDir);
|
|
38276
38377
|
return { project, config: await loadRNXAppConfig(project) };
|
|
38277
38378
|
}
|
|
38278
|
-
var import_node_module3,
|
|
38379
|
+
var import_node_module3, import_node_path34, import_jiti, require2;
|
|
38279
38380
|
var init_app_config = __esm({
|
|
38280
38381
|
"cli/app-config.ts"() {
|
|
38281
38382
|
"use strict";
|
|
38282
38383
|
import_node_module3 = require("node:module");
|
|
38283
|
-
|
|
38384
|
+
import_node_path34 = __toESM(require("node:path"), 1);
|
|
38284
38385
|
import_jiti = require("jiti");
|
|
38285
38386
|
init_config();
|
|
38286
38387
|
init_public_brand();
|
|
@@ -38337,13 +38438,13 @@ function discoverNativeLinkedAppFonts(opts) {
|
|
|
38337
38438
|
scannedFontDirectories++;
|
|
38338
38439
|
let entries;
|
|
38339
38440
|
try {
|
|
38340
|
-
entries =
|
|
38441
|
+
entries = import_node_fs33.default.readdirSync(current.dir, { withFileTypes: true });
|
|
38341
38442
|
} catch {
|
|
38342
38443
|
continue;
|
|
38343
38444
|
}
|
|
38344
38445
|
for (const entry of entries) {
|
|
38345
38446
|
if (entry.isSymbolicLink()) continue;
|
|
38346
|
-
const fullPath =
|
|
38447
|
+
const fullPath = import_node_path35.default.join(current.dir, entry.name);
|
|
38347
38448
|
if (entry.isDirectory()) {
|
|
38348
38449
|
if (current.depth < 4 && pending.length < 64 && !entry.name.startsWith(".")) {
|
|
38349
38450
|
pending.push({ dir: fullPath, depth: current.depth + 1 });
|
|
@@ -38351,15 +38452,15 @@ function discoverNativeLinkedAppFonts(opts) {
|
|
|
38351
38452
|
continue;
|
|
38352
38453
|
}
|
|
38353
38454
|
if (!entry.isFile() || !/\.(ttf|otf|woff|woff2)$/i.test(entry.name)) continue;
|
|
38354
|
-
const relative3 =
|
|
38355
|
-
fontPaths.push(
|
|
38455
|
+
const relative3 = import_node_path35.default.relative(root, fullPath).split(import_node_path35.default.sep).join("/");
|
|
38456
|
+
fontPaths.push(import_node_path35.default.posix.join(metroPathPrefix, relative3));
|
|
38356
38457
|
if (fontPaths.length >= 256) break;
|
|
38357
38458
|
}
|
|
38358
38459
|
}
|
|
38359
38460
|
};
|
|
38360
38461
|
try {
|
|
38361
38462
|
const packageJson = JSON.parse(
|
|
38362
|
-
|
|
38463
|
+
import_node_fs33.default.readFileSync(import_node_path35.default.join(selectedAppDir, "package.json"), "utf8")
|
|
38363
38464
|
);
|
|
38364
38465
|
const dependencyNames = /* @__PURE__ */ new Set();
|
|
38365
38466
|
for (const field of ["dependencies", "devDependencies", "optionalDependencies"]) {
|
|
@@ -38374,32 +38475,32 @@ function discoverNativeLinkedAppFonts(opts) {
|
|
|
38374
38475
|
const config = Reflect.get(packageJson, "reactNativeVectorIcons");
|
|
38375
38476
|
const configuredFontDir = config && typeof config === "object" ? Reflect.get(config, "fontDir") : null;
|
|
38376
38477
|
const configuredDir = typeof configuredFontDir === "string" ? configuredFontDir : "rnvi-fonts";
|
|
38377
|
-
const root =
|
|
38378
|
-
const relativeRoot =
|
|
38379
|
-
if (!relativeRoot.startsWith("..") && !
|
|
38380
|
-
collectFontFiles(root, relativeRoot.split(
|
|
38478
|
+
const root = import_node_path35.default.resolve(selectedAppDir, configuredDir);
|
|
38479
|
+
const relativeRoot = import_node_path35.default.relative(selectedAppDir, root);
|
|
38480
|
+
if (!relativeRoot.startsWith("..") && !import_node_path35.default.isAbsolute(relativeRoot)) {
|
|
38481
|
+
collectFontFiles(root, relativeRoot.split(import_node_path35.default.sep).join("/"));
|
|
38381
38482
|
}
|
|
38382
|
-
const bundleDir =
|
|
38383
|
-
const appRelativeDir = bundleDir.split("/").join(
|
|
38483
|
+
const bundleDir = import_node_path35.default.posix.dirname(new URL(opts.bundleUrl).pathname).replace(/^\/+/, "");
|
|
38484
|
+
const appRelativeDir = bundleDir.split("/").join(import_node_path35.default.sep);
|
|
38384
38485
|
const metroRootCandidates = [selectedAppDir];
|
|
38385
|
-
if (bundleDir && selectedAppDir.endsWith(
|
|
38486
|
+
if (bundleDir && selectedAppDir.endsWith(import_node_path35.default.sep + appRelativeDir)) {
|
|
38386
38487
|
metroRootCandidates.push(selectedAppDir.slice(0, -appRelativeDir.length - 1));
|
|
38387
38488
|
}
|
|
38388
|
-
const vectorIconRequire = (0, import_node_module4.createRequire)(
|
|
38489
|
+
const vectorIconRequire = (0, import_node_module4.createRequire)(import_node_path35.default.join(selectedAppDir, "package.json"));
|
|
38389
38490
|
for (const dependencyName of vectorIconDependencies) {
|
|
38390
38491
|
try {
|
|
38391
38492
|
const entryPath = vectorIconRequire.resolve(dependencyName);
|
|
38392
|
-
const dependencyPath = dependencyName.split("/").join(
|
|
38393
|
-
const marker = `${
|
|
38493
|
+
const dependencyPath = dependencyName.split("/").join(import_node_path35.default.sep);
|
|
38494
|
+
const marker = `${import_node_path35.default.sep}node_modules${import_node_path35.default.sep}${dependencyPath}${import_node_path35.default.sep}`;
|
|
38394
38495
|
const markerIndex = entryPath.lastIndexOf(marker);
|
|
38395
38496
|
if (markerIndex === -1) continue;
|
|
38396
38497
|
const packageRoot = entryPath.slice(0, markerIndex + marker.length - 1);
|
|
38397
38498
|
const fontsDir = dependencyName === "react-native-vector-icons" ? "Fonts" : "fonts";
|
|
38398
|
-
const fontsRoot =
|
|
38499
|
+
const fontsRoot = import_node_path35.default.join(packageRoot, fontsDir);
|
|
38399
38500
|
for (const metroRoot of metroRootCandidates) {
|
|
38400
38501
|
collectFontFiles(
|
|
38401
38502
|
fontsRoot,
|
|
38402
|
-
|
|
38503
|
+
import_node_path35.default.relative(metroRoot, fontsRoot).split(import_node_path35.default.sep).join("/")
|
|
38403
38504
|
);
|
|
38404
38505
|
}
|
|
38405
38506
|
} catch {
|
|
@@ -38409,37 +38510,37 @@ function discoverNativeLinkedAppFonts(opts) {
|
|
|
38409
38510
|
} catch {
|
|
38410
38511
|
}
|
|
38411
38512
|
try {
|
|
38412
|
-
const configPath =
|
|
38413
|
-
if (
|
|
38414
|
-
const appConfigRequire = (0, import_node_module4.createRequire)(
|
|
38513
|
+
const configPath = import_node_path35.default.join(selectedAppDir, "react-native.config.js");
|
|
38514
|
+
if (import_node_fs33.default.statSync(configPath).isFile()) {
|
|
38515
|
+
const appConfigRequire = (0, import_node_module4.createRequire)(import_node_path35.default.join(selectedAppDir, "package.json"));
|
|
38415
38516
|
const rnConfig = appConfigRequire(configPath);
|
|
38416
38517
|
const assets2 = rnConfig && typeof rnConfig === "object" ? Reflect.get(rnConfig, "assets") : null;
|
|
38417
38518
|
if (Array.isArray(assets2)) {
|
|
38418
38519
|
for (const assetDir of assets2) {
|
|
38419
38520
|
if (typeof assetDir !== "string") continue;
|
|
38420
|
-
const root =
|
|
38421
|
-
const relativeRoot =
|
|
38422
|
-
if (relativeRoot.startsWith("..") ||
|
|
38423
|
-
collectFontFiles(root, relativeRoot.split(
|
|
38521
|
+
const root = import_node_path35.default.resolve(selectedAppDir, assetDir);
|
|
38522
|
+
const relativeRoot = import_node_path35.default.relative(selectedAppDir, root);
|
|
38523
|
+
if (relativeRoot.startsWith("..") || import_node_path35.default.isAbsolute(relativeRoot)) continue;
|
|
38524
|
+
collectFontFiles(root, relativeRoot.split(import_node_path35.default.sep).join("/"));
|
|
38424
38525
|
}
|
|
38425
38526
|
}
|
|
38426
38527
|
}
|
|
38427
38528
|
} catch {
|
|
38428
38529
|
}
|
|
38429
38530
|
if (platform === "ios") {
|
|
38430
|
-
const iosDir =
|
|
38531
|
+
const iosDir = import_node_path35.default.join(selectedAppDir, "ios");
|
|
38431
38532
|
try {
|
|
38432
|
-
const targetDirs =
|
|
38533
|
+
const targetDirs = import_node_fs33.default.readdirSync(iosDir, { withFileTypes: true }).filter(
|
|
38433
38534
|
(entry) => entry.isDirectory() && !entry.isSymbolicLink() && entry.name !== "Pods" && entry.name !== "build" && !entry.name.startsWith(".")
|
|
38434
38535
|
).slice(0, 64);
|
|
38435
|
-
const plistPaths = [
|
|
38536
|
+
const plistPaths = [import_node_path35.default.join(iosDir, "Info.plist")];
|
|
38436
38537
|
for (const entry of targetDirs) {
|
|
38437
|
-
plistPaths.push(
|
|
38538
|
+
plistPaths.push(import_node_path35.default.join(iosDir, entry.name, "Info.plist"));
|
|
38438
38539
|
}
|
|
38439
38540
|
for (const plistPath of plistPaths) {
|
|
38440
38541
|
let parsed;
|
|
38441
38542
|
try {
|
|
38442
|
-
parsed = parsePlistSource(
|
|
38543
|
+
parsed = parsePlistSource(import_node_fs33.default.readFileSync(plistPath, "utf8"));
|
|
38443
38544
|
} catch {
|
|
38444
38545
|
continue;
|
|
38445
38546
|
}
|
|
@@ -38449,21 +38550,21 @@ function discoverNativeLinkedAppFonts(opts) {
|
|
|
38449
38550
|
for (const declaredFont of declaredFonts) {
|
|
38450
38551
|
if (typeof declaredFont !== "string") continue;
|
|
38451
38552
|
const candidates = [
|
|
38452
|
-
|
|
38453
|
-
|
|
38553
|
+
import_node_path35.default.resolve(import_node_path35.default.dirname(plistPath), declaredFont),
|
|
38554
|
+
import_node_path35.default.resolve(iosDir, declaredFont)
|
|
38454
38555
|
];
|
|
38455
38556
|
const fontPath = candidates.find((candidate) => {
|
|
38456
|
-
const relative3 =
|
|
38457
|
-
if (relative3.startsWith("..") ||
|
|
38557
|
+
const relative3 = import_node_path35.default.relative(selectedAppDir, candidate);
|
|
38558
|
+
if (relative3.startsWith("..") || import_node_path35.default.isAbsolute(relative3)) return false;
|
|
38458
38559
|
try {
|
|
38459
|
-
return
|
|
38560
|
+
return import_node_fs33.default.statSync(candidate).isFile();
|
|
38460
38561
|
} catch {
|
|
38461
38562
|
return false;
|
|
38462
38563
|
}
|
|
38463
38564
|
});
|
|
38464
38565
|
if (!fontPath) continue;
|
|
38465
38566
|
fontPaths.push(
|
|
38466
|
-
|
|
38567
|
+
import_node_path35.default.relative(selectedAppDir, fontPath).split(import_node_path35.default.sep).join("/")
|
|
38467
38568
|
);
|
|
38468
38569
|
}
|
|
38469
38570
|
}
|
|
@@ -38505,13 +38606,13 @@ async function resolveMetroProjectRoot(bundleUrl, opts) {
|
|
|
38505
38606
|
function encodeAppFontsWire(specs) {
|
|
38506
38607
|
return specs.map((spec) => `${encodeURIComponent(spec.url)}::${encodeURIComponent(spec.family)}`).join(",");
|
|
38507
38608
|
}
|
|
38508
|
-
var
|
|
38609
|
+
var import_node_fs33, import_node_module4, import_node_path35, import_config_plugin_fonts, require3;
|
|
38509
38610
|
var init_app_fonts = __esm({
|
|
38510
38611
|
"cli/app-fonts.ts"() {
|
|
38511
38612
|
"use strict";
|
|
38512
|
-
|
|
38613
|
+
import_node_fs33 = __toESM(require("node:fs"), 1);
|
|
38513
38614
|
import_node_module4 = require("node:module");
|
|
38514
|
-
|
|
38615
|
+
import_node_path35 = __toESM(require("node:path"), 1);
|
|
38515
38616
|
import_config_plugin_fonts = require("peach-engine/engine/config-plugin-fonts");
|
|
38516
38617
|
init_dev_server_scanner();
|
|
38517
38618
|
init_backend_origin();
|
|
@@ -39441,9 +39542,9 @@ var init_bridge_diagnostics = __esm({
|
|
|
39441
39542
|
|
|
39442
39543
|
// src/desktop-host-delivery.ts
|
|
39443
39544
|
function bundleValue(app, key) {
|
|
39444
|
-
const read = (0,
|
|
39545
|
+
const read = (0, import_node_child_process12.spawnSync)(
|
|
39445
39546
|
"plutil",
|
|
39446
|
-
["-extract", key, "raw", "-o", "-",
|
|
39547
|
+
["-extract", key, "raw", "-o", "-", import_node_path36.default.join(app, "Contents/Info.plist")],
|
|
39447
39548
|
{ encoding: "utf8" }
|
|
39448
39549
|
);
|
|
39449
39550
|
return read.status === 0 ? read.stdout.trim() : null;
|
|
@@ -39457,12 +39558,12 @@ function placedHostVersion() {
|
|
|
39457
39558
|
function activeDesktopHostApp() {
|
|
39458
39559
|
return placedHostVersion() ? MAC_HOST_APP : null;
|
|
39459
39560
|
}
|
|
39460
|
-
var
|
|
39561
|
+
var import_node_child_process12, import_node_path36, MAC_HOST_APP, HOST_BUNDLE_ID;
|
|
39461
39562
|
var init_desktop_host_delivery = __esm({
|
|
39462
39563
|
"src/desktop-host-delivery.ts"() {
|
|
39463
39564
|
"use strict";
|
|
39464
|
-
|
|
39465
|
-
|
|
39565
|
+
import_node_child_process12 = require("node:child_process");
|
|
39566
|
+
import_node_path36 = __toESM(require("node:path"), 1);
|
|
39466
39567
|
init_src();
|
|
39467
39568
|
init_home_paths();
|
|
39468
39569
|
MAC_HOST_APP = "/Applications/Peach.app";
|
|
@@ -40985,7 +41086,7 @@ function linuxBrowserLibsKey(id, arch) {
|
|
|
40985
41086
|
return `linux-libs/${id}/${arch}.tar.gz`;
|
|
40986
41087
|
}
|
|
40987
41088
|
function missingLibraries(executablePath, libraryPath) {
|
|
40988
|
-
const ldd = (0,
|
|
41089
|
+
const ldd = (0, import_node_child_process13.spawnSync)("ldd", [executablePath], {
|
|
40989
41090
|
encoding: "utf8",
|
|
40990
41091
|
timeout: 3e4,
|
|
40991
41092
|
env: libraryPath ? {
|
|
@@ -41009,8 +41110,8 @@ async function ensureLinuxBrowserLibraries(executablePath, browser) {
|
|
|
41009
41110
|
};
|
|
41010
41111
|
}
|
|
41011
41112
|
const lock = parseLinuxBrowserLibsLock(linux_browser_libs_lock_default);
|
|
41012
|
-
const dir = (0,
|
|
41013
|
-
if (!(0,
|
|
41113
|
+
const dir = (0, import_node_path37.join)(rnxHomeDir(), "linux-libs", `${lock.id}-${arch}`);
|
|
41114
|
+
if (!(0, import_node_fs34.existsSync)((0, import_node_path37.join)(dir, LINUX_BROWSER_LIBS_MARKER))) {
|
|
41014
41115
|
const url = `${DEFAULT_CLI_RELEASE_ORIGIN}/${linuxBrowserLibsKey(lock.id, arch)}`;
|
|
41015
41116
|
process.stderr.write(
|
|
41016
41117
|
`peach: this system lacks ${missing.length} shared libraries ${browser} links; downloading them\u2026
|
|
@@ -41038,7 +41139,7 @@ async function ensureLinuxBrowserLibraries(executablePath, browser) {
|
|
|
41038
41139
|
};
|
|
41039
41140
|
}
|
|
41040
41141
|
}
|
|
41041
|
-
const libraryPath = [(0,
|
|
41142
|
+
const libraryPath = [(0, import_node_path37.join)(dir, "lib"), (0, import_node_path37.join)(dir, "lib", "nss")].join(":");
|
|
41042
41143
|
const stillMissing = missingLibraries(executablePath, libraryPath);
|
|
41043
41144
|
if (stillMissing.length) {
|
|
41044
41145
|
return {
|
|
@@ -41048,13 +41149,13 @@ async function ensureLinuxBrowserLibraries(executablePath, browser) {
|
|
|
41048
41149
|
}
|
|
41049
41150
|
return { ok: true, libraryPath };
|
|
41050
41151
|
}
|
|
41051
|
-
var
|
|
41152
|
+
var import_node_child_process13, import_node_fs34, import_node_path37, LINUX_BROWSER_LIBS_ARCHES, LINUX_BROWSER_LIBS_MARKER;
|
|
41052
41153
|
var init_linux_browser_libs = __esm({
|
|
41053
41154
|
"cli/drivers/linux-browser-libs.ts"() {
|
|
41054
41155
|
"use strict";
|
|
41055
|
-
|
|
41056
|
-
|
|
41057
|
-
|
|
41156
|
+
import_node_child_process13 = require("node:child_process");
|
|
41157
|
+
import_node_fs34 = require("node:fs");
|
|
41158
|
+
import_node_path37 = require("node:path");
|
|
41058
41159
|
init_src();
|
|
41059
41160
|
init_home_paths();
|
|
41060
41161
|
init_is_record();
|
|
@@ -41078,13 +41179,13 @@ function resolvePlaywright() {
|
|
|
41078
41179
|
try {
|
|
41079
41180
|
const modulePath = requireFromRoot.resolve(spec);
|
|
41080
41181
|
const packageJsonPath = requireFromRoot.resolve(`${spec}/package.json`);
|
|
41081
|
-
const parsed = JSON.parse((0,
|
|
41182
|
+
const parsed = JSON.parse((0, import_node_fs35.readFileSync)(packageJsonPath, "utf8"));
|
|
41082
41183
|
if (!isRecord(parsed) || typeof parsed.version !== "string") continue;
|
|
41083
41184
|
const corePackagePath = (0, import_node_module6.createRequire)(modulePath).resolve(
|
|
41084
41185
|
"playwright-core/package.json"
|
|
41085
41186
|
);
|
|
41086
|
-
const cliPath = (0,
|
|
41087
|
-
if (!(0,
|
|
41187
|
+
const cliPath = (0, import_node_path38.join)((0, import_node_path38.dirname)(corePackagePath), "cli.js");
|
|
41188
|
+
if (!(0, import_node_fs35.existsSync)(cliPath)) continue;
|
|
41088
41189
|
return {
|
|
41089
41190
|
spec,
|
|
41090
41191
|
modulePath,
|
|
@@ -41112,7 +41213,7 @@ async function provisionPlaywright() {
|
|
|
41112
41213
|
await installVerifiedTarball({
|
|
41113
41214
|
url: `https://registry.npmjs.org/playwright-core/-/playwright-core-${version}.tgz`,
|
|
41114
41215
|
digest: { algorithm, encoding: "base64", value: digest },
|
|
41115
|
-
destDir: (0,
|
|
41216
|
+
destDir: (0, import_node_path38.join)(playwrightCoreDir(version), "node_modules", "playwright-core"),
|
|
41116
41217
|
installedMarker: "package.json",
|
|
41117
41218
|
// npm tarballs hold the package under a leading `package/`
|
|
41118
41219
|
stripComponents: 1,
|
|
@@ -41128,7 +41229,7 @@ async function provisionPlaywright() {
|
|
|
41128
41229
|
}
|
|
41129
41230
|
function probeBrowser(resolved, env) {
|
|
41130
41231
|
const self = rnxSelfInvocation();
|
|
41131
|
-
const probe2 = (0,
|
|
41232
|
+
const probe2 = (0, import_node_child_process14.spawnSync)(
|
|
41132
41233
|
self.executable,
|
|
41133
41234
|
[...self.prefixArgs, RNX_INTERNAL_COMMAND, RNX_INTERNAL_CHILDREN.playwrightProbe],
|
|
41134
41235
|
{
|
|
@@ -41155,7 +41256,7 @@ function probeBrowser(resolved, env) {
|
|
|
41155
41256
|
return {
|
|
41156
41257
|
ok: true,
|
|
41157
41258
|
executablePath: parsed.executablePath,
|
|
41158
|
-
exists: parsed.exists && (0,
|
|
41259
|
+
exists: parsed.exists && (0, import_node_fs35.existsSync)(parsed.executablePath)
|
|
41159
41260
|
};
|
|
41160
41261
|
} catch (error) {
|
|
41161
41262
|
return {
|
|
@@ -41181,7 +41282,7 @@ async function ensurePlaywrightBrowser(resolved, headless, env = process.env) {
|
|
|
41181
41282
|
};
|
|
41182
41283
|
}
|
|
41183
41284
|
const installer = rnxSelfInvocation();
|
|
41184
|
-
const install = (0,
|
|
41285
|
+
const install = (0, import_node_child_process14.spawnSync)(
|
|
41185
41286
|
installer.executable,
|
|
41186
41287
|
[
|
|
41187
41288
|
...installer.prefixArgs,
|
|
@@ -41223,14 +41324,14 @@ ${detail}` : ""}`
|
|
|
41223
41324
|
libraryPath: libraries.libraryPath
|
|
41224
41325
|
};
|
|
41225
41326
|
}
|
|
41226
|
-
var
|
|
41327
|
+
var import_node_child_process14, import_node_fs35, import_node_module6, import_node_path38;
|
|
41227
41328
|
var init_playwright_provisioning = __esm({
|
|
41228
41329
|
"cli/drivers/playwright-provisioning.ts"() {
|
|
41229
41330
|
"use strict";
|
|
41230
|
-
|
|
41231
|
-
|
|
41331
|
+
import_node_child_process14 = require("node:child_process");
|
|
41332
|
+
import_node_fs35 = require("node:fs");
|
|
41232
41333
|
import_node_module6 = require("node:module");
|
|
41233
|
-
|
|
41334
|
+
import_node_path38 = require("node:path");
|
|
41234
41335
|
init_src();
|
|
41235
41336
|
init_home_paths();
|
|
41236
41337
|
init_is_record();
|
|
@@ -41617,7 +41718,7 @@ var init_parse_args = __esm({
|
|
|
41617
41718
|
// cli/telemetry.ts
|
|
41618
41719
|
function sanitizeDiagnosticMessage(value) {
|
|
41619
41720
|
const firstLine = value.slice(0, 2048).split(/[\r\n\u2028\u2029]/, 1)[0] ?? "";
|
|
41620
|
-
return firstLine.split((0,
|
|
41721
|
+
return firstLine.split((0, import_node_os8.homedir)()).join("<home>").replace(
|
|
41621
41722
|
/<package:(?:@[\w.-]+\/)?[\w.-]+>|(?:https?:\/\/|file:\/\/|[A-Za-z]:[\\/]|<home>[\\/]|\/|\.{1,2}[\\/]|\b[\w.-]+[\\/])(?:[^\s"'<>]|\s(?=[^"'<>]*[\\/]))+/g,
|
|
41622
41723
|
(location2) => {
|
|
41623
41724
|
if (location2.startsWith("<package:")) return location2;
|
|
@@ -41644,11 +41745,11 @@ function trackCliDiagnostic(diagnostic) {
|
|
|
41644
41745
|
if (queue.some((queued) => JSON.stringify(queued) === JSON.stringify(entry))) return;
|
|
41645
41746
|
queue.push(entry);
|
|
41646
41747
|
}
|
|
41647
|
-
var
|
|
41748
|
+
var import_node_os8, import_crash_fingerprint, observedRuntimeVersion, queue, CRASH_REPORT_EVERY_MS;
|
|
41648
41749
|
var init_telemetry = __esm({
|
|
41649
41750
|
"cli/telemetry.ts"() {
|
|
41650
41751
|
"use strict";
|
|
41651
|
-
|
|
41752
|
+
import_node_os8 = require("node:os");
|
|
41652
41753
|
import_crash_fingerprint = require("peach-engine/crash-fingerprint");
|
|
41653
41754
|
init_cli_version();
|
|
41654
41755
|
init_home_paths();
|
|
@@ -41714,12 +41815,12 @@ var init_runtime_diagnostics = __esm({
|
|
|
41714
41815
|
// cli/commands/skills.ts
|
|
41715
41816
|
function getSkillsDir() {
|
|
41716
41817
|
if (typeof __PEACH_BUNDLED_SKILLS__ !== "undefined") {
|
|
41717
|
-
const dir =
|
|
41818
|
+
const dir = path31.join(rnxHomeDir(), "skills", getCliVersion());
|
|
41718
41819
|
for (const [file, body] of Object.entries(__PEACH_BUNDLED_SKILLS__)) {
|
|
41719
|
-
const target =
|
|
41720
|
-
if (
|
|
41721
|
-
|
|
41722
|
-
|
|
41820
|
+
const target = path31.join(dir, file);
|
|
41821
|
+
if (fs26.existsSync(target)) continue;
|
|
41822
|
+
fs26.mkdirSync(path31.dirname(target), { recursive: true });
|
|
41823
|
+
fs26.writeFileSync(target, body);
|
|
41723
41824
|
}
|
|
41724
41825
|
return dir;
|
|
41725
41826
|
}
|
|
@@ -41727,10 +41828,10 @@ function getSkillsDir() {
|
|
|
41727
41828
|
const pkgPath = (0, import_url3.fileURLToPath)(
|
|
41728
41829
|
import_meta4.resolve(`${rnxPublicBrand.packageName}/package.json`)
|
|
41729
41830
|
);
|
|
41730
|
-
return primaryCheckoutPath(
|
|
41831
|
+
return primaryCheckoutPath(path31.join(path31.dirname(pkgPath), "skills"));
|
|
41731
41832
|
} catch {
|
|
41732
|
-
const __dirname =
|
|
41733
|
-
return primaryCheckoutPath(
|
|
41833
|
+
const __dirname = path31.dirname((0, import_url3.fileURLToPath)(__sootsim_import_meta_url));
|
|
41834
|
+
return primaryCheckoutPath(path31.resolve(__dirname, "../../skills"));
|
|
41734
41835
|
}
|
|
41735
41836
|
}
|
|
41736
41837
|
function primaryCheckoutPath(dir) {
|
|
@@ -41753,17 +41854,17 @@ function primaryCheckoutPath(dir) {
|
|
|
41753
41854
|
} catch {
|
|
41754
41855
|
return dir;
|
|
41755
41856
|
}
|
|
41756
|
-
if (
|
|
41757
|
-
const primary =
|
|
41758
|
-
return
|
|
41857
|
+
if (path31.basename(common) !== ".git") return dir;
|
|
41858
|
+
const primary = path31.join(path31.dirname(common), path31.relative(top, dir));
|
|
41859
|
+
return fs26.existsSync(primary) ? primary : dir;
|
|
41759
41860
|
}
|
|
41760
41861
|
function skillsDir() {
|
|
41761
41862
|
skillsDirPath ??= getSkillsDir();
|
|
41762
41863
|
return skillsDirPath;
|
|
41763
41864
|
}
|
|
41764
41865
|
function targetFromHome(envName, fallbackDir) {
|
|
41765
|
-
const home = process.env[envName] ||
|
|
41766
|
-
return
|
|
41866
|
+
const home = process.env[envName] || path31.join(os7.homedir(), fallbackDir);
|
|
41867
|
+
return path31.join(home, "skills");
|
|
41767
41868
|
}
|
|
41768
41869
|
function defaultAgentTargets() {
|
|
41769
41870
|
return [
|
|
@@ -41776,7 +41877,7 @@ function hasInstalledPeachSkills() {
|
|
|
41776
41877
|
(file) => /^([^/]+)\/SKILL\.md$/.exec(file)?.[1] ?? []
|
|
41777
41878
|
) : listSkills().map((skill7) => skill7.name);
|
|
41778
41879
|
return defaultAgentTargets().some(
|
|
41779
|
-
({ dir }) => names.some((name2) =>
|
|
41880
|
+
({ dir }) => names.some((name2) => fs26.existsSync(path31.join(dir, name2, "SKILL.md")))
|
|
41780
41881
|
);
|
|
41781
41882
|
}
|
|
41782
41883
|
function parseSkillFrontmatter(content) {
|
|
@@ -41819,26 +41920,26 @@ function readFrontmatterField(frontmatter, field) {
|
|
|
41819
41920
|
return null;
|
|
41820
41921
|
}
|
|
41821
41922
|
function listSkills() {
|
|
41822
|
-
if (!
|
|
41923
|
+
if (!fs26.existsSync(skillsDir())) return [];
|
|
41823
41924
|
const skills = [];
|
|
41824
|
-
for (const entry of
|
|
41825
|
-
const skillMd =
|
|
41826
|
-
if (!
|
|
41827
|
-
const meta = parseSkillFrontmatter(
|
|
41925
|
+
for (const entry of fs26.readdirSync(skillsDir())) {
|
|
41926
|
+
const skillMd = path31.join(skillsDir(), entry, "SKILL.md");
|
|
41927
|
+
if (!fs26.existsSync(skillMd)) continue;
|
|
41928
|
+
const meta = parseSkillFrontmatter(fs26.readFileSync(skillMd, "utf8"));
|
|
41828
41929
|
if (meta) {
|
|
41829
41930
|
skills.push({ name: entry, description: meta.description });
|
|
41830
41931
|
}
|
|
41831
41932
|
}
|
|
41832
41933
|
return skills.sort((a, b) => a.name.localeCompare(b.name));
|
|
41833
41934
|
}
|
|
41834
|
-
var import_child_process7,
|
|
41935
|
+
var import_child_process7, fs26, os7, path31, import_url3, import_meta4, skillsDirPath;
|
|
41835
41936
|
var init_skills = __esm({
|
|
41836
41937
|
"cli/commands/skills.ts"() {
|
|
41837
41938
|
"use strict";
|
|
41838
41939
|
import_child_process7 = require("child_process");
|
|
41839
|
-
|
|
41840
|
-
|
|
41841
|
-
|
|
41940
|
+
fs26 = __toESM(require("fs"), 1);
|
|
41941
|
+
os7 = __toESM(require("os"), 1);
|
|
41942
|
+
path31 = __toESM(require("path"), 1);
|
|
41842
41943
|
import_url3 = require("url");
|
|
41843
41944
|
init_cli_version();
|
|
41844
41945
|
init_home_paths();
|
|
@@ -42325,14 +42426,14 @@ function assertExplicitBridgeLock(preferredPort, explicitPort, lock) {
|
|
|
42325
42426
|
async function ensureRuntimeForOpen() {
|
|
42326
42427
|
if (resolveDevCheckoutRuntimeRoot()) return;
|
|
42327
42428
|
const active = readActiveRuntime();
|
|
42328
|
-
if (active &&
|
|
42429
|
+
if (active && import_node_fs36.default.existsSync(runtimeDir(active))) return;
|
|
42329
42430
|
console.error(" installing peach engine runtime...");
|
|
42330
42431
|
const { runRuntime: runRuntime2 } = await Promise.resolve().then(() => (init_runtime(), runtime_exports));
|
|
42331
42432
|
await runRuntime2(["install"], {});
|
|
42332
42433
|
}
|
|
42333
42434
|
function spawnSootsim(args) {
|
|
42334
42435
|
const { executable, prefixArgs } = rnxSelfInvocation();
|
|
42335
|
-
return (0,
|
|
42436
|
+
return (0, import_node_child_process15.spawn)(executable, [...prefixArgs, ...args], {
|
|
42336
42437
|
detached: true,
|
|
42337
42438
|
stdio: "ignore",
|
|
42338
42439
|
env: process.env
|
|
@@ -42479,10 +42580,10 @@ async function buildResolvedBundleOpenUrl(target, baseUrl, opts = {}) {
|
|
|
42479
42580
|
}
|
|
42480
42581
|
function normalizeReplacementPath(filePath) {
|
|
42481
42582
|
if (filePath.startsWith("~/")) {
|
|
42482
|
-
return
|
|
42583
|
+
return import_node_path39.default.join(import_node_os9.default.homedir(), filePath.slice(2));
|
|
42483
42584
|
}
|
|
42484
|
-
if (
|
|
42485
|
-
return
|
|
42585
|
+
if (import_node_path39.default.isAbsolute(filePath)) return filePath;
|
|
42586
|
+
return import_node_path39.default.resolve(process.cwd(), filePath);
|
|
42486
42587
|
}
|
|
42487
42588
|
function parseOpenRuntimeConfig(args) {
|
|
42488
42589
|
const modules = {};
|
|
@@ -42501,7 +42602,7 @@ function parseOpenRuntimeConfig(args) {
|
|
|
42501
42602
|
}
|
|
42502
42603
|
const moduleName = raw2.slice(0, eqIndex).trim();
|
|
42503
42604
|
const filePath = normalizeReplacementPath(raw2.slice(eqIndex + 1).trim());
|
|
42504
|
-
if (!
|
|
42605
|
+
if (!import_node_fs36.default.existsSync(filePath)) {
|
|
42505
42606
|
console.error(` peach open: replacement file not found: ${filePath}`);
|
|
42506
42607
|
rnxExit(1);
|
|
42507
42608
|
}
|
|
@@ -42532,7 +42633,7 @@ async function resolveAppProjectForBundleUrl(bundleUrl) {
|
|
|
42532
42633
|
return advertisedRoot ? resolveAppProject(advertisedRoot) : null;
|
|
42533
42634
|
}
|
|
42534
42635
|
async function ensureConfiguredRuntime(version) {
|
|
42535
|
-
if (
|
|
42636
|
+
if (import_node_fs36.default.existsSync(import_node_path39.default.join(runtimeDir(version), "index.html"))) return;
|
|
42536
42637
|
console.error(` installing configured engine runtime ${version}...`);
|
|
42537
42638
|
const result = await rnxRuntime.install({
|
|
42538
42639
|
version,
|
|
@@ -42868,7 +42969,7 @@ function playwrightHostPidForSim(sim) {
|
|
|
42868
42969
|
function signalDriverLaunchConnected(result) {
|
|
42869
42970
|
if (!result.connectAckFile) return false;
|
|
42870
42971
|
try {
|
|
42871
|
-
|
|
42972
|
+
import_node_fs36.default.writeFileSync(
|
|
42872
42973
|
result.connectAckFile,
|
|
42873
42974
|
`${JSON.stringify({ connectedAt: Date.now(), pid: result.pid ?? null })}
|
|
42874
42975
|
`,
|
|
@@ -42882,7 +42983,7 @@ function signalDriverLaunchConnected(result) {
|
|
|
42882
42983
|
function readUnservedUrl(result) {
|
|
42883
42984
|
if (!result.diagnosticLogPath) return null;
|
|
42884
42985
|
try {
|
|
42885
|
-
const detail =
|
|
42986
|
+
const detail = import_node_fs36.default.readFileSync(result.diagnosticLogPath, "utf8");
|
|
42886
42987
|
const match = detail.match(/\[unserved\] nothing serves (\S+)/);
|
|
42887
42988
|
return match ? match[1] : null;
|
|
42888
42989
|
} catch {
|
|
@@ -42892,19 +42993,19 @@ function readUnservedUrl(result) {
|
|
|
42892
42993
|
function printDriverDiagnosticLogTail(result) {
|
|
42893
42994
|
if (!result.diagnosticLogPath) return;
|
|
42894
42995
|
try {
|
|
42895
|
-
const detail =
|
|
42996
|
+
const detail = import_node_fs36.default.readFileSync(result.diagnosticLogPath, "utf8").trim();
|
|
42896
42997
|
if (!detail) {
|
|
42897
|
-
console.error(` ${
|
|
42998
|
+
console.error(` ${import_node_path39.default.basename(result.diagnosticLogPath)} was empty`);
|
|
42898
42999
|
return;
|
|
42899
43000
|
}
|
|
42900
43001
|
const shown = detail.length > 4e3 ? `\u2026
|
|
42901
43002
|
${detail.slice(-4e3)}` : detail;
|
|
42902
|
-
console.error(` ${
|
|
43003
|
+
console.error(` ${import_node_path39.default.basename(result.diagnosticLogPath)}:`);
|
|
42903
43004
|
console.error(shown);
|
|
42904
43005
|
} catch (err) {
|
|
42905
43006
|
const message = err instanceof Error ? err.message : String(err);
|
|
42906
43007
|
console.error(
|
|
42907
|
-
` failed to read ${
|
|
43008
|
+
` failed to read ${import_node_path39.default.basename(result.diagnosticLogPath)}: ${message}`
|
|
42908
43009
|
);
|
|
42909
43010
|
}
|
|
42910
43011
|
}
|
|
@@ -42925,11 +43026,11 @@ async function waitForProcessExit(pid, timeoutMs = 2500) {
|
|
|
42925
43026
|
return !isProcessAlive2(pid);
|
|
42926
43027
|
}
|
|
42927
43028
|
function isPlaywrightHostProcess(pid) {
|
|
42928
|
-
const plain = (0,
|
|
43029
|
+
const plain = (0, import_node_child_process15.spawnSync)("ps", ["-o", "command=", "-p", String(pid)], {
|
|
42929
43030
|
encoding: "utf8",
|
|
42930
43031
|
stdio: ["ignore", "pipe", "pipe"]
|
|
42931
43032
|
});
|
|
42932
|
-
const withEnv = (0,
|
|
43033
|
+
const withEnv = (0, import_node_child_process15.spawnSync)("ps", ["eww", "-o", "command=", "-p", String(pid)], {
|
|
42933
43034
|
encoding: "utf8",
|
|
42934
43035
|
stdio: ["ignore", "pipe", "pipe"]
|
|
42935
43036
|
});
|
|
@@ -43903,14 +44004,14 @@ async function runCloseCommand(args, opts = {}) {
|
|
|
43903
44004
|
bridge.close();
|
|
43904
44005
|
}
|
|
43905
44006
|
}
|
|
43906
|
-
var
|
|
44007
|
+
var import_node_child_process15, import_node_fs36, import_node_os9, import_node_path39, 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;
|
|
43907
44008
|
var init_control = __esm({
|
|
43908
44009
|
"cli/commands/control.ts"() {
|
|
43909
44010
|
"use strict";
|
|
43910
|
-
|
|
43911
|
-
|
|
43912
|
-
|
|
43913
|
-
|
|
44011
|
+
import_node_child_process15 = require("node:child_process");
|
|
44012
|
+
import_node_fs36 = __toESM(require("node:fs"), 1);
|
|
44013
|
+
import_node_os9 = __toESM(require("node:os"), 1);
|
|
44014
|
+
import_node_path39 = __toESM(require("node:path"), 1);
|
|
43914
44015
|
import_app_catalog_wire = require("peach-engine/engine/app-catalog-wire");
|
|
43915
44016
|
import_devices2 = require("peach-engine/settings/devices");
|
|
43916
44017
|
import_ws4 = require("ws");
|
|
@@ -44825,10 +44926,10 @@ var init_maestro_js = __esm({
|
|
|
44825
44926
|
// evaluates against the env as it stands, then all are defined, so
|
|
44826
44927
|
// `${NAME || 'default'}` keeps a value passed with --env.
|
|
44827
44928
|
defineVariables(env) {
|
|
44828
|
-
const
|
|
44929
|
+
const evaluated2 = Object.entries(env).map(
|
|
44829
44930
|
([key, value]) => [key, this.evaluateStringTemplate(String(value))]
|
|
44830
44931
|
);
|
|
44831
|
-
for (const [key, value] of
|
|
44932
|
+
for (const [key, value] of evaluated2) this.envBinding.set(key, value);
|
|
44832
44933
|
}
|
|
44833
44934
|
setCopiedText(text2) {
|
|
44834
44935
|
this.maestro.copiedText = text2;
|
|
@@ -45333,16 +45434,16 @@ function readRecentShellAppId(state) {
|
|
|
45333
45434
|
}
|
|
45334
45435
|
function resolveProjectRelativeFlowBase(flowDir) {
|
|
45335
45436
|
if (!flowDir) return process.cwd();
|
|
45336
|
-
return
|
|
45437
|
+
return path33.basename(flowDir) === ".maestro" ? path33.dirname(flowDir) : flowDir;
|
|
45337
45438
|
}
|
|
45338
45439
|
function resolveFlowScreenshotPathWithMode(screenshotDir, name2, opts) {
|
|
45339
45440
|
const normalizedName = name2.endsWith(".png") ? name2 : `${name2}.png`;
|
|
45340
|
-
if (
|
|
45441
|
+
if (path33.isAbsolute(normalizedName)) return normalizedName;
|
|
45341
45442
|
if (opts.mode === "flow" && /[\\/]/.test(normalizedName)) {
|
|
45342
45443
|
const baseDir = normalizedName.startsWith("./") || normalizedName.startsWith("../") ? opts.flowDir ?? process.cwd() : resolveProjectRelativeFlowBase(opts.flowDir);
|
|
45343
|
-
return
|
|
45444
|
+
return path33.resolve(baseDir, normalizedName);
|
|
45344
45445
|
}
|
|
45345
|
-
return
|
|
45446
|
+
return path33.join(screenshotDir, normalizedName);
|
|
45346
45447
|
}
|
|
45347
45448
|
function normalizeFlowScreenshotSpec(step) {
|
|
45348
45449
|
if (typeof step === "string") {
|
|
@@ -45396,12 +45497,12 @@ function normalizeBareStringStep(verb) {
|
|
|
45396
45497
|
function parseFlowSteps(content) {
|
|
45397
45498
|
return parseFlowFile(content).steps;
|
|
45398
45499
|
}
|
|
45399
|
-
var
|
|
45500
|
+
var fs29, path33, 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;
|
|
45400
45501
|
var init_bridge_flow_runner = __esm({
|
|
45401
45502
|
"cli/bridge-flow-runner.ts"() {
|
|
45402
45503
|
"use strict";
|
|
45403
|
-
|
|
45404
|
-
|
|
45504
|
+
fs29 = __toESM(require("fs"), 1);
|
|
45505
|
+
path33 = __toESM(require("path"), 1);
|
|
45405
45506
|
import_devices4 = require("peach-engine/settings/devices");
|
|
45406
45507
|
import_proof_frame = __toESM(require_proof_frame(), 1);
|
|
45407
45508
|
init_flow_timeout_scale();
|
|
@@ -45663,19 +45764,19 @@ var init_bridge_flow_runner = __esm({
|
|
|
45663
45764
|
if (typeof value === "string") return value.slice(0, 80);
|
|
45664
45765
|
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
45665
45766
|
if (!value || typeof value !== "object") return void 0;
|
|
45666
|
-
const
|
|
45667
|
-
const direct =
|
|
45767
|
+
const record2 = value;
|
|
45768
|
+
const direct = record2.id ?? record2.text ?? record2.name ?? record2.path;
|
|
45668
45769
|
if (typeof direct === "string" && direct) return direct.slice(0, 80);
|
|
45669
|
-
const awaited =
|
|
45770
|
+
const awaited = record2.visible ?? record2.notVisible ?? record2.element;
|
|
45670
45771
|
if (typeof awaited === "string" && awaited) return awaited.slice(0, 80);
|
|
45671
45772
|
if (awaited && typeof awaited === "object") {
|
|
45672
45773
|
const target = awaited;
|
|
45673
45774
|
const label = target.id ?? target.text;
|
|
45674
45775
|
if (typeof label === "string" && label) return label.slice(0, 80);
|
|
45675
45776
|
}
|
|
45676
|
-
if (
|
|
45677
|
-
if (typeof
|
|
45678
|
-
return `${Math.round(
|
|
45777
|
+
if (record2.point && typeof record2.point === "string") return record2.point.slice(0, 80);
|
|
45778
|
+
if (typeof record2.x === "number" && typeof record2.y === "number") {
|
|
45779
|
+
return `${Math.round(record2.x)}, ${Math.round(record2.y)}`;
|
|
45679
45780
|
}
|
|
45680
45781
|
return void 0;
|
|
45681
45782
|
}
|
|
@@ -45726,14 +45827,14 @@ var init_bridge_flow_runner = __esm({
|
|
|
45726
45827
|
if (chunks.length === 0) {
|
|
45727
45828
|
throw new Error("recording requested but no video buffer was produced");
|
|
45728
45829
|
}
|
|
45729
|
-
|
|
45830
|
+
fs29.mkdirSync(this.opts.recordingOutputDir, { recursive: true });
|
|
45730
45831
|
const videoMime = stopped.mime || this.opts.recordingFormat || "video/webm";
|
|
45731
45832
|
const extension = videoMime.includes("mp4") ? "mp4" : "webm";
|
|
45732
|
-
const outputPath =
|
|
45833
|
+
const outputPath = path33.join(
|
|
45733
45834
|
this.opts.recordingOutputDir,
|
|
45734
45835
|
`peach-${Date.now()}.${extension}`
|
|
45735
45836
|
);
|
|
45736
|
-
|
|
45837
|
+
fs29.writeFileSync(outputPath, Buffer.concat(chunks));
|
|
45737
45838
|
return outputPath;
|
|
45738
45839
|
}
|
|
45739
45840
|
async waitForRecordingTail(opts) {
|
|
@@ -46409,7 +46510,7 @@ var init_bridge_flow_runner = __esm({
|
|
|
46409
46510
|
flowDir: this.opts.flowDir
|
|
46410
46511
|
}
|
|
46411
46512
|
);
|
|
46412
|
-
|
|
46513
|
+
fs29.mkdirSync(path33.dirname(outputPath), { recursive: true });
|
|
46413
46514
|
const layers = spec.layers ?? this.opts.screenshotLayers;
|
|
46414
46515
|
const screenshotRequest = {
|
|
46415
46516
|
type: "screenshot",
|
|
@@ -46444,11 +46545,11 @@ var init_bridge_flow_runner = __esm({
|
|
|
46444
46545
|
throw new Error("could not read current device model for framed screenshot");
|
|
46445
46546
|
}
|
|
46446
46547
|
const framed = await composeFramedScreenshot(rawBuffer, model);
|
|
46447
|
-
|
|
46548
|
+
fs29.writeFileSync(outputPath, framed);
|
|
46448
46549
|
console.log(`[flow] screenshot: ${outputPath} (frame: ${model})`);
|
|
46449
46550
|
return outputPath;
|
|
46450
46551
|
}
|
|
46451
|
-
|
|
46552
|
+
fs29.writeFileSync(outputPath, rawBuffer);
|
|
46452
46553
|
console.log(`[flow] screenshot: ${outputPath}`);
|
|
46453
46554
|
return outputPath;
|
|
46454
46555
|
}
|
|
@@ -46470,10 +46571,10 @@ var init_bridge_flow_runner = __esm({
|
|
|
46470
46571
|
// + a11y tree + console errors/warnings + failed network requests +
|
|
46471
46572
|
// shell state, all under one directory so post-mortem is one grep away.
|
|
46472
46573
|
async captureFailureBundle(outputDir, context) {
|
|
46473
|
-
|
|
46574
|
+
fs29.mkdirSync(outputDir, { recursive: true });
|
|
46474
46575
|
const write = (name2, content) => {
|
|
46475
46576
|
try {
|
|
46476
|
-
|
|
46577
|
+
fs29.writeFileSync(path33.join(outputDir, name2), content);
|
|
46477
46578
|
} catch {
|
|
46478
46579
|
}
|
|
46479
46580
|
};
|
|
@@ -47067,8 +47168,8 @@ var init_bridge_flow_runner = __esm({
|
|
|
47067
47168
|
runScript(target) {
|
|
47068
47169
|
const spec = typeof target === "string" ? { file: target } : target;
|
|
47069
47170
|
if (!spec.file) throw new Error("runScript requires a file");
|
|
47070
|
-
const scriptPath =
|
|
47071
|
-
const source =
|
|
47171
|
+
const scriptPath = path33.resolve(this.opts.flowDir, spec.file);
|
|
47172
|
+
const source = fs29.readFileSync(scriptPath, "utf8");
|
|
47072
47173
|
this.js.evaluate(source, { env: spec.env });
|
|
47073
47174
|
console.log(`[flow] runScript: ${spec.file} done`);
|
|
47074
47175
|
}
|
|
@@ -47428,14 +47529,14 @@ var init_bridge_flow_runner = __esm({
|
|
|
47428
47529
|
for (const [k, v] of Object.entries(env)) this.js.putEnv(k, v);
|
|
47429
47530
|
}
|
|
47430
47531
|
if (file) {
|
|
47431
|
-
const flowPath =
|
|
47432
|
-
const flowContent =
|
|
47532
|
+
const flowPath = path33.resolve(this.opts.flowDir, file);
|
|
47533
|
+
const flowContent = fs29.readFileSync(flowPath, "utf8");
|
|
47433
47534
|
const { frontmatter } = parseFlowFile(flowContent);
|
|
47434
47535
|
if (frontmatter.env && typeof frontmatter.env === "object") {
|
|
47435
47536
|
this.js.defineVariables(frontmatter.env);
|
|
47436
47537
|
}
|
|
47437
47538
|
const previousDir = this.opts.flowDir;
|
|
47438
|
-
this.opts.flowDir =
|
|
47539
|
+
this.opts.flowDir = path33.dirname(flowPath);
|
|
47439
47540
|
try {
|
|
47440
47541
|
await this.runFlow(parseFlowSteps(flowContent));
|
|
47441
47542
|
} finally {
|
|
@@ -47606,8 +47707,8 @@ __export(registry_exports, {
|
|
|
47606
47707
|
skillRegistry: () => skillRegistry
|
|
47607
47708
|
});
|
|
47608
47709
|
module.exports = __toCommonJS(registry_exports);
|
|
47609
|
-
var
|
|
47610
|
-
var
|
|
47710
|
+
var fs30 = __toESM(require("fs"), 1);
|
|
47711
|
+
var path34 = __toESM(require("path"), 1);
|
|
47611
47712
|
|
|
47612
47713
|
// src/skills/builtin/a11y-review.ts
|
|
47613
47714
|
init_reap_browser();
|
|
@@ -47626,8 +47727,8 @@ var skill = {
|
|
|
47626
47727
|
},
|
|
47627
47728
|
async execute(params, context) {
|
|
47628
47729
|
const { chromium } = await import("playwright");
|
|
47629
|
-
const
|
|
47630
|
-
const
|
|
47730
|
+
const path35 = await import("path");
|
|
47731
|
+
const fs31 = await import("fs");
|
|
47631
47732
|
const browser = await launchReapedChrome((options) => chromium.launch(options), {
|
|
47632
47733
|
headless: true
|
|
47633
47734
|
});
|
|
@@ -47684,9 +47785,9 @@ var skill = {
|
|
|
47684
47785
|
warnings: issues.filter((i) => i.severity === "warning").length,
|
|
47685
47786
|
tree: typeof tree === "string" ? tree : JSON.stringify(tree)
|
|
47686
47787
|
};
|
|
47687
|
-
const reportPath =
|
|
47688
|
-
|
|
47689
|
-
|
|
47788
|
+
const reportPath = path35.join(context.outputDir, "a11y-report.json");
|
|
47789
|
+
fs31.mkdirSync(path35.dirname(reportPath), { recursive: true });
|
|
47790
|
+
fs31.writeFileSync(reportPath, JSON.stringify(report, null, 2));
|
|
47690
47791
|
return {
|
|
47691
47792
|
success: issues.filter((i) => i.severity === "error").length === 0,
|
|
47692
47793
|
message: `${report.errors} errors, ${report.warnings} warnings across ${report.nodeCount} nodes`,
|
|
@@ -47719,14 +47820,14 @@ var skill2 = {
|
|
|
47719
47820
|
}
|
|
47720
47821
|
},
|
|
47721
47822
|
async execute(params, context) {
|
|
47722
|
-
const
|
|
47723
|
-
const
|
|
47823
|
+
const fs31 = await import("node:fs");
|
|
47824
|
+
const path35 = await import("node:path");
|
|
47724
47825
|
const { COMPAT_RESULT_CAVEAT: COMPAT_RESULT_CAVEAT2, formatPackageStatus: formatPackageStatus2, formatScanCounts: formatScanCounts2, scanDeps: scanDeps2 } = await Promise.resolve().then(() => (init_web(), web_exports));
|
|
47725
|
-
const packagePath =
|
|
47726
|
-
if (!
|
|
47826
|
+
const packagePath = path35.join(context.projectDir, "package.json");
|
|
47827
|
+
if (!fs31.existsSync(packagePath)) {
|
|
47727
47828
|
return { success: false, message: "No package.json found" };
|
|
47728
47829
|
}
|
|
47729
|
-
const parsed = JSON.parse(
|
|
47830
|
+
const parsed = JSON.parse(fs31.readFileSync(packagePath, "utf8"));
|
|
47730
47831
|
if (!parsed || typeof parsed !== "object") {
|
|
47731
47832
|
return { success: false, message: "package.json is not an object" };
|
|
47732
47833
|
}
|
|
@@ -47738,9 +47839,9 @@ var skill2 = {
|
|
|
47738
47839
|
}) : scanDeps2(parsed);
|
|
47739
47840
|
const packageResult = params.packageName ? scan.packages[0] : void 0;
|
|
47740
47841
|
const message = packageResult ? `${params.packageName}: ${formatPackageStatus2(packageResult)}. ${COMPAT_RESULT_CAVEAT2}` : `${formatScanCounts2(scan)}. ${COMPAT_RESULT_CAVEAT2}`;
|
|
47741
|
-
const reportPath =
|
|
47742
|
-
|
|
47743
|
-
|
|
47842
|
+
const reportPath = path35.join(context.outputDir, "compat-report.json");
|
|
47843
|
+
fs31.mkdirSync(path35.dirname(reportPath), { recursive: true });
|
|
47844
|
+
fs31.writeFileSync(reportPath, `${JSON.stringify(scan, null, 2)}
|
|
47744
47845
|
`);
|
|
47745
47846
|
return {
|
|
47746
47847
|
success: true,
|
|
@@ -47782,8 +47883,8 @@ var skill3 = {
|
|
|
47782
47883
|
record: { type: "boolean", description: "Record video of the flow" }
|
|
47783
47884
|
},
|
|
47784
47885
|
async execute(params, context) {
|
|
47785
|
-
const
|
|
47786
|
-
const
|
|
47886
|
+
const fs31 = await import("fs");
|
|
47887
|
+
const path35 = await import("path");
|
|
47787
47888
|
const yaml2 = await import("yaml");
|
|
47788
47889
|
const { DEFAULT_SOOTSIM_BRIDGE_PORT: DEFAULT_SOOTSIM_BRIDGE_PORT3 } = await Promise.resolve().then(() => (init_bridge_constants(), bridge_constants_exports));
|
|
47789
47890
|
const { SootSimBridgeHost: SootSimBridgeHost2 } = await Promise.resolve().then(() => (init_bridge_host(), bridge_host_exports));
|
|
@@ -47793,7 +47894,7 @@ var skill3 = {
|
|
|
47793
47894
|
const host2 = new SootSimBridgeHost2({ port: DEFAULT_SOOTSIM_BRIDGE_PORT3 });
|
|
47794
47895
|
host2.start({ silent: true });
|
|
47795
47896
|
try {
|
|
47796
|
-
const flowContent =
|
|
47897
|
+
const flowContent = fs31.readFileSync(params.flowPath, "utf8");
|
|
47797
47898
|
const fmMatch = flowContent.match(/^---\n([\s\S]*?)\n---\n?/);
|
|
47798
47899
|
const stepsBody = fmMatch ? flowContent.slice(fmMatch[0].length) : flowContent;
|
|
47799
47900
|
const steps = yaml2.parse(stepsBody);
|
|
@@ -47820,7 +47921,7 @@ var skill3 = {
|
|
|
47820
47921
|
});
|
|
47821
47922
|
const driver = new SootSimBridgeFlowRunner2(bridge, {
|
|
47822
47923
|
screenshotDir: context.outputDir,
|
|
47823
|
-
flowDir:
|
|
47924
|
+
flowDir: path35.dirname(path35.resolve(params.flowPath)),
|
|
47824
47925
|
simId,
|
|
47825
47926
|
recordingOutputDir: params.record ? context.outputDir : void 0
|
|
47826
47927
|
});
|
|
@@ -47842,7 +47943,7 @@ var skill3 = {
|
|
|
47842
47943
|
simId,
|
|
47843
47944
|
videoPath: videoPath || void 0
|
|
47844
47945
|
},
|
|
47845
|
-
artifacts: videoPath ? [{ type: "video", name:
|
|
47946
|
+
artifacts: videoPath ? [{ type: "video", name: path35.basename(videoPath), path: videoPath }] : void 0
|
|
47846
47947
|
};
|
|
47847
47948
|
} finally {
|
|
47848
47949
|
try {
|
|
@@ -47889,8 +47990,8 @@ var skill4 = {
|
|
|
47889
47990
|
},
|
|
47890
47991
|
async execute(params, context) {
|
|
47891
47992
|
const { chromium } = await import("playwright");
|
|
47892
|
-
const
|
|
47893
|
-
const
|
|
47993
|
+
const path35 = await import("path");
|
|
47994
|
+
const fs31 = await import("fs");
|
|
47894
47995
|
const browser = await launchReapedChrome((options) => chromium.launch(options), {
|
|
47895
47996
|
headless: true
|
|
47896
47997
|
});
|
|
@@ -47918,9 +48019,9 @@ var skill4 = {
|
|
|
47918
48019
|
...profile,
|
|
47919
48020
|
fps: syncCount > 0 ? (syncCount / (duration / 1e3)).toFixed(1) : "0"
|
|
47920
48021
|
};
|
|
47921
|
-
const reportPath =
|
|
47922
|
-
|
|
47923
|
-
|
|
48022
|
+
const reportPath = path35.join(context.outputDir, "perf-report.json");
|
|
48023
|
+
fs31.mkdirSync(path35.dirname(reportPath), { recursive: true });
|
|
48024
|
+
fs31.writeFileSync(reportPath, JSON.stringify(report, null, 2));
|
|
47924
48025
|
return {
|
|
47925
48026
|
success: true,
|
|
47926
48027
|
message: `${report.fps} fps, ${profile.avgSyncMs?.toFixed(1)}ms avg sync, ${nodeCount} nodes`,
|
|
@@ -47953,8 +48054,8 @@ var skill5 = {
|
|
|
47953
48054
|
},
|
|
47954
48055
|
async execute(params, context) {
|
|
47955
48056
|
const { chromium } = await import("playwright");
|
|
47956
|
-
const
|
|
47957
|
-
const
|
|
48057
|
+
const path35 = await import("path");
|
|
48058
|
+
const fs31 = await import("fs");
|
|
47958
48059
|
const browser = await launchReapedChrome((options) => chromium.launch(options), {
|
|
47959
48060
|
headless: true
|
|
47960
48061
|
});
|
|
@@ -47962,8 +48063,8 @@ var skill5 = {
|
|
|
47962
48063
|
try {
|
|
47963
48064
|
await page.goto(context.url, { waitUntil: "networkidle" });
|
|
47964
48065
|
await page.waitForTimeout(2e3);
|
|
47965
|
-
const outputPath =
|
|
47966
|
-
|
|
48066
|
+
const outputPath = path35.join(context.outputDir, `${params.name}.png`);
|
|
48067
|
+
fs31.mkdirSync(path35.dirname(outputPath), { recursive: true });
|
|
47967
48068
|
await page.screenshot({ path: outputPath });
|
|
47968
48069
|
return {
|
|
47969
48070
|
success: true,
|
|
@@ -48004,8 +48105,8 @@ var skill6 = {
|
|
|
48004
48105
|
},
|
|
48005
48106
|
async execute(params, context) {
|
|
48006
48107
|
const { chromium } = await import("playwright");
|
|
48007
|
-
const
|
|
48008
|
-
const
|
|
48108
|
+
const path35 = await import("path");
|
|
48109
|
+
const fs31 = await import("fs");
|
|
48009
48110
|
const browser = await launchReapedChrome((options) => chromium.launch(options), {
|
|
48010
48111
|
headless: true
|
|
48011
48112
|
});
|
|
@@ -48013,14 +48114,14 @@ var skill6 = {
|
|
|
48013
48114
|
try {
|
|
48014
48115
|
await page.goto(context.url, { waitUntil: "networkidle" });
|
|
48015
48116
|
await page.waitForTimeout(2e3);
|
|
48016
|
-
const currentPath =
|
|
48017
|
-
|
|
48117
|
+
const currentPath = path35.join(context.outputDir, `${params.name}-current.png`);
|
|
48118
|
+
fs31.mkdirSync(path35.dirname(currentPath), { recursive: true });
|
|
48018
48119
|
await page.screenshot({ path: currentPath });
|
|
48019
48120
|
try {
|
|
48020
48121
|
const { PNG } = await import("pngjs");
|
|
48021
48122
|
const pixelmatch = (await import("pixelmatch")).default;
|
|
48022
|
-
const baseline = PNG.sync.read(
|
|
48023
|
-
const current = PNG.sync.read(
|
|
48123
|
+
const baseline = PNG.sync.read(fs31.readFileSync(params.baseline));
|
|
48124
|
+
const current = PNG.sync.read(fs31.readFileSync(currentPath));
|
|
48024
48125
|
const { width, height } = baseline;
|
|
48025
48126
|
const diff = new PNG({ width, height });
|
|
48026
48127
|
const numDiffPixels = pixelmatch(
|
|
@@ -48031,8 +48132,8 @@ var skill6 = {
|
|
|
48031
48132
|
height,
|
|
48032
48133
|
{ threshold: params.threshold || 0.1 }
|
|
48033
48134
|
);
|
|
48034
|
-
const diffPath =
|
|
48035
|
-
|
|
48135
|
+
const diffPath = path35.join(context.outputDir, `${params.name}-diff.png`);
|
|
48136
|
+
fs31.writeFileSync(diffPath, PNG.sync.write(diff));
|
|
48036
48137
|
const totalPixels = width * height;
|
|
48037
48138
|
const diffPercent = (numDiffPixels / totalPixels * 100).toFixed(2);
|
|
48038
48139
|
return {
|
|
@@ -48096,10 +48197,10 @@ var skillRegistry = {
|
|
|
48096
48197
|
},
|
|
48097
48198
|
// load skills from a project manifest (rnx-skills.json)
|
|
48098
48199
|
async loadFromManifest(projectDir) {
|
|
48099
|
-
const manifestPath =
|
|
48100
|
-
if (!
|
|
48200
|
+
const manifestPath = path34.join(projectDir, "rnx-skills.json");
|
|
48201
|
+
if (!fs30.existsSync(manifestPath)) return;
|
|
48101
48202
|
try {
|
|
48102
|
-
const manifest = JSON.parse(
|
|
48203
|
+
const manifest = JSON.parse(fs30.readFileSync(manifestPath, "utf8"));
|
|
48103
48204
|
if (Array.isArray(manifest.skills)) {
|
|
48104
48205
|
for (const entry of manifest.skills) {
|
|
48105
48206
|
if (typeof entry === "string") {
|
|
@@ -48110,7 +48211,7 @@ var skillRegistry = {
|
|
|
48110
48211
|
}
|
|
48111
48212
|
} else if (entry.file) {
|
|
48112
48213
|
try {
|
|
48113
|
-
const mod = await import(
|
|
48214
|
+
const mod = await import(path34.resolve(projectDir, entry.file));
|
|
48114
48215
|
if (mod.skill) this.register(mod.skill);
|
|
48115
48216
|
} catch {
|
|
48116
48217
|
}
|
|
@@ -48123,10 +48224,10 @@ var skillRegistry = {
|
|
|
48123
48224
|
// auto-discover skills based on project dependencies
|
|
48124
48225
|
suggestSkills(projectDir) {
|
|
48125
48226
|
const suggestions = [];
|
|
48126
|
-
const pkgPath =
|
|
48127
|
-
if (!
|
|
48227
|
+
const pkgPath = path34.join(projectDir, "package.json");
|
|
48228
|
+
if (!fs30.existsSync(pkgPath)) return suggestions;
|
|
48128
48229
|
try {
|
|
48129
|
-
const pkg = JSON.parse(
|
|
48230
|
+
const pkg = JSON.parse(fs30.readFileSync(pkgPath, "utf8"));
|
|
48130
48231
|
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
48131
48232
|
if (deps["detox"] || deps["maestro"]) {
|
|
48132
48233
|
suggestions.push("maestro-test");
|