peachsim 0.1.759 → 0.1.761
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 +888 -735
- 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 +1185 -1026
- package/dist-lib/swift-compile.cjs +66 -8
- package/dist-lib/swift-compile.mjs +66 -8
- 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 +672 -519
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/src/native-seam-manifest.ts +8 -0
- package/src/swift-compile.ts +102 -12
- 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.761 | (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
|
|
|
@@ -21990,14 +21883,72 @@ function withNativeSourceGlue(input, glue) {
|
|
|
21990
21883
|
oneModule: true
|
|
21991
21884
|
};
|
|
21992
21885
|
}
|
|
21993
|
-
function
|
|
21886
|
+
function swiftCondition(text2, available) {
|
|
21887
|
+
const tokens = text2.match(/\w+\s*\([^()]*\)|&&|\|\||!|\(|\)|\w+/g) ?? [];
|
|
21888
|
+
let index = 0;
|
|
21889
|
+
const atom = () => {
|
|
21890
|
+
const token = tokens[index++];
|
|
21891
|
+
if (token === "!") {
|
|
21892
|
+
const value = atom();
|
|
21893
|
+
return value === void 0 ? void 0 : !value;
|
|
21894
|
+
}
|
|
21895
|
+
if (token === "(") {
|
|
21896
|
+
const value = either();
|
|
21897
|
+
index++;
|
|
21898
|
+
return value;
|
|
21899
|
+
}
|
|
21900
|
+
if (token === "true") return true;
|
|
21901
|
+
if (token === "false") return false;
|
|
21902
|
+
const call = /^(\w+)\s*\(\s*([^,()]*?)\s*(?:,[^()]*)?\)$/.exec(token ?? "");
|
|
21903
|
+
if (!call) return void 0;
|
|
21904
|
+
const [, name2, argument] = call;
|
|
21905
|
+
if (name2 === "os") return argument === "iOS" || argument === "WASI";
|
|
21906
|
+
if (name2 === "canImport") return available.has(argument);
|
|
21907
|
+
if (name2 === "targetEnvironment") return false;
|
|
21908
|
+
if (name2 === "arch") return argument === "wasm32";
|
|
21909
|
+
return void 0;
|
|
21910
|
+
};
|
|
21911
|
+
const both = () => {
|
|
21912
|
+
let value = atom();
|
|
21913
|
+
while (tokens[index] === "&&") {
|
|
21914
|
+
index++;
|
|
21915
|
+
const next = atom();
|
|
21916
|
+
value = value === false || next === false ? false : value && next ? true : void 0;
|
|
21917
|
+
}
|
|
21918
|
+
return value;
|
|
21919
|
+
};
|
|
21920
|
+
const either = () => {
|
|
21921
|
+
let value = both();
|
|
21922
|
+
while (tokens[index] === "||") {
|
|
21923
|
+
index++;
|
|
21924
|
+
const next = both();
|
|
21925
|
+
value = value === true || next === true ? true : value === false && next === false ? false : void 0;
|
|
21926
|
+
}
|
|
21927
|
+
return value;
|
|
21928
|
+
};
|
|
21929
|
+
return either();
|
|
21930
|
+
}
|
|
21931
|
+
function swiftImportNames(contents, available) {
|
|
21994
21932
|
const names = [];
|
|
21995
|
-
|
|
21933
|
+
const frames = [];
|
|
21996
21934
|
for (const line of contents.split("\n")) {
|
|
21997
|
-
const directive = /^\s*#(if|endif)\b
|
|
21998
|
-
if (directive
|
|
21999
|
-
|
|
22000
|
-
|
|
21935
|
+
const directive = /^\s*#(if|elseif|else|endif)\b(.*)$/.exec(line);
|
|
21936
|
+
if (directive && available) {
|
|
21937
|
+
const [, kind, rest] = directive;
|
|
21938
|
+
const condition = (rest ?? "").replace(/\/\/.*$/, "").trim();
|
|
21939
|
+
if (kind === "if") {
|
|
21940
|
+
const active = swiftCondition(condition, available);
|
|
21941
|
+
frames.push({ active, taken: active });
|
|
21942
|
+
} else if (kind === "endif") frames.pop();
|
|
21943
|
+
else if (frames.length > 0) {
|
|
21944
|
+
const frame = frames[frames.length - 1];
|
|
21945
|
+
const holds = kind === "else" ? true : swiftCondition(condition, available);
|
|
21946
|
+
frame.active = frame.taken === true ? false : frame.taken === false ? holds : holds && void 0;
|
|
21947
|
+
frame.taken = frame.taken === true || holds === true ? true : frame.taken === false ? holds : void 0;
|
|
21948
|
+
}
|
|
21949
|
+
continue;
|
|
21950
|
+
}
|
|
21951
|
+
if (available && frames.some((frame) => frame.active !== true)) continue;
|
|
22001
21952
|
const name2 = SWIFT_IMPORT.exec(line)?.[1];
|
|
22002
21953
|
if (name2) names.push(name2);
|
|
22003
21954
|
}
|
|
@@ -22041,7 +21992,7 @@ function missingSwiftModules(files, available) {
|
|
|
22041
21992
|
const missing = /* @__PURE__ */ new Map();
|
|
22042
21993
|
for (const [file, contents] of Object.entries(files)) {
|
|
22043
21994
|
if (!file.endsWith(".swift") || file === "Package.swift") continue;
|
|
22044
|
-
for (const name2 of new Set(swiftImportNames(contents,
|
|
21995
|
+
for (const name2 of new Set(swiftImportNames(contents, available))) {
|
|
22045
21996
|
if (available.has(name2)) continue;
|
|
22046
21997
|
missing.set(name2, [...missing.get(name2) ?? [], file]);
|
|
22047
21998
|
}
|
|
@@ -22235,21 +22186,21 @@ function scanObjCExtensionMembers(source, tokens, records) {
|
|
|
22235
22186
|
const masked = swiftCodeMask(source);
|
|
22236
22187
|
const found = /* @__PURE__ */ new Map();
|
|
22237
22188
|
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(
|
|
22189
|
+
for (const record2 of records) {
|
|
22190
|
+
const close = closingBrace(source, tokens, record2.open);
|
|
22191
|
+
const body = masked.slice(record2.open, close);
|
|
22241
22192
|
member.lastIndex = 0;
|
|
22242
22193
|
for (let match = member.exec(body); match; match = member.exec(body)) {
|
|
22243
|
-
const at =
|
|
22194
|
+
const at = record2.open + match.index + match[0].indexOf(match[1]);
|
|
22244
22195
|
let depth = 0;
|
|
22245
22196
|
for (const token of tokens) {
|
|
22246
|
-
if (token <=
|
|
22197
|
+
if (token <= record2.open) continue;
|
|
22247
22198
|
if (token >= at) break;
|
|
22248
22199
|
if (source[token] === "{") depth++;
|
|
22249
22200
|
else if (source[token] === "}") depth--;
|
|
22250
22201
|
}
|
|
22251
22202
|
if (depth > 0) continue;
|
|
22252
|
-
const head = masked.slice(
|
|
22203
|
+
const head = masked.slice(record2.open, at);
|
|
22253
22204
|
const bound = Math.max(
|
|
22254
22205
|
head.lastIndexOf(";"),
|
|
22255
22206
|
head.lastIndexOf("{"),
|
|
@@ -22260,11 +22211,11 @@ function scanObjCExtensionMembers(source, tokens, records) {
|
|
|
22260
22211
|
prefix
|
|
22261
22212
|
))
|
|
22262
22213
|
continue;
|
|
22263
|
-
if (!/@objc\b/.test(prefix) && !/@IBAction\b/.test(prefix) && !
|
|
22214
|
+
if (!/@objc\b/.test(prefix) && !/@IBAction\b/.test(prefix) && !record2.objcMembers)
|
|
22264
22215
|
continue;
|
|
22265
|
-
const members = found.get(
|
|
22216
|
+
const members = found.get(record2.type) ?? /* @__PURE__ */ new Set();
|
|
22266
22217
|
members.add(match[2]);
|
|
22267
|
-
found.set(
|
|
22218
|
+
found.set(record2.type, members);
|
|
22268
22219
|
}
|
|
22269
22220
|
}
|
|
22270
22221
|
return found;
|
|
@@ -23860,8 +23811,8 @@ function pickImagesetFile(images) {
|
|
|
23860
23811
|
scale: pick.scale === "2x" ? 2 : pick.scale === "3x" ? 3 : 1
|
|
23861
23812
|
};
|
|
23862
23813
|
}
|
|
23863
|
-
function flatScale(
|
|
23864
|
-
const match = /@([23])x\.[^./]+$/.exec(
|
|
23814
|
+
function flatScale(path35) {
|
|
23815
|
+
const match = /@([23])x\.[^./]+$/.exec(path35);
|
|
23865
23816
|
return match ? Number(match[1]) : 1;
|
|
23866
23817
|
}
|
|
23867
23818
|
function providesNamespace(text2) {
|
|
@@ -23888,13 +23839,13 @@ function catalogEntryName(contentsPath, kind, readText2) {
|
|
|
23888
23839
|
}
|
|
23889
23840
|
return segments.join("/");
|
|
23890
23841
|
}
|
|
23891
|
-
function isFlatResourceImage(
|
|
23892
|
-
return
|
|
23842
|
+
function isFlatResourceImage(path35) {
|
|
23843
|
+
return path35.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path35));
|
|
23893
23844
|
}
|
|
23894
23845
|
function enumerateBundleImages(paths, readText2) {
|
|
23895
23846
|
const table = [];
|
|
23896
23847
|
const seen = /* @__PURE__ */ new Set();
|
|
23897
|
-
const catalogs = paths.filter((
|
|
23848
|
+
const catalogs = paths.filter((path35) => baseOf(path35) === "Contents.json");
|
|
23898
23849
|
for (const contentsPath of catalogs) {
|
|
23899
23850
|
const name2 = catalogEntryName(contentsPath, ".imageset", readText2);
|
|
23900
23851
|
if (name2 === null || seen.has(name2)) continue;
|
|
@@ -23915,12 +23866,12 @@ function enumerateBundleImages(paths, readText2) {
|
|
|
23915
23866
|
seen.add(name2);
|
|
23916
23867
|
table.push({ name: name2, file: `${dir}/${pick.filename}`, scale: pick.scale });
|
|
23917
23868
|
}
|
|
23918
|
-
for (const
|
|
23919
|
-
if (!isFlatResourceImage(
|
|
23920
|
-
const name2 = baseOf(
|
|
23869
|
+
for (const path35 of paths) {
|
|
23870
|
+
if (!isFlatResourceImage(path35)) continue;
|
|
23871
|
+
const name2 = baseOf(path35).slice(0, -extOf(path35).length);
|
|
23921
23872
|
if (name2 === "" || seen.has(name2)) continue;
|
|
23922
23873
|
seen.add(name2);
|
|
23923
|
-
table.push({ name: name2, file:
|
|
23874
|
+
table.push({ name: name2, file: path35, scale: flatScale(path35) });
|
|
23924
23875
|
}
|
|
23925
23876
|
return table;
|
|
23926
23877
|
}
|
|
@@ -23949,7 +23900,7 @@ function colorsetValue(color) {
|
|
|
23949
23900
|
}
|
|
23950
23901
|
function enumerateBundleColors(paths, readText2) {
|
|
23951
23902
|
const table = {};
|
|
23952
|
-
for (const contentsPath of paths.filter((
|
|
23903
|
+
for (const contentsPath of paths.filter((path35) => baseOf(path35) === "Contents.json")) {
|
|
23953
23904
|
const name2 = catalogEntryName(contentsPath, ".colorset", readText2);
|
|
23954
23905
|
if (name2 === null || name2 in table) continue;
|
|
23955
23906
|
let colors;
|
|
@@ -23988,11 +23939,11 @@ function enumerateBundleColors(paths, readText2) {
|
|
|
23988
23939
|
function axisExtremes(points) {
|
|
23989
23940
|
const [a = 0, b = 0, c = 0, d] = points;
|
|
23990
23941
|
const out = [a, d ?? c];
|
|
23991
|
-
const
|
|
23942
|
+
const within2 = (t) => t > 0 && t < 1;
|
|
23992
23943
|
if (d === void 0) {
|
|
23993
23944
|
const denom = a - 2 * b + c;
|
|
23994
23945
|
const t = denom === 0 ? -1 : (a - b) / denom;
|
|
23995
|
-
if (
|
|
23946
|
+
if (within2(t)) out.push((1 - t) ** 2 * a + 2 * (1 - t) * t * b + t ** 2 * c);
|
|
23996
23947
|
return out;
|
|
23997
23948
|
}
|
|
23998
23949
|
const qa = 3 * (-a + 3 * b - 3 * c + d);
|
|
@@ -24004,7 +23955,7 @@ function axisExtremes(points) {
|
|
|
24004
23955
|
const root = Math.sqrt(disc);
|
|
24005
23956
|
return [(-qb + root) / (2 * qa), (-qb - root) / (2 * qa)];
|
|
24006
23957
|
})();
|
|
24007
|
-
for (const t of roots.filter(
|
|
23958
|
+
for (const t of roots.filter(within2))
|
|
24008
23959
|
out.push(
|
|
24009
23960
|
(1 - t) ** 3 * a + 3 * (1 - t) ** 2 * t * b + 3 * (1 - t) * t ** 2 * c + t ** 3 * d
|
|
24010
23961
|
);
|
|
@@ -24013,8 +23964,8 @@ function axisExtremes(points) {
|
|
|
24013
23964
|
function pathBounds(d) {
|
|
24014
23965
|
const xs = [];
|
|
24015
23966
|
const ys = [];
|
|
24016
|
-
for (const
|
|
24017
|
-
(0, import_svgpath.default)(
|
|
23967
|
+
for (const path35 of d)
|
|
23968
|
+
(0, import_svgpath.default)(path35).abs().unshort().unarc().iterate((segment, _index, x, y) => {
|
|
24018
23969
|
const [command, ...args] = segment;
|
|
24019
23970
|
if (command === "M" || command === "L") {
|
|
24020
23971
|
xs.push(Number(args[0]));
|
|
@@ -24041,7 +23992,7 @@ function guide(svg, id, axis) {
|
|
|
24041
23992
|
}
|
|
24042
23993
|
function enumerateBundleSymbols(paths, readText2) {
|
|
24043
23994
|
const table = {};
|
|
24044
|
-
for (const contentsPath of paths.filter((
|
|
23995
|
+
for (const contentsPath of paths.filter((path35) => baseOf(path35) === "Contents.json")) {
|
|
24045
23996
|
const name2 = catalogEntryName(contentsPath, ".symbolset", readText2);
|
|
24046
23997
|
if (name2 === null || name2 in table) continue;
|
|
24047
23998
|
let symbols;
|
|
@@ -24074,8 +24025,8 @@ function enumerateBundleSymbols(paths, readText2) {
|
|
|
24074
24025
|
viewBox: "0 0 24 24",
|
|
24075
24026
|
advance,
|
|
24076
24027
|
box: [12 - advance / 2, 12 - tall / 2, advance, tall],
|
|
24077
|
-
layers: d.map((
|
|
24078
|
-
d: (0, import_svgpath.default)(
|
|
24028
|
+
layers: d.map((path35) => ({
|
|
24029
|
+
d: (0, import_svgpath.default)(path35).abs().scale(scale).translate(translateX, translateY).round(3).toString()
|
|
24079
24030
|
}))
|
|
24080
24031
|
};
|
|
24081
24032
|
}
|
|
@@ -24085,7 +24036,7 @@ function enumerateBundleJson(paths) {
|
|
|
24085
24036
|
const found = [];
|
|
24086
24037
|
const seen = /* @__PURE__ */ new Set();
|
|
24087
24038
|
const ordered = [...paths].filter(
|
|
24088
|
-
(
|
|
24039
|
+
(path35) => path35.split("/").includes("Resources") && path35.split("/").every((segment) => segment !== "" && segment !== "..") && (extOf(path35) === ".json" || extOf(path35) === ".xcstrings")
|
|
24089
24040
|
).sort((a, b) => {
|
|
24090
24041
|
const aDepth = a.split("/").length;
|
|
24091
24042
|
const bDepth = b.split("/").length;
|
|
@@ -24354,9 +24305,226 @@ var init_auth = __esm({
|
|
|
24354
24305
|
}
|
|
24355
24306
|
});
|
|
24356
24307
|
|
|
24357
|
-
// src/swift-
|
|
24308
|
+
// src/swift-package-manifest.ts
|
|
24309
|
+
function swiftCommand() {
|
|
24310
|
+
return process.platform === "darwin" ? { file: "xcrun", args: ["swift"] } : { file: import_node_path13.default.join(swiftToolchainBin(swift_distribution_lock_default.release), "swift"), args: [] };
|
|
24311
|
+
}
|
|
24312
|
+
function dump(dir) {
|
|
24313
|
+
const manifests = import_node_fs13.default.readdirSync(dir).filter((name2) => /^Package(@swift-[\d.]+)?\.swift$/.test(name2)).sort();
|
|
24314
|
+
const command = swiftCommand();
|
|
24315
|
+
const key = (0, import_node_crypto5.createHash)("sha256").update(JSON.stringify([command, import_node_path13.default.resolve(dir)])).update(
|
|
24316
|
+
manifests.map((name2) => `${name2}\0${import_node_fs13.default.readFileSync(import_node_path13.default.join(dir, name2), "utf8")}`).join("\0")
|
|
24317
|
+
).digest("hex").slice(0, 32);
|
|
24318
|
+
const cached4 = import_node_path13.default.join(cacheDir2, `${key}.json`);
|
|
24319
|
+
if (import_node_fs13.default.existsSync(cached4))
|
|
24320
|
+
return { key, raw: record(JSON.parse(import_node_fs13.default.readFileSync(cached4, "utf8"))) };
|
|
24321
|
+
let output;
|
|
24322
|
+
try {
|
|
24323
|
+
output = (0, import_node_child_process7.execFileSync)(
|
|
24324
|
+
command.file,
|
|
24325
|
+
[
|
|
24326
|
+
...command.args,
|
|
24327
|
+
"package",
|
|
24328
|
+
"--package-path",
|
|
24329
|
+
dir,
|
|
24330
|
+
// swiftpm's scratch files never land in the app's own package
|
|
24331
|
+
"--scratch-path",
|
|
24332
|
+
import_node_path13.default.join(cacheDir2, `${key}.build`),
|
|
24333
|
+
"dump-package"
|
|
24334
|
+
],
|
|
24335
|
+
{
|
|
24336
|
+
encoding: "utf8",
|
|
24337
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
24338
|
+
maxBuffer: 64 * 1024 * 1024
|
|
24339
|
+
}
|
|
24340
|
+
);
|
|
24341
|
+
} catch (error) {
|
|
24342
|
+
const stderr = error instanceof Error && "stderr" in error ? String(error.stderr).trim() : "";
|
|
24343
|
+
throw new Error(
|
|
24344
|
+
`swiftpm could not evaluate ${import_node_path13.default.join(dir, "Package.swift")}${stderr ? `: ${stderr}` : ""}`
|
|
24345
|
+
);
|
|
24346
|
+
}
|
|
24347
|
+
import_node_fs13.default.mkdirSync(cacheDir2, { recursive: true });
|
|
24348
|
+
import_node_fs13.default.writeFileSync(cached4, output);
|
|
24349
|
+
return { key, raw: record(JSON.parse(output)) };
|
|
24350
|
+
}
|
|
24351
|
+
function defaultTraits(manifest) {
|
|
24352
|
+
const traits = new Map(
|
|
24353
|
+
array(manifest.traits).map((trait) => [
|
|
24354
|
+
string(record(trait).name) ?? "",
|
|
24355
|
+
array(record(trait).enabledTraits).flatMap((name2) => string(name2) ?? [])
|
|
24356
|
+
])
|
|
24357
|
+
);
|
|
24358
|
+
const enabled = /* @__PURE__ */ new Set();
|
|
24359
|
+
const pending = [...traits.get("default") ?? []];
|
|
24360
|
+
while (pending.length > 0) {
|
|
24361
|
+
const name2 = pending.pop();
|
|
24362
|
+
if (enabled.has(name2)) continue;
|
|
24363
|
+
enabled.add(name2);
|
|
24364
|
+
pending.push(...traits.get(name2) ?? []);
|
|
24365
|
+
}
|
|
24366
|
+
return enabled;
|
|
24367
|
+
}
|
|
24368
|
+
function linksOnIOS(condition, traits) {
|
|
24369
|
+
const { platformNames, traits: needed } = record(condition);
|
|
24370
|
+
const platforms = array(platformNames);
|
|
24371
|
+
if (platforms.length > 0 && !platforms.includes("ios")) return false;
|
|
24372
|
+
const gates = array(needed);
|
|
24373
|
+
return gates.length === 0 || gates.some((name2) => traits.has(string(name2) ?? ""));
|
|
24374
|
+
}
|
|
24375
|
+
function swiftPackageManifest(dir) {
|
|
24376
|
+
dir = import_node_fs13.default.realpathSync(dir);
|
|
24377
|
+
const { key, raw: raw2 } = dump(dir);
|
|
24378
|
+
const known = evaluated.get(key);
|
|
24379
|
+
if (known) return known;
|
|
24380
|
+
const traits = defaultTraits(raw2);
|
|
24381
|
+
const tools = Number(
|
|
24382
|
+
/^(\d+)/.exec(string(record(raw2.toolsVersion)._version) ?? "5")?.[1] ?? 5
|
|
24383
|
+
);
|
|
24384
|
+
const declaredModes = array(raw2.swiftLanguageVersions).flatMap((mode) => {
|
|
24385
|
+
const major = Number(/^(\d+)/.exec(string(mode) ?? "")?.[1]);
|
|
24386
|
+
return Number.isFinite(major) ? [major] : [];
|
|
24387
|
+
});
|
|
24388
|
+
const packageMode = Math.max(
|
|
24389
|
+
5,
|
|
24390
|
+
declaredModes.length > 0 ? Math.max(...declaredModes) : tools >= 6 ? 6 : 5
|
|
24391
|
+
);
|
|
24392
|
+
const packages = /* @__PURE__ */ new Map();
|
|
24393
|
+
for (const entry of array(raw2.dependencies)) {
|
|
24394
|
+
const { sourceControl, fileSystem } = record(entry);
|
|
24395
|
+
const source = record(array(sourceControl ?? fileSystem)[0]);
|
|
24396
|
+
const identity = string(source.identity);
|
|
24397
|
+
if (!identity) continue;
|
|
24398
|
+
const url = string(record(array(record(source.location).remote)[0]).urlString);
|
|
24399
|
+
const local = string(source.path);
|
|
24400
|
+
const value = url ? { url } : local ? { dir: local } : null;
|
|
24401
|
+
if (!value) continue;
|
|
24402
|
+
packages.set(identity, value);
|
|
24403
|
+
const alias = string(source.nameForTargetDependencyResolutionOnly);
|
|
24404
|
+
if (alias) packages.set(alias.toLowerCase(), value);
|
|
24405
|
+
}
|
|
24406
|
+
const products = /* @__PURE__ */ new Map();
|
|
24407
|
+
for (const product of array(raw2.products)) {
|
|
24408
|
+
const { name: name2, targets: targets2, type } = record(product);
|
|
24409
|
+
if (!string(name2) || !("library" in record(type))) continue;
|
|
24410
|
+
products.set(
|
|
24411
|
+
string(name2),
|
|
24412
|
+
array(targets2).flatMap((target) => string(target) ?? [])
|
|
24413
|
+
);
|
|
24414
|
+
}
|
|
24415
|
+
const targets = /* @__PURE__ */ new Map();
|
|
24416
|
+
const names = new Set(array(raw2.targets).map((target) => string(record(target).name)));
|
|
24417
|
+
for (const entry of array(raw2.targets)) {
|
|
24418
|
+
const target = record(entry);
|
|
24419
|
+
const name2 = string(target.name);
|
|
24420
|
+
const kind = string(target.type);
|
|
24421
|
+
if (!name2 || !isTargetType(kind)) continue;
|
|
24422
|
+
const declared = string(target.path);
|
|
24423
|
+
const roots = kind === "test" ? ["Tests"] : ["Sources", "Source", "src", "srcs"];
|
|
24424
|
+
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);
|
|
24425
|
+
const dependencies = [];
|
|
24426
|
+
for (const dependency of array(target.dependencies)) {
|
|
24427
|
+
const { target: local, product, byName } = record(dependency);
|
|
24428
|
+
const payload = array(local ?? product ?? byName);
|
|
24429
|
+
if (!linksOnIOS(payload[payload.length - 1], traits)) continue;
|
|
24430
|
+
const dependencyName = string(payload[0]);
|
|
24431
|
+
if (!dependencyName) continue;
|
|
24432
|
+
if (product)
|
|
24433
|
+
dependencies.push({
|
|
24434
|
+
kind: "product",
|
|
24435
|
+
name: dependencyName,
|
|
24436
|
+
package: (string(payload[1]) ?? "").toLowerCase()
|
|
24437
|
+
});
|
|
24438
|
+
else if (local || names.has(dependencyName))
|
|
24439
|
+
dependencies.push({ kind: "target", name: dependencyName });
|
|
24440
|
+
else
|
|
24441
|
+
dependencies.push({
|
|
24442
|
+
kind: "product",
|
|
24443
|
+
name: dependencyName,
|
|
24444
|
+
package: dependencyName.toLowerCase()
|
|
24445
|
+
});
|
|
24446
|
+
}
|
|
24447
|
+
let languageMode = packageMode;
|
|
24448
|
+
let mainActorIsolation = false;
|
|
24449
|
+
for (const setting of array(target.settings)) {
|
|
24450
|
+
const settingKind = record(record(setting).kind);
|
|
24451
|
+
const mode = string(record(settingKind.swiftLanguageMode)._0);
|
|
24452
|
+
if (mode)
|
|
24453
|
+
languageMode = Math.max(5, Number(/^(\d+)/.exec(mode)?.[1] ?? languageMode));
|
|
24454
|
+
if (string(record(settingKind.defaultIsolation)._0) === "MainActor")
|
|
24455
|
+
mainActorIsolation = true;
|
|
24456
|
+
}
|
|
24457
|
+
targets.set(name2, {
|
|
24458
|
+
name: name2,
|
|
24459
|
+
type: kind,
|
|
24460
|
+
dir: targetDir,
|
|
24461
|
+
sources: target.sources == null ? null : array(target.sources).flatMap((file) => string(file) ?? []),
|
|
24462
|
+
exclude: array(target.exclude).flatMap((file) => string(file) ?? []),
|
|
24463
|
+
dependencies,
|
|
24464
|
+
languageMode,
|
|
24465
|
+
mainActorIsolation,
|
|
24466
|
+
declaresResources: array(target.resources).length > 0
|
|
24467
|
+
});
|
|
24468
|
+
}
|
|
24469
|
+
const manifest = { dir, products, targets, packages };
|
|
24470
|
+
evaluated.set(key, manifest);
|
|
24471
|
+
return manifest;
|
|
24472
|
+
}
|
|
24473
|
+
function walk(dir) {
|
|
24474
|
+
if (!import_node_fs13.default.existsSync(dir)) return [];
|
|
24475
|
+
if (import_node_fs13.default.statSync(dir).isFile()) return [dir];
|
|
24476
|
+
const out = [];
|
|
24477
|
+
for (const entry of import_node_fs13.default.readdirSync(dir, { withFileTypes: true })) {
|
|
24478
|
+
if (entry.name.startsWith(".")) continue;
|
|
24479
|
+
const full = import_node_path13.default.join(dir, entry.name);
|
|
24480
|
+
if (entry.isDirectory()) out.push(...walk(full));
|
|
24481
|
+
else if (entry.isFile()) out.push(full);
|
|
24482
|
+
}
|
|
24483
|
+
return out;
|
|
24484
|
+
}
|
|
24485
|
+
function swiftTargetFiles(manifest, target) {
|
|
24486
|
+
const included = target.sources ? target.sources.map((source) => import_node_path13.default.resolve(target.dir, source)) : [target.dir];
|
|
24487
|
+
const excluded = [
|
|
24488
|
+
...target.exclude.map((file) => import_node_path13.default.resolve(target.dir, file)),
|
|
24489
|
+
...[...manifest.targets.values()].flatMap(
|
|
24490
|
+
(other) => other !== target && within(other.dir, [target.dir]) && other.dir !== target.dir ? [other.dir] : []
|
|
24491
|
+
)
|
|
24492
|
+
];
|
|
24493
|
+
return included.flatMap(walk).filter((file) => !within(file, excluded)).sort();
|
|
24494
|
+
}
|
|
24495
|
+
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;
|
|
24496
|
+
var init_swift_package_manifest = __esm({
|
|
24497
|
+
"src/swift-package-manifest.ts"() {
|
|
24498
|
+
"use strict";
|
|
24499
|
+
import_node_child_process7 = require("node:child_process");
|
|
24500
|
+
import_node_crypto5 = require("node:crypto");
|
|
24501
|
+
import_node_fs13 = __toESM(require("node:fs"), 1);
|
|
24502
|
+
import_node_os5 = __toESM(require("node:os"), 1);
|
|
24503
|
+
import_node_path13 = __toESM(require("node:path"), 1);
|
|
24504
|
+
init_swift_distribution_lock();
|
|
24505
|
+
init_swift_toolchain();
|
|
24506
|
+
TARGET_TYPES = [
|
|
24507
|
+
"regular",
|
|
24508
|
+
"executable",
|
|
24509
|
+
"test",
|
|
24510
|
+
"binary",
|
|
24511
|
+
"system",
|
|
24512
|
+
"macro",
|
|
24513
|
+
"plugin"
|
|
24514
|
+
];
|
|
24515
|
+
isTargetType = (value) => TARGET_TYPES.some((type) => type === value);
|
|
24516
|
+
record = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
24517
|
+
array = (value) => Array.isArray(value) ? value : [];
|
|
24518
|
+
string = (value) => typeof value === "string" ? value : void 0;
|
|
24519
|
+
cacheDir2 = import_node_path13.default.join(import_node_os5.default.tmpdir(), "peach-swift-manifests");
|
|
24520
|
+
evaluated = /* @__PURE__ */ new Map();
|
|
24521
|
+
within = (file, roots) => roots.some((root) => file === root || file.startsWith(`${root}${import_node_path13.default.sep}`));
|
|
24522
|
+
}
|
|
24523
|
+
});
|
|
24524
|
+
|
|
24525
|
+
// src/swift-packages.ts
|
|
24358
24526
|
function readPins(resolved) {
|
|
24359
|
-
const data = JSON.parse(
|
|
24527
|
+
const data = JSON.parse(import_node_fs14.default.readFileSync(resolved, "utf8"));
|
|
24360
24528
|
const pins = data && typeof data === "object" && "pins" in data && Array.isArray(data.pins) ? data.pins : null;
|
|
24361
24529
|
if (!pins)
|
|
24362
24530
|
throw new Error(`${resolved} has no pins; resolve packages in a current Xcode`);
|
|
@@ -24370,35 +24538,24 @@ function readPins(resolved) {
|
|
|
24370
24538
|
}
|
|
24371
24539
|
return out;
|
|
24372
24540
|
}
|
|
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
24541
|
function checkout(checkouts, identity, pin) {
|
|
24385
|
-
const dir =
|
|
24542
|
+
const dir = import_node_path14.default.join(checkouts, identity);
|
|
24386
24543
|
const key = `${dir}\0${pin.revision}`;
|
|
24387
24544
|
if (verified2.has(key)) return dir;
|
|
24388
|
-
const git = (...args) => (0,
|
|
24545
|
+
const git = (...args) => (0, import_node_child_process8.execFileSync)("git", ["-C", dir, ...args], {
|
|
24389
24546
|
encoding: "utf8",
|
|
24390
24547
|
stdio: ["ignore", "pipe", "pipe"]
|
|
24391
24548
|
}).trim();
|
|
24392
|
-
const current =
|
|
24549
|
+
const current = import_node_fs14.default.existsSync(import_node_path14.default.join(dir, ".git")) ? git("rev-parse", "HEAD") : "";
|
|
24393
24550
|
if (current !== pin.revision) {
|
|
24394
|
-
|
|
24395
|
-
|
|
24551
|
+
import_node_fs14.default.rmSync(dir, { recursive: true, force: true });
|
|
24552
|
+
import_node_fs14.default.mkdirSync(dir, { recursive: true });
|
|
24396
24553
|
try {
|
|
24397
24554
|
git("init", "-q");
|
|
24398
24555
|
git("fetch", "-q", "--depth", "1", pin.location, pin.revision);
|
|
24399
24556
|
git("checkout", "-q", "FETCH_HEAD");
|
|
24400
24557
|
} catch (error) {
|
|
24401
|
-
|
|
24558
|
+
import_node_fs14.default.rmSync(dir, { recursive: true, force: true });
|
|
24402
24559
|
const stderr = error instanceof Error && "stderr" in error ? String(error.stderr).trim() : "";
|
|
24403
24560
|
throw new Error(
|
|
24404
24561
|
`could not fetch ${pin.location} at ${pin.revision}${stderr ? `: ${stderr}` : ""}`
|
|
@@ -24408,138 +24565,165 @@ function checkout(checkouts, identity, pin) {
|
|
|
24408
24565
|
verified2.add(key);
|
|
24409
24566
|
return dir;
|
|
24410
24567
|
}
|
|
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");
|
|
24568
|
+
function resolveSwiftPackages(options) {
|
|
24569
|
+
const { rootDir, resolved, products, localDirs } = options;
|
|
24570
|
+
const provided = options.provided ?? /* @__PURE__ */ new Set();
|
|
24571
|
+
const result = {
|
|
24572
|
+
targets: [],
|
|
24573
|
+
unavailable: /* @__PURE__ */ new Map(),
|
|
24574
|
+
modules: /* @__PURE__ */ new Map()
|
|
24575
|
+
};
|
|
24576
|
+
const pins = resolved ? readPins(resolved) : null;
|
|
24577
|
+
const checkouts = import_node_path14.default.join(rootDir, REMOTE_CHECKOUTS);
|
|
24427
24578
|
const packages = /* @__PURE__ */ new Map();
|
|
24428
|
-
const load2 = (
|
|
24429
|
-
const
|
|
24430
|
-
|
|
24431
|
-
|
|
24432
|
-
|
|
24433
|
-
|
|
24434
|
-
|
|
24435
|
-
|
|
24436
|
-
|
|
24579
|
+
const load2 = (source) => {
|
|
24580
|
+
const key = source.kind === "local" ? import_node_path14.default.resolve(source.dir) : source.url;
|
|
24581
|
+
const cached4 = packages.get(key);
|
|
24582
|
+
if (cached4 !== void 0) return cached4;
|
|
24583
|
+
let loaded2;
|
|
24584
|
+
if (source.kind === "local") {
|
|
24585
|
+
loaded2 = { source: key, remote: false, manifest: swiftPackageManifest(key) };
|
|
24586
|
+
} else {
|
|
24587
|
+
const identity = swiftPackageIdentity(source.url);
|
|
24588
|
+
const pin = pins?.get(identity);
|
|
24589
|
+
if (!pin) {
|
|
24590
|
+
loaded2 = pins ? `package ${identity} is not pinned in Package.resolved` : "no Package.resolved pins it; resolve packages in Xcode once";
|
|
24591
|
+
} else {
|
|
24592
|
+
import_node_fs14.default.mkdirSync(checkouts, { recursive: true });
|
|
24593
|
+
import_node_fs14.default.writeFileSync(import_node_path14.default.join(import_node_path14.default.dirname(checkouts), ".gitignore"), "*\n");
|
|
24594
|
+
loaded2 = {
|
|
24595
|
+
source: source.url,
|
|
24596
|
+
remote: true,
|
|
24597
|
+
manifest: swiftPackageManifest(checkout(checkouts, identity, pin))
|
|
24598
|
+
};
|
|
24599
|
+
}
|
|
24600
|
+
}
|
|
24601
|
+
packages.set(key, loaded2);
|
|
24437
24602
|
return loaded2;
|
|
24438
24603
|
};
|
|
24439
24604
|
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}`;
|
|
24605
|
+
const targetOutcomes = /* @__PURE__ */ new Map();
|
|
24606
|
+
const resolveTarget = (pkg, name2) => {
|
|
24607
|
+
const key = `${pkg.manifest.dir}\0${name2}`;
|
|
24608
|
+
if (targetOutcomes.has(key)) return targetOutcomes.get(key);
|
|
24609
|
+
targetOutcomes.set(key, null);
|
|
24610
|
+
const outcome = (() => {
|
|
24611
|
+
if (provided.has(name2)) return null;
|
|
24612
|
+
const target = pkg.manifest.targets.get(name2);
|
|
24613
|
+
if (!target) return `${import_node_path14.default.basename(pkg.manifest.dir)} declares no target ${name2}`;
|
|
24614
|
+
if (target.type === "binary") return `${name2} is a binary framework`;
|
|
24615
|
+
if (target.type === "system") return `${name2} is a system C library`;
|
|
24616
|
+
if (target.type !== "regular") return `${name2} is a ${target.type} target`;
|
|
24617
|
+
const files = swiftTargetFiles(pkg.manifest, target);
|
|
24618
|
+
if (files.some((file) => C_FAMILY.test(file)))
|
|
24619
|
+
return `${name2} is a C or Objective-C target`;
|
|
24620
|
+
for (const dependency of target.dependencies) {
|
|
24621
|
+
if (dependency.kind === "target") {
|
|
24622
|
+
const nested2 = resolveTarget(pkg, dependency.name);
|
|
24623
|
+
if (nested2) return nested2;
|
|
24624
|
+
continue;
|
|
24494
24625
|
}
|
|
24626
|
+
const nested = resolveDependencyProduct(pkg, dependency.package, dependency.name);
|
|
24627
|
+
if (nested) return `${dependency.name}: ${nested}`;
|
|
24495
24628
|
}
|
|
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,
|
|
24629
|
+
const relative3 = files.map((file) => import_node_path14.default.relative(target.dir, file));
|
|
24630
|
+
targets.set(`${pkg.manifest.dir}\0${name2}`, {
|
|
24631
|
+
name: name2,
|
|
24632
|
+
path: "",
|
|
24633
|
+
dir: target.dir,
|
|
24634
|
+
files,
|
|
24635
|
+
packageDir: pkg.manifest.dir,
|
|
24636
|
+
remote: pkg.remote,
|
|
24513
24637
|
executable: false,
|
|
24514
|
-
|
|
24515
|
-
|
|
24638
|
+
languageMode: target.languageMode,
|
|
24639
|
+
mainActorIsolation: target.mainActorIsolation,
|
|
24640
|
+
resources: target.declaresResources || swiftImplicitResourcePaths(relative3).length > 0
|
|
24516
24641
|
});
|
|
24642
|
+
return null;
|
|
24643
|
+
})();
|
|
24644
|
+
targetOutcomes.set(key, outcome);
|
|
24645
|
+
return outcome;
|
|
24646
|
+
};
|
|
24647
|
+
const resolveProduct = (pkg, product) => {
|
|
24648
|
+
if (provided.has(product)) return null;
|
|
24649
|
+
const roots = pkg.manifest.products.get(product);
|
|
24650
|
+
if (!roots) return `${import_node_path14.default.basename(pkg.manifest.dir)} has no library ${product}`;
|
|
24651
|
+
for (const name2 of roots) {
|
|
24652
|
+
const reason = resolveTarget(pkg, name2);
|
|
24653
|
+
if (reason) return reason;
|
|
24517
24654
|
}
|
|
24518
24655
|
return null;
|
|
24519
24656
|
};
|
|
24520
|
-
|
|
24521
|
-
|
|
24522
|
-
|
|
24523
|
-
|
|
24524
|
-
|
|
24657
|
+
const resolveDependencyProduct = (pkg, packageName, product) => {
|
|
24658
|
+
if (provided.has(product)) return null;
|
|
24659
|
+
const dependency = pkg.manifest.packages.get(packageName);
|
|
24660
|
+
if (!dependency)
|
|
24661
|
+
return `${import_node_path14.default.basename(pkg.manifest.dir)} names no package ${packageName}`;
|
|
24662
|
+
if ("dir" in dependency) {
|
|
24663
|
+
const loaded3 = load2({ kind: "local", dir: dependency.dir });
|
|
24664
|
+
return typeof loaded3 === "string" ? loaded3 : resolveProduct(loaded3, product);
|
|
24665
|
+
}
|
|
24666
|
+
if (!options.provided) return null;
|
|
24667
|
+
const loaded2 = load2({ kind: "remote", url: dependency.url });
|
|
24668
|
+
return typeof loaded2 === "string" ? loaded2 : resolveProduct(loaded2, product);
|
|
24669
|
+
};
|
|
24670
|
+
const unnamed = () => localDirs.map((dir) => load2({ kind: "local", dir })).filter((pkg) => typeof pkg !== "string");
|
|
24671
|
+
for (const { product, source } of products) {
|
|
24672
|
+
if (provided.has(product)) continue;
|
|
24673
|
+
if (source.kind === "remote" && !options.provided) continue;
|
|
24674
|
+
const pkg = source.kind === "unnamed" ? unnamed().find((candidate) => candidate.manifest.products.has(product)) : load2(source);
|
|
24675
|
+
const reason = pkg === void 0 ? "no package the workspace references vends it" : typeof pkg === "string" ? pkg : resolveProduct(pkg, product);
|
|
24525
24676
|
if (reason)
|
|
24526
|
-
result.unavailable.set(
|
|
24527
|
-
|
|
24677
|
+
result.unavailable.set(product, {
|
|
24678
|
+
source: source.kind === "remote" ? source.url : typeof pkg === "object" ? pkg.source : source.kind === "local" ? source.dir : "the workspace",
|
|
24528
24679
|
reason
|
|
24529
24680
|
});
|
|
24530
24681
|
}
|
|
24531
|
-
|
|
24682
|
+
for (const pkg of packages.values()) {
|
|
24683
|
+
if (typeof pkg === "string") continue;
|
|
24684
|
+
for (const [name2, target] of pkg.manifest.targets) {
|
|
24685
|
+
if (target.type === "test" || target.type === "plugin" || target.type === "macro")
|
|
24686
|
+
continue;
|
|
24687
|
+
if (target.type === "executable") continue;
|
|
24688
|
+
const reason = resolveTarget(pkg, name2);
|
|
24689
|
+
if (reason && !result.modules.has(name2))
|
|
24690
|
+
result.modules.set(name2, { source: pkg.source, reason });
|
|
24691
|
+
}
|
|
24692
|
+
}
|
|
24693
|
+
const reached = /* @__PURE__ */ new Set();
|
|
24694
|
+
const reach = (pkg, name2) => {
|
|
24695
|
+
const key = `${pkg.manifest.dir}\0${name2}`;
|
|
24696
|
+
if (reached.has(key) || !targets.has(key)) return;
|
|
24697
|
+
reached.add(key);
|
|
24698
|
+
for (const dependency of pkg.manifest.targets.get(name2)?.dependencies ?? []) {
|
|
24699
|
+
if (dependency.kind === "target") reach(pkg, dependency.name);
|
|
24700
|
+
else {
|
|
24701
|
+
const source = pkg.manifest.packages.get(dependency.package);
|
|
24702
|
+
const nested = source && ("dir" in source ? packages.get(import_node_path14.default.resolve(source.dir)) : packages.get(source.url));
|
|
24703
|
+
if (nested && typeof nested !== "string")
|
|
24704
|
+
for (const root of nested.manifest.products.get(dependency.name) ?? [])
|
|
24705
|
+
reach(nested, root);
|
|
24706
|
+
}
|
|
24707
|
+
}
|
|
24708
|
+
};
|
|
24709
|
+
for (const { product, source } of products) {
|
|
24710
|
+
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);
|
|
24711
|
+
if (!pkg || typeof pkg === "string" || result.unavailable.has(product)) continue;
|
|
24712
|
+
for (const root of pkg.manifest.products.get(product) ?? []) reach(pkg, root);
|
|
24713
|
+
}
|
|
24714
|
+
result.targets = [...targets.entries()].filter(([key]) => reached.has(key)).map(([, target]) => target);
|
|
24532
24715
|
return result;
|
|
24533
24716
|
}
|
|
24534
|
-
var
|
|
24535
|
-
var
|
|
24536
|
-
"src/swift-
|
|
24717
|
+
var import_node_child_process8, import_node_fs14, import_node_path14, REMOTE_CHECKOUTS, C_FAMILY, verified2;
|
|
24718
|
+
var init_swift_packages = __esm({
|
|
24719
|
+
"src/swift-packages.ts"() {
|
|
24537
24720
|
"use strict";
|
|
24538
|
-
|
|
24539
|
-
|
|
24540
|
-
|
|
24721
|
+
import_node_child_process8 = require("node:child_process");
|
|
24722
|
+
import_node_fs14 = __toESM(require("node:fs"), 1);
|
|
24723
|
+
import_node_path14 = __toESM(require("node:path"), 1);
|
|
24541
24724
|
init_swift_package();
|
|
24542
|
-
|
|
24725
|
+
init_swift_package_manifest();
|
|
24726
|
+
REMOTE_CHECKOUTS = import_node_path14.default.join(".build", "peach", "checkouts");
|
|
24543
24727
|
C_FAMILY = /\.(c|cc|cpp|cxx|m|mm|s|S)$/;
|
|
24544
24728
|
verified2 = /* @__PURE__ */ new Set();
|
|
24545
24729
|
}
|
|
@@ -24681,7 +24865,7 @@ var init_swift_submit = __esm({
|
|
|
24681
24865
|
function readXcodeJsonProject(xcodeproj, source) {
|
|
24682
24866
|
const json = import_json5.default.parse(source);
|
|
24683
24867
|
if (!isJsonObject(json)) throw new Error(`${xcodeproj}/project.xcproj is not an object`);
|
|
24684
|
-
const projectDir =
|
|
24868
|
+
const projectDir = import_node_path15.default.dirname(xcodeproj);
|
|
24685
24869
|
const objects = {};
|
|
24686
24870
|
let next = 0;
|
|
24687
24871
|
const add = (entry, id) => {
|
|
@@ -24694,7 +24878,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
24694
24878
|
const base = /^<([A-Z]+)>\/(.*)$/.exec(raw2);
|
|
24695
24879
|
if (base) {
|
|
24696
24880
|
if (base[1] === "PROJECT")
|
|
24697
|
-
return { sourceTree: "<absolute>", path:
|
|
24881
|
+
return { sourceTree: "<absolute>", path: import_node_path15.default.join(projectDir, base[2]) };
|
|
24698
24882
|
if (base[1] === "PRODUCTS")
|
|
24699
24883
|
return { sourceTree: "BUILT_PRODUCTS_DIR", path: base[2] };
|
|
24700
24884
|
return null;
|
|
@@ -24702,7 +24886,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
24702
24886
|
const unescaped = raw2.replaceAll("\\<", "<");
|
|
24703
24887
|
if (unescaped.startsWith("/")) return { sourceTree: "<absolute>", path: unescaped };
|
|
24704
24888
|
if (unescaped.startsWith("~")) return null;
|
|
24705
|
-
return groupDir === null ? null : { sourceTree: "<absolute>", path:
|
|
24889
|
+
return groupDir === null ? null : { sourceTree: "<absolute>", path: import_node_path15.default.join(groupDir, unescaped) };
|
|
24706
24890
|
};
|
|
24707
24891
|
const memberships = [];
|
|
24708
24892
|
const folders = [];
|
|
@@ -24713,7 +24897,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
24713
24897
|
const kind = text(entry.kind) ?? "file-reference";
|
|
24714
24898
|
const raw2 = text(entry.path) ?? "";
|
|
24715
24899
|
const located = raw2 === "" ? null : locate(raw2, parent.dir);
|
|
24716
|
-
const name2 = text(entry.name) ??
|
|
24900
|
+
const name2 = text(entry.name) ?? import_node_path15.default.basename(raw2);
|
|
24717
24901
|
const node = { id: "", name: name2, dir: null, parent, children: [] };
|
|
24718
24902
|
if (kind === "group" || kind === "variant-group" || kind === "version-group") {
|
|
24719
24903
|
node.dir = raw2 === "" ? parent.dir : located?.sourceTree === "<absolute>" ? located.path : null;
|
|
@@ -24828,7 +25012,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
24828
25012
|
if (!isObject(entry)) continue;
|
|
24829
25013
|
const repository = text(entry.repository);
|
|
24830
25014
|
const local = text(entry.path);
|
|
24831
|
-
const name2 = local !== void 0 ?
|
|
25015
|
+
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
25016
|
const id = text(entry.kind) === "local" && local !== void 0 ? add({ isa: "XCLocalSwiftPackageReference", relativePath: local }) : add({ isa: "XCRemoteSwiftPackageReference", repositoryURL: repository ?? "" });
|
|
24833
25017
|
packageIds.set(name2.toLowerCase(), id);
|
|
24834
25018
|
}
|
|
@@ -24996,11 +25180,11 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
24996
25180
|
function isJsonObject(value) {
|
|
24997
25181
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
24998
25182
|
}
|
|
24999
|
-
var
|
|
25183
|
+
var import_node_path15, import_json5, isObject, text, items, PHASE_ISA;
|
|
25000
25184
|
var init_xcode_json_project = __esm({
|
|
25001
25185
|
"src/xcode-json-project.ts"() {
|
|
25002
25186
|
"use strict";
|
|
25003
|
-
|
|
25187
|
+
import_node_path15 = __toESM(require("node:path"), 1);
|
|
25004
25188
|
import_json5 = __toESM(require("json5"), 1);
|
|
25005
25189
|
isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
25006
25190
|
text = (value) => typeof value === "string" ? value : void 0;
|
|
@@ -25107,27 +25291,27 @@ function parseOpenStepPlist(text2) {
|
|
|
25107
25291
|
return root;
|
|
25108
25292
|
}
|
|
25109
25293
|
function walkFiles(dir) {
|
|
25110
|
-
if (!
|
|
25294
|
+
if (!import_node_fs15.default.existsSync(dir)) return [];
|
|
25111
25295
|
const out = [];
|
|
25112
|
-
for (const entry of
|
|
25296
|
+
for (const entry of import_node_fs15.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
|
|
25113
25297
|
if (entry.name.startsWith(".")) continue;
|
|
25114
|
-
const full =
|
|
25298
|
+
const full = import_node_path16.default.join(dir, entry.name);
|
|
25115
25299
|
if (entry.isDirectory()) out.push(...walkFiles(full));
|
|
25116
25300
|
else if (entry.isFile()) out.push(full);
|
|
25117
25301
|
}
|
|
25118
25302
|
return out;
|
|
25119
25303
|
}
|
|
25120
25304
|
function readXcconfig(file, seen = /* @__PURE__ */ new Set()) {
|
|
25121
|
-
if (seen.has(file) || !
|
|
25305
|
+
if (seen.has(file) || !import_node_fs15.default.existsSync(file)) return {};
|
|
25122
25306
|
seen.add(file);
|
|
25123
25307
|
const settings = {};
|
|
25124
|
-
for (const raw2 of
|
|
25308
|
+
for (const raw2 of import_node_fs15.default.readFileSync(file, "utf8").split("\n")) {
|
|
25125
25309
|
const line = raw2.replace(/\/\/.*$/, "").trim();
|
|
25126
25310
|
const include = /^#include\??\s+"([^"]+)"/.exec(line);
|
|
25127
25311
|
if (include) {
|
|
25128
25312
|
Object.assign(
|
|
25129
25313
|
settings,
|
|
25130
|
-
readXcconfig(
|
|
25314
|
+
readXcconfig(import_node_path16.default.resolve(import_node_path16.default.dirname(file), include[1]), seen)
|
|
25131
25315
|
);
|
|
25132
25316
|
continue;
|
|
25133
25317
|
}
|
|
@@ -25177,22 +25361,22 @@ function decodeXml(text2) {
|
|
|
25177
25361
|
return text2.replaceAll(""", '"').replaceAll("'", "'").replaceAll("<", "<").replaceAll(">", ">").replaceAll("&", "&");
|
|
25178
25362
|
}
|
|
25179
25363
|
function workspaceReferences(workspace) {
|
|
25180
|
-
const data =
|
|
25181
|
-
if (!
|
|
25364
|
+
const data = import_node_path16.default.join(workspace, "contents.xcworkspacedata");
|
|
25365
|
+
if (!import_node_fs15.default.existsSync(data))
|
|
25182
25366
|
throw new Error(`${workspace} has no contents.xcworkspacedata`);
|
|
25183
|
-
const container =
|
|
25367
|
+
const container = import_node_path16.default.dirname(workspace);
|
|
25184
25368
|
const locate = (location2, base) => {
|
|
25185
25369
|
const colon = location2.indexOf(":");
|
|
25186
25370
|
const kind = location2.slice(0, colon);
|
|
25187
25371
|
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(`${
|
|
25372
|
+
if (kind === "group") return import_node_path16.default.resolve(base, rest);
|
|
25373
|
+
if (kind === "container" || kind === "self") return import_node_path16.default.resolve(container, rest);
|
|
25374
|
+
if (kind === "absolute") return import_node_path16.default.resolve(rest);
|
|
25375
|
+
throw new Error(`${import_node_path16.default.basename(workspace)} has an unsupported location ${location2}`);
|
|
25192
25376
|
};
|
|
25193
25377
|
const groups = [container];
|
|
25194
25378
|
const references = [];
|
|
25195
|
-
for (const [, closing, tag, attributes, selfClosing] of
|
|
25379
|
+
for (const [, closing, tag, attributes, selfClosing] of import_node_fs15.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
|
|
25196
25380
|
if (closing) {
|
|
25197
25381
|
if (tag === "Group") groups.pop();
|
|
25198
25382
|
continue;
|
|
@@ -25207,8 +25391,8 @@ function workspaceReferences(workspace) {
|
|
|
25207
25391
|
}
|
|
25208
25392
|
function xcodeProjectFile(xcodeproj) {
|
|
25209
25393
|
for (const name2 of ["project.pbxproj", "project.xcproj"]) {
|
|
25210
|
-
const file =
|
|
25211
|
-
if (
|
|
25394
|
+
const file = import_node_path16.default.join(xcodeproj, name2);
|
|
25395
|
+
if (import_node_fs15.default.existsSync(file)) return file;
|
|
25212
25396
|
}
|
|
25213
25397
|
return null;
|
|
25214
25398
|
}
|
|
@@ -25216,10 +25400,10 @@ function loadProject(xcodeproj) {
|
|
|
25216
25400
|
const projectFile = xcodeProjectFile(xcodeproj);
|
|
25217
25401
|
if (!projectFile)
|
|
25218
25402
|
throw new Error(`${xcodeproj} has no project.pbxproj or project.xcproj`);
|
|
25219
|
-
const mtimeMs =
|
|
25403
|
+
const mtimeMs = import_node_fs15.default.statSync(projectFile).mtimeMs;
|
|
25220
25404
|
const cached4 = loaded.get(projectFile);
|
|
25221
25405
|
if (cached4?.mtimeMs === mtimeMs) return cached4.project;
|
|
25222
|
-
const source =
|
|
25406
|
+
const source = import_node_fs15.default.readFileSync(projectFile, "utf8");
|
|
25223
25407
|
const root = projectFile.endsWith(".xcproj") ? readXcodeJsonProject(xcodeproj, source) : parseOpenStepPlist(source);
|
|
25224
25408
|
if (!isDict(root) || !isDict(root.objects)) {
|
|
25225
25409
|
throw new Error(`${projectFile} has no objects table`);
|
|
@@ -25233,8 +25417,8 @@ function loadProject(xcodeproj) {
|
|
|
25233
25417
|
if (!project || project.isa !== "PBXProject") {
|
|
25234
25418
|
throw new Error(`${projectFile} has no PBXProject root`);
|
|
25235
25419
|
}
|
|
25236
|
-
const projectDir =
|
|
25237
|
-
|
|
25420
|
+
const projectDir = import_node_fs15.default.realpathSync(
|
|
25421
|
+
import_node_path16.default.resolve(import_node_path16.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
|
|
25238
25422
|
);
|
|
25239
25423
|
const parent = /* @__PURE__ */ new Map();
|
|
25240
25424
|
for (const [id, entry] of Object.entries(objects)) {
|
|
@@ -25252,11 +25436,11 @@ function loadProject(xcodeproj) {
|
|
|
25252
25436
|
const own = str(entry.path) ?? "";
|
|
25253
25437
|
const tree = str(entry.sourceTree) ?? "<group>";
|
|
25254
25438
|
if (tree === "<absolute>") result2 = own;
|
|
25255
|
-
else if (tree === "SOURCE_ROOT") result2 =
|
|
25439
|
+
else if (tree === "SOURCE_ROOT") result2 = import_node_path16.default.join(projectDir, own);
|
|
25256
25440
|
else if (tree === "<group>") {
|
|
25257
25441
|
const up = parent.get(id);
|
|
25258
25442
|
const base = up ? resolvePath(up) : projectDir;
|
|
25259
|
-
result2 = base === null ? null :
|
|
25443
|
+
result2 = base === null ? null : import_node_path16.default.join(base, own);
|
|
25260
25444
|
}
|
|
25261
25445
|
}
|
|
25262
25446
|
resolvedPaths.set(id, result2);
|
|
@@ -25356,7 +25540,7 @@ function targetMembers(ref) {
|
|
|
25356
25540
|
const addResource = (file) => {
|
|
25357
25541
|
if (isDirectory(file)) {
|
|
25358
25542
|
for (const inner of walkFiles(file)) resources.add(inner);
|
|
25359
|
-
} else if (
|
|
25543
|
+
} else if (import_node_fs15.default.existsSync(file)) resources.add(file);
|
|
25360
25544
|
};
|
|
25361
25545
|
const fileRefPaths = (refId) => {
|
|
25362
25546
|
const entry = project.object(refId);
|
|
@@ -25377,7 +25561,7 @@ function targetMembers(ref) {
|
|
|
25377
25561
|
for (const buildFileId of list(phase.files)) {
|
|
25378
25562
|
for (const file of fileRefPaths(str(project.object(buildFileId)?.fileRef) ?? "")) {
|
|
25379
25563
|
if (phase.isa === "PBXSourcesBuildPhase") {
|
|
25380
|
-
if (!
|
|
25564
|
+
if (!import_node_fs15.default.existsSync(file)) continue;
|
|
25381
25565
|
allSources.add(file);
|
|
25382
25566
|
if (file.endsWith(".swift")) sources.add(file);
|
|
25383
25567
|
} else if (phase.isa === "PBXResourcesBuildPhase") addResource(file);
|
|
@@ -25385,7 +25569,7 @@ function targetMembers(ref) {
|
|
|
25385
25569
|
}
|
|
25386
25570
|
}
|
|
25387
25571
|
const addSynchronized = (folder, relative3) => {
|
|
25388
|
-
const file =
|
|
25572
|
+
const file = import_node_path16.default.join(folder, relative3);
|
|
25389
25573
|
if (NEVER_MEMBER.test(relative3)) return;
|
|
25390
25574
|
if (file.endsWith(".swift")) {
|
|
25391
25575
|
if (!relative3.split("/").some((segment) => BUNDLE_DIR.test(segment))) {
|
|
@@ -25410,7 +25594,7 @@ function targetMembers(ref) {
|
|
|
25410
25594
|
}
|
|
25411
25595
|
if (owned.has(groupId)) {
|
|
25412
25596
|
for (const file of walkFiles(folder)) {
|
|
25413
|
-
const relative3 =
|
|
25597
|
+
const relative3 = import_node_path16.default.relative(folder, file).split(import_node_path16.default.sep).join("/");
|
|
25414
25598
|
if ([...exceptions].some(
|
|
25415
25599
|
(exception) => relative3 === exception || relative3.startsWith(`${exception}/`)
|
|
25416
25600
|
))
|
|
@@ -25419,14 +25603,14 @@ function targetMembers(ref) {
|
|
|
25419
25603
|
}
|
|
25420
25604
|
} else {
|
|
25421
25605
|
for (const relative3 of exceptions) {
|
|
25422
|
-
const file =
|
|
25606
|
+
const file = import_node_path16.default.join(folder, relative3);
|
|
25423
25607
|
if (isDirectory(file)) {
|
|
25424
25608
|
for (const inner of walkFiles(file))
|
|
25425
25609
|
addSynchronized(
|
|
25426
25610
|
folder,
|
|
25427
|
-
|
|
25611
|
+
import_node_path16.default.relative(folder, inner).split(import_node_path16.default.sep).join("/")
|
|
25428
25612
|
);
|
|
25429
|
-
} else if (
|
|
25613
|
+
} else if (import_node_fs15.default.existsSync(file)) addSynchronized(folder, relative3);
|
|
25430
25614
|
}
|
|
25431
25615
|
}
|
|
25432
25616
|
}
|
|
@@ -25439,8 +25623,8 @@ function targetMembers(ref) {
|
|
|
25439
25623
|
function commonAncestor(dirs) {
|
|
25440
25624
|
let common = dirs[0];
|
|
25441
25625
|
for (const dir of dirs) {
|
|
25442
|
-
while (common !==
|
|
25443
|
-
common =
|
|
25626
|
+
while (common !== import_node_path16.default.dirname(common) && import_node_path16.default.relative(common, dir).startsWith(".."))
|
|
25627
|
+
common = import_node_path16.default.dirname(common);
|
|
25444
25628
|
}
|
|
25445
25629
|
return common;
|
|
25446
25630
|
}
|
|
@@ -25449,8 +25633,8 @@ function workspaceProjects(xcodeprojOrWorkspace) {
|
|
|
25449
25633
|
const projects2 = [];
|
|
25450
25634
|
const projectAt = /* @__PURE__ */ new Map();
|
|
25451
25635
|
const addProject = (xcodeproj) => {
|
|
25452
|
-
const key =
|
|
25453
|
-
if (projectAt.has(key) || key.split(
|
|
25636
|
+
const key = import_node_path16.default.resolve(xcodeproj);
|
|
25637
|
+
if (projectAt.has(key) || key.split(import_node_path16.default.sep).includes("Pods")) return;
|
|
25454
25638
|
if (!xcodeProjectFile(key)) return;
|
|
25455
25639
|
const project = loadProject(key);
|
|
25456
25640
|
projectAt.set(key, project);
|
|
@@ -25467,7 +25651,7 @@ function workspaceProjects(xcodeprojOrWorkspace) {
|
|
|
25467
25651
|
for (const reference of listed)
|
|
25468
25652
|
if (reference.endsWith(".xcodeproj")) addProject(reference);
|
|
25469
25653
|
if (projects2.length === 0) {
|
|
25470
|
-
throw new Error(`${
|
|
25654
|
+
throw new Error(`${import_node_path16.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
|
|
25471
25655
|
}
|
|
25472
25656
|
return { listed, projects: projects2, projectAt };
|
|
25473
25657
|
}
|
|
@@ -25491,7 +25675,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
25491
25675
|
const allTargets = projects2.flatMap(nativeTargets);
|
|
25492
25676
|
const appTargets = allTargets.filter((ref) => ref.target.productType === APPLICATION);
|
|
25493
25677
|
const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
|
|
25494
|
-
const container =
|
|
25678
|
+
const container = import_node_path16.default.basename(xcodeprojOrWorkspace);
|
|
25495
25679
|
const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
|
|
25496
25680
|
if (named.length !== 1) {
|
|
25497
25681
|
throw new Error(
|
|
@@ -25503,14 +25687,14 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
25503
25687
|
for (const ref of allTargets) {
|
|
25504
25688
|
const product = ref.project.object(str(ref.target.productReference));
|
|
25505
25689
|
const file = str(product?.path);
|
|
25506
|
-
if (file && !byProduct.has(
|
|
25507
|
-
byProduct.set(
|
|
25690
|
+
if (file && !byProduct.has(import_node_path16.default.basename(file)))
|
|
25691
|
+
byProduct.set(import_node_path16.default.basename(file), ref);
|
|
25508
25692
|
}
|
|
25509
25693
|
const proxied = (project, proxyId) => {
|
|
25510
25694
|
const proxy = project.object(proxyId);
|
|
25511
25695
|
if (proxy?.isa !== "PBXContainerItemProxy") return void 0;
|
|
25512
25696
|
const portal = str(proxy.containerPortal);
|
|
25513
|
-
const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(
|
|
25697
|
+
const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path16.default.resolve(project.resolvePath(portal ?? "") ?? ""));
|
|
25514
25698
|
const remote = str(proxy.remoteGlobalIDString);
|
|
25515
25699
|
if (!owner || !remote) return void 0;
|
|
25516
25700
|
return nativeTargets(owner).find(
|
|
@@ -25531,7 +25715,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
25531
25715
|
if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
|
|
25532
25716
|
for (const buildFileId of list(phase.files)) {
|
|
25533
25717
|
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(
|
|
25718
|
+
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
25719
|
if (resolved) found.push(resolved);
|
|
25536
25720
|
}
|
|
25537
25721
|
}
|
|
@@ -25552,7 +25736,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
25552
25736
|
const name2 = str(ref.target.name) ?? ref.id;
|
|
25553
25737
|
const { get: settings2, keys } = targetSettings(ref, {
|
|
25554
25738
|
TARGET_NAME: name2,
|
|
25555
|
-
PROJECT_NAME:
|
|
25739
|
+
PROJECT_NAME: import_node_path16.default.basename(ref.project.xcodeproj, ".xcodeproj"),
|
|
25556
25740
|
SRCROOT: ref.project.projectDir,
|
|
25557
25741
|
SOURCE_ROOT: ref.project.projectDir,
|
|
25558
25742
|
PROJECT_DIR: ref.project.projectDir,
|
|
@@ -25583,8 +25767,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
25583
25767
|
}
|
|
25584
25768
|
return value;
|
|
25585
25769
|
};
|
|
25586
|
-
const infoPlistFile = settings("INFOPLIST_FILE") ?
|
|
25587
|
-
const sourceInfo = infoPlistFile ? import_plist3.default.parse(
|
|
25770
|
+
const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path16.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
|
|
25771
|
+
const sourceInfo = infoPlistFile ? import_plist3.default.parse(import_node_fs15.default.readFileSync(infoPlistFile, "utf8")) : {};
|
|
25588
25772
|
if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
|
|
25589
25773
|
throw new Error(`${module2.name} Info.plist must contain a dictionary`);
|
|
25590
25774
|
}
|
|
@@ -25602,34 +25786,17 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
25602
25786
|
};
|
|
25603
25787
|
}
|
|
25604
25788
|
const localPackageDirs = [
|
|
25605
|
-
...listed.filter((reference) =>
|
|
25789
|
+
...listed.filter((reference) => import_node_fs15.default.existsSync(import_node_path16.default.join(reference, "Package.swift"))),
|
|
25606
25790
|
...projects2.flatMap(
|
|
25607
25791
|
(project) => Object.entries(project.objects).flatMap(([id, entry]) => {
|
|
25608
25792
|
if (!isDict(entry)) return [];
|
|
25609
|
-
const candidate = entry.isa === "XCLocalSwiftPackageReference" ?
|
|
25610
|
-
return candidate &&
|
|
25793
|
+
const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path16.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
|
|
25794
|
+
return candidate && import_node_fs15.default.existsSync(import_node_path16.default.join(candidate, "Package.swift")) ? [candidate] : [];
|
|
25611
25795
|
})
|
|
25612
25796
|
)
|
|
25613
25797
|
];
|
|
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 = [];
|
|
25798
|
+
const linkedProducts = [];
|
|
25799
|
+
const binaryFrameworks = /* @__PURE__ */ new Set();
|
|
25633
25800
|
for (const { project, target } of order) {
|
|
25634
25801
|
const productDependencies = [
|
|
25635
25802
|
...list(target.packageProductDependencies),
|
|
@@ -25641,45 +25808,37 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
25641
25808
|
for (const dependencyId of productDependencies) {
|
|
25642
25809
|
const dependency = project.object(dependencyId);
|
|
25643
25810
|
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")))
|
|
25811
|
+
if (!dependency || !product || linkedProducts.some((entry) => entry.product === product))
|
|
25668
25812
|
continue;
|
|
25669
|
-
|
|
25670
|
-
|
|
25813
|
+
const reference = project.object(str(dependency.package));
|
|
25814
|
+
linkedProducts.push({
|
|
25815
|
+
product,
|
|
25816
|
+
source: reference?.isa === "XCRemoteSwiftPackageReference" ? { kind: "remote", url: str(reference.repositoryURL) ?? "" } : reference?.isa === "XCLocalSwiftPackageReference" ? {
|
|
25817
|
+
kind: "local",
|
|
25818
|
+
dir: import_node_path16.default.resolve(
|
|
25819
|
+
project.projectDir,
|
|
25820
|
+
str(reference.relativePath) ?? ""
|
|
25821
|
+
)
|
|
25822
|
+
} : { kind: "unnamed" }
|
|
25823
|
+
});
|
|
25671
25824
|
}
|
|
25672
|
-
for (const
|
|
25673
|
-
|
|
25674
|
-
|
|
25675
|
-
|
|
25676
|
-
|
|
25677
|
-
|
|
25825
|
+
for (const phaseId of list(target.buildPhases)) {
|
|
25826
|
+
const phase = project.object(phaseId);
|
|
25827
|
+
if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
|
|
25828
|
+
for (const buildFileId of list(phase.files)) {
|
|
25829
|
+
const fileId = str(project.object(buildFileId)?.fileRef);
|
|
25830
|
+
const file = project.object(fileId);
|
|
25831
|
+
const tree = str(file?.sourceTree);
|
|
25832
|
+
const name2 = /([^/]+)\.(xc)?framework$/.exec(str(file?.path) ?? "")?.[1];
|
|
25833
|
+
if (file?.isa !== "PBXFileReference" || !name2) continue;
|
|
25834
|
+
if (tree === "BUILT_PRODUCTS_DIR" || tree === "SDKROOT" || tree === "DEVELOPER_DIR")
|
|
25835
|
+
continue;
|
|
25836
|
+
binaryFrameworks.add(name2);
|
|
25678
25837
|
}
|
|
25679
25838
|
}
|
|
25680
25839
|
}
|
|
25681
|
-
const resolvedFile =
|
|
25682
|
-
workspace ??
|
|
25840
|
+
const resolvedFile = import_node_path16.default.join(
|
|
25841
|
+
workspace ?? import_node_path16.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
|
|
25683
25842
|
"xcshareddata",
|
|
25684
25843
|
"swiftpm",
|
|
25685
25844
|
"Package.resolved"
|
|
@@ -25689,30 +25848,34 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
25689
25848
|
...module2,
|
|
25690
25849
|
rootDir: commonAncestor(
|
|
25691
25850
|
[
|
|
25692
|
-
workspace ?
|
|
25851
|
+
workspace ? import_node_path16.default.dirname(workspace) : app.project.projectDir,
|
|
25693
25852
|
...used.map((project) => project.projectDir),
|
|
25694
|
-
...
|
|
25695
|
-
|
|
25853
|
+
...localPackageDirs,
|
|
25854
|
+
...linkedProducts.flatMap(
|
|
25855
|
+
({ source }) => source.kind === "local" && import_node_fs15.default.existsSync(source.dir) ? [source.dir] : []
|
|
25856
|
+
)
|
|
25857
|
+
].map((dir) => import_node_fs15.default.realpathSync(dir))
|
|
25696
25858
|
),
|
|
25697
25859
|
projectFiles: [...new Set(used.map((project) => project.projectFile))].sort(),
|
|
25698
25860
|
infoPlist: import_plist3.default.build(info),
|
|
25699
25861
|
infoPlistFile,
|
|
25700
25862
|
frameworks,
|
|
25701
|
-
|
|
25702
|
-
|
|
25703
|
-
|
|
25704
|
-
|
|
25863
|
+
linkedProducts,
|
|
25864
|
+
localPackageDirs: [
|
|
25865
|
+
...new Set(localPackageDirs.map((dir) => import_node_fs15.default.realpathSync(dir)))
|
|
25866
|
+
].sort(),
|
|
25867
|
+
binaryFrameworks: [...binaryFrameworks].sort(),
|
|
25868
|
+
packageResolved: import_node_fs15.default.existsSync(resolvedFile) ? resolvedFile : null,
|
|
25705
25869
|
appTargets: appTargetNames
|
|
25706
25870
|
};
|
|
25707
25871
|
}
|
|
25708
|
-
var
|
|
25872
|
+
var import_node_fs15, import_node_path16, import_plist3, isDict, str, list, APPLICATION, MODULE_PRODUCTS, NEVER_MEMBER, BUNDLE_DIR, CONDITIONS, isDirectory, loaded, targetRefs;
|
|
25709
25873
|
var init_xcode_project = __esm({
|
|
25710
25874
|
"src/xcode-project.ts"() {
|
|
25711
25875
|
"use strict";
|
|
25712
|
-
|
|
25713
|
-
|
|
25876
|
+
import_node_fs15 = __toESM(require("node:fs"), 1);
|
|
25877
|
+
import_node_path16 = __toESM(require("node:path"), 1);
|
|
25714
25878
|
import_plist3 = __toESM(require_plist(), 1);
|
|
25715
|
-
init_swift_package();
|
|
25716
25879
|
init_xcode_json_project();
|
|
25717
25880
|
isDict = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
25718
25881
|
str = (value) => typeof value === "string" ? value : void 0;
|
|
@@ -25731,7 +25894,7 @@ var init_xcode_project = __esm({
|
|
|
25731
25894
|
arch: "arm64",
|
|
25732
25895
|
variant: "normal"
|
|
25733
25896
|
};
|
|
25734
|
-
isDirectory = (dir) =>
|
|
25897
|
+
isDirectory = (dir) => import_node_fs15.default.existsSync(dir) && import_node_fs15.default.statSync(dir).isDirectory();
|
|
25735
25898
|
loaded = /* @__PURE__ */ new Map();
|
|
25736
25899
|
targetRefs = /* @__PURE__ */ new WeakMap();
|
|
25737
25900
|
}
|
|
@@ -25739,17 +25902,17 @@ var init_xcode_project = __esm({
|
|
|
25739
25902
|
|
|
25740
25903
|
// src/swift-host.ts
|
|
25741
25904
|
function swiftPackageId(packagePath) {
|
|
25742
|
-
return
|
|
25905
|
+
return import_node_path17.default.basename(packagePath).replace(/[^A-Za-z0-9_]/g, "_").replace(/^(\d)/, "_$1");
|
|
25743
25906
|
}
|
|
25744
25907
|
function nativeSourceDescriptor(packagePath) {
|
|
25745
|
-
packagePath =
|
|
25746
|
-
const file =
|
|
25747
|
-
if (!
|
|
25908
|
+
packagePath = import_node_fs16.default.realpathSync(packagePath);
|
|
25909
|
+
const file = import_node_path17.default.join(packagePath, NATIVE_DESCRIPTOR);
|
|
25910
|
+
if (!import_node_fs16.default.existsSync(file)) return null;
|
|
25748
25911
|
const value = JSON.parse(
|
|
25749
25912
|
readPackageFile(packagePath, file, MAX_SWIFT_COMPILE_SOURCE_BYTES).toString("utf8")
|
|
25750
25913
|
);
|
|
25751
25914
|
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" || !
|
|
25915
|
+
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
25916
|
throw invalid();
|
|
25754
25917
|
}
|
|
25755
25918
|
if (!isSwiftNativeModules(value) || value.packageId !== swiftPackageId(packagePath)) {
|
|
@@ -25758,7 +25921,7 @@ function nativeSourceDescriptor(packagePath) {
|
|
|
25758
25921
|
return value;
|
|
25759
25922
|
}
|
|
25760
25923
|
function projectFor(packagePath, hosted) {
|
|
25761
|
-
packagePath =
|
|
25924
|
+
packagePath = import_node_fs16.default.realpathSync(packagePath);
|
|
25762
25925
|
const existing = projects.get(packagePath);
|
|
25763
25926
|
if (existing) {
|
|
25764
25927
|
if (hosted && !existing.hosted) {
|
|
@@ -25778,30 +25941,35 @@ function projectFor(packagePath, hosted) {
|
|
|
25778
25941
|
projects.set(packagePath, created);
|
|
25779
25942
|
return created;
|
|
25780
25943
|
}
|
|
25781
|
-
function
|
|
25782
|
-
|
|
25944
|
+
function swiftPackages(entry, app) {
|
|
25945
|
+
const stamp = (file) => file && import_node_fs16.default.existsSync(file) ? import_node_fs16.default.statSync(file).mtimeMs : 0;
|
|
25783
25946
|
const key = JSON.stringify([
|
|
25784
|
-
app.
|
|
25947
|
+
app.linkedProducts,
|
|
25785
25948
|
app.packageResolved,
|
|
25786
|
-
|
|
25949
|
+
stamp(app.packageResolved),
|
|
25950
|
+
app.localPackageDirs.map((dir) => stamp(import_node_path17.default.join(dir, "Package.swift"))),
|
|
25951
|
+
app.linkedProducts.map(
|
|
25952
|
+
({ source }) => source.kind === "local" ? stamp(import_node_path17.default.join(source.dir, "Package.swift")) : 0
|
|
25953
|
+
)
|
|
25787
25954
|
]);
|
|
25788
|
-
if (entry.
|
|
25789
|
-
entry.
|
|
25955
|
+
if (entry.packages?.key !== key) {
|
|
25956
|
+
entry.packages = {
|
|
25790
25957
|
key,
|
|
25791
|
-
packages:
|
|
25792
|
-
app.rootDir,
|
|
25793
|
-
app.packageResolved,
|
|
25794
|
-
app.
|
|
25795
|
-
|
|
25796
|
-
|
|
25958
|
+
packages: resolveSwiftPackages({
|
|
25959
|
+
rootDir: app.rootDir,
|
|
25960
|
+
resolved: app.packageResolved,
|
|
25961
|
+
products: app.linkedProducts,
|
|
25962
|
+
localDirs: app.localPackageDirs,
|
|
25963
|
+
provided: entry.provided
|
|
25964
|
+
})
|
|
25797
25965
|
};
|
|
25798
25966
|
}
|
|
25799
|
-
return entry.
|
|
25967
|
+
return entry.packages.packages;
|
|
25800
25968
|
}
|
|
25801
25969
|
function xcodeInputKey(layout, file, relative3) {
|
|
25802
25970
|
const owner = layout.targetDirs.get(file);
|
|
25803
|
-
if (owner) return
|
|
25804
|
-
return relative3.startsWith(CHECKOUTS_PREFIX) ?
|
|
25971
|
+
if (owner) return import_node_path17.default.posix.join(owner, relative3);
|
|
25972
|
+
return relative3.startsWith(CHECKOUTS_PREFIX) ? import_node_path17.default.posix.join(XCODE_PACKAGES_DIR, relative3.slice(CHECKOUTS_PREFIX.length)) : relative3;
|
|
25805
25973
|
}
|
|
25806
25974
|
function xcodeLayout(root) {
|
|
25807
25975
|
const registered = xcodeProjects.get(root);
|
|
@@ -25812,7 +25980,7 @@ function xcodeLayout(root) {
|
|
|
25812
25980
|
const targetDirs = new Map(app.sources.map((file) => [file, XCODE_APP_DIR]));
|
|
25813
25981
|
const targets = [];
|
|
25814
25982
|
for (const framework of app.frameworks) {
|
|
25815
|
-
const dir =
|
|
25983
|
+
const dir = import_node_path17.default.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName);
|
|
25816
25984
|
for (const file of framework.sources) {
|
|
25817
25985
|
if (targetDirs.has(file)) continue;
|
|
25818
25986
|
targetDirs.set(file, dir);
|
|
@@ -25823,44 +25991,35 @@ function xcodeLayout(root) {
|
|
|
25823
25991
|
path: dir,
|
|
25824
25992
|
executable: false,
|
|
25825
25993
|
resources: false,
|
|
25994
|
+
exclude: [],
|
|
25826
25995
|
languageMode: framework.languageMode,
|
|
25827
25996
|
mainActorIsolation: framework.mainActorIsolation
|
|
25828
25997
|
});
|
|
25829
25998
|
}
|
|
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
|
-
)
|
|
25999
|
+
const packages = swiftPackages(registered, app);
|
|
26000
|
+
for (const target of packages.targets) {
|
|
26001
|
+
const relative3 = import_node_path17.default.relative(
|
|
26002
|
+
target.remote ? import_node_path17.default.join(root, REMOTE_CHECKOUTS) : root,
|
|
26003
|
+
target.dir
|
|
25840
26004
|
);
|
|
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) {
|
|
26005
|
+
if (relative3 === ".." || relative3.startsWith(`..${import_node_path17.default.sep}`) || import_node_path17.default.isAbsolute(relative3))
|
|
26006
|
+
throw new Error(`swift input escapes the selected package: ${target.dir}`);
|
|
26007
|
+
const posix2 = relative3.split(import_node_path17.default.sep).join(import_node_path17.default.posix.sep);
|
|
25851
26008
|
targets.push({
|
|
25852
26009
|
...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
|
-
)
|
|
26010
|
+
path: target.remote ? import_node_path17.default.posix.join(XCODE_PACKAGES_DIR, posix2) : posix2,
|
|
26011
|
+
exclude: []
|
|
25857
26012
|
});
|
|
26013
|
+
if (!target.remote) files.add(import_node_path17.default.join(target.packageDir, "Package.swift"));
|
|
25858
26014
|
for (const file of target.files) files.add(file);
|
|
25859
26015
|
}
|
|
26016
|
+
for (const target of targets) {
|
|
26017
|
+
target.exclude = targets.filter((other) => other.path.startsWith(`${target.path}/`)).map((other) => other.path.slice(target.path.length + 1));
|
|
26018
|
+
}
|
|
25860
26019
|
return {
|
|
25861
26020
|
app,
|
|
25862
26021
|
targets,
|
|
25863
|
-
|
|
26022
|
+
packages,
|
|
25864
26023
|
targetDirs,
|
|
25865
26024
|
files: [...files].sort()
|
|
25866
26025
|
};
|
|
@@ -25873,32 +26032,32 @@ function xcodeManifest(layout) {
|
|
|
25873
26032
|
'let package = Package(name: "app", targets: [',
|
|
25874
26033
|
` .executableTarget(name: "${layout.app.moduleName}", path: "${XCODE_APP_DIR}", ${settings(layout.app.languageMode, layout.app.mainActorIsolation)}),`,
|
|
25875
26034
|
...layout.targets.map(
|
|
25876
|
-
(target) => ` .target(name: "${target.name}", path: "${target.path}", ${target.resources ? "resources: [], " : ""}${settings(target.languageMode, target.mainActorIsolation)}),`
|
|
26035
|
+
(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
26036
|
),
|
|
25878
26037
|
"])",
|
|
25879
26038
|
""
|
|
25880
26039
|
].join("\n");
|
|
25881
26040
|
}
|
|
25882
26041
|
function packageFiles(root) {
|
|
25883
|
-
const canonicalRoot =
|
|
26042
|
+
const canonicalRoot = import_node_fs16.default.realpathSync(root);
|
|
25884
26043
|
const xcode = xcodeLayout(canonicalRoot);
|
|
25885
26044
|
return xcode ? xcode.files : sourceTreeFiles(canonicalRoot, canonicalRoot);
|
|
25886
26045
|
}
|
|
25887
26046
|
function sourceTreeFiles(dir, canonicalRoot) {
|
|
25888
26047
|
const found = [];
|
|
25889
26048
|
const walk2 = (dir2) => {
|
|
25890
|
-
for (const entry of
|
|
26049
|
+
for (const entry of import_node_fs16.default.readdirSync(dir2, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
|
|
25891
26050
|
if (entry.name.startsWith(".") && entry.name !== NATIVE_DESCRIPTOR && entry.name !== NATIVE_GLUE || SKIP_SOURCE_DIRS.has(entry.name))
|
|
25892
26051
|
continue;
|
|
25893
|
-
const full =
|
|
26052
|
+
const full = import_node_path17.default.join(dir2, entry.name);
|
|
25894
26053
|
if (entry.isSymbolicLink()) throw new Error(`swift input is a symlink: ${full}`);
|
|
25895
|
-
const real =
|
|
25896
|
-
const relative3 =
|
|
25897
|
-
if (relative3.startsWith(`..${
|
|
26054
|
+
const real = import_node_fs16.default.realpathSync(full);
|
|
26055
|
+
const relative3 = import_node_path17.default.relative(canonicalRoot, real);
|
|
26056
|
+
if (relative3.startsWith(`..${import_node_path17.default.sep}`) || relative3 === ".." || import_node_path17.default.isAbsolute(relative3)) {
|
|
25898
26057
|
throw new Error(`swift input escapes the selected package: ${full}`);
|
|
25899
26058
|
}
|
|
25900
26059
|
if (entry.isDirectory()) {
|
|
25901
|
-
if (
|
|
26060
|
+
if (import_node_fs16.default.existsSync(import_node_path17.default.join(full, "Package.swift"))) continue;
|
|
25902
26061
|
walk2(full);
|
|
25903
26062
|
} else if (entry.isFile()) {
|
|
25904
26063
|
found.push(full);
|
|
@@ -25906,29 +26065,29 @@ function sourceTreeFiles(dir, canonicalRoot) {
|
|
|
25906
26065
|
}
|
|
25907
26066
|
}
|
|
25908
26067
|
};
|
|
25909
|
-
if (
|
|
26068
|
+
if (import_node_fs16.default.existsSync(dir)) walk2(import_node_fs16.default.realpathSync(dir));
|
|
25910
26069
|
return found;
|
|
25911
26070
|
}
|
|
25912
26071
|
function readPackageFile(root, file, maxBytes) {
|
|
25913
|
-
const canonicalRoot =
|
|
25914
|
-
const relative3 =
|
|
25915
|
-
if (relative3 === ".." || relative3.startsWith(`..${
|
|
26072
|
+
const canonicalRoot = import_node_fs16.default.realpathSync(root);
|
|
26073
|
+
const relative3 = import_node_path17.default.relative(canonicalRoot, import_node_fs16.default.realpathSync(file));
|
|
26074
|
+
if (relative3 === ".." || relative3.startsWith(`..${import_node_path17.default.sep}`) || import_node_path17.default.isAbsolute(relative3)) {
|
|
25916
26075
|
throw new Error(`swift input escapes the selected package: ${file}`);
|
|
25917
26076
|
}
|
|
25918
|
-
let ancestor =
|
|
26077
|
+
let ancestor = import_node_path17.default.resolve(file);
|
|
25919
26078
|
while (ancestor !== canonicalRoot) {
|
|
25920
|
-
if (
|
|
26079
|
+
if (import_node_fs16.default.lstatSync(ancestor).isSymbolicLink()) {
|
|
25921
26080
|
throw new Error(`swift input is a symlink: ${ancestor}`);
|
|
25922
26081
|
}
|
|
25923
|
-
const parent =
|
|
26082
|
+
const parent = import_node_path17.default.dirname(ancestor);
|
|
25924
26083
|
if (parent === ancestor)
|
|
25925
26084
|
throw new Error(`swift input escapes the selected package: ${file}`);
|
|
25926
26085
|
ancestor = parent;
|
|
25927
26086
|
}
|
|
25928
|
-
const expected =
|
|
25929
|
-
const fd =
|
|
26087
|
+
const expected = import_node_fs16.default.statSync(file);
|
|
26088
|
+
const fd = import_node_fs16.default.openSync(file, import_node_fs16.default.constants.O_RDONLY | import_node_fs16.default.constants.O_NOFOLLOW);
|
|
25930
26089
|
try {
|
|
25931
|
-
const stat2 =
|
|
26090
|
+
const stat2 = import_node_fs16.default.fstatSync(fd);
|
|
25932
26091
|
if (stat2.dev !== expected.dev || stat2.ino !== expected.ino) {
|
|
25933
26092
|
throw new Error(`swift input changed while opening: ${file}`);
|
|
25934
26093
|
}
|
|
@@ -25938,16 +26097,16 @@ function readPackageFile(root, file, maxBytes) {
|
|
|
25938
26097
|
const bytes = Buffer.alloc(stat2.size + 1);
|
|
25939
26098
|
let offset = 0;
|
|
25940
26099
|
while (offset < bytes.length) {
|
|
25941
|
-
const count =
|
|
26100
|
+
const count = import_node_fs16.default.readSync(fd, bytes, offset, bytes.length - offset, null);
|
|
25942
26101
|
if (count === 0) break;
|
|
25943
26102
|
offset += count;
|
|
25944
26103
|
}
|
|
25945
|
-
if (offset !== stat2.size ||
|
|
26104
|
+
if (offset !== stat2.size || import_node_fs16.default.fstatSync(fd).size !== stat2.size) {
|
|
25946
26105
|
throw new Error(`swift input changed while reading: ${file}`);
|
|
25947
26106
|
}
|
|
25948
26107
|
return bytes.subarray(0, offset);
|
|
25949
26108
|
} finally {
|
|
25950
|
-
|
|
26109
|
+
import_node_fs16.default.closeSync(fd);
|
|
25951
26110
|
}
|
|
25952
26111
|
}
|
|
25953
26112
|
function sourceFiles(root) {
|
|
@@ -25955,14 +26114,14 @@ function sourceFiles(root) {
|
|
|
25955
26114
|
}
|
|
25956
26115
|
function resourceCandidateFiles(root) {
|
|
25957
26116
|
return packageFiles(root).filter(
|
|
25958
|
-
(file) => !file.endsWith(".swift") && !["project.pbxproj", "project.xcproj"].includes(
|
|
26117
|
+
(file) => !file.endsWith(".swift") && !["project.pbxproj", "project.xcproj"].includes(import_node_path17.default.basename(file))
|
|
25959
26118
|
);
|
|
25960
26119
|
}
|
|
25961
26120
|
function buildSwiftResourceTable(project, baseUrl) {
|
|
25962
26121
|
const limits = inputLimits(Boolean(project.hosted));
|
|
25963
26122
|
const absolute = resourceCandidateFiles(project.packagePath);
|
|
25964
26123
|
const relative3 = absolute.map(
|
|
25965
|
-
(file) =>
|
|
26124
|
+
(file) => import_node_path17.default.relative(project.packagePath, file).split(import_node_path17.default.sep).join(import_node_path17.default.posix.sep)
|
|
25966
26125
|
);
|
|
25967
26126
|
const byRelative = new Map(absolute.map((file, index) => [relative3[index], file]));
|
|
25968
26127
|
const readContents = (candidate) => {
|
|
@@ -25984,16 +26143,16 @@ function buildSwiftResourceTable(project, baseUrl) {
|
|
|
25984
26143
|
for (const { name: name2, file, scale } of found) {
|
|
25985
26144
|
const disk = byRelative.get(file);
|
|
25986
26145
|
if (!disk) continue;
|
|
25987
|
-
if (Object.keys(images).length >= limits.images || imageBytes +
|
|
26146
|
+
if (Object.keys(images).length >= limits.images || imageBytes + import_node_fs16.default.statSync(disk).size > limits.imageTotalBytes) {
|
|
25988
26147
|
throw new Error("swift image pack exceeds the compile service caps");
|
|
25989
26148
|
}
|
|
25990
26149
|
const bytes = readPackageFile(project.packagePath, disk, limits.imageBytes);
|
|
25991
26150
|
imageBytes += bytes.length;
|
|
25992
|
-
const hash = (0,
|
|
25993
|
-
const ext =
|
|
26151
|
+
const hash = (0, import_node_crypto6.createHash)("sha256").update(bytes).digest("hex").slice(0, 16);
|
|
26152
|
+
const ext = import_node_path17.default.posix.extname(file).toLowerCase();
|
|
25994
26153
|
table[name2] = { uri: `${baseUrl}${RESOURCE_PATH}${hash}${ext}`, scale };
|
|
25995
26154
|
images[name2] = {
|
|
25996
|
-
file:
|
|
26155
|
+
file: import_node_path17.default.posix.basename(file),
|
|
25997
26156
|
data: bytes.toString("base64")
|
|
25998
26157
|
};
|
|
25999
26158
|
watched.push(file);
|
|
@@ -26017,10 +26176,10 @@ function buildSwiftResourceTable(project, baseUrl) {
|
|
|
26017
26176
|
return { table, images, colors, symbols, watched };
|
|
26018
26177
|
}
|
|
26019
26178
|
function buildSwiftBundleFiles(packagePath, hosted) {
|
|
26020
|
-
packagePath =
|
|
26179
|
+
packagePath = import_node_fs16.default.realpathSync(packagePath);
|
|
26021
26180
|
const limits = inputLimits(hosted);
|
|
26022
26181
|
const relative3 = resourceCandidateFiles(packagePath).map(
|
|
26023
|
-
(file) =>
|
|
26182
|
+
(file) => import_node_path17.default.relative(packagePath, file).split(import_node_path17.default.sep).join(import_node_path17.default.posix.sep)
|
|
26024
26183
|
);
|
|
26025
26184
|
const files = {};
|
|
26026
26185
|
const watched = [];
|
|
@@ -26034,13 +26193,13 @@ function buildSwiftBundleFiles(packagePath, hosted) {
|
|
|
26034
26193
|
total += bytes.length;
|
|
26035
26194
|
if (xcode.app.infoPlistFile)
|
|
26036
26195
|
watched.push(
|
|
26037
|
-
|
|
26196
|
+
import_node_path17.default.relative(packagePath, xcode.app.infoPlistFile).split(import_node_path17.default.sep).join("/")
|
|
26038
26197
|
);
|
|
26039
26198
|
}
|
|
26040
26199
|
for (const { base, file } of enumerateBundleJson(relative3)) {
|
|
26041
26200
|
watched.push(file);
|
|
26042
|
-
const disk =
|
|
26043
|
-
if (Object.keys(files).length >= limits.resources || total +
|
|
26201
|
+
const disk = import_node_path17.default.join(packagePath, ...file.split("/"));
|
|
26202
|
+
if (Object.keys(files).length >= limits.resources || total + import_node_fs16.default.statSync(disk).size > limits.resourceTotalBytes) {
|
|
26044
26203
|
throw new Error(
|
|
26045
26204
|
`swift bundle pack exceeds ${limits.resources} files / ${limits.resourceTotalBytes} bytes`
|
|
26046
26205
|
);
|
|
@@ -26055,12 +26214,12 @@ function serveSwiftResource(project, key) {
|
|
|
26055
26214
|
return project.resourceFiles.get(key) ?? project.resourcesPrevious.get(key) ?? null;
|
|
26056
26215
|
}
|
|
26057
26216
|
function linkedModuleRoots(packagePath) {
|
|
26058
|
-
packagePath =
|
|
26217
|
+
packagePath = import_node_fs16.default.realpathSync(packagePath);
|
|
26059
26218
|
let manifest;
|
|
26060
26219
|
try {
|
|
26061
26220
|
manifest = readPackageFile(
|
|
26062
26221
|
packagePath,
|
|
26063
|
-
|
|
26222
|
+
import_node_path17.default.join(packagePath, "Package.swift"),
|
|
26064
26223
|
MAX_SWIFT_COMPILE_SOURCE_BYTES
|
|
26065
26224
|
).toString("utf8");
|
|
26066
26225
|
} catch {
|
|
@@ -26069,28 +26228,28 @@ function linkedModuleRoots(packagePath) {
|
|
|
26069
26228
|
const roots = /* @__PURE__ */ new Set();
|
|
26070
26229
|
const dependency = /\.package\(\s*path:\s*"([^"]+)"\s*\)/g;
|
|
26071
26230
|
for (const match of manifest.replace(/^\s*\/\/.*$/gm, "").matchAll(dependency)) {
|
|
26072
|
-
const root =
|
|
26073
|
-
if (
|
|
26231
|
+
const root = import_node_path17.default.resolve(packagePath, match[1]);
|
|
26232
|
+
if (import_node_fs16.default.existsSync(import_node_path17.default.join(root, "Package.swift"))) roots.add(root);
|
|
26074
26233
|
}
|
|
26075
26234
|
return [...roots].sort();
|
|
26076
26235
|
}
|
|
26077
26236
|
function sourceStamp(packagePath, moduleRootOverride, hosted = false) {
|
|
26078
|
-
const hash = (0,
|
|
26237
|
+
const hash = (0, import_node_crypto6.createHash)("sha256");
|
|
26079
26238
|
hash.update(packagePath);
|
|
26080
26239
|
const projectInputs = new Set(packageFiles(packagePath));
|
|
26081
26240
|
for (const file of [...projectInputs].sort()) {
|
|
26082
|
-
hash.update(
|
|
26083
|
-
const stat2 =
|
|
26241
|
+
hash.update(import_node_path17.default.relative(packagePath, file));
|
|
26242
|
+
const stat2 = import_node_fs16.default.statSync(file);
|
|
26084
26243
|
hash.update(`${stat2.mtimeMs}/${stat2.ctimeMs}/${stat2.size}`);
|
|
26085
26244
|
}
|
|
26086
26245
|
const moduleRoot = hosted ? void 0 : moduleRootOverride ?? linkedModuleRoots(packagePath).find(
|
|
26087
|
-
(root) =>
|
|
26246
|
+
(root) => import_node_fs16.default.existsSync(import_node_path17.default.join(root, "toolchain.json"))
|
|
26088
26247
|
);
|
|
26089
26248
|
if (moduleRoot) {
|
|
26090
26249
|
hash.update(moduleRoot);
|
|
26091
26250
|
for (const relative3 of swiftModuleInputFiles(moduleRoot)) {
|
|
26092
26251
|
hash.update(relative3);
|
|
26093
|
-
hash.update(String(
|
|
26252
|
+
hash.update(String(import_node_fs16.default.statSync(import_node_path17.default.join(moduleRoot, relative3)).mtimeMs));
|
|
26094
26253
|
}
|
|
26095
26254
|
}
|
|
26096
26255
|
return hash.digest("hex").slice(0, 16);
|
|
@@ -26102,8 +26261,8 @@ function packageSources(packagePath) {
|
|
|
26102
26261
|
const xcode = xcodeLayout(packagePath);
|
|
26103
26262
|
const files = {};
|
|
26104
26263
|
for (const file of sourceFiles(packagePath)) {
|
|
26105
|
-
const relative3 =
|
|
26106
|
-
if (xcode &&
|
|
26264
|
+
const relative3 = import_node_path17.default.relative(packagePath, file).split(import_node_path17.default.sep).join(import_node_path17.default.posix.sep);
|
|
26265
|
+
if (xcode && import_node_path17.default.basename(file) === "Package.swift") continue;
|
|
26107
26266
|
files[xcode ? xcodeInputKey(xcode, file, relative3) : relative3] = readPackageFile(
|
|
26108
26267
|
packagePath,
|
|
26109
26268
|
file,
|
|
@@ -26120,7 +26279,7 @@ function packageSnapshot(project) {
|
|
|
26120
26279
|
files,
|
|
26121
26280
|
resourcePaths: swiftImplicitResourcePaths(
|
|
26122
26281
|
resourceCandidateFiles(project.packagePath).map(
|
|
26123
|
-
(file) =>
|
|
26282
|
+
(file) => import_node_path17.default.relative(project.packagePath, file).split(import_node_path17.default.sep).join(import_node_path17.default.posix.sep)
|
|
26124
26283
|
)
|
|
26125
26284
|
),
|
|
26126
26285
|
resources: buildSwiftResourceTable(project, ""),
|
|
@@ -26129,7 +26288,7 @@ function packageSnapshot(project) {
|
|
|
26129
26288
|
...native ? {
|
|
26130
26289
|
glue: readPackageFile(
|
|
26131
26290
|
project.packagePath,
|
|
26132
|
-
|
|
26291
|
+
import_node_path17.default.join(project.packagePath, NATIVE_GLUE),
|
|
26133
26292
|
MAX_SWIFT_COMPILE_SOURCE_BYTES
|
|
26134
26293
|
).toString("utf8")
|
|
26135
26294
|
} : {}
|
|
@@ -26165,7 +26324,7 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
|
|
|
26165
26324
|
package: content
|
|
26166
26325
|
};
|
|
26167
26326
|
const moduleRoot = moduleRootOverride ?? linkedModuleRoots(packagePath).find(
|
|
26168
|
-
(root) =>
|
|
26327
|
+
(root) => import_node_fs16.default.existsSync(import_node_path17.default.join(root, "toolchain.json"))
|
|
26169
26328
|
) ?? await swiftDistributionRoot();
|
|
26170
26329
|
if (!moduleRoot)
|
|
26171
26330
|
return {
|
|
@@ -26191,10 +26350,10 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
|
|
|
26191
26350
|
// server and a capture, or two checkouts) build each other's sources. so
|
|
26192
26351
|
// each app and module checkout gets its own root, which keeps the same
|
|
26193
26352
|
// app's incremental build across restarts.
|
|
26194
|
-
buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ??
|
|
26195
|
-
|
|
26353
|
+
buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ?? import_node_path17.default.join(
|
|
26354
|
+
import_node_os6.default.tmpdir(),
|
|
26196
26355
|
"contrast-swift-build",
|
|
26197
|
-
(0,
|
|
26356
|
+
(0, import_node_crypto6.createHash)("sha256").update(`${moduleRoot}\0${import_node_path17.default.resolve(packagePath)}`).digest("hex").slice(0, 16)
|
|
26198
26357
|
),
|
|
26199
26358
|
moduleRoot,
|
|
26200
26359
|
...toolchain
|
|
@@ -26245,19 +26404,19 @@ function swiftApiGapReport(output) {
|
|
|
26245
26404
|
}
|
|
26246
26405
|
function missingModulesMessage(packagePath, missing) {
|
|
26247
26406
|
const layout = xcodeLayout(packagePath);
|
|
26248
|
-
const
|
|
26249
|
-
(layout?.app.
|
|
26250
|
-
|
|
26251
|
-
|
|
26252
|
-
]
|
|
26253
|
-
|
|
26407
|
+
const gaps = new Map([
|
|
26408
|
+
...(layout?.app.binaryFrameworks ?? []).map(
|
|
26409
|
+
(name2) => [name2, { source: "the project", reason: "a vendored binary framework" }]
|
|
26410
|
+
),
|
|
26411
|
+
...layout?.packages.modules ?? [],
|
|
26412
|
+
...layout?.packages.unavailable ?? []
|
|
26413
|
+
]);
|
|
26254
26414
|
const width = Math.max(...[...missing.keys()].map((name2) => name2.length));
|
|
26255
26415
|
return [
|
|
26256
26416
|
`Peach does not provide ${missing.size} module${missing.size === 1 ? "" : "s"} this app imports:`,
|
|
26257
26417
|
...[...missing].map(([name2, files]) => {
|
|
26258
|
-
const
|
|
26259
|
-
|
|
26260
|
-
return ` ${name2.padEnd(width)} ${files.length} file${files.length === 1 ? "" : "s"}${source ? `, package ${source}` : ""}${reason ? ` (${reason})` : ""}`;
|
|
26418
|
+
const gap = gaps.get(name2);
|
|
26419
|
+
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
26420
|
})
|
|
26262
26421
|
].join("\n");
|
|
26263
26422
|
}
|
|
@@ -26265,7 +26424,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
|
|
|
26265
26424
|
const auth = hosted ? null : resolveCliAuth();
|
|
26266
26425
|
if (!hosted && (!auth || auth.kind === "github")) {
|
|
26267
26426
|
throw new Error(
|
|
26268
|
-
`compiling ${
|
|
26427
|
+
`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
26428
|
);
|
|
26270
26429
|
}
|
|
26271
26430
|
const origin = hosted?.origin ?? resolveContrastBackendOrigin(auth?.kind === "session" ? auth.origin : null);
|
|
@@ -26284,7 +26443,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
|
|
|
26284
26443
|
const bytes = sources.reduce((total2, text2) => total2 + Buffer.byteLength(text2), 0);
|
|
26285
26444
|
if (sources.length > MAX_SWIFT_COMPILE_FILES || bytes > MAX_SWIFT_COMPILE_SOURCE_BYTES) {
|
|
26286
26445
|
throw new Error(
|
|
26287
|
-
`${
|
|
26446
|
+
`${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
26447
|
);
|
|
26289
26448
|
}
|
|
26290
26449
|
const descriptor = snapshot.native;
|
|
@@ -26303,7 +26462,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
|
|
|
26303
26462
|
);
|
|
26304
26463
|
if (descriptor && address.native?.hash !== descriptor.hash) {
|
|
26305
26464
|
throw new Error(
|
|
26306
|
-
`${
|
|
26465
|
+
`${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
26466
|
);
|
|
26308
26467
|
}
|
|
26309
26468
|
const response = await fetch(address.url, { signal });
|
|
@@ -26420,21 +26579,21 @@ function serveSwiftPackageAsset(pathname, res) {
|
|
|
26420
26579
|
res.end("swift artifact is stale");
|
|
26421
26580
|
return true;
|
|
26422
26581
|
}
|
|
26423
|
-
var
|
|
26582
|
+
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
26583
|
var init_swift_host = __esm({
|
|
26425
26584
|
"src/swift-host.ts"() {
|
|
26426
26585
|
"use strict";
|
|
26427
|
-
|
|
26428
|
-
|
|
26429
|
-
|
|
26430
|
-
|
|
26586
|
+
import_node_crypto6 = require("node:crypto");
|
|
26587
|
+
import_node_fs16 = __toESM(require("node:fs"), 1);
|
|
26588
|
+
import_node_os6 = __toESM(require("node:os"), 1);
|
|
26589
|
+
import_node_path17 = __toESM(require("node:path"), 1);
|
|
26431
26590
|
init_bundleAssets();
|
|
26432
26591
|
init_auth();
|
|
26433
26592
|
init_backend_origin();
|
|
26434
26593
|
init_swift_compile();
|
|
26435
26594
|
init_swift_distribution();
|
|
26436
26595
|
init_swift_package();
|
|
26437
|
-
|
|
26596
|
+
init_swift_packages();
|
|
26438
26597
|
init_swift_submit();
|
|
26439
26598
|
init_xcode_project();
|
|
26440
26599
|
ARTIFACT_PATH = "/__peach/swift/";
|
|
@@ -26455,7 +26614,7 @@ var init_swift_host = __esm({
|
|
|
26455
26614
|
XCODE_APP_DIR = "__app__";
|
|
26456
26615
|
XCODE_FRAMEWORKS_DIR = "__frameworks__";
|
|
26457
26616
|
XCODE_PACKAGES_DIR = "__packages__";
|
|
26458
|
-
CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(
|
|
26617
|
+
CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(import_node_path17.default.sep).join(import_node_path17.default.posix.sep)}/`;
|
|
26459
26618
|
HOSTED_LIMITS = {
|
|
26460
26619
|
resources: MAX_SWIFT_COMPILE_RESOURCES,
|
|
26461
26620
|
resourceBytes: MAX_SWIFT_COMPILE_RESOURCE_BYTES,
|
|
@@ -26502,8 +26661,8 @@ var init_swift_host = __esm({
|
|
|
26502
26661
|
|
|
26503
26662
|
// src/expo-swift-host.ts
|
|
26504
26663
|
async function collectExpoSwiftSources(appRoot) {
|
|
26505
|
-
appRoot =
|
|
26506
|
-
const appRequire = (0, import_node_module.createRequire)(
|
|
26664
|
+
appRoot = import_node_fs17.default.realpathSync(appRoot);
|
|
26665
|
+
const appRequire = (0, import_node_module.createRequire)(import_node_path18.default.join(appRoot, "package.json"));
|
|
26507
26666
|
let autolinker;
|
|
26508
26667
|
try {
|
|
26509
26668
|
autolinker = appRequire.resolve("expo-modules-autolinking/package.json");
|
|
@@ -26517,7 +26676,7 @@ async function collectExpoSwiftSources(appRoot) {
|
|
|
26517
26676
|
(command) => run3(
|
|
26518
26677
|
process.execPath,
|
|
26519
26678
|
[
|
|
26520
|
-
|
|
26679
|
+
import_node_path18.default.join(import_node_path18.default.dirname(autolinker), "bin/expo-modules-autolinking.js"),
|
|
26521
26680
|
command,
|
|
26522
26681
|
"--platform",
|
|
26523
26682
|
"apple",
|
|
@@ -26548,8 +26707,8 @@ async function collectExpoSwiftSources(appRoot) {
|
|
|
26548
26707
|
const sourceRoot = Reflect.get(entry, "path");
|
|
26549
26708
|
if (typeof sourceRoot !== "string")
|
|
26550
26709
|
throw new Error("Expo autolinking entry has no path");
|
|
26551
|
-
const canonical =
|
|
26552
|
-
if (canonical.split(
|
|
26710
|
+
const canonical = import_node_fs17.default.realpathSync(sourceRoot);
|
|
26711
|
+
if (canonical.split(import_node_path18.default.sep).includes("node_modules")) continue;
|
|
26553
26712
|
const resolution = resolutions.find(
|
|
26554
26713
|
(candidate) => candidate && typeof candidate === "object" && Reflect.get(candidate, "packageName") === Reflect.get(entry, "name")
|
|
26555
26714
|
);
|
|
@@ -26575,12 +26734,12 @@ async function collectExpoSwiftSources(appRoot) {
|
|
|
26575
26734
|
`(${className.includes(".") ? className : `${namespace}.${className}`}.self, ${name2 === null ? "nil" : JSON.stringify(name2)})`
|
|
26576
26735
|
);
|
|
26577
26736
|
}
|
|
26578
|
-
const ios =
|
|
26579
|
-
if (
|
|
26737
|
+
const ios = import_node_path18.default.join(canonical, "ios");
|
|
26738
|
+
if (import_node_fs17.default.lstatSync(ios).isSymbolicLink())
|
|
26580
26739
|
throw new Error(`Expo Swift source directory is a symlink: ${ios}`);
|
|
26581
26740
|
const walk2 = (dir) => {
|
|
26582
|
-
for (const child of
|
|
26583
|
-
const file =
|
|
26741
|
+
for (const child of import_node_fs17.default.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
26742
|
+
const file = import_node_path18.default.join(dir, child.name);
|
|
26584
26743
|
if (child.isSymbolicLink())
|
|
26585
26744
|
throw new Error(`Expo Swift source is a symlink: ${file}`);
|
|
26586
26745
|
if (child.isDirectory()) {
|
|
@@ -26588,13 +26747,13 @@ async function collectExpoSwiftSources(appRoot) {
|
|
|
26588
26747
|
continue;
|
|
26589
26748
|
}
|
|
26590
26749
|
if (!child.name.endsWith(".swift")) continue;
|
|
26591
|
-
const size =
|
|
26750
|
+
const size = import_node_fs17.default.statSync(file).size;
|
|
26592
26751
|
bytes += size;
|
|
26593
26752
|
fileCount++;
|
|
26594
26753
|
if (fileCount > MAX_SWIFT_COMPILE_FILES - 2 || bytes > MAX_SWIFT_COMPILE_SOURCE_BYTES)
|
|
26595
26754
|
throw new Error("Expo Swift sources exceed compile service caps");
|
|
26596
|
-
files[`Sources/${namespace}/${
|
|
26597
|
-
${
|
|
26755
|
+
files[`Sources/${namespace}/${import_node_path18.default.relative(ios, file).split(import_node_path18.default.sep).join("/")}`] = `#sourceLocation(file: ${JSON.stringify(file)}, line: 1)
|
|
26756
|
+
${import_node_fs17.default.readFileSync(file, "utf8")}`;
|
|
26598
26757
|
}
|
|
26599
26758
|
};
|
|
26600
26759
|
walk2(ios);
|
|
@@ -26677,7 +26836,7 @@ async function handleExpoSwiftRequest(req, res) {
|
|
|
26677
26836
|
return true;
|
|
26678
26837
|
}
|
|
26679
26838
|
const root = url.searchParams.get("root");
|
|
26680
|
-
if (!root || !
|
|
26839
|
+
if (!root || !import_node_path18.default.isAbsolute(root)) {
|
|
26681
26840
|
res.writeHead(400);
|
|
26682
26841
|
res.end("missing absolute app root");
|
|
26683
26842
|
return true;
|
|
@@ -26694,7 +26853,7 @@ async function handleExpoSwiftRequest(req, res) {
|
|
|
26694
26853
|
modules: [],
|
|
26695
26854
|
failures: []
|
|
26696
26855
|
};
|
|
26697
|
-
const key = (0,
|
|
26856
|
+
const key = (0, import_node_crypto7.createHash)("sha256").update(import_node_fs17.default.realpathSync(root)).digest("hex");
|
|
26698
26857
|
const host2 = req.headers.host;
|
|
26699
26858
|
if (!host2) throw new Error("Expo Swift request has no host");
|
|
26700
26859
|
const base = `http://${host2}`;
|
|
@@ -26708,8 +26867,8 @@ async function handleExpoSwiftRequest(req, res) {
|
|
|
26708
26867
|
continue;
|
|
26709
26868
|
}
|
|
26710
26869
|
try {
|
|
26711
|
-
const packagePath =
|
|
26712
|
-
|
|
26870
|
+
const packagePath = import_node_path18.default.join(
|
|
26871
|
+
import_node_os7.default.tmpdir(),
|
|
26713
26872
|
"peach-expo-swift",
|
|
26714
26873
|
key,
|
|
26715
26874
|
unit.namespace
|
|
@@ -26718,7 +26877,7 @@ async function handleExpoSwiftRequest(req, res) {
|
|
|
26718
26877
|
packagePath,
|
|
26719
26878
|
new Map(
|
|
26720
26879
|
Object.entries(unit.files).map(([name2, source]) => [
|
|
26721
|
-
|
|
26880
|
+
import_node_path18.default.join(packagePath, name2),
|
|
26722
26881
|
source
|
|
26723
26882
|
])
|
|
26724
26883
|
)
|
|
@@ -26769,8 +26928,8 @@ async function handleExpoSwiftRequest(req, res) {
|
|
|
26769
26928
|
import PackageDescription
|
|
26770
26929
|
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
26930
|
`;
|
|
26772
|
-
const packagePath =
|
|
26773
|
-
|
|
26931
|
+
const packagePath = import_node_path18.default.join(
|
|
26932
|
+
import_node_os7.default.tmpdir(),
|
|
26774
26933
|
"peach-expo-swift",
|
|
26775
26934
|
key,
|
|
26776
26935
|
"linked-app"
|
|
@@ -26779,7 +26938,7 @@ let package = Package(name: "PeachExpo", targets: [${targets.map((name2) => `.ta
|
|
|
26779
26938
|
packagePath,
|
|
26780
26939
|
new Map(
|
|
26781
26940
|
Object.entries(files).map(([name2, source]) => [
|
|
26782
|
-
|
|
26941
|
+
import_node_path18.default.join(packagePath, name2),
|
|
26783
26942
|
source
|
|
26784
26943
|
])
|
|
26785
26944
|
)
|
|
@@ -26815,16 +26974,16 @@ let package = Package(name: "PeachExpo", targets: [${targets.map((name2) => `.ta
|
|
|
26815
26974
|
}
|
|
26816
26975
|
return true;
|
|
26817
26976
|
}
|
|
26818
|
-
var
|
|
26977
|
+
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
26978
|
var init_expo_swift_host = __esm({
|
|
26820
26979
|
"src/expo-swift-host.ts"() {
|
|
26821
26980
|
"use strict";
|
|
26822
|
-
|
|
26823
|
-
|
|
26824
|
-
|
|
26981
|
+
import_node_child_process9 = require("node:child_process");
|
|
26982
|
+
import_node_crypto7 = require("node:crypto");
|
|
26983
|
+
import_node_fs17 = __toESM(require("node:fs"), 1);
|
|
26825
26984
|
import_node_module = require("node:module");
|
|
26826
|
-
|
|
26827
|
-
|
|
26985
|
+
import_node_os7 = __toESM(require("node:os"), 1);
|
|
26986
|
+
import_node_path18 = __toESM(require("node:path"), 1);
|
|
26828
26987
|
import_node_util3 = require("node:util");
|
|
26829
26988
|
init_internal_child();
|
|
26830
26989
|
init_backend_origin();
|
|
@@ -26832,7 +26991,7 @@ var init_expo_swift_host = __esm({
|
|
|
26832
26991
|
init_swift_distribution();
|
|
26833
26992
|
init_swift_host();
|
|
26834
26993
|
init_swift_submit();
|
|
26835
|
-
run3 = (0, import_node_util3.promisify)(
|
|
26994
|
+
run3 = (0, import_node_util3.promisify)(import_node_child_process9.execFile);
|
|
26836
26995
|
scriptEnv = { ...process.env, [RNX_FORKED_SCRIPT_ENV]: "1" };
|
|
26837
26996
|
EXPO_SWIFT_ROUTE = "/__peach/expo-swift";
|
|
26838
26997
|
EXPO_SWIFT_ENTRY = "Sources/PeachExpoApp/PeachExpoEntry.swift";
|
|
@@ -27008,14 +27167,14 @@ var init_standalone = __esm({
|
|
|
27008
27167
|
// cli/self-invocation.ts
|
|
27009
27168
|
function sourceEntryPath() {
|
|
27010
27169
|
try {
|
|
27011
|
-
const candidate = (0,
|
|
27012
|
-
return (0,
|
|
27170
|
+
const candidate = (0, import_node_path19.join)((0, import_node_path19.dirname)((0, import_node_url3.fileURLToPath)(__sootsim_import_meta_url)), "bin.ts");
|
|
27171
|
+
return (0, import_node_fs18.existsSync)(candidate) ? candidate : null;
|
|
27013
27172
|
} catch {
|
|
27014
27173
|
return null;
|
|
27015
27174
|
}
|
|
27016
27175
|
}
|
|
27017
|
-
function isCliEntry(
|
|
27018
|
-
const name2 = (0,
|
|
27176
|
+
function isCliEntry(path35) {
|
|
27177
|
+
const name2 = (0, import_node_path19.basename)(path35);
|
|
27019
27178
|
return name2 === "bin.ts" || name2 === "bin.js";
|
|
27020
27179
|
}
|
|
27021
27180
|
function rnxSelfInvocation() {
|
|
@@ -27033,12 +27192,12 @@ function rnxSelfInvocation() {
|
|
|
27033
27192
|
}
|
|
27034
27193
|
return { executable: process.execPath, prefixArgs: [entry] };
|
|
27035
27194
|
}
|
|
27036
|
-
var
|
|
27195
|
+
var import_node_fs18, import_node_path19, import_node_url3;
|
|
27037
27196
|
var init_self_invocation = __esm({
|
|
27038
27197
|
"cli/self-invocation.ts"() {
|
|
27039
27198
|
"use strict";
|
|
27040
|
-
|
|
27041
|
-
|
|
27199
|
+
import_node_fs18 = require("node:fs");
|
|
27200
|
+
import_node_path19 = require("node:path");
|
|
27042
27201
|
import_node_url3 = require("node:url");
|
|
27043
27202
|
init_public_brand();
|
|
27044
27203
|
init_standalone();
|
|
@@ -27106,7 +27265,7 @@ function getUserDataDir() {
|
|
|
27106
27265
|
return userDataDir();
|
|
27107
27266
|
}
|
|
27108
27267
|
function storeFile() {
|
|
27109
|
-
return
|
|
27268
|
+
return import_node_path20.default.join(userDataDir(), "attached-projects.json");
|
|
27110
27269
|
}
|
|
27111
27270
|
function cloneEmpty() {
|
|
27112
27271
|
return {
|
|
@@ -27120,7 +27279,7 @@ function loadStore() {
|
|
|
27120
27279
|
const file = storeFile();
|
|
27121
27280
|
let raw2;
|
|
27122
27281
|
try {
|
|
27123
|
-
raw2 =
|
|
27282
|
+
raw2 = import_node_fs19.default.readFileSync(file, "utf8");
|
|
27124
27283
|
} catch (err) {
|
|
27125
27284
|
if (err.code === "ENOENT") return cloneEmpty();
|
|
27126
27285
|
throw err;
|
|
@@ -27137,7 +27296,7 @@ function loadStore() {
|
|
|
27137
27296
|
} catch (err) {
|
|
27138
27297
|
const quarantine = `${file}.corrupt-${Date.now()}`;
|
|
27139
27298
|
try {
|
|
27140
|
-
|
|
27299
|
+
import_node_fs19.default.renameSync(file, quarantine);
|
|
27141
27300
|
console.warn(
|
|
27142
27301
|
`[sootsim] attached-projects.json was unparseable; quarantined to ${quarantine}. original error: ${err.message}`
|
|
27143
27302
|
);
|
|
@@ -27148,16 +27307,16 @@ function loadStore() {
|
|
|
27148
27307
|
}
|
|
27149
27308
|
function writeStore(store) {
|
|
27150
27309
|
const file = storeFile();
|
|
27151
|
-
|
|
27310
|
+
import_node_fs19.default.mkdirSync(import_node_path20.default.dirname(file), { recursive: true });
|
|
27152
27311
|
const tmp = `${file}.tmp-${process.pid}-${Date.now()}`;
|
|
27153
|
-
const fd =
|
|
27312
|
+
const fd = import_node_fs19.default.openSync(tmp, "w", 384);
|
|
27154
27313
|
try {
|
|
27155
|
-
|
|
27156
|
-
|
|
27314
|
+
import_node_fs19.default.writeFileSync(fd, JSON.stringify(store, null, 2));
|
|
27315
|
+
import_node_fs19.default.fsyncSync(fd);
|
|
27157
27316
|
} finally {
|
|
27158
|
-
|
|
27317
|
+
import_node_fs19.default.closeSync(fd);
|
|
27159
27318
|
}
|
|
27160
|
-
|
|
27319
|
+
import_node_fs19.default.renameSync(tmp, file);
|
|
27161
27320
|
}
|
|
27162
27321
|
function mutateStore(fn) {
|
|
27163
27322
|
const store = loadStore();
|
|
@@ -27166,13 +27325,13 @@ function mutateStore(fn) {
|
|
|
27166
27325
|
return store;
|
|
27167
27326
|
}
|
|
27168
27327
|
function projectIdForCwd(cwd) {
|
|
27169
|
-
return (0,
|
|
27328
|
+
return (0, import_node_crypto8.createHash)("sha256").update(import_node_path20.default.resolve(cwd)).digest("hex").slice(0, 16);
|
|
27170
27329
|
}
|
|
27171
27330
|
function newSessionId() {
|
|
27172
|
-
return `s_${(0,
|
|
27331
|
+
return `s_${(0, import_node_crypto8.randomBytes)(10).toString("hex")}`;
|
|
27173
27332
|
}
|
|
27174
27333
|
function upsertProject(input) {
|
|
27175
|
-
const cwd =
|
|
27334
|
+
const cwd = import_node_path20.default.resolve(input.cwd);
|
|
27176
27335
|
const id = projectIdForCwd(cwd);
|
|
27177
27336
|
let result;
|
|
27178
27337
|
mutateStore((store) => {
|
|
@@ -27198,7 +27357,7 @@ function upsertProject(input) {
|
|
|
27198
27357
|
const now = Date.now();
|
|
27199
27358
|
const created = {
|
|
27200
27359
|
id,
|
|
27201
|
-
name: input.name ??
|
|
27360
|
+
name: input.name ?? import_node_path20.default.basename(cwd),
|
|
27202
27361
|
cwd,
|
|
27203
27362
|
repoRoot: input.repoRoot,
|
|
27204
27363
|
sourceRoots: input.sourceRoots ?? [cwd],
|
|
@@ -27343,8 +27502,8 @@ async function seedFromDemoAppRegistry() {
|
|
|
27343
27502
|
if (apps.length === 0) return;
|
|
27344
27503
|
mutateStore((store) => {
|
|
27345
27504
|
for (const app of apps) {
|
|
27346
|
-
if (!
|
|
27347
|
-
const cwd =
|
|
27505
|
+
if (!import_node_fs19.default.existsSync(app.dir)) continue;
|
|
27506
|
+
const cwd = import_node_path20.default.resolve(app.dir);
|
|
27348
27507
|
const id = projectIdForCwd(cwd);
|
|
27349
27508
|
if (store.attachedProjects.some((p) => p.id === id)) continue;
|
|
27350
27509
|
const now = Date.now();
|
|
@@ -27365,13 +27524,13 @@ async function seedFromDemoAppRegistry() {
|
|
|
27365
27524
|
}
|
|
27366
27525
|
});
|
|
27367
27526
|
}
|
|
27368
|
-
var
|
|
27527
|
+
var import_node_crypto8, import_node_fs19, import_node_path20, overrideDir, COST_HISTORY_MAX_AGE_MS;
|
|
27369
27528
|
var init_attached_projects = __esm({
|
|
27370
27529
|
"src/attached-projects.ts"() {
|
|
27371
27530
|
"use strict";
|
|
27372
|
-
|
|
27373
|
-
|
|
27374
|
-
|
|
27531
|
+
import_node_crypto8 = require("node:crypto");
|
|
27532
|
+
import_node_fs19 = __toESM(require("node:fs"), 1);
|
|
27533
|
+
import_node_path20 = __toESM(require("node:path"), 1);
|
|
27375
27534
|
init_home_paths();
|
|
27376
27535
|
overrideDir = null;
|
|
27377
27536
|
COST_HISTORY_MAX_AGE_MS = 14 * 24 * 60 * 60 * 1e3;
|
|
@@ -27380,16 +27539,16 @@ var init_attached_projects = __esm({
|
|
|
27380
27539
|
|
|
27381
27540
|
// src/agent-sessions.ts
|
|
27382
27541
|
function sessionDir(sessionId) {
|
|
27383
|
-
return
|
|
27542
|
+
return import_node_path21.default.join(getUserDataDir(), "sessions", sessionId);
|
|
27384
27543
|
}
|
|
27385
27544
|
function promptFifoPath(sessionId) {
|
|
27386
|
-
return
|
|
27545
|
+
return import_node_path21.default.join(sessionDir(sessionId), "prompt.in");
|
|
27387
27546
|
}
|
|
27388
27547
|
function eventsFifoPath(sessionId) {
|
|
27389
|
-
return
|
|
27548
|
+
return import_node_path21.default.join(sessionDir(sessionId), "events.out");
|
|
27390
27549
|
}
|
|
27391
27550
|
function transcriptPath(sessionId) {
|
|
27392
|
-
return
|
|
27551
|
+
return import_node_path21.default.join(getUserDataDir(), "transcripts", `${sessionId}.log`);
|
|
27393
27552
|
}
|
|
27394
27553
|
function pidIsAlive(pid, sessionId) {
|
|
27395
27554
|
if (!pid) return false;
|
|
@@ -27399,7 +27558,7 @@ function pidIsAlive(pid, sessionId) {
|
|
|
27399
27558
|
return false;
|
|
27400
27559
|
}
|
|
27401
27560
|
if (sessionId) {
|
|
27402
|
-
if (!
|
|
27561
|
+
if (!import_node_fs20.default.existsSync(sessionDir(sessionId))) return false;
|
|
27403
27562
|
}
|
|
27404
27563
|
return true;
|
|
27405
27564
|
}
|
|
@@ -27412,11 +27571,11 @@ function resolveSootsimInvocation() {
|
|
|
27412
27571
|
const resourcesPath = process.resourcesPath;
|
|
27413
27572
|
if (resourcesPath) {
|
|
27414
27573
|
const candidates = [
|
|
27415
|
-
|
|
27416
|
-
|
|
27574
|
+
import_node_path21.default.join(resourcesPath, "bin", "sootsim"),
|
|
27575
|
+
import_node_path21.default.join(resourcesPath, "bin", `sootsim-${process.platform}-${process.arch}`)
|
|
27417
27576
|
];
|
|
27418
27577
|
for (const c of candidates) {
|
|
27419
|
-
if (
|
|
27578
|
+
if (import_node_fs20.default.existsSync(c)) return { executable: c, prefixArgs: [] };
|
|
27420
27579
|
}
|
|
27421
27580
|
}
|
|
27422
27581
|
}
|
|
@@ -27435,15 +27594,15 @@ function tryWorkspaceSootsim() {
|
|
|
27435
27594
|
const sootsimDir = resolveSootsimPackageDir();
|
|
27436
27595
|
if (!sootsimDir) return null;
|
|
27437
27596
|
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 (
|
|
27597
|
+
const distBinary = import_node_path21.default.join(sootsimDir, "dist-bin", binaryName);
|
|
27598
|
+
if (import_node_fs20.default.existsSync(distBinary)) return { executable: distBinary, prefixArgs: [] };
|
|
27599
|
+
const distBin = import_node_path21.default.join(sootsimDir, "dist-cli", "bin.js");
|
|
27600
|
+
if (import_node_fs20.default.existsSync(distBin)) {
|
|
27442
27601
|
try {
|
|
27443
|
-
const src =
|
|
27444
|
-
if (
|
|
27445
|
-
const srcMtime =
|
|
27446
|
-
const buildMtime =
|
|
27602
|
+
const src = import_node_path21.default.join(sootsimDir, "cli", "commands", "agent-wrapper.ts");
|
|
27603
|
+
if (import_node_fs20.default.existsSync(src)) {
|
|
27604
|
+
const srcMtime = import_node_fs20.default.statSync(src).mtimeMs;
|
|
27605
|
+
const buildMtime = import_node_fs20.default.statSync(distBin).mtimeMs;
|
|
27447
27606
|
if (buildMtime < srcMtime) {
|
|
27448
27607
|
console.warn(
|
|
27449
27608
|
`[peach] dist-cli/bin.js is older than agent-wrapper.ts \u2014 rebuild with \`bun run --cwd packages/peachsim build:cli\`.`
|
|
@@ -27462,22 +27621,22 @@ function tryWorkspaceSootsim() {
|
|
|
27462
27621
|
function resolveSootsimPackageDir() {
|
|
27463
27622
|
try {
|
|
27464
27623
|
const resolved = require.resolve(`${rnxPublicBrand.packageName}/package.json`);
|
|
27465
|
-
return
|
|
27624
|
+
return import_node_path21.default.dirname(resolved);
|
|
27466
27625
|
} catch {
|
|
27467
27626
|
}
|
|
27468
27627
|
const here = fileFromImportMeta();
|
|
27469
27628
|
if (!here) return null;
|
|
27470
|
-
let cur =
|
|
27629
|
+
let cur = import_node_path21.default.dirname(here);
|
|
27471
27630
|
for (let i = 0; i < 8; i++) {
|
|
27472
|
-
const pkg =
|
|
27631
|
+
const pkg = import_node_path21.default.join(cur, "package.json");
|
|
27473
27632
|
try {
|
|
27474
|
-
if (
|
|
27475
|
-
const parsed = JSON.parse(
|
|
27633
|
+
if (import_node_fs20.default.existsSync(pkg)) {
|
|
27634
|
+
const parsed = JSON.parse(import_node_fs20.default.readFileSync(pkg, "utf8"));
|
|
27476
27635
|
if (parsed.name === rnxPublicBrand.packageName) return cur;
|
|
27477
27636
|
}
|
|
27478
27637
|
} catch {
|
|
27479
27638
|
}
|
|
27480
|
-
const parent =
|
|
27639
|
+
const parent = import_node_path21.default.dirname(cur);
|
|
27481
27640
|
if (parent === cur) break;
|
|
27482
27641
|
cur = parent;
|
|
27483
27642
|
}
|
|
@@ -27493,28 +27652,28 @@ function fileFromImportMeta() {
|
|
|
27493
27652
|
}
|
|
27494
27653
|
}
|
|
27495
27654
|
async function withStartLock(projectId, provider, fn) {
|
|
27496
|
-
const lockDir =
|
|
27497
|
-
|
|
27655
|
+
const lockDir = import_node_path21.default.join(getUserDataDir(), "locks");
|
|
27656
|
+
import_node_fs20.default.mkdirSync(lockDir, { recursive: true });
|
|
27498
27657
|
try {
|
|
27499
|
-
|
|
27658
|
+
import_node_fs20.default.chmodSync(lockDir, 448);
|
|
27500
27659
|
} catch {
|
|
27501
27660
|
}
|
|
27502
|
-
const lockPath =
|
|
27661
|
+
const lockPath = import_node_path21.default.join(lockDir, `start-${projectId}-${provider}.lock`);
|
|
27503
27662
|
const deadline = Date.now() + 4e3;
|
|
27504
27663
|
let fd = null;
|
|
27505
27664
|
while (fd === null) {
|
|
27506
27665
|
try {
|
|
27507
|
-
fd =
|
|
27666
|
+
fd = import_node_fs20.default.openSync(
|
|
27508
27667
|
lockPath,
|
|
27509
|
-
|
|
27668
|
+
import_node_fs20.constants.O_WRONLY | import_node_fs20.constants.O_CREAT | import_node_fs20.constants.O_EXCL,
|
|
27510
27669
|
384
|
|
27511
27670
|
);
|
|
27512
27671
|
} catch (err) {
|
|
27513
27672
|
if (err.code !== "EEXIST") throw err;
|
|
27514
27673
|
try {
|
|
27515
|
-
const stale = Number(
|
|
27674
|
+
const stale = Number(import_node_fs20.default.readFileSync(lockPath, "utf8").trim());
|
|
27516
27675
|
if (stale && !isProcessAlive(stale)) {
|
|
27517
|
-
|
|
27676
|
+
import_node_fs20.default.unlinkSync(lockPath);
|
|
27518
27677
|
continue;
|
|
27519
27678
|
}
|
|
27520
27679
|
} catch {
|
|
@@ -27528,15 +27687,15 @@ async function withStartLock(projectId, provider, fn) {
|
|
|
27528
27687
|
}
|
|
27529
27688
|
}
|
|
27530
27689
|
try {
|
|
27531
|
-
|
|
27690
|
+
import_node_fs20.default.writeFileSync(fd, String(process.pid));
|
|
27532
27691
|
return await fn();
|
|
27533
27692
|
} finally {
|
|
27534
27693
|
try {
|
|
27535
|
-
|
|
27694
|
+
import_node_fs20.default.closeSync(fd);
|
|
27536
27695
|
} catch {
|
|
27537
27696
|
}
|
|
27538
27697
|
try {
|
|
27539
|
-
|
|
27698
|
+
import_node_fs20.default.unlinkSync(lockPath);
|
|
27540
27699
|
} catch {
|
|
27541
27700
|
}
|
|
27542
27701
|
}
|
|
@@ -27550,28 +27709,28 @@ function isProcessAlive(pid) {
|
|
|
27550
27709
|
}
|
|
27551
27710
|
}
|
|
27552
27711
|
function mkfifoSync(p) {
|
|
27553
|
-
const parent =
|
|
27554
|
-
|
|
27712
|
+
const parent = import_node_path21.default.dirname(p);
|
|
27713
|
+
import_node_fs20.default.mkdirSync(parent, { recursive: true });
|
|
27555
27714
|
try {
|
|
27556
|
-
|
|
27715
|
+
import_node_fs20.default.chmodSync(parent, 448);
|
|
27557
27716
|
} catch {
|
|
27558
27717
|
}
|
|
27559
|
-
if (
|
|
27718
|
+
if (import_node_fs20.default.existsSync(p)) {
|
|
27560
27719
|
try {
|
|
27561
|
-
const stat2 =
|
|
27720
|
+
const stat2 = import_node_fs20.default.statSync(p);
|
|
27562
27721
|
if (stat2.isFIFO()) {
|
|
27563
27722
|
try {
|
|
27564
|
-
|
|
27723
|
+
import_node_fs20.default.chmodSync(p, 384);
|
|
27565
27724
|
} catch {
|
|
27566
27725
|
}
|
|
27567
27726
|
return;
|
|
27568
27727
|
}
|
|
27569
|
-
|
|
27728
|
+
import_node_fs20.default.unlinkSync(p);
|
|
27570
27729
|
} catch {
|
|
27571
|
-
|
|
27730
|
+
import_node_fs20.default.unlinkSync(p);
|
|
27572
27731
|
}
|
|
27573
27732
|
}
|
|
27574
|
-
const result = (0,
|
|
27733
|
+
const result = (0, import_node_child_process10.spawnSync)("mkfifo", ["-m", "600", p]);
|
|
27575
27734
|
if (result.status !== 0) {
|
|
27576
27735
|
throw new Error(
|
|
27577
27736
|
`mkfifo(${p}) failed: ${result.stderr?.toString().trim() || "unknown error"}`
|
|
@@ -27594,7 +27753,7 @@ async function startSession(opts) {
|
|
|
27594
27753
|
`session already running for project=${project.id} provider=${provider} (session ${existingLive.id}, pid ${existingLive.wrapperPid}). end it first with \`peach agent end <sessionId>\`.`
|
|
27595
27754
|
);
|
|
27596
27755
|
}
|
|
27597
|
-
const claudeSessionUuid = provider === "claude" ? (0,
|
|
27756
|
+
const claudeSessionUuid = provider === "claude" ? (0, import_node_crypto9.randomUUID)() : void 0;
|
|
27598
27757
|
const session = upsertSession({
|
|
27599
27758
|
projectId: project.id,
|
|
27600
27759
|
provider,
|
|
@@ -27608,10 +27767,10 @@ async function startSession(opts) {
|
|
|
27608
27767
|
const transcript = transcriptPath(session.id);
|
|
27609
27768
|
mkfifoSync(promptIn);
|
|
27610
27769
|
mkfifoSync(eventsOut);
|
|
27611
|
-
const transcriptDir =
|
|
27612
|
-
|
|
27770
|
+
const transcriptDir = import_node_path21.default.dirname(transcript);
|
|
27771
|
+
import_node_fs20.default.mkdirSync(transcriptDir, { recursive: true });
|
|
27613
27772
|
try {
|
|
27614
|
-
|
|
27773
|
+
import_node_fs20.default.chmodSync(transcriptDir, 448);
|
|
27615
27774
|
} catch {
|
|
27616
27775
|
}
|
|
27617
27776
|
const { executable, prefixArgs } = resolveSootsimInvocation();
|
|
@@ -27639,7 +27798,7 @@ async function startSession(opts) {
|
|
|
27639
27798
|
if (claudeSessionUuid) {
|
|
27640
27799
|
wrapperArgs.push("--claude-session-uuid", claudeSessionUuid);
|
|
27641
27800
|
}
|
|
27642
|
-
const child = (0,
|
|
27801
|
+
const child = (0, import_node_child_process10.spawn)(executable, wrapperArgs, {
|
|
27643
27802
|
detached: true,
|
|
27644
27803
|
stdio: "ignore",
|
|
27645
27804
|
env: {
|
|
@@ -27662,7 +27821,7 @@ async function startSession(opts) {
|
|
|
27662
27821
|
}
|
|
27663
27822
|
}
|
|
27664
27823
|
try {
|
|
27665
|
-
|
|
27824
|
+
import_node_fs20.default.rmSync(sessionDir(session.id), { recursive: true, force: true });
|
|
27666
27825
|
} catch {
|
|
27667
27826
|
}
|
|
27668
27827
|
updateSessionStatus(session.id, { status: "ended" });
|
|
@@ -27690,18 +27849,18 @@ async function sendPrompt(sessionId, prompt) {
|
|
|
27690
27849
|
);
|
|
27691
27850
|
}
|
|
27692
27851
|
const fifo = promptFifoPath(sessionId);
|
|
27693
|
-
if (!
|
|
27852
|
+
if (!import_node_fs20.default.existsSync(fifo)) {
|
|
27694
27853
|
throw new AgentSessionError("NO_FIFO", `prompt FIFO missing: ${fifo}`);
|
|
27695
27854
|
}
|
|
27696
|
-
const fd =
|
|
27855
|
+
const fd = import_node_fs20.default.openSync(fifo, import_node_fs20.constants.O_WRONLY);
|
|
27697
27856
|
try {
|
|
27698
27857
|
const wireText = encodeAgentPromptEnvelope(prompt);
|
|
27699
27858
|
if (!wireText) {
|
|
27700
27859
|
throw new AgentSessionError("EMPTY_PROMPT", "prompt text is empty");
|
|
27701
27860
|
}
|
|
27702
|
-
|
|
27861
|
+
import_node_fs20.default.writeSync(fd, wireText + "\n");
|
|
27703
27862
|
} finally {
|
|
27704
|
-
|
|
27863
|
+
import_node_fs20.default.closeSync(fd);
|
|
27705
27864
|
}
|
|
27706
27865
|
updateSessionStatus(sessionId, {
|
|
27707
27866
|
lastPrompt: prompt.displayText ?? prompt.text,
|
|
@@ -27723,7 +27882,7 @@ async function endSession(sessionId) {
|
|
|
27723
27882
|
const base = getUserDataDir();
|
|
27724
27883
|
if (dir.startsWith(base)) {
|
|
27725
27884
|
try {
|
|
27726
|
-
|
|
27885
|
+
import_node_fs20.default.rmSync(dir, { recursive: true, force: true });
|
|
27727
27886
|
} catch {
|
|
27728
27887
|
}
|
|
27729
27888
|
}
|
|
@@ -27731,11 +27890,11 @@ async function endSession(sessionId) {
|
|
|
27731
27890
|
}
|
|
27732
27891
|
function subscribeEvents(sessionId, onEvent) {
|
|
27733
27892
|
const fifo = eventsFifoPath(sessionId);
|
|
27734
|
-
if (!
|
|
27893
|
+
if (!import_node_fs20.default.existsSync(fifo)) {
|
|
27735
27894
|
throw new AgentSessionError("NO_FIFO", `events FIFO missing: ${fifo}`);
|
|
27736
27895
|
}
|
|
27737
|
-
const fd =
|
|
27738
|
-
const stream =
|
|
27896
|
+
const fd = import_node_fs20.default.openSync(fifo, import_node_fs20.constants.O_RDWR);
|
|
27897
|
+
const stream = import_node_fs20.default.createReadStream("", { fd, autoClose: true });
|
|
27739
27898
|
const rl = import_node_readline.default.createInterface({ input: stream, crlfDelay: Infinity });
|
|
27740
27899
|
rl.on("line", (line) => {
|
|
27741
27900
|
const event = parseAgentEventLine(line);
|
|
@@ -27746,7 +27905,7 @@ function subscribeEvents(sessionId, onEvent) {
|
|
|
27746
27905
|
if (closed) return;
|
|
27747
27906
|
closed = true;
|
|
27748
27907
|
try {
|
|
27749
|
-
|
|
27908
|
+
import_node_fs20.default.writeSync(fd, "\n");
|
|
27750
27909
|
} catch {
|
|
27751
27910
|
}
|
|
27752
27911
|
try {
|
|
@@ -27760,7 +27919,7 @@ function subscribeEvents(sessionId, onEvent) {
|
|
|
27760
27919
|
};
|
|
27761
27920
|
}
|
|
27762
27921
|
async function waitForFirstEvent(fifo, predicate, timeoutMs) {
|
|
27763
|
-
const fd =
|
|
27922
|
+
const fd = import_node_fs20.default.openSync(fifo, import_node_fs20.constants.O_RDWR | import_node_fs20.constants.O_NONBLOCK);
|
|
27764
27923
|
const buf = Buffer.alloc(8192);
|
|
27765
27924
|
let leftover = "";
|
|
27766
27925
|
const deadline = Date.now() + timeoutMs;
|
|
@@ -27768,7 +27927,7 @@ async function waitForFirstEvent(fifo, predicate, timeoutMs) {
|
|
|
27768
27927
|
while (Date.now() < deadline) {
|
|
27769
27928
|
let n = 0;
|
|
27770
27929
|
try {
|
|
27771
|
-
n =
|
|
27930
|
+
n = import_node_fs20.default.readSync(fd, buf, 0, buf.length, null);
|
|
27772
27931
|
} catch (err) {
|
|
27773
27932
|
if (err.code !== "EAGAIN") throw err;
|
|
27774
27933
|
n = 0;
|
|
@@ -27788,17 +27947,17 @@ async function waitForFirstEvent(fifo, predicate, timeoutMs) {
|
|
|
27788
27947
|
}
|
|
27789
27948
|
return null;
|
|
27790
27949
|
} finally {
|
|
27791
|
-
|
|
27950
|
+
import_node_fs20.default.closeSync(fd);
|
|
27792
27951
|
}
|
|
27793
27952
|
}
|
|
27794
|
-
var
|
|
27953
|
+
var import_node_child_process10, import_node_crypto9, import_node_fs20, import_node_path21, import_node_readline, AgentSessionError;
|
|
27795
27954
|
var init_agent_sessions = __esm({
|
|
27796
27955
|
"src/agent-sessions.ts"() {
|
|
27797
27956
|
"use strict";
|
|
27798
|
-
|
|
27799
|
-
|
|
27800
|
-
|
|
27801
|
-
|
|
27957
|
+
import_node_child_process10 = require("node:child_process");
|
|
27958
|
+
import_node_crypto9 = require("node:crypto");
|
|
27959
|
+
import_node_fs20 = __toESM(require("node:fs"), 1);
|
|
27960
|
+
import_node_path21 = __toESM(require("node:path"), 1);
|
|
27802
27961
|
import_node_readline = __toESM(require("node:readline"), 1);
|
|
27803
27962
|
init_self_invocation();
|
|
27804
27963
|
init_standalone();
|
|
@@ -27829,13 +27988,13 @@ function mapFrameworkToProjectFramework(fw) {
|
|
|
27829
27988
|
if (fw === "one" || fw === "vxrn") return "one";
|
|
27830
27989
|
return "unknown";
|
|
27831
27990
|
}
|
|
27832
|
-
var
|
|
27991
|
+
var import_node_crypto10, import_node_fs21, import_node_path22, WS_OPEN, SESSION_STATUS_PERSIST_DELAY_MS, AgentHost;
|
|
27833
27992
|
var init_agent_host = __esm({
|
|
27834
27993
|
"src/host/agent-host.ts"() {
|
|
27835
27994
|
"use strict";
|
|
27836
|
-
|
|
27837
|
-
|
|
27838
|
-
|
|
27995
|
+
import_node_crypto10 = require("node:crypto");
|
|
27996
|
+
import_node_fs21 = __toESM(require("node:fs"), 1);
|
|
27997
|
+
import_node_path22 = __toESM(require("node:path"), 1);
|
|
27839
27998
|
init_dev_server_scanner();
|
|
27840
27999
|
init_agent_sessions();
|
|
27841
28000
|
init_attached_projects();
|
|
@@ -28035,7 +28194,7 @@ var init_agent_host = __esm({
|
|
|
28035
28194
|
throw new AgentSessionError("EMPTY_PROMPT", "inspect message cannot be empty");
|
|
28036
28195
|
}
|
|
28037
28196
|
const message = {
|
|
28038
|
-
id: `inspect-${(0,
|
|
28197
|
+
id: `inspect-${(0, import_node_crypto10.randomUUID)()}`,
|
|
28039
28198
|
simId,
|
|
28040
28199
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
28041
28200
|
prompt
|
|
@@ -28081,7 +28240,7 @@ var init_agent_host = __esm({
|
|
|
28081
28240
|
);
|
|
28082
28241
|
const project = upsertProject({
|
|
28083
28242
|
cwd: match.cwd,
|
|
28084
|
-
name: match.projectName ??
|
|
28243
|
+
name: match.projectName ?? import_node_path22.default.basename(match.cwd),
|
|
28085
28244
|
preferredProvider: input.provider ?? existing?.preferredProvider,
|
|
28086
28245
|
sourceRoots: existing?.sourceRoots ?? [match.cwd],
|
|
28087
28246
|
knownBundleUrls,
|
|
@@ -28092,18 +28251,18 @@ var init_agent_host = __esm({
|
|
|
28092
28251
|
}
|
|
28093
28252
|
getTranscript(sessionId) {
|
|
28094
28253
|
const p = transcriptPath(sessionId);
|
|
28095
|
-
if (!
|
|
28254
|
+
if (!import_node_fs21.default.existsSync(p)) {
|
|
28096
28255
|
return { error: "transcript not found", code: "NO_TRANSCRIPT" };
|
|
28097
28256
|
}
|
|
28098
|
-
return
|
|
28257
|
+
return import_node_fs21.default.readFileSync(p, "utf8");
|
|
28099
28258
|
}
|
|
28100
28259
|
getPaths() {
|
|
28101
28260
|
const dir = getUserDataDir();
|
|
28102
28261
|
return {
|
|
28103
28262
|
userDataDir: dir,
|
|
28104
|
-
storeFile:
|
|
28105
|
-
sessionsDir:
|
|
28106
|
-
transcriptsDir:
|
|
28263
|
+
storeFile: import_node_path22.default.join(dir, "attached-projects.json"),
|
|
28264
|
+
sessionsDir: import_node_path22.default.join(dir, "sessions"),
|
|
28265
|
+
transcriptsDir: import_node_path22.default.join(dir, "transcripts")
|
|
28107
28266
|
};
|
|
28108
28267
|
}
|
|
28109
28268
|
// --- subscription management ---
|
|
@@ -28817,7 +28976,7 @@ async function startFetchProxyTransport() {
|
|
|
28817
28976
|
const keys = await crypto.subtle.generateKey(algorithm, true, ["sign", "verify"]);
|
|
28818
28977
|
const certificate = await import_x509.X509CertificateGenerator.createSelfSigned(
|
|
28819
28978
|
{
|
|
28820
|
-
serialNumber: (0,
|
|
28979
|
+
serialNumber: (0, import_node_crypto11.randomBytes)(16).toString("hex"),
|
|
28821
28980
|
name: "CN=localhost",
|
|
28822
28981
|
notBefore: new Date(Date.now() - 6e4),
|
|
28823
28982
|
notAfter: new Date(Date.now() + 365 * 24 * 60 * 6e4),
|
|
@@ -28830,7 +28989,7 @@ async function startFetchProxyTransport() {
|
|
|
28830
28989
|
crypto
|
|
28831
28990
|
);
|
|
28832
28991
|
const privateKey = Buffer.from(await crypto.subtle.exportKey("pkcs8", keys.privateKey));
|
|
28833
|
-
const spki = (0,
|
|
28992
|
+
const spki = (0, import_node_crypto11.createHash)("sha256").update(Buffer.from(await crypto.subtle.exportKey("spki", keys.publicKey))).digest("base64");
|
|
28834
28993
|
const sessions = /* @__PURE__ */ new Set();
|
|
28835
28994
|
const server = (0, import_node_http22.createSecureServer)(
|
|
28836
28995
|
{
|
|
@@ -28876,11 +29035,11 @@ ${privateKey.toString("base64").match(/.{1,64}/g)?.join("\n")}
|
|
|
28876
29035
|
}
|
|
28877
29036
|
};
|
|
28878
29037
|
}
|
|
28879
|
-
var
|
|
29038
|
+
var import_node_crypto11, import_node_http22, import_x509;
|
|
28880
29039
|
var init_fetch_proxy_transport = __esm({
|
|
28881
29040
|
"src/host/fetch-proxy-transport.ts"() {
|
|
28882
29041
|
"use strict";
|
|
28883
|
-
|
|
29042
|
+
import_node_crypto11 = require("node:crypto");
|
|
28884
29043
|
import_node_http22 = require("node:http2");
|
|
28885
29044
|
import_x509 = require("@peculiar/x509");
|
|
28886
29045
|
init_fetch_proxy_handler();
|
|
@@ -29097,23 +29256,23 @@ function looksBinary(filePath, size) {
|
|
|
29097
29256
|
if (size === 0) return false;
|
|
29098
29257
|
let fd;
|
|
29099
29258
|
try {
|
|
29100
|
-
fd =
|
|
29259
|
+
fd = import_node_fs22.default.openSync(filePath, "r");
|
|
29101
29260
|
const buffer = Buffer.alloc(Math.min(BINARY_SNIFF_BYTES, size));
|
|
29102
|
-
const read =
|
|
29261
|
+
const read = import_node_fs22.default.readSync(fd, buffer, 0, buffer.length, 0);
|
|
29103
29262
|
return buffer.subarray(0, read).includes(0);
|
|
29104
29263
|
} catch {
|
|
29105
29264
|
return false;
|
|
29106
29265
|
} finally {
|
|
29107
|
-
if (fd !== void 0)
|
|
29266
|
+
if (fd !== void 0) import_node_fs22.default.closeSync(fd);
|
|
29108
29267
|
}
|
|
29109
29268
|
}
|
|
29110
|
-
var
|
|
29269
|
+
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
29270
|
var init_checkout_plane = __esm({
|
|
29112
29271
|
"cli/commands/box/checkout-plane.ts"() {
|
|
29113
29272
|
"use strict";
|
|
29114
|
-
|
|
29115
|
-
|
|
29116
|
-
|
|
29273
|
+
import_node_child_process11 = require("node:child_process");
|
|
29274
|
+
import_node_fs22 = __toESM(require("node:fs"), 1);
|
|
29275
|
+
import_node_path23 = __toESM(require("node:path"), 1);
|
|
29117
29276
|
CheckoutRequiresGitError = class extends Error {
|
|
29118
29277
|
};
|
|
29119
29278
|
BINARY_SNIFF_BYTES = 8192;
|
|
@@ -29130,7 +29289,7 @@ var init_checkout_plane = __esm({
|
|
|
29130
29289
|
listTimeoutMs;
|
|
29131
29290
|
trackedOnly;
|
|
29132
29291
|
constructor(root, options = {}) {
|
|
29133
|
-
this.root =
|
|
29292
|
+
this.root = import_node_path23.default.resolve(root);
|
|
29134
29293
|
this.listTimeoutMs = options.listTimeoutMs ?? LIST_FILES_TIMEOUT_MS;
|
|
29135
29294
|
this.trackedOnly = options.trackedOnly ?? false;
|
|
29136
29295
|
}
|
|
@@ -29139,7 +29298,7 @@ var init_checkout_plane = __esm({
|
|
|
29139
29298
|
}
|
|
29140
29299
|
listFiles() {
|
|
29141
29300
|
const args = this.trackedOnly ? ["ls-files", "-z"] : ["ls-files", "-co", "--exclude-standard", "-z"];
|
|
29142
|
-
const stdout = (0,
|
|
29301
|
+
const stdout = (0, import_node_child_process11.execFileSync)("git", args, {
|
|
29143
29302
|
cwd: this.root,
|
|
29144
29303
|
encoding: "utf8",
|
|
29145
29304
|
maxBuffer: 64 * 1024 * 1024,
|
|
@@ -29192,13 +29351,13 @@ var init_checkout_plane = __esm({
|
|
|
29192
29351
|
if (!relative3) continue;
|
|
29193
29352
|
let stat2;
|
|
29194
29353
|
try {
|
|
29195
|
-
stat2 =
|
|
29354
|
+
stat2 = import_node_fs22.default.statSync(import_node_path23.default.join(this.root, relative3));
|
|
29196
29355
|
} catch {
|
|
29197
29356
|
continue;
|
|
29198
29357
|
}
|
|
29199
29358
|
if (!stat2.isFile()) continue;
|
|
29200
29359
|
const seen = this.sniffed.get(relative3);
|
|
29201
|
-
const binary = seen && seen.size === stat2.size && seen.mtimeMs === stat2.mtimeMs ? seen.binary : looksBinary(
|
|
29360
|
+
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
29361
|
nextSniffed.set(relative3, { size: stat2.size, mtimeMs: stat2.mtimeMs, binary });
|
|
29203
29362
|
next.set(relative3, {
|
|
29204
29363
|
size: stat2.size,
|
|
@@ -29212,22 +29371,22 @@ var init_checkout_plane = __esm({
|
|
|
29212
29371
|
this.sniffed = nextSniffed;
|
|
29213
29372
|
}
|
|
29214
29373
|
absolute(planePath) {
|
|
29215
|
-
const resolved =
|
|
29216
|
-
if (resolved !== this.root && !resolved.startsWith(`${this.root}${
|
|
29374
|
+
const resolved = import_node_path23.default.resolve(this.root, planePath);
|
|
29375
|
+
if (resolved !== this.root && !resolved.startsWith(`${this.root}${import_node_path23.default.sep}`)) {
|
|
29217
29376
|
throw new Error(`path escapes the project: ${planePath}`);
|
|
29218
29377
|
}
|
|
29219
29378
|
return resolved;
|
|
29220
29379
|
}
|
|
29221
29380
|
async read(planePath) {
|
|
29222
|
-
return
|
|
29381
|
+
return import_node_fs22.default.promises.readFile(this.absolute(planePath), "utf8");
|
|
29223
29382
|
}
|
|
29224
29383
|
async readBytes(planePath) {
|
|
29225
|
-
return
|
|
29384
|
+
return import_node_fs22.default.promises.readFile(this.absolute(planePath));
|
|
29226
29385
|
}
|
|
29227
29386
|
async write(planePath, content) {
|
|
29228
29387
|
const absolute = this.absolute(planePath);
|
|
29229
|
-
await
|
|
29230
|
-
await
|
|
29388
|
+
await import_node_fs22.default.promises.mkdir(import_node_path23.default.dirname(absolute), { recursive: true });
|
|
29389
|
+
await import_node_fs22.default.promises.writeFile(absolute, content);
|
|
29231
29390
|
this.entries.set(planePath, {
|
|
29232
29391
|
size: content.byteLength,
|
|
29233
29392
|
readOnly: false,
|
|
@@ -29236,7 +29395,7 @@ var init_checkout_plane = __esm({
|
|
|
29236
29395
|
});
|
|
29237
29396
|
}
|
|
29238
29397
|
async delete(planePath) {
|
|
29239
|
-
await
|
|
29398
|
+
await import_node_fs22.default.promises.rm(this.absolute(planePath), { force: true });
|
|
29240
29399
|
this.entries.delete(planePath);
|
|
29241
29400
|
}
|
|
29242
29401
|
};
|
|
@@ -29244,12 +29403,12 @@ var init_checkout_plane = __esm({
|
|
|
29244
29403
|
});
|
|
29245
29404
|
|
|
29246
29405
|
// src/host/plane-host.ts
|
|
29247
|
-
var
|
|
29406
|
+
var import_node_fs23, import_node_path24, WS_OPEN2, PlaneNotRegisteredError, PlaneHost;
|
|
29248
29407
|
var init_plane_host = __esm({
|
|
29249
29408
|
"src/host/plane-host.ts"() {
|
|
29250
29409
|
"use strict";
|
|
29251
|
-
|
|
29252
|
-
|
|
29410
|
+
import_node_fs23 = __toESM(require("node:fs"), 1);
|
|
29411
|
+
import_node_path24 = __toESM(require("node:path"), 1);
|
|
29253
29412
|
init_plane();
|
|
29254
29413
|
init_checkout_plane();
|
|
29255
29414
|
WS_OPEN2 = 1;
|
|
@@ -29264,12 +29423,12 @@ var init_plane_host = __esm({
|
|
|
29264
29423
|
/** handle a plane:* message. returns true iff it was one. */
|
|
29265
29424
|
async handleMessage(ws, msg) {
|
|
29266
29425
|
if (typeof msg !== "object" || msg === null) return false;
|
|
29267
|
-
const
|
|
29268
|
-
const type =
|
|
29426
|
+
const record2 = { ...msg };
|
|
29427
|
+
const type = record2.type;
|
|
29269
29428
|
if (typeof type !== "string" || !type.startsWith("plane:")) return false;
|
|
29270
|
-
const id =
|
|
29429
|
+
const id = record2.id;
|
|
29271
29430
|
try {
|
|
29272
|
-
this.respond(ws, id, await this.dispatch(ws, type,
|
|
29431
|
+
this.respond(ws, id, await this.dispatch(ws, type, record2));
|
|
29273
29432
|
} catch (err) {
|
|
29274
29433
|
const code = err instanceof PlaneNotRegisteredError ? "plane-not-registered" : void 0;
|
|
29275
29434
|
this.respondError(ws, id, err instanceof Error ? err.message : String(err), code);
|
|
@@ -29372,14 +29531,14 @@ var init_plane_host = __esm({
|
|
|
29372
29531
|
// root and an opened one cannot disagree about the same directory.
|
|
29373
29532
|
realRoot(root) {
|
|
29374
29533
|
if (!root) throw new Error("root is required");
|
|
29375
|
-
const resolved =
|
|
29534
|
+
const resolved = import_node_path24.default.resolve(root);
|
|
29376
29535
|
let real;
|
|
29377
29536
|
try {
|
|
29378
|
-
real =
|
|
29537
|
+
real = import_node_fs23.default.realpathSync(resolved);
|
|
29379
29538
|
} catch {
|
|
29380
29539
|
throw new Error(`no such directory: ${resolved}`);
|
|
29381
29540
|
}
|
|
29382
|
-
if (!
|
|
29541
|
+
if (!import_node_fs23.default.statSync(real).isDirectory()) throw new Error(`not a directory: ${real}`);
|
|
29383
29542
|
return real;
|
|
29384
29543
|
}
|
|
29385
29544
|
respond(ws, id, result) {
|
|
@@ -29735,16 +29894,16 @@ function sendJavaScript(req, res, source) {
|
|
|
29735
29894
|
res.end(req.method === "HEAD" ? void 0 : source);
|
|
29736
29895
|
}
|
|
29737
29896
|
function resolveReplacementModuleFile(fromFile, specifier) {
|
|
29738
|
-
const base =
|
|
29897
|
+
const base = import_node_path25.default.resolve(import_node_path25.default.dirname(fromFile), specifier);
|
|
29739
29898
|
const candidates = [
|
|
29740
29899
|
...REPLACEMENT_MODULE_EXTENSIONS.some(
|
|
29741
|
-
(ext) => ext ===
|
|
29900
|
+
(ext) => ext === import_node_path25.default.extname(base).toLowerCase()
|
|
29742
29901
|
) ? [base] : [],
|
|
29743
29902
|
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => base + ext),
|
|
29744
|
-
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) =>
|
|
29903
|
+
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => import_node_path25.default.join(base, `index${ext}`))
|
|
29745
29904
|
];
|
|
29746
29905
|
const found = candidates.find(
|
|
29747
|
-
(candidate) => (0,
|
|
29906
|
+
(candidate) => (0, import_node_fs24.statSync)(candidate, { throwIfNoEntry: false })?.isFile()
|
|
29748
29907
|
);
|
|
29749
29908
|
if (!found) {
|
|
29750
29909
|
throw new Error(
|
|
@@ -29799,13 +29958,13 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
29799
29958
|
res.end("missing path param");
|
|
29800
29959
|
return true;
|
|
29801
29960
|
}
|
|
29802
|
-
const extension =
|
|
29961
|
+
const extension = import_node_path25.default.extname(targetPath).toLowerCase();
|
|
29803
29962
|
if (!REPLACEMENT_MODULE_EXTENSIONS.some((allowed) => allowed === extension)) {
|
|
29804
29963
|
res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
29805
29964
|
res.end(`replacement files must be ${REPLACEMENT_MODULE_EXTENSIONS.join(", ")}`);
|
|
29806
29965
|
return true;
|
|
29807
29966
|
}
|
|
29808
|
-
if (!
|
|
29967
|
+
if (!import_node_path25.default.isAbsolute(targetPath)) {
|
|
29809
29968
|
res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
29810
29969
|
res.end("replacement file path must be absolute");
|
|
29811
29970
|
return true;
|
|
@@ -29813,10 +29972,10 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
29813
29972
|
const runtimePackages = new Set(url.searchParams.getAll("runtimePackage"));
|
|
29814
29973
|
let resolvedProjectRoot;
|
|
29815
29974
|
if (options.projectRoot) {
|
|
29816
|
-
const lexicalProjectRoot =
|
|
29975
|
+
const lexicalProjectRoot = import_node_path25.default.resolve(options.projectRoot);
|
|
29817
29976
|
resolvedProjectRoot = await import_promises5.default.realpath(options.projectRoot);
|
|
29818
|
-
const lexicalTarget =
|
|
29819
|
-
if (lexicalTarget.startsWith("..") ||
|
|
29977
|
+
const lexicalTarget = import_node_path25.default.relative(lexicalProjectRoot, targetPath);
|
|
29978
|
+
if (lexicalTarget.startsWith("..") || import_node_path25.default.isAbsolute(lexicalTarget)) {
|
|
29820
29979
|
res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
|
|
29821
29980
|
res.end("replacement file must be inside the project root");
|
|
29822
29981
|
return true;
|
|
@@ -29832,8 +29991,8 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
29832
29991
|
return true;
|
|
29833
29992
|
}
|
|
29834
29993
|
if (resolvedProjectRoot) {
|
|
29835
|
-
const relativeTarget =
|
|
29836
|
-
if (relativeTarget.startsWith("..") ||
|
|
29994
|
+
const relativeTarget = import_node_path25.default.relative(resolvedProjectRoot, resolvedTargetPath);
|
|
29995
|
+
if (relativeTarget.startsWith("..") || import_node_path25.default.isAbsolute(relativeTarget)) {
|
|
29837
29996
|
res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
|
|
29838
29997
|
res.end("replacement file must be inside the project root");
|
|
29839
29998
|
return true;
|
|
@@ -29868,13 +30027,13 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
29868
30027
|
}
|
|
29869
30028
|
return true;
|
|
29870
30029
|
}
|
|
29871
|
-
var
|
|
30030
|
+
var import_node_fs24, import_promises5, import_node_path25, REPLACEMENT_MODULE_ROUTE;
|
|
29872
30031
|
var init_replacement_module_handler = __esm({
|
|
29873
30032
|
"src/host/replacement-module-handler.ts"() {
|
|
29874
30033
|
"use strict";
|
|
29875
|
-
|
|
30034
|
+
import_node_fs24 = require("node:fs");
|
|
29876
30035
|
import_promises5 = __toESM(require("node:fs/promises"), 1);
|
|
29877
|
-
|
|
30036
|
+
import_node_path25 = __toESM(require("node:path"), 1);
|
|
29878
30037
|
init_replacementModule();
|
|
29879
30038
|
init_backend_origin();
|
|
29880
30039
|
REPLACEMENT_MODULE_ROUTE = "/__sootsim-replacement-module";
|
|
@@ -31843,8 +32002,8 @@ function metroIosAssetDestRelatives(httpServerLocation, filename) {
|
|
|
31843
32002
|
}
|
|
31844
32003
|
const out = [];
|
|
31845
32004
|
for (const dir of dirs) {
|
|
31846
|
-
const
|
|
31847
|
-
if (!out.includes(
|
|
32005
|
+
const path35 = `${dir}/${filename}`;
|
|
32006
|
+
if (!out.includes(path35)) out.push(path35);
|
|
31848
32007
|
}
|
|
31849
32008
|
if (!out.includes(filename)) out.push(filename);
|
|
31850
32009
|
return out;
|
|
@@ -32798,13 +32957,13 @@ function readFactoryStringLiterals(factory) {
|
|
|
32798
32957
|
return literals;
|
|
32799
32958
|
}
|
|
32800
32959
|
function normalizeFingerprintLiteral(literal) {
|
|
32801
|
-
const
|
|
32960
|
+
const path35 = literal.replaceAll("\\\\", "/").replaceAll("\\/", "/");
|
|
32802
32961
|
const nodeModulesMarker = "/node_modules/";
|
|
32803
|
-
const nodeModulesIndex =
|
|
32962
|
+
const nodeModulesIndex = path35.lastIndexOf(nodeModulesMarker);
|
|
32804
32963
|
if (nodeModulesIndex >= 0) {
|
|
32805
|
-
return `node_modules/${
|
|
32964
|
+
return `node_modules/${path35.slice(nodeModulesIndex + nodeModulesMarker.length)}`;
|
|
32806
32965
|
}
|
|
32807
|
-
if ((
|
|
32966
|
+
if ((path35.startsWith("/") || /^[A-Za-z]:\//.test(path35) || path35.startsWith("file:/")) && /\.[cm]?[jt]sx?(?::\d+(?::\d+)?)?$/.test(path35)) {
|
|
32808
32967
|
return null;
|
|
32809
32968
|
}
|
|
32810
32969
|
return literal;
|
|
@@ -33042,10 +33201,10 @@ function templateAssignment(template, embeddings) {
|
|
|
33042
33201
|
if (existingNode !== void 0 && existingNode !== nodeIndex) return null;
|
|
33043
33202
|
nodesByModuleId.set(moduleId, nodeIndex);
|
|
33044
33203
|
const node = template.nodes[nodeIndex];
|
|
33045
|
-
const
|
|
33204
|
+
const path35 = node.landmarkPath ?? `node_modules/${template.packageName}/__rnx_inferred__/${moduleId}.js`;
|
|
33046
33205
|
const existingPath = pathsByModuleId.get(moduleId);
|
|
33047
|
-
if (existingPath !== void 0 && existingPath !==
|
|
33048
|
-
pathsByModuleId.set(moduleId,
|
|
33206
|
+
if (existingPath !== void 0 && existingPath !== path35) return null;
|
|
33207
|
+
pathsByModuleId.set(moduleId, path35);
|
|
33049
33208
|
}
|
|
33050
33209
|
}
|
|
33051
33210
|
return {
|
|
@@ -33207,14 +33366,14 @@ async function inferMetroModuleIdentity(args) {
|
|
|
33207
33366
|
const packageClaims = claimsByPackage.values().next().value;
|
|
33208
33367
|
if (!packageClaims) continue;
|
|
33209
33368
|
const exactClaims = packageClaims.filter((assignment2) => {
|
|
33210
|
-
const
|
|
33211
|
-
return
|
|
33369
|
+
const path35 = assignment2.pathsByModuleId.get(moduleId);
|
|
33370
|
+
return path35 !== void 0 && !path35.includes("/__rnx_inferred__/");
|
|
33212
33371
|
});
|
|
33213
33372
|
const preferredClaims = exactClaims.length > 0 ? exactClaims : packageClaims;
|
|
33214
33373
|
const routes = new Set(
|
|
33215
33374
|
preferredClaims.flatMap((assignment2) => {
|
|
33216
|
-
const
|
|
33217
|
-
return
|
|
33375
|
+
const path35 = assignment2.pathsByModuleId.get(moduleId);
|
|
33376
|
+
return path35 ? [metroFingerprintModuleClaimRoute(assignment2.packageName, path35)] : [];
|
|
33218
33377
|
})
|
|
33219
33378
|
);
|
|
33220
33379
|
if (routes.size !== 1) continue;
|
|
@@ -33509,8 +33668,8 @@ function detectFramework2(deps) {
|
|
|
33509
33668
|
return "unknown";
|
|
33510
33669
|
}
|
|
33511
33670
|
function detectProject(dir) {
|
|
33512
|
-
const pkgPath = (0,
|
|
33513
|
-
if (!(0,
|
|
33671
|
+
const pkgPath = (0, import_node_path26.join)(dir, "package.json");
|
|
33672
|
+
if (!(0, import_node_fs25.existsSync)(pkgPath)) return null;
|
|
33514
33673
|
const pkg = readProjectManifest(dir);
|
|
33515
33674
|
if (!pkg) return null;
|
|
33516
33675
|
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
@@ -33522,25 +33681,25 @@ function detectProject(dir) {
|
|
|
33522
33681
|
if (framework === "unknown") return null;
|
|
33523
33682
|
return {
|
|
33524
33683
|
dir,
|
|
33525
|
-
name: pkg.name || (0,
|
|
33684
|
+
name: pkg.name || (0, import_node_path26.basename)(dir),
|
|
33526
33685
|
framework,
|
|
33527
33686
|
// a config file is a config file whatever module system it declares. real
|
|
33528
33687
|
// apps write .cjs as often as .js, and missing one reads as "this project
|
|
33529
33688
|
// has no bundler config" and sends the user to create a second one.
|
|
33530
33689
|
hasViteConfig: CONFIG_EXTENSIONS.some(
|
|
33531
|
-
(ext) => (0,
|
|
33690
|
+
(ext) => (0, import_node_fs25.existsSync)((0, import_node_path26.join)(dir, `vite.config.${ext}`))
|
|
33532
33691
|
),
|
|
33533
33692
|
hasMetroConfig: CONFIG_EXTENSIONS.some(
|
|
33534
|
-
(ext) => (0,
|
|
33693
|
+
(ext) => (0, import_node_fs25.existsSync)((0, import_node_path26.join)(dir, `metro.config.${ext}`))
|
|
33535
33694
|
),
|
|
33536
33695
|
devCommand: typeof devCommand === "string" ? devCommand : null
|
|
33537
33696
|
};
|
|
33538
33697
|
}
|
|
33539
|
-
function readProjectMetadata(
|
|
33698
|
+
function readProjectMetadata(path35) {
|
|
33540
33699
|
try {
|
|
33541
|
-
const info = (0,
|
|
33700
|
+
const info = (0, import_node_fs25.lstatSync)(path35);
|
|
33542
33701
|
if (!info.isFile() || info.size > 4 * 1024 * 1024) return null;
|
|
33543
|
-
return (0,
|
|
33702
|
+
return (0, import_node_fs25.readFileSync)(path35, "utf8");
|
|
33544
33703
|
} catch {
|
|
33545
33704
|
return null;
|
|
33546
33705
|
}
|
|
@@ -33549,8 +33708,8 @@ function metadataValue(value, key) {
|
|
|
33549
33708
|
if (!value || typeof value !== "object") return void 0;
|
|
33550
33709
|
return Object.getOwnPropertyDescriptor(value, key)?.value;
|
|
33551
33710
|
}
|
|
33552
|
-
function readProjectJson(
|
|
33553
|
-
const text2 = readProjectMetadata(
|
|
33711
|
+
function readProjectJson(path35) {
|
|
33712
|
+
const text2 = readProjectMetadata(path35);
|
|
33554
33713
|
if (text2 === null) return null;
|
|
33555
33714
|
try {
|
|
33556
33715
|
const value = JSON.parse(text2);
|
|
@@ -33560,9 +33719,9 @@ function readProjectJson(path34) {
|
|
|
33560
33719
|
}
|
|
33561
33720
|
}
|
|
33562
33721
|
function readProjectManifest(dir) {
|
|
33563
|
-
const parsed = readProjectJson((0,
|
|
33722
|
+
const parsed = readProjectJson((0, import_node_path26.join)(dir, "package.json"));
|
|
33564
33723
|
if (!parsed || typeof parsed !== "object") return null;
|
|
33565
|
-
const
|
|
33724
|
+
const record2 = (value) => {
|
|
33566
33725
|
if (!value || typeof value !== "object") return {};
|
|
33567
33726
|
return Object.fromEntries(
|
|
33568
33727
|
Object.entries(value).filter(
|
|
@@ -33573,16 +33732,16 @@ function readProjectManifest(dir) {
|
|
|
33573
33732
|
const name2 = metadataValue(parsed, "name");
|
|
33574
33733
|
return {
|
|
33575
33734
|
...typeof name2 === "string" ? { name: name2 } : {},
|
|
33576
|
-
dependencies:
|
|
33577
|
-
devDependencies:
|
|
33735
|
+
dependencies: record2(metadataValue(parsed, "dependencies")),
|
|
33736
|
+
devDependencies: record2(metadataValue(parsed, "devDependencies"))
|
|
33578
33737
|
};
|
|
33579
33738
|
}
|
|
33580
|
-
var
|
|
33739
|
+
var import_node_fs25, import_node_path26, import_json52, import_yaml, CONFIG_EXTENSIONS;
|
|
33581
33740
|
var init_detect = __esm({
|
|
33582
33741
|
"cli/commands/detect.ts"() {
|
|
33583
33742
|
"use strict";
|
|
33584
|
-
|
|
33585
|
-
|
|
33743
|
+
import_node_fs25 = require("node:fs");
|
|
33744
|
+
import_node_path26 = require("node:path");
|
|
33586
33745
|
import_json52 = __toESM(require("json5"), 1);
|
|
33587
33746
|
import_yaml = require("yaml");
|
|
33588
33747
|
CONFIG_EXTENSIONS = ["ts", "js", "cjs", "mjs", "mts", "cts"];
|
|
@@ -33619,21 +33778,21 @@ function resolveCloudOrigin(value) {
|
|
|
33619
33778
|
return normalizeCloudOrigin(source);
|
|
33620
33779
|
}
|
|
33621
33780
|
function readImmutableBundleSource(bundlePath) {
|
|
33622
|
-
const filepath = (0,
|
|
33623
|
-
if ((0,
|
|
33781
|
+
const filepath = (0, import_node_path27.resolve)(bundlePath);
|
|
33782
|
+
if ((0, import_node_path27.extname)(filepath) !== ".js") {
|
|
33624
33783
|
throw new Error(`${REMOTE_COMMAND} requires one local Metro .js bundle`);
|
|
33625
33784
|
}
|
|
33626
|
-
const descriptor = (0,
|
|
33785
|
+
const descriptor = (0, import_node_fs26.openSync)(filepath, "r");
|
|
33627
33786
|
try {
|
|
33628
|
-
const before = (0,
|
|
33787
|
+
const before = (0, import_node_fs26.fstatSync)(descriptor, { bigint: true });
|
|
33629
33788
|
if (!before.isFile()) {
|
|
33630
33789
|
throw new Error(`${REMOTE_COMMAND} bundle must be a regular local file`);
|
|
33631
33790
|
}
|
|
33632
33791
|
if (before.size <= 0n) {
|
|
33633
33792
|
throw new Error(`${REMOTE_COMMAND} bundle is empty`);
|
|
33634
33793
|
}
|
|
33635
|
-
const bytes = (0,
|
|
33636
|
-
const after = (0,
|
|
33794
|
+
const bytes = (0, import_node_fs26.readFileSync)(descriptor);
|
|
33795
|
+
const after = (0, import_node_fs26.fstatSync)(descriptor, { bigint: true });
|
|
33637
33796
|
if (before.dev !== after.dev || before.ino !== after.ino || before.size !== after.size || before.mtimeNs !== after.mtimeNs || bytes.length !== Number(before.size)) {
|
|
33638
33797
|
throw new Error(`${REMOTE_COMMAND} bundle changed while it was being read`);
|
|
33639
33798
|
}
|
|
@@ -33648,7 +33807,7 @@ function readImmutableBundleSource(bundlePath) {
|
|
|
33648
33807
|
}
|
|
33649
33808
|
return source;
|
|
33650
33809
|
} finally {
|
|
33651
|
-
(0,
|
|
33810
|
+
(0, import_node_fs26.closeSync)(descriptor);
|
|
33652
33811
|
}
|
|
33653
33812
|
}
|
|
33654
33813
|
async function fetchBundleSource(bundleUrl) {
|
|
@@ -33695,15 +33854,15 @@ async function loadBundleSource(bundleInput) {
|
|
|
33695
33854
|
return readImmutableBundleSource(bundleInput);
|
|
33696
33855
|
}
|
|
33697
33856
|
function listMetroAssetDest(assetsPath) {
|
|
33698
|
-
const directory = (0,
|
|
33699
|
-
if (!(0,
|
|
33700
|
-
const skipNested = (0,
|
|
33857
|
+
const directory = (0, import_node_path27.resolve)(assetsPath);
|
|
33858
|
+
if (!(0, import_node_fs26.existsSync)(directory)) return { directory, files: [], truncated: false };
|
|
33859
|
+
const skipNested = (0, import_node_fs26.existsSync)((0, import_node_path27.join)(directory, "package.json"));
|
|
33701
33860
|
const files = [];
|
|
33702
33861
|
let truncated = false;
|
|
33703
33862
|
const walk2 = (dir, prefix) => {
|
|
33704
33863
|
let entries;
|
|
33705
33864
|
try {
|
|
33706
|
-
entries = (0,
|
|
33865
|
+
entries = (0, import_node_fs26.readdirSync)(dir, { withFileTypes: true });
|
|
33707
33866
|
} catch {
|
|
33708
33867
|
return;
|
|
33709
33868
|
}
|
|
@@ -33715,7 +33874,7 @@ function listMetroAssetDest(assetsPath) {
|
|
|
33715
33874
|
if (entry.isDirectory()) {
|
|
33716
33875
|
if (entry.name === ".git") continue;
|
|
33717
33876
|
if (skipNested && PROJECT_ONLY_DIRECTORIES.has(entry.name)) continue;
|
|
33718
|
-
walk2((0,
|
|
33877
|
+
walk2((0, import_node_path27.join)(dir, entry.name), prefix ? `${prefix}/${entry.name}` : entry.name);
|
|
33719
33878
|
} else if (entry.isFile()) {
|
|
33720
33879
|
files.push(prefix ? `${prefix}/${entry.name}` : entry.name);
|
|
33721
33880
|
}
|
|
@@ -33725,7 +33884,7 @@ function listMetroAssetDest(assetsPath) {
|
|
|
33725
33884
|
return { directory, files, truncated };
|
|
33726
33885
|
}
|
|
33727
33886
|
function metroDescriptorHash(scaleBytes) {
|
|
33728
|
-
const hasher = (0,
|
|
33887
|
+
const hasher = (0, import_node_crypto12.createHash)("md5");
|
|
33729
33888
|
for (const bytes of scaleBytes) hasher.update(bytes);
|
|
33730
33889
|
return hasher.digest("hex");
|
|
33731
33890
|
}
|
|
@@ -33750,11 +33909,11 @@ function distinctByContent(directory, options) {
|
|
|
33750
33909
|
for (const relative3 of options) {
|
|
33751
33910
|
let bytes;
|
|
33752
33911
|
try {
|
|
33753
|
-
bytes = (0,
|
|
33912
|
+
bytes = (0, import_node_fs26.readFileSync)((0, import_node_path27.join)(directory, relative3));
|
|
33754
33913
|
} catch {
|
|
33755
33914
|
continue;
|
|
33756
33915
|
}
|
|
33757
|
-
const digest = (0,
|
|
33916
|
+
const digest = (0, import_node_crypto12.createHash)("md5").update(bytes).digest("hex");
|
|
33758
33917
|
if (!byContent.has(digest)) byContent.set(digest, relative3);
|
|
33759
33918
|
}
|
|
33760
33919
|
return [...byContent.values()];
|
|
@@ -33782,13 +33941,13 @@ function placeMetroDescriptor(listing, descriptor) {
|
|
|
33782
33941
|
let bytes;
|
|
33783
33942
|
try {
|
|
33784
33943
|
bytes = combination.map(
|
|
33785
|
-
(relative3) => (0,
|
|
33944
|
+
(relative3) => (0, import_node_fs26.readFileSync)((0, import_node_path27.join)(listing.directory, relative3))
|
|
33786
33945
|
);
|
|
33787
33946
|
} catch {
|
|
33788
33947
|
continue;
|
|
33789
33948
|
}
|
|
33790
33949
|
const identical = fileHashes ? bytes.every((file, index) => {
|
|
33791
|
-
const digest = (0,
|
|
33950
|
+
const digest = (0, import_node_crypto12.createHash)("md5").update(file).digest("hex");
|
|
33792
33951
|
return descriptor.scales.some(
|
|
33793
33952
|
(scale, declared) => scale === scales[index] && fileHashes[declared] === digest
|
|
33794
33953
|
);
|
|
@@ -33810,10 +33969,10 @@ function unverifiedContentKey(dest, fileDigests) {
|
|
|
33810
33969
|
return JSON.stringify(
|
|
33811
33970
|
dest.placements.map(
|
|
33812
33971
|
(placement) => placement.verified ? null : [...placement.files].map(([scale, relative3]) => {
|
|
33813
|
-
const file = (0,
|
|
33972
|
+
const file = (0, import_node_path27.join)(dest.directory, relative3);
|
|
33814
33973
|
let digest = fileDigests.get(file);
|
|
33815
33974
|
if (digest === void 0) {
|
|
33816
|
-
digest = (0,
|
|
33975
|
+
digest = (0, import_node_crypto12.createHash)("sha256").update((0, import_node_fs26.readFileSync)(file)).digest("hex");
|
|
33817
33976
|
fileDigests.set(file, digest);
|
|
33818
33977
|
}
|
|
33819
33978
|
return [scale, digest];
|
|
@@ -33822,22 +33981,22 @@ function unverifiedContentKey(dest, fileDigests) {
|
|
|
33822
33981
|
);
|
|
33823
33982
|
}
|
|
33824
33983
|
function searchMetroAssetDest(bundlePath, descriptors) {
|
|
33825
|
-
const bundleDirectory = (0,
|
|
33984
|
+
const bundleDirectory = (0, import_node_path27.dirname)((0, import_node_path27.resolve)(bundlePath));
|
|
33826
33985
|
const candidates = [
|
|
33827
|
-
(0,
|
|
33986
|
+
(0, import_node_path27.join)(bundleDirectory, "assets"),
|
|
33828
33987
|
bundleDirectory,
|
|
33829
|
-
(0,
|
|
33988
|
+
(0, import_node_path27.resolve)(bundleDirectory, "..", "assets")
|
|
33830
33989
|
];
|
|
33831
33990
|
const cwd = process.cwd();
|
|
33832
33991
|
let projectDirectory = null;
|
|
33833
33992
|
for (const start of [bundleDirectory, cwd]) {
|
|
33834
|
-
let directory = (0,
|
|
33993
|
+
let directory = (0, import_node_path27.resolve)(start);
|
|
33835
33994
|
while (true) {
|
|
33836
33995
|
if (detectProject(directory)?.hasMetroConfig) {
|
|
33837
33996
|
projectDirectory = directory;
|
|
33838
33997
|
break;
|
|
33839
33998
|
}
|
|
33840
|
-
const parent = (0,
|
|
33999
|
+
const parent = (0, import_node_path27.dirname)(directory);
|
|
33841
34000
|
if (parent === directory) break;
|
|
33842
34001
|
directory = parent;
|
|
33843
34002
|
}
|
|
@@ -33845,11 +34004,11 @@ function searchMetroAssetDest(bundlePath, descriptors) {
|
|
|
33845
34004
|
}
|
|
33846
34005
|
if (projectDirectory) {
|
|
33847
34006
|
candidates.push(
|
|
33848
|
-
(0,
|
|
33849
|
-
(0,
|
|
33850
|
-
(0,
|
|
33851
|
-
(0,
|
|
33852
|
-
(0,
|
|
34007
|
+
(0, import_node_path27.join)(projectDirectory, "assets"),
|
|
34008
|
+
(0, import_node_path27.join)(projectDirectory, "dist"),
|
|
34009
|
+
(0, import_node_path27.join)(projectDirectory, "dist", "assets"),
|
|
34010
|
+
(0, import_node_path27.join)(projectDirectory, "build"),
|
|
34011
|
+
(0, import_node_path27.join)(projectDirectory, "build", "assets")
|
|
33853
34012
|
);
|
|
33854
34013
|
}
|
|
33855
34014
|
const searched = [];
|
|
@@ -33857,7 +34016,7 @@ function searchMetroAssetDest(bundlePath, descriptors) {
|
|
|
33857
34016
|
const stale = [];
|
|
33858
34017
|
let truncated = false;
|
|
33859
34018
|
for (const candidate of candidates) {
|
|
33860
|
-
const directory = (0,
|
|
34019
|
+
const directory = (0, import_node_path27.resolve)(candidate);
|
|
33861
34020
|
if (searched.includes(directory)) continue;
|
|
33862
34021
|
searched.push(directory);
|
|
33863
34022
|
const listing = listMetroAssetDest(directory);
|
|
@@ -33966,7 +34125,7 @@ async function embedBundleAssets(bundlePath, command, assetPolicy) {
|
|
|
33966
34125
|
);
|
|
33967
34126
|
}
|
|
33968
34127
|
const relative3 = placement?.files.get(variant.scale);
|
|
33969
|
-
if (relative3 && dest) return (0,
|
|
34128
|
+
if (relative3 && dest) return (0, import_node_fs26.readFileSync)((0, import_node_path27.join)(dest.directory, relative3));
|
|
33970
34129
|
if (placement && placement.files.size > 0) return null;
|
|
33971
34130
|
if (placement && placement.ambiguous.length > 0 && dest) {
|
|
33972
34131
|
throw new Error(
|
|
@@ -33995,7 +34154,7 @@ async function embedBundleAssets(bundlePath, command, assetPolicy) {
|
|
|
33995
34154
|
);
|
|
33996
34155
|
const classic = metroIosAssetDestRelatives(variant.descriptor.httpServerLocation, filename)[0] ?? filename;
|
|
33997
34156
|
throw new Error(
|
|
33998
|
-
`${command} could not read ${(0,
|
|
34157
|
+
`${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
34158
|
);
|
|
34000
34159
|
});
|
|
34001
34160
|
return {
|
|
@@ -34036,7 +34195,7 @@ async function produceArtifact(bundlePath, maxBytes, command, assetPolicy) {
|
|
|
34036
34195
|
}
|
|
34037
34196
|
return {
|
|
34038
34197
|
bytes,
|
|
34039
|
-
sha256: (0,
|
|
34198
|
+
sha256: (0, import_node_crypto12.createHash)("sha256").update(bytes).digest("hex"),
|
|
34040
34199
|
receipt: artifact.receipt,
|
|
34041
34200
|
assetsDirectory: prepared.dest?.directory ?? null,
|
|
34042
34201
|
warnings
|
|
@@ -34181,13 +34340,13 @@ function createCloudBridgeForParsed(parsed) {
|
|
|
34181
34340
|
if (!session) return null;
|
|
34182
34341
|
return session.service === "box" ? new CloudBoxBridge(session) : new CloudBridge(session);
|
|
34183
34342
|
}
|
|
34184
|
-
var
|
|
34343
|
+
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
34344
|
var init_cloud_client = __esm({
|
|
34186
34345
|
"cli/cloud-client.ts"() {
|
|
34187
34346
|
"use strict";
|
|
34188
|
-
|
|
34189
|
-
|
|
34190
|
-
|
|
34347
|
+
import_node_crypto12 = require("node:crypto");
|
|
34348
|
+
import_node_fs26 = require("node:fs");
|
|
34349
|
+
import_node_path27 = require("node:path");
|
|
34191
34350
|
init_metroAssetArtifact();
|
|
34192
34351
|
init_metroCloudArtifact();
|
|
34193
34352
|
init_metro_fingerprint_registry_client();
|
|
@@ -34227,7 +34386,7 @@ var init_cloud_client = __esm({
|
|
|
34227
34386
|
plane = "cloud";
|
|
34228
34387
|
async send(command, options) {
|
|
34229
34388
|
const body = {
|
|
34230
|
-
id: (0,
|
|
34389
|
+
id: (0, import_node_crypto12.randomUUID)(),
|
|
34231
34390
|
claimId: this.session.claimId,
|
|
34232
34391
|
command: cloudCommand(command)
|
|
34233
34392
|
};
|
|
@@ -34297,7 +34456,7 @@ var init_cloud_client = __esm({
|
|
|
34297
34456
|
}
|
|
34298
34457
|
plane = "cloud";
|
|
34299
34458
|
async send(command, options) {
|
|
34300
|
-
const id = (0,
|
|
34459
|
+
const id = (0, import_node_crypto12.randomUUID)();
|
|
34301
34460
|
const payload = {};
|
|
34302
34461
|
for (const [key, value] of Object.entries(command)) {
|
|
34303
34462
|
if (key !== "id" && key !== "simId") payload[key] = value;
|
|
@@ -36699,31 +36858,31 @@ var init_parent_pid = __esm({
|
|
|
36699
36858
|
|
|
36700
36859
|
// cli/secure-file.ts
|
|
36701
36860
|
function writeSecureJsonAtomic(filepath, value) {
|
|
36702
|
-
(0,
|
|
36703
|
-
const temporary = `${filepath}.tmp-${process.pid}-${(0,
|
|
36861
|
+
(0, import_node_fs27.mkdirSync)((0, import_node_path28.dirname)(filepath), { recursive: true });
|
|
36862
|
+
const temporary = `${filepath}.tmp-${process.pid}-${(0, import_node_crypto13.randomUUID)()}`;
|
|
36704
36863
|
let descriptor = null;
|
|
36705
36864
|
try {
|
|
36706
|
-
descriptor = (0,
|
|
36707
|
-
(0,
|
|
36708
|
-
(0,
|
|
36865
|
+
descriptor = (0, import_node_fs27.openSync)(temporary, "wx", 384);
|
|
36866
|
+
(0, import_node_fs27.fchmodSync)(descriptor, 384);
|
|
36867
|
+
(0, import_node_fs27.writeFileSync)(descriptor, `${JSON.stringify(value, null, 2)}
|
|
36709
36868
|
`);
|
|
36710
|
-
(0,
|
|
36711
|
-
(0,
|
|
36869
|
+
(0, import_node_fs27.fsyncSync)(descriptor);
|
|
36870
|
+
(0, import_node_fs27.closeSync)(descriptor);
|
|
36712
36871
|
descriptor = null;
|
|
36713
|
-
(0,
|
|
36872
|
+
(0, import_node_fs27.renameSync)(temporary, filepath);
|
|
36714
36873
|
} catch (error) {
|
|
36715
|
-
if (descriptor !== null) (0,
|
|
36716
|
-
(0,
|
|
36874
|
+
if (descriptor !== null) (0, import_node_fs27.closeSync)(descriptor);
|
|
36875
|
+
(0, import_node_fs27.rmSync)(temporary, { force: true });
|
|
36717
36876
|
throw error;
|
|
36718
36877
|
}
|
|
36719
36878
|
}
|
|
36720
|
-
var
|
|
36879
|
+
var import_node_crypto13, import_node_fs27, import_node_path28;
|
|
36721
36880
|
var init_secure_file = __esm({
|
|
36722
36881
|
"cli/secure-file.ts"() {
|
|
36723
36882
|
"use strict";
|
|
36724
|
-
|
|
36725
|
-
|
|
36726
|
-
|
|
36883
|
+
import_node_crypto13 = require("node:crypto");
|
|
36884
|
+
import_node_fs27 = require("node:fs");
|
|
36885
|
+
import_node_path28 = require("node:path");
|
|
36727
36886
|
}
|
|
36728
36887
|
});
|
|
36729
36888
|
|
|
@@ -36908,17 +37067,17 @@ function liveDevBridgeLockfiles() {
|
|
|
36908
37067
|
return readDevBridgeLockfiles().filter((lockfile) => isDevBridgeLockfileFresh(lockfile));
|
|
36909
37068
|
}
|
|
36910
37069
|
function checkoutRoot(cwd) {
|
|
36911
|
-
let current =
|
|
37070
|
+
let current = import_node_path29.default.resolve(cwd);
|
|
36912
37071
|
while (true) {
|
|
36913
|
-
if (
|
|
36914
|
-
const parent =
|
|
37072
|
+
if (import_node_fs28.default.existsSync(import_node_path29.default.join(current, ".git"))) return current;
|
|
37073
|
+
const parent = import_node_path29.default.dirname(current);
|
|
36915
37074
|
if (parent === current) return null;
|
|
36916
37075
|
current = parent;
|
|
36917
37076
|
}
|
|
36918
37077
|
}
|
|
36919
37078
|
function pathContains(parent, child) {
|
|
36920
|
-
const relative3 =
|
|
36921
|
-
return relative3 === "" || relative3 !== ".." && !relative3.startsWith(`..${
|
|
37079
|
+
const relative3 = import_node_path29.default.relative(parent, child);
|
|
37080
|
+
return relative3 === "" || relative3 !== ".." && !relative3.startsWith(`..${import_node_path29.default.sep}`) && !import_node_path29.default.isAbsolute(relative3);
|
|
36922
37081
|
}
|
|
36923
37082
|
function resolveDefaultDevBridgeLockfile() {
|
|
36924
37083
|
const lockfiles = liveDevBridgeLockfiles();
|
|
@@ -37418,18 +37577,18 @@ async function evalInBridge(bridge, code, opts = {}) {
|
|
|
37418
37577
|
if (opts.acquireLock) payload.acquireLock = true;
|
|
37419
37578
|
return bridge.send(payload);
|
|
37420
37579
|
}
|
|
37421
|
-
async function callInBridge(bridge,
|
|
37422
|
-
return bridge.send({ type: "call", path:
|
|
37580
|
+
async function callInBridge(bridge, path35, ...args) {
|
|
37581
|
+
return bridge.send({ type: "call", path: path35, args });
|
|
37423
37582
|
}
|
|
37424
|
-
async function callInBridgeWrite(bridge,
|
|
37425
|
-
return bridge.send({ type: "call", path:
|
|
37583
|
+
async function callInBridgeWrite(bridge, path35, ...args) {
|
|
37584
|
+
return bridge.send({ type: "call", path: path35, args, acquireLock: true });
|
|
37426
37585
|
}
|
|
37427
|
-
var
|
|
37586
|
+
var import_node_fs28, import_node_path29, import_ws2, PEACH_PLACEMENT_ENV, resolvedWorld, BridgeSimLockedError, BRIDGE_VALUE_FLAGS_TABLE, BRIDGE_VALUE_FLAGS;
|
|
37428
37587
|
var init_ws_bridge = __esm({
|
|
37429
37588
|
"cli/ws-bridge.ts"() {
|
|
37430
37589
|
"use strict";
|
|
37431
|
-
|
|
37432
|
-
|
|
37590
|
+
import_node_fs28 = __toESM(require("node:fs"), 1);
|
|
37591
|
+
import_node_path29 = __toESM(require("node:path"), 1);
|
|
37433
37592
|
import_ws2 = require("ws");
|
|
37434
37593
|
init_bridge_constants();
|
|
37435
37594
|
init_cli_constants();
|
|
@@ -37557,8 +37716,8 @@ function getDefaultPortForProtocol(protocol) {
|
|
|
37557
37716
|
return protocol === "https:" ? 443 : 80;
|
|
37558
37717
|
}
|
|
37559
37718
|
function isBaseServerUrl(url) {
|
|
37560
|
-
const
|
|
37561
|
-
return (
|
|
37719
|
+
const path35 = url.pathname || "/";
|
|
37720
|
+
return (path35 === "/" || path35 === "") && !url.search && !url.hash;
|
|
37562
37721
|
}
|
|
37563
37722
|
async function resolvePortViaServerScan(port) {
|
|
37564
37723
|
try {
|
|
@@ -37722,8 +37881,8 @@ var init_dev_bundle_resolution = __esm({
|
|
|
37722
37881
|
|
|
37723
37882
|
// src/dot-env.ts
|
|
37724
37883
|
function selectEnvFile(env, notices) {
|
|
37725
|
-
if (
|
|
37726
|
-
return { name:
|
|
37884
|
+
if (import_node_fs29.default.existsSync("/tmp/envfile")) {
|
|
37885
|
+
return { name: import_node_fs29.default.readFileSync("/tmp/envfile", "utf8").trim(), fromEnvfile: false };
|
|
37727
37886
|
}
|
|
37728
37887
|
const requested = env.ENVFILE;
|
|
37729
37888
|
if (!requested) return { name: DEFAULT_ENV_FILE, fromEnvfile: false };
|
|
@@ -37786,16 +37945,16 @@ function readProjectDotEnv(envsRoot, env = process.env) {
|
|
|
37786
37945
|
const notices = [];
|
|
37787
37946
|
const selection = selectEnvFile(env, notices);
|
|
37788
37947
|
const requestedPaths = [
|
|
37789
|
-
|
|
37790
|
-
|
|
37948
|
+
import_node_path30.default.resolve(import_node_path30.default.join(envsRoot, selection.name)),
|
|
37949
|
+
import_node_path30.default.resolve(selection.name)
|
|
37791
37950
|
];
|
|
37792
37951
|
const candidates = [
|
|
37793
37952
|
...requestedPaths,
|
|
37794
|
-
|
|
37953
|
+
import_node_path30.default.resolve(import_node_path30.default.join(envsRoot, DEFAULT_ENV_FILE))
|
|
37795
37954
|
];
|
|
37796
|
-
if (!
|
|
37955
|
+
if (!import_node_fs29.default.existsSync(candidates[2])) candidates.push(import_node_path30.default.resolve(DEFAULT_ENV_FILE));
|
|
37797
37956
|
const tried = [...new Set(candidates)];
|
|
37798
|
-
const resolved = tried.find((candidate) =>
|
|
37957
|
+
const resolved = tried.find((candidate) => import_node_fs29.default.existsSync(candidate));
|
|
37799
37958
|
if (!resolved) {
|
|
37800
37959
|
notices.push(
|
|
37801
37960
|
"*** Missing .env file ****",
|
|
@@ -37815,7 +37974,7 @@ function readProjectDotEnv(envsRoot, env = process.env) {
|
|
|
37815
37974
|
);
|
|
37816
37975
|
}
|
|
37817
37976
|
const config = {};
|
|
37818
|
-
for (const line of
|
|
37977
|
+
for (const line of import_node_fs29.default.readFileSync(resolved, "utf8").split("\n")) {
|
|
37819
37978
|
if (!line.trim()) continue;
|
|
37820
37979
|
if (/^[ \t\n\v\f\r]*#/.test(line)) continue;
|
|
37821
37980
|
const match = DOTENV_PATTERN.exec(line);
|
|
@@ -37825,12 +37984,12 @@ function readProjectDotEnv(envsRoot, env = process.env) {
|
|
|
37825
37984
|
}
|
|
37826
37985
|
return { config, notices };
|
|
37827
37986
|
}
|
|
37828
|
-
var
|
|
37987
|
+
var import_node_fs29, import_node_path30, DEFAULT_ENV_FILE, DOTENV_PATTERN, BUILD_SETTING_PATTERN, INVALID_ENTRY;
|
|
37829
37988
|
var init_dot_env = __esm({
|
|
37830
37989
|
"src/dot-env.ts"() {
|
|
37831
37990
|
"use strict";
|
|
37832
|
-
|
|
37833
|
-
|
|
37991
|
+
import_node_fs29 = __toESM(require("node:fs"), 1);
|
|
37992
|
+
import_node_path30 = __toESM(require("node:path"), 1);
|
|
37834
37993
|
DEFAULT_ENV_FILE = ".env";
|
|
37835
37994
|
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
37995
|
BUILD_SETTING_PATTERN = /\$[({]([A-Za-z_][A-Za-z0-9_]*)[)}]|\$([A-Za-z_][A-Za-z0-9_]*)/g;
|
|
@@ -37854,8 +38013,8 @@ var init_flow_timeout_scale = __esm({
|
|
|
37854
38013
|
function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
37855
38014
|
const result = {};
|
|
37856
38015
|
let config = {};
|
|
37857
|
-
const appJsonPath =
|
|
37858
|
-
const appJson =
|
|
38016
|
+
const appJsonPath = import_node_path31.default.join(projectRoot, "app.json");
|
|
38017
|
+
const appJson = import_node_fs30.default.existsSync(appJsonPath) ? JSON.parse(import_node_fs30.default.readFileSync(appJsonPath, "utf8")) : null;
|
|
37859
38018
|
const staticExpo = isRecord(appJson) && (isRecord(appJson.expo) || [appJson.ios, appJson.android].some(
|
|
37860
38019
|
(value) => isRecord(value) && typeof value.googleServicesFile === "string"
|
|
37861
38020
|
));
|
|
@@ -37864,9 +38023,9 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
37864
38023
|
"app.config.ts",
|
|
37865
38024
|
"app.config.cjs",
|
|
37866
38025
|
"app.config.mjs"
|
|
37867
|
-
].some((name2) =>
|
|
38026
|
+
].some((name2) => import_node_fs30.default.existsSync(import_node_path31.default.join(projectRoot, name2)));
|
|
37868
38027
|
if (staticExpo || dynamicExpo) {
|
|
37869
|
-
const require5 = (0, import_node_module2.createRequire)(
|
|
38028
|
+
const require5 = (0, import_node_module2.createRequire)(import_node_path31.default.join(projectRoot, "package.json"));
|
|
37870
38029
|
const configModule = require5("@expo/config");
|
|
37871
38030
|
if (!isRecord(configModule) || typeof configModule.getConfig !== "function")
|
|
37872
38031
|
throw new Error("Expo native configuration is unavailable.");
|
|
@@ -37878,23 +38037,23 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
37878
38037
|
}
|
|
37879
38038
|
const ios = config.ios;
|
|
37880
38039
|
if (platforms.includes("ios") && (!isRecord(ios) || typeof ios.googleServicesFile !== "string")) {
|
|
37881
|
-
const iosRoot =
|
|
37882
|
-
if (
|
|
37883
|
-
const projects2 =
|
|
38040
|
+
const iosRoot = import_node_path31.default.join(projectRoot, "ios");
|
|
38041
|
+
if (import_node_fs30.default.existsSync(iosRoot)) {
|
|
38042
|
+
const projects2 = import_node_fs30.default.readdirSync(iosRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory() && entry.name.endsWith(".xcodeproj"));
|
|
37884
38043
|
if (projects2.length > 1)
|
|
37885
38044
|
throw new Error("native Firebase configuration requires a selected Xcode project");
|
|
37886
38045
|
if (projects2.length === 1) {
|
|
37887
|
-
const xcodeproj =
|
|
38046
|
+
const xcodeproj = import_node_path31.default.join(iosRoot, projects2[0].name);
|
|
37888
38047
|
const appTargets = listXcodeAppTargets(xcodeproj);
|
|
37889
38048
|
if (appTargets.length > 1)
|
|
37890
38049
|
throw new Error("native Firebase configuration requires a selected app target");
|
|
37891
38050
|
if (appTargets.length === 1) {
|
|
37892
38051
|
const app = readXcodeAppTarget(xcodeproj, appTargets[0]);
|
|
37893
38052
|
const delegates = app.allSources.filter(
|
|
37894
|
-
(file) => /^AppDelegate\.(swift|mm|m)$/.test(
|
|
38053
|
+
(file) => /^AppDelegate\.(swift|mm|m)$/.test(import_node_path31.default.basename(file))
|
|
37895
38054
|
);
|
|
37896
38055
|
const defaultConfigured = delegates.some((file) => {
|
|
37897
|
-
const source =
|
|
38056
|
+
const source = import_node_fs30.default.readFileSync(file, "utf8").replace(
|
|
37898
38057
|
/\/\*[\s\S]*?\*\/|\/\/[^\n]*|"(?:\\.|[^"\\])*"/g,
|
|
37899
38058
|
(token) => token.startsWith('"') ? '""' : token.replace(/[^\n]/g, " ")
|
|
37900
38059
|
);
|
|
@@ -37922,15 +38081,15 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
37922
38081
|
});
|
|
37923
38082
|
if (defaultConfigured) {
|
|
37924
38083
|
const resources = app.resources.filter(
|
|
37925
|
-
(file) => /^GoogleService-Info\.plist$/.test(
|
|
38084
|
+
(file) => /^GoogleService-Info\.plist$/.test(import_node_path31.default.basename(file))
|
|
37926
38085
|
);
|
|
37927
38086
|
if (resources.length !== 1)
|
|
37928
38087
|
throw new Error(
|
|
37929
38088
|
"native Firebase default initialization requires one GoogleService-Info.plist build resource"
|
|
37930
38089
|
);
|
|
37931
38090
|
config.ios = {
|
|
37932
|
-
googleServicesFile:
|
|
37933
|
-
|
|
38091
|
+
googleServicesFile: import_node_path31.default.relative(
|
|
38092
|
+
import_node_fs30.default.realpathSync(projectRoot),
|
|
37934
38093
|
resources[0]
|
|
37935
38094
|
)
|
|
37936
38095
|
};
|
|
@@ -37943,8 +38102,8 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
37943
38102
|
const native = config[platform];
|
|
37944
38103
|
if (!isRecord(native) || typeof native.googleServicesFile !== "string") continue;
|
|
37945
38104
|
try {
|
|
37946
|
-
const source =
|
|
37947
|
-
|
|
38105
|
+
const source = import_node_fs30.default.readFileSync(
|
|
38106
|
+
import_node_path31.default.resolve(projectRoot, native.googleServicesFile),
|
|
37948
38107
|
"utf8"
|
|
37949
38108
|
);
|
|
37950
38109
|
const parsed = platform === "ios" ? parsePlistSource(source) : JSON.parse(source);
|
|
@@ -37996,13 +38155,13 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
37996
38155
|
}
|
|
37997
38156
|
return result;
|
|
37998
38157
|
}
|
|
37999
|
-
var
|
|
38158
|
+
var import_node_fs30, import_node_module2, import_node_path31;
|
|
38000
38159
|
var init_native_firebase_config = __esm({
|
|
38001
38160
|
"src/native-firebase-config.ts"() {
|
|
38002
38161
|
"use strict";
|
|
38003
|
-
|
|
38162
|
+
import_node_fs30 = __toESM(require("node:fs"), 1);
|
|
38004
38163
|
import_node_module2 = require("node:module");
|
|
38005
|
-
|
|
38164
|
+
import_node_path31 = __toESM(require("node:path"), 1);
|
|
38006
38165
|
init_is_record();
|
|
38007
38166
|
init_plist();
|
|
38008
38167
|
init_xcode_project();
|
|
@@ -38116,59 +38275,59 @@ var init_profiles = __esm({
|
|
|
38116
38275
|
// cli/app-catalog.ts
|
|
38117
38276
|
function listDir(dir) {
|
|
38118
38277
|
try {
|
|
38119
|
-
return
|
|
38278
|
+
return import_node_fs31.default.readdirSync(dir, { withFileTypes: true });
|
|
38120
38279
|
} catch {
|
|
38121
38280
|
return [];
|
|
38122
38281
|
}
|
|
38123
38282
|
}
|
|
38124
38283
|
function readText(file) {
|
|
38125
38284
|
try {
|
|
38126
|
-
return
|
|
38285
|
+
return import_node_fs31.default.readFileSync(file, "utf8");
|
|
38127
38286
|
} catch {
|
|
38128
38287
|
return null;
|
|
38129
38288
|
}
|
|
38130
38289
|
}
|
|
38131
38290
|
function catalogFiles(dir, found) {
|
|
38132
38291
|
for (const entry of listDir(dir)) {
|
|
38133
|
-
const full =
|
|
38292
|
+
const full = import_node_path32.default.join(dir, entry.name);
|
|
38134
38293
|
if (entry.isDirectory()) catalogFiles(full, found);
|
|
38135
38294
|
else if (entry.name === "Contents.json") found.push(full);
|
|
38136
38295
|
}
|
|
38137
38296
|
}
|
|
38138
38297
|
function discoverAppCatalog(appDir) {
|
|
38139
|
-
const iosDir =
|
|
38298
|
+
const iosDir = import_node_path32.default.join(appDir, "ios");
|
|
38140
38299
|
const target = listDir(iosDir).find(
|
|
38141
|
-
(entry) => entry.isDirectory() && entry.name !== "Pods" && listDir(
|
|
38300
|
+
(entry) => entry.isDirectory() && entry.name !== "Pods" && listDir(import_node_path32.default.join(iosDir, entry.name)).some(
|
|
38142
38301
|
(file) => /^AppDelegate\.(swift|mm|m)$/.test(file.name)
|
|
38143
38302
|
)
|
|
38144
38303
|
);
|
|
38145
38304
|
if (!target) return null;
|
|
38146
|
-
const targetDir =
|
|
38305
|
+
const targetDir = import_node_path32.default.join(iosDir, target.name);
|
|
38147
38306
|
const files = [];
|
|
38148
38307
|
for (const entry of listDir(targetDir)) {
|
|
38149
38308
|
if (entry.isDirectory() && entry.name.endsWith(".xcassets"))
|
|
38150
|
-
catalogFiles(
|
|
38309
|
+
catalogFiles(import_node_path32.default.join(targetDir, entry.name), files);
|
|
38151
38310
|
}
|
|
38152
38311
|
const relative3 = files.map(
|
|
38153
|
-
(file) =>
|
|
38312
|
+
(file) => import_node_path32.default.relative(targetDir, file).split(import_node_path32.default.sep).join(import_node_path32.default.posix.sep)
|
|
38154
38313
|
);
|
|
38155
38314
|
const colors = enumerateBundleColors(
|
|
38156
38315
|
relative3,
|
|
38157
|
-
(candidate) => candidate.endsWith("Contents.json") ? readText(
|
|
38316
|
+
(candidate) => candidate.endsWith("Contents.json") ? readText(import_node_path32.default.join(targetDir, candidate)) : null
|
|
38158
38317
|
);
|
|
38159
38318
|
const pbxproj = listDir(iosDir).find((entry) => entry.name.endsWith(".xcodeproj"));
|
|
38160
|
-
const accentName = readText(
|
|
38319
|
+
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
38320
|
ACCENT_BUILD_SETTING
|
|
38162
38321
|
)?.[1] : void 0) ?? null;
|
|
38163
38322
|
if (accentName === null && Object.keys(colors).length === 0) return null;
|
|
38164
38323
|
return { colors, accentName };
|
|
38165
38324
|
}
|
|
38166
|
-
var
|
|
38325
|
+
var import_node_fs31, import_node_path32, ACCENT_BUILD_SETTING, PLIST_ACCENT;
|
|
38167
38326
|
var init_app_catalog = __esm({
|
|
38168
38327
|
"cli/app-catalog.ts"() {
|
|
38169
38328
|
"use strict";
|
|
38170
|
-
|
|
38171
|
-
|
|
38329
|
+
import_node_fs31 = __toESM(require("node:fs"), 1);
|
|
38330
|
+
import_node_path32 = __toESM(require("node:path"), 1);
|
|
38172
38331
|
init_bundleAssets();
|
|
38173
38332
|
ACCENT_BUILD_SETTING = /ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = "?([^";]+)"?;/;
|
|
38174
38333
|
PLIST_ACCENT = /<key>NSAccentColorName<\/key>\s*<string>([^<]+)<\/string>/;
|
|
@@ -38178,9 +38337,9 @@ var init_app_catalog = __esm({
|
|
|
38178
38337
|
// cli/app-project.ts
|
|
38179
38338
|
function firstNamedFile(dir, names) {
|
|
38180
38339
|
for (const name2 of names) {
|
|
38181
|
-
const candidate =
|
|
38340
|
+
const candidate = import_node_path33.default.join(dir, name2);
|
|
38182
38341
|
try {
|
|
38183
|
-
if (
|
|
38342
|
+
if (import_node_fs32.default.statSync(candidate).isFile()) return candidate;
|
|
38184
38343
|
} catch {
|
|
38185
38344
|
}
|
|
38186
38345
|
}
|
|
@@ -38193,24 +38352,24 @@ function findRNXAppConfig(dir) {
|
|
|
38193
38352
|
return firstNamedFile(dir, PEACH_APP_CONFIG_NAMES);
|
|
38194
38353
|
}
|
|
38195
38354
|
function resolveAppProject(projectRoot) {
|
|
38196
|
-
const appDir =
|
|
38355
|
+
const appDir = import_node_path33.default.resolve(projectRoot);
|
|
38197
38356
|
try {
|
|
38198
|
-
if (!
|
|
38357
|
+
if (!import_node_fs32.default.statSync(appDir).isDirectory()) return null;
|
|
38199
38358
|
} catch {
|
|
38200
38359
|
return null;
|
|
38201
38360
|
}
|
|
38202
38361
|
const configPath = findRNXAppConfig(appDir);
|
|
38203
|
-
if (!configPath && !findExpoAppConfig(appDir) && !
|
|
38362
|
+
if (!configPath && !findExpoAppConfig(appDir) && !import_node_fs32.default.existsSync(import_node_path33.default.join(appDir, "package.json"))) {
|
|
38204
38363
|
return null;
|
|
38205
38364
|
}
|
|
38206
38365
|
return { appDir, configPath };
|
|
38207
38366
|
}
|
|
38208
|
-
var
|
|
38367
|
+
var import_node_fs32, import_node_path33, EXPO_APP_CONFIG_NAMES, PEACH_APP_CONFIG_NAMES;
|
|
38209
38368
|
var init_app_project = __esm({
|
|
38210
38369
|
"cli/app-project.ts"() {
|
|
38211
38370
|
"use strict";
|
|
38212
|
-
|
|
38213
|
-
|
|
38371
|
+
import_node_fs32 = __toESM(require("node:fs"), 1);
|
|
38372
|
+
import_node_path33 = __toESM(require("node:path"), 1);
|
|
38214
38373
|
EXPO_APP_CONFIG_NAMES = [
|
|
38215
38374
|
"app.config.js",
|
|
38216
38375
|
"app.config.ts",
|
|
@@ -38233,12 +38392,12 @@ function resolveFileEntries(entries, configDir) {
|
|
|
38233
38392
|
return Object.fromEntries(
|
|
38234
38393
|
Object.entries(entries).map(([name2, resolution]) => [
|
|
38235
38394
|
name2,
|
|
38236
|
-
resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file:
|
|
38395
|
+
resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file: import_node_path34.default.resolve(configDir, resolution.file) } : resolution
|
|
38237
38396
|
])
|
|
38238
38397
|
);
|
|
38239
38398
|
}
|
|
38240
38399
|
function resolveConfigReplacementFiles(config, configPath) {
|
|
38241
|
-
const configDir =
|
|
38400
|
+
const configDir = import_node_path34.default.dirname(configPath);
|
|
38242
38401
|
return {
|
|
38243
38402
|
...config,
|
|
38244
38403
|
modules: resolveFileEntries(config.modules, configDir),
|
|
@@ -38275,12 +38434,12 @@ async function resolveRNXAppConfig(startDir = process.cwd()) {
|
|
|
38275
38434
|
const project = resolveAppProject(startDir);
|
|
38276
38435
|
return { project, config: await loadRNXAppConfig(project) };
|
|
38277
38436
|
}
|
|
38278
|
-
var import_node_module3,
|
|
38437
|
+
var import_node_module3, import_node_path34, import_jiti, require2;
|
|
38279
38438
|
var init_app_config = __esm({
|
|
38280
38439
|
"cli/app-config.ts"() {
|
|
38281
38440
|
"use strict";
|
|
38282
38441
|
import_node_module3 = require("node:module");
|
|
38283
|
-
|
|
38442
|
+
import_node_path34 = __toESM(require("node:path"), 1);
|
|
38284
38443
|
import_jiti = require("jiti");
|
|
38285
38444
|
init_config();
|
|
38286
38445
|
init_public_brand();
|
|
@@ -38337,13 +38496,13 @@ function discoverNativeLinkedAppFonts(opts) {
|
|
|
38337
38496
|
scannedFontDirectories++;
|
|
38338
38497
|
let entries;
|
|
38339
38498
|
try {
|
|
38340
|
-
entries =
|
|
38499
|
+
entries = import_node_fs33.default.readdirSync(current.dir, { withFileTypes: true });
|
|
38341
38500
|
} catch {
|
|
38342
38501
|
continue;
|
|
38343
38502
|
}
|
|
38344
38503
|
for (const entry of entries) {
|
|
38345
38504
|
if (entry.isSymbolicLink()) continue;
|
|
38346
|
-
const fullPath =
|
|
38505
|
+
const fullPath = import_node_path35.default.join(current.dir, entry.name);
|
|
38347
38506
|
if (entry.isDirectory()) {
|
|
38348
38507
|
if (current.depth < 4 && pending.length < 64 && !entry.name.startsWith(".")) {
|
|
38349
38508
|
pending.push({ dir: fullPath, depth: current.depth + 1 });
|
|
@@ -38351,15 +38510,15 @@ function discoverNativeLinkedAppFonts(opts) {
|
|
|
38351
38510
|
continue;
|
|
38352
38511
|
}
|
|
38353
38512
|
if (!entry.isFile() || !/\.(ttf|otf|woff|woff2)$/i.test(entry.name)) continue;
|
|
38354
|
-
const relative3 =
|
|
38355
|
-
fontPaths.push(
|
|
38513
|
+
const relative3 = import_node_path35.default.relative(root, fullPath).split(import_node_path35.default.sep).join("/");
|
|
38514
|
+
fontPaths.push(import_node_path35.default.posix.join(metroPathPrefix, relative3));
|
|
38356
38515
|
if (fontPaths.length >= 256) break;
|
|
38357
38516
|
}
|
|
38358
38517
|
}
|
|
38359
38518
|
};
|
|
38360
38519
|
try {
|
|
38361
38520
|
const packageJson = JSON.parse(
|
|
38362
|
-
|
|
38521
|
+
import_node_fs33.default.readFileSync(import_node_path35.default.join(selectedAppDir, "package.json"), "utf8")
|
|
38363
38522
|
);
|
|
38364
38523
|
const dependencyNames = /* @__PURE__ */ new Set();
|
|
38365
38524
|
for (const field of ["dependencies", "devDependencies", "optionalDependencies"]) {
|
|
@@ -38374,32 +38533,32 @@ function discoverNativeLinkedAppFonts(opts) {
|
|
|
38374
38533
|
const config = Reflect.get(packageJson, "reactNativeVectorIcons");
|
|
38375
38534
|
const configuredFontDir = config && typeof config === "object" ? Reflect.get(config, "fontDir") : null;
|
|
38376
38535
|
const configuredDir = typeof configuredFontDir === "string" ? configuredFontDir : "rnvi-fonts";
|
|
38377
|
-
const root =
|
|
38378
|
-
const relativeRoot =
|
|
38379
|
-
if (!relativeRoot.startsWith("..") && !
|
|
38380
|
-
collectFontFiles(root, relativeRoot.split(
|
|
38536
|
+
const root = import_node_path35.default.resolve(selectedAppDir, configuredDir);
|
|
38537
|
+
const relativeRoot = import_node_path35.default.relative(selectedAppDir, root);
|
|
38538
|
+
if (!relativeRoot.startsWith("..") && !import_node_path35.default.isAbsolute(relativeRoot)) {
|
|
38539
|
+
collectFontFiles(root, relativeRoot.split(import_node_path35.default.sep).join("/"));
|
|
38381
38540
|
}
|
|
38382
|
-
const bundleDir =
|
|
38383
|
-
const appRelativeDir = bundleDir.split("/").join(
|
|
38541
|
+
const bundleDir = import_node_path35.default.posix.dirname(new URL(opts.bundleUrl).pathname).replace(/^\/+/, "");
|
|
38542
|
+
const appRelativeDir = bundleDir.split("/").join(import_node_path35.default.sep);
|
|
38384
38543
|
const metroRootCandidates = [selectedAppDir];
|
|
38385
|
-
if (bundleDir && selectedAppDir.endsWith(
|
|
38544
|
+
if (bundleDir && selectedAppDir.endsWith(import_node_path35.default.sep + appRelativeDir)) {
|
|
38386
38545
|
metroRootCandidates.push(selectedAppDir.slice(0, -appRelativeDir.length - 1));
|
|
38387
38546
|
}
|
|
38388
|
-
const vectorIconRequire = (0, import_node_module4.createRequire)(
|
|
38547
|
+
const vectorIconRequire = (0, import_node_module4.createRequire)(import_node_path35.default.join(selectedAppDir, "package.json"));
|
|
38389
38548
|
for (const dependencyName of vectorIconDependencies) {
|
|
38390
38549
|
try {
|
|
38391
38550
|
const entryPath = vectorIconRequire.resolve(dependencyName);
|
|
38392
|
-
const dependencyPath = dependencyName.split("/").join(
|
|
38393
|
-
const marker = `${
|
|
38551
|
+
const dependencyPath = dependencyName.split("/").join(import_node_path35.default.sep);
|
|
38552
|
+
const marker = `${import_node_path35.default.sep}node_modules${import_node_path35.default.sep}${dependencyPath}${import_node_path35.default.sep}`;
|
|
38394
38553
|
const markerIndex = entryPath.lastIndexOf(marker);
|
|
38395
38554
|
if (markerIndex === -1) continue;
|
|
38396
38555
|
const packageRoot = entryPath.slice(0, markerIndex + marker.length - 1);
|
|
38397
38556
|
const fontsDir = dependencyName === "react-native-vector-icons" ? "Fonts" : "fonts";
|
|
38398
|
-
const fontsRoot =
|
|
38557
|
+
const fontsRoot = import_node_path35.default.join(packageRoot, fontsDir);
|
|
38399
38558
|
for (const metroRoot of metroRootCandidates) {
|
|
38400
38559
|
collectFontFiles(
|
|
38401
38560
|
fontsRoot,
|
|
38402
|
-
|
|
38561
|
+
import_node_path35.default.relative(metroRoot, fontsRoot).split(import_node_path35.default.sep).join("/")
|
|
38403
38562
|
);
|
|
38404
38563
|
}
|
|
38405
38564
|
} catch {
|
|
@@ -38409,37 +38568,37 @@ function discoverNativeLinkedAppFonts(opts) {
|
|
|
38409
38568
|
} catch {
|
|
38410
38569
|
}
|
|
38411
38570
|
try {
|
|
38412
|
-
const configPath =
|
|
38413
|
-
if (
|
|
38414
|
-
const appConfigRequire = (0, import_node_module4.createRequire)(
|
|
38571
|
+
const configPath = import_node_path35.default.join(selectedAppDir, "react-native.config.js");
|
|
38572
|
+
if (import_node_fs33.default.statSync(configPath).isFile()) {
|
|
38573
|
+
const appConfigRequire = (0, import_node_module4.createRequire)(import_node_path35.default.join(selectedAppDir, "package.json"));
|
|
38415
38574
|
const rnConfig = appConfigRequire(configPath);
|
|
38416
38575
|
const assets2 = rnConfig && typeof rnConfig === "object" ? Reflect.get(rnConfig, "assets") : null;
|
|
38417
38576
|
if (Array.isArray(assets2)) {
|
|
38418
38577
|
for (const assetDir of assets2) {
|
|
38419
38578
|
if (typeof assetDir !== "string") continue;
|
|
38420
|
-
const root =
|
|
38421
|
-
const relativeRoot =
|
|
38422
|
-
if (relativeRoot.startsWith("..") ||
|
|
38423
|
-
collectFontFiles(root, relativeRoot.split(
|
|
38579
|
+
const root = import_node_path35.default.resolve(selectedAppDir, assetDir);
|
|
38580
|
+
const relativeRoot = import_node_path35.default.relative(selectedAppDir, root);
|
|
38581
|
+
if (relativeRoot.startsWith("..") || import_node_path35.default.isAbsolute(relativeRoot)) continue;
|
|
38582
|
+
collectFontFiles(root, relativeRoot.split(import_node_path35.default.sep).join("/"));
|
|
38424
38583
|
}
|
|
38425
38584
|
}
|
|
38426
38585
|
}
|
|
38427
38586
|
} catch {
|
|
38428
38587
|
}
|
|
38429
38588
|
if (platform === "ios") {
|
|
38430
|
-
const iosDir =
|
|
38589
|
+
const iosDir = import_node_path35.default.join(selectedAppDir, "ios");
|
|
38431
38590
|
try {
|
|
38432
|
-
const targetDirs =
|
|
38591
|
+
const targetDirs = import_node_fs33.default.readdirSync(iosDir, { withFileTypes: true }).filter(
|
|
38433
38592
|
(entry) => entry.isDirectory() && !entry.isSymbolicLink() && entry.name !== "Pods" && entry.name !== "build" && !entry.name.startsWith(".")
|
|
38434
38593
|
).slice(0, 64);
|
|
38435
|
-
const plistPaths = [
|
|
38594
|
+
const plistPaths = [import_node_path35.default.join(iosDir, "Info.plist")];
|
|
38436
38595
|
for (const entry of targetDirs) {
|
|
38437
|
-
plistPaths.push(
|
|
38596
|
+
plistPaths.push(import_node_path35.default.join(iosDir, entry.name, "Info.plist"));
|
|
38438
38597
|
}
|
|
38439
38598
|
for (const plistPath of plistPaths) {
|
|
38440
38599
|
let parsed;
|
|
38441
38600
|
try {
|
|
38442
|
-
parsed = parsePlistSource(
|
|
38601
|
+
parsed = parsePlistSource(import_node_fs33.default.readFileSync(plistPath, "utf8"));
|
|
38443
38602
|
} catch {
|
|
38444
38603
|
continue;
|
|
38445
38604
|
}
|
|
@@ -38449,21 +38608,21 @@ function discoverNativeLinkedAppFonts(opts) {
|
|
|
38449
38608
|
for (const declaredFont of declaredFonts) {
|
|
38450
38609
|
if (typeof declaredFont !== "string") continue;
|
|
38451
38610
|
const candidates = [
|
|
38452
|
-
|
|
38453
|
-
|
|
38611
|
+
import_node_path35.default.resolve(import_node_path35.default.dirname(plistPath), declaredFont),
|
|
38612
|
+
import_node_path35.default.resolve(iosDir, declaredFont)
|
|
38454
38613
|
];
|
|
38455
38614
|
const fontPath = candidates.find((candidate) => {
|
|
38456
|
-
const relative3 =
|
|
38457
|
-
if (relative3.startsWith("..") ||
|
|
38615
|
+
const relative3 = import_node_path35.default.relative(selectedAppDir, candidate);
|
|
38616
|
+
if (relative3.startsWith("..") || import_node_path35.default.isAbsolute(relative3)) return false;
|
|
38458
38617
|
try {
|
|
38459
|
-
return
|
|
38618
|
+
return import_node_fs33.default.statSync(candidate).isFile();
|
|
38460
38619
|
} catch {
|
|
38461
38620
|
return false;
|
|
38462
38621
|
}
|
|
38463
38622
|
});
|
|
38464
38623
|
if (!fontPath) continue;
|
|
38465
38624
|
fontPaths.push(
|
|
38466
|
-
|
|
38625
|
+
import_node_path35.default.relative(selectedAppDir, fontPath).split(import_node_path35.default.sep).join("/")
|
|
38467
38626
|
);
|
|
38468
38627
|
}
|
|
38469
38628
|
}
|
|
@@ -38505,13 +38664,13 @@ async function resolveMetroProjectRoot(bundleUrl, opts) {
|
|
|
38505
38664
|
function encodeAppFontsWire(specs) {
|
|
38506
38665
|
return specs.map((spec) => `${encodeURIComponent(spec.url)}::${encodeURIComponent(spec.family)}`).join(",");
|
|
38507
38666
|
}
|
|
38508
|
-
var
|
|
38667
|
+
var import_node_fs33, import_node_module4, import_node_path35, import_config_plugin_fonts, require3;
|
|
38509
38668
|
var init_app_fonts = __esm({
|
|
38510
38669
|
"cli/app-fonts.ts"() {
|
|
38511
38670
|
"use strict";
|
|
38512
|
-
|
|
38671
|
+
import_node_fs33 = __toESM(require("node:fs"), 1);
|
|
38513
38672
|
import_node_module4 = require("node:module");
|
|
38514
|
-
|
|
38673
|
+
import_node_path35 = __toESM(require("node:path"), 1);
|
|
38515
38674
|
import_config_plugin_fonts = require("peach-engine/engine/config-plugin-fonts");
|
|
38516
38675
|
init_dev_server_scanner();
|
|
38517
38676
|
init_backend_origin();
|
|
@@ -39441,9 +39600,9 @@ var init_bridge_diagnostics = __esm({
|
|
|
39441
39600
|
|
|
39442
39601
|
// src/desktop-host-delivery.ts
|
|
39443
39602
|
function bundleValue(app, key) {
|
|
39444
|
-
const read = (0,
|
|
39603
|
+
const read = (0, import_node_child_process12.spawnSync)(
|
|
39445
39604
|
"plutil",
|
|
39446
|
-
["-extract", key, "raw", "-o", "-",
|
|
39605
|
+
["-extract", key, "raw", "-o", "-", import_node_path36.default.join(app, "Contents/Info.plist")],
|
|
39447
39606
|
{ encoding: "utf8" }
|
|
39448
39607
|
);
|
|
39449
39608
|
return read.status === 0 ? read.stdout.trim() : null;
|
|
@@ -39457,12 +39616,12 @@ function placedHostVersion() {
|
|
|
39457
39616
|
function activeDesktopHostApp() {
|
|
39458
39617
|
return placedHostVersion() ? MAC_HOST_APP : null;
|
|
39459
39618
|
}
|
|
39460
|
-
var
|
|
39619
|
+
var import_node_child_process12, import_node_path36, MAC_HOST_APP, HOST_BUNDLE_ID;
|
|
39461
39620
|
var init_desktop_host_delivery = __esm({
|
|
39462
39621
|
"src/desktop-host-delivery.ts"() {
|
|
39463
39622
|
"use strict";
|
|
39464
|
-
|
|
39465
|
-
|
|
39623
|
+
import_node_child_process12 = require("node:child_process");
|
|
39624
|
+
import_node_path36 = __toESM(require("node:path"), 1);
|
|
39466
39625
|
init_src();
|
|
39467
39626
|
init_home_paths();
|
|
39468
39627
|
MAC_HOST_APP = "/Applications/Peach.app";
|
|
@@ -40985,7 +41144,7 @@ function linuxBrowserLibsKey(id, arch) {
|
|
|
40985
41144
|
return `linux-libs/${id}/${arch}.tar.gz`;
|
|
40986
41145
|
}
|
|
40987
41146
|
function missingLibraries(executablePath, libraryPath) {
|
|
40988
|
-
const ldd = (0,
|
|
41147
|
+
const ldd = (0, import_node_child_process13.spawnSync)("ldd", [executablePath], {
|
|
40989
41148
|
encoding: "utf8",
|
|
40990
41149
|
timeout: 3e4,
|
|
40991
41150
|
env: libraryPath ? {
|
|
@@ -41009,8 +41168,8 @@ async function ensureLinuxBrowserLibraries(executablePath, browser) {
|
|
|
41009
41168
|
};
|
|
41010
41169
|
}
|
|
41011
41170
|
const lock = parseLinuxBrowserLibsLock(linux_browser_libs_lock_default);
|
|
41012
|
-
const dir = (0,
|
|
41013
|
-
if (!(0,
|
|
41171
|
+
const dir = (0, import_node_path37.join)(rnxHomeDir(), "linux-libs", `${lock.id}-${arch}`);
|
|
41172
|
+
if (!(0, import_node_fs34.existsSync)((0, import_node_path37.join)(dir, LINUX_BROWSER_LIBS_MARKER))) {
|
|
41014
41173
|
const url = `${DEFAULT_CLI_RELEASE_ORIGIN}/${linuxBrowserLibsKey(lock.id, arch)}`;
|
|
41015
41174
|
process.stderr.write(
|
|
41016
41175
|
`peach: this system lacks ${missing.length} shared libraries ${browser} links; downloading them\u2026
|
|
@@ -41038,7 +41197,7 @@ async function ensureLinuxBrowserLibraries(executablePath, browser) {
|
|
|
41038
41197
|
};
|
|
41039
41198
|
}
|
|
41040
41199
|
}
|
|
41041
|
-
const libraryPath = [(0,
|
|
41200
|
+
const libraryPath = [(0, import_node_path37.join)(dir, "lib"), (0, import_node_path37.join)(dir, "lib", "nss")].join(":");
|
|
41042
41201
|
const stillMissing = missingLibraries(executablePath, libraryPath);
|
|
41043
41202
|
if (stillMissing.length) {
|
|
41044
41203
|
return {
|
|
@@ -41048,13 +41207,13 @@ async function ensureLinuxBrowserLibraries(executablePath, browser) {
|
|
|
41048
41207
|
}
|
|
41049
41208
|
return { ok: true, libraryPath };
|
|
41050
41209
|
}
|
|
41051
|
-
var
|
|
41210
|
+
var import_node_child_process13, import_node_fs34, import_node_path37, LINUX_BROWSER_LIBS_ARCHES, LINUX_BROWSER_LIBS_MARKER;
|
|
41052
41211
|
var init_linux_browser_libs = __esm({
|
|
41053
41212
|
"cli/drivers/linux-browser-libs.ts"() {
|
|
41054
41213
|
"use strict";
|
|
41055
|
-
|
|
41056
|
-
|
|
41057
|
-
|
|
41214
|
+
import_node_child_process13 = require("node:child_process");
|
|
41215
|
+
import_node_fs34 = require("node:fs");
|
|
41216
|
+
import_node_path37 = require("node:path");
|
|
41058
41217
|
init_src();
|
|
41059
41218
|
init_home_paths();
|
|
41060
41219
|
init_is_record();
|
|
@@ -41078,13 +41237,13 @@ function resolvePlaywright() {
|
|
|
41078
41237
|
try {
|
|
41079
41238
|
const modulePath = requireFromRoot.resolve(spec);
|
|
41080
41239
|
const packageJsonPath = requireFromRoot.resolve(`${spec}/package.json`);
|
|
41081
|
-
const parsed = JSON.parse((0,
|
|
41240
|
+
const parsed = JSON.parse((0, import_node_fs35.readFileSync)(packageJsonPath, "utf8"));
|
|
41082
41241
|
if (!isRecord(parsed) || typeof parsed.version !== "string") continue;
|
|
41083
41242
|
const corePackagePath = (0, import_node_module6.createRequire)(modulePath).resolve(
|
|
41084
41243
|
"playwright-core/package.json"
|
|
41085
41244
|
);
|
|
41086
|
-
const cliPath = (0,
|
|
41087
|
-
if (!(0,
|
|
41245
|
+
const cliPath = (0, import_node_path38.join)((0, import_node_path38.dirname)(corePackagePath), "cli.js");
|
|
41246
|
+
if (!(0, import_node_fs35.existsSync)(cliPath)) continue;
|
|
41088
41247
|
return {
|
|
41089
41248
|
spec,
|
|
41090
41249
|
modulePath,
|
|
@@ -41112,7 +41271,7 @@ async function provisionPlaywright() {
|
|
|
41112
41271
|
await installVerifiedTarball({
|
|
41113
41272
|
url: `https://registry.npmjs.org/playwright-core/-/playwright-core-${version}.tgz`,
|
|
41114
41273
|
digest: { algorithm, encoding: "base64", value: digest },
|
|
41115
|
-
destDir: (0,
|
|
41274
|
+
destDir: (0, import_node_path38.join)(playwrightCoreDir(version), "node_modules", "playwright-core"),
|
|
41116
41275
|
installedMarker: "package.json",
|
|
41117
41276
|
// npm tarballs hold the package under a leading `package/`
|
|
41118
41277
|
stripComponents: 1,
|
|
@@ -41128,7 +41287,7 @@ async function provisionPlaywright() {
|
|
|
41128
41287
|
}
|
|
41129
41288
|
function probeBrowser(resolved, env) {
|
|
41130
41289
|
const self = rnxSelfInvocation();
|
|
41131
|
-
const probe2 = (0,
|
|
41290
|
+
const probe2 = (0, import_node_child_process14.spawnSync)(
|
|
41132
41291
|
self.executable,
|
|
41133
41292
|
[...self.prefixArgs, RNX_INTERNAL_COMMAND, RNX_INTERNAL_CHILDREN.playwrightProbe],
|
|
41134
41293
|
{
|
|
@@ -41155,7 +41314,7 @@ function probeBrowser(resolved, env) {
|
|
|
41155
41314
|
return {
|
|
41156
41315
|
ok: true,
|
|
41157
41316
|
executablePath: parsed.executablePath,
|
|
41158
|
-
exists: parsed.exists && (0,
|
|
41317
|
+
exists: parsed.exists && (0, import_node_fs35.existsSync)(parsed.executablePath)
|
|
41159
41318
|
};
|
|
41160
41319
|
} catch (error) {
|
|
41161
41320
|
return {
|
|
@@ -41181,7 +41340,7 @@ async function ensurePlaywrightBrowser(resolved, headless, env = process.env) {
|
|
|
41181
41340
|
};
|
|
41182
41341
|
}
|
|
41183
41342
|
const installer = rnxSelfInvocation();
|
|
41184
|
-
const install = (0,
|
|
41343
|
+
const install = (0, import_node_child_process14.spawnSync)(
|
|
41185
41344
|
installer.executable,
|
|
41186
41345
|
[
|
|
41187
41346
|
...installer.prefixArgs,
|
|
@@ -41223,14 +41382,14 @@ ${detail}` : ""}`
|
|
|
41223
41382
|
libraryPath: libraries.libraryPath
|
|
41224
41383
|
};
|
|
41225
41384
|
}
|
|
41226
|
-
var
|
|
41385
|
+
var import_node_child_process14, import_node_fs35, import_node_module6, import_node_path38;
|
|
41227
41386
|
var init_playwright_provisioning = __esm({
|
|
41228
41387
|
"cli/drivers/playwright-provisioning.ts"() {
|
|
41229
41388
|
"use strict";
|
|
41230
|
-
|
|
41231
|
-
|
|
41389
|
+
import_node_child_process14 = require("node:child_process");
|
|
41390
|
+
import_node_fs35 = require("node:fs");
|
|
41232
41391
|
import_node_module6 = require("node:module");
|
|
41233
|
-
|
|
41392
|
+
import_node_path38 = require("node:path");
|
|
41234
41393
|
init_src();
|
|
41235
41394
|
init_home_paths();
|
|
41236
41395
|
init_is_record();
|
|
@@ -41617,7 +41776,7 @@ var init_parse_args = __esm({
|
|
|
41617
41776
|
// cli/telemetry.ts
|
|
41618
41777
|
function sanitizeDiagnosticMessage(value) {
|
|
41619
41778
|
const firstLine = value.slice(0, 2048).split(/[\r\n\u2028\u2029]/, 1)[0] ?? "";
|
|
41620
|
-
return firstLine.split((0,
|
|
41779
|
+
return firstLine.split((0, import_node_os8.homedir)()).join("<home>").replace(
|
|
41621
41780
|
/<package:(?:@[\w.-]+\/)?[\w.-]+>|(?:https?:\/\/|file:\/\/|[A-Za-z]:[\\/]|<home>[\\/]|\/|\.{1,2}[\\/]|\b[\w.-]+[\\/])(?:[^\s"'<>]|\s(?=[^"'<>]*[\\/]))+/g,
|
|
41622
41781
|
(location2) => {
|
|
41623
41782
|
if (location2.startsWith("<package:")) return location2;
|
|
@@ -41644,11 +41803,11 @@ function trackCliDiagnostic(diagnostic) {
|
|
|
41644
41803
|
if (queue.some((queued) => JSON.stringify(queued) === JSON.stringify(entry))) return;
|
|
41645
41804
|
queue.push(entry);
|
|
41646
41805
|
}
|
|
41647
|
-
var
|
|
41806
|
+
var import_node_os8, import_crash_fingerprint, observedRuntimeVersion, queue, CRASH_REPORT_EVERY_MS;
|
|
41648
41807
|
var init_telemetry = __esm({
|
|
41649
41808
|
"cli/telemetry.ts"() {
|
|
41650
41809
|
"use strict";
|
|
41651
|
-
|
|
41810
|
+
import_node_os8 = require("node:os");
|
|
41652
41811
|
import_crash_fingerprint = require("peach-engine/crash-fingerprint");
|
|
41653
41812
|
init_cli_version();
|
|
41654
41813
|
init_home_paths();
|
|
@@ -41714,12 +41873,12 @@ var init_runtime_diagnostics = __esm({
|
|
|
41714
41873
|
// cli/commands/skills.ts
|
|
41715
41874
|
function getSkillsDir() {
|
|
41716
41875
|
if (typeof __PEACH_BUNDLED_SKILLS__ !== "undefined") {
|
|
41717
|
-
const dir =
|
|
41876
|
+
const dir = path31.join(rnxHomeDir(), "skills", getCliVersion());
|
|
41718
41877
|
for (const [file, body] of Object.entries(__PEACH_BUNDLED_SKILLS__)) {
|
|
41719
|
-
const target =
|
|
41720
|
-
if (
|
|
41721
|
-
|
|
41722
|
-
|
|
41878
|
+
const target = path31.join(dir, file);
|
|
41879
|
+
if (fs26.existsSync(target)) continue;
|
|
41880
|
+
fs26.mkdirSync(path31.dirname(target), { recursive: true });
|
|
41881
|
+
fs26.writeFileSync(target, body);
|
|
41723
41882
|
}
|
|
41724
41883
|
return dir;
|
|
41725
41884
|
}
|
|
@@ -41727,10 +41886,10 @@ function getSkillsDir() {
|
|
|
41727
41886
|
const pkgPath = (0, import_url3.fileURLToPath)(
|
|
41728
41887
|
import_meta4.resolve(`${rnxPublicBrand.packageName}/package.json`)
|
|
41729
41888
|
);
|
|
41730
|
-
return primaryCheckoutPath(
|
|
41889
|
+
return primaryCheckoutPath(path31.join(path31.dirname(pkgPath), "skills"));
|
|
41731
41890
|
} catch {
|
|
41732
|
-
const __dirname =
|
|
41733
|
-
return primaryCheckoutPath(
|
|
41891
|
+
const __dirname = path31.dirname((0, import_url3.fileURLToPath)(__sootsim_import_meta_url));
|
|
41892
|
+
return primaryCheckoutPath(path31.resolve(__dirname, "../../skills"));
|
|
41734
41893
|
}
|
|
41735
41894
|
}
|
|
41736
41895
|
function primaryCheckoutPath(dir) {
|
|
@@ -41753,17 +41912,17 @@ function primaryCheckoutPath(dir) {
|
|
|
41753
41912
|
} catch {
|
|
41754
41913
|
return dir;
|
|
41755
41914
|
}
|
|
41756
|
-
if (
|
|
41757
|
-
const primary =
|
|
41758
|
-
return
|
|
41915
|
+
if (path31.basename(common) !== ".git") return dir;
|
|
41916
|
+
const primary = path31.join(path31.dirname(common), path31.relative(top, dir));
|
|
41917
|
+
return fs26.existsSync(primary) ? primary : dir;
|
|
41759
41918
|
}
|
|
41760
41919
|
function skillsDir() {
|
|
41761
41920
|
skillsDirPath ??= getSkillsDir();
|
|
41762
41921
|
return skillsDirPath;
|
|
41763
41922
|
}
|
|
41764
41923
|
function targetFromHome(envName, fallbackDir) {
|
|
41765
|
-
const home = process.env[envName] ||
|
|
41766
|
-
return
|
|
41924
|
+
const home = process.env[envName] || path31.join(os7.homedir(), fallbackDir);
|
|
41925
|
+
return path31.join(home, "skills");
|
|
41767
41926
|
}
|
|
41768
41927
|
function defaultAgentTargets() {
|
|
41769
41928
|
return [
|
|
@@ -41776,7 +41935,7 @@ function hasInstalledPeachSkills() {
|
|
|
41776
41935
|
(file) => /^([^/]+)\/SKILL\.md$/.exec(file)?.[1] ?? []
|
|
41777
41936
|
) : listSkills().map((skill7) => skill7.name);
|
|
41778
41937
|
return defaultAgentTargets().some(
|
|
41779
|
-
({ dir }) => names.some((name2) =>
|
|
41938
|
+
({ dir }) => names.some((name2) => fs26.existsSync(path31.join(dir, name2, "SKILL.md")))
|
|
41780
41939
|
);
|
|
41781
41940
|
}
|
|
41782
41941
|
function parseSkillFrontmatter(content) {
|
|
@@ -41819,26 +41978,26 @@ function readFrontmatterField(frontmatter, field) {
|
|
|
41819
41978
|
return null;
|
|
41820
41979
|
}
|
|
41821
41980
|
function listSkills() {
|
|
41822
|
-
if (!
|
|
41981
|
+
if (!fs26.existsSync(skillsDir())) return [];
|
|
41823
41982
|
const skills = [];
|
|
41824
|
-
for (const entry of
|
|
41825
|
-
const skillMd =
|
|
41826
|
-
if (!
|
|
41827
|
-
const meta = parseSkillFrontmatter(
|
|
41983
|
+
for (const entry of fs26.readdirSync(skillsDir())) {
|
|
41984
|
+
const skillMd = path31.join(skillsDir(), entry, "SKILL.md");
|
|
41985
|
+
if (!fs26.existsSync(skillMd)) continue;
|
|
41986
|
+
const meta = parseSkillFrontmatter(fs26.readFileSync(skillMd, "utf8"));
|
|
41828
41987
|
if (meta) {
|
|
41829
41988
|
skills.push({ name: entry, description: meta.description });
|
|
41830
41989
|
}
|
|
41831
41990
|
}
|
|
41832
41991
|
return skills.sort((a, b) => a.name.localeCompare(b.name));
|
|
41833
41992
|
}
|
|
41834
|
-
var import_child_process7,
|
|
41993
|
+
var import_child_process7, fs26, os7, path31, import_url3, import_meta4, skillsDirPath;
|
|
41835
41994
|
var init_skills = __esm({
|
|
41836
41995
|
"cli/commands/skills.ts"() {
|
|
41837
41996
|
"use strict";
|
|
41838
41997
|
import_child_process7 = require("child_process");
|
|
41839
|
-
|
|
41840
|
-
|
|
41841
|
-
|
|
41998
|
+
fs26 = __toESM(require("fs"), 1);
|
|
41999
|
+
os7 = __toESM(require("os"), 1);
|
|
42000
|
+
path31 = __toESM(require("path"), 1);
|
|
41842
42001
|
import_url3 = require("url");
|
|
41843
42002
|
init_cli_version();
|
|
41844
42003
|
init_home_paths();
|
|
@@ -42325,14 +42484,14 @@ function assertExplicitBridgeLock(preferredPort, explicitPort, lock) {
|
|
|
42325
42484
|
async function ensureRuntimeForOpen() {
|
|
42326
42485
|
if (resolveDevCheckoutRuntimeRoot()) return;
|
|
42327
42486
|
const active = readActiveRuntime();
|
|
42328
|
-
if (active &&
|
|
42487
|
+
if (active && import_node_fs36.default.existsSync(runtimeDir(active))) return;
|
|
42329
42488
|
console.error(" installing peach engine runtime...");
|
|
42330
42489
|
const { runRuntime: runRuntime2 } = await Promise.resolve().then(() => (init_runtime(), runtime_exports));
|
|
42331
42490
|
await runRuntime2(["install"], {});
|
|
42332
42491
|
}
|
|
42333
42492
|
function spawnSootsim(args) {
|
|
42334
42493
|
const { executable, prefixArgs } = rnxSelfInvocation();
|
|
42335
|
-
return (0,
|
|
42494
|
+
return (0, import_node_child_process15.spawn)(executable, [...prefixArgs, ...args], {
|
|
42336
42495
|
detached: true,
|
|
42337
42496
|
stdio: "ignore",
|
|
42338
42497
|
env: process.env
|
|
@@ -42479,10 +42638,10 @@ async function buildResolvedBundleOpenUrl(target, baseUrl, opts = {}) {
|
|
|
42479
42638
|
}
|
|
42480
42639
|
function normalizeReplacementPath(filePath) {
|
|
42481
42640
|
if (filePath.startsWith("~/")) {
|
|
42482
|
-
return
|
|
42641
|
+
return import_node_path39.default.join(import_node_os9.default.homedir(), filePath.slice(2));
|
|
42483
42642
|
}
|
|
42484
|
-
if (
|
|
42485
|
-
return
|
|
42643
|
+
if (import_node_path39.default.isAbsolute(filePath)) return filePath;
|
|
42644
|
+
return import_node_path39.default.resolve(process.cwd(), filePath);
|
|
42486
42645
|
}
|
|
42487
42646
|
function parseOpenRuntimeConfig(args) {
|
|
42488
42647
|
const modules = {};
|
|
@@ -42501,7 +42660,7 @@ function parseOpenRuntimeConfig(args) {
|
|
|
42501
42660
|
}
|
|
42502
42661
|
const moduleName = raw2.slice(0, eqIndex).trim();
|
|
42503
42662
|
const filePath = normalizeReplacementPath(raw2.slice(eqIndex + 1).trim());
|
|
42504
|
-
if (!
|
|
42663
|
+
if (!import_node_fs36.default.existsSync(filePath)) {
|
|
42505
42664
|
console.error(` peach open: replacement file not found: ${filePath}`);
|
|
42506
42665
|
rnxExit(1);
|
|
42507
42666
|
}
|
|
@@ -42532,7 +42691,7 @@ async function resolveAppProjectForBundleUrl(bundleUrl) {
|
|
|
42532
42691
|
return advertisedRoot ? resolveAppProject(advertisedRoot) : null;
|
|
42533
42692
|
}
|
|
42534
42693
|
async function ensureConfiguredRuntime(version) {
|
|
42535
|
-
if (
|
|
42694
|
+
if (import_node_fs36.default.existsSync(import_node_path39.default.join(runtimeDir(version), "index.html"))) return;
|
|
42536
42695
|
console.error(` installing configured engine runtime ${version}...`);
|
|
42537
42696
|
const result = await rnxRuntime.install({
|
|
42538
42697
|
version,
|
|
@@ -42868,7 +43027,7 @@ function playwrightHostPidForSim(sim) {
|
|
|
42868
43027
|
function signalDriverLaunchConnected(result) {
|
|
42869
43028
|
if (!result.connectAckFile) return false;
|
|
42870
43029
|
try {
|
|
42871
|
-
|
|
43030
|
+
import_node_fs36.default.writeFileSync(
|
|
42872
43031
|
result.connectAckFile,
|
|
42873
43032
|
`${JSON.stringify({ connectedAt: Date.now(), pid: result.pid ?? null })}
|
|
42874
43033
|
`,
|
|
@@ -42882,7 +43041,7 @@ function signalDriverLaunchConnected(result) {
|
|
|
42882
43041
|
function readUnservedUrl(result) {
|
|
42883
43042
|
if (!result.diagnosticLogPath) return null;
|
|
42884
43043
|
try {
|
|
42885
|
-
const detail =
|
|
43044
|
+
const detail = import_node_fs36.default.readFileSync(result.diagnosticLogPath, "utf8");
|
|
42886
43045
|
const match = detail.match(/\[unserved\] nothing serves (\S+)/);
|
|
42887
43046
|
return match ? match[1] : null;
|
|
42888
43047
|
} catch {
|
|
@@ -42892,19 +43051,19 @@ function readUnservedUrl(result) {
|
|
|
42892
43051
|
function printDriverDiagnosticLogTail(result) {
|
|
42893
43052
|
if (!result.diagnosticLogPath) return;
|
|
42894
43053
|
try {
|
|
42895
|
-
const detail =
|
|
43054
|
+
const detail = import_node_fs36.default.readFileSync(result.diagnosticLogPath, "utf8").trim();
|
|
42896
43055
|
if (!detail) {
|
|
42897
|
-
console.error(` ${
|
|
43056
|
+
console.error(` ${import_node_path39.default.basename(result.diagnosticLogPath)} was empty`);
|
|
42898
43057
|
return;
|
|
42899
43058
|
}
|
|
42900
43059
|
const shown = detail.length > 4e3 ? `\u2026
|
|
42901
43060
|
${detail.slice(-4e3)}` : detail;
|
|
42902
|
-
console.error(` ${
|
|
43061
|
+
console.error(` ${import_node_path39.default.basename(result.diagnosticLogPath)}:`);
|
|
42903
43062
|
console.error(shown);
|
|
42904
43063
|
} catch (err) {
|
|
42905
43064
|
const message = err instanceof Error ? err.message : String(err);
|
|
42906
43065
|
console.error(
|
|
42907
|
-
` failed to read ${
|
|
43066
|
+
` failed to read ${import_node_path39.default.basename(result.diagnosticLogPath)}: ${message}`
|
|
42908
43067
|
);
|
|
42909
43068
|
}
|
|
42910
43069
|
}
|
|
@@ -42925,11 +43084,11 @@ async function waitForProcessExit(pid, timeoutMs = 2500) {
|
|
|
42925
43084
|
return !isProcessAlive2(pid);
|
|
42926
43085
|
}
|
|
42927
43086
|
function isPlaywrightHostProcess(pid) {
|
|
42928
|
-
const plain = (0,
|
|
43087
|
+
const plain = (0, import_node_child_process15.spawnSync)("ps", ["-o", "command=", "-p", String(pid)], {
|
|
42929
43088
|
encoding: "utf8",
|
|
42930
43089
|
stdio: ["ignore", "pipe", "pipe"]
|
|
42931
43090
|
});
|
|
42932
|
-
const withEnv = (0,
|
|
43091
|
+
const withEnv = (0, import_node_child_process15.spawnSync)("ps", ["eww", "-o", "command=", "-p", String(pid)], {
|
|
42933
43092
|
encoding: "utf8",
|
|
42934
43093
|
stdio: ["ignore", "pipe", "pipe"]
|
|
42935
43094
|
});
|
|
@@ -43903,14 +44062,14 @@ async function runCloseCommand(args, opts = {}) {
|
|
|
43903
44062
|
bridge.close();
|
|
43904
44063
|
}
|
|
43905
44064
|
}
|
|
43906
|
-
var
|
|
44065
|
+
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
44066
|
var init_control = __esm({
|
|
43908
44067
|
"cli/commands/control.ts"() {
|
|
43909
44068
|
"use strict";
|
|
43910
|
-
|
|
43911
|
-
|
|
43912
|
-
|
|
43913
|
-
|
|
44069
|
+
import_node_child_process15 = require("node:child_process");
|
|
44070
|
+
import_node_fs36 = __toESM(require("node:fs"), 1);
|
|
44071
|
+
import_node_os9 = __toESM(require("node:os"), 1);
|
|
44072
|
+
import_node_path39 = __toESM(require("node:path"), 1);
|
|
43914
44073
|
import_app_catalog_wire = require("peach-engine/engine/app-catalog-wire");
|
|
43915
44074
|
import_devices2 = require("peach-engine/settings/devices");
|
|
43916
44075
|
import_ws4 = require("ws");
|
|
@@ -44825,10 +44984,10 @@ var init_maestro_js = __esm({
|
|
|
44825
44984
|
// evaluates against the env as it stands, then all are defined, so
|
|
44826
44985
|
// `${NAME || 'default'}` keeps a value passed with --env.
|
|
44827
44986
|
defineVariables(env) {
|
|
44828
|
-
const
|
|
44987
|
+
const evaluated2 = Object.entries(env).map(
|
|
44829
44988
|
([key, value]) => [key, this.evaluateStringTemplate(String(value))]
|
|
44830
44989
|
);
|
|
44831
|
-
for (const [key, value] of
|
|
44990
|
+
for (const [key, value] of evaluated2) this.envBinding.set(key, value);
|
|
44832
44991
|
}
|
|
44833
44992
|
setCopiedText(text2) {
|
|
44834
44993
|
this.maestro.copiedText = text2;
|
|
@@ -45333,16 +45492,16 @@ function readRecentShellAppId(state) {
|
|
|
45333
45492
|
}
|
|
45334
45493
|
function resolveProjectRelativeFlowBase(flowDir) {
|
|
45335
45494
|
if (!flowDir) return process.cwd();
|
|
45336
|
-
return
|
|
45495
|
+
return path33.basename(flowDir) === ".maestro" ? path33.dirname(flowDir) : flowDir;
|
|
45337
45496
|
}
|
|
45338
45497
|
function resolveFlowScreenshotPathWithMode(screenshotDir, name2, opts) {
|
|
45339
45498
|
const normalizedName = name2.endsWith(".png") ? name2 : `${name2}.png`;
|
|
45340
|
-
if (
|
|
45499
|
+
if (path33.isAbsolute(normalizedName)) return normalizedName;
|
|
45341
45500
|
if (opts.mode === "flow" && /[\\/]/.test(normalizedName)) {
|
|
45342
45501
|
const baseDir = normalizedName.startsWith("./") || normalizedName.startsWith("../") ? opts.flowDir ?? process.cwd() : resolveProjectRelativeFlowBase(opts.flowDir);
|
|
45343
|
-
return
|
|
45502
|
+
return path33.resolve(baseDir, normalizedName);
|
|
45344
45503
|
}
|
|
45345
|
-
return
|
|
45504
|
+
return path33.join(screenshotDir, normalizedName);
|
|
45346
45505
|
}
|
|
45347
45506
|
function normalizeFlowScreenshotSpec(step) {
|
|
45348
45507
|
if (typeof step === "string") {
|
|
@@ -45396,12 +45555,12 @@ function normalizeBareStringStep(verb) {
|
|
|
45396
45555
|
function parseFlowSteps(content) {
|
|
45397
45556
|
return parseFlowFile(content).steps;
|
|
45398
45557
|
}
|
|
45399
|
-
var
|
|
45558
|
+
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
45559
|
var init_bridge_flow_runner = __esm({
|
|
45401
45560
|
"cli/bridge-flow-runner.ts"() {
|
|
45402
45561
|
"use strict";
|
|
45403
|
-
|
|
45404
|
-
|
|
45562
|
+
fs29 = __toESM(require("fs"), 1);
|
|
45563
|
+
path33 = __toESM(require("path"), 1);
|
|
45405
45564
|
import_devices4 = require("peach-engine/settings/devices");
|
|
45406
45565
|
import_proof_frame = __toESM(require_proof_frame(), 1);
|
|
45407
45566
|
init_flow_timeout_scale();
|
|
@@ -45663,19 +45822,19 @@ var init_bridge_flow_runner = __esm({
|
|
|
45663
45822
|
if (typeof value === "string") return value.slice(0, 80);
|
|
45664
45823
|
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
45665
45824
|
if (!value || typeof value !== "object") return void 0;
|
|
45666
|
-
const
|
|
45667
|
-
const direct =
|
|
45825
|
+
const record2 = value;
|
|
45826
|
+
const direct = record2.id ?? record2.text ?? record2.name ?? record2.path;
|
|
45668
45827
|
if (typeof direct === "string" && direct) return direct.slice(0, 80);
|
|
45669
|
-
const awaited =
|
|
45828
|
+
const awaited = record2.visible ?? record2.notVisible ?? record2.element;
|
|
45670
45829
|
if (typeof awaited === "string" && awaited) return awaited.slice(0, 80);
|
|
45671
45830
|
if (awaited && typeof awaited === "object") {
|
|
45672
45831
|
const target = awaited;
|
|
45673
45832
|
const label = target.id ?? target.text;
|
|
45674
45833
|
if (typeof label === "string" && label) return label.slice(0, 80);
|
|
45675
45834
|
}
|
|
45676
|
-
if (
|
|
45677
|
-
if (typeof
|
|
45678
|
-
return `${Math.round(
|
|
45835
|
+
if (record2.point && typeof record2.point === "string") return record2.point.slice(0, 80);
|
|
45836
|
+
if (typeof record2.x === "number" && typeof record2.y === "number") {
|
|
45837
|
+
return `${Math.round(record2.x)}, ${Math.round(record2.y)}`;
|
|
45679
45838
|
}
|
|
45680
45839
|
return void 0;
|
|
45681
45840
|
}
|
|
@@ -45726,14 +45885,14 @@ var init_bridge_flow_runner = __esm({
|
|
|
45726
45885
|
if (chunks.length === 0) {
|
|
45727
45886
|
throw new Error("recording requested but no video buffer was produced");
|
|
45728
45887
|
}
|
|
45729
|
-
|
|
45888
|
+
fs29.mkdirSync(this.opts.recordingOutputDir, { recursive: true });
|
|
45730
45889
|
const videoMime = stopped.mime || this.opts.recordingFormat || "video/webm";
|
|
45731
45890
|
const extension = videoMime.includes("mp4") ? "mp4" : "webm";
|
|
45732
|
-
const outputPath =
|
|
45891
|
+
const outputPath = path33.join(
|
|
45733
45892
|
this.opts.recordingOutputDir,
|
|
45734
45893
|
`peach-${Date.now()}.${extension}`
|
|
45735
45894
|
);
|
|
45736
|
-
|
|
45895
|
+
fs29.writeFileSync(outputPath, Buffer.concat(chunks));
|
|
45737
45896
|
return outputPath;
|
|
45738
45897
|
}
|
|
45739
45898
|
async waitForRecordingTail(opts) {
|
|
@@ -46409,7 +46568,7 @@ var init_bridge_flow_runner = __esm({
|
|
|
46409
46568
|
flowDir: this.opts.flowDir
|
|
46410
46569
|
}
|
|
46411
46570
|
);
|
|
46412
|
-
|
|
46571
|
+
fs29.mkdirSync(path33.dirname(outputPath), { recursive: true });
|
|
46413
46572
|
const layers = spec.layers ?? this.opts.screenshotLayers;
|
|
46414
46573
|
const screenshotRequest = {
|
|
46415
46574
|
type: "screenshot",
|
|
@@ -46444,11 +46603,11 @@ var init_bridge_flow_runner = __esm({
|
|
|
46444
46603
|
throw new Error("could not read current device model for framed screenshot");
|
|
46445
46604
|
}
|
|
46446
46605
|
const framed = await composeFramedScreenshot(rawBuffer, model);
|
|
46447
|
-
|
|
46606
|
+
fs29.writeFileSync(outputPath, framed);
|
|
46448
46607
|
console.log(`[flow] screenshot: ${outputPath} (frame: ${model})`);
|
|
46449
46608
|
return outputPath;
|
|
46450
46609
|
}
|
|
46451
|
-
|
|
46610
|
+
fs29.writeFileSync(outputPath, rawBuffer);
|
|
46452
46611
|
console.log(`[flow] screenshot: ${outputPath}`);
|
|
46453
46612
|
return outputPath;
|
|
46454
46613
|
}
|
|
@@ -46470,10 +46629,10 @@ var init_bridge_flow_runner = __esm({
|
|
|
46470
46629
|
// + a11y tree + console errors/warnings + failed network requests +
|
|
46471
46630
|
// shell state, all under one directory so post-mortem is one grep away.
|
|
46472
46631
|
async captureFailureBundle(outputDir, context) {
|
|
46473
|
-
|
|
46632
|
+
fs29.mkdirSync(outputDir, { recursive: true });
|
|
46474
46633
|
const write = (name2, content) => {
|
|
46475
46634
|
try {
|
|
46476
|
-
|
|
46635
|
+
fs29.writeFileSync(path33.join(outputDir, name2), content);
|
|
46477
46636
|
} catch {
|
|
46478
46637
|
}
|
|
46479
46638
|
};
|
|
@@ -47067,8 +47226,8 @@ var init_bridge_flow_runner = __esm({
|
|
|
47067
47226
|
runScript(target) {
|
|
47068
47227
|
const spec = typeof target === "string" ? { file: target } : target;
|
|
47069
47228
|
if (!spec.file) throw new Error("runScript requires a file");
|
|
47070
|
-
const scriptPath =
|
|
47071
|
-
const source =
|
|
47229
|
+
const scriptPath = path33.resolve(this.opts.flowDir, spec.file);
|
|
47230
|
+
const source = fs29.readFileSync(scriptPath, "utf8");
|
|
47072
47231
|
this.js.evaluate(source, { env: spec.env });
|
|
47073
47232
|
console.log(`[flow] runScript: ${spec.file} done`);
|
|
47074
47233
|
}
|
|
@@ -47428,14 +47587,14 @@ var init_bridge_flow_runner = __esm({
|
|
|
47428
47587
|
for (const [k, v] of Object.entries(env)) this.js.putEnv(k, v);
|
|
47429
47588
|
}
|
|
47430
47589
|
if (file) {
|
|
47431
|
-
const flowPath =
|
|
47432
|
-
const flowContent =
|
|
47590
|
+
const flowPath = path33.resolve(this.opts.flowDir, file);
|
|
47591
|
+
const flowContent = fs29.readFileSync(flowPath, "utf8");
|
|
47433
47592
|
const { frontmatter } = parseFlowFile(flowContent);
|
|
47434
47593
|
if (frontmatter.env && typeof frontmatter.env === "object") {
|
|
47435
47594
|
this.js.defineVariables(frontmatter.env);
|
|
47436
47595
|
}
|
|
47437
47596
|
const previousDir = this.opts.flowDir;
|
|
47438
|
-
this.opts.flowDir =
|
|
47597
|
+
this.opts.flowDir = path33.dirname(flowPath);
|
|
47439
47598
|
try {
|
|
47440
47599
|
await this.runFlow(parseFlowSteps(flowContent));
|
|
47441
47600
|
} finally {
|
|
@@ -47606,8 +47765,8 @@ __export(registry_exports, {
|
|
|
47606
47765
|
skillRegistry: () => skillRegistry
|
|
47607
47766
|
});
|
|
47608
47767
|
module.exports = __toCommonJS(registry_exports);
|
|
47609
|
-
var
|
|
47610
|
-
var
|
|
47768
|
+
var fs30 = __toESM(require("fs"), 1);
|
|
47769
|
+
var path34 = __toESM(require("path"), 1);
|
|
47611
47770
|
|
|
47612
47771
|
// src/skills/builtin/a11y-review.ts
|
|
47613
47772
|
init_reap_browser();
|
|
@@ -47626,8 +47785,8 @@ var skill = {
|
|
|
47626
47785
|
},
|
|
47627
47786
|
async execute(params, context) {
|
|
47628
47787
|
const { chromium } = await import("playwright");
|
|
47629
|
-
const
|
|
47630
|
-
const
|
|
47788
|
+
const path35 = await import("path");
|
|
47789
|
+
const fs31 = await import("fs");
|
|
47631
47790
|
const browser = await launchReapedChrome((options) => chromium.launch(options), {
|
|
47632
47791
|
headless: true
|
|
47633
47792
|
});
|
|
@@ -47684,9 +47843,9 @@ var skill = {
|
|
|
47684
47843
|
warnings: issues.filter((i) => i.severity === "warning").length,
|
|
47685
47844
|
tree: typeof tree === "string" ? tree : JSON.stringify(tree)
|
|
47686
47845
|
};
|
|
47687
|
-
const reportPath =
|
|
47688
|
-
|
|
47689
|
-
|
|
47846
|
+
const reportPath = path35.join(context.outputDir, "a11y-report.json");
|
|
47847
|
+
fs31.mkdirSync(path35.dirname(reportPath), { recursive: true });
|
|
47848
|
+
fs31.writeFileSync(reportPath, JSON.stringify(report, null, 2));
|
|
47690
47849
|
return {
|
|
47691
47850
|
success: issues.filter((i) => i.severity === "error").length === 0,
|
|
47692
47851
|
message: `${report.errors} errors, ${report.warnings} warnings across ${report.nodeCount} nodes`,
|
|
@@ -47719,14 +47878,14 @@ var skill2 = {
|
|
|
47719
47878
|
}
|
|
47720
47879
|
},
|
|
47721
47880
|
async execute(params, context) {
|
|
47722
|
-
const
|
|
47723
|
-
const
|
|
47881
|
+
const fs31 = await import("node:fs");
|
|
47882
|
+
const path35 = await import("node:path");
|
|
47724
47883
|
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 (!
|
|
47884
|
+
const packagePath = path35.join(context.projectDir, "package.json");
|
|
47885
|
+
if (!fs31.existsSync(packagePath)) {
|
|
47727
47886
|
return { success: false, message: "No package.json found" };
|
|
47728
47887
|
}
|
|
47729
|
-
const parsed = JSON.parse(
|
|
47888
|
+
const parsed = JSON.parse(fs31.readFileSync(packagePath, "utf8"));
|
|
47730
47889
|
if (!parsed || typeof parsed !== "object") {
|
|
47731
47890
|
return { success: false, message: "package.json is not an object" };
|
|
47732
47891
|
}
|
|
@@ -47738,9 +47897,9 @@ var skill2 = {
|
|
|
47738
47897
|
}) : scanDeps2(parsed);
|
|
47739
47898
|
const packageResult = params.packageName ? scan.packages[0] : void 0;
|
|
47740
47899
|
const message = packageResult ? `${params.packageName}: ${formatPackageStatus2(packageResult)}. ${COMPAT_RESULT_CAVEAT2}` : `${formatScanCounts2(scan)}. ${COMPAT_RESULT_CAVEAT2}`;
|
|
47741
|
-
const reportPath =
|
|
47742
|
-
|
|
47743
|
-
|
|
47900
|
+
const reportPath = path35.join(context.outputDir, "compat-report.json");
|
|
47901
|
+
fs31.mkdirSync(path35.dirname(reportPath), { recursive: true });
|
|
47902
|
+
fs31.writeFileSync(reportPath, `${JSON.stringify(scan, null, 2)}
|
|
47744
47903
|
`);
|
|
47745
47904
|
return {
|
|
47746
47905
|
success: true,
|
|
@@ -47782,8 +47941,8 @@ var skill3 = {
|
|
|
47782
47941
|
record: { type: "boolean", description: "Record video of the flow" }
|
|
47783
47942
|
},
|
|
47784
47943
|
async execute(params, context) {
|
|
47785
|
-
const
|
|
47786
|
-
const
|
|
47944
|
+
const fs31 = await import("fs");
|
|
47945
|
+
const path35 = await import("path");
|
|
47787
47946
|
const yaml2 = await import("yaml");
|
|
47788
47947
|
const { DEFAULT_SOOTSIM_BRIDGE_PORT: DEFAULT_SOOTSIM_BRIDGE_PORT3 } = await Promise.resolve().then(() => (init_bridge_constants(), bridge_constants_exports));
|
|
47789
47948
|
const { SootSimBridgeHost: SootSimBridgeHost2 } = await Promise.resolve().then(() => (init_bridge_host(), bridge_host_exports));
|
|
@@ -47793,7 +47952,7 @@ var skill3 = {
|
|
|
47793
47952
|
const host2 = new SootSimBridgeHost2({ port: DEFAULT_SOOTSIM_BRIDGE_PORT3 });
|
|
47794
47953
|
host2.start({ silent: true });
|
|
47795
47954
|
try {
|
|
47796
|
-
const flowContent =
|
|
47955
|
+
const flowContent = fs31.readFileSync(params.flowPath, "utf8");
|
|
47797
47956
|
const fmMatch = flowContent.match(/^---\n([\s\S]*?)\n---\n?/);
|
|
47798
47957
|
const stepsBody = fmMatch ? flowContent.slice(fmMatch[0].length) : flowContent;
|
|
47799
47958
|
const steps = yaml2.parse(stepsBody);
|
|
@@ -47820,7 +47979,7 @@ var skill3 = {
|
|
|
47820
47979
|
});
|
|
47821
47980
|
const driver = new SootSimBridgeFlowRunner2(bridge, {
|
|
47822
47981
|
screenshotDir: context.outputDir,
|
|
47823
|
-
flowDir:
|
|
47982
|
+
flowDir: path35.dirname(path35.resolve(params.flowPath)),
|
|
47824
47983
|
simId,
|
|
47825
47984
|
recordingOutputDir: params.record ? context.outputDir : void 0
|
|
47826
47985
|
});
|
|
@@ -47842,7 +48001,7 @@ var skill3 = {
|
|
|
47842
48001
|
simId,
|
|
47843
48002
|
videoPath: videoPath || void 0
|
|
47844
48003
|
},
|
|
47845
|
-
artifacts: videoPath ? [{ type: "video", name:
|
|
48004
|
+
artifacts: videoPath ? [{ type: "video", name: path35.basename(videoPath), path: videoPath }] : void 0
|
|
47846
48005
|
};
|
|
47847
48006
|
} finally {
|
|
47848
48007
|
try {
|
|
@@ -47889,8 +48048,8 @@ var skill4 = {
|
|
|
47889
48048
|
},
|
|
47890
48049
|
async execute(params, context) {
|
|
47891
48050
|
const { chromium } = await import("playwright");
|
|
47892
|
-
const
|
|
47893
|
-
const
|
|
48051
|
+
const path35 = await import("path");
|
|
48052
|
+
const fs31 = await import("fs");
|
|
47894
48053
|
const browser = await launchReapedChrome((options) => chromium.launch(options), {
|
|
47895
48054
|
headless: true
|
|
47896
48055
|
});
|
|
@@ -47918,9 +48077,9 @@ var skill4 = {
|
|
|
47918
48077
|
...profile,
|
|
47919
48078
|
fps: syncCount > 0 ? (syncCount / (duration / 1e3)).toFixed(1) : "0"
|
|
47920
48079
|
};
|
|
47921
|
-
const reportPath =
|
|
47922
|
-
|
|
47923
|
-
|
|
48080
|
+
const reportPath = path35.join(context.outputDir, "perf-report.json");
|
|
48081
|
+
fs31.mkdirSync(path35.dirname(reportPath), { recursive: true });
|
|
48082
|
+
fs31.writeFileSync(reportPath, JSON.stringify(report, null, 2));
|
|
47924
48083
|
return {
|
|
47925
48084
|
success: true,
|
|
47926
48085
|
message: `${report.fps} fps, ${profile.avgSyncMs?.toFixed(1)}ms avg sync, ${nodeCount} nodes`,
|
|
@@ -47953,8 +48112,8 @@ var skill5 = {
|
|
|
47953
48112
|
},
|
|
47954
48113
|
async execute(params, context) {
|
|
47955
48114
|
const { chromium } = await import("playwright");
|
|
47956
|
-
const
|
|
47957
|
-
const
|
|
48115
|
+
const path35 = await import("path");
|
|
48116
|
+
const fs31 = await import("fs");
|
|
47958
48117
|
const browser = await launchReapedChrome((options) => chromium.launch(options), {
|
|
47959
48118
|
headless: true
|
|
47960
48119
|
});
|
|
@@ -47962,8 +48121,8 @@ var skill5 = {
|
|
|
47962
48121
|
try {
|
|
47963
48122
|
await page.goto(context.url, { waitUntil: "networkidle" });
|
|
47964
48123
|
await page.waitForTimeout(2e3);
|
|
47965
|
-
const outputPath =
|
|
47966
|
-
|
|
48124
|
+
const outputPath = path35.join(context.outputDir, `${params.name}.png`);
|
|
48125
|
+
fs31.mkdirSync(path35.dirname(outputPath), { recursive: true });
|
|
47967
48126
|
await page.screenshot({ path: outputPath });
|
|
47968
48127
|
return {
|
|
47969
48128
|
success: true,
|
|
@@ -48004,8 +48163,8 @@ var skill6 = {
|
|
|
48004
48163
|
},
|
|
48005
48164
|
async execute(params, context) {
|
|
48006
48165
|
const { chromium } = await import("playwright");
|
|
48007
|
-
const
|
|
48008
|
-
const
|
|
48166
|
+
const path35 = await import("path");
|
|
48167
|
+
const fs31 = await import("fs");
|
|
48009
48168
|
const browser = await launchReapedChrome((options) => chromium.launch(options), {
|
|
48010
48169
|
headless: true
|
|
48011
48170
|
});
|
|
@@ -48013,14 +48172,14 @@ var skill6 = {
|
|
|
48013
48172
|
try {
|
|
48014
48173
|
await page.goto(context.url, { waitUntil: "networkidle" });
|
|
48015
48174
|
await page.waitForTimeout(2e3);
|
|
48016
|
-
const currentPath =
|
|
48017
|
-
|
|
48175
|
+
const currentPath = path35.join(context.outputDir, `${params.name}-current.png`);
|
|
48176
|
+
fs31.mkdirSync(path35.dirname(currentPath), { recursive: true });
|
|
48018
48177
|
await page.screenshot({ path: currentPath });
|
|
48019
48178
|
try {
|
|
48020
48179
|
const { PNG } = await import("pngjs");
|
|
48021
48180
|
const pixelmatch = (await import("pixelmatch")).default;
|
|
48022
|
-
const baseline = PNG.sync.read(
|
|
48023
|
-
const current = PNG.sync.read(
|
|
48181
|
+
const baseline = PNG.sync.read(fs31.readFileSync(params.baseline));
|
|
48182
|
+
const current = PNG.sync.read(fs31.readFileSync(currentPath));
|
|
48024
48183
|
const { width, height } = baseline;
|
|
48025
48184
|
const diff = new PNG({ width, height });
|
|
48026
48185
|
const numDiffPixels = pixelmatch(
|
|
@@ -48031,8 +48190,8 @@ var skill6 = {
|
|
|
48031
48190
|
height,
|
|
48032
48191
|
{ threshold: params.threshold || 0.1 }
|
|
48033
48192
|
);
|
|
48034
|
-
const diffPath =
|
|
48035
|
-
|
|
48193
|
+
const diffPath = path35.join(context.outputDir, `${params.name}-diff.png`);
|
|
48194
|
+
fs31.writeFileSync(diffPath, PNG.sync.write(diff));
|
|
48036
48195
|
const totalPixels = width * height;
|
|
48037
48196
|
const diffPercent = (numDiffPixels / totalPixels * 100).toFixed(2);
|
|
48038
48197
|
return {
|
|
@@ -48096,10 +48255,10 @@ var skillRegistry = {
|
|
|
48096
48255
|
},
|
|
48097
48256
|
// load skills from a project manifest (rnx-skills.json)
|
|
48098
48257
|
async loadFromManifest(projectDir) {
|
|
48099
|
-
const manifestPath =
|
|
48100
|
-
if (!
|
|
48258
|
+
const manifestPath = path34.join(projectDir, "rnx-skills.json");
|
|
48259
|
+
if (!fs30.existsSync(manifestPath)) return;
|
|
48101
48260
|
try {
|
|
48102
|
-
const manifest = JSON.parse(
|
|
48261
|
+
const manifest = JSON.parse(fs30.readFileSync(manifestPath, "utf8"));
|
|
48103
48262
|
if (Array.isArray(manifest.skills)) {
|
|
48104
48263
|
for (const entry of manifest.skills) {
|
|
48105
48264
|
if (typeof entry === "string") {
|
|
@@ -48110,7 +48269,7 @@ var skillRegistry = {
|
|
|
48110
48269
|
}
|
|
48111
48270
|
} else if (entry.file) {
|
|
48112
48271
|
try {
|
|
48113
|
-
const mod = await import(
|
|
48272
|
+
const mod = await import(path34.resolve(projectDir, entry.file));
|
|
48114
48273
|
if (mod.skill) this.register(mod.skill);
|
|
48115
48274
|
} catch {
|
|
48116
48275
|
}
|
|
@@ -48123,10 +48282,10 @@ var skillRegistry = {
|
|
|
48123
48282
|
// auto-discover skills based on project dependencies
|
|
48124
48283
|
suggestSkills(projectDir) {
|
|
48125
48284
|
const suggestions = [];
|
|
48126
|
-
const pkgPath =
|
|
48127
|
-
if (!
|
|
48285
|
+
const pkgPath = path34.join(projectDir, "package.json");
|
|
48286
|
+
if (!fs30.existsSync(pkgPath)) return suggestions;
|
|
48128
48287
|
try {
|
|
48129
|
-
const pkg = JSON.parse(
|
|
48288
|
+
const pkg = JSON.parse(fs30.readFileSync(pkgPath, "utf8"));
|
|
48130
48289
|
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
48131
48290
|
if (deps["detox"] || deps["maestro"]) {
|
|
48132
48291
|
suggestions.push("maestro-test");
|