peachsim 0.1.768 → 0.1.770
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/commands/daemon.ts +2 -1
- package/cli/outbound-endpoints.ts +14 -0
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-identity.cjs +1 -1
- package/dist-lib/agent-sessions.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cli-constants.cjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +847 -458
- package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1 -1
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +1 -1
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/render-mode.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +1134 -732
- package/dist-lib/swift-compile.cjs +1 -1
- package/dist-lib/swift-compile.mjs +1 -1
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +674 -285
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/src/ios-sdk-frameworks.json +289 -0
- package/src/swift-binary-modules.ts +116 -0
- package/src/swift-host.ts +34 -22
- package/src/swift-package-manifest.ts +3 -0
- package/src/swift-packages.ts +32 -4
package/dist-lib/skills.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.770 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -18532,9 +18532,9 @@ function overlapsBounds(left, right) {
|
|
|
18532
18532
|
}
|
|
18533
18533
|
function resolveCompatVersionRange(availableRegistryRanges, declaredVersion) {
|
|
18534
18534
|
const declaredGroups = parseRange(declaredVersion);
|
|
18535
|
-
const registryGroups = availableRegistryRanges.map((
|
|
18536
|
-
range,
|
|
18537
|
-
bounds: parseRange(
|
|
18535
|
+
const registryGroups = availableRegistryRanges.map((range2) => ({
|
|
18536
|
+
range: range2,
|
|
18537
|
+
bounds: parseRange(range2)
|
|
18538
18538
|
}));
|
|
18539
18539
|
if (!declaredGroups || registryGroups.some((candidate) => !candidate.bounds)) {
|
|
18540
18540
|
return {
|
|
@@ -19802,9 +19802,9 @@ function safeChildPlistName(value) {
|
|
|
19802
19802
|
name: file.toLowerCase().endsWith(".plist") ? file : `${file}.plist`
|
|
19803
19803
|
};
|
|
19804
19804
|
}
|
|
19805
|
-
async function readableSettingsBundle(
|
|
19805
|
+
async function readableSettingsBundle(path36) {
|
|
19806
19806
|
try {
|
|
19807
|
-
const root = await (0, import_promises.stat)((0, import_node_path.join)(
|
|
19807
|
+
const root = await (0, import_promises.stat)((0, import_node_path.join)(path36, "Root.plist"));
|
|
19808
19808
|
return root.isFile() && root.size <= MAX_PLIST_BYTES;
|
|
19809
19809
|
} catch {
|
|
19810
19810
|
return false;
|
|
@@ -19849,11 +19849,11 @@ async function settingsBundleFingerprint(bundlePath) {
|
|
|
19849
19849
|
return null;
|
|
19850
19850
|
}
|
|
19851
19851
|
}
|
|
19852
|
-
async function parsePlistRecord(
|
|
19852
|
+
async function parsePlistRecord(path36) {
|
|
19853
19853
|
try {
|
|
19854
|
-
const metadata = await (0, import_promises.stat)(
|
|
19854
|
+
const metadata = await (0, import_promises.stat)(path36);
|
|
19855
19855
|
if (!metadata.isFile() || metadata.size > MAX_PLIST_BYTES) return null;
|
|
19856
|
-
const source = await (0, import_promises.readFile)(
|
|
19856
|
+
const source = await (0, import_promises.readFile)(path36, "utf8");
|
|
19857
19857
|
const parsed = parsePlistSource(source);
|
|
19858
19858
|
return isRecord2(parsed) ? parsed : null;
|
|
19859
19859
|
} catch {
|
|
@@ -20177,7 +20177,7 @@ async function tcpPing(port, timeout = TCP_GATE_MS) {
|
|
|
20177
20177
|
return null;
|
|
20178
20178
|
}
|
|
20179
20179
|
}
|
|
20180
|
-
function httpGet(hostname, port,
|
|
20180
|
+
function httpGet(hostname, port, path36, method = "GET", timeout = TIMEOUT_MS, headers = {}) {
|
|
20181
20181
|
return new Promise((resolve10) => {
|
|
20182
20182
|
let settled = false;
|
|
20183
20183
|
let killing = false;
|
|
@@ -20186,7 +20186,7 @@ function httpGet(hostname, port, path35, method = "GET", timeout = TIMEOUT_MS, h
|
|
|
20186
20186
|
settled = true;
|
|
20187
20187
|
resolve10(value);
|
|
20188
20188
|
};
|
|
20189
|
-
const req = import_http.default.request({ hostname, port, path:
|
|
20189
|
+
const req = import_http.default.request({ hostname, port, path: path36, method, headers }, (res) => {
|
|
20190
20190
|
let body = "";
|
|
20191
20191
|
res.on("data", (c) => body += c.toString());
|
|
20192
20192
|
const contentType = (() => {
|
|
@@ -22349,14 +22349,14 @@ function liftExtensionOverrides(source, extraObjCExtensions) {
|
|
|
22349
22349
|
const args = forwardedArguments(source.slice(open + 1, close));
|
|
22350
22350
|
if (args === null) continue;
|
|
22351
22351
|
const call = (clause.includes("->") ? "return " : "") + (/\b(?:throws|rethrows)\b/.test(clause) ? "try " : "") + (/\basync\b/.test(clause) ? "await " : "") + `__peach_ext_${name2}(${args})`;
|
|
22352
|
-
const
|
|
22352
|
+
const signature2 = `func ${name2}${func[3] ?? ""}${source.slice(open, close + 1)}${clause ? ` ${clause}` : ""}`;
|
|
22353
22353
|
const nameAt = at + rest.indexOf(name2, rest.indexOf("func", "override".length + func[1].length) + 4);
|
|
22354
22354
|
lifted.push({
|
|
22355
22355
|
type: top.name,
|
|
22356
22356
|
member: name2,
|
|
22357
22357
|
at,
|
|
22358
22358
|
modifiers,
|
|
22359
|
-
decl:
|
|
22359
|
+
decl: signature2,
|
|
22360
22360
|
forward: `{ ${call} };`,
|
|
22361
22361
|
nameAt,
|
|
22362
22362
|
edits: [
|
|
@@ -23811,8 +23811,8 @@ function pickImagesetFile(images) {
|
|
|
23811
23811
|
scale: pick.scale === "2x" ? 2 : pick.scale === "3x" ? 3 : 1
|
|
23812
23812
|
};
|
|
23813
23813
|
}
|
|
23814
|
-
function flatScale(
|
|
23815
|
-
const match = /@([23])x\.[^./]+$/.exec(
|
|
23814
|
+
function flatScale(path36) {
|
|
23815
|
+
const match = /@([23])x\.[^./]+$/.exec(path36);
|
|
23816
23816
|
return match ? Number(match[1]) : 1;
|
|
23817
23817
|
}
|
|
23818
23818
|
function providesNamespace(text2) {
|
|
@@ -23839,13 +23839,13 @@ function catalogEntryName(contentsPath, kind, readText2) {
|
|
|
23839
23839
|
}
|
|
23840
23840
|
return segments.join("/");
|
|
23841
23841
|
}
|
|
23842
|
-
function isFlatResourceImage(
|
|
23843
|
-
return
|
|
23842
|
+
function isFlatResourceImage(path36) {
|
|
23843
|
+
return path36.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path36));
|
|
23844
23844
|
}
|
|
23845
23845
|
function enumerateBundleImages(paths, readText2) {
|
|
23846
23846
|
const table = [];
|
|
23847
23847
|
const seen = /* @__PURE__ */ new Set();
|
|
23848
|
-
const catalogs = paths.filter((
|
|
23848
|
+
const catalogs = paths.filter((path36) => baseOf(path36) === "Contents.json");
|
|
23849
23849
|
for (const contentsPath of catalogs) {
|
|
23850
23850
|
const name2 = catalogEntryName(contentsPath, ".imageset", readText2);
|
|
23851
23851
|
if (name2 === null || seen.has(name2)) continue;
|
|
@@ -23866,12 +23866,12 @@ function enumerateBundleImages(paths, readText2) {
|
|
|
23866
23866
|
seen.add(name2);
|
|
23867
23867
|
table.push({ name: name2, file: `${dir}/${pick.filename}`, scale: pick.scale });
|
|
23868
23868
|
}
|
|
23869
|
-
for (const
|
|
23870
|
-
if (!isFlatResourceImage(
|
|
23871
|
-
const name2 = baseOf(
|
|
23869
|
+
for (const path36 of paths) {
|
|
23870
|
+
if (!isFlatResourceImage(path36)) continue;
|
|
23871
|
+
const name2 = baseOf(path36).slice(0, -extOf(path36).length);
|
|
23872
23872
|
if (name2 === "" || seen.has(name2)) continue;
|
|
23873
23873
|
seen.add(name2);
|
|
23874
|
-
table.push({ name: name2, file:
|
|
23874
|
+
table.push({ name: name2, file: path36, scale: flatScale(path36) });
|
|
23875
23875
|
}
|
|
23876
23876
|
return table;
|
|
23877
23877
|
}
|
|
@@ -23900,7 +23900,7 @@ function colorsetValue(color) {
|
|
|
23900
23900
|
}
|
|
23901
23901
|
function enumerateBundleColors(paths, readText2) {
|
|
23902
23902
|
const table = {};
|
|
23903
|
-
for (const contentsPath of paths.filter((
|
|
23903
|
+
for (const contentsPath of paths.filter((path36) => baseOf(path36) === "Contents.json")) {
|
|
23904
23904
|
const name2 = catalogEntryName(contentsPath, ".colorset", readText2);
|
|
23905
23905
|
if (name2 === null || name2 in table) continue;
|
|
23906
23906
|
let colors;
|
|
@@ -23964,8 +23964,8 @@ function axisExtremes(points) {
|
|
|
23964
23964
|
function pathBounds(d) {
|
|
23965
23965
|
const xs = [];
|
|
23966
23966
|
const ys = [];
|
|
23967
|
-
for (const
|
|
23968
|
-
(0, import_svgpath.default)(
|
|
23967
|
+
for (const path36 of d)
|
|
23968
|
+
(0, import_svgpath.default)(path36).abs().unshort().unarc().iterate((segment, _index, x, y) => {
|
|
23969
23969
|
const [command, ...args] = segment;
|
|
23970
23970
|
if (command === "M" || command === "L") {
|
|
23971
23971
|
xs.push(Number(args[0]));
|
|
@@ -23992,7 +23992,7 @@ function guide(svg, id, axis) {
|
|
|
23992
23992
|
}
|
|
23993
23993
|
function enumerateBundleSymbols(paths, readText2) {
|
|
23994
23994
|
const table = {};
|
|
23995
|
-
for (const contentsPath of paths.filter((
|
|
23995
|
+
for (const contentsPath of paths.filter((path36) => baseOf(path36) === "Contents.json")) {
|
|
23996
23996
|
const name2 = catalogEntryName(contentsPath, ".symbolset", readText2);
|
|
23997
23997
|
if (name2 === null || name2 in table) continue;
|
|
23998
23998
|
let symbols;
|
|
@@ -24025,8 +24025,8 @@ function enumerateBundleSymbols(paths, readText2) {
|
|
|
24025
24025
|
viewBox: "0 0 24 24",
|
|
24026
24026
|
advance,
|
|
24027
24027
|
box: [12 - advance / 2, 12 - tall / 2, advance, tall],
|
|
24028
|
-
layers: d.map((
|
|
24029
|
-
d: (0, import_svgpath.default)(
|
|
24028
|
+
layers: d.map((path36) => ({
|
|
24029
|
+
d: (0, import_svgpath.default)(path36).abs().scale(scale).translate(translateX, translateY).round(3).toString()
|
|
24030
24030
|
}))
|
|
24031
24031
|
};
|
|
24032
24032
|
}
|
|
@@ -24036,7 +24036,7 @@ function enumerateBundleJson(paths) {
|
|
|
24036
24036
|
const found = [];
|
|
24037
24037
|
const seen = /* @__PURE__ */ new Set();
|
|
24038
24038
|
const ordered = [...paths].filter(
|
|
24039
|
-
(
|
|
24039
|
+
(path36) => path36.split("/").includes("Resources") && path36.split("/").every((segment) => segment !== "" && segment !== "..") && (extOf(path36) === ".json" || extOf(path36) === ".xcstrings")
|
|
24040
24040
|
).sort((a, b) => {
|
|
24041
24041
|
const aDepth = a.split("/").length;
|
|
24042
24042
|
const bDepth = b.split("/").length;
|
|
@@ -24305,19 +24305,405 @@ var init_auth = __esm({
|
|
|
24305
24305
|
}
|
|
24306
24306
|
});
|
|
24307
24307
|
|
|
24308
|
+
// src/ios-sdk-frameworks.json
|
|
24309
|
+
var ios_sdk_frameworks_default;
|
|
24310
|
+
var init_ios_sdk_frameworks = __esm({
|
|
24311
|
+
"src/ios-sdk-frameworks.json"() {
|
|
24312
|
+
ios_sdk_frameworks_default = {
|
|
24313
|
+
sdk: "iphonesimulator27.1",
|
|
24314
|
+
frameworks: [
|
|
24315
|
+
"ARKit",
|
|
24316
|
+
"AVFAudio",
|
|
24317
|
+
"AVFoundation",
|
|
24318
|
+
"AVKit",
|
|
24319
|
+
"AVRouting",
|
|
24320
|
+
"Accelerate",
|
|
24321
|
+
"Accessibility",
|
|
24322
|
+
"AccessoryLiveActivities",
|
|
24323
|
+
"AccessoryNotifications",
|
|
24324
|
+
"AccessorySetupKit",
|
|
24325
|
+
"AccessoryTransportExtension",
|
|
24326
|
+
"Accounts",
|
|
24327
|
+
"ActivityKit",
|
|
24328
|
+
"AdAttributionKit",
|
|
24329
|
+
"AdServices",
|
|
24330
|
+
"AdSupport",
|
|
24331
|
+
"AddressBook",
|
|
24332
|
+
"AddressBookUI",
|
|
24333
|
+
"AlarmKit",
|
|
24334
|
+
"AppClip",
|
|
24335
|
+
"AppIntents",
|
|
24336
|
+
"AppIntentsTypeSupport",
|
|
24337
|
+
"AppMigrationKit",
|
|
24338
|
+
"AppTrackingTransparency",
|
|
24339
|
+
"AssetsLibrary",
|
|
24340
|
+
"AudioToolbox",
|
|
24341
|
+
"AudioUnit",
|
|
24342
|
+
"AuthenticationServices",
|
|
24343
|
+
"AutomatedDeviceEnrollment",
|
|
24344
|
+
"AutomaticAssessmentConfiguration",
|
|
24345
|
+
"BackgroundAssets",
|
|
24346
|
+
"BackgroundTasks",
|
|
24347
|
+
"BrowserEngineCore",
|
|
24348
|
+
"BrowserEngineKit",
|
|
24349
|
+
"BrowserKit",
|
|
24350
|
+
"BusinessChat",
|
|
24351
|
+
"CFNetwork",
|
|
24352
|
+
"CallKit",
|
|
24353
|
+
"CarKey",
|
|
24354
|
+
"CarPlay",
|
|
24355
|
+
"Charts",
|
|
24356
|
+
"ClassKit",
|
|
24357
|
+
"ClassKitUI",
|
|
24358
|
+
"ClockKit",
|
|
24359
|
+
"CloudKit",
|
|
24360
|
+
"ColorSync",
|
|
24361
|
+
"Combine",
|
|
24362
|
+
"ComputeGraph",
|
|
24363
|
+
"ContactProvider",
|
|
24364
|
+
"Contacts",
|
|
24365
|
+
"ContactsUI",
|
|
24366
|
+
"CoreAudio",
|
|
24367
|
+
"CoreAudioKit",
|
|
24368
|
+
"CoreAudioTypes",
|
|
24369
|
+
"CoreBluetooth",
|
|
24370
|
+
"CoreData",
|
|
24371
|
+
"CoreFoundation",
|
|
24372
|
+
"CoreGraphics",
|
|
24373
|
+
"CoreHaptics",
|
|
24374
|
+
"CoreImage",
|
|
24375
|
+
"CoreLocation",
|
|
24376
|
+
"CoreLocationUI",
|
|
24377
|
+
"CoreMIDI",
|
|
24378
|
+
"CoreML",
|
|
24379
|
+
"CoreMedia",
|
|
24380
|
+
"CoreMotion",
|
|
24381
|
+
"CoreNFC",
|
|
24382
|
+
"CoreServices",
|
|
24383
|
+
"CoreSpotlight",
|
|
24384
|
+
"CoreTelephony",
|
|
24385
|
+
"CoreText",
|
|
24386
|
+
"CoreTransferable",
|
|
24387
|
+
"CoreVideo",
|
|
24388
|
+
"CreateMLComponents",
|
|
24389
|
+
"CryptoKit",
|
|
24390
|
+
"CryptoTokenKit",
|
|
24391
|
+
"DataDetection",
|
|
24392
|
+
"DeclaredAgeRange",
|
|
24393
|
+
"DeveloperToolsSupport",
|
|
24394
|
+
"DeviceActivity",
|
|
24395
|
+
"DeviceCheck",
|
|
24396
|
+
"DeviceDiscoveryExtension",
|
|
24397
|
+
"DeviceDiscoveryUI",
|
|
24398
|
+
"EnergyKit",
|
|
24399
|
+
"EventKit",
|
|
24400
|
+
"EventKitUI",
|
|
24401
|
+
"ExposureNotification",
|
|
24402
|
+
"ExtensionFoundation",
|
|
24403
|
+
"ExtensionKit",
|
|
24404
|
+
"ExternalAccessory",
|
|
24405
|
+
"FamilyControls",
|
|
24406
|
+
"FileProvider",
|
|
24407
|
+
"FileProviderUI",
|
|
24408
|
+
"FinanceKit",
|
|
24409
|
+
"FinanceKitUI",
|
|
24410
|
+
"Foundation",
|
|
24411
|
+
"FoundationModels",
|
|
24412
|
+
"GLKit",
|
|
24413
|
+
"GSS",
|
|
24414
|
+
"GameController",
|
|
24415
|
+
"GameKit",
|
|
24416
|
+
"GameSave",
|
|
24417
|
+
"GameplayKit",
|
|
24418
|
+
"GeoToolbox",
|
|
24419
|
+
"GroupActivities",
|
|
24420
|
+
"HealthKit",
|
|
24421
|
+
"HealthKitUI",
|
|
24422
|
+
"HomeKit",
|
|
24423
|
+
"IOKit",
|
|
24424
|
+
"IOSurface",
|
|
24425
|
+
"IdentityDocumentServices",
|
|
24426
|
+
"IdentityDocumentServicesUI",
|
|
24427
|
+
"IdentityLookup",
|
|
24428
|
+
"IdentityLookupUI",
|
|
24429
|
+
"ImageCaptureCore",
|
|
24430
|
+
"ImageIO",
|
|
24431
|
+
"ImagePlayground",
|
|
24432
|
+
"ImmersiveMediaSupport",
|
|
24433
|
+
"Intents",
|
|
24434
|
+
"IntentsUI",
|
|
24435
|
+
"JavaScriptCore",
|
|
24436
|
+
"LinkPresentation",
|
|
24437
|
+
"LinkSecurity",
|
|
24438
|
+
"LiveCommunicationKit",
|
|
24439
|
+
"LocalAuthentication",
|
|
24440
|
+
"LocalAuthenticationEmbeddedUI",
|
|
24441
|
+
"LockedCameraCapture",
|
|
24442
|
+
"ManagedApp",
|
|
24443
|
+
"ManagedAppDistribution",
|
|
24444
|
+
"ManagedSettings",
|
|
24445
|
+
"ManagedSettingsUI",
|
|
24446
|
+
"MapKit",
|
|
24447
|
+
"MarketplaceKit",
|
|
24448
|
+
"Matter",
|
|
24449
|
+
"MatterSupport",
|
|
24450
|
+
"MediaAccessibility",
|
|
24451
|
+
"MediaIntelligence",
|
|
24452
|
+
"MediaIntents",
|
|
24453
|
+
"MediaPlayer",
|
|
24454
|
+
"MediaToolbox",
|
|
24455
|
+
"MessageUI",
|
|
24456
|
+
"Messages",
|
|
24457
|
+
"Metal",
|
|
24458
|
+
"MetalKit",
|
|
24459
|
+
"MetalPerformancePrimitives",
|
|
24460
|
+
"MetalPerformanceShaders",
|
|
24461
|
+
"MetalPerformanceShadersGraph",
|
|
24462
|
+
"MetricKit",
|
|
24463
|
+
"MobileCoreServices",
|
|
24464
|
+
"ModelIO",
|
|
24465
|
+
"MultipeerConnectivity",
|
|
24466
|
+
"MusicKit",
|
|
24467
|
+
"MusicUnderstanding",
|
|
24468
|
+
"NaturalLanguage",
|
|
24469
|
+
"NearbyInteraction",
|
|
24470
|
+
"Network",
|
|
24471
|
+
"NetworkExtension",
|
|
24472
|
+
"NotificationCenter",
|
|
24473
|
+
"NowPlaying",
|
|
24474
|
+
"OSLog",
|
|
24475
|
+
"OpenAL",
|
|
24476
|
+
"OpenGLES",
|
|
24477
|
+
"PDFKit",
|
|
24478
|
+
"PHASE",
|
|
24479
|
+
"PaperKit",
|
|
24480
|
+
"PassKit",
|
|
24481
|
+
"PencilKit",
|
|
24482
|
+
"PermissionKit",
|
|
24483
|
+
"Photos",
|
|
24484
|
+
"PhotosUI",
|
|
24485
|
+
"ProximityReader",
|
|
24486
|
+
"PushKit",
|
|
24487
|
+
"PushToTalk",
|
|
24488
|
+
"QuartzCore",
|
|
24489
|
+
"QuickLook",
|
|
24490
|
+
"QuickLookThumbnailing",
|
|
24491
|
+
"RealityFoundation",
|
|
24492
|
+
"RealityKit",
|
|
24493
|
+
"RelevanceKit",
|
|
24494
|
+
"ReplayKit",
|
|
24495
|
+
"RoomPlan",
|
|
24496
|
+
"SafariServices",
|
|
24497
|
+
"SafetyKit",
|
|
24498
|
+
"SceneKit",
|
|
24499
|
+
"ScreenTime",
|
|
24500
|
+
"SecureElementCredential",
|
|
24501
|
+
"Security",
|
|
24502
|
+
"SecurityUI",
|
|
24503
|
+
"SensitiveContentAnalysis",
|
|
24504
|
+
"SensorKit",
|
|
24505
|
+
"ServicesAccountLinking",
|
|
24506
|
+
"SharedWithYou",
|
|
24507
|
+
"SharedWithYouCore",
|
|
24508
|
+
"ShazamKit",
|
|
24509
|
+
"Social",
|
|
24510
|
+
"SoundAnalysis",
|
|
24511
|
+
"Speech",
|
|
24512
|
+
"SpriteKit",
|
|
24513
|
+
"StateReporting",
|
|
24514
|
+
"StoreKit",
|
|
24515
|
+
"SuggestedActions",
|
|
24516
|
+
"SwiftData",
|
|
24517
|
+
"SwiftUI",
|
|
24518
|
+
"SwiftUICore",
|
|
24519
|
+
"Symbols",
|
|
24520
|
+
"SystemConfiguration",
|
|
24521
|
+
"SystemExtensions",
|
|
24522
|
+
"TabularData",
|
|
24523
|
+
"TelephonyMessagingKit",
|
|
24524
|
+
"TipKit",
|
|
24525
|
+
"TouchController",
|
|
24526
|
+
"Translation",
|
|
24527
|
+
"TranslationUIProvider",
|
|
24528
|
+
"TrustInsights",
|
|
24529
|
+
"Twitter",
|
|
24530
|
+
"UIKit",
|
|
24531
|
+
"USDKit",
|
|
24532
|
+
"UniformTypeIdentifiers",
|
|
24533
|
+
"UserNotifications",
|
|
24534
|
+
"UserNotificationsUI",
|
|
24535
|
+
"VideoSubscriberAccount",
|
|
24536
|
+
"VideoToolbox",
|
|
24537
|
+
"Vision",
|
|
24538
|
+
"VisionKit",
|
|
24539
|
+
"WatchConnectivity",
|
|
24540
|
+
"WeatherKit",
|
|
24541
|
+
"WebKit",
|
|
24542
|
+
"WiFiAware",
|
|
24543
|
+
"WidgetKit",
|
|
24544
|
+
"WorkoutKit",
|
|
24545
|
+
"_AVKit_SwiftUI",
|
|
24546
|
+
"_AdAttributionKit_StoreKit",
|
|
24547
|
+
"_AppIntents_HealthKit",
|
|
24548
|
+
"_AppIntents_SwiftUI",
|
|
24549
|
+
"_AppIntents_UIKit",
|
|
24550
|
+
"_AuthenticationServices_SwiftUI",
|
|
24551
|
+
"_Contacts_AppIntents",
|
|
24552
|
+
"_CoreData_CloudKit",
|
|
24553
|
+
"_CoreLocationUI_SwiftUI",
|
|
24554
|
+
"_CoreNFC_UIKit",
|
|
24555
|
+
"_CoreSpotlight_FoundationModels",
|
|
24556
|
+
"_DataDetection_SwiftUI",
|
|
24557
|
+
"_DeviceActivity_SwiftUI",
|
|
24558
|
+
"_DeviceDiscoveryUI_SwiftUI",
|
|
24559
|
+
"_FinanceKit_AppIntents",
|
|
24560
|
+
"_FoundationModels_SwiftUI",
|
|
24561
|
+
"_FoundationModels_UIKit",
|
|
24562
|
+
"_GameController_SwiftUI",
|
|
24563
|
+
"_GeoToolbox_AppIntents",
|
|
24564
|
+
"_GroupActivities_UIKit",
|
|
24565
|
+
"_HomeKit_SwiftUI",
|
|
24566
|
+
"_Intents_TipKit",
|
|
24567
|
+
"_LinkPresentation_AppIntents",
|
|
24568
|
+
"_LocationEssentials",
|
|
24569
|
+
"_MapKit_SwiftUI",
|
|
24570
|
+
"_MarketplaceKit_UIKit",
|
|
24571
|
+
"_MediaIntents_AppIntents",
|
|
24572
|
+
"_MediaPlayer_AppIntents",
|
|
24573
|
+
"_MusicKit_SwiftUI",
|
|
24574
|
+
"_NowPlaying_AppIntents",
|
|
24575
|
+
"_PassKit_SwiftUI",
|
|
24576
|
+
"_PermissionKit_SwiftUI",
|
|
24577
|
+
"_PermissionKit_UIKit",
|
|
24578
|
+
"_PhotosUI_SwiftUI",
|
|
24579
|
+
"_PhotosUI_WidgetKit",
|
|
24580
|
+
"_Photos_AppIntents",
|
|
24581
|
+
"_QuickLook_SwiftUI",
|
|
24582
|
+
"_RealityKit_ComputeGraph",
|
|
24583
|
+
"_RealityKit_SwiftUI",
|
|
24584
|
+
"_RelevanceKit_MapKit",
|
|
24585
|
+
"_SceneKit_SwiftUI",
|
|
24586
|
+
"_SecureElementCredential_SwiftUI",
|
|
24587
|
+
"_SecureElementCredential_UIKit",
|
|
24588
|
+
"_SharedWithYou_AppIntents",
|
|
24589
|
+
"_SpriteKit_SwiftUI",
|
|
24590
|
+
"_StoreKit_SwiftUI",
|
|
24591
|
+
"_SwiftData_CoreData",
|
|
24592
|
+
"_SwiftData_SwiftUI",
|
|
24593
|
+
"_Translation_SwiftUI",
|
|
24594
|
+
"_USDKit_RealityKit",
|
|
24595
|
+
"_UserNotifications_AppIntents",
|
|
24596
|
+
"_WebKit_SwiftUI",
|
|
24597
|
+
"_WorkoutKit_SwiftUI",
|
|
24598
|
+
"iAd"
|
|
24599
|
+
]
|
|
24600
|
+
};
|
|
24601
|
+
}
|
|
24602
|
+
});
|
|
24603
|
+
|
|
24604
|
+
// src/swift-binary-modules.ts
|
|
24605
|
+
function frameworkModules(paths) {
|
|
24606
|
+
const modules = /* @__PURE__ */ new Set();
|
|
24607
|
+
for (const file of paths) {
|
|
24608
|
+
const segment = file.split("/").find((part) => part.endsWith(".framework"));
|
|
24609
|
+
if (segment) modules.add(segment.slice(0, -".framework".length));
|
|
24610
|
+
}
|
|
24611
|
+
return [...modules].sort();
|
|
24612
|
+
}
|
|
24613
|
+
async function range(url, spec) {
|
|
24614
|
+
const response = await fetch(url, {
|
|
24615
|
+
headers: { range: `bytes=${spec}` },
|
|
24616
|
+
signal: AbortSignal.timeout(2e4)
|
|
24617
|
+
});
|
|
24618
|
+
const match = /^bytes (\d+)-\d+\/(\d+)$/.exec(
|
|
24619
|
+
response.headers.get("content-range") ?? ""
|
|
24620
|
+
);
|
|
24621
|
+
if (response.status !== 206 || !match)
|
|
24622
|
+
throw new Error(`${url} answered ${response.status} to a range request`);
|
|
24623
|
+
return {
|
|
24624
|
+
bytes: Buffer.from(await response.arrayBuffer()),
|
|
24625
|
+
start: Number(match[1]),
|
|
24626
|
+
total: Number(match[2])
|
|
24627
|
+
};
|
|
24628
|
+
}
|
|
24629
|
+
async function zipEntries(url) {
|
|
24630
|
+
const { total } = await range(url, "0-0");
|
|
24631
|
+
const tail = await range(url, `${Math.max(0, total - 65558)}-${total - 1}`);
|
|
24632
|
+
const end = signature(tail.bytes, 101010256);
|
|
24633
|
+
if (end < 0) throw new Error(`${url} has no zip end record`);
|
|
24634
|
+
let size = tail.bytes.readUInt32LE(end + 12);
|
|
24635
|
+
let offset = tail.bytes.readUInt32LE(end + 16);
|
|
24636
|
+
if (offset === 4294967295 || size === 4294967295) {
|
|
24637
|
+
const locator = end - 20;
|
|
24638
|
+
if (locator < 0 || tail.bytes.readUInt32LE(locator) !== 117853008)
|
|
24639
|
+
throw new Error(`${url} has no zip64 locator`);
|
|
24640
|
+
const recordAt = Number(tail.bytes.readBigUInt64LE(locator + 8));
|
|
24641
|
+
const record2 = recordAt >= tail.start ? tail.bytes.subarray(recordAt - tail.start) : (await range(url, `${recordAt}-${recordAt + 55}`)).bytes;
|
|
24642
|
+
size = Number(record2.readBigUInt64LE(40));
|
|
24643
|
+
offset = Number(record2.readBigUInt64LE(48));
|
|
24644
|
+
}
|
|
24645
|
+
const directory = offset >= tail.start ? tail.bytes.subarray(offset - tail.start, offset - tail.start + size) : (await range(url, `${offset}-${offset + size - 1}`)).bytes;
|
|
24646
|
+
const names = [];
|
|
24647
|
+
for (let at = 0; at + 46 <= directory.length; ) {
|
|
24648
|
+
if (directory.readUInt32LE(at) !== 33639248) break;
|
|
24649
|
+
const nameLength = directory.readUInt16LE(at + 28);
|
|
24650
|
+
names.push(directory.toString("utf8", at + 46, at + 46 + nameLength));
|
|
24651
|
+
at += 46 + nameLength + directory.readUInt16LE(at + 30) + directory.readUInt16LE(at + 32);
|
|
24652
|
+
}
|
|
24653
|
+
return names;
|
|
24654
|
+
}
|
|
24655
|
+
function localEntries(dir) {
|
|
24656
|
+
if (!import_node_fs13.default.existsSync(dir)) return [];
|
|
24657
|
+
return import_node_fs13.default.readdirSync(dir, { withFileTypes: true }).filter((slice) => slice.isDirectory()).flatMap(
|
|
24658
|
+
(slice) => import_node_fs13.default.readdirSync(import_node_path13.default.join(dir, slice.name)).map((entry) => `${slice.name}/${entry}`)
|
|
24659
|
+
);
|
|
24660
|
+
}
|
|
24661
|
+
async function swiftBinaryModules(binary) {
|
|
24662
|
+
if (!binary.url) return frameworkModules(localEntries(binary.dir));
|
|
24663
|
+
const cached4 = import_node_path13.default.join(
|
|
24664
|
+
cacheDir2,
|
|
24665
|
+
`${(0, import_node_crypto5.createHash)("sha256").update(binary.url).digest("hex").slice(0, 32)}.json`
|
|
24666
|
+
);
|
|
24667
|
+
if (import_node_fs13.default.existsSync(cached4)) {
|
|
24668
|
+
const value = JSON.parse(import_node_fs13.default.readFileSync(cached4, "utf8"));
|
|
24669
|
+
if (Array.isArray(value) && value.every((name2) => typeof name2 === "string"))
|
|
24670
|
+
return value;
|
|
24671
|
+
}
|
|
24672
|
+
const modules = frameworkModules(await zipEntries(binary.url));
|
|
24673
|
+
import_node_fs13.default.mkdirSync(cacheDir2, { recursive: true });
|
|
24674
|
+
import_node_fs13.default.writeFileSync(cached4, JSON.stringify(modules));
|
|
24675
|
+
return modules;
|
|
24676
|
+
}
|
|
24677
|
+
var import_node_crypto5, import_node_fs13, import_node_os5, import_node_path13, cacheDir2, signature;
|
|
24678
|
+
var init_swift_binary_modules = __esm({
|
|
24679
|
+
"src/swift-binary-modules.ts"() {
|
|
24680
|
+
"use strict";
|
|
24681
|
+
import_node_crypto5 = require("node:crypto");
|
|
24682
|
+
import_node_fs13 = __toESM(require("node:fs"), 1);
|
|
24683
|
+
import_node_os5 = __toESM(require("node:os"), 1);
|
|
24684
|
+
import_node_path13 = __toESM(require("node:path"), 1);
|
|
24685
|
+
cacheDir2 = import_node_path13.default.join(import_node_os5.default.tmpdir(), "peach-swift-binary-modules");
|
|
24686
|
+
signature = (bytes, value) => {
|
|
24687
|
+
const needle = Buffer.alloc(4);
|
|
24688
|
+
needle.writeUInt32LE(value);
|
|
24689
|
+
return bytes.lastIndexOf(needle);
|
|
24690
|
+
};
|
|
24691
|
+
}
|
|
24692
|
+
});
|
|
24693
|
+
|
|
24308
24694
|
// src/swift-package-manifest.ts
|
|
24309
24695
|
function swiftCommand() {
|
|
24310
|
-
return process.platform === "darwin" ? { file: "xcrun", args: ["swift"] } : { file:
|
|
24696
|
+
return process.platform === "darwin" ? { file: "xcrun", args: ["swift"] } : { file: import_node_path14.default.join(swiftToolchainBin(swift_distribution_lock_default.release), "swift"), args: [] };
|
|
24311
24697
|
}
|
|
24312
24698
|
function dump(dir) {
|
|
24313
|
-
const manifests =
|
|
24699
|
+
const manifests = import_node_fs14.default.readdirSync(dir).filter((name2) => /^Package(@swift-[\d.]+)?\.swift$/.test(name2)).sort();
|
|
24314
24700
|
const command = swiftCommand();
|
|
24315
|
-
const key = (0,
|
|
24316
|
-
manifests.map((name2) => `${name2}\0${
|
|
24701
|
+
const key = (0, import_node_crypto6.createHash)("sha256").update(JSON.stringify([command, import_node_path14.default.resolve(dir)])).update(
|
|
24702
|
+
manifests.map((name2) => `${name2}\0${import_node_fs14.default.readFileSync(import_node_path14.default.join(dir, name2), "utf8")}`).join("\0")
|
|
24317
24703
|
).digest("hex").slice(0, 32);
|
|
24318
|
-
const cached4 =
|
|
24319
|
-
if (
|
|
24320
|
-
return { key, raw: record(JSON.parse(
|
|
24704
|
+
const cached4 = import_node_path14.default.join(cacheDir3, `${key}.json`);
|
|
24705
|
+
if (import_node_fs14.default.existsSync(cached4))
|
|
24706
|
+
return { key, raw: record(JSON.parse(import_node_fs14.default.readFileSync(cached4, "utf8"))) };
|
|
24321
24707
|
let output;
|
|
24322
24708
|
try {
|
|
24323
24709
|
output = (0, import_node_child_process7.execFileSync)(
|
|
@@ -24329,7 +24715,7 @@ function dump(dir) {
|
|
|
24329
24715
|
dir,
|
|
24330
24716
|
// swiftpm's scratch files never land in the app's own package
|
|
24331
24717
|
"--scratch-path",
|
|
24332
|
-
|
|
24718
|
+
import_node_path14.default.join(cacheDir3, `${key}.build`),
|
|
24333
24719
|
"dump-package"
|
|
24334
24720
|
],
|
|
24335
24721
|
{
|
|
@@ -24341,11 +24727,11 @@ function dump(dir) {
|
|
|
24341
24727
|
} catch (error) {
|
|
24342
24728
|
const stderr = error instanceof Error && "stderr" in error ? String(error.stderr).trim() : "";
|
|
24343
24729
|
throw new Error(
|
|
24344
|
-
`swiftpm could not evaluate ${
|
|
24730
|
+
`swiftpm could not evaluate ${import_node_path14.default.join(dir, "Package.swift")}${stderr ? `: ${stderr}` : ""}`
|
|
24345
24731
|
);
|
|
24346
24732
|
}
|
|
24347
|
-
|
|
24348
|
-
|
|
24733
|
+
import_node_fs14.default.mkdirSync(cacheDir3, { recursive: true });
|
|
24734
|
+
import_node_fs14.default.writeFileSync(cached4, output);
|
|
24349
24735
|
return { key, raw: record(JSON.parse(output)) };
|
|
24350
24736
|
}
|
|
24351
24737
|
function defaultTraits(manifest) {
|
|
@@ -24373,7 +24759,7 @@ function linksOnIOS(condition, traits) {
|
|
|
24373
24759
|
return gates.length === 0 || gates.some((name2) => traits.has(string(name2) ?? ""));
|
|
24374
24760
|
}
|
|
24375
24761
|
function swiftPackageManifest(dir) {
|
|
24376
|
-
dir =
|
|
24762
|
+
dir = import_node_fs14.default.realpathSync(dir);
|
|
24377
24763
|
const { key, raw: raw2 } = dump(dir);
|
|
24378
24764
|
const known = evaluated.get(key);
|
|
24379
24765
|
if (known) return known;
|
|
@@ -24421,7 +24807,7 @@ function swiftPackageManifest(dir) {
|
|
|
24421
24807
|
if (!name2 || !isTargetType(kind)) continue;
|
|
24422
24808
|
const declared = string(target.path);
|
|
24423
24809
|
const roots = kind === "test" ? ["Tests"] : ["Sources", "Source", "src", "srcs"];
|
|
24424
|
-
const targetDir = declared ?
|
|
24810
|
+
const targetDir = declared ? import_node_path14.default.resolve(dir, declared) : roots.map((root) => import_node_path14.default.join(dir, root, name2)).find((candidate) => import_node_fs14.default.existsSync(candidate)) ?? import_node_path14.default.join(dir, roots[0], name2);
|
|
24425
24811
|
const dependencies = [];
|
|
24426
24812
|
for (const dependency of array(target.dependencies)) {
|
|
24427
24813
|
const { target: local, product, byName } = record(dependency);
|
|
@@ -24463,7 +24849,8 @@ function swiftPackageManifest(dir) {
|
|
|
24463
24849
|
dependencies,
|
|
24464
24850
|
languageMode,
|
|
24465
24851
|
mainActorIsolation,
|
|
24466
|
-
declaresResources: array(target.resources).length > 0
|
|
24852
|
+
declaresResources: array(target.resources).length > 0,
|
|
24853
|
+
url: string(target.url) ?? null
|
|
24467
24854
|
});
|
|
24468
24855
|
}
|
|
24469
24856
|
const manifest = { dir, products, targets, packages };
|
|
@@ -24471,36 +24858,36 @@ function swiftPackageManifest(dir) {
|
|
|
24471
24858
|
return manifest;
|
|
24472
24859
|
}
|
|
24473
24860
|
function walk(dir) {
|
|
24474
|
-
if (!
|
|
24475
|
-
if (
|
|
24861
|
+
if (!import_node_fs14.default.existsSync(dir)) return [];
|
|
24862
|
+
if (import_node_fs14.default.statSync(dir).isFile()) return [dir];
|
|
24476
24863
|
const out = [];
|
|
24477
|
-
for (const entry of
|
|
24864
|
+
for (const entry of import_node_fs14.default.readdirSync(dir, { withFileTypes: true })) {
|
|
24478
24865
|
if (entry.name.startsWith(".")) continue;
|
|
24479
|
-
const full =
|
|
24866
|
+
const full = import_node_path14.default.join(dir, entry.name);
|
|
24480
24867
|
if (entry.isDirectory()) out.push(...walk(full));
|
|
24481
24868
|
else if (entry.isFile()) out.push(full);
|
|
24482
24869
|
}
|
|
24483
24870
|
return out;
|
|
24484
24871
|
}
|
|
24485
24872
|
function swiftTargetFiles(manifest, target) {
|
|
24486
|
-
const included = target.sources ? target.sources.map((source) =>
|
|
24873
|
+
const included = target.sources ? target.sources.map((source) => import_node_path14.default.resolve(target.dir, source)) : [target.dir];
|
|
24487
24874
|
const excluded = [
|
|
24488
|
-
...target.exclude.map((file) =>
|
|
24875
|
+
...target.exclude.map((file) => import_node_path14.default.resolve(target.dir, file)),
|
|
24489
24876
|
...[...manifest.targets.values()].flatMap(
|
|
24490
24877
|
(other) => other !== target && within(other.dir, [target.dir]) && other.dir !== target.dir ? [other.dir] : []
|
|
24491
24878
|
)
|
|
24492
24879
|
];
|
|
24493
24880
|
return included.flatMap(walk).filter((file) => !within(file, excluded)).sort();
|
|
24494
24881
|
}
|
|
24495
|
-
var import_node_child_process7,
|
|
24882
|
+
var import_node_child_process7, import_node_crypto6, import_node_fs14, import_node_os6, import_node_path14, TARGET_TYPES, isTargetType, record, array, string, cacheDir3, evaluated, within;
|
|
24496
24883
|
var init_swift_package_manifest = __esm({
|
|
24497
24884
|
"src/swift-package-manifest.ts"() {
|
|
24498
24885
|
"use strict";
|
|
24499
24886
|
import_node_child_process7 = require("node:child_process");
|
|
24500
|
-
|
|
24501
|
-
|
|
24502
|
-
|
|
24503
|
-
|
|
24887
|
+
import_node_crypto6 = require("node:crypto");
|
|
24888
|
+
import_node_fs14 = __toESM(require("node:fs"), 1);
|
|
24889
|
+
import_node_os6 = __toESM(require("node:os"), 1);
|
|
24890
|
+
import_node_path14 = __toESM(require("node:path"), 1);
|
|
24504
24891
|
init_swift_distribution_lock();
|
|
24505
24892
|
init_swift_toolchain();
|
|
24506
24893
|
TARGET_TYPES = [
|
|
@@ -24516,15 +24903,15 @@ var init_swift_package_manifest = __esm({
|
|
|
24516
24903
|
record = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
24517
24904
|
array = (value) => Array.isArray(value) ? value : [];
|
|
24518
24905
|
string = (value) => typeof value === "string" ? value : void 0;
|
|
24519
|
-
|
|
24906
|
+
cacheDir3 = import_node_path14.default.join(import_node_os6.default.tmpdir(), "peach-swift-manifests");
|
|
24520
24907
|
evaluated = /* @__PURE__ */ new Map();
|
|
24521
|
-
within = (file, roots) => roots.some((root) => file === root || file.startsWith(`${root}${
|
|
24908
|
+
within = (file, roots) => roots.some((root) => file === root || file.startsWith(`${root}${import_node_path14.default.sep}`));
|
|
24522
24909
|
}
|
|
24523
24910
|
});
|
|
24524
24911
|
|
|
24525
24912
|
// src/swift-packages.ts
|
|
24526
24913
|
function readPins(resolved) {
|
|
24527
|
-
const data = JSON.parse(
|
|
24914
|
+
const data = JSON.parse(import_node_fs15.default.readFileSync(resolved, "utf8"));
|
|
24528
24915
|
const pins = data && typeof data === "object" && "pins" in data && Array.isArray(data.pins) ? data.pins : null;
|
|
24529
24916
|
if (!pins)
|
|
24530
24917
|
throw new Error(`${resolved} has no pins; resolve packages in a current Xcode`);
|
|
@@ -24539,23 +24926,23 @@ function readPins(resolved) {
|
|
|
24539
24926
|
return out;
|
|
24540
24927
|
}
|
|
24541
24928
|
function checkout(checkouts, identity, pin) {
|
|
24542
|
-
const dir =
|
|
24929
|
+
const dir = import_node_path15.default.join(checkouts, identity);
|
|
24543
24930
|
const key = `${dir}\0${pin.revision}`;
|
|
24544
24931
|
if (verified2.has(key)) return dir;
|
|
24545
24932
|
const git = (...args) => (0, import_node_child_process8.execFileSync)("git", ["-C", dir, ...args], {
|
|
24546
24933
|
encoding: "utf8",
|
|
24547
24934
|
stdio: ["ignore", "pipe", "pipe"]
|
|
24548
24935
|
}).trim();
|
|
24549
|
-
const current =
|
|
24936
|
+
const current = import_node_fs15.default.existsSync(import_node_path15.default.join(dir, ".git")) ? git("rev-parse", "HEAD") : "";
|
|
24550
24937
|
if (current !== pin.revision) {
|
|
24551
|
-
|
|
24552
|
-
|
|
24938
|
+
import_node_fs15.default.rmSync(dir, { recursive: true, force: true });
|
|
24939
|
+
import_node_fs15.default.mkdirSync(dir, { recursive: true });
|
|
24553
24940
|
try {
|
|
24554
24941
|
git("init", "-q");
|
|
24555
24942
|
git("fetch", "-q", "--depth", "1", pin.location, pin.revision);
|
|
24556
24943
|
git("checkout", "-q", "FETCH_HEAD");
|
|
24557
24944
|
} catch (error) {
|
|
24558
|
-
|
|
24945
|
+
import_node_fs15.default.rmSync(dir, { recursive: true, force: true });
|
|
24559
24946
|
const stderr = error instanceof Error && "stderr" in error ? String(error.stderr).trim() : "";
|
|
24560
24947
|
throw new Error(
|
|
24561
24948
|
`could not fetch ${pin.location} at ${pin.revision}${stderr ? `: ${stderr}` : ""}`
|
|
@@ -24571,13 +24958,14 @@ function resolveSwiftPackages(options) {
|
|
|
24571
24958
|
const result = {
|
|
24572
24959
|
targets: [],
|
|
24573
24960
|
unavailable: /* @__PURE__ */ new Map(),
|
|
24574
|
-
modules: /* @__PURE__ */ new Map()
|
|
24961
|
+
modules: /* @__PURE__ */ new Map(),
|
|
24962
|
+
binaries: []
|
|
24575
24963
|
};
|
|
24576
24964
|
const pins = resolved ? readPins(resolved) : null;
|
|
24577
|
-
const checkouts =
|
|
24965
|
+
const checkouts = import_node_path15.default.join(rootDir, REMOTE_CHECKOUTS);
|
|
24578
24966
|
const packages = /* @__PURE__ */ new Map();
|
|
24579
24967
|
const load2 = (source) => {
|
|
24580
|
-
const key = source.kind === "local" ?
|
|
24968
|
+
const key = source.kind === "local" ? import_node_path15.default.resolve(source.dir) : source.url;
|
|
24581
24969
|
const cached4 = packages.get(key);
|
|
24582
24970
|
if (cached4 !== void 0) return cached4;
|
|
24583
24971
|
let loaded2;
|
|
@@ -24589,8 +24977,8 @@ function resolveSwiftPackages(options) {
|
|
|
24589
24977
|
if (!pin) {
|
|
24590
24978
|
loaded2 = pins ? `package ${identity} is not pinned in Package.resolved` : "no Package.resolved pins it; resolve packages in Xcode once";
|
|
24591
24979
|
} else {
|
|
24592
|
-
|
|
24593
|
-
|
|
24980
|
+
import_node_fs15.default.mkdirSync(checkouts, { recursive: true });
|
|
24981
|
+
import_node_fs15.default.writeFileSync(import_node_path15.default.join(import_node_path15.default.dirname(checkouts), ".gitignore"), "*\n");
|
|
24594
24982
|
loaded2 = {
|
|
24595
24983
|
source: source.url,
|
|
24596
24984
|
remote: true,
|
|
@@ -24610,8 +24998,8 @@ function resolveSwiftPackages(options) {
|
|
|
24610
24998
|
const outcome = (() => {
|
|
24611
24999
|
if (provided.has(name2)) return null;
|
|
24612
25000
|
const target = pkg.manifest.targets.get(name2);
|
|
24613
|
-
if (!target) return `${
|
|
24614
|
-
if (target.type === "binary") return `${name2}
|
|
25001
|
+
if (!target) return `${import_node_path15.default.basename(pkg.manifest.dir)} declares no target ${name2}`;
|
|
25002
|
+
if (target.type === "binary") return `${name2} ${BINARY}`;
|
|
24615
25003
|
if (target.type === "system") return `${name2} is a system C library`;
|
|
24616
25004
|
if (target.type !== "regular") return `${name2} is a ${target.type} target`;
|
|
24617
25005
|
const files = swiftTargetFiles(pkg.manifest, target);
|
|
@@ -24622,9 +25010,9 @@ function resolveSwiftPackages(options) {
|
|
|
24622
25010
|
const nested = resolveDependencyProduct(pkg, dependency.package, dependency.name);
|
|
24623
25011
|
return nested && `${dependency.name}: ${nested}`;
|
|
24624
25012
|
});
|
|
24625
|
-
const blocked = reasons
|
|
25013
|
+
const blocked = blocker(reasons);
|
|
24626
25014
|
if (blocked) return blocked;
|
|
24627
|
-
const relative3 = files.map((file) =>
|
|
25015
|
+
const relative3 = files.map((file) => import_node_path15.default.relative(target.dir, file));
|
|
24628
25016
|
targets.set(`${pkg.manifest.dir}\0${name2}`, {
|
|
24629
25017
|
name: name2,
|
|
24630
25018
|
path: "",
|
|
@@ -24646,7 +25034,7 @@ function resolveSwiftPackages(options) {
|
|
|
24646
25034
|
const resolveProduct = (pkg, product) => {
|
|
24647
25035
|
if (provided.has(product)) return null;
|
|
24648
25036
|
const roots = pkg.manifest.products.get(product);
|
|
24649
|
-
const reason = !roots ? `${
|
|
25037
|
+
const reason = !roots ? `${import_node_path15.default.basename(pkg.manifest.dir)} has no library ${product}` : blocker(roots.map((name2) => resolveTarget(pkg, name2)));
|
|
24650
25038
|
productOutcomes.set(`${pkg.manifest.dir}\0${product}`, { pkg, reason });
|
|
24651
25039
|
return reason;
|
|
24652
25040
|
};
|
|
@@ -24654,7 +25042,7 @@ function resolveSwiftPackages(options) {
|
|
|
24654
25042
|
if (provided.has(product)) return null;
|
|
24655
25043
|
const dependency = pkg.manifest.packages.get(packageName);
|
|
24656
25044
|
if (!dependency)
|
|
24657
|
-
return `${
|
|
25045
|
+
return `${import_node_path15.default.basename(pkg.manifest.dir)} names no package ${packageName}`;
|
|
24658
25046
|
if ("dir" in dependency) {
|
|
24659
25047
|
const loaded3 = load2({ kind: "local", dir: dependency.dir });
|
|
24660
25048
|
return typeof loaded3 === "string" ? loaded3 : resolveProduct(loaded3, product);
|
|
@@ -24681,6 +25069,13 @@ function resolveSwiftPackages(options) {
|
|
|
24681
25069
|
if (target.type === "test" || target.type === "plugin" || target.type === "macro")
|
|
24682
25070
|
continue;
|
|
24683
25071
|
if (target.type === "executable") continue;
|
|
25072
|
+
if (target.type === "binary")
|
|
25073
|
+
result.binaries.push({
|
|
25074
|
+
target: name2,
|
|
25075
|
+
source: pkg.source,
|
|
25076
|
+
url: target.url,
|
|
25077
|
+
dir: target.dir
|
|
25078
|
+
});
|
|
24684
25079
|
const reason = resolveTarget(pkg, name2);
|
|
24685
25080
|
if (reason && !result.modules.has(name2))
|
|
24686
25081
|
result.modules.set(name2, { source: pkg.source, reason });
|
|
@@ -24700,7 +25095,7 @@ function resolveSwiftPackages(options) {
|
|
|
24700
25095
|
if (dependency.kind === "target") reach(pkg, dependency.name);
|
|
24701
25096
|
else {
|
|
24702
25097
|
const source = pkg.manifest.packages.get(dependency.package);
|
|
24703
|
-
const nested = source && ("dir" in source ? packages.get(
|
|
25098
|
+
const nested = source && ("dir" in source ? packages.get(import_node_path15.default.resolve(source.dir)) : packages.get(source.url));
|
|
24704
25099
|
if (nested && typeof nested !== "string")
|
|
24705
25100
|
for (const root of nested.manifest.products.get(dependency.name) ?? [])
|
|
24706
25101
|
reach(nested, root);
|
|
@@ -24708,24 +25103,26 @@ function resolveSwiftPackages(options) {
|
|
|
24708
25103
|
}
|
|
24709
25104
|
};
|
|
24710
25105
|
for (const { product, source } of products) {
|
|
24711
|
-
const pkg = source.kind === "unnamed" ? unnamed().find((candidate) => candidate.manifest.products.has(product)) : packages.get(source.kind === "local" ?
|
|
25106
|
+
const pkg = source.kind === "unnamed" ? unnamed().find((candidate) => candidate.manifest.products.has(product)) : packages.get(source.kind === "local" ? import_node_path15.default.resolve(source.dir) : source.url);
|
|
24712
25107
|
if (!pkg || typeof pkg === "string") continue;
|
|
24713
25108
|
for (const root of pkg.manifest.products.get(product) ?? []) reach(pkg, root);
|
|
24714
25109
|
}
|
|
24715
25110
|
result.targets = [...targets.entries()].filter(([key]) => reached.has(key)).map(([, target]) => target);
|
|
24716
25111
|
return result;
|
|
24717
25112
|
}
|
|
24718
|
-
var import_node_child_process8,
|
|
25113
|
+
var import_node_child_process8, import_node_fs15, import_node_path15, REMOTE_CHECKOUTS, C_FAMILY, BINARY, blocker, verified2;
|
|
24719
25114
|
var init_swift_packages = __esm({
|
|
24720
25115
|
"src/swift-packages.ts"() {
|
|
24721
25116
|
"use strict";
|
|
24722
25117
|
import_node_child_process8 = require("node:child_process");
|
|
24723
|
-
|
|
24724
|
-
|
|
25118
|
+
import_node_fs15 = __toESM(require("node:fs"), 1);
|
|
25119
|
+
import_node_path15 = __toESM(require("node:path"), 1);
|
|
24725
25120
|
init_swift_package();
|
|
24726
25121
|
init_swift_package_manifest();
|
|
24727
|
-
REMOTE_CHECKOUTS =
|
|
25122
|
+
REMOTE_CHECKOUTS = import_node_path15.default.join(".build", "peach", "checkouts");
|
|
24728
25123
|
C_FAMILY = /\.(c|cc|cpp|cxx|m|mm|s|S)$/;
|
|
25124
|
+
BINARY = "is a binary framework";
|
|
25125
|
+
blocker = (reasons) => reasons.find((reason) => reason?.includes(BINARY)) ?? reasons.find((reason) => reason !== null) ?? null;
|
|
24729
25126
|
verified2 = /* @__PURE__ */ new Set();
|
|
24730
25127
|
}
|
|
24731
25128
|
});
|
|
@@ -24866,7 +25263,7 @@ var init_swift_submit = __esm({
|
|
|
24866
25263
|
function readXcodeJsonProject(xcodeproj, source) {
|
|
24867
25264
|
const json = import_json5.default.parse(source);
|
|
24868
25265
|
if (!isJsonObject(json)) throw new Error(`${xcodeproj}/project.xcproj is not an object`);
|
|
24869
|
-
const projectDir =
|
|
25266
|
+
const projectDir = import_node_path16.default.dirname(xcodeproj);
|
|
24870
25267
|
const objects = {};
|
|
24871
25268
|
let next = 0;
|
|
24872
25269
|
const add = (entry, id) => {
|
|
@@ -24879,7 +25276,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
24879
25276
|
const base = /^<([A-Z]+)>\/(.*)$/.exec(raw2);
|
|
24880
25277
|
if (base) {
|
|
24881
25278
|
if (base[1] === "PROJECT")
|
|
24882
|
-
return { sourceTree: "<absolute>", path:
|
|
25279
|
+
return { sourceTree: "<absolute>", path: import_node_path16.default.join(projectDir, base[2]) };
|
|
24883
25280
|
if (base[1] === "PRODUCTS")
|
|
24884
25281
|
return { sourceTree: "BUILT_PRODUCTS_DIR", path: base[2] };
|
|
24885
25282
|
return null;
|
|
@@ -24887,7 +25284,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
24887
25284
|
const unescaped = raw2.replaceAll("\\<", "<");
|
|
24888
25285
|
if (unescaped.startsWith("/")) return { sourceTree: "<absolute>", path: unescaped };
|
|
24889
25286
|
if (unescaped.startsWith("~")) return null;
|
|
24890
|
-
return groupDir === null ? null : { sourceTree: "<absolute>", path:
|
|
25287
|
+
return groupDir === null ? null : { sourceTree: "<absolute>", path: import_node_path16.default.join(groupDir, unescaped) };
|
|
24891
25288
|
};
|
|
24892
25289
|
const memberships = [];
|
|
24893
25290
|
const folders = [];
|
|
@@ -24898,7 +25295,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
24898
25295
|
const kind = text(entry.kind) ?? "file-reference";
|
|
24899
25296
|
const raw2 = text(entry.path) ?? "";
|
|
24900
25297
|
const located = raw2 === "" ? null : locate(raw2, parent.dir);
|
|
24901
|
-
const name2 = text(entry.name) ??
|
|
25298
|
+
const name2 = text(entry.name) ?? import_node_path16.default.basename(raw2);
|
|
24902
25299
|
const node = { id: "", name: name2, dir: null, parent, children: [] };
|
|
24903
25300
|
if (kind === "group" || kind === "variant-group" || kind === "version-group") {
|
|
24904
25301
|
node.dir = raw2 === "" ? parent.dir : located?.sourceTree === "<absolute>" ? located.path : null;
|
|
@@ -25013,7 +25410,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
25013
25410
|
if (!isObject(entry)) continue;
|
|
25014
25411
|
const repository = text(entry.repository);
|
|
25015
25412
|
const local = text(entry.path);
|
|
25016
|
-
const name2 = local !== void 0 ?
|
|
25413
|
+
const name2 = local !== void 0 ? import_node_path16.default.basename(import_node_path16.default.resolve(import_node_path16.default.dirname(xcodeproj), local)) : import_node_path16.default.basename(repository ?? "").replace(/\.git$/, "");
|
|
25017
25414
|
const id = text(entry.kind) === "local" && local !== void 0 ? add({ isa: "XCLocalSwiftPackageReference", relativePath: local }) : add({ isa: "XCRemoteSwiftPackageReference", repositoryURL: repository ?? "" });
|
|
25018
25415
|
packageIds.set(name2.toLowerCase(), id);
|
|
25019
25416
|
}
|
|
@@ -25181,11 +25578,11 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
25181
25578
|
function isJsonObject(value) {
|
|
25182
25579
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
25183
25580
|
}
|
|
25184
|
-
var
|
|
25581
|
+
var import_node_path16, import_json5, isObject, text, items, PHASE_ISA;
|
|
25185
25582
|
var init_xcode_json_project = __esm({
|
|
25186
25583
|
"src/xcode-json-project.ts"() {
|
|
25187
25584
|
"use strict";
|
|
25188
|
-
|
|
25585
|
+
import_node_path16 = __toESM(require("node:path"), 1);
|
|
25189
25586
|
import_json5 = __toESM(require("json5"), 1);
|
|
25190
25587
|
isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
25191
25588
|
text = (value) => typeof value === "string" ? value : void 0;
|
|
@@ -25292,27 +25689,27 @@ function parseOpenStepPlist(text2) {
|
|
|
25292
25689
|
return root;
|
|
25293
25690
|
}
|
|
25294
25691
|
function walkFiles(dir) {
|
|
25295
|
-
if (!
|
|
25692
|
+
if (!import_node_fs16.default.existsSync(dir)) return [];
|
|
25296
25693
|
const out = [];
|
|
25297
|
-
for (const entry of
|
|
25694
|
+
for (const entry of import_node_fs16.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
|
|
25298
25695
|
if (entry.name.startsWith(".")) continue;
|
|
25299
|
-
const full =
|
|
25696
|
+
const full = import_node_path17.default.join(dir, entry.name);
|
|
25300
25697
|
if (entry.isDirectory()) out.push(...walkFiles(full));
|
|
25301
25698
|
else if (entry.isFile()) out.push(full);
|
|
25302
25699
|
}
|
|
25303
25700
|
return out;
|
|
25304
25701
|
}
|
|
25305
25702
|
function readXcconfig(file, seen = /* @__PURE__ */ new Set()) {
|
|
25306
|
-
if (seen.has(file) || !
|
|
25703
|
+
if (seen.has(file) || !import_node_fs16.default.existsSync(file)) return {};
|
|
25307
25704
|
seen.add(file);
|
|
25308
25705
|
const settings = {};
|
|
25309
|
-
for (const raw2 of
|
|
25706
|
+
for (const raw2 of import_node_fs16.default.readFileSync(file, "utf8").split("\n")) {
|
|
25310
25707
|
const line = raw2.replace(/\/\/.*$/, "").trim();
|
|
25311
25708
|
const include = /^#include\??\s+"([^"]+)"/.exec(line);
|
|
25312
25709
|
if (include) {
|
|
25313
25710
|
Object.assign(
|
|
25314
25711
|
settings,
|
|
25315
|
-
readXcconfig(
|
|
25712
|
+
readXcconfig(import_node_path17.default.resolve(import_node_path17.default.dirname(file), include[1]), seen)
|
|
25316
25713
|
);
|
|
25317
25714
|
continue;
|
|
25318
25715
|
}
|
|
@@ -25362,22 +25759,22 @@ function decodeXml(text2) {
|
|
|
25362
25759
|
return text2.replaceAll(""", '"').replaceAll("'", "'").replaceAll("<", "<").replaceAll(">", ">").replaceAll("&", "&");
|
|
25363
25760
|
}
|
|
25364
25761
|
function workspaceReferences(workspace) {
|
|
25365
|
-
const data =
|
|
25366
|
-
if (!
|
|
25762
|
+
const data = import_node_path17.default.join(workspace, "contents.xcworkspacedata");
|
|
25763
|
+
if (!import_node_fs16.default.existsSync(data))
|
|
25367
25764
|
throw new Error(`${workspace} has no contents.xcworkspacedata`);
|
|
25368
|
-
const container =
|
|
25765
|
+
const container = import_node_path17.default.dirname(workspace);
|
|
25369
25766
|
const locate = (location2, base) => {
|
|
25370
25767
|
const colon = location2.indexOf(":");
|
|
25371
25768
|
const kind = location2.slice(0, colon);
|
|
25372
25769
|
const rest = location2.slice(colon + 1);
|
|
25373
|
-
if (kind === "group") return
|
|
25374
|
-
if (kind === "container" || kind === "self") return
|
|
25375
|
-
if (kind === "absolute") return
|
|
25376
|
-
throw new Error(`${
|
|
25770
|
+
if (kind === "group") return import_node_path17.default.resolve(base, rest);
|
|
25771
|
+
if (kind === "container" || kind === "self") return import_node_path17.default.resolve(container, rest);
|
|
25772
|
+
if (kind === "absolute") return import_node_path17.default.resolve(rest);
|
|
25773
|
+
throw new Error(`${import_node_path17.default.basename(workspace)} has an unsupported location ${location2}`);
|
|
25377
25774
|
};
|
|
25378
25775
|
const groups = [container];
|
|
25379
25776
|
const references = [];
|
|
25380
|
-
for (const [, closing, tag, attributes, selfClosing] of
|
|
25777
|
+
for (const [, closing, tag, attributes, selfClosing] of import_node_fs16.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
|
|
25381
25778
|
if (closing) {
|
|
25382
25779
|
if (tag === "Group") groups.pop();
|
|
25383
25780
|
continue;
|
|
@@ -25392,8 +25789,8 @@ function workspaceReferences(workspace) {
|
|
|
25392
25789
|
}
|
|
25393
25790
|
function xcodeProjectFile(xcodeproj) {
|
|
25394
25791
|
for (const name2 of ["project.pbxproj", "project.xcproj"]) {
|
|
25395
|
-
const file =
|
|
25396
|
-
if (
|
|
25792
|
+
const file = import_node_path17.default.join(xcodeproj, name2);
|
|
25793
|
+
if (import_node_fs16.default.existsSync(file)) return file;
|
|
25397
25794
|
}
|
|
25398
25795
|
return null;
|
|
25399
25796
|
}
|
|
@@ -25401,10 +25798,10 @@ function loadProject(xcodeproj) {
|
|
|
25401
25798
|
const projectFile = xcodeProjectFile(xcodeproj);
|
|
25402
25799
|
if (!projectFile)
|
|
25403
25800
|
throw new Error(`${xcodeproj} has no project.pbxproj or project.xcproj`);
|
|
25404
|
-
const mtimeMs =
|
|
25801
|
+
const mtimeMs = import_node_fs16.default.statSync(projectFile).mtimeMs;
|
|
25405
25802
|
const cached4 = loaded.get(projectFile);
|
|
25406
25803
|
if (cached4?.mtimeMs === mtimeMs) return cached4.project;
|
|
25407
|
-
const source =
|
|
25804
|
+
const source = import_node_fs16.default.readFileSync(projectFile, "utf8");
|
|
25408
25805
|
const root = projectFile.endsWith(".xcproj") ? readXcodeJsonProject(xcodeproj, source) : parseOpenStepPlist(source);
|
|
25409
25806
|
if (!isDict(root) || !isDict(root.objects)) {
|
|
25410
25807
|
throw new Error(`${projectFile} has no objects table`);
|
|
@@ -25418,8 +25815,8 @@ function loadProject(xcodeproj) {
|
|
|
25418
25815
|
if (!project || project.isa !== "PBXProject") {
|
|
25419
25816
|
throw new Error(`${projectFile} has no PBXProject root`);
|
|
25420
25817
|
}
|
|
25421
|
-
const projectDir =
|
|
25422
|
-
|
|
25818
|
+
const projectDir = import_node_fs16.default.realpathSync(
|
|
25819
|
+
import_node_path17.default.resolve(import_node_path17.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
|
|
25423
25820
|
);
|
|
25424
25821
|
const parent = /* @__PURE__ */ new Map();
|
|
25425
25822
|
for (const [id, entry] of Object.entries(objects)) {
|
|
@@ -25437,11 +25834,11 @@ function loadProject(xcodeproj) {
|
|
|
25437
25834
|
const own = str(entry.path) ?? "";
|
|
25438
25835
|
const tree = str(entry.sourceTree) ?? "<group>";
|
|
25439
25836
|
if (tree === "<absolute>") result2 = own;
|
|
25440
|
-
else if (tree === "SOURCE_ROOT") result2 =
|
|
25837
|
+
else if (tree === "SOURCE_ROOT") result2 = import_node_path17.default.join(projectDir, own);
|
|
25441
25838
|
else if (tree === "<group>") {
|
|
25442
25839
|
const up = parent.get(id);
|
|
25443
25840
|
const base = up ? resolvePath(up) : projectDir;
|
|
25444
|
-
result2 = base === null ? null :
|
|
25841
|
+
result2 = base === null ? null : import_node_path17.default.join(base, own);
|
|
25445
25842
|
}
|
|
25446
25843
|
}
|
|
25447
25844
|
resolvedPaths.set(id, result2);
|
|
@@ -25541,7 +25938,7 @@ function targetMembers(ref) {
|
|
|
25541
25938
|
const addResource = (file) => {
|
|
25542
25939
|
if (isDirectory(file)) {
|
|
25543
25940
|
for (const inner of walkFiles(file)) resources.add(inner);
|
|
25544
|
-
} else if (
|
|
25941
|
+
} else if (import_node_fs16.default.existsSync(file)) resources.add(file);
|
|
25545
25942
|
};
|
|
25546
25943
|
const fileRefPaths = (refId) => {
|
|
25547
25944
|
const entry = project.object(refId);
|
|
@@ -25562,7 +25959,7 @@ function targetMembers(ref) {
|
|
|
25562
25959
|
for (const buildFileId of list(phase.files)) {
|
|
25563
25960
|
for (const file of fileRefPaths(str(project.object(buildFileId)?.fileRef) ?? "")) {
|
|
25564
25961
|
if (phase.isa === "PBXSourcesBuildPhase") {
|
|
25565
|
-
if (!
|
|
25962
|
+
if (!import_node_fs16.default.existsSync(file)) continue;
|
|
25566
25963
|
allSources.add(file);
|
|
25567
25964
|
if (file.endsWith(".swift")) sources.add(file);
|
|
25568
25965
|
} else if (phase.isa === "PBXResourcesBuildPhase") addResource(file);
|
|
@@ -25570,7 +25967,7 @@ function targetMembers(ref) {
|
|
|
25570
25967
|
}
|
|
25571
25968
|
}
|
|
25572
25969
|
const addSynchronized = (folder, relative3) => {
|
|
25573
|
-
const file =
|
|
25970
|
+
const file = import_node_path17.default.join(folder, relative3);
|
|
25574
25971
|
if (NEVER_MEMBER.test(relative3)) return;
|
|
25575
25972
|
if (file.endsWith(".swift")) {
|
|
25576
25973
|
if (!relative3.split("/").some((segment) => BUNDLE_DIR.test(segment))) {
|
|
@@ -25595,7 +25992,7 @@ function targetMembers(ref) {
|
|
|
25595
25992
|
}
|
|
25596
25993
|
if (owned.has(groupId)) {
|
|
25597
25994
|
for (const file of walkFiles(folder)) {
|
|
25598
|
-
const relative3 =
|
|
25995
|
+
const relative3 = import_node_path17.default.relative(folder, file).split(import_node_path17.default.sep).join("/");
|
|
25599
25996
|
if ([...exceptions].some(
|
|
25600
25997
|
(exception) => relative3 === exception || relative3.startsWith(`${exception}/`)
|
|
25601
25998
|
))
|
|
@@ -25604,14 +26001,14 @@ function targetMembers(ref) {
|
|
|
25604
26001
|
}
|
|
25605
26002
|
} else {
|
|
25606
26003
|
for (const relative3 of exceptions) {
|
|
25607
|
-
const file =
|
|
26004
|
+
const file = import_node_path17.default.join(folder, relative3);
|
|
25608
26005
|
if (isDirectory(file)) {
|
|
25609
26006
|
for (const inner of walkFiles(file))
|
|
25610
26007
|
addSynchronized(
|
|
25611
26008
|
folder,
|
|
25612
|
-
|
|
26009
|
+
import_node_path17.default.relative(folder, inner).split(import_node_path17.default.sep).join("/")
|
|
25613
26010
|
);
|
|
25614
|
-
} else if (
|
|
26011
|
+
} else if (import_node_fs16.default.existsSync(file)) addSynchronized(folder, relative3);
|
|
25615
26012
|
}
|
|
25616
26013
|
}
|
|
25617
26014
|
}
|
|
@@ -25624,8 +26021,8 @@ function targetMembers(ref) {
|
|
|
25624
26021
|
function commonAncestor(dirs) {
|
|
25625
26022
|
let common = dirs[0];
|
|
25626
26023
|
for (const dir of dirs) {
|
|
25627
|
-
while (common !==
|
|
25628
|
-
common =
|
|
26024
|
+
while (common !== import_node_path17.default.dirname(common) && import_node_path17.default.relative(common, dir).startsWith(".."))
|
|
26025
|
+
common = import_node_path17.default.dirname(common);
|
|
25629
26026
|
}
|
|
25630
26027
|
return common;
|
|
25631
26028
|
}
|
|
@@ -25634,8 +26031,8 @@ function workspaceProjects(xcodeprojOrWorkspace) {
|
|
|
25634
26031
|
const projects2 = [];
|
|
25635
26032
|
const projectAt = /* @__PURE__ */ new Map();
|
|
25636
26033
|
const addProject = (xcodeproj) => {
|
|
25637
|
-
const key =
|
|
25638
|
-
if (projectAt.has(key) || key.split(
|
|
26034
|
+
const key = import_node_path17.default.resolve(xcodeproj);
|
|
26035
|
+
if (projectAt.has(key) || key.split(import_node_path17.default.sep).includes("Pods")) return;
|
|
25639
26036
|
if (!xcodeProjectFile(key)) return;
|
|
25640
26037
|
const project = loadProject(key);
|
|
25641
26038
|
projectAt.set(key, project);
|
|
@@ -25652,7 +26049,7 @@ function workspaceProjects(xcodeprojOrWorkspace) {
|
|
|
25652
26049
|
for (const reference of listed)
|
|
25653
26050
|
if (reference.endsWith(".xcodeproj")) addProject(reference);
|
|
25654
26051
|
if (projects2.length === 0) {
|
|
25655
|
-
throw new Error(`${
|
|
26052
|
+
throw new Error(`${import_node_path17.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
|
|
25656
26053
|
}
|
|
25657
26054
|
return { listed, projects: projects2, projectAt };
|
|
25658
26055
|
}
|
|
@@ -25676,7 +26073,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
25676
26073
|
const allTargets = projects2.flatMap(nativeTargets);
|
|
25677
26074
|
const appTargets = allTargets.filter((ref) => ref.target.productType === APPLICATION);
|
|
25678
26075
|
const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
|
|
25679
|
-
const container =
|
|
26076
|
+
const container = import_node_path17.default.basename(xcodeprojOrWorkspace);
|
|
25680
26077
|
const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
|
|
25681
26078
|
if (named.length !== 1) {
|
|
25682
26079
|
throw new Error(
|
|
@@ -25688,14 +26085,14 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
25688
26085
|
for (const ref of allTargets) {
|
|
25689
26086
|
const product = ref.project.object(str(ref.target.productReference));
|
|
25690
26087
|
const file = str(product?.path);
|
|
25691
|
-
if (file && !byProduct.has(
|
|
25692
|
-
byProduct.set(
|
|
26088
|
+
if (file && !byProduct.has(import_node_path17.default.basename(file)))
|
|
26089
|
+
byProduct.set(import_node_path17.default.basename(file), ref);
|
|
25693
26090
|
}
|
|
25694
26091
|
const proxied = (project, proxyId) => {
|
|
25695
26092
|
const proxy = project.object(proxyId);
|
|
25696
26093
|
if (proxy?.isa !== "PBXContainerItemProxy") return void 0;
|
|
25697
26094
|
const portal = str(proxy.containerPortal);
|
|
25698
|
-
const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(
|
|
26095
|
+
const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path17.default.resolve(project.resolvePath(portal ?? "") ?? ""));
|
|
25699
26096
|
const remote = str(proxy.remoteGlobalIDString);
|
|
25700
26097
|
if (!owner || !remote) return void 0;
|
|
25701
26098
|
return nativeTargets(owner).find(
|
|
@@ -25716,7 +26113,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
25716
26113
|
if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
|
|
25717
26114
|
for (const buildFileId of list(phase.files)) {
|
|
25718
26115
|
const file = project.object(str(project.object(buildFileId)?.fileRef));
|
|
25719
|
-
const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(
|
|
26116
|
+
const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path17.default.basename(str(file.path) ?? "")) : void 0;
|
|
25720
26117
|
if (resolved) found.push(resolved);
|
|
25721
26118
|
}
|
|
25722
26119
|
}
|
|
@@ -25737,7 +26134,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
25737
26134
|
const name2 = str(ref.target.name) ?? ref.id;
|
|
25738
26135
|
const { get: settings2, keys } = targetSettings(ref, {
|
|
25739
26136
|
TARGET_NAME: name2,
|
|
25740
|
-
PROJECT_NAME:
|
|
26137
|
+
PROJECT_NAME: import_node_path17.default.basename(ref.project.xcodeproj, ".xcodeproj"),
|
|
25741
26138
|
SRCROOT: ref.project.projectDir,
|
|
25742
26139
|
SOURCE_ROOT: ref.project.projectDir,
|
|
25743
26140
|
PROJECT_DIR: ref.project.projectDir,
|
|
@@ -25768,8 +26165,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
25768
26165
|
}
|
|
25769
26166
|
return value;
|
|
25770
26167
|
};
|
|
25771
|
-
const infoPlistFile = settings("INFOPLIST_FILE") ?
|
|
25772
|
-
const sourceInfo = infoPlistFile ? import_plist3.default.parse(
|
|
26168
|
+
const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path17.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
|
|
26169
|
+
const sourceInfo = infoPlistFile ? import_plist3.default.parse(import_node_fs16.default.readFileSync(infoPlistFile, "utf8")) : {};
|
|
25773
26170
|
if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
|
|
25774
26171
|
throw new Error(`${module2.name} Info.plist must contain a dictionary`);
|
|
25775
26172
|
}
|
|
@@ -25787,12 +26184,12 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
25787
26184
|
};
|
|
25788
26185
|
}
|
|
25789
26186
|
const localPackageDirs = [
|
|
25790
|
-
...listed.filter((reference) =>
|
|
26187
|
+
...listed.filter((reference) => import_node_fs16.default.existsSync(import_node_path17.default.join(reference, "Package.swift"))),
|
|
25791
26188
|
...projects2.flatMap(
|
|
25792
26189
|
(project) => Object.entries(project.objects).flatMap(([id, entry]) => {
|
|
25793
26190
|
if (!isDict(entry)) return [];
|
|
25794
|
-
const candidate = entry.isa === "XCLocalSwiftPackageReference" ?
|
|
25795
|
-
return candidate &&
|
|
26191
|
+
const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path17.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
|
|
26192
|
+
return candidate && import_node_fs16.default.existsSync(import_node_path17.default.join(candidate, "Package.swift")) ? [candidate] : [];
|
|
25796
26193
|
})
|
|
25797
26194
|
)
|
|
25798
26195
|
];
|
|
@@ -25816,7 +26213,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
25816
26213
|
product,
|
|
25817
26214
|
source: reference?.isa === "XCRemoteSwiftPackageReference" ? { kind: "remote", url: str(reference.repositoryURL) ?? "" } : reference?.isa === "XCLocalSwiftPackageReference" ? {
|
|
25818
26215
|
kind: "local",
|
|
25819
|
-
dir:
|
|
26216
|
+
dir: import_node_path17.default.resolve(
|
|
25820
26217
|
project.projectDir,
|
|
25821
26218
|
str(reference.relativePath) ?? ""
|
|
25822
26219
|
)
|
|
@@ -25838,8 +26235,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
25838
26235
|
}
|
|
25839
26236
|
}
|
|
25840
26237
|
}
|
|
25841
|
-
const resolvedFile =
|
|
25842
|
-
workspace ??
|
|
26238
|
+
const resolvedFile = import_node_path17.default.join(
|
|
26239
|
+
workspace ?? import_node_path17.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
|
|
25843
26240
|
"xcshareddata",
|
|
25844
26241
|
"swiftpm",
|
|
25845
26242
|
"Package.resolved"
|
|
@@ -25849,13 +26246,13 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
25849
26246
|
...module2,
|
|
25850
26247
|
rootDir: commonAncestor(
|
|
25851
26248
|
[
|
|
25852
|
-
workspace ?
|
|
26249
|
+
workspace ? import_node_path17.default.dirname(workspace) : app.project.projectDir,
|
|
25853
26250
|
...used.map((project) => project.projectDir),
|
|
25854
26251
|
...localPackageDirs,
|
|
25855
26252
|
...linkedProducts.flatMap(
|
|
25856
|
-
({ source }) => source.kind === "local" &&
|
|
26253
|
+
({ source }) => source.kind === "local" && import_node_fs16.default.existsSync(source.dir) ? [source.dir] : []
|
|
25857
26254
|
)
|
|
25858
|
-
].map((dir) =>
|
|
26255
|
+
].map((dir) => import_node_fs16.default.realpathSync(dir))
|
|
25859
26256
|
),
|
|
25860
26257
|
projectFiles: [...new Set(used.map((project) => project.projectFile))].sort(),
|
|
25861
26258
|
infoPlist: import_plist3.default.build(info),
|
|
@@ -25863,19 +26260,19 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
25863
26260
|
frameworks,
|
|
25864
26261
|
linkedProducts,
|
|
25865
26262
|
localPackageDirs: [
|
|
25866
|
-
...new Set(localPackageDirs.map((dir) =>
|
|
26263
|
+
...new Set(localPackageDirs.map((dir) => import_node_fs16.default.realpathSync(dir)))
|
|
25867
26264
|
].sort(),
|
|
25868
26265
|
binaryFrameworks: [...binaryFrameworks].sort(),
|
|
25869
|
-
packageResolved:
|
|
26266
|
+
packageResolved: import_node_fs16.default.existsSync(resolvedFile) ? resolvedFile : null,
|
|
25870
26267
|
appTargets: appTargetNames
|
|
25871
26268
|
};
|
|
25872
26269
|
}
|
|
25873
|
-
var
|
|
26270
|
+
var import_node_fs16, import_node_path17, import_plist3, isDict, str, list, APPLICATION, MODULE_PRODUCTS, NEVER_MEMBER, BUNDLE_DIR, CONDITIONS, isDirectory, loaded, targetRefs;
|
|
25874
26271
|
var init_xcode_project = __esm({
|
|
25875
26272
|
"src/xcode-project.ts"() {
|
|
25876
26273
|
"use strict";
|
|
25877
|
-
|
|
25878
|
-
|
|
26274
|
+
import_node_fs16 = __toESM(require("node:fs"), 1);
|
|
26275
|
+
import_node_path17 = __toESM(require("node:path"), 1);
|
|
25879
26276
|
import_plist3 = __toESM(require_plist(), 1);
|
|
25880
26277
|
init_xcode_json_project();
|
|
25881
26278
|
isDict = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -25895,7 +26292,7 @@ var init_xcode_project = __esm({
|
|
|
25895
26292
|
arch: "arm64",
|
|
25896
26293
|
variant: "normal"
|
|
25897
26294
|
};
|
|
25898
|
-
isDirectory = (dir) =>
|
|
26295
|
+
isDirectory = (dir) => import_node_fs16.default.existsSync(dir) && import_node_fs16.default.statSync(dir).isDirectory();
|
|
25899
26296
|
loaded = /* @__PURE__ */ new Map();
|
|
25900
26297
|
targetRefs = /* @__PURE__ */ new WeakMap();
|
|
25901
26298
|
}
|
|
@@ -25903,17 +26300,17 @@ var init_xcode_project = __esm({
|
|
|
25903
26300
|
|
|
25904
26301
|
// src/swift-host.ts
|
|
25905
26302
|
function swiftPackageId(packagePath) {
|
|
25906
|
-
return
|
|
26303
|
+
return import_node_path18.default.basename(packagePath).replace(/[^A-Za-z0-9_]/g, "_").replace(/^(\d)/, "_$1");
|
|
25907
26304
|
}
|
|
25908
26305
|
function nativeSourceDescriptor(packagePath) {
|
|
25909
|
-
packagePath =
|
|
25910
|
-
const file =
|
|
25911
|
-
if (!
|
|
26306
|
+
packagePath = import_node_fs17.default.realpathSync(packagePath);
|
|
26307
|
+
const file = import_node_path18.default.join(packagePath, NATIVE_DESCRIPTOR);
|
|
26308
|
+
if (!import_node_fs17.default.existsSync(file)) return null;
|
|
25912
26309
|
const value = JSON.parse(
|
|
25913
26310
|
readPackageFile(packagePath, file, MAX_SWIFT_COMPILE_SOURCE_BYTES).toString("utf8")
|
|
25914
26311
|
);
|
|
25915
26312
|
const invalid = () => new Error(`${file}: invalid One native source descriptor; run one typegen`);
|
|
25916
|
-
if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !
|
|
26313
|
+
if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !import_node_fs17.default.existsSync(import_node_path18.default.join(packagePath, NATIVE_GLUE))) {
|
|
25917
26314
|
throw invalid();
|
|
25918
26315
|
}
|
|
25919
26316
|
if (!isSwiftNativeModules(value) || value.packageId !== swiftPackageId(packagePath)) {
|
|
@@ -25922,7 +26319,7 @@ function nativeSourceDescriptor(packagePath) {
|
|
|
25922
26319
|
return value;
|
|
25923
26320
|
}
|
|
25924
26321
|
function projectFor(packagePath, hosted) {
|
|
25925
|
-
packagePath =
|
|
26322
|
+
packagePath = import_node_fs17.default.realpathSync(packagePath);
|
|
25926
26323
|
const existing = projects.get(packagePath);
|
|
25927
26324
|
if (existing) {
|
|
25928
26325
|
if (hosted && !existing.hosted) {
|
|
@@ -25943,14 +26340,14 @@ function projectFor(packagePath, hosted) {
|
|
|
25943
26340
|
return created;
|
|
25944
26341
|
}
|
|
25945
26342
|
function swiftPackages(entry, app) {
|
|
25946
|
-
const stamp = (file) => file &&
|
|
26343
|
+
const stamp = (file) => file && import_node_fs17.default.existsSync(file) ? import_node_fs17.default.statSync(file).mtimeMs : 0;
|
|
25947
26344
|
const key = JSON.stringify([
|
|
25948
26345
|
app.linkedProducts,
|
|
25949
26346
|
app.packageResolved,
|
|
25950
26347
|
stamp(app.packageResolved),
|
|
25951
|
-
app.localPackageDirs.map((dir) => stamp(
|
|
26348
|
+
app.localPackageDirs.map((dir) => stamp(import_node_path18.default.join(dir, "Package.swift"))),
|
|
25952
26349
|
app.linkedProducts.map(
|
|
25953
|
-
({ source }) => source.kind === "local" ? stamp(
|
|
26350
|
+
({ source }) => source.kind === "local" ? stamp(import_node_path18.default.join(source.dir, "Package.swift")) : 0
|
|
25954
26351
|
)
|
|
25955
26352
|
]);
|
|
25956
26353
|
if (entry.packages?.key !== key) {
|
|
@@ -25969,8 +26366,8 @@ function swiftPackages(entry, app) {
|
|
|
25969
26366
|
}
|
|
25970
26367
|
function xcodeInputKey(layout, file, relative3) {
|
|
25971
26368
|
const owner = layout.targetDirs.get(file);
|
|
25972
|
-
if (owner) return
|
|
25973
|
-
return relative3.startsWith(CHECKOUTS_PREFIX) ?
|
|
26369
|
+
if (owner) return import_node_path18.default.posix.join(owner, relative3);
|
|
26370
|
+
return relative3.startsWith(CHECKOUTS_PREFIX) ? import_node_path18.default.posix.join(XCODE_PACKAGES_DIR, relative3.slice(CHECKOUTS_PREFIX.length)) : relative3;
|
|
25974
26371
|
}
|
|
25975
26372
|
function xcodeLayout(root) {
|
|
25976
26373
|
const registered = xcodeProjects.get(root);
|
|
@@ -25981,7 +26378,7 @@ function xcodeLayout(root) {
|
|
|
25981
26378
|
const targetDirs = new Map(app.sources.map((file) => [file, XCODE_APP_DIR]));
|
|
25982
26379
|
const targets = [];
|
|
25983
26380
|
for (const framework of app.frameworks) {
|
|
25984
|
-
const dir =
|
|
26381
|
+
const dir = import_node_path18.default.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName);
|
|
25985
26382
|
for (const file of framework.sources) {
|
|
25986
26383
|
if (targetDirs.has(file)) continue;
|
|
25987
26384
|
targetDirs.set(file, dir);
|
|
@@ -25999,19 +26396,19 @@ function xcodeLayout(root) {
|
|
|
25999
26396
|
}
|
|
26000
26397
|
const packages = swiftPackages(registered, app);
|
|
26001
26398
|
for (const target of packages.targets) {
|
|
26002
|
-
const relative3 =
|
|
26003
|
-
target.remote ?
|
|
26399
|
+
const relative3 = import_node_path18.default.relative(
|
|
26400
|
+
target.remote ? import_node_path18.default.join(root, REMOTE_CHECKOUTS) : root,
|
|
26004
26401
|
target.dir
|
|
26005
26402
|
);
|
|
26006
|
-
if (relative3 === ".." || relative3.startsWith(`..${
|
|
26403
|
+
if (relative3 === ".." || relative3.startsWith(`..${import_node_path18.default.sep}`) || import_node_path18.default.isAbsolute(relative3))
|
|
26007
26404
|
throw new Error(`swift input escapes the selected package: ${target.dir}`);
|
|
26008
|
-
const posix2 = relative3.split(
|
|
26405
|
+
const posix2 = relative3.split(import_node_path18.default.sep).join(import_node_path18.default.posix.sep);
|
|
26009
26406
|
targets.push({
|
|
26010
26407
|
...target,
|
|
26011
|
-
path: target.remote ?
|
|
26408
|
+
path: target.remote ? import_node_path18.default.posix.join(XCODE_PACKAGES_DIR, posix2) : posix2,
|
|
26012
26409
|
exclude: []
|
|
26013
26410
|
});
|
|
26014
|
-
if (!target.remote) files.add(
|
|
26411
|
+
if (!target.remote) files.add(import_node_path18.default.join(target.packageDir, "Package.swift"));
|
|
26015
26412
|
for (const file of target.files) files.add(file);
|
|
26016
26413
|
}
|
|
26017
26414
|
for (const target of targets) {
|
|
@@ -26040,25 +26437,25 @@ function xcodeManifest(layout) {
|
|
|
26040
26437
|
].join("\n");
|
|
26041
26438
|
}
|
|
26042
26439
|
function packageFiles(root) {
|
|
26043
|
-
const canonicalRoot =
|
|
26440
|
+
const canonicalRoot = import_node_fs17.default.realpathSync(root);
|
|
26044
26441
|
const xcode = xcodeLayout(canonicalRoot);
|
|
26045
26442
|
return xcode ? xcode.files : sourceTreeFiles(canonicalRoot, canonicalRoot);
|
|
26046
26443
|
}
|
|
26047
26444
|
function sourceTreeFiles(dir, canonicalRoot) {
|
|
26048
26445
|
const found = [];
|
|
26049
26446
|
const walk2 = (dir2) => {
|
|
26050
|
-
for (const entry of
|
|
26447
|
+
for (const entry of import_node_fs17.default.readdirSync(dir2, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
|
|
26051
26448
|
if (entry.name.startsWith(".") && entry.name !== NATIVE_DESCRIPTOR && entry.name !== NATIVE_GLUE || SKIP_SOURCE_DIRS.has(entry.name))
|
|
26052
26449
|
continue;
|
|
26053
|
-
const full =
|
|
26450
|
+
const full = import_node_path18.default.join(dir2, entry.name);
|
|
26054
26451
|
if (entry.isSymbolicLink()) throw new Error(`swift input is a symlink: ${full}`);
|
|
26055
|
-
const real =
|
|
26056
|
-
const relative3 =
|
|
26057
|
-
if (relative3.startsWith(`..${
|
|
26452
|
+
const real = import_node_fs17.default.realpathSync(full);
|
|
26453
|
+
const relative3 = import_node_path18.default.relative(canonicalRoot, real);
|
|
26454
|
+
if (relative3.startsWith(`..${import_node_path18.default.sep}`) || relative3 === ".." || import_node_path18.default.isAbsolute(relative3)) {
|
|
26058
26455
|
throw new Error(`swift input escapes the selected package: ${full}`);
|
|
26059
26456
|
}
|
|
26060
26457
|
if (entry.isDirectory()) {
|
|
26061
|
-
if (
|
|
26458
|
+
if (import_node_fs17.default.existsSync(import_node_path18.default.join(full, "Package.swift"))) continue;
|
|
26062
26459
|
walk2(full);
|
|
26063
26460
|
} else if (entry.isFile()) {
|
|
26064
26461
|
found.push(full);
|
|
@@ -26066,29 +26463,29 @@ function sourceTreeFiles(dir, canonicalRoot) {
|
|
|
26066
26463
|
}
|
|
26067
26464
|
}
|
|
26068
26465
|
};
|
|
26069
|
-
if (
|
|
26466
|
+
if (import_node_fs17.default.existsSync(dir)) walk2(import_node_fs17.default.realpathSync(dir));
|
|
26070
26467
|
return found;
|
|
26071
26468
|
}
|
|
26072
26469
|
function readPackageFile(root, file, maxBytes) {
|
|
26073
|
-
const canonicalRoot =
|
|
26074
|
-
const relative3 =
|
|
26075
|
-
if (relative3 === ".." || relative3.startsWith(`..${
|
|
26470
|
+
const canonicalRoot = import_node_fs17.default.realpathSync(root);
|
|
26471
|
+
const relative3 = import_node_path18.default.relative(canonicalRoot, import_node_fs17.default.realpathSync(file));
|
|
26472
|
+
if (relative3 === ".." || relative3.startsWith(`..${import_node_path18.default.sep}`) || import_node_path18.default.isAbsolute(relative3)) {
|
|
26076
26473
|
throw new Error(`swift input escapes the selected package: ${file}`);
|
|
26077
26474
|
}
|
|
26078
|
-
let ancestor =
|
|
26475
|
+
let ancestor = import_node_path18.default.resolve(file);
|
|
26079
26476
|
while (ancestor !== canonicalRoot) {
|
|
26080
|
-
if (
|
|
26477
|
+
if (import_node_fs17.default.lstatSync(ancestor).isSymbolicLink()) {
|
|
26081
26478
|
throw new Error(`swift input is a symlink: ${ancestor}`);
|
|
26082
26479
|
}
|
|
26083
|
-
const parent =
|
|
26480
|
+
const parent = import_node_path18.default.dirname(ancestor);
|
|
26084
26481
|
if (parent === ancestor)
|
|
26085
26482
|
throw new Error(`swift input escapes the selected package: ${file}`);
|
|
26086
26483
|
ancestor = parent;
|
|
26087
26484
|
}
|
|
26088
|
-
const expected =
|
|
26089
|
-
const fd =
|
|
26485
|
+
const expected = import_node_fs17.default.statSync(file);
|
|
26486
|
+
const fd = import_node_fs17.default.openSync(file, import_node_fs17.default.constants.O_RDONLY | import_node_fs17.default.constants.O_NOFOLLOW);
|
|
26090
26487
|
try {
|
|
26091
|
-
const stat2 =
|
|
26488
|
+
const stat2 = import_node_fs17.default.fstatSync(fd);
|
|
26092
26489
|
if (stat2.dev !== expected.dev || stat2.ino !== expected.ino) {
|
|
26093
26490
|
throw new Error(`swift input changed while opening: ${file}`);
|
|
26094
26491
|
}
|
|
@@ -26098,16 +26495,16 @@ function readPackageFile(root, file, maxBytes) {
|
|
|
26098
26495
|
const bytes = Buffer.alloc(stat2.size + 1);
|
|
26099
26496
|
let offset = 0;
|
|
26100
26497
|
while (offset < bytes.length) {
|
|
26101
|
-
const count =
|
|
26498
|
+
const count = import_node_fs17.default.readSync(fd, bytes, offset, bytes.length - offset, null);
|
|
26102
26499
|
if (count === 0) break;
|
|
26103
26500
|
offset += count;
|
|
26104
26501
|
}
|
|
26105
|
-
if (offset !== stat2.size ||
|
|
26502
|
+
if (offset !== stat2.size || import_node_fs17.default.fstatSync(fd).size !== stat2.size) {
|
|
26106
26503
|
throw new Error(`swift input changed while reading: ${file}`);
|
|
26107
26504
|
}
|
|
26108
26505
|
return bytes.subarray(0, offset);
|
|
26109
26506
|
} finally {
|
|
26110
|
-
|
|
26507
|
+
import_node_fs17.default.closeSync(fd);
|
|
26111
26508
|
}
|
|
26112
26509
|
}
|
|
26113
26510
|
function sourceFiles(root) {
|
|
@@ -26115,14 +26512,14 @@ function sourceFiles(root) {
|
|
|
26115
26512
|
}
|
|
26116
26513
|
function resourceCandidateFiles(root) {
|
|
26117
26514
|
return packageFiles(root).filter(
|
|
26118
|
-
(file) => !file.endsWith(".swift") && !["project.pbxproj", "project.xcproj"].includes(
|
|
26515
|
+
(file) => !file.endsWith(".swift") && !["project.pbxproj", "project.xcproj"].includes(import_node_path18.default.basename(file))
|
|
26119
26516
|
);
|
|
26120
26517
|
}
|
|
26121
26518
|
function buildSwiftResourceTable(project, baseUrl) {
|
|
26122
26519
|
const limits = inputLimits(Boolean(project.hosted));
|
|
26123
26520
|
const absolute = resourceCandidateFiles(project.packagePath);
|
|
26124
26521
|
const relative3 = absolute.map(
|
|
26125
|
-
(file) =>
|
|
26522
|
+
(file) => import_node_path18.default.relative(project.packagePath, file).split(import_node_path18.default.sep).join(import_node_path18.default.posix.sep)
|
|
26126
26523
|
);
|
|
26127
26524
|
const byRelative = new Map(absolute.map((file, index) => [relative3[index], file]));
|
|
26128
26525
|
const readContents = (candidate) => {
|
|
@@ -26144,16 +26541,16 @@ function buildSwiftResourceTable(project, baseUrl) {
|
|
|
26144
26541
|
for (const { name: name2, file, scale } of found) {
|
|
26145
26542
|
const disk = byRelative.get(file);
|
|
26146
26543
|
if (!disk) continue;
|
|
26147
|
-
if (Object.keys(images).length >= limits.images || imageBytes +
|
|
26544
|
+
if (Object.keys(images).length >= limits.images || imageBytes + import_node_fs17.default.statSync(disk).size > limits.imageTotalBytes) {
|
|
26148
26545
|
throw new Error("swift image pack exceeds the compile service caps");
|
|
26149
26546
|
}
|
|
26150
26547
|
const bytes = readPackageFile(project.packagePath, disk, limits.imageBytes);
|
|
26151
26548
|
imageBytes += bytes.length;
|
|
26152
|
-
const hash = (0,
|
|
26153
|
-
const ext =
|
|
26549
|
+
const hash = (0, import_node_crypto7.createHash)("sha256").update(bytes).digest("hex").slice(0, 16);
|
|
26550
|
+
const ext = import_node_path18.default.posix.extname(file).toLowerCase();
|
|
26154
26551
|
table[name2] = { uri: `${baseUrl}${RESOURCE_PATH}${hash}${ext}`, scale };
|
|
26155
26552
|
images[name2] = {
|
|
26156
|
-
file:
|
|
26553
|
+
file: import_node_path18.default.posix.basename(file),
|
|
26157
26554
|
data: bytes.toString("base64")
|
|
26158
26555
|
};
|
|
26159
26556
|
watched.push(file);
|
|
@@ -26177,10 +26574,10 @@ function buildSwiftResourceTable(project, baseUrl) {
|
|
|
26177
26574
|
return { table, images, colors, symbols, watched };
|
|
26178
26575
|
}
|
|
26179
26576
|
function buildSwiftBundleFiles(packagePath, hosted) {
|
|
26180
|
-
packagePath =
|
|
26577
|
+
packagePath = import_node_fs17.default.realpathSync(packagePath);
|
|
26181
26578
|
const limits = inputLimits(hosted);
|
|
26182
26579
|
const relative3 = resourceCandidateFiles(packagePath).map(
|
|
26183
|
-
(file) =>
|
|
26580
|
+
(file) => import_node_path18.default.relative(packagePath, file).split(import_node_path18.default.sep).join(import_node_path18.default.posix.sep)
|
|
26184
26581
|
);
|
|
26185
26582
|
const files = {};
|
|
26186
26583
|
const watched = [];
|
|
@@ -26194,13 +26591,13 @@ function buildSwiftBundleFiles(packagePath, hosted) {
|
|
|
26194
26591
|
total += bytes.length;
|
|
26195
26592
|
if (xcode.app.infoPlistFile)
|
|
26196
26593
|
watched.push(
|
|
26197
|
-
|
|
26594
|
+
import_node_path18.default.relative(packagePath, xcode.app.infoPlistFile).split(import_node_path18.default.sep).join("/")
|
|
26198
26595
|
);
|
|
26199
26596
|
}
|
|
26200
26597
|
for (const { base, file } of enumerateBundleJson(relative3)) {
|
|
26201
26598
|
watched.push(file);
|
|
26202
|
-
const disk =
|
|
26203
|
-
if (Object.keys(files).length >= limits.resources || total +
|
|
26599
|
+
const disk = import_node_path18.default.join(packagePath, ...file.split("/"));
|
|
26600
|
+
if (Object.keys(files).length >= limits.resources || total + import_node_fs17.default.statSync(disk).size > limits.resourceTotalBytes) {
|
|
26204
26601
|
throw new Error(
|
|
26205
26602
|
`swift bundle pack exceeds ${limits.resources} files / ${limits.resourceTotalBytes} bytes`
|
|
26206
26603
|
);
|
|
@@ -26215,12 +26612,12 @@ function serveSwiftResource(project, key) {
|
|
|
26215
26612
|
return project.resourceFiles.get(key) ?? project.resourcesPrevious.get(key) ?? null;
|
|
26216
26613
|
}
|
|
26217
26614
|
function linkedModuleRoots(packagePath) {
|
|
26218
|
-
packagePath =
|
|
26615
|
+
packagePath = import_node_fs17.default.realpathSync(packagePath);
|
|
26219
26616
|
let manifest;
|
|
26220
26617
|
try {
|
|
26221
26618
|
manifest = readPackageFile(
|
|
26222
26619
|
packagePath,
|
|
26223
|
-
|
|
26620
|
+
import_node_path18.default.join(packagePath, "Package.swift"),
|
|
26224
26621
|
MAX_SWIFT_COMPILE_SOURCE_BYTES
|
|
26225
26622
|
).toString("utf8");
|
|
26226
26623
|
} catch {
|
|
@@ -26229,28 +26626,28 @@ function linkedModuleRoots(packagePath) {
|
|
|
26229
26626
|
const roots = /* @__PURE__ */ new Set();
|
|
26230
26627
|
const dependency = /\.package\(\s*path:\s*"([^"]+)"\s*\)/g;
|
|
26231
26628
|
for (const match of manifest.replace(/^\s*\/\/.*$/gm, "").matchAll(dependency)) {
|
|
26232
|
-
const root =
|
|
26233
|
-
if (
|
|
26629
|
+
const root = import_node_path18.default.resolve(packagePath, match[1]);
|
|
26630
|
+
if (import_node_fs17.default.existsSync(import_node_path18.default.join(root, "Package.swift"))) roots.add(root);
|
|
26234
26631
|
}
|
|
26235
26632
|
return [...roots].sort();
|
|
26236
26633
|
}
|
|
26237
26634
|
function sourceStamp(packagePath, moduleRootOverride, hosted = false) {
|
|
26238
|
-
const hash = (0,
|
|
26635
|
+
const hash = (0, import_node_crypto7.createHash)("sha256");
|
|
26239
26636
|
hash.update(packagePath);
|
|
26240
26637
|
const projectInputs = new Set(packageFiles(packagePath));
|
|
26241
26638
|
for (const file of [...projectInputs].sort()) {
|
|
26242
|
-
hash.update(
|
|
26243
|
-
const stat2 =
|
|
26639
|
+
hash.update(import_node_path18.default.relative(packagePath, file));
|
|
26640
|
+
const stat2 = import_node_fs17.default.statSync(file);
|
|
26244
26641
|
hash.update(`${stat2.mtimeMs}/${stat2.ctimeMs}/${stat2.size}`);
|
|
26245
26642
|
}
|
|
26246
26643
|
const moduleRoot = hosted ? void 0 : moduleRootOverride ?? linkedModuleRoots(packagePath).find(
|
|
26247
|
-
(root) =>
|
|
26644
|
+
(root) => import_node_fs17.default.existsSync(import_node_path18.default.join(root, "toolchain.json"))
|
|
26248
26645
|
);
|
|
26249
26646
|
if (moduleRoot) {
|
|
26250
26647
|
hash.update(moduleRoot);
|
|
26251
26648
|
for (const relative3 of swiftModuleInputFiles(moduleRoot)) {
|
|
26252
26649
|
hash.update(relative3);
|
|
26253
|
-
hash.update(String(
|
|
26650
|
+
hash.update(String(import_node_fs17.default.statSync(import_node_path18.default.join(moduleRoot, relative3)).mtimeMs));
|
|
26254
26651
|
}
|
|
26255
26652
|
}
|
|
26256
26653
|
return hash.digest("hex").slice(0, 16);
|
|
@@ -26262,8 +26659,8 @@ function packageSources(packagePath) {
|
|
|
26262
26659
|
const xcode = xcodeLayout(packagePath);
|
|
26263
26660
|
const files = {};
|
|
26264
26661
|
for (const file of sourceFiles(packagePath)) {
|
|
26265
|
-
const relative3 =
|
|
26266
|
-
if (xcode &&
|
|
26662
|
+
const relative3 = import_node_path18.default.relative(packagePath, file).split(import_node_path18.default.sep).join(import_node_path18.default.posix.sep);
|
|
26663
|
+
if (xcode && import_node_path18.default.basename(file) === "Package.swift") continue;
|
|
26267
26664
|
files[xcode ? xcodeInputKey(xcode, file, relative3) : relative3] = readPackageFile(
|
|
26268
26665
|
packagePath,
|
|
26269
26666
|
file,
|
|
@@ -26280,7 +26677,7 @@ function packageSnapshot(project) {
|
|
|
26280
26677
|
files,
|
|
26281
26678
|
resourcePaths: swiftImplicitResourcePaths(
|
|
26282
26679
|
resourceCandidateFiles(project.packagePath).map(
|
|
26283
|
-
(file) =>
|
|
26680
|
+
(file) => import_node_path18.default.relative(project.packagePath, file).split(import_node_path18.default.sep).join(import_node_path18.default.posix.sep)
|
|
26284
26681
|
)
|
|
26285
26682
|
),
|
|
26286
26683
|
resources: buildSwiftResourceTable(project, ""),
|
|
@@ -26289,7 +26686,7 @@ function packageSnapshot(project) {
|
|
|
26289
26686
|
...native ? {
|
|
26290
26687
|
glue: readPackageFile(
|
|
26291
26688
|
project.packagePath,
|
|
26292
|
-
|
|
26689
|
+
import_node_path18.default.join(project.packagePath, NATIVE_GLUE),
|
|
26293
26690
|
MAX_SWIFT_COMPILE_SOURCE_BYTES
|
|
26294
26691
|
).toString("utf8")
|
|
26295
26692
|
} : {}
|
|
@@ -26325,7 +26722,7 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
|
|
|
26325
26722
|
package: content
|
|
26326
26723
|
};
|
|
26327
26724
|
const moduleRoot = moduleRootOverride ?? linkedModuleRoots(packagePath).find(
|
|
26328
|
-
(root) =>
|
|
26725
|
+
(root) => import_node_fs17.default.existsSync(import_node_path18.default.join(root, "toolchain.json"))
|
|
26329
26726
|
) ?? await swiftDistributionRoot();
|
|
26330
26727
|
if (!moduleRoot)
|
|
26331
26728
|
return {
|
|
@@ -26344,17 +26741,17 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
|
|
|
26344
26741
|
...targets.length > 0 ? targets : ["App"]
|
|
26345
26742
|
])
|
|
26346
26743
|
);
|
|
26347
|
-
if (missing.size > 0) throw new Error(missingModulesMessage(packagePath, missing));
|
|
26744
|
+
if (missing.size > 0) throw new Error(await missingModulesMessage(packagePath, missing));
|
|
26348
26745
|
const artifact = await compileSwiftProjectUnit(input, {
|
|
26349
26746
|
// the compile rewrites Sources/App in its root before swiftpm builds, and
|
|
26350
26747
|
// its lock orders one process only: two vites on one root (a lane's dev
|
|
26351
26748
|
// server and a capture, or two checkouts) build each other's sources. so
|
|
26352
26749
|
// each app and module checkout gets its own root, which keeps the same
|
|
26353
26750
|
// app's incremental build across restarts.
|
|
26354
|
-
buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ??
|
|
26355
|
-
|
|
26751
|
+
buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ?? import_node_path18.default.join(
|
|
26752
|
+
import_node_os7.default.tmpdir(),
|
|
26356
26753
|
"contrast-swift-build",
|
|
26357
|
-
(0,
|
|
26754
|
+
(0, import_node_crypto7.createHash)("sha256").update(`${moduleRoot}\0${import_node_path18.default.resolve(packagePath)}`).digest("hex").slice(0, 16)
|
|
26358
26755
|
),
|
|
26359
26756
|
moduleRoot,
|
|
26360
26757
|
...toolchain
|
|
@@ -26403,20 +26800,7 @@ function swiftApiGapReport(output) {
|
|
|
26403
26800
|
...other.size > 0 ? ["other errors, often caused by the ones above:", ...rows(other)] : []
|
|
26404
26801
|
].join("\n");
|
|
26405
26802
|
}
|
|
26406
|
-
function
|
|
26407
|
-
if (iosSdkFrameworks) return iosSdkFrameworks;
|
|
26408
|
-
iosSdkFrameworks = /* @__PURE__ */ new Set();
|
|
26409
|
-
if (process.platform !== "darwin") return iosSdkFrameworks;
|
|
26410
|
-
const sdk = (0, import_node_child_process9.execFileSync)("xcrun", ["--sdk", "iphonesimulator", "--show-sdk-path"], {
|
|
26411
|
-
encoding: "utf8",
|
|
26412
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
26413
|
-
}).trim();
|
|
26414
|
-
for (const entry of import_node_fs16.default.readdirSync(import_node_path17.default.join(sdk, "System/Library/Frameworks")))
|
|
26415
|
-
if (entry.endsWith(".framework"))
|
|
26416
|
-
iosSdkFrameworks.add(entry.slice(0, -".framework".length));
|
|
26417
|
-
return iosSdkFrameworks;
|
|
26418
|
-
}
|
|
26419
|
-
function missingModulesMessage(packagePath, missing) {
|
|
26803
|
+
async function missingModulesMessage(packagePath, missing) {
|
|
26420
26804
|
const layout = xcodeLayout(packagePath);
|
|
26421
26805
|
const gaps = new Map([
|
|
26422
26806
|
...(layout?.app.binaryFrameworks ?? []).map(
|
|
@@ -26428,7 +26812,7 @@ function missingModulesMessage(packagePath, missing) {
|
|
|
26428
26812
|
name2,
|
|
26429
26813
|
{ source: "the iOS SDK", reason: UNPROVIDED_PLATFORM_MODULES[name2] }
|
|
26430
26814
|
]
|
|
26431
|
-
] :
|
|
26815
|
+
] : IOS_SDK_FRAMEWORKS.has(name2) ? [
|
|
26432
26816
|
[
|
|
26433
26817
|
name2,
|
|
26434
26818
|
{ source: "the iOS SDK", reason: "a framework Peach does not provide" }
|
|
@@ -26438,12 +26822,29 @@ function missingModulesMessage(packagePath, missing) {
|
|
|
26438
26822
|
...layout?.packages.modules ?? [],
|
|
26439
26823
|
...layout?.packages.unavailable ?? []
|
|
26440
26824
|
]);
|
|
26825
|
+
const packaged = new Set(
|
|
26826
|
+
[...missing.keys()].filter(
|
|
26827
|
+
(name2) => !UNPROVIDED_PLATFORM_MODULES[name2] && !IOS_SDK_FRAMEWORKS.has(name2)
|
|
26828
|
+
)
|
|
26829
|
+
);
|
|
26830
|
+
if (packaged.size > 0)
|
|
26831
|
+
await Promise.all(
|
|
26832
|
+
(layout?.packages.binaries ?? []).map(async (binary) => {
|
|
26833
|
+
const modules = await swiftBinaryModules(binary).catch(() => []);
|
|
26834
|
+
for (const name2 of modules)
|
|
26835
|
+
if (packaged.has(name2))
|
|
26836
|
+
gaps.set(name2, {
|
|
26837
|
+
source: binary.source,
|
|
26838
|
+
reason: `${binary.target} is a binary framework`
|
|
26839
|
+
});
|
|
26840
|
+
})
|
|
26841
|
+
);
|
|
26441
26842
|
const width = Math.max(...[...missing.keys()].map((name2) => name2.length));
|
|
26442
26843
|
return [
|
|
26443
26844
|
`Peach does not provide ${missing.size} module${missing.size === 1 ? "" : "s"} this app imports:`,
|
|
26444
26845
|
...[...missing].map(([name2, files]) => {
|
|
26445
26846
|
const gap = gaps.get(name2);
|
|
26446
|
-
return ` ${name2.padEnd(width)} ${files.length} file${files.length === 1 ? "" : "s"}${gap ? `, ${gap.source.includes("://") ? `package ${gap.source}` : gap.source.startsWith("/") ? `package ${
|
|
26847
|
+
return ` ${name2.padEnd(width)} ${files.length} file${files.length === 1 ? "" : "s"}${gap ? `, ${gap.source.includes("://") ? `package ${gap.source}` : gap.source.startsWith("/") ? `package ${import_node_path18.default.relative(packagePath, gap.source) || "."}` : gap.source} (${gap.reason})` : ""}`;
|
|
26447
26848
|
})
|
|
26448
26849
|
].join("\n");
|
|
26449
26850
|
}
|
|
@@ -26451,7 +26852,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
|
|
|
26451
26852
|
const auth = hosted ? null : resolveCliAuth();
|
|
26452
26853
|
if (!hosted && (!auth || auth.kind === "github")) {
|
|
26453
26854
|
throw new Error(
|
|
26454
|
-
`compiling ${
|
|
26855
|
+
`compiling ${import_node_path18.default.basename(packagePath)} for Peach needs \`peach login\` or PEACH_API_KEY: this peachsim has no local SwiftUI module, so Contrast compiles it`
|
|
26455
26856
|
);
|
|
26456
26857
|
}
|
|
26457
26858
|
const origin = hosted?.origin ?? resolveContrastBackendOrigin(auth?.kind === "session" ? auth.origin : null);
|
|
@@ -26470,7 +26871,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
|
|
|
26470
26871
|
const bytes = sources.reduce((total2, text2) => total2 + Buffer.byteLength(text2), 0);
|
|
26471
26872
|
if (sources.length > MAX_SWIFT_COMPILE_FILES || bytes > MAX_SWIFT_COMPILE_SOURCE_BYTES) {
|
|
26472
26873
|
throw new Error(
|
|
26473
|
-
`${
|
|
26874
|
+
`${import_node_path18.default.basename(packagePath)} has ${sources.length} Swift files (${bytes} bytes), over Contrast's compile limits of ${MAX_SWIFT_COMPILE_FILES} files and ${MAX_SWIFT_COMPILE_SOURCE_BYTES} bytes; compile it on this machine with the Swift distribution instead`
|
|
26474
26875
|
);
|
|
26475
26876
|
}
|
|
26476
26877
|
const descriptor = snapshot.native;
|
|
@@ -26489,7 +26890,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
|
|
|
26489
26890
|
);
|
|
26490
26891
|
if (descriptor && address.native?.hash !== descriptor.hash) {
|
|
26491
26892
|
throw new Error(
|
|
26492
|
-
`${
|
|
26893
|
+
`${import_node_path18.default.basename(packagePath)}: Contrast compiled native contract ${address.native?.hash ?? "none"} but one typegen wrote ${descriptor.hash}; the app's One and the compile host's differ, or the compile host is older than this peachsim`
|
|
26493
26894
|
);
|
|
26494
26895
|
}
|
|
26495
26896
|
const response = await fetch(address.url, { signal });
|
|
@@ -26606,18 +27007,19 @@ function serveSwiftPackageAsset(pathname, res) {
|
|
|
26606
27007
|
res.end("swift artifact is stale");
|
|
26607
27008
|
return true;
|
|
26608
27009
|
}
|
|
26609
|
-
var
|
|
27010
|
+
var import_node_crypto7, import_node_fs17, import_node_os7, import_node_path18, ARTIFACT_PATH, RESOURCE_PATH, ICU_PATH, SKIP_SOURCE_DIRS, NATIVE_DESCRIPTOR, NATIVE_GLUE, projects, xcodeProjects, XCODE_APP_DIR, XCODE_FRAMEWORKS_DIR, XCODE_PACKAGES_DIR, CHECKOUTS_PREFIX, HOSTED_LIMITS, LOCAL_LIMITS, inputLimits, RESOURCE_CONTENT_TYPES, API_GAP_PATTERNS, UNPROVIDED_PLATFORM_MODULES, IOS_SDK_FRAMEWORKS;
|
|
26610
27011
|
var init_swift_host = __esm({
|
|
26611
27012
|
"src/swift-host.ts"() {
|
|
26612
27013
|
"use strict";
|
|
26613
|
-
|
|
26614
|
-
|
|
26615
|
-
|
|
26616
|
-
|
|
26617
|
-
import_node_path17 = __toESM(require("node:path"), 1);
|
|
27014
|
+
import_node_crypto7 = require("node:crypto");
|
|
27015
|
+
import_node_fs17 = __toESM(require("node:fs"), 1);
|
|
27016
|
+
import_node_os7 = __toESM(require("node:os"), 1);
|
|
27017
|
+
import_node_path18 = __toESM(require("node:path"), 1);
|
|
26618
27018
|
init_bundleAssets();
|
|
26619
27019
|
init_auth();
|
|
26620
27020
|
init_backend_origin();
|
|
27021
|
+
init_ios_sdk_frameworks();
|
|
27022
|
+
init_swift_binary_modules();
|
|
26621
27023
|
init_swift_compile();
|
|
26622
27024
|
init_swift_distribution();
|
|
26623
27025
|
init_swift_package();
|
|
@@ -26642,7 +27044,7 @@ var init_swift_host = __esm({
|
|
|
26642
27044
|
XCODE_APP_DIR = "__app__";
|
|
26643
27045
|
XCODE_FRAMEWORKS_DIR = "__frameworks__";
|
|
26644
27046
|
XCODE_PACKAGES_DIR = "__packages__";
|
|
26645
|
-
CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(
|
|
27047
|
+
CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(import_node_path18.default.sep).join(import_node_path18.default.posix.sep)}/`;
|
|
26646
27048
|
HOSTED_LIMITS = {
|
|
26647
27049
|
resources: MAX_SWIFT_COMPILE_RESOURCES,
|
|
26648
27050
|
resourceBytes: MAX_SWIFT_COMPILE_RESOURCE_BYTES,
|
|
@@ -26688,14 +27090,14 @@ var init_swift_host = __esm({
|
|
|
26688
27090
|
Darwin: "Peach compiles for WebAssembly, which has no Darwin; C library names come through Foundation",
|
|
26689
27091
|
MachO: "Peach compiles for WebAssembly, which has no Mach-O images"
|
|
26690
27092
|
};
|
|
26691
|
-
|
|
27093
|
+
IOS_SDK_FRAMEWORKS = new Set(ios_sdk_frameworks_default.frameworks);
|
|
26692
27094
|
}
|
|
26693
27095
|
});
|
|
26694
27096
|
|
|
26695
27097
|
// src/expo-swift-host.ts
|
|
26696
27098
|
async function collectExpoSwiftSources(appRoot) {
|
|
26697
|
-
appRoot =
|
|
26698
|
-
const appRequire = (0, import_node_module.createRequire)(
|
|
27099
|
+
appRoot = import_node_fs18.default.realpathSync(appRoot);
|
|
27100
|
+
const appRequire = (0, import_node_module.createRequire)(import_node_path19.default.join(appRoot, "package.json"));
|
|
26699
27101
|
let autolinker;
|
|
26700
27102
|
try {
|
|
26701
27103
|
autolinker = appRequire.resolve("expo-modules-autolinking/package.json");
|
|
@@ -26709,7 +27111,7 @@ async function collectExpoSwiftSources(appRoot) {
|
|
|
26709
27111
|
(command) => run3(
|
|
26710
27112
|
process.execPath,
|
|
26711
27113
|
[
|
|
26712
|
-
|
|
27114
|
+
import_node_path19.default.join(import_node_path19.default.dirname(autolinker), "bin/expo-modules-autolinking.js"),
|
|
26713
27115
|
command,
|
|
26714
27116
|
"--platform",
|
|
26715
27117
|
"apple",
|
|
@@ -26740,8 +27142,8 @@ async function collectExpoSwiftSources(appRoot) {
|
|
|
26740
27142
|
const sourceRoot = Reflect.get(entry, "path");
|
|
26741
27143
|
if (typeof sourceRoot !== "string")
|
|
26742
27144
|
throw new Error("Expo autolinking entry has no path");
|
|
26743
|
-
const canonical =
|
|
26744
|
-
if (canonical.split(
|
|
27145
|
+
const canonical = import_node_fs18.default.realpathSync(sourceRoot);
|
|
27146
|
+
if (canonical.split(import_node_path19.default.sep).includes("node_modules")) continue;
|
|
26745
27147
|
const resolution = resolutions.find(
|
|
26746
27148
|
(candidate) => candidate && typeof candidate === "object" && Reflect.get(candidate, "packageName") === Reflect.get(entry, "name")
|
|
26747
27149
|
);
|
|
@@ -26767,12 +27169,12 @@ async function collectExpoSwiftSources(appRoot) {
|
|
|
26767
27169
|
`(${className.includes(".") ? className : `${namespace}.${className}`}.self, ${name2 === null ? "nil" : JSON.stringify(name2)})`
|
|
26768
27170
|
);
|
|
26769
27171
|
}
|
|
26770
|
-
const ios =
|
|
26771
|
-
if (
|
|
27172
|
+
const ios = import_node_path19.default.join(canonical, "ios");
|
|
27173
|
+
if (import_node_fs18.default.lstatSync(ios).isSymbolicLink())
|
|
26772
27174
|
throw new Error(`Expo Swift source directory is a symlink: ${ios}`);
|
|
26773
27175
|
const walk2 = (dir) => {
|
|
26774
|
-
for (const child of
|
|
26775
|
-
const file =
|
|
27176
|
+
for (const child of import_node_fs18.default.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
27177
|
+
const file = import_node_path19.default.join(dir, child.name);
|
|
26776
27178
|
if (child.isSymbolicLink())
|
|
26777
27179
|
throw new Error(`Expo Swift source is a symlink: ${file}`);
|
|
26778
27180
|
if (child.isDirectory()) {
|
|
@@ -26780,13 +27182,13 @@ async function collectExpoSwiftSources(appRoot) {
|
|
|
26780
27182
|
continue;
|
|
26781
27183
|
}
|
|
26782
27184
|
if (!child.name.endsWith(".swift")) continue;
|
|
26783
|
-
const size =
|
|
27185
|
+
const size = import_node_fs18.default.statSync(file).size;
|
|
26784
27186
|
bytes += size;
|
|
26785
27187
|
fileCount++;
|
|
26786
27188
|
if (fileCount > MAX_SWIFT_COMPILE_FILES - 2 || bytes > MAX_SWIFT_COMPILE_SOURCE_BYTES)
|
|
26787
27189
|
throw new Error("Expo Swift sources exceed compile service caps");
|
|
26788
|
-
files[`Sources/${namespace}/${
|
|
26789
|
-
${
|
|
27190
|
+
files[`Sources/${namespace}/${import_node_path19.default.relative(ios, file).split(import_node_path19.default.sep).join("/")}`] = `#sourceLocation(file: ${JSON.stringify(file)}, line: 1)
|
|
27191
|
+
${import_node_fs18.default.readFileSync(file, "utf8")}`;
|
|
26790
27192
|
}
|
|
26791
27193
|
};
|
|
26792
27194
|
walk2(ios);
|
|
@@ -26869,7 +27271,7 @@ async function handleExpoSwiftRequest(req, res) {
|
|
|
26869
27271
|
return true;
|
|
26870
27272
|
}
|
|
26871
27273
|
const root = url.searchParams.get("root");
|
|
26872
|
-
if (!root || !
|
|
27274
|
+
if (!root || !import_node_path19.default.isAbsolute(root)) {
|
|
26873
27275
|
res.writeHead(400);
|
|
26874
27276
|
res.end("missing absolute app root");
|
|
26875
27277
|
return true;
|
|
@@ -26886,7 +27288,7 @@ async function handleExpoSwiftRequest(req, res) {
|
|
|
26886
27288
|
modules: [],
|
|
26887
27289
|
failures: []
|
|
26888
27290
|
};
|
|
26889
|
-
const key = (0,
|
|
27291
|
+
const key = (0, import_node_crypto8.createHash)("sha256").update(import_node_fs18.default.realpathSync(root)).digest("hex");
|
|
26890
27292
|
const host2 = req.headers.host;
|
|
26891
27293
|
if (!host2) throw new Error("Expo Swift request has no host");
|
|
26892
27294
|
const base = `http://${host2}`;
|
|
@@ -26900,8 +27302,8 @@ async function handleExpoSwiftRequest(req, res) {
|
|
|
26900
27302
|
continue;
|
|
26901
27303
|
}
|
|
26902
27304
|
try {
|
|
26903
|
-
const packagePath =
|
|
26904
|
-
|
|
27305
|
+
const packagePath = import_node_path19.default.join(
|
|
27306
|
+
import_node_os8.default.tmpdir(),
|
|
26905
27307
|
"peach-expo-swift",
|
|
26906
27308
|
key,
|
|
26907
27309
|
unit.namespace
|
|
@@ -26910,7 +27312,7 @@ async function handleExpoSwiftRequest(req, res) {
|
|
|
26910
27312
|
packagePath,
|
|
26911
27313
|
new Map(
|
|
26912
27314
|
Object.entries(unit.files).map(([name2, source]) => [
|
|
26913
|
-
|
|
27315
|
+
import_node_path19.default.join(packagePath, name2),
|
|
26914
27316
|
source
|
|
26915
27317
|
])
|
|
26916
27318
|
)
|
|
@@ -26961,8 +27363,8 @@ async function handleExpoSwiftRequest(req, res) {
|
|
|
26961
27363
|
import PackageDescription
|
|
26962
27364
|
let package = Package(name: "PeachExpo", targets: [${targets.map((name2) => `.target(name: ${JSON.stringify(name2)}, path: ${JSON.stringify(`Sources/${name2}`)})`).join(", ")}, .executableTarget(name: "PeachExpoApp", path: "Sources/PeachExpoApp")])
|
|
26963
27365
|
`;
|
|
26964
|
-
const packagePath =
|
|
26965
|
-
|
|
27366
|
+
const packagePath = import_node_path19.default.join(
|
|
27367
|
+
import_node_os8.default.tmpdir(),
|
|
26966
27368
|
"peach-expo-swift",
|
|
26967
27369
|
key,
|
|
26968
27370
|
"linked-app"
|
|
@@ -26971,7 +27373,7 @@ let package = Package(name: "PeachExpo", targets: [${targets.map((name2) => `.ta
|
|
|
26971
27373
|
packagePath,
|
|
26972
27374
|
new Map(
|
|
26973
27375
|
Object.entries(files).map(([name2, source]) => [
|
|
26974
|
-
|
|
27376
|
+
import_node_path19.default.join(packagePath, name2),
|
|
26975
27377
|
source
|
|
26976
27378
|
])
|
|
26977
27379
|
)
|
|
@@ -27007,16 +27409,16 @@ let package = Package(name: "PeachExpo", targets: [${targets.map((name2) => `.ta
|
|
|
27007
27409
|
}
|
|
27008
27410
|
return true;
|
|
27009
27411
|
}
|
|
27010
|
-
var
|
|
27412
|
+
var import_node_child_process9, import_node_crypto8, import_node_fs18, import_node_module, import_node_os8, import_node_path19, import_node_util3, run3, scriptEnv, EXPO_SWIFT_ROUTE, EXPO_SWIFT_ENTRY, compiling, failedCompilations;
|
|
27011
27413
|
var init_expo_swift_host = __esm({
|
|
27012
27414
|
"src/expo-swift-host.ts"() {
|
|
27013
27415
|
"use strict";
|
|
27014
|
-
|
|
27015
|
-
|
|
27016
|
-
|
|
27416
|
+
import_node_child_process9 = require("node:child_process");
|
|
27417
|
+
import_node_crypto8 = require("node:crypto");
|
|
27418
|
+
import_node_fs18 = __toESM(require("node:fs"), 1);
|
|
27017
27419
|
import_node_module = require("node:module");
|
|
27018
|
-
|
|
27019
|
-
|
|
27420
|
+
import_node_os8 = __toESM(require("node:os"), 1);
|
|
27421
|
+
import_node_path19 = __toESM(require("node:path"), 1);
|
|
27020
27422
|
import_node_util3 = require("node:util");
|
|
27021
27423
|
init_internal_child();
|
|
27022
27424
|
init_backend_origin();
|
|
@@ -27024,7 +27426,7 @@ var init_expo_swift_host = __esm({
|
|
|
27024
27426
|
init_swift_distribution();
|
|
27025
27427
|
init_swift_host();
|
|
27026
27428
|
init_swift_submit();
|
|
27027
|
-
run3 = (0, import_node_util3.promisify)(
|
|
27429
|
+
run3 = (0, import_node_util3.promisify)(import_node_child_process9.execFile);
|
|
27028
27430
|
scriptEnv = { ...process.env, [RNX_FORKED_SCRIPT_ENV]: "1" };
|
|
27029
27431
|
EXPO_SWIFT_ROUTE = "/__peach/expo-swift";
|
|
27030
27432
|
EXPO_SWIFT_ENTRY = "Sources/PeachExpoApp/PeachExpoEntry.swift";
|
|
@@ -27106,10 +27508,10 @@ function resolveRuntimeRootForHostname(hostname) {
|
|
|
27106
27508
|
}
|
|
27107
27509
|
function sendFileWithRanges(req, res, filePath, total, headers) {
|
|
27108
27510
|
const head = (req?.method || "GET").toUpperCase() === "HEAD";
|
|
27109
|
-
const
|
|
27110
|
-
const invalid =
|
|
27111
|
-
if (
|
|
27112
|
-
const [, startRaw, endRaw] =
|
|
27511
|
+
const range2 = /^bytes=(\d*)-(\d*)$/.exec(req?.headers?.range || "");
|
|
27512
|
+
const invalid = range2 && range2[1] && range2[2] && Number(range2[2]) < Number(range2[1]);
|
|
27513
|
+
if (range2 && (range2[1] || range2[2]) && !invalid) {
|
|
27514
|
+
const [, startRaw, endRaw] = range2;
|
|
27113
27515
|
const start = startRaw ? Number(startRaw) : Math.max(0, total - Number(endRaw));
|
|
27114
27516
|
const end = startRaw && endRaw ? Math.min(Number(endRaw), total - 1) : total - 1;
|
|
27115
27517
|
if (start > end || start >= total) {
|
|
@@ -27200,14 +27602,14 @@ var init_standalone = __esm({
|
|
|
27200
27602
|
// cli/self-invocation.ts
|
|
27201
27603
|
function sourceEntryPath() {
|
|
27202
27604
|
try {
|
|
27203
|
-
const candidate = (0,
|
|
27204
|
-
return (0,
|
|
27605
|
+
const candidate = (0, import_node_path20.join)((0, import_node_path20.dirname)((0, import_node_url3.fileURLToPath)(__sootsim_import_meta_url)), "bin.ts");
|
|
27606
|
+
return (0, import_node_fs19.existsSync)(candidate) ? candidate : null;
|
|
27205
27607
|
} catch {
|
|
27206
27608
|
return null;
|
|
27207
27609
|
}
|
|
27208
27610
|
}
|
|
27209
|
-
function isCliEntry(
|
|
27210
|
-
const name2 = (0,
|
|
27611
|
+
function isCliEntry(path36) {
|
|
27612
|
+
const name2 = (0, import_node_path20.basename)(path36);
|
|
27211
27613
|
return name2 === "bin.ts" || name2 === "bin.js";
|
|
27212
27614
|
}
|
|
27213
27615
|
function rnxSelfInvocation() {
|
|
@@ -27225,12 +27627,12 @@ function rnxSelfInvocation() {
|
|
|
27225
27627
|
}
|
|
27226
27628
|
return { executable: process.execPath, prefixArgs: [entry] };
|
|
27227
27629
|
}
|
|
27228
|
-
var
|
|
27630
|
+
var import_node_fs19, import_node_path20, import_node_url3;
|
|
27229
27631
|
var init_self_invocation = __esm({
|
|
27230
27632
|
"cli/self-invocation.ts"() {
|
|
27231
27633
|
"use strict";
|
|
27232
|
-
|
|
27233
|
-
|
|
27634
|
+
import_node_fs19 = require("node:fs");
|
|
27635
|
+
import_node_path20 = require("node:path");
|
|
27234
27636
|
import_node_url3 = require("node:url");
|
|
27235
27637
|
init_public_brand();
|
|
27236
27638
|
init_standalone();
|
|
@@ -27298,7 +27700,7 @@ function getUserDataDir() {
|
|
|
27298
27700
|
return userDataDir();
|
|
27299
27701
|
}
|
|
27300
27702
|
function storeFile() {
|
|
27301
|
-
return
|
|
27703
|
+
return import_node_path21.default.join(userDataDir(), "attached-projects.json");
|
|
27302
27704
|
}
|
|
27303
27705
|
function cloneEmpty() {
|
|
27304
27706
|
return {
|
|
@@ -27312,7 +27714,7 @@ function loadStore() {
|
|
|
27312
27714
|
const file = storeFile();
|
|
27313
27715
|
let raw2;
|
|
27314
27716
|
try {
|
|
27315
|
-
raw2 =
|
|
27717
|
+
raw2 = import_node_fs20.default.readFileSync(file, "utf8");
|
|
27316
27718
|
} catch (err) {
|
|
27317
27719
|
if (err.code === "ENOENT") return cloneEmpty();
|
|
27318
27720
|
throw err;
|
|
@@ -27329,7 +27731,7 @@ function loadStore() {
|
|
|
27329
27731
|
} catch (err) {
|
|
27330
27732
|
const quarantine = `${file}.corrupt-${Date.now()}`;
|
|
27331
27733
|
try {
|
|
27332
|
-
|
|
27734
|
+
import_node_fs20.default.renameSync(file, quarantine);
|
|
27333
27735
|
console.warn(
|
|
27334
27736
|
`[sootsim] attached-projects.json was unparseable; quarantined to ${quarantine}. original error: ${err.message}`
|
|
27335
27737
|
);
|
|
@@ -27340,16 +27742,16 @@ function loadStore() {
|
|
|
27340
27742
|
}
|
|
27341
27743
|
function writeStore(store) {
|
|
27342
27744
|
const file = storeFile();
|
|
27343
|
-
|
|
27745
|
+
import_node_fs20.default.mkdirSync(import_node_path21.default.dirname(file), { recursive: true });
|
|
27344
27746
|
const tmp = `${file}.tmp-${process.pid}-${Date.now()}`;
|
|
27345
|
-
const fd =
|
|
27747
|
+
const fd = import_node_fs20.default.openSync(tmp, "w", 384);
|
|
27346
27748
|
try {
|
|
27347
|
-
|
|
27348
|
-
|
|
27749
|
+
import_node_fs20.default.writeFileSync(fd, JSON.stringify(store, null, 2));
|
|
27750
|
+
import_node_fs20.default.fsyncSync(fd);
|
|
27349
27751
|
} finally {
|
|
27350
|
-
|
|
27752
|
+
import_node_fs20.default.closeSync(fd);
|
|
27351
27753
|
}
|
|
27352
|
-
|
|
27754
|
+
import_node_fs20.default.renameSync(tmp, file);
|
|
27353
27755
|
}
|
|
27354
27756
|
function mutateStore(fn) {
|
|
27355
27757
|
const store = loadStore();
|
|
@@ -27358,13 +27760,13 @@ function mutateStore(fn) {
|
|
|
27358
27760
|
return store;
|
|
27359
27761
|
}
|
|
27360
27762
|
function projectIdForCwd(cwd) {
|
|
27361
|
-
return (0,
|
|
27763
|
+
return (0, import_node_crypto9.createHash)("sha256").update(import_node_path21.default.resolve(cwd)).digest("hex").slice(0, 16);
|
|
27362
27764
|
}
|
|
27363
27765
|
function newSessionId() {
|
|
27364
|
-
return `s_${(0,
|
|
27766
|
+
return `s_${(0, import_node_crypto9.randomBytes)(10).toString("hex")}`;
|
|
27365
27767
|
}
|
|
27366
27768
|
function upsertProject(input) {
|
|
27367
|
-
const cwd =
|
|
27769
|
+
const cwd = import_node_path21.default.resolve(input.cwd);
|
|
27368
27770
|
const id = projectIdForCwd(cwd);
|
|
27369
27771
|
let result;
|
|
27370
27772
|
mutateStore((store) => {
|
|
@@ -27390,7 +27792,7 @@ function upsertProject(input) {
|
|
|
27390
27792
|
const now = Date.now();
|
|
27391
27793
|
const created = {
|
|
27392
27794
|
id,
|
|
27393
|
-
name: input.name ??
|
|
27795
|
+
name: input.name ?? import_node_path21.default.basename(cwd),
|
|
27394
27796
|
cwd,
|
|
27395
27797
|
repoRoot: input.repoRoot,
|
|
27396
27798
|
sourceRoots: input.sourceRoots ?? [cwd],
|
|
@@ -27535,8 +27937,8 @@ async function seedFromDemoAppRegistry() {
|
|
|
27535
27937
|
if (apps.length === 0) return;
|
|
27536
27938
|
mutateStore((store) => {
|
|
27537
27939
|
for (const app of apps) {
|
|
27538
|
-
if (!
|
|
27539
|
-
const cwd =
|
|
27940
|
+
if (!import_node_fs20.default.existsSync(app.dir)) continue;
|
|
27941
|
+
const cwd = import_node_path21.default.resolve(app.dir);
|
|
27540
27942
|
const id = projectIdForCwd(cwd);
|
|
27541
27943
|
if (store.attachedProjects.some((p) => p.id === id)) continue;
|
|
27542
27944
|
const now = Date.now();
|
|
@@ -27557,13 +27959,13 @@ async function seedFromDemoAppRegistry() {
|
|
|
27557
27959
|
}
|
|
27558
27960
|
});
|
|
27559
27961
|
}
|
|
27560
|
-
var
|
|
27962
|
+
var import_node_crypto9, import_node_fs20, import_node_path21, overrideDir, COST_HISTORY_MAX_AGE_MS;
|
|
27561
27963
|
var init_attached_projects = __esm({
|
|
27562
27964
|
"src/attached-projects.ts"() {
|
|
27563
27965
|
"use strict";
|
|
27564
|
-
|
|
27565
|
-
|
|
27566
|
-
|
|
27966
|
+
import_node_crypto9 = require("node:crypto");
|
|
27967
|
+
import_node_fs20 = __toESM(require("node:fs"), 1);
|
|
27968
|
+
import_node_path21 = __toESM(require("node:path"), 1);
|
|
27567
27969
|
init_home_paths();
|
|
27568
27970
|
overrideDir = null;
|
|
27569
27971
|
COST_HISTORY_MAX_AGE_MS = 14 * 24 * 60 * 60 * 1e3;
|
|
@@ -27572,16 +27974,16 @@ var init_attached_projects = __esm({
|
|
|
27572
27974
|
|
|
27573
27975
|
// src/agent-sessions.ts
|
|
27574
27976
|
function sessionDir(sessionId) {
|
|
27575
|
-
return
|
|
27977
|
+
return import_node_path22.default.join(getUserDataDir(), "sessions", sessionId);
|
|
27576
27978
|
}
|
|
27577
27979
|
function promptFifoPath(sessionId) {
|
|
27578
|
-
return
|
|
27980
|
+
return import_node_path22.default.join(sessionDir(sessionId), "prompt.in");
|
|
27579
27981
|
}
|
|
27580
27982
|
function eventsFifoPath(sessionId) {
|
|
27581
|
-
return
|
|
27983
|
+
return import_node_path22.default.join(sessionDir(sessionId), "events.out");
|
|
27582
27984
|
}
|
|
27583
27985
|
function transcriptPath(sessionId) {
|
|
27584
|
-
return
|
|
27986
|
+
return import_node_path22.default.join(getUserDataDir(), "transcripts", `${sessionId}.log`);
|
|
27585
27987
|
}
|
|
27586
27988
|
function pidIsAlive(pid, sessionId) {
|
|
27587
27989
|
if (!pid) return false;
|
|
@@ -27591,7 +27993,7 @@ function pidIsAlive(pid, sessionId) {
|
|
|
27591
27993
|
return false;
|
|
27592
27994
|
}
|
|
27593
27995
|
if (sessionId) {
|
|
27594
|
-
if (!
|
|
27996
|
+
if (!import_node_fs21.default.existsSync(sessionDir(sessionId))) return false;
|
|
27595
27997
|
}
|
|
27596
27998
|
return true;
|
|
27597
27999
|
}
|
|
@@ -27604,11 +28006,11 @@ function resolveSootsimInvocation() {
|
|
|
27604
28006
|
const resourcesPath = process.resourcesPath;
|
|
27605
28007
|
if (resourcesPath) {
|
|
27606
28008
|
const candidates = [
|
|
27607
|
-
|
|
27608
|
-
|
|
28009
|
+
import_node_path22.default.join(resourcesPath, "bin", "sootsim"),
|
|
28010
|
+
import_node_path22.default.join(resourcesPath, "bin", `sootsim-${process.platform}-${process.arch}`)
|
|
27609
28011
|
];
|
|
27610
28012
|
for (const c of candidates) {
|
|
27611
|
-
if (
|
|
28013
|
+
if (import_node_fs21.default.existsSync(c)) return { executable: c, prefixArgs: [] };
|
|
27612
28014
|
}
|
|
27613
28015
|
}
|
|
27614
28016
|
}
|
|
@@ -27627,15 +28029,15 @@ function tryWorkspaceSootsim() {
|
|
|
27627
28029
|
const sootsimDir = resolveSootsimPackageDir();
|
|
27628
28030
|
if (!sootsimDir) return null;
|
|
27629
28031
|
const binaryName = `peach-${process.platform === "win32" ? "windows" : process.platform}-${process.arch}${process.platform === "win32" ? ".exe" : ""}`;
|
|
27630
|
-
const distBinary =
|
|
27631
|
-
if (
|
|
27632
|
-
const distBin =
|
|
27633
|
-
if (
|
|
28032
|
+
const distBinary = import_node_path22.default.join(sootsimDir, "dist-bin", binaryName);
|
|
28033
|
+
if (import_node_fs21.default.existsSync(distBinary)) return { executable: distBinary, prefixArgs: [] };
|
|
28034
|
+
const distBin = import_node_path22.default.join(sootsimDir, "dist-cli", "bin.js");
|
|
28035
|
+
if (import_node_fs21.default.existsSync(distBin)) {
|
|
27634
28036
|
try {
|
|
27635
|
-
const src =
|
|
27636
|
-
if (
|
|
27637
|
-
const srcMtime =
|
|
27638
|
-
const buildMtime =
|
|
28037
|
+
const src = import_node_path22.default.join(sootsimDir, "cli", "commands", "agent-wrapper.ts");
|
|
28038
|
+
if (import_node_fs21.default.existsSync(src)) {
|
|
28039
|
+
const srcMtime = import_node_fs21.default.statSync(src).mtimeMs;
|
|
28040
|
+
const buildMtime = import_node_fs21.default.statSync(distBin).mtimeMs;
|
|
27639
28041
|
if (buildMtime < srcMtime) {
|
|
27640
28042
|
console.warn(
|
|
27641
28043
|
`[peach] dist-cli/bin.js is older than agent-wrapper.ts \u2014 rebuild with \`bun run --cwd packages/peachsim build:cli\`.`
|
|
@@ -27654,22 +28056,22 @@ function tryWorkspaceSootsim() {
|
|
|
27654
28056
|
function resolveSootsimPackageDir() {
|
|
27655
28057
|
try {
|
|
27656
28058
|
const resolved = require.resolve(`${rnxPublicBrand.packageName}/package.json`);
|
|
27657
|
-
return
|
|
28059
|
+
return import_node_path22.default.dirname(resolved);
|
|
27658
28060
|
} catch {
|
|
27659
28061
|
}
|
|
27660
28062
|
const here = fileFromImportMeta();
|
|
27661
28063
|
if (!here) return null;
|
|
27662
|
-
let cur =
|
|
28064
|
+
let cur = import_node_path22.default.dirname(here);
|
|
27663
28065
|
for (let i = 0; i < 8; i++) {
|
|
27664
|
-
const pkg =
|
|
28066
|
+
const pkg = import_node_path22.default.join(cur, "package.json");
|
|
27665
28067
|
try {
|
|
27666
|
-
if (
|
|
27667
|
-
const parsed = JSON.parse(
|
|
28068
|
+
if (import_node_fs21.default.existsSync(pkg)) {
|
|
28069
|
+
const parsed = JSON.parse(import_node_fs21.default.readFileSync(pkg, "utf8"));
|
|
27668
28070
|
if (parsed.name === rnxPublicBrand.packageName) return cur;
|
|
27669
28071
|
}
|
|
27670
28072
|
} catch {
|
|
27671
28073
|
}
|
|
27672
|
-
const parent =
|
|
28074
|
+
const parent = import_node_path22.default.dirname(cur);
|
|
27673
28075
|
if (parent === cur) break;
|
|
27674
28076
|
cur = parent;
|
|
27675
28077
|
}
|
|
@@ -27685,28 +28087,28 @@ function fileFromImportMeta() {
|
|
|
27685
28087
|
}
|
|
27686
28088
|
}
|
|
27687
28089
|
async function withStartLock(projectId, provider, fn) {
|
|
27688
|
-
const lockDir =
|
|
27689
|
-
|
|
28090
|
+
const lockDir = import_node_path22.default.join(getUserDataDir(), "locks");
|
|
28091
|
+
import_node_fs21.default.mkdirSync(lockDir, { recursive: true });
|
|
27690
28092
|
try {
|
|
27691
|
-
|
|
28093
|
+
import_node_fs21.default.chmodSync(lockDir, 448);
|
|
27692
28094
|
} catch {
|
|
27693
28095
|
}
|
|
27694
|
-
const lockPath =
|
|
28096
|
+
const lockPath = import_node_path22.default.join(lockDir, `start-${projectId}-${provider}.lock`);
|
|
27695
28097
|
const deadline = Date.now() + 4e3;
|
|
27696
28098
|
let fd = null;
|
|
27697
28099
|
while (fd === null) {
|
|
27698
28100
|
try {
|
|
27699
|
-
fd =
|
|
28101
|
+
fd = import_node_fs21.default.openSync(
|
|
27700
28102
|
lockPath,
|
|
27701
|
-
|
|
28103
|
+
import_node_fs21.constants.O_WRONLY | import_node_fs21.constants.O_CREAT | import_node_fs21.constants.O_EXCL,
|
|
27702
28104
|
384
|
|
27703
28105
|
);
|
|
27704
28106
|
} catch (err) {
|
|
27705
28107
|
if (err.code !== "EEXIST") throw err;
|
|
27706
28108
|
try {
|
|
27707
|
-
const stale = Number(
|
|
28109
|
+
const stale = Number(import_node_fs21.default.readFileSync(lockPath, "utf8").trim());
|
|
27708
28110
|
if (stale && !isProcessAlive(stale)) {
|
|
27709
|
-
|
|
28111
|
+
import_node_fs21.default.unlinkSync(lockPath);
|
|
27710
28112
|
continue;
|
|
27711
28113
|
}
|
|
27712
28114
|
} catch {
|
|
@@ -27720,15 +28122,15 @@ async function withStartLock(projectId, provider, fn) {
|
|
|
27720
28122
|
}
|
|
27721
28123
|
}
|
|
27722
28124
|
try {
|
|
27723
|
-
|
|
28125
|
+
import_node_fs21.default.writeFileSync(fd, String(process.pid));
|
|
27724
28126
|
return await fn();
|
|
27725
28127
|
} finally {
|
|
27726
28128
|
try {
|
|
27727
|
-
|
|
28129
|
+
import_node_fs21.default.closeSync(fd);
|
|
27728
28130
|
} catch {
|
|
27729
28131
|
}
|
|
27730
28132
|
try {
|
|
27731
|
-
|
|
28133
|
+
import_node_fs21.default.unlinkSync(lockPath);
|
|
27732
28134
|
} catch {
|
|
27733
28135
|
}
|
|
27734
28136
|
}
|
|
@@ -27742,28 +28144,28 @@ function isProcessAlive(pid) {
|
|
|
27742
28144
|
}
|
|
27743
28145
|
}
|
|
27744
28146
|
function mkfifoSync(p) {
|
|
27745
|
-
const parent =
|
|
27746
|
-
|
|
28147
|
+
const parent = import_node_path22.default.dirname(p);
|
|
28148
|
+
import_node_fs21.default.mkdirSync(parent, { recursive: true });
|
|
27747
28149
|
try {
|
|
27748
|
-
|
|
28150
|
+
import_node_fs21.default.chmodSync(parent, 448);
|
|
27749
28151
|
} catch {
|
|
27750
28152
|
}
|
|
27751
|
-
if (
|
|
28153
|
+
if (import_node_fs21.default.existsSync(p)) {
|
|
27752
28154
|
try {
|
|
27753
|
-
const stat2 =
|
|
28155
|
+
const stat2 = import_node_fs21.default.statSync(p);
|
|
27754
28156
|
if (stat2.isFIFO()) {
|
|
27755
28157
|
try {
|
|
27756
|
-
|
|
28158
|
+
import_node_fs21.default.chmodSync(p, 384);
|
|
27757
28159
|
} catch {
|
|
27758
28160
|
}
|
|
27759
28161
|
return;
|
|
27760
28162
|
}
|
|
27761
|
-
|
|
28163
|
+
import_node_fs21.default.unlinkSync(p);
|
|
27762
28164
|
} catch {
|
|
27763
|
-
|
|
28165
|
+
import_node_fs21.default.unlinkSync(p);
|
|
27764
28166
|
}
|
|
27765
28167
|
}
|
|
27766
|
-
const result = (0,
|
|
28168
|
+
const result = (0, import_node_child_process10.spawnSync)("mkfifo", ["-m", "600", p]);
|
|
27767
28169
|
if (result.status !== 0) {
|
|
27768
28170
|
throw new Error(
|
|
27769
28171
|
`mkfifo(${p}) failed: ${result.stderr?.toString().trim() || "unknown error"}`
|
|
@@ -27786,7 +28188,7 @@ async function startSession(opts) {
|
|
|
27786
28188
|
`session already running for project=${project.id} provider=${provider} (session ${existingLive.id}, pid ${existingLive.wrapperPid}). end it first with \`peach agent end <sessionId>\`.`
|
|
27787
28189
|
);
|
|
27788
28190
|
}
|
|
27789
|
-
const claudeSessionUuid = provider === "claude" ? (0,
|
|
28191
|
+
const claudeSessionUuid = provider === "claude" ? (0, import_node_crypto10.randomUUID)() : void 0;
|
|
27790
28192
|
const session = upsertSession({
|
|
27791
28193
|
projectId: project.id,
|
|
27792
28194
|
provider,
|
|
@@ -27800,10 +28202,10 @@ async function startSession(opts) {
|
|
|
27800
28202
|
const transcript = transcriptPath(session.id);
|
|
27801
28203
|
mkfifoSync(promptIn);
|
|
27802
28204
|
mkfifoSync(eventsOut);
|
|
27803
|
-
const transcriptDir =
|
|
27804
|
-
|
|
28205
|
+
const transcriptDir = import_node_path22.default.dirname(transcript);
|
|
28206
|
+
import_node_fs21.default.mkdirSync(transcriptDir, { recursive: true });
|
|
27805
28207
|
try {
|
|
27806
|
-
|
|
28208
|
+
import_node_fs21.default.chmodSync(transcriptDir, 448);
|
|
27807
28209
|
} catch {
|
|
27808
28210
|
}
|
|
27809
28211
|
const { executable, prefixArgs } = resolveSootsimInvocation();
|
|
@@ -27831,7 +28233,7 @@ async function startSession(opts) {
|
|
|
27831
28233
|
if (claudeSessionUuid) {
|
|
27832
28234
|
wrapperArgs.push("--claude-session-uuid", claudeSessionUuid);
|
|
27833
28235
|
}
|
|
27834
|
-
const child = (0,
|
|
28236
|
+
const child = (0, import_node_child_process10.spawn)(executable, wrapperArgs, {
|
|
27835
28237
|
detached: true,
|
|
27836
28238
|
stdio: "ignore",
|
|
27837
28239
|
env: {
|
|
@@ -27854,7 +28256,7 @@ async function startSession(opts) {
|
|
|
27854
28256
|
}
|
|
27855
28257
|
}
|
|
27856
28258
|
try {
|
|
27857
|
-
|
|
28259
|
+
import_node_fs21.default.rmSync(sessionDir(session.id), { recursive: true, force: true });
|
|
27858
28260
|
} catch {
|
|
27859
28261
|
}
|
|
27860
28262
|
updateSessionStatus(session.id, { status: "ended" });
|
|
@@ -27882,18 +28284,18 @@ async function sendPrompt(sessionId, prompt) {
|
|
|
27882
28284
|
);
|
|
27883
28285
|
}
|
|
27884
28286
|
const fifo = promptFifoPath(sessionId);
|
|
27885
|
-
if (!
|
|
28287
|
+
if (!import_node_fs21.default.existsSync(fifo)) {
|
|
27886
28288
|
throw new AgentSessionError("NO_FIFO", `prompt FIFO missing: ${fifo}`);
|
|
27887
28289
|
}
|
|
27888
|
-
const fd =
|
|
28290
|
+
const fd = import_node_fs21.default.openSync(fifo, import_node_fs21.constants.O_WRONLY);
|
|
27889
28291
|
try {
|
|
27890
28292
|
const wireText = encodeAgentPromptEnvelope(prompt);
|
|
27891
28293
|
if (!wireText) {
|
|
27892
28294
|
throw new AgentSessionError("EMPTY_PROMPT", "prompt text is empty");
|
|
27893
28295
|
}
|
|
27894
|
-
|
|
28296
|
+
import_node_fs21.default.writeSync(fd, wireText + "\n");
|
|
27895
28297
|
} finally {
|
|
27896
|
-
|
|
28298
|
+
import_node_fs21.default.closeSync(fd);
|
|
27897
28299
|
}
|
|
27898
28300
|
updateSessionStatus(sessionId, {
|
|
27899
28301
|
lastPrompt: prompt.displayText ?? prompt.text,
|
|
@@ -27915,7 +28317,7 @@ async function endSession(sessionId) {
|
|
|
27915
28317
|
const base = getUserDataDir();
|
|
27916
28318
|
if (dir.startsWith(base)) {
|
|
27917
28319
|
try {
|
|
27918
|
-
|
|
28320
|
+
import_node_fs21.default.rmSync(dir, { recursive: true, force: true });
|
|
27919
28321
|
} catch {
|
|
27920
28322
|
}
|
|
27921
28323
|
}
|
|
@@ -27923,11 +28325,11 @@ async function endSession(sessionId) {
|
|
|
27923
28325
|
}
|
|
27924
28326
|
function subscribeEvents(sessionId, onEvent) {
|
|
27925
28327
|
const fifo = eventsFifoPath(sessionId);
|
|
27926
|
-
if (!
|
|
28328
|
+
if (!import_node_fs21.default.existsSync(fifo)) {
|
|
27927
28329
|
throw new AgentSessionError("NO_FIFO", `events FIFO missing: ${fifo}`);
|
|
27928
28330
|
}
|
|
27929
|
-
const fd =
|
|
27930
|
-
const stream =
|
|
28331
|
+
const fd = import_node_fs21.default.openSync(fifo, import_node_fs21.constants.O_RDWR);
|
|
28332
|
+
const stream = import_node_fs21.default.createReadStream("", { fd, autoClose: true });
|
|
27931
28333
|
const rl = import_node_readline.default.createInterface({ input: stream, crlfDelay: Infinity });
|
|
27932
28334
|
rl.on("line", (line) => {
|
|
27933
28335
|
const event = parseAgentEventLine(line);
|
|
@@ -27938,7 +28340,7 @@ function subscribeEvents(sessionId, onEvent) {
|
|
|
27938
28340
|
if (closed) return;
|
|
27939
28341
|
closed = true;
|
|
27940
28342
|
try {
|
|
27941
|
-
|
|
28343
|
+
import_node_fs21.default.writeSync(fd, "\n");
|
|
27942
28344
|
} catch {
|
|
27943
28345
|
}
|
|
27944
28346
|
try {
|
|
@@ -27952,7 +28354,7 @@ function subscribeEvents(sessionId, onEvent) {
|
|
|
27952
28354
|
};
|
|
27953
28355
|
}
|
|
27954
28356
|
async function waitForFirstEvent(fifo, predicate, timeoutMs) {
|
|
27955
|
-
const fd =
|
|
28357
|
+
const fd = import_node_fs21.default.openSync(fifo, import_node_fs21.constants.O_RDWR | import_node_fs21.constants.O_NONBLOCK);
|
|
27956
28358
|
const buf = Buffer.alloc(8192);
|
|
27957
28359
|
let leftover = "";
|
|
27958
28360
|
const deadline = Date.now() + timeoutMs;
|
|
@@ -27960,7 +28362,7 @@ async function waitForFirstEvent(fifo, predicate, timeoutMs) {
|
|
|
27960
28362
|
while (Date.now() < deadline) {
|
|
27961
28363
|
let n = 0;
|
|
27962
28364
|
try {
|
|
27963
|
-
n =
|
|
28365
|
+
n = import_node_fs21.default.readSync(fd, buf, 0, buf.length, null);
|
|
27964
28366
|
} catch (err) {
|
|
27965
28367
|
if (err.code !== "EAGAIN") throw err;
|
|
27966
28368
|
n = 0;
|
|
@@ -27980,17 +28382,17 @@ async function waitForFirstEvent(fifo, predicate, timeoutMs) {
|
|
|
27980
28382
|
}
|
|
27981
28383
|
return null;
|
|
27982
28384
|
} finally {
|
|
27983
|
-
|
|
28385
|
+
import_node_fs21.default.closeSync(fd);
|
|
27984
28386
|
}
|
|
27985
28387
|
}
|
|
27986
|
-
var
|
|
28388
|
+
var import_node_child_process10, import_node_crypto10, import_node_fs21, import_node_path22, import_node_readline, AgentSessionError;
|
|
27987
28389
|
var init_agent_sessions = __esm({
|
|
27988
28390
|
"src/agent-sessions.ts"() {
|
|
27989
28391
|
"use strict";
|
|
27990
|
-
|
|
27991
|
-
|
|
27992
|
-
|
|
27993
|
-
|
|
28392
|
+
import_node_child_process10 = require("node:child_process");
|
|
28393
|
+
import_node_crypto10 = require("node:crypto");
|
|
28394
|
+
import_node_fs21 = __toESM(require("node:fs"), 1);
|
|
28395
|
+
import_node_path22 = __toESM(require("node:path"), 1);
|
|
27994
28396
|
import_node_readline = __toESM(require("node:readline"), 1);
|
|
27995
28397
|
init_self_invocation();
|
|
27996
28398
|
init_standalone();
|
|
@@ -28021,13 +28423,13 @@ function mapFrameworkToProjectFramework(fw) {
|
|
|
28021
28423
|
if (fw === "one" || fw === "vxrn") return "one";
|
|
28022
28424
|
return "unknown";
|
|
28023
28425
|
}
|
|
28024
|
-
var
|
|
28426
|
+
var import_node_crypto11, import_node_fs22, import_node_path23, WS_OPEN, SESSION_STATUS_PERSIST_DELAY_MS, AgentHost;
|
|
28025
28427
|
var init_agent_host = __esm({
|
|
28026
28428
|
"src/host/agent-host.ts"() {
|
|
28027
28429
|
"use strict";
|
|
28028
|
-
|
|
28029
|
-
|
|
28030
|
-
|
|
28430
|
+
import_node_crypto11 = require("node:crypto");
|
|
28431
|
+
import_node_fs22 = __toESM(require("node:fs"), 1);
|
|
28432
|
+
import_node_path23 = __toESM(require("node:path"), 1);
|
|
28031
28433
|
init_dev_server_scanner();
|
|
28032
28434
|
init_agent_sessions();
|
|
28033
28435
|
init_attached_projects();
|
|
@@ -28227,7 +28629,7 @@ var init_agent_host = __esm({
|
|
|
28227
28629
|
throw new AgentSessionError("EMPTY_PROMPT", "inspect message cannot be empty");
|
|
28228
28630
|
}
|
|
28229
28631
|
const message = {
|
|
28230
|
-
id: `inspect-${(0,
|
|
28632
|
+
id: `inspect-${(0, import_node_crypto11.randomUUID)()}`,
|
|
28231
28633
|
simId,
|
|
28232
28634
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
28233
28635
|
prompt
|
|
@@ -28273,7 +28675,7 @@ var init_agent_host = __esm({
|
|
|
28273
28675
|
);
|
|
28274
28676
|
const project = upsertProject({
|
|
28275
28677
|
cwd: match.cwd,
|
|
28276
|
-
name: match.projectName ??
|
|
28678
|
+
name: match.projectName ?? import_node_path23.default.basename(match.cwd),
|
|
28277
28679
|
preferredProvider: input.provider ?? existing?.preferredProvider,
|
|
28278
28680
|
sourceRoots: existing?.sourceRoots ?? [match.cwd],
|
|
28279
28681
|
knownBundleUrls,
|
|
@@ -28284,18 +28686,18 @@ var init_agent_host = __esm({
|
|
|
28284
28686
|
}
|
|
28285
28687
|
getTranscript(sessionId) {
|
|
28286
28688
|
const p = transcriptPath(sessionId);
|
|
28287
|
-
if (!
|
|
28689
|
+
if (!import_node_fs22.default.existsSync(p)) {
|
|
28288
28690
|
return { error: "transcript not found", code: "NO_TRANSCRIPT" };
|
|
28289
28691
|
}
|
|
28290
|
-
return
|
|
28692
|
+
return import_node_fs22.default.readFileSync(p, "utf8");
|
|
28291
28693
|
}
|
|
28292
28694
|
getPaths() {
|
|
28293
28695
|
const dir = getUserDataDir();
|
|
28294
28696
|
return {
|
|
28295
28697
|
userDataDir: dir,
|
|
28296
|
-
storeFile:
|
|
28297
|
-
sessionsDir:
|
|
28298
|
-
transcriptsDir:
|
|
28698
|
+
storeFile: import_node_path23.default.join(dir, "attached-projects.json"),
|
|
28699
|
+
sessionsDir: import_node_path23.default.join(dir, "sessions"),
|
|
28700
|
+
transcriptsDir: import_node_path23.default.join(dir, "transcripts")
|
|
28299
28701
|
};
|
|
28300
28702
|
}
|
|
28301
28703
|
// --- subscription management ---
|
|
@@ -29009,7 +29411,7 @@ async function startFetchProxyTransport() {
|
|
|
29009
29411
|
const keys = await crypto.subtle.generateKey(algorithm, true, ["sign", "verify"]);
|
|
29010
29412
|
const certificate = await import_x509.X509CertificateGenerator.createSelfSigned(
|
|
29011
29413
|
{
|
|
29012
|
-
serialNumber: (0,
|
|
29414
|
+
serialNumber: (0, import_node_crypto12.randomBytes)(16).toString("hex"),
|
|
29013
29415
|
name: "CN=localhost",
|
|
29014
29416
|
notBefore: new Date(Date.now() - 6e4),
|
|
29015
29417
|
notAfter: new Date(Date.now() + 365 * 24 * 60 * 6e4),
|
|
@@ -29022,7 +29424,7 @@ async function startFetchProxyTransport() {
|
|
|
29022
29424
|
crypto
|
|
29023
29425
|
);
|
|
29024
29426
|
const privateKey = Buffer.from(await crypto.subtle.exportKey("pkcs8", keys.privateKey));
|
|
29025
|
-
const spki = (0,
|
|
29427
|
+
const spki = (0, import_node_crypto12.createHash)("sha256").update(Buffer.from(await crypto.subtle.exportKey("spki", keys.publicKey))).digest("base64");
|
|
29026
29428
|
const sessions = /* @__PURE__ */ new Set();
|
|
29027
29429
|
const server = (0, import_node_http22.createSecureServer)(
|
|
29028
29430
|
{
|
|
@@ -29068,11 +29470,11 @@ ${privateKey.toString("base64").match(/.{1,64}/g)?.join("\n")}
|
|
|
29068
29470
|
}
|
|
29069
29471
|
};
|
|
29070
29472
|
}
|
|
29071
|
-
var
|
|
29473
|
+
var import_node_crypto12, import_node_http22, import_x509;
|
|
29072
29474
|
var init_fetch_proxy_transport = __esm({
|
|
29073
29475
|
"src/host/fetch-proxy-transport.ts"() {
|
|
29074
29476
|
"use strict";
|
|
29075
|
-
|
|
29477
|
+
import_node_crypto12 = require("node:crypto");
|
|
29076
29478
|
import_node_http22 = require("node:http2");
|
|
29077
29479
|
import_x509 = require("@peculiar/x509");
|
|
29078
29480
|
init_fetch_proxy_handler();
|
|
@@ -29289,23 +29691,23 @@ function looksBinary(filePath, size) {
|
|
|
29289
29691
|
if (size === 0) return false;
|
|
29290
29692
|
let fd;
|
|
29291
29693
|
try {
|
|
29292
|
-
fd =
|
|
29694
|
+
fd = import_node_fs23.default.openSync(filePath, "r");
|
|
29293
29695
|
const buffer = Buffer.alloc(Math.min(BINARY_SNIFF_BYTES, size));
|
|
29294
|
-
const read =
|
|
29696
|
+
const read = import_node_fs23.default.readSync(fd, buffer, 0, buffer.length, 0);
|
|
29295
29697
|
return buffer.subarray(0, read).includes(0);
|
|
29296
29698
|
} catch {
|
|
29297
29699
|
return false;
|
|
29298
29700
|
} finally {
|
|
29299
|
-
if (fd !== void 0)
|
|
29701
|
+
if (fd !== void 0) import_node_fs23.default.closeSync(fd);
|
|
29300
29702
|
}
|
|
29301
29703
|
}
|
|
29302
|
-
var
|
|
29704
|
+
var import_node_child_process11, import_node_fs23, import_node_path24, CheckoutRequiresGitError, BINARY_SNIFF_BYTES, LIST_FILES_TIMEOUT_MS, LIST_FILES_ATTEMPTS, LIST_FILES_RETRY_MS, CheckoutFilePlane;
|
|
29303
29705
|
var init_checkout_plane = __esm({
|
|
29304
29706
|
"cli/commands/box/checkout-plane.ts"() {
|
|
29305
29707
|
"use strict";
|
|
29306
|
-
|
|
29307
|
-
|
|
29308
|
-
|
|
29708
|
+
import_node_child_process11 = require("node:child_process");
|
|
29709
|
+
import_node_fs23 = __toESM(require("node:fs"), 1);
|
|
29710
|
+
import_node_path24 = __toESM(require("node:path"), 1);
|
|
29309
29711
|
CheckoutRequiresGitError = class extends Error {
|
|
29310
29712
|
};
|
|
29311
29713
|
BINARY_SNIFF_BYTES = 8192;
|
|
@@ -29322,7 +29724,7 @@ var init_checkout_plane = __esm({
|
|
|
29322
29724
|
listTimeoutMs;
|
|
29323
29725
|
trackedOnly;
|
|
29324
29726
|
constructor(root, options = {}) {
|
|
29325
|
-
this.root =
|
|
29727
|
+
this.root = import_node_path24.default.resolve(root);
|
|
29326
29728
|
this.listTimeoutMs = options.listTimeoutMs ?? LIST_FILES_TIMEOUT_MS;
|
|
29327
29729
|
this.trackedOnly = options.trackedOnly ?? false;
|
|
29328
29730
|
}
|
|
@@ -29331,7 +29733,7 @@ var init_checkout_plane = __esm({
|
|
|
29331
29733
|
}
|
|
29332
29734
|
listFiles() {
|
|
29333
29735
|
const args = this.trackedOnly ? ["ls-files", "-z"] : ["ls-files", "-co", "--exclude-standard", "-z"];
|
|
29334
|
-
const stdout = (0,
|
|
29736
|
+
const stdout = (0, import_node_child_process11.execFileSync)("git", args, {
|
|
29335
29737
|
cwd: this.root,
|
|
29336
29738
|
encoding: "utf8",
|
|
29337
29739
|
maxBuffer: 64 * 1024 * 1024,
|
|
@@ -29384,13 +29786,13 @@ var init_checkout_plane = __esm({
|
|
|
29384
29786
|
if (!relative3) continue;
|
|
29385
29787
|
let stat2;
|
|
29386
29788
|
try {
|
|
29387
|
-
stat2 =
|
|
29789
|
+
stat2 = import_node_fs23.default.statSync(import_node_path24.default.join(this.root, relative3));
|
|
29388
29790
|
} catch {
|
|
29389
29791
|
continue;
|
|
29390
29792
|
}
|
|
29391
29793
|
if (!stat2.isFile()) continue;
|
|
29392
29794
|
const seen = this.sniffed.get(relative3);
|
|
29393
|
-
const binary = seen && seen.size === stat2.size && seen.mtimeMs === stat2.mtimeMs ? seen.binary : looksBinary(
|
|
29795
|
+
const binary = seen && seen.size === stat2.size && seen.mtimeMs === stat2.mtimeMs ? seen.binary : looksBinary(import_node_path24.default.join(this.root, relative3), stat2.size);
|
|
29394
29796
|
nextSniffed.set(relative3, { size: stat2.size, mtimeMs: stat2.mtimeMs, binary });
|
|
29395
29797
|
next.set(relative3, {
|
|
29396
29798
|
size: stat2.size,
|
|
@@ -29404,22 +29806,22 @@ var init_checkout_plane = __esm({
|
|
|
29404
29806
|
this.sniffed = nextSniffed;
|
|
29405
29807
|
}
|
|
29406
29808
|
absolute(planePath) {
|
|
29407
|
-
const resolved =
|
|
29408
|
-
if (resolved !== this.root && !resolved.startsWith(`${this.root}${
|
|
29809
|
+
const resolved = import_node_path24.default.resolve(this.root, planePath);
|
|
29810
|
+
if (resolved !== this.root && !resolved.startsWith(`${this.root}${import_node_path24.default.sep}`)) {
|
|
29409
29811
|
throw new Error(`path escapes the project: ${planePath}`);
|
|
29410
29812
|
}
|
|
29411
29813
|
return resolved;
|
|
29412
29814
|
}
|
|
29413
29815
|
async read(planePath) {
|
|
29414
|
-
return
|
|
29816
|
+
return import_node_fs23.default.promises.readFile(this.absolute(planePath), "utf8");
|
|
29415
29817
|
}
|
|
29416
29818
|
async readBytes(planePath) {
|
|
29417
|
-
return
|
|
29819
|
+
return import_node_fs23.default.promises.readFile(this.absolute(planePath));
|
|
29418
29820
|
}
|
|
29419
29821
|
async write(planePath, content) {
|
|
29420
29822
|
const absolute = this.absolute(planePath);
|
|
29421
|
-
await
|
|
29422
|
-
await
|
|
29823
|
+
await import_node_fs23.default.promises.mkdir(import_node_path24.default.dirname(absolute), { recursive: true });
|
|
29824
|
+
await import_node_fs23.default.promises.writeFile(absolute, content);
|
|
29423
29825
|
this.entries.set(planePath, {
|
|
29424
29826
|
size: content.byteLength,
|
|
29425
29827
|
readOnly: false,
|
|
@@ -29428,7 +29830,7 @@ var init_checkout_plane = __esm({
|
|
|
29428
29830
|
});
|
|
29429
29831
|
}
|
|
29430
29832
|
async delete(planePath) {
|
|
29431
|
-
await
|
|
29833
|
+
await import_node_fs23.default.promises.rm(this.absolute(planePath), { force: true });
|
|
29432
29834
|
this.entries.delete(planePath);
|
|
29433
29835
|
}
|
|
29434
29836
|
};
|
|
@@ -29436,12 +29838,12 @@ var init_checkout_plane = __esm({
|
|
|
29436
29838
|
});
|
|
29437
29839
|
|
|
29438
29840
|
// src/host/plane-host.ts
|
|
29439
|
-
var
|
|
29841
|
+
var import_node_fs24, import_node_path25, WS_OPEN2, PlaneNotRegisteredError, PlaneHost;
|
|
29440
29842
|
var init_plane_host = __esm({
|
|
29441
29843
|
"src/host/plane-host.ts"() {
|
|
29442
29844
|
"use strict";
|
|
29443
|
-
|
|
29444
|
-
|
|
29845
|
+
import_node_fs24 = __toESM(require("node:fs"), 1);
|
|
29846
|
+
import_node_path25 = __toESM(require("node:path"), 1);
|
|
29445
29847
|
init_plane();
|
|
29446
29848
|
init_checkout_plane();
|
|
29447
29849
|
WS_OPEN2 = 1;
|
|
@@ -29564,14 +29966,14 @@ var init_plane_host = __esm({
|
|
|
29564
29966
|
// root and an opened one cannot disagree about the same directory.
|
|
29565
29967
|
realRoot(root) {
|
|
29566
29968
|
if (!root) throw new Error("root is required");
|
|
29567
|
-
const resolved =
|
|
29969
|
+
const resolved = import_node_path25.default.resolve(root);
|
|
29568
29970
|
let real;
|
|
29569
29971
|
try {
|
|
29570
|
-
real =
|
|
29972
|
+
real = import_node_fs24.default.realpathSync(resolved);
|
|
29571
29973
|
} catch {
|
|
29572
29974
|
throw new Error(`no such directory: ${resolved}`);
|
|
29573
29975
|
}
|
|
29574
|
-
if (!
|
|
29976
|
+
if (!import_node_fs24.default.statSync(real).isDirectory()) throw new Error(`not a directory: ${real}`);
|
|
29575
29977
|
return real;
|
|
29576
29978
|
}
|
|
29577
29979
|
respond(ws, id, result) {
|
|
@@ -29927,16 +30329,16 @@ function sendJavaScript(req, res, source) {
|
|
|
29927
30329
|
res.end(req.method === "HEAD" ? void 0 : source);
|
|
29928
30330
|
}
|
|
29929
30331
|
function resolveReplacementModuleFile(fromFile, specifier) {
|
|
29930
|
-
const base =
|
|
30332
|
+
const base = import_node_path26.default.resolve(import_node_path26.default.dirname(fromFile), specifier);
|
|
29931
30333
|
const candidates = [
|
|
29932
30334
|
...REPLACEMENT_MODULE_EXTENSIONS.some(
|
|
29933
|
-
(ext) => ext ===
|
|
30335
|
+
(ext) => ext === import_node_path26.default.extname(base).toLowerCase()
|
|
29934
30336
|
) ? [base] : [],
|
|
29935
30337
|
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => base + ext),
|
|
29936
|
-
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) =>
|
|
30338
|
+
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => import_node_path26.default.join(base, `index${ext}`))
|
|
29937
30339
|
];
|
|
29938
30340
|
const found = candidates.find(
|
|
29939
|
-
(candidate) => (0,
|
|
30341
|
+
(candidate) => (0, import_node_fs25.statSync)(candidate, { throwIfNoEntry: false })?.isFile()
|
|
29940
30342
|
);
|
|
29941
30343
|
if (!found) {
|
|
29942
30344
|
throw new Error(
|
|
@@ -29991,13 +30393,13 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
29991
30393
|
res.end("missing path param");
|
|
29992
30394
|
return true;
|
|
29993
30395
|
}
|
|
29994
|
-
const extension =
|
|
30396
|
+
const extension = import_node_path26.default.extname(targetPath).toLowerCase();
|
|
29995
30397
|
if (!REPLACEMENT_MODULE_EXTENSIONS.some((allowed) => allowed === extension)) {
|
|
29996
30398
|
res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
29997
30399
|
res.end(`replacement files must be ${REPLACEMENT_MODULE_EXTENSIONS.join(", ")}`);
|
|
29998
30400
|
return true;
|
|
29999
30401
|
}
|
|
30000
|
-
if (!
|
|
30402
|
+
if (!import_node_path26.default.isAbsolute(targetPath)) {
|
|
30001
30403
|
res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
30002
30404
|
res.end("replacement file path must be absolute");
|
|
30003
30405
|
return true;
|
|
@@ -30005,10 +30407,10 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
30005
30407
|
const runtimePackages = new Set(url.searchParams.getAll("runtimePackage"));
|
|
30006
30408
|
let resolvedProjectRoot;
|
|
30007
30409
|
if (options.projectRoot) {
|
|
30008
|
-
const lexicalProjectRoot =
|
|
30410
|
+
const lexicalProjectRoot = import_node_path26.default.resolve(options.projectRoot);
|
|
30009
30411
|
resolvedProjectRoot = await import_promises5.default.realpath(options.projectRoot);
|
|
30010
|
-
const lexicalTarget =
|
|
30011
|
-
if (lexicalTarget.startsWith("..") ||
|
|
30412
|
+
const lexicalTarget = import_node_path26.default.relative(lexicalProjectRoot, targetPath);
|
|
30413
|
+
if (lexicalTarget.startsWith("..") || import_node_path26.default.isAbsolute(lexicalTarget)) {
|
|
30012
30414
|
res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
|
|
30013
30415
|
res.end("replacement file must be inside the project root");
|
|
30014
30416
|
return true;
|
|
@@ -30024,8 +30426,8 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
30024
30426
|
return true;
|
|
30025
30427
|
}
|
|
30026
30428
|
if (resolvedProjectRoot) {
|
|
30027
|
-
const relativeTarget =
|
|
30028
|
-
if (relativeTarget.startsWith("..") ||
|
|
30429
|
+
const relativeTarget = import_node_path26.default.relative(resolvedProjectRoot, resolvedTargetPath);
|
|
30430
|
+
if (relativeTarget.startsWith("..") || import_node_path26.default.isAbsolute(relativeTarget)) {
|
|
30029
30431
|
res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
|
|
30030
30432
|
res.end("replacement file must be inside the project root");
|
|
30031
30433
|
return true;
|
|
@@ -30060,13 +30462,13 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
30060
30462
|
}
|
|
30061
30463
|
return true;
|
|
30062
30464
|
}
|
|
30063
|
-
var
|
|
30465
|
+
var import_node_fs25, import_promises5, import_node_path26, REPLACEMENT_MODULE_ROUTE;
|
|
30064
30466
|
var init_replacement_module_handler = __esm({
|
|
30065
30467
|
"src/host/replacement-module-handler.ts"() {
|
|
30066
30468
|
"use strict";
|
|
30067
|
-
|
|
30469
|
+
import_node_fs25 = require("node:fs");
|
|
30068
30470
|
import_promises5 = __toESM(require("node:fs/promises"), 1);
|
|
30069
|
-
|
|
30471
|
+
import_node_path26 = __toESM(require("node:path"), 1);
|
|
30070
30472
|
init_replacementModule();
|
|
30071
30473
|
init_backend_origin();
|
|
30072
30474
|
REPLACEMENT_MODULE_ROUTE = "/__sootsim-replacement-module";
|
|
@@ -32042,8 +32444,8 @@ function metroIosAssetDestRelatives(httpServerLocation, filename) {
|
|
|
32042
32444
|
}
|
|
32043
32445
|
const out = [];
|
|
32044
32446
|
for (const dir of dirs) {
|
|
32045
|
-
const
|
|
32046
|
-
if (!out.includes(
|
|
32447
|
+
const path36 = `${dir}/${filename}`;
|
|
32448
|
+
if (!out.includes(path36)) out.push(path36);
|
|
32047
32449
|
}
|
|
32048
32450
|
if (!out.includes(filename)) out.push(filename);
|
|
32049
32451
|
return out;
|
|
@@ -32997,13 +33399,13 @@ function readFactoryStringLiterals(factory) {
|
|
|
32997
33399
|
return literals;
|
|
32998
33400
|
}
|
|
32999
33401
|
function normalizeFingerprintLiteral(literal) {
|
|
33000
|
-
const
|
|
33402
|
+
const path36 = literal.replaceAll("\\\\", "/").replaceAll("\\/", "/");
|
|
33001
33403
|
const nodeModulesMarker = "/node_modules/";
|
|
33002
|
-
const nodeModulesIndex =
|
|
33404
|
+
const nodeModulesIndex = path36.lastIndexOf(nodeModulesMarker);
|
|
33003
33405
|
if (nodeModulesIndex >= 0) {
|
|
33004
|
-
return `node_modules/${
|
|
33406
|
+
return `node_modules/${path36.slice(nodeModulesIndex + nodeModulesMarker.length)}`;
|
|
33005
33407
|
}
|
|
33006
|
-
if ((
|
|
33408
|
+
if ((path36.startsWith("/") || /^[A-Za-z]:\//.test(path36) || path36.startsWith("file:/")) && /\.[cm]?[jt]sx?(?::\d+(?::\d+)?)?$/.test(path36)) {
|
|
33007
33409
|
return null;
|
|
33008
33410
|
}
|
|
33009
33411
|
return literal;
|
|
@@ -33241,10 +33643,10 @@ function templateAssignment(template, embeddings) {
|
|
|
33241
33643
|
if (existingNode !== void 0 && existingNode !== nodeIndex) return null;
|
|
33242
33644
|
nodesByModuleId.set(moduleId, nodeIndex);
|
|
33243
33645
|
const node = template.nodes[nodeIndex];
|
|
33244
|
-
const
|
|
33646
|
+
const path36 = node.landmarkPath ?? `node_modules/${template.packageName}/__rnx_inferred__/${moduleId}.js`;
|
|
33245
33647
|
const existingPath = pathsByModuleId.get(moduleId);
|
|
33246
|
-
if (existingPath !== void 0 && existingPath !==
|
|
33247
|
-
pathsByModuleId.set(moduleId,
|
|
33648
|
+
if (existingPath !== void 0 && existingPath !== path36) return null;
|
|
33649
|
+
pathsByModuleId.set(moduleId, path36);
|
|
33248
33650
|
}
|
|
33249
33651
|
}
|
|
33250
33652
|
return {
|
|
@@ -33406,14 +33808,14 @@ async function inferMetroModuleIdentity(args) {
|
|
|
33406
33808
|
const packageClaims = claimsByPackage.values().next().value;
|
|
33407
33809
|
if (!packageClaims) continue;
|
|
33408
33810
|
const exactClaims = packageClaims.filter((assignment2) => {
|
|
33409
|
-
const
|
|
33410
|
-
return
|
|
33811
|
+
const path36 = assignment2.pathsByModuleId.get(moduleId);
|
|
33812
|
+
return path36 !== void 0 && !path36.includes("/__rnx_inferred__/");
|
|
33411
33813
|
});
|
|
33412
33814
|
const preferredClaims = exactClaims.length > 0 ? exactClaims : packageClaims;
|
|
33413
33815
|
const routes = new Set(
|
|
33414
33816
|
preferredClaims.flatMap((assignment2) => {
|
|
33415
|
-
const
|
|
33416
|
-
return
|
|
33817
|
+
const path36 = assignment2.pathsByModuleId.get(moduleId);
|
|
33818
|
+
return path36 ? [metroFingerprintModuleClaimRoute(assignment2.packageName, path36)] : [];
|
|
33417
33819
|
})
|
|
33418
33820
|
);
|
|
33419
33821
|
if (routes.size !== 1) continue;
|
|
@@ -33708,8 +34110,8 @@ function detectFramework2(deps) {
|
|
|
33708
34110
|
return "unknown";
|
|
33709
34111
|
}
|
|
33710
34112
|
function detectProject(dir) {
|
|
33711
|
-
const pkgPath = (0,
|
|
33712
|
-
if (!(0,
|
|
34113
|
+
const pkgPath = (0, import_node_path27.join)(dir, "package.json");
|
|
34114
|
+
if (!(0, import_node_fs26.existsSync)(pkgPath)) return null;
|
|
33713
34115
|
const pkg = readProjectManifest(dir);
|
|
33714
34116
|
if (!pkg) return null;
|
|
33715
34117
|
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
@@ -33721,25 +34123,25 @@ function detectProject(dir) {
|
|
|
33721
34123
|
if (framework === "unknown") return null;
|
|
33722
34124
|
return {
|
|
33723
34125
|
dir,
|
|
33724
|
-
name: pkg.name || (0,
|
|
34126
|
+
name: pkg.name || (0, import_node_path27.basename)(dir),
|
|
33725
34127
|
framework,
|
|
33726
34128
|
// a config file is a config file whatever module system it declares. real
|
|
33727
34129
|
// apps write .cjs as often as .js, and missing one reads as "this project
|
|
33728
34130
|
// has no bundler config" and sends the user to create a second one.
|
|
33729
34131
|
hasViteConfig: CONFIG_EXTENSIONS.some(
|
|
33730
|
-
(ext) => (0,
|
|
34132
|
+
(ext) => (0, import_node_fs26.existsSync)((0, import_node_path27.join)(dir, `vite.config.${ext}`))
|
|
33731
34133
|
),
|
|
33732
34134
|
hasMetroConfig: CONFIG_EXTENSIONS.some(
|
|
33733
|
-
(ext) => (0,
|
|
34135
|
+
(ext) => (0, import_node_fs26.existsSync)((0, import_node_path27.join)(dir, `metro.config.${ext}`))
|
|
33734
34136
|
),
|
|
33735
34137
|
devCommand: typeof devCommand === "string" ? devCommand : null
|
|
33736
34138
|
};
|
|
33737
34139
|
}
|
|
33738
|
-
function readProjectMetadata(
|
|
34140
|
+
function readProjectMetadata(path36) {
|
|
33739
34141
|
try {
|
|
33740
|
-
const info = (0,
|
|
34142
|
+
const info = (0, import_node_fs26.lstatSync)(path36);
|
|
33741
34143
|
if (!info.isFile() || info.size > 4 * 1024 * 1024) return null;
|
|
33742
|
-
return (0,
|
|
34144
|
+
return (0, import_node_fs26.readFileSync)(path36, "utf8");
|
|
33743
34145
|
} catch {
|
|
33744
34146
|
return null;
|
|
33745
34147
|
}
|
|
@@ -33748,8 +34150,8 @@ function metadataValue(value, key) {
|
|
|
33748
34150
|
if (!value || typeof value !== "object") return void 0;
|
|
33749
34151
|
return Object.getOwnPropertyDescriptor(value, key)?.value;
|
|
33750
34152
|
}
|
|
33751
|
-
function readProjectJson(
|
|
33752
|
-
const text2 = readProjectMetadata(
|
|
34153
|
+
function readProjectJson(path36) {
|
|
34154
|
+
const text2 = readProjectMetadata(path36);
|
|
33753
34155
|
if (text2 === null) return null;
|
|
33754
34156
|
try {
|
|
33755
34157
|
const value = JSON.parse(text2);
|
|
@@ -33759,7 +34161,7 @@ function readProjectJson(path35) {
|
|
|
33759
34161
|
}
|
|
33760
34162
|
}
|
|
33761
34163
|
function readProjectManifest(dir) {
|
|
33762
|
-
const parsed = readProjectJson((0,
|
|
34164
|
+
const parsed = readProjectJson((0, import_node_path27.join)(dir, "package.json"));
|
|
33763
34165
|
if (!parsed || typeof parsed !== "object") return null;
|
|
33764
34166
|
const record2 = (value) => {
|
|
33765
34167
|
if (!value || typeof value !== "object") return {};
|
|
@@ -33776,12 +34178,12 @@ function readProjectManifest(dir) {
|
|
|
33776
34178
|
devDependencies: record2(metadataValue(parsed, "devDependencies"))
|
|
33777
34179
|
};
|
|
33778
34180
|
}
|
|
33779
|
-
var
|
|
34181
|
+
var import_node_fs26, import_node_path27, import_json52, import_yaml, CONFIG_EXTENSIONS;
|
|
33780
34182
|
var init_detect = __esm({
|
|
33781
34183
|
"cli/commands/detect.ts"() {
|
|
33782
34184
|
"use strict";
|
|
33783
|
-
|
|
33784
|
-
|
|
34185
|
+
import_node_fs26 = require("node:fs");
|
|
34186
|
+
import_node_path27 = require("node:path");
|
|
33785
34187
|
import_json52 = __toESM(require("json5"), 1);
|
|
33786
34188
|
import_yaml = require("yaml");
|
|
33787
34189
|
CONFIG_EXTENSIONS = ["ts", "js", "cjs", "mjs", "mts", "cts"];
|
|
@@ -33818,21 +34220,21 @@ function resolveCloudOrigin(value) {
|
|
|
33818
34220
|
return normalizeCloudOrigin(source);
|
|
33819
34221
|
}
|
|
33820
34222
|
function readImmutableBundleSource(bundlePath) {
|
|
33821
|
-
const filepath = (0,
|
|
33822
|
-
if ((0,
|
|
34223
|
+
const filepath = (0, import_node_path28.resolve)(bundlePath);
|
|
34224
|
+
if ((0, import_node_path28.extname)(filepath) !== ".js") {
|
|
33823
34225
|
throw new Error(`${REMOTE_COMMAND} requires one local Metro .js bundle`);
|
|
33824
34226
|
}
|
|
33825
|
-
const descriptor = (0,
|
|
34227
|
+
const descriptor = (0, import_node_fs27.openSync)(filepath, "r");
|
|
33826
34228
|
try {
|
|
33827
|
-
const before = (0,
|
|
34229
|
+
const before = (0, import_node_fs27.fstatSync)(descriptor, { bigint: true });
|
|
33828
34230
|
if (!before.isFile()) {
|
|
33829
34231
|
throw new Error(`${REMOTE_COMMAND} bundle must be a regular local file`);
|
|
33830
34232
|
}
|
|
33831
34233
|
if (before.size <= 0n) {
|
|
33832
34234
|
throw new Error(`${REMOTE_COMMAND} bundle is empty`);
|
|
33833
34235
|
}
|
|
33834
|
-
const bytes = (0,
|
|
33835
|
-
const after = (0,
|
|
34236
|
+
const bytes = (0, import_node_fs27.readFileSync)(descriptor);
|
|
34237
|
+
const after = (0, import_node_fs27.fstatSync)(descriptor, { bigint: true });
|
|
33836
34238
|
if (before.dev !== after.dev || before.ino !== after.ino || before.size !== after.size || before.mtimeNs !== after.mtimeNs || bytes.length !== Number(before.size)) {
|
|
33837
34239
|
throw new Error(`${REMOTE_COMMAND} bundle changed while it was being read`);
|
|
33838
34240
|
}
|
|
@@ -33847,7 +34249,7 @@ function readImmutableBundleSource(bundlePath) {
|
|
|
33847
34249
|
}
|
|
33848
34250
|
return source;
|
|
33849
34251
|
} finally {
|
|
33850
|
-
(0,
|
|
34252
|
+
(0, import_node_fs27.closeSync)(descriptor);
|
|
33851
34253
|
}
|
|
33852
34254
|
}
|
|
33853
34255
|
async function fetchBundleSource(bundleUrl) {
|
|
@@ -33894,15 +34296,15 @@ async function loadBundleSource(bundleInput) {
|
|
|
33894
34296
|
return readImmutableBundleSource(bundleInput);
|
|
33895
34297
|
}
|
|
33896
34298
|
function listMetroAssetDest(assetsPath) {
|
|
33897
|
-
const directory = (0,
|
|
33898
|
-
if (!(0,
|
|
33899
|
-
const skipNested = (0,
|
|
34299
|
+
const directory = (0, import_node_path28.resolve)(assetsPath);
|
|
34300
|
+
if (!(0, import_node_fs27.existsSync)(directory)) return { directory, files: [], truncated: false };
|
|
34301
|
+
const skipNested = (0, import_node_fs27.existsSync)((0, import_node_path28.join)(directory, "package.json"));
|
|
33900
34302
|
const files = [];
|
|
33901
34303
|
let truncated = false;
|
|
33902
34304
|
const walk2 = (dir, prefix) => {
|
|
33903
34305
|
let entries;
|
|
33904
34306
|
try {
|
|
33905
|
-
entries = (0,
|
|
34307
|
+
entries = (0, import_node_fs27.readdirSync)(dir, { withFileTypes: true });
|
|
33906
34308
|
} catch {
|
|
33907
34309
|
return;
|
|
33908
34310
|
}
|
|
@@ -33914,7 +34316,7 @@ function listMetroAssetDest(assetsPath) {
|
|
|
33914
34316
|
if (entry.isDirectory()) {
|
|
33915
34317
|
if (entry.name === ".git") continue;
|
|
33916
34318
|
if (skipNested && PROJECT_ONLY_DIRECTORIES.has(entry.name)) continue;
|
|
33917
|
-
walk2((0,
|
|
34319
|
+
walk2((0, import_node_path28.join)(dir, entry.name), prefix ? `${prefix}/${entry.name}` : entry.name);
|
|
33918
34320
|
} else if (entry.isFile()) {
|
|
33919
34321
|
files.push(prefix ? `${prefix}/${entry.name}` : entry.name);
|
|
33920
34322
|
}
|
|
@@ -33924,7 +34326,7 @@ function listMetroAssetDest(assetsPath) {
|
|
|
33924
34326
|
return { directory, files, truncated };
|
|
33925
34327
|
}
|
|
33926
34328
|
function metroDescriptorHash(scaleBytes) {
|
|
33927
|
-
const hasher = (0,
|
|
34329
|
+
const hasher = (0, import_node_crypto13.createHash)("md5");
|
|
33928
34330
|
for (const bytes of scaleBytes) hasher.update(bytes);
|
|
33929
34331
|
return hasher.digest("hex");
|
|
33930
34332
|
}
|
|
@@ -33949,11 +34351,11 @@ function distinctByContent(directory, options) {
|
|
|
33949
34351
|
for (const relative3 of options) {
|
|
33950
34352
|
let bytes;
|
|
33951
34353
|
try {
|
|
33952
|
-
bytes = (0,
|
|
34354
|
+
bytes = (0, import_node_fs27.readFileSync)((0, import_node_path28.join)(directory, relative3));
|
|
33953
34355
|
} catch {
|
|
33954
34356
|
continue;
|
|
33955
34357
|
}
|
|
33956
|
-
const digest = (0,
|
|
34358
|
+
const digest = (0, import_node_crypto13.createHash)("md5").update(bytes).digest("hex");
|
|
33957
34359
|
if (!byContent.has(digest)) byContent.set(digest, relative3);
|
|
33958
34360
|
}
|
|
33959
34361
|
return [...byContent.values()];
|
|
@@ -33981,13 +34383,13 @@ function placeMetroDescriptor(listing, descriptor) {
|
|
|
33981
34383
|
let bytes;
|
|
33982
34384
|
try {
|
|
33983
34385
|
bytes = combination.map(
|
|
33984
|
-
(relative3) => (0,
|
|
34386
|
+
(relative3) => (0, import_node_fs27.readFileSync)((0, import_node_path28.join)(listing.directory, relative3))
|
|
33985
34387
|
);
|
|
33986
34388
|
} catch {
|
|
33987
34389
|
continue;
|
|
33988
34390
|
}
|
|
33989
34391
|
const identical = fileHashes ? bytes.every((file, index) => {
|
|
33990
|
-
const digest = (0,
|
|
34392
|
+
const digest = (0, import_node_crypto13.createHash)("md5").update(file).digest("hex");
|
|
33991
34393
|
return descriptor.scales.some(
|
|
33992
34394
|
(scale, declared) => scale === scales[index] && fileHashes[declared] === digest
|
|
33993
34395
|
);
|
|
@@ -34009,10 +34411,10 @@ function unverifiedContentKey(dest, fileDigests) {
|
|
|
34009
34411
|
return JSON.stringify(
|
|
34010
34412
|
dest.placements.map(
|
|
34011
34413
|
(placement) => placement.verified ? null : [...placement.files].map(([scale, relative3]) => {
|
|
34012
|
-
const file = (0,
|
|
34414
|
+
const file = (0, import_node_path28.join)(dest.directory, relative3);
|
|
34013
34415
|
let digest = fileDigests.get(file);
|
|
34014
34416
|
if (digest === void 0) {
|
|
34015
|
-
digest = (0,
|
|
34417
|
+
digest = (0, import_node_crypto13.createHash)("sha256").update((0, import_node_fs27.readFileSync)(file)).digest("hex");
|
|
34016
34418
|
fileDigests.set(file, digest);
|
|
34017
34419
|
}
|
|
34018
34420
|
return [scale, digest];
|
|
@@ -34021,22 +34423,22 @@ function unverifiedContentKey(dest, fileDigests) {
|
|
|
34021
34423
|
);
|
|
34022
34424
|
}
|
|
34023
34425
|
function searchMetroAssetDest(bundlePath, descriptors) {
|
|
34024
|
-
const bundleDirectory = (0,
|
|
34426
|
+
const bundleDirectory = (0, import_node_path28.dirname)((0, import_node_path28.resolve)(bundlePath));
|
|
34025
34427
|
const candidates = [
|
|
34026
|
-
(0,
|
|
34428
|
+
(0, import_node_path28.join)(bundleDirectory, "assets"),
|
|
34027
34429
|
bundleDirectory,
|
|
34028
|
-
(0,
|
|
34430
|
+
(0, import_node_path28.resolve)(bundleDirectory, "..", "assets")
|
|
34029
34431
|
];
|
|
34030
34432
|
const cwd = process.cwd();
|
|
34031
34433
|
let projectDirectory = null;
|
|
34032
34434
|
for (const start of [bundleDirectory, cwd]) {
|
|
34033
|
-
let directory = (0,
|
|
34435
|
+
let directory = (0, import_node_path28.resolve)(start);
|
|
34034
34436
|
while (true) {
|
|
34035
34437
|
if (detectProject(directory)?.hasMetroConfig) {
|
|
34036
34438
|
projectDirectory = directory;
|
|
34037
34439
|
break;
|
|
34038
34440
|
}
|
|
34039
|
-
const parent = (0,
|
|
34441
|
+
const parent = (0, import_node_path28.dirname)(directory);
|
|
34040
34442
|
if (parent === directory) break;
|
|
34041
34443
|
directory = parent;
|
|
34042
34444
|
}
|
|
@@ -34044,11 +34446,11 @@ function searchMetroAssetDest(bundlePath, descriptors) {
|
|
|
34044
34446
|
}
|
|
34045
34447
|
if (projectDirectory) {
|
|
34046
34448
|
candidates.push(
|
|
34047
|
-
(0,
|
|
34048
|
-
(0,
|
|
34049
|
-
(0,
|
|
34050
|
-
(0,
|
|
34051
|
-
(0,
|
|
34449
|
+
(0, import_node_path28.join)(projectDirectory, "assets"),
|
|
34450
|
+
(0, import_node_path28.join)(projectDirectory, "dist"),
|
|
34451
|
+
(0, import_node_path28.join)(projectDirectory, "dist", "assets"),
|
|
34452
|
+
(0, import_node_path28.join)(projectDirectory, "build"),
|
|
34453
|
+
(0, import_node_path28.join)(projectDirectory, "build", "assets")
|
|
34052
34454
|
);
|
|
34053
34455
|
}
|
|
34054
34456
|
const searched = [];
|
|
@@ -34056,7 +34458,7 @@ function searchMetroAssetDest(bundlePath, descriptors) {
|
|
|
34056
34458
|
const stale = [];
|
|
34057
34459
|
let truncated = false;
|
|
34058
34460
|
for (const candidate of candidates) {
|
|
34059
|
-
const directory = (0,
|
|
34461
|
+
const directory = (0, import_node_path28.resolve)(candidate);
|
|
34060
34462
|
if (searched.includes(directory)) continue;
|
|
34061
34463
|
searched.push(directory);
|
|
34062
34464
|
const listing = listMetroAssetDest(directory);
|
|
@@ -34165,7 +34567,7 @@ async function embedBundleAssets(bundlePath, command, assetPolicy) {
|
|
|
34165
34567
|
);
|
|
34166
34568
|
}
|
|
34167
34569
|
const relative3 = placement?.files.get(variant.scale);
|
|
34168
|
-
if (relative3 && dest) return (0,
|
|
34570
|
+
if (relative3 && dest) return (0, import_node_fs27.readFileSync)((0, import_node_path28.join)(dest.directory, relative3));
|
|
34169
34571
|
if (placement && placement.files.size > 0) return null;
|
|
34170
34572
|
if (placement && placement.ambiguous.length > 0 && dest) {
|
|
34171
34573
|
throw new Error(
|
|
@@ -34194,7 +34596,7 @@ async function embedBundleAssets(bundlePath, command, assetPolicy) {
|
|
|
34194
34596
|
);
|
|
34195
34597
|
const classic = metroIosAssetDestRelatives(variant.descriptor.httpServerLocation, filename)[0] ?? filename;
|
|
34196
34598
|
throw new Error(
|
|
34197
|
-
`${command} could not read ${(0,
|
|
34599
|
+
`${command} could not read ${(0, import_node_path28.join)(dest?.directory ?? ".", classic)} for ${variant.descriptor.name}.${variant.descriptor.type} at scale ${variant.scale}, and has no stand-in for a .${variant.descriptor.type} asset. Rebuild with \`react-native bundle --assets-dest\`.`
|
|
34198
34600
|
);
|
|
34199
34601
|
});
|
|
34200
34602
|
return {
|
|
@@ -34235,7 +34637,7 @@ async function produceArtifact(bundlePath, maxBytes, command, assetPolicy) {
|
|
|
34235
34637
|
}
|
|
34236
34638
|
return {
|
|
34237
34639
|
bytes,
|
|
34238
|
-
sha256: (0,
|
|
34640
|
+
sha256: (0, import_node_crypto13.createHash)("sha256").update(bytes).digest("hex"),
|
|
34239
34641
|
receipt: artifact.receipt,
|
|
34240
34642
|
assetsDirectory: prepared.dest?.directory ?? null,
|
|
34241
34643
|
warnings
|
|
@@ -34380,13 +34782,13 @@ function createCloudBridgeForParsed(parsed) {
|
|
|
34380
34782
|
if (!session) return null;
|
|
34381
34783
|
return session.service === "box" ? new CloudBoxBridge(session) : new CloudBridge(session);
|
|
34382
34784
|
}
|
|
34383
|
-
var
|
|
34785
|
+
var import_node_crypto13, import_node_fs27, import_node_path28, DEFAULT_RNX_CLOUD_ORIGIN, MAX_RNX_CLOUD_BUNDLE_BYTES, REMOTE_COMMAND, MAX_ASSET_DEST_FILES, ACCOUNT_CHOICE_REFUSALS, PROJECT_ONLY_DIRECTORIES, MAX_PLACEMENT_COMBINATIONS, CloudBridge, CloudBoxBridge;
|
|
34384
34786
|
var init_cloud_client = __esm({
|
|
34385
34787
|
"cli/cloud-client.ts"() {
|
|
34386
34788
|
"use strict";
|
|
34387
|
-
|
|
34388
|
-
|
|
34389
|
-
|
|
34789
|
+
import_node_crypto13 = require("node:crypto");
|
|
34790
|
+
import_node_fs27 = require("node:fs");
|
|
34791
|
+
import_node_path28 = require("node:path");
|
|
34390
34792
|
init_metroAssetArtifact();
|
|
34391
34793
|
init_metroCloudArtifact();
|
|
34392
34794
|
init_metro_fingerprint_registry_client();
|
|
@@ -34426,7 +34828,7 @@ var init_cloud_client = __esm({
|
|
|
34426
34828
|
plane = "cloud";
|
|
34427
34829
|
async send(command, options) {
|
|
34428
34830
|
const body = {
|
|
34429
|
-
id: (0,
|
|
34831
|
+
id: (0, import_node_crypto13.randomUUID)(),
|
|
34430
34832
|
claimId: this.session.claimId,
|
|
34431
34833
|
command: cloudCommand(command)
|
|
34432
34834
|
};
|
|
@@ -34496,7 +34898,7 @@ var init_cloud_client = __esm({
|
|
|
34496
34898
|
}
|
|
34497
34899
|
plane = "cloud";
|
|
34498
34900
|
async send(command, options) {
|
|
34499
|
-
const id = (0,
|
|
34901
|
+
const id = (0, import_node_crypto13.randomUUID)();
|
|
34500
34902
|
const payload = {};
|
|
34501
34903
|
for (const [key, value] of Object.entries(command)) {
|
|
34502
34904
|
if (key !== "id" && key !== "simId") payload[key] = value;
|
|
@@ -36898,31 +37300,31 @@ var init_parent_pid = __esm({
|
|
|
36898
37300
|
|
|
36899
37301
|
// cli/secure-file.ts
|
|
36900
37302
|
function writeSecureJsonAtomic(filepath, value) {
|
|
36901
|
-
(0,
|
|
36902
|
-
const temporary = `${filepath}.tmp-${process.pid}-${(0,
|
|
37303
|
+
(0, import_node_fs28.mkdirSync)((0, import_node_path29.dirname)(filepath), { recursive: true });
|
|
37304
|
+
const temporary = `${filepath}.tmp-${process.pid}-${(0, import_node_crypto14.randomUUID)()}`;
|
|
36903
37305
|
let descriptor = null;
|
|
36904
37306
|
try {
|
|
36905
|
-
descriptor = (0,
|
|
36906
|
-
(0,
|
|
36907
|
-
(0,
|
|
37307
|
+
descriptor = (0, import_node_fs28.openSync)(temporary, "wx", 384);
|
|
37308
|
+
(0, import_node_fs28.fchmodSync)(descriptor, 384);
|
|
37309
|
+
(0, import_node_fs28.writeFileSync)(descriptor, `${JSON.stringify(value, null, 2)}
|
|
36908
37310
|
`);
|
|
36909
|
-
(0,
|
|
36910
|
-
(0,
|
|
37311
|
+
(0, import_node_fs28.fsyncSync)(descriptor);
|
|
37312
|
+
(0, import_node_fs28.closeSync)(descriptor);
|
|
36911
37313
|
descriptor = null;
|
|
36912
|
-
(0,
|
|
37314
|
+
(0, import_node_fs28.renameSync)(temporary, filepath);
|
|
36913
37315
|
} catch (error) {
|
|
36914
|
-
if (descriptor !== null) (0,
|
|
36915
|
-
(0,
|
|
37316
|
+
if (descriptor !== null) (0, import_node_fs28.closeSync)(descriptor);
|
|
37317
|
+
(0, import_node_fs28.rmSync)(temporary, { force: true });
|
|
36916
37318
|
throw error;
|
|
36917
37319
|
}
|
|
36918
37320
|
}
|
|
36919
|
-
var
|
|
37321
|
+
var import_node_crypto14, import_node_fs28, import_node_path29;
|
|
36920
37322
|
var init_secure_file = __esm({
|
|
36921
37323
|
"cli/secure-file.ts"() {
|
|
36922
37324
|
"use strict";
|
|
36923
|
-
|
|
36924
|
-
|
|
36925
|
-
|
|
37325
|
+
import_node_crypto14 = require("node:crypto");
|
|
37326
|
+
import_node_fs28 = require("node:fs");
|
|
37327
|
+
import_node_path29 = require("node:path");
|
|
36926
37328
|
}
|
|
36927
37329
|
});
|
|
36928
37330
|
|
|
@@ -37107,17 +37509,17 @@ function liveDevBridgeLockfiles() {
|
|
|
37107
37509
|
return readDevBridgeLockfiles().filter((lockfile) => isDevBridgeLockfileFresh(lockfile));
|
|
37108
37510
|
}
|
|
37109
37511
|
function checkoutRoot(cwd) {
|
|
37110
|
-
let current =
|
|
37512
|
+
let current = import_node_path30.default.resolve(cwd);
|
|
37111
37513
|
while (true) {
|
|
37112
|
-
if (
|
|
37113
|
-
const parent =
|
|
37514
|
+
if (import_node_fs29.default.existsSync(import_node_path30.default.join(current, ".git"))) return current;
|
|
37515
|
+
const parent = import_node_path30.default.dirname(current);
|
|
37114
37516
|
if (parent === current) return null;
|
|
37115
37517
|
current = parent;
|
|
37116
37518
|
}
|
|
37117
37519
|
}
|
|
37118
37520
|
function pathContains(parent, child) {
|
|
37119
|
-
const relative3 =
|
|
37120
|
-
return relative3 === "" || relative3 !== ".." && !relative3.startsWith(`..${
|
|
37521
|
+
const relative3 = import_node_path30.default.relative(parent, child);
|
|
37522
|
+
return relative3 === "" || relative3 !== ".." && !relative3.startsWith(`..${import_node_path30.default.sep}`) && !import_node_path30.default.isAbsolute(relative3);
|
|
37121
37523
|
}
|
|
37122
37524
|
function resolveDefaultDevBridgeLockfile() {
|
|
37123
37525
|
const lockfiles = liveDevBridgeLockfiles();
|
|
@@ -37617,18 +38019,18 @@ async function evalInBridge(bridge, code, opts = {}) {
|
|
|
37617
38019
|
if (opts.acquireLock) payload.acquireLock = true;
|
|
37618
38020
|
return bridge.send(payload);
|
|
37619
38021
|
}
|
|
37620
|
-
async function callInBridge(bridge,
|
|
37621
|
-
return bridge.send({ type: "call", path:
|
|
38022
|
+
async function callInBridge(bridge, path36, ...args) {
|
|
38023
|
+
return bridge.send({ type: "call", path: path36, args });
|
|
37622
38024
|
}
|
|
37623
|
-
async function callInBridgeWrite(bridge,
|
|
37624
|
-
return bridge.send({ type: "call", path:
|
|
38025
|
+
async function callInBridgeWrite(bridge, path36, ...args) {
|
|
38026
|
+
return bridge.send({ type: "call", path: path36, args, acquireLock: true });
|
|
37625
38027
|
}
|
|
37626
|
-
var
|
|
38028
|
+
var import_node_fs29, import_node_path30, import_ws2, PEACH_PLACEMENT_ENV, resolvedWorld, BridgeSimLockedError, BRIDGE_VALUE_FLAGS_TABLE, BRIDGE_VALUE_FLAGS;
|
|
37627
38029
|
var init_ws_bridge = __esm({
|
|
37628
38030
|
"cli/ws-bridge.ts"() {
|
|
37629
38031
|
"use strict";
|
|
37630
|
-
|
|
37631
|
-
|
|
38032
|
+
import_node_fs29 = __toESM(require("node:fs"), 1);
|
|
38033
|
+
import_node_path30 = __toESM(require("node:path"), 1);
|
|
37632
38034
|
import_ws2 = require("ws");
|
|
37633
38035
|
init_bridge_constants();
|
|
37634
38036
|
init_cli_constants();
|
|
@@ -37756,8 +38158,8 @@ function getDefaultPortForProtocol(protocol) {
|
|
|
37756
38158
|
return protocol === "https:" ? 443 : 80;
|
|
37757
38159
|
}
|
|
37758
38160
|
function isBaseServerUrl(url) {
|
|
37759
|
-
const
|
|
37760
|
-
return (
|
|
38161
|
+
const path36 = url.pathname || "/";
|
|
38162
|
+
return (path36 === "/" || path36 === "") && !url.search && !url.hash;
|
|
37761
38163
|
}
|
|
37762
38164
|
async function resolvePortViaServerScan(port) {
|
|
37763
38165
|
try {
|
|
@@ -37921,8 +38323,8 @@ var init_dev_bundle_resolution = __esm({
|
|
|
37921
38323
|
|
|
37922
38324
|
// src/dot-env.ts
|
|
37923
38325
|
function selectEnvFile(env, notices) {
|
|
37924
|
-
if (
|
|
37925
|
-
return { name:
|
|
38326
|
+
if (import_node_fs30.default.existsSync("/tmp/envfile")) {
|
|
38327
|
+
return { name: import_node_fs30.default.readFileSync("/tmp/envfile", "utf8").trim(), fromEnvfile: false };
|
|
37926
38328
|
}
|
|
37927
38329
|
const requested = env.ENVFILE;
|
|
37928
38330
|
if (!requested) return { name: DEFAULT_ENV_FILE, fromEnvfile: false };
|
|
@@ -37985,16 +38387,16 @@ function readProjectDotEnv(envsRoot, env = process.env) {
|
|
|
37985
38387
|
const notices = [];
|
|
37986
38388
|
const selection = selectEnvFile(env, notices);
|
|
37987
38389
|
const requestedPaths = [
|
|
37988
|
-
|
|
37989
|
-
|
|
38390
|
+
import_node_path31.default.resolve(import_node_path31.default.join(envsRoot, selection.name)),
|
|
38391
|
+
import_node_path31.default.resolve(selection.name)
|
|
37990
38392
|
];
|
|
37991
38393
|
const candidates = [
|
|
37992
38394
|
...requestedPaths,
|
|
37993
|
-
|
|
38395
|
+
import_node_path31.default.resolve(import_node_path31.default.join(envsRoot, DEFAULT_ENV_FILE))
|
|
37994
38396
|
];
|
|
37995
|
-
if (!
|
|
38397
|
+
if (!import_node_fs30.default.existsSync(candidates[2])) candidates.push(import_node_path31.default.resolve(DEFAULT_ENV_FILE));
|
|
37996
38398
|
const tried = [...new Set(candidates)];
|
|
37997
|
-
const resolved = tried.find((candidate) =>
|
|
38399
|
+
const resolved = tried.find((candidate) => import_node_fs30.default.existsSync(candidate));
|
|
37998
38400
|
if (!resolved) {
|
|
37999
38401
|
notices.push(
|
|
38000
38402
|
"*** Missing .env file ****",
|
|
@@ -38014,7 +38416,7 @@ function readProjectDotEnv(envsRoot, env = process.env) {
|
|
|
38014
38416
|
);
|
|
38015
38417
|
}
|
|
38016
38418
|
const config = {};
|
|
38017
|
-
for (const line of
|
|
38419
|
+
for (const line of import_node_fs30.default.readFileSync(resolved, "utf8").split("\n")) {
|
|
38018
38420
|
if (!line.trim()) continue;
|
|
38019
38421
|
if (/^[ \t\n\v\f\r]*#/.test(line)) continue;
|
|
38020
38422
|
const match = DOTENV_PATTERN.exec(line);
|
|
@@ -38024,12 +38426,12 @@ function readProjectDotEnv(envsRoot, env = process.env) {
|
|
|
38024
38426
|
}
|
|
38025
38427
|
return { config, notices };
|
|
38026
38428
|
}
|
|
38027
|
-
var
|
|
38429
|
+
var import_node_fs30, import_node_path31, DEFAULT_ENV_FILE, DOTENV_PATTERN, BUILD_SETTING_PATTERN, INVALID_ENTRY;
|
|
38028
38430
|
var init_dot_env = __esm({
|
|
38029
38431
|
"src/dot-env.ts"() {
|
|
38030
38432
|
"use strict";
|
|
38031
|
-
|
|
38032
|
-
|
|
38433
|
+
import_node_fs30 = __toESM(require("node:fs"), 1);
|
|
38434
|
+
import_node_path31 = __toESM(require("node:path"), 1);
|
|
38033
38435
|
DEFAULT_ENV_FILE = ".env";
|
|
38034
38436
|
DOTENV_PATTERN = /^(?:export[ \t\n\v\f\r]+|)(?<key>[\p{Alphabetic}\p{Nd}_]+)[ \t\n\v\f\r]*=[ \t\n\v\f\r]*((?<quote>["'])?(?<val>[^\n]*?[^\\\n])\k<quote>?|)$/u;
|
|
38035
38437
|
BUILD_SETTING_PATTERN = /\$[({]([A-Za-z_][A-Za-z0-9_]*)[)}]|\$([A-Za-z_][A-Za-z0-9_]*)/g;
|
|
@@ -38053,8 +38455,8 @@ var init_flow_timeout_scale = __esm({
|
|
|
38053
38455
|
function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
38054
38456
|
const result = {};
|
|
38055
38457
|
let config = {};
|
|
38056
|
-
const appJsonPath =
|
|
38057
|
-
const appJson =
|
|
38458
|
+
const appJsonPath = import_node_path32.default.join(projectRoot, "app.json");
|
|
38459
|
+
const appJson = import_node_fs31.default.existsSync(appJsonPath) ? JSON.parse(import_node_fs31.default.readFileSync(appJsonPath, "utf8")) : null;
|
|
38058
38460
|
const staticExpo = isRecord(appJson) && (isRecord(appJson.expo) || [appJson.ios, appJson.android].some(
|
|
38059
38461
|
(value) => isRecord(value) && typeof value.googleServicesFile === "string"
|
|
38060
38462
|
));
|
|
@@ -38063,9 +38465,9 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
38063
38465
|
"app.config.ts",
|
|
38064
38466
|
"app.config.cjs",
|
|
38065
38467
|
"app.config.mjs"
|
|
38066
|
-
].some((name2) =>
|
|
38468
|
+
].some((name2) => import_node_fs31.default.existsSync(import_node_path32.default.join(projectRoot, name2)));
|
|
38067
38469
|
if (staticExpo || dynamicExpo) {
|
|
38068
|
-
const require5 = (0, import_node_module2.createRequire)(
|
|
38470
|
+
const require5 = (0, import_node_module2.createRequire)(import_node_path32.default.join(projectRoot, "package.json"));
|
|
38069
38471
|
const configModule = require5("@expo/config");
|
|
38070
38472
|
if (!isRecord(configModule) || typeof configModule.getConfig !== "function")
|
|
38071
38473
|
throw new Error("Expo native configuration is unavailable.");
|
|
@@ -38077,23 +38479,23 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
38077
38479
|
}
|
|
38078
38480
|
const ios = config.ios;
|
|
38079
38481
|
if (platforms.includes("ios") && (!isRecord(ios) || typeof ios.googleServicesFile !== "string")) {
|
|
38080
|
-
const iosRoot =
|
|
38081
|
-
if (
|
|
38082
|
-
const projects2 =
|
|
38482
|
+
const iosRoot = import_node_path32.default.join(projectRoot, "ios");
|
|
38483
|
+
if (import_node_fs31.default.existsSync(iosRoot)) {
|
|
38484
|
+
const projects2 = import_node_fs31.default.readdirSync(iosRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory() && entry.name.endsWith(".xcodeproj"));
|
|
38083
38485
|
if (projects2.length > 1)
|
|
38084
38486
|
throw new Error("native Firebase configuration requires a selected Xcode project");
|
|
38085
38487
|
if (projects2.length === 1) {
|
|
38086
|
-
const xcodeproj =
|
|
38488
|
+
const xcodeproj = import_node_path32.default.join(iosRoot, projects2[0].name);
|
|
38087
38489
|
const appTargets = listXcodeAppTargets(xcodeproj);
|
|
38088
38490
|
if (appTargets.length > 1)
|
|
38089
38491
|
throw new Error("native Firebase configuration requires a selected app target");
|
|
38090
38492
|
if (appTargets.length === 1) {
|
|
38091
38493
|
const app = readXcodeAppTarget(xcodeproj, appTargets[0]);
|
|
38092
38494
|
const delegates = app.allSources.filter(
|
|
38093
|
-
(file) => /^AppDelegate\.(swift|mm|m)$/.test(
|
|
38495
|
+
(file) => /^AppDelegate\.(swift|mm|m)$/.test(import_node_path32.default.basename(file))
|
|
38094
38496
|
);
|
|
38095
38497
|
const defaultConfigured = delegates.some((file) => {
|
|
38096
|
-
const source =
|
|
38498
|
+
const source = import_node_fs31.default.readFileSync(file, "utf8").replace(
|
|
38097
38499
|
/\/\*[\s\S]*?\*\/|\/\/[^\n]*|"(?:\\.|[^"\\])*"/g,
|
|
38098
38500
|
(token) => token.startsWith('"') ? '""' : token.replace(/[^\n]/g, " ")
|
|
38099
38501
|
);
|
|
@@ -38121,15 +38523,15 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
38121
38523
|
});
|
|
38122
38524
|
if (defaultConfigured) {
|
|
38123
38525
|
const resources = app.resources.filter(
|
|
38124
|
-
(file) => /^GoogleService-Info\.plist$/.test(
|
|
38526
|
+
(file) => /^GoogleService-Info\.plist$/.test(import_node_path32.default.basename(file))
|
|
38125
38527
|
);
|
|
38126
38528
|
if (resources.length !== 1)
|
|
38127
38529
|
throw new Error(
|
|
38128
38530
|
"native Firebase default initialization requires one GoogleService-Info.plist build resource"
|
|
38129
38531
|
);
|
|
38130
38532
|
config.ios = {
|
|
38131
|
-
googleServicesFile:
|
|
38132
|
-
|
|
38533
|
+
googleServicesFile: import_node_path32.default.relative(
|
|
38534
|
+
import_node_fs31.default.realpathSync(projectRoot),
|
|
38133
38535
|
resources[0]
|
|
38134
38536
|
)
|
|
38135
38537
|
};
|
|
@@ -38142,8 +38544,8 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
38142
38544
|
const native = config[platform];
|
|
38143
38545
|
if (!isRecord(native) || typeof native.googleServicesFile !== "string") continue;
|
|
38144
38546
|
try {
|
|
38145
|
-
const source =
|
|
38146
|
-
|
|
38547
|
+
const source = import_node_fs31.default.readFileSync(
|
|
38548
|
+
import_node_path32.default.resolve(projectRoot, native.googleServicesFile),
|
|
38147
38549
|
"utf8"
|
|
38148
38550
|
);
|
|
38149
38551
|
const parsed = platform === "ios" ? parsePlistSource(source) : JSON.parse(source);
|
|
@@ -38195,13 +38597,13 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
38195
38597
|
}
|
|
38196
38598
|
return result;
|
|
38197
38599
|
}
|
|
38198
|
-
var
|
|
38600
|
+
var import_node_fs31, import_node_module2, import_node_path32;
|
|
38199
38601
|
var init_native_firebase_config = __esm({
|
|
38200
38602
|
"src/native-firebase-config.ts"() {
|
|
38201
38603
|
"use strict";
|
|
38202
|
-
|
|
38604
|
+
import_node_fs31 = __toESM(require("node:fs"), 1);
|
|
38203
38605
|
import_node_module2 = require("node:module");
|
|
38204
|
-
|
|
38606
|
+
import_node_path32 = __toESM(require("node:path"), 1);
|
|
38205
38607
|
init_is_record();
|
|
38206
38608
|
init_plist();
|
|
38207
38609
|
init_xcode_project();
|
|
@@ -38315,59 +38717,59 @@ var init_profiles = __esm({
|
|
|
38315
38717
|
// cli/app-catalog.ts
|
|
38316
38718
|
function listDir(dir) {
|
|
38317
38719
|
try {
|
|
38318
|
-
return
|
|
38720
|
+
return import_node_fs32.default.readdirSync(dir, { withFileTypes: true });
|
|
38319
38721
|
} catch {
|
|
38320
38722
|
return [];
|
|
38321
38723
|
}
|
|
38322
38724
|
}
|
|
38323
38725
|
function readText(file) {
|
|
38324
38726
|
try {
|
|
38325
|
-
return
|
|
38727
|
+
return import_node_fs32.default.readFileSync(file, "utf8");
|
|
38326
38728
|
} catch {
|
|
38327
38729
|
return null;
|
|
38328
38730
|
}
|
|
38329
38731
|
}
|
|
38330
38732
|
function catalogFiles(dir, found) {
|
|
38331
38733
|
for (const entry of listDir(dir)) {
|
|
38332
|
-
const full =
|
|
38734
|
+
const full = import_node_path33.default.join(dir, entry.name);
|
|
38333
38735
|
if (entry.isDirectory()) catalogFiles(full, found);
|
|
38334
38736
|
else if (entry.name === "Contents.json") found.push(full);
|
|
38335
38737
|
}
|
|
38336
38738
|
}
|
|
38337
38739
|
function discoverAppCatalog(appDir) {
|
|
38338
|
-
const iosDir =
|
|
38740
|
+
const iosDir = import_node_path33.default.join(appDir, "ios");
|
|
38339
38741
|
const target = listDir(iosDir).find(
|
|
38340
|
-
(entry) => entry.isDirectory() && entry.name !== "Pods" && listDir(
|
|
38742
|
+
(entry) => entry.isDirectory() && entry.name !== "Pods" && listDir(import_node_path33.default.join(iosDir, entry.name)).some(
|
|
38341
38743
|
(file) => /^AppDelegate\.(swift|mm|m)$/.test(file.name)
|
|
38342
38744
|
)
|
|
38343
38745
|
);
|
|
38344
38746
|
if (!target) return null;
|
|
38345
|
-
const targetDir =
|
|
38747
|
+
const targetDir = import_node_path33.default.join(iosDir, target.name);
|
|
38346
38748
|
const files = [];
|
|
38347
38749
|
for (const entry of listDir(targetDir)) {
|
|
38348
38750
|
if (entry.isDirectory() && entry.name.endsWith(".xcassets"))
|
|
38349
|
-
catalogFiles(
|
|
38751
|
+
catalogFiles(import_node_path33.default.join(targetDir, entry.name), files);
|
|
38350
38752
|
}
|
|
38351
38753
|
const relative3 = files.map(
|
|
38352
|
-
(file) =>
|
|
38754
|
+
(file) => import_node_path33.default.relative(targetDir, file).split(import_node_path33.default.sep).join(import_node_path33.default.posix.sep)
|
|
38353
38755
|
);
|
|
38354
38756
|
const colors = enumerateBundleColors(
|
|
38355
38757
|
relative3,
|
|
38356
|
-
(candidate) => candidate.endsWith("Contents.json") ? readText(
|
|
38758
|
+
(candidate) => candidate.endsWith("Contents.json") ? readText(import_node_path33.default.join(targetDir, candidate)) : null
|
|
38357
38759
|
);
|
|
38358
38760
|
const pbxproj = listDir(iosDir).find((entry) => entry.name.endsWith(".xcodeproj"));
|
|
38359
|
-
const accentName = readText(
|
|
38761
|
+
const accentName = readText(import_node_path33.default.join(targetDir, "Info.plist"))?.match(PLIST_ACCENT)?.[1] ?? (pbxproj ? readText(import_node_path33.default.join(iosDir, pbxproj.name, "project.pbxproj"))?.match(
|
|
38360
38762
|
ACCENT_BUILD_SETTING
|
|
38361
38763
|
)?.[1] : void 0) ?? null;
|
|
38362
38764
|
if (accentName === null && Object.keys(colors).length === 0) return null;
|
|
38363
38765
|
return { colors, accentName };
|
|
38364
38766
|
}
|
|
38365
|
-
var
|
|
38767
|
+
var import_node_fs32, import_node_path33, ACCENT_BUILD_SETTING, PLIST_ACCENT;
|
|
38366
38768
|
var init_app_catalog = __esm({
|
|
38367
38769
|
"cli/app-catalog.ts"() {
|
|
38368
38770
|
"use strict";
|
|
38369
|
-
|
|
38370
|
-
|
|
38771
|
+
import_node_fs32 = __toESM(require("node:fs"), 1);
|
|
38772
|
+
import_node_path33 = __toESM(require("node:path"), 1);
|
|
38371
38773
|
init_bundleAssets();
|
|
38372
38774
|
ACCENT_BUILD_SETTING = /ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = "?([^";]+)"?;/;
|
|
38373
38775
|
PLIST_ACCENT = /<key>NSAccentColorName<\/key>\s*<string>([^<]+)<\/string>/;
|
|
@@ -38377,9 +38779,9 @@ var init_app_catalog = __esm({
|
|
|
38377
38779
|
// cli/app-project.ts
|
|
38378
38780
|
function firstNamedFile(dir, names) {
|
|
38379
38781
|
for (const name2 of names) {
|
|
38380
|
-
const candidate =
|
|
38782
|
+
const candidate = import_node_path34.default.join(dir, name2);
|
|
38381
38783
|
try {
|
|
38382
|
-
if (
|
|
38784
|
+
if (import_node_fs33.default.statSync(candidate).isFile()) return candidate;
|
|
38383
38785
|
} catch {
|
|
38384
38786
|
}
|
|
38385
38787
|
}
|
|
@@ -38392,24 +38794,24 @@ function findRNXAppConfig(dir) {
|
|
|
38392
38794
|
return firstNamedFile(dir, PEACH_APP_CONFIG_NAMES);
|
|
38393
38795
|
}
|
|
38394
38796
|
function resolveAppProject(projectRoot) {
|
|
38395
|
-
const appDir =
|
|
38797
|
+
const appDir = import_node_path34.default.resolve(projectRoot);
|
|
38396
38798
|
try {
|
|
38397
|
-
if (!
|
|
38799
|
+
if (!import_node_fs33.default.statSync(appDir).isDirectory()) return null;
|
|
38398
38800
|
} catch {
|
|
38399
38801
|
return null;
|
|
38400
38802
|
}
|
|
38401
38803
|
const configPath = findRNXAppConfig(appDir);
|
|
38402
|
-
if (!configPath && !findExpoAppConfig(appDir) && !
|
|
38804
|
+
if (!configPath && !findExpoAppConfig(appDir) && !import_node_fs33.default.existsSync(import_node_path34.default.join(appDir, "package.json"))) {
|
|
38403
38805
|
return null;
|
|
38404
38806
|
}
|
|
38405
38807
|
return { appDir, configPath };
|
|
38406
38808
|
}
|
|
38407
|
-
var
|
|
38809
|
+
var import_node_fs33, import_node_path34, EXPO_APP_CONFIG_NAMES, PEACH_APP_CONFIG_NAMES;
|
|
38408
38810
|
var init_app_project = __esm({
|
|
38409
38811
|
"cli/app-project.ts"() {
|
|
38410
38812
|
"use strict";
|
|
38411
|
-
|
|
38412
|
-
|
|
38813
|
+
import_node_fs33 = __toESM(require("node:fs"), 1);
|
|
38814
|
+
import_node_path34 = __toESM(require("node:path"), 1);
|
|
38413
38815
|
EXPO_APP_CONFIG_NAMES = [
|
|
38414
38816
|
"app.config.js",
|
|
38415
38817
|
"app.config.ts",
|
|
@@ -38432,12 +38834,12 @@ function resolveFileEntries(entries, configDir) {
|
|
|
38432
38834
|
return Object.fromEntries(
|
|
38433
38835
|
Object.entries(entries).map(([name2, resolution]) => [
|
|
38434
38836
|
name2,
|
|
38435
|
-
resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file:
|
|
38837
|
+
resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file: import_node_path35.default.resolve(configDir, resolution.file) } : resolution
|
|
38436
38838
|
])
|
|
38437
38839
|
);
|
|
38438
38840
|
}
|
|
38439
38841
|
function resolveConfigReplacementFiles(config, configPath) {
|
|
38440
|
-
const configDir =
|
|
38842
|
+
const configDir = import_node_path35.default.dirname(configPath);
|
|
38441
38843
|
return {
|
|
38442
38844
|
...config,
|
|
38443
38845
|
modules: resolveFileEntries(config.modules, configDir),
|
|
@@ -38474,12 +38876,12 @@ async function resolveRNXAppConfig(startDir = process.cwd()) {
|
|
|
38474
38876
|
const project = resolveAppProject(startDir);
|
|
38475
38877
|
return { project, config: await loadRNXAppConfig(project) };
|
|
38476
38878
|
}
|
|
38477
|
-
var import_node_module3,
|
|
38879
|
+
var import_node_module3, import_node_path35, import_jiti, require2;
|
|
38478
38880
|
var init_app_config = __esm({
|
|
38479
38881
|
"cli/app-config.ts"() {
|
|
38480
38882
|
"use strict";
|
|
38481
38883
|
import_node_module3 = require("node:module");
|
|
38482
|
-
|
|
38884
|
+
import_node_path35 = __toESM(require("node:path"), 1);
|
|
38483
38885
|
import_jiti = require("jiti");
|
|
38484
38886
|
init_config();
|
|
38485
38887
|
init_public_brand();
|
|
@@ -38536,13 +38938,13 @@ function discoverNativeLinkedAppFonts(opts) {
|
|
|
38536
38938
|
scannedFontDirectories++;
|
|
38537
38939
|
let entries;
|
|
38538
38940
|
try {
|
|
38539
|
-
entries =
|
|
38941
|
+
entries = import_node_fs34.default.readdirSync(current.dir, { withFileTypes: true });
|
|
38540
38942
|
} catch {
|
|
38541
38943
|
continue;
|
|
38542
38944
|
}
|
|
38543
38945
|
for (const entry of entries) {
|
|
38544
38946
|
if (entry.isSymbolicLink()) continue;
|
|
38545
|
-
const fullPath =
|
|
38947
|
+
const fullPath = import_node_path36.default.join(current.dir, entry.name);
|
|
38546
38948
|
if (entry.isDirectory()) {
|
|
38547
38949
|
if (current.depth < 4 && pending.length < 64 && !entry.name.startsWith(".")) {
|
|
38548
38950
|
pending.push({ dir: fullPath, depth: current.depth + 1 });
|
|
@@ -38550,15 +38952,15 @@ function discoverNativeLinkedAppFonts(opts) {
|
|
|
38550
38952
|
continue;
|
|
38551
38953
|
}
|
|
38552
38954
|
if (!entry.isFile() || !/\.(ttf|otf|woff|woff2)$/i.test(entry.name)) continue;
|
|
38553
|
-
const relative3 =
|
|
38554
|
-
fontPaths.push(
|
|
38955
|
+
const relative3 = import_node_path36.default.relative(root, fullPath).split(import_node_path36.default.sep).join("/");
|
|
38956
|
+
fontPaths.push(import_node_path36.default.posix.join(metroPathPrefix, relative3));
|
|
38555
38957
|
if (fontPaths.length >= 256) break;
|
|
38556
38958
|
}
|
|
38557
38959
|
}
|
|
38558
38960
|
};
|
|
38559
38961
|
try {
|
|
38560
38962
|
const packageJson = JSON.parse(
|
|
38561
|
-
|
|
38963
|
+
import_node_fs34.default.readFileSync(import_node_path36.default.join(selectedAppDir, "package.json"), "utf8")
|
|
38562
38964
|
);
|
|
38563
38965
|
const dependencyNames = /* @__PURE__ */ new Set();
|
|
38564
38966
|
for (const field of ["dependencies", "devDependencies", "optionalDependencies"]) {
|
|
@@ -38573,32 +38975,32 @@ function discoverNativeLinkedAppFonts(opts) {
|
|
|
38573
38975
|
const config = Reflect.get(packageJson, "reactNativeVectorIcons");
|
|
38574
38976
|
const configuredFontDir = config && typeof config === "object" ? Reflect.get(config, "fontDir") : null;
|
|
38575
38977
|
const configuredDir = typeof configuredFontDir === "string" ? configuredFontDir : "rnvi-fonts";
|
|
38576
|
-
const root =
|
|
38577
|
-
const relativeRoot =
|
|
38578
|
-
if (!relativeRoot.startsWith("..") && !
|
|
38579
|
-
collectFontFiles(root, relativeRoot.split(
|
|
38978
|
+
const root = import_node_path36.default.resolve(selectedAppDir, configuredDir);
|
|
38979
|
+
const relativeRoot = import_node_path36.default.relative(selectedAppDir, root);
|
|
38980
|
+
if (!relativeRoot.startsWith("..") && !import_node_path36.default.isAbsolute(relativeRoot)) {
|
|
38981
|
+
collectFontFiles(root, relativeRoot.split(import_node_path36.default.sep).join("/"));
|
|
38580
38982
|
}
|
|
38581
|
-
const bundleDir =
|
|
38582
|
-
const appRelativeDir = bundleDir.split("/").join(
|
|
38983
|
+
const bundleDir = import_node_path36.default.posix.dirname(new URL(opts.bundleUrl).pathname).replace(/^\/+/, "");
|
|
38984
|
+
const appRelativeDir = bundleDir.split("/").join(import_node_path36.default.sep);
|
|
38583
38985
|
const metroRootCandidates = [selectedAppDir];
|
|
38584
|
-
if (bundleDir && selectedAppDir.endsWith(
|
|
38986
|
+
if (bundleDir && selectedAppDir.endsWith(import_node_path36.default.sep + appRelativeDir)) {
|
|
38585
38987
|
metroRootCandidates.push(selectedAppDir.slice(0, -appRelativeDir.length - 1));
|
|
38586
38988
|
}
|
|
38587
|
-
const vectorIconRequire = (0, import_node_module4.createRequire)(
|
|
38989
|
+
const vectorIconRequire = (0, import_node_module4.createRequire)(import_node_path36.default.join(selectedAppDir, "package.json"));
|
|
38588
38990
|
for (const dependencyName of vectorIconDependencies) {
|
|
38589
38991
|
try {
|
|
38590
38992
|
const entryPath = vectorIconRequire.resolve(dependencyName);
|
|
38591
|
-
const dependencyPath = dependencyName.split("/").join(
|
|
38592
|
-
const marker = `${
|
|
38993
|
+
const dependencyPath = dependencyName.split("/").join(import_node_path36.default.sep);
|
|
38994
|
+
const marker = `${import_node_path36.default.sep}node_modules${import_node_path36.default.sep}${dependencyPath}${import_node_path36.default.sep}`;
|
|
38593
38995
|
const markerIndex = entryPath.lastIndexOf(marker);
|
|
38594
38996
|
if (markerIndex === -1) continue;
|
|
38595
38997
|
const packageRoot = entryPath.slice(0, markerIndex + marker.length - 1);
|
|
38596
38998
|
const fontsDir = dependencyName === "react-native-vector-icons" ? "Fonts" : "fonts";
|
|
38597
|
-
const fontsRoot =
|
|
38999
|
+
const fontsRoot = import_node_path36.default.join(packageRoot, fontsDir);
|
|
38598
39000
|
for (const metroRoot of metroRootCandidates) {
|
|
38599
39001
|
collectFontFiles(
|
|
38600
39002
|
fontsRoot,
|
|
38601
|
-
|
|
39003
|
+
import_node_path36.default.relative(metroRoot, fontsRoot).split(import_node_path36.default.sep).join("/")
|
|
38602
39004
|
);
|
|
38603
39005
|
}
|
|
38604
39006
|
} catch {
|
|
@@ -38608,37 +39010,37 @@ function discoverNativeLinkedAppFonts(opts) {
|
|
|
38608
39010
|
} catch {
|
|
38609
39011
|
}
|
|
38610
39012
|
try {
|
|
38611
|
-
const configPath =
|
|
38612
|
-
if (
|
|
38613
|
-
const appConfigRequire = (0, import_node_module4.createRequire)(
|
|
39013
|
+
const configPath = import_node_path36.default.join(selectedAppDir, "react-native.config.js");
|
|
39014
|
+
if (import_node_fs34.default.statSync(configPath).isFile()) {
|
|
39015
|
+
const appConfigRequire = (0, import_node_module4.createRequire)(import_node_path36.default.join(selectedAppDir, "package.json"));
|
|
38614
39016
|
const rnConfig = appConfigRequire(configPath);
|
|
38615
39017
|
const assets2 = rnConfig && typeof rnConfig === "object" ? Reflect.get(rnConfig, "assets") : null;
|
|
38616
39018
|
if (Array.isArray(assets2)) {
|
|
38617
39019
|
for (const assetDir of assets2) {
|
|
38618
39020
|
if (typeof assetDir !== "string") continue;
|
|
38619
|
-
const root =
|
|
38620
|
-
const relativeRoot =
|
|
38621
|
-
if (relativeRoot.startsWith("..") ||
|
|
38622
|
-
collectFontFiles(root, relativeRoot.split(
|
|
39021
|
+
const root = import_node_path36.default.resolve(selectedAppDir, assetDir);
|
|
39022
|
+
const relativeRoot = import_node_path36.default.relative(selectedAppDir, root);
|
|
39023
|
+
if (relativeRoot.startsWith("..") || import_node_path36.default.isAbsolute(relativeRoot)) continue;
|
|
39024
|
+
collectFontFiles(root, relativeRoot.split(import_node_path36.default.sep).join("/"));
|
|
38623
39025
|
}
|
|
38624
39026
|
}
|
|
38625
39027
|
}
|
|
38626
39028
|
} catch {
|
|
38627
39029
|
}
|
|
38628
39030
|
if (platform === "ios") {
|
|
38629
|
-
const iosDir =
|
|
39031
|
+
const iosDir = import_node_path36.default.join(selectedAppDir, "ios");
|
|
38630
39032
|
try {
|
|
38631
|
-
const targetDirs =
|
|
39033
|
+
const targetDirs = import_node_fs34.default.readdirSync(iosDir, { withFileTypes: true }).filter(
|
|
38632
39034
|
(entry) => entry.isDirectory() && !entry.isSymbolicLink() && entry.name !== "Pods" && entry.name !== "build" && !entry.name.startsWith(".")
|
|
38633
39035
|
).slice(0, 64);
|
|
38634
|
-
const plistPaths = [
|
|
39036
|
+
const plistPaths = [import_node_path36.default.join(iosDir, "Info.plist")];
|
|
38635
39037
|
for (const entry of targetDirs) {
|
|
38636
|
-
plistPaths.push(
|
|
39038
|
+
plistPaths.push(import_node_path36.default.join(iosDir, entry.name, "Info.plist"));
|
|
38637
39039
|
}
|
|
38638
39040
|
for (const plistPath of plistPaths) {
|
|
38639
39041
|
let parsed;
|
|
38640
39042
|
try {
|
|
38641
|
-
parsed = parsePlistSource(
|
|
39043
|
+
parsed = parsePlistSource(import_node_fs34.default.readFileSync(plistPath, "utf8"));
|
|
38642
39044
|
} catch {
|
|
38643
39045
|
continue;
|
|
38644
39046
|
}
|
|
@@ -38648,21 +39050,21 @@ function discoverNativeLinkedAppFonts(opts) {
|
|
|
38648
39050
|
for (const declaredFont of declaredFonts) {
|
|
38649
39051
|
if (typeof declaredFont !== "string") continue;
|
|
38650
39052
|
const candidates = [
|
|
38651
|
-
|
|
38652
|
-
|
|
39053
|
+
import_node_path36.default.resolve(import_node_path36.default.dirname(plistPath), declaredFont),
|
|
39054
|
+
import_node_path36.default.resolve(iosDir, declaredFont)
|
|
38653
39055
|
];
|
|
38654
39056
|
const fontPath = candidates.find((candidate) => {
|
|
38655
|
-
const relative3 =
|
|
38656
|
-
if (relative3.startsWith("..") ||
|
|
39057
|
+
const relative3 = import_node_path36.default.relative(selectedAppDir, candidate);
|
|
39058
|
+
if (relative3.startsWith("..") || import_node_path36.default.isAbsolute(relative3)) return false;
|
|
38657
39059
|
try {
|
|
38658
|
-
return
|
|
39060
|
+
return import_node_fs34.default.statSync(candidate).isFile();
|
|
38659
39061
|
} catch {
|
|
38660
39062
|
return false;
|
|
38661
39063
|
}
|
|
38662
39064
|
});
|
|
38663
39065
|
if (!fontPath) continue;
|
|
38664
39066
|
fontPaths.push(
|
|
38665
|
-
|
|
39067
|
+
import_node_path36.default.relative(selectedAppDir, fontPath).split(import_node_path36.default.sep).join("/")
|
|
38666
39068
|
);
|
|
38667
39069
|
}
|
|
38668
39070
|
}
|
|
@@ -38704,13 +39106,13 @@ async function resolveMetroProjectRoot(bundleUrl, opts) {
|
|
|
38704
39106
|
function encodeAppFontsWire(specs) {
|
|
38705
39107
|
return specs.map((spec) => `${encodeURIComponent(spec.url)}::${encodeURIComponent(spec.family)}`).join(",");
|
|
38706
39108
|
}
|
|
38707
|
-
var
|
|
39109
|
+
var import_node_fs34, import_node_module4, import_node_path36, import_config_plugin_fonts, require3;
|
|
38708
39110
|
var init_app_fonts = __esm({
|
|
38709
39111
|
"cli/app-fonts.ts"() {
|
|
38710
39112
|
"use strict";
|
|
38711
|
-
|
|
39113
|
+
import_node_fs34 = __toESM(require("node:fs"), 1);
|
|
38712
39114
|
import_node_module4 = require("node:module");
|
|
38713
|
-
|
|
39115
|
+
import_node_path36 = __toESM(require("node:path"), 1);
|
|
38714
39116
|
import_config_plugin_fonts = require("peach-engine/engine/config-plugin-fonts");
|
|
38715
39117
|
init_dev_server_scanner();
|
|
38716
39118
|
init_backend_origin();
|
|
@@ -39640,9 +40042,9 @@ var init_bridge_diagnostics = __esm({
|
|
|
39640
40042
|
|
|
39641
40043
|
// src/desktop-host-delivery.ts
|
|
39642
40044
|
function bundleValue(app, key) {
|
|
39643
|
-
const read = (0,
|
|
40045
|
+
const read = (0, import_node_child_process12.spawnSync)(
|
|
39644
40046
|
"plutil",
|
|
39645
|
-
["-extract", key, "raw", "-o", "-",
|
|
40047
|
+
["-extract", key, "raw", "-o", "-", import_node_path37.default.join(app, "Contents/Info.plist")],
|
|
39646
40048
|
{ encoding: "utf8" }
|
|
39647
40049
|
);
|
|
39648
40050
|
return read.status === 0 ? read.stdout.trim() : null;
|
|
@@ -39656,12 +40058,12 @@ function placedHostVersion() {
|
|
|
39656
40058
|
function activeDesktopHostApp() {
|
|
39657
40059
|
return placedHostVersion() ? MAC_HOST_APP : null;
|
|
39658
40060
|
}
|
|
39659
|
-
var
|
|
40061
|
+
var import_node_child_process12, import_node_path37, MAC_HOST_APP, HOST_BUNDLE_ID;
|
|
39660
40062
|
var init_desktop_host_delivery = __esm({
|
|
39661
40063
|
"src/desktop-host-delivery.ts"() {
|
|
39662
40064
|
"use strict";
|
|
39663
|
-
|
|
39664
|
-
|
|
40065
|
+
import_node_child_process12 = require("node:child_process");
|
|
40066
|
+
import_node_path37 = __toESM(require("node:path"), 1);
|
|
39665
40067
|
init_src();
|
|
39666
40068
|
init_home_paths();
|
|
39667
40069
|
MAC_HOST_APP = "/Applications/Peach.app";
|
|
@@ -41184,7 +41586,7 @@ function linuxBrowserLibsKey(id, arch) {
|
|
|
41184
41586
|
return `linux-libs/${id}/${arch}.tar.gz`;
|
|
41185
41587
|
}
|
|
41186
41588
|
function missingLibraries(executablePath, libraryPath) {
|
|
41187
|
-
const ldd = (0,
|
|
41589
|
+
const ldd = (0, import_node_child_process13.spawnSync)("ldd", [executablePath], {
|
|
41188
41590
|
encoding: "utf8",
|
|
41189
41591
|
timeout: 3e4,
|
|
41190
41592
|
env: libraryPath ? {
|
|
@@ -41208,8 +41610,8 @@ async function ensureLinuxBrowserLibraries(executablePath, browser) {
|
|
|
41208
41610
|
};
|
|
41209
41611
|
}
|
|
41210
41612
|
const lock = parseLinuxBrowserLibsLock(linux_browser_libs_lock_default);
|
|
41211
|
-
const dir = (0,
|
|
41212
|
-
if (!(0,
|
|
41613
|
+
const dir = (0, import_node_path38.join)(rnxHomeDir(), "linux-libs", `${lock.id}-${arch}`);
|
|
41614
|
+
if (!(0, import_node_fs35.existsSync)((0, import_node_path38.join)(dir, LINUX_BROWSER_LIBS_MARKER))) {
|
|
41213
41615
|
const url = `${DEFAULT_CLI_RELEASE_ORIGIN}/${linuxBrowserLibsKey(lock.id, arch)}`;
|
|
41214
41616
|
process.stderr.write(
|
|
41215
41617
|
`peach: this system lacks ${missing.length} shared libraries ${browser} links; downloading them\u2026
|
|
@@ -41237,7 +41639,7 @@ async function ensureLinuxBrowserLibraries(executablePath, browser) {
|
|
|
41237
41639
|
};
|
|
41238
41640
|
}
|
|
41239
41641
|
}
|
|
41240
|
-
const libraryPath = [(0,
|
|
41642
|
+
const libraryPath = [(0, import_node_path38.join)(dir, "lib"), (0, import_node_path38.join)(dir, "lib", "nss")].join(":");
|
|
41241
41643
|
const stillMissing = missingLibraries(executablePath, libraryPath);
|
|
41242
41644
|
if (stillMissing.length) {
|
|
41243
41645
|
return {
|
|
@@ -41247,13 +41649,13 @@ async function ensureLinuxBrowserLibraries(executablePath, browser) {
|
|
|
41247
41649
|
}
|
|
41248
41650
|
return { ok: true, libraryPath };
|
|
41249
41651
|
}
|
|
41250
|
-
var
|
|
41652
|
+
var import_node_child_process13, import_node_fs35, import_node_path38, LINUX_BROWSER_LIBS_ARCHES, LINUX_BROWSER_LIBS_MARKER;
|
|
41251
41653
|
var init_linux_browser_libs = __esm({
|
|
41252
41654
|
"cli/drivers/linux-browser-libs.ts"() {
|
|
41253
41655
|
"use strict";
|
|
41254
|
-
|
|
41255
|
-
|
|
41256
|
-
|
|
41656
|
+
import_node_child_process13 = require("node:child_process");
|
|
41657
|
+
import_node_fs35 = require("node:fs");
|
|
41658
|
+
import_node_path38 = require("node:path");
|
|
41257
41659
|
init_src();
|
|
41258
41660
|
init_home_paths();
|
|
41259
41661
|
init_is_record();
|
|
@@ -41277,13 +41679,13 @@ function resolvePlaywright() {
|
|
|
41277
41679
|
try {
|
|
41278
41680
|
const modulePath = requireFromRoot.resolve(spec);
|
|
41279
41681
|
const packageJsonPath = requireFromRoot.resolve(`${spec}/package.json`);
|
|
41280
|
-
const parsed = JSON.parse((0,
|
|
41682
|
+
const parsed = JSON.parse((0, import_node_fs36.readFileSync)(packageJsonPath, "utf8"));
|
|
41281
41683
|
if (!isRecord(parsed) || typeof parsed.version !== "string") continue;
|
|
41282
41684
|
const corePackagePath = (0, import_node_module6.createRequire)(modulePath).resolve(
|
|
41283
41685
|
"playwright-core/package.json"
|
|
41284
41686
|
);
|
|
41285
|
-
const cliPath = (0,
|
|
41286
|
-
if (!(0,
|
|
41687
|
+
const cliPath = (0, import_node_path39.join)((0, import_node_path39.dirname)(corePackagePath), "cli.js");
|
|
41688
|
+
if (!(0, import_node_fs36.existsSync)(cliPath)) continue;
|
|
41287
41689
|
return {
|
|
41288
41690
|
spec,
|
|
41289
41691
|
modulePath,
|
|
@@ -41311,7 +41713,7 @@ async function provisionPlaywright() {
|
|
|
41311
41713
|
await installVerifiedTarball({
|
|
41312
41714
|
url: `https://registry.npmjs.org/playwright-core/-/playwright-core-${version}.tgz`,
|
|
41313
41715
|
digest: { algorithm, encoding: "base64", value: digest },
|
|
41314
|
-
destDir: (0,
|
|
41716
|
+
destDir: (0, import_node_path39.join)(playwrightCoreDir(version), "node_modules", "playwright-core"),
|
|
41315
41717
|
installedMarker: "package.json",
|
|
41316
41718
|
// npm tarballs hold the package under a leading `package/`
|
|
41317
41719
|
stripComponents: 1,
|
|
@@ -41327,7 +41729,7 @@ async function provisionPlaywright() {
|
|
|
41327
41729
|
}
|
|
41328
41730
|
function probeBrowser(resolved, env) {
|
|
41329
41731
|
const self = rnxSelfInvocation();
|
|
41330
|
-
const probe2 = (0,
|
|
41732
|
+
const probe2 = (0, import_node_child_process14.spawnSync)(
|
|
41331
41733
|
self.executable,
|
|
41332
41734
|
[...self.prefixArgs, RNX_INTERNAL_COMMAND, RNX_INTERNAL_CHILDREN.playwrightProbe],
|
|
41333
41735
|
{
|
|
@@ -41354,7 +41756,7 @@ function probeBrowser(resolved, env) {
|
|
|
41354
41756
|
return {
|
|
41355
41757
|
ok: true,
|
|
41356
41758
|
executablePath: parsed.executablePath,
|
|
41357
|
-
exists: parsed.exists && (0,
|
|
41759
|
+
exists: parsed.exists && (0, import_node_fs36.existsSync)(parsed.executablePath)
|
|
41358
41760
|
};
|
|
41359
41761
|
} catch (error) {
|
|
41360
41762
|
return {
|
|
@@ -41380,7 +41782,7 @@ async function ensurePlaywrightBrowser(resolved, headless, env = process.env) {
|
|
|
41380
41782
|
};
|
|
41381
41783
|
}
|
|
41382
41784
|
const installer = rnxSelfInvocation();
|
|
41383
|
-
const install = (0,
|
|
41785
|
+
const install = (0, import_node_child_process14.spawnSync)(
|
|
41384
41786
|
installer.executable,
|
|
41385
41787
|
[
|
|
41386
41788
|
...installer.prefixArgs,
|
|
@@ -41422,14 +41824,14 @@ ${detail}` : ""}`
|
|
|
41422
41824
|
libraryPath: libraries.libraryPath
|
|
41423
41825
|
};
|
|
41424
41826
|
}
|
|
41425
|
-
var
|
|
41827
|
+
var import_node_child_process14, import_node_fs36, import_node_module6, import_node_path39;
|
|
41426
41828
|
var init_playwright_provisioning = __esm({
|
|
41427
41829
|
"cli/drivers/playwright-provisioning.ts"() {
|
|
41428
41830
|
"use strict";
|
|
41429
|
-
|
|
41430
|
-
|
|
41831
|
+
import_node_child_process14 = require("node:child_process");
|
|
41832
|
+
import_node_fs36 = require("node:fs");
|
|
41431
41833
|
import_node_module6 = require("node:module");
|
|
41432
|
-
|
|
41834
|
+
import_node_path39 = require("node:path");
|
|
41433
41835
|
init_src();
|
|
41434
41836
|
init_home_paths();
|
|
41435
41837
|
init_is_record();
|
|
@@ -41816,7 +42218,7 @@ var init_parse_args = __esm({
|
|
|
41816
42218
|
// cli/telemetry.ts
|
|
41817
42219
|
function sanitizeDiagnosticMessage(value) {
|
|
41818
42220
|
const firstLine = value.slice(0, 2048).split(/[\r\n\u2028\u2029]/, 1)[0] ?? "";
|
|
41819
|
-
return firstLine.split((0,
|
|
42221
|
+
return firstLine.split((0, import_node_os9.homedir)()).join("<home>").replace(
|
|
41820
42222
|
/<package:(?:@[\w.-]+\/)?[\w.-]+>|(?:https?:\/\/|file:\/\/|[A-Za-z]:[\\/]|<home>[\\/]|\/|\.{1,2}[\\/]|\b[\w.-]+[\\/])(?:[^\s"'<>]|\s(?=[^"'<>]*[\\/]))+/g,
|
|
41821
42223
|
(location2) => {
|
|
41822
42224
|
if (location2.startsWith("<package:")) return location2;
|
|
@@ -41843,11 +42245,11 @@ function trackCliDiagnostic(diagnostic) {
|
|
|
41843
42245
|
if (queue.some((queued) => JSON.stringify(queued) === JSON.stringify(entry))) return;
|
|
41844
42246
|
queue.push(entry);
|
|
41845
42247
|
}
|
|
41846
|
-
var
|
|
42248
|
+
var import_node_os9, import_crash_fingerprint, observedRuntimeVersion, queue, CRASH_REPORT_EVERY_MS;
|
|
41847
42249
|
var init_telemetry = __esm({
|
|
41848
42250
|
"cli/telemetry.ts"() {
|
|
41849
42251
|
"use strict";
|
|
41850
|
-
|
|
42252
|
+
import_node_os9 = require("node:os");
|
|
41851
42253
|
import_crash_fingerprint = require("peach-engine/crash-fingerprint");
|
|
41852
42254
|
init_cli_version();
|
|
41853
42255
|
init_home_paths();
|
|
@@ -41913,12 +42315,12 @@ var init_runtime_diagnostics = __esm({
|
|
|
41913
42315
|
// cli/commands/skills.ts
|
|
41914
42316
|
function getSkillsDir() {
|
|
41915
42317
|
if (typeof __PEACH_BUNDLED_SKILLS__ !== "undefined") {
|
|
41916
|
-
const dir =
|
|
42318
|
+
const dir = path32.join(rnxHomeDir(), "skills", getCliVersion());
|
|
41917
42319
|
for (const [file, body] of Object.entries(__PEACH_BUNDLED_SKILLS__)) {
|
|
41918
|
-
const target =
|
|
41919
|
-
if (
|
|
41920
|
-
|
|
41921
|
-
|
|
42320
|
+
const target = path32.join(dir, file);
|
|
42321
|
+
if (fs27.existsSync(target)) continue;
|
|
42322
|
+
fs27.mkdirSync(path32.dirname(target), { recursive: true });
|
|
42323
|
+
fs27.writeFileSync(target, body);
|
|
41922
42324
|
}
|
|
41923
42325
|
return dir;
|
|
41924
42326
|
}
|
|
@@ -41926,10 +42328,10 @@ function getSkillsDir() {
|
|
|
41926
42328
|
const pkgPath = (0, import_url3.fileURLToPath)(
|
|
41927
42329
|
import_meta4.resolve(`${rnxPublicBrand.packageName}/package.json`)
|
|
41928
42330
|
);
|
|
41929
|
-
return primaryCheckoutPath(
|
|
42331
|
+
return primaryCheckoutPath(path32.join(path32.dirname(pkgPath), "skills"));
|
|
41930
42332
|
} catch {
|
|
41931
|
-
const __dirname =
|
|
41932
|
-
return primaryCheckoutPath(
|
|
42333
|
+
const __dirname = path32.dirname((0, import_url3.fileURLToPath)(__sootsim_import_meta_url));
|
|
42334
|
+
return primaryCheckoutPath(path32.resolve(__dirname, "../../skills"));
|
|
41933
42335
|
}
|
|
41934
42336
|
}
|
|
41935
42337
|
function primaryCheckoutPath(dir) {
|
|
@@ -41952,17 +42354,17 @@ function primaryCheckoutPath(dir) {
|
|
|
41952
42354
|
} catch {
|
|
41953
42355
|
return dir;
|
|
41954
42356
|
}
|
|
41955
|
-
if (
|
|
41956
|
-
const primary =
|
|
41957
|
-
return
|
|
42357
|
+
if (path32.basename(common) !== ".git") return dir;
|
|
42358
|
+
const primary = path32.join(path32.dirname(common), path32.relative(top, dir));
|
|
42359
|
+
return fs27.existsSync(primary) ? primary : dir;
|
|
41958
42360
|
}
|
|
41959
42361
|
function skillsDir() {
|
|
41960
42362
|
skillsDirPath ??= getSkillsDir();
|
|
41961
42363
|
return skillsDirPath;
|
|
41962
42364
|
}
|
|
41963
42365
|
function targetFromHome(envName, fallbackDir) {
|
|
41964
|
-
const home = process.env[envName] ||
|
|
41965
|
-
return
|
|
42366
|
+
const home = process.env[envName] || path32.join(os8.homedir(), fallbackDir);
|
|
42367
|
+
return path32.join(home, "skills");
|
|
41966
42368
|
}
|
|
41967
42369
|
function defaultAgentTargets() {
|
|
41968
42370
|
return [
|
|
@@ -41975,7 +42377,7 @@ function hasInstalledPeachSkills() {
|
|
|
41975
42377
|
(file) => /^([^/]+)\/SKILL\.md$/.exec(file)?.[1] ?? []
|
|
41976
42378
|
) : listSkills().map((skill7) => skill7.name);
|
|
41977
42379
|
return defaultAgentTargets().some(
|
|
41978
|
-
({ dir }) => names.some((name2) =>
|
|
42380
|
+
({ dir }) => names.some((name2) => fs27.existsSync(path32.join(dir, name2, "SKILL.md")))
|
|
41979
42381
|
);
|
|
41980
42382
|
}
|
|
41981
42383
|
function parseSkillFrontmatter(content) {
|
|
@@ -42018,26 +42420,26 @@ function readFrontmatterField(frontmatter, field) {
|
|
|
42018
42420
|
return null;
|
|
42019
42421
|
}
|
|
42020
42422
|
function listSkills() {
|
|
42021
|
-
if (!
|
|
42423
|
+
if (!fs27.existsSync(skillsDir())) return [];
|
|
42022
42424
|
const skills = [];
|
|
42023
|
-
for (const entry of
|
|
42024
|
-
const skillMd =
|
|
42025
|
-
if (!
|
|
42026
|
-
const meta = parseSkillFrontmatter(
|
|
42425
|
+
for (const entry of fs27.readdirSync(skillsDir())) {
|
|
42426
|
+
const skillMd = path32.join(skillsDir(), entry, "SKILL.md");
|
|
42427
|
+
if (!fs27.existsSync(skillMd)) continue;
|
|
42428
|
+
const meta = parseSkillFrontmatter(fs27.readFileSync(skillMd, "utf8"));
|
|
42027
42429
|
if (meta) {
|
|
42028
42430
|
skills.push({ name: entry, description: meta.description });
|
|
42029
42431
|
}
|
|
42030
42432
|
}
|
|
42031
42433
|
return skills.sort((a, b) => a.name.localeCompare(b.name));
|
|
42032
42434
|
}
|
|
42033
|
-
var import_child_process7,
|
|
42435
|
+
var import_child_process7, fs27, os8, path32, import_url3, import_meta4, skillsDirPath;
|
|
42034
42436
|
var init_skills = __esm({
|
|
42035
42437
|
"cli/commands/skills.ts"() {
|
|
42036
42438
|
"use strict";
|
|
42037
42439
|
import_child_process7 = require("child_process");
|
|
42038
|
-
|
|
42039
|
-
|
|
42040
|
-
|
|
42440
|
+
fs27 = __toESM(require("fs"), 1);
|
|
42441
|
+
os8 = __toESM(require("os"), 1);
|
|
42442
|
+
path32 = __toESM(require("path"), 1);
|
|
42041
42443
|
import_url3 = require("url");
|
|
42042
42444
|
init_cli_version();
|
|
42043
42445
|
init_home_paths();
|
|
@@ -42524,14 +42926,14 @@ function assertExplicitBridgeLock(preferredPort, explicitPort, lock) {
|
|
|
42524
42926
|
async function ensureRuntimeForOpen() {
|
|
42525
42927
|
if (resolveDevCheckoutRuntimeRoot()) return;
|
|
42526
42928
|
const active = readActiveRuntime();
|
|
42527
|
-
if (active &&
|
|
42929
|
+
if (active && import_node_fs37.default.existsSync(runtimeDir(active))) return;
|
|
42528
42930
|
console.error(" installing peach engine runtime...");
|
|
42529
42931
|
const { runRuntime: runRuntime2 } = await Promise.resolve().then(() => (init_runtime(), runtime_exports));
|
|
42530
42932
|
await runRuntime2(["install"], {});
|
|
42531
42933
|
}
|
|
42532
42934
|
function spawnSootsim(args) {
|
|
42533
42935
|
const { executable, prefixArgs } = rnxSelfInvocation();
|
|
42534
|
-
return (0,
|
|
42936
|
+
return (0, import_node_child_process15.spawn)(executable, [...prefixArgs, ...args], {
|
|
42535
42937
|
detached: true,
|
|
42536
42938
|
stdio: "ignore",
|
|
42537
42939
|
env: process.env
|
|
@@ -42678,10 +43080,10 @@ async function buildResolvedBundleOpenUrl(target, baseUrl, opts = {}) {
|
|
|
42678
43080
|
}
|
|
42679
43081
|
function normalizeReplacementPath(filePath) {
|
|
42680
43082
|
if (filePath.startsWith("~/")) {
|
|
42681
|
-
return
|
|
43083
|
+
return import_node_path40.default.join(import_node_os10.default.homedir(), filePath.slice(2));
|
|
42682
43084
|
}
|
|
42683
|
-
if (
|
|
42684
|
-
return
|
|
43085
|
+
if (import_node_path40.default.isAbsolute(filePath)) return filePath;
|
|
43086
|
+
return import_node_path40.default.resolve(process.cwd(), filePath);
|
|
42685
43087
|
}
|
|
42686
43088
|
function parseOpenRuntimeConfig(args) {
|
|
42687
43089
|
const modules = {};
|
|
@@ -42700,7 +43102,7 @@ function parseOpenRuntimeConfig(args) {
|
|
|
42700
43102
|
}
|
|
42701
43103
|
const moduleName = raw2.slice(0, eqIndex).trim();
|
|
42702
43104
|
const filePath = normalizeReplacementPath(raw2.slice(eqIndex + 1).trim());
|
|
42703
|
-
if (!
|
|
43105
|
+
if (!import_node_fs37.default.existsSync(filePath)) {
|
|
42704
43106
|
console.error(` peach open: replacement file not found: ${filePath}`);
|
|
42705
43107
|
rnxExit(1);
|
|
42706
43108
|
}
|
|
@@ -42731,7 +43133,7 @@ async function resolveAppProjectForBundleUrl(bundleUrl) {
|
|
|
42731
43133
|
return advertisedRoot ? resolveAppProject(advertisedRoot) : null;
|
|
42732
43134
|
}
|
|
42733
43135
|
async function ensureConfiguredRuntime(version) {
|
|
42734
|
-
if (
|
|
43136
|
+
if (import_node_fs37.default.existsSync(import_node_path40.default.join(runtimeDir(version), "index.html"))) return;
|
|
42735
43137
|
console.error(` installing configured engine runtime ${version}...`);
|
|
42736
43138
|
const result = await rnxRuntime.install({
|
|
42737
43139
|
version,
|
|
@@ -43067,7 +43469,7 @@ function playwrightHostPidForSim(sim) {
|
|
|
43067
43469
|
function signalDriverLaunchConnected(result) {
|
|
43068
43470
|
if (!result.connectAckFile) return false;
|
|
43069
43471
|
try {
|
|
43070
|
-
|
|
43472
|
+
import_node_fs37.default.writeFileSync(
|
|
43071
43473
|
result.connectAckFile,
|
|
43072
43474
|
`${JSON.stringify({ connectedAt: Date.now(), pid: result.pid ?? null })}
|
|
43073
43475
|
`,
|
|
@@ -43081,7 +43483,7 @@ function signalDriverLaunchConnected(result) {
|
|
|
43081
43483
|
function readUnservedUrl(result) {
|
|
43082
43484
|
if (!result.diagnosticLogPath) return null;
|
|
43083
43485
|
try {
|
|
43084
|
-
const detail =
|
|
43486
|
+
const detail = import_node_fs37.default.readFileSync(result.diagnosticLogPath, "utf8");
|
|
43085
43487
|
const match = detail.match(/\[unserved\] nothing serves (\S+)/);
|
|
43086
43488
|
return match ? match[1] : null;
|
|
43087
43489
|
} catch {
|
|
@@ -43091,19 +43493,19 @@ function readUnservedUrl(result) {
|
|
|
43091
43493
|
function printDriverDiagnosticLogTail(result) {
|
|
43092
43494
|
if (!result.diagnosticLogPath) return;
|
|
43093
43495
|
try {
|
|
43094
|
-
const detail =
|
|
43496
|
+
const detail = import_node_fs37.default.readFileSync(result.diagnosticLogPath, "utf8").trim();
|
|
43095
43497
|
if (!detail) {
|
|
43096
|
-
console.error(` ${
|
|
43498
|
+
console.error(` ${import_node_path40.default.basename(result.diagnosticLogPath)} was empty`);
|
|
43097
43499
|
return;
|
|
43098
43500
|
}
|
|
43099
43501
|
const shown = detail.length > 4e3 ? `\u2026
|
|
43100
43502
|
${detail.slice(-4e3)}` : detail;
|
|
43101
|
-
console.error(` ${
|
|
43503
|
+
console.error(` ${import_node_path40.default.basename(result.diagnosticLogPath)}:`);
|
|
43102
43504
|
console.error(shown);
|
|
43103
43505
|
} catch (err) {
|
|
43104
43506
|
const message = err instanceof Error ? err.message : String(err);
|
|
43105
43507
|
console.error(
|
|
43106
|
-
` failed to read ${
|
|
43508
|
+
` failed to read ${import_node_path40.default.basename(result.diagnosticLogPath)}: ${message}`
|
|
43107
43509
|
);
|
|
43108
43510
|
}
|
|
43109
43511
|
}
|
|
@@ -43124,11 +43526,11 @@ async function waitForProcessExit(pid, timeoutMs = 2500) {
|
|
|
43124
43526
|
return !isProcessAlive2(pid);
|
|
43125
43527
|
}
|
|
43126
43528
|
function isPlaywrightHostProcess(pid) {
|
|
43127
|
-
const plain = (0,
|
|
43529
|
+
const plain = (0, import_node_child_process15.spawnSync)("ps", ["-o", "command=", "-p", String(pid)], {
|
|
43128
43530
|
encoding: "utf8",
|
|
43129
43531
|
stdio: ["ignore", "pipe", "pipe"]
|
|
43130
43532
|
});
|
|
43131
|
-
const withEnv = (0,
|
|
43533
|
+
const withEnv = (0, import_node_child_process15.spawnSync)("ps", ["eww", "-o", "command=", "-p", String(pid)], {
|
|
43132
43534
|
encoding: "utf8",
|
|
43133
43535
|
stdio: ["ignore", "pipe", "pipe"]
|
|
43134
43536
|
});
|
|
@@ -44102,14 +44504,14 @@ async function runCloseCommand(args, opts = {}) {
|
|
|
44102
44504
|
bridge.close();
|
|
44103
44505
|
}
|
|
44104
44506
|
}
|
|
44105
|
-
var
|
|
44507
|
+
var import_node_child_process15, import_node_fs37, import_node_os10, import_node_path40, import_app_catalog_wire, import_devices2, import_ws4, DEFAULT_DRIVER_CONNECT_TIMEOUT_MS, DRIVER_CONNECT_INTERVAL_MS, DRIVER_CONNECT_HOST_GRACE_MS, OPEN_BRIDGE_SPAWN_TIMEOUT_MS, SHELL_APPS, DEV_BUNDLE_RESOLVE_ATTEMPTS, DEV_BUNDLE_RESOLVE_INTERVAL_MS;
|
|
44106
44508
|
var init_control = __esm({
|
|
44107
44509
|
"cli/commands/control.ts"() {
|
|
44108
44510
|
"use strict";
|
|
44109
|
-
|
|
44110
|
-
|
|
44111
|
-
|
|
44112
|
-
|
|
44511
|
+
import_node_child_process15 = require("node:child_process");
|
|
44512
|
+
import_node_fs37 = __toESM(require("node:fs"), 1);
|
|
44513
|
+
import_node_os10 = __toESM(require("node:os"), 1);
|
|
44514
|
+
import_node_path40 = __toESM(require("node:path"), 1);
|
|
44113
44515
|
import_app_catalog_wire = require("peach-engine/engine/app-catalog-wire");
|
|
44114
44516
|
import_devices2 = require("peach-engine/settings/devices");
|
|
44115
44517
|
import_ws4 = require("ws");
|
|
@@ -45564,16 +45966,16 @@ function readRecentShellAppId(state) {
|
|
|
45564
45966
|
}
|
|
45565
45967
|
function resolveProjectRelativeFlowBase(flowDir) {
|
|
45566
45968
|
if (!flowDir) return process.cwd();
|
|
45567
|
-
return
|
|
45969
|
+
return path34.basename(flowDir) === ".maestro" ? path34.dirname(flowDir) : flowDir;
|
|
45568
45970
|
}
|
|
45569
45971
|
function resolveFlowScreenshotPathWithMode(screenshotDir, name2, opts) {
|
|
45570
45972
|
const normalizedName = name2.endsWith(".png") ? name2 : `${name2}.png`;
|
|
45571
|
-
if (
|
|
45973
|
+
if (path34.isAbsolute(normalizedName)) return normalizedName;
|
|
45572
45974
|
if (opts.mode === "flow" && /[\\/]/.test(normalizedName)) {
|
|
45573
45975
|
const baseDir = normalizedName.startsWith("./") || normalizedName.startsWith("../") ? opts.flowDir ?? process.cwd() : resolveProjectRelativeFlowBase(opts.flowDir);
|
|
45574
|
-
return
|
|
45976
|
+
return path34.resolve(baseDir, normalizedName);
|
|
45575
45977
|
}
|
|
45576
|
-
return
|
|
45978
|
+
return path34.join(screenshotDir, normalizedName);
|
|
45577
45979
|
}
|
|
45578
45980
|
function normalizeFlowScreenshotSpec(step) {
|
|
45579
45981
|
if (typeof step === "string") {
|
|
@@ -45627,12 +46029,12 @@ function normalizeBareStringStep(verb) {
|
|
|
45627
46029
|
function parseFlowSteps(content) {
|
|
45628
46030
|
return parseFlowFile(content).steps;
|
|
45629
46031
|
}
|
|
45630
|
-
var
|
|
46032
|
+
var fs30, path34, import_devices4, import_proof_frame, DEFAULT_TIMEOUT, ASSERTION_LOOKUP_MS, FLOW_TIMEOUT_SCALE, scaledTimeout, MAESTRO_SELECTOR_KEYS, SELECTOR_FILTER_KEYS, UNSUPPORTED_SELECTOR_KEYS, ACCESSIBILITY_SELECTOR_KEYS, ACCESSIBILITY_TRAIT_FILTERS, MAESTRO_PERMISSION_KINDS, MAESTRO_PERMISSION_STATUS, SootSimBridgeFlowRunner;
|
|
45631
46033
|
var init_bridge_flow_runner = __esm({
|
|
45632
46034
|
"cli/bridge-flow-runner.ts"() {
|
|
45633
46035
|
"use strict";
|
|
45634
|
-
|
|
45635
|
-
|
|
46036
|
+
fs30 = __toESM(require("fs"), 1);
|
|
46037
|
+
path34 = __toESM(require("path"), 1);
|
|
45636
46038
|
import_devices4 = require("peach-engine/settings/devices");
|
|
45637
46039
|
import_proof_frame = __toESM(require_proof_frame(), 1);
|
|
45638
46040
|
init_flow_timeout_scale();
|
|
@@ -45957,14 +46359,14 @@ var init_bridge_flow_runner = __esm({
|
|
|
45957
46359
|
if (chunks.length === 0) {
|
|
45958
46360
|
throw new Error("recording requested but no video buffer was produced");
|
|
45959
46361
|
}
|
|
45960
|
-
|
|
46362
|
+
fs30.mkdirSync(this.opts.recordingOutputDir, { recursive: true });
|
|
45961
46363
|
const videoMime = stopped.mime || this.opts.recordingFormat || "video/webm";
|
|
45962
46364
|
const extension = videoMime.includes("mp4") ? "mp4" : "webm";
|
|
45963
|
-
const outputPath =
|
|
46365
|
+
const outputPath = path34.join(
|
|
45964
46366
|
this.opts.recordingOutputDir,
|
|
45965
46367
|
`peach-${Date.now()}.${extension}`
|
|
45966
46368
|
);
|
|
45967
|
-
|
|
46369
|
+
fs30.writeFileSync(outputPath, Buffer.concat(chunks));
|
|
45968
46370
|
return outputPath;
|
|
45969
46371
|
}
|
|
45970
46372
|
async waitForRecordingTail(opts) {
|
|
@@ -46640,7 +47042,7 @@ var init_bridge_flow_runner = __esm({
|
|
|
46640
47042
|
flowDir: this.opts.flowDir
|
|
46641
47043
|
}
|
|
46642
47044
|
);
|
|
46643
|
-
|
|
47045
|
+
fs30.mkdirSync(path34.dirname(outputPath), { recursive: true });
|
|
46644
47046
|
const layers = spec.layers ?? this.opts.screenshotLayers;
|
|
46645
47047
|
const screenshotRequest = {
|
|
46646
47048
|
type: "screenshot",
|
|
@@ -46675,11 +47077,11 @@ var init_bridge_flow_runner = __esm({
|
|
|
46675
47077
|
throw new Error("could not read current device model for framed screenshot");
|
|
46676
47078
|
}
|
|
46677
47079
|
const framed = await composeFramedScreenshot(rawBuffer, model);
|
|
46678
|
-
|
|
47080
|
+
fs30.writeFileSync(outputPath, framed);
|
|
46679
47081
|
console.log(`[flow] screenshot: ${outputPath} (frame: ${model})`);
|
|
46680
47082
|
return outputPath;
|
|
46681
47083
|
}
|
|
46682
|
-
|
|
47084
|
+
fs30.writeFileSync(outputPath, rawBuffer);
|
|
46683
47085
|
console.log(`[flow] screenshot: ${outputPath}`);
|
|
46684
47086
|
return outputPath;
|
|
46685
47087
|
}
|
|
@@ -46701,10 +47103,10 @@ var init_bridge_flow_runner = __esm({
|
|
|
46701
47103
|
// + a11y tree + console errors/warnings + failed network requests +
|
|
46702
47104
|
// shell state, all under one directory so post-mortem is one grep away.
|
|
46703
47105
|
async captureFailureBundle(outputDir, context) {
|
|
46704
|
-
|
|
47106
|
+
fs30.mkdirSync(outputDir, { recursive: true });
|
|
46705
47107
|
const write = (name2, content) => {
|
|
46706
47108
|
try {
|
|
46707
|
-
|
|
47109
|
+
fs30.writeFileSync(path34.join(outputDir, name2), content);
|
|
46708
47110
|
} catch {
|
|
46709
47111
|
}
|
|
46710
47112
|
};
|
|
@@ -47297,8 +47699,8 @@ var init_bridge_flow_runner = __esm({
|
|
|
47297
47699
|
runScript(target) {
|
|
47298
47700
|
const spec = typeof target === "string" ? { file: target } : target;
|
|
47299
47701
|
if (!spec.file) throw new Error("runScript requires a file");
|
|
47300
|
-
const scriptPath =
|
|
47301
|
-
const source =
|
|
47702
|
+
const scriptPath = path34.resolve(this.opts.flowDir, spec.file);
|
|
47703
|
+
const source = fs30.readFileSync(scriptPath, "utf8");
|
|
47302
47704
|
this.js.evaluate(source, { env: spec.env });
|
|
47303
47705
|
console.log(`[flow] runScript: ${spec.file} done`);
|
|
47304
47706
|
}
|
|
@@ -47658,14 +48060,14 @@ var init_bridge_flow_runner = __esm({
|
|
|
47658
48060
|
for (const [k, v] of Object.entries(env)) this.js.putEnv(k, v);
|
|
47659
48061
|
}
|
|
47660
48062
|
if (file) {
|
|
47661
|
-
const flowPath =
|
|
47662
|
-
const flowContent =
|
|
48063
|
+
const flowPath = path34.resolve(this.opts.flowDir, file);
|
|
48064
|
+
const flowContent = fs30.readFileSync(flowPath, "utf8");
|
|
47663
48065
|
const { frontmatter } = parseFlowFile(flowContent);
|
|
47664
48066
|
if (frontmatter.env && typeof frontmatter.env === "object") {
|
|
47665
48067
|
this.js.defineVariables(frontmatter.env);
|
|
47666
48068
|
}
|
|
47667
48069
|
const previousDir = this.opts.flowDir;
|
|
47668
|
-
this.opts.flowDir =
|
|
48070
|
+
this.opts.flowDir = path34.dirname(flowPath);
|
|
47669
48071
|
try {
|
|
47670
48072
|
await this.runFlow(parseFlowSteps(flowContent));
|
|
47671
48073
|
} finally {
|
|
@@ -47836,8 +48238,8 @@ __export(registry_exports, {
|
|
|
47836
48238
|
skillRegistry: () => skillRegistry
|
|
47837
48239
|
});
|
|
47838
48240
|
module.exports = __toCommonJS(registry_exports);
|
|
47839
|
-
var
|
|
47840
|
-
var
|
|
48241
|
+
var fs31 = __toESM(require("fs"), 1);
|
|
48242
|
+
var path35 = __toESM(require("path"), 1);
|
|
47841
48243
|
|
|
47842
48244
|
// src/skills/builtin/a11y-review.ts
|
|
47843
48245
|
init_reap_browser();
|
|
@@ -47856,8 +48258,8 @@ var skill = {
|
|
|
47856
48258
|
},
|
|
47857
48259
|
async execute(params, context) {
|
|
47858
48260
|
const { chromium } = await import("playwright");
|
|
47859
|
-
const
|
|
47860
|
-
const
|
|
48261
|
+
const path36 = await import("path");
|
|
48262
|
+
const fs32 = await import("fs");
|
|
47861
48263
|
const browser = await launchReapedChrome((options) => chromium.launch(options), {
|
|
47862
48264
|
headless: true
|
|
47863
48265
|
});
|
|
@@ -47914,9 +48316,9 @@ var skill = {
|
|
|
47914
48316
|
warnings: issues.filter((i) => i.severity === "warning").length,
|
|
47915
48317
|
tree: typeof tree === "string" ? tree : JSON.stringify(tree)
|
|
47916
48318
|
};
|
|
47917
|
-
const reportPath =
|
|
47918
|
-
|
|
47919
|
-
|
|
48319
|
+
const reportPath = path36.join(context.outputDir, "a11y-report.json");
|
|
48320
|
+
fs32.mkdirSync(path36.dirname(reportPath), { recursive: true });
|
|
48321
|
+
fs32.writeFileSync(reportPath, JSON.stringify(report, null, 2));
|
|
47920
48322
|
return {
|
|
47921
48323
|
success: issues.filter((i) => i.severity === "error").length === 0,
|
|
47922
48324
|
message: `${report.errors} errors, ${report.warnings} warnings across ${report.nodeCount} nodes`,
|
|
@@ -47949,14 +48351,14 @@ var skill2 = {
|
|
|
47949
48351
|
}
|
|
47950
48352
|
},
|
|
47951
48353
|
async execute(params, context) {
|
|
47952
|
-
const
|
|
47953
|
-
const
|
|
48354
|
+
const fs32 = await import("node:fs");
|
|
48355
|
+
const path36 = await import("node:path");
|
|
47954
48356
|
const { COMPAT_RESULT_CAVEAT: COMPAT_RESULT_CAVEAT2, formatPackageStatus: formatPackageStatus2, formatScanCounts: formatScanCounts2, scanDeps: scanDeps2 } = await Promise.resolve().then(() => (init_web(), web_exports));
|
|
47955
|
-
const packagePath =
|
|
47956
|
-
if (!
|
|
48357
|
+
const packagePath = path36.join(context.projectDir, "package.json");
|
|
48358
|
+
if (!fs32.existsSync(packagePath)) {
|
|
47957
48359
|
return { success: false, message: "No package.json found" };
|
|
47958
48360
|
}
|
|
47959
|
-
const parsed = JSON.parse(
|
|
48361
|
+
const parsed = JSON.parse(fs32.readFileSync(packagePath, "utf8"));
|
|
47960
48362
|
if (!parsed || typeof parsed !== "object") {
|
|
47961
48363
|
return { success: false, message: "package.json is not an object" };
|
|
47962
48364
|
}
|
|
@@ -47968,9 +48370,9 @@ var skill2 = {
|
|
|
47968
48370
|
}) : scanDeps2(parsed);
|
|
47969
48371
|
const packageResult = params.packageName ? scan.packages[0] : void 0;
|
|
47970
48372
|
const message = packageResult ? `${params.packageName}: ${formatPackageStatus2(packageResult)}. ${COMPAT_RESULT_CAVEAT2}` : `${formatScanCounts2(scan)}. ${COMPAT_RESULT_CAVEAT2}`;
|
|
47971
|
-
const reportPath =
|
|
47972
|
-
|
|
47973
|
-
|
|
48373
|
+
const reportPath = path36.join(context.outputDir, "compat-report.json");
|
|
48374
|
+
fs32.mkdirSync(path36.dirname(reportPath), { recursive: true });
|
|
48375
|
+
fs32.writeFileSync(reportPath, `${JSON.stringify(scan, null, 2)}
|
|
47974
48376
|
`);
|
|
47975
48377
|
return {
|
|
47976
48378
|
success: true,
|
|
@@ -48012,8 +48414,8 @@ var skill3 = {
|
|
|
48012
48414
|
record: { type: "boolean", description: "Record video of the flow" }
|
|
48013
48415
|
},
|
|
48014
48416
|
async execute(params, context) {
|
|
48015
|
-
const
|
|
48016
|
-
const
|
|
48417
|
+
const fs32 = await import("fs");
|
|
48418
|
+
const path36 = await import("path");
|
|
48017
48419
|
const yaml2 = await import("yaml");
|
|
48018
48420
|
const { DEFAULT_SOOTSIM_BRIDGE_PORT: DEFAULT_SOOTSIM_BRIDGE_PORT3 } = await Promise.resolve().then(() => (init_bridge_constants(), bridge_constants_exports));
|
|
48019
48421
|
const { SootSimBridgeHost: SootSimBridgeHost2 } = await Promise.resolve().then(() => (init_bridge_host(), bridge_host_exports));
|
|
@@ -48023,7 +48425,7 @@ var skill3 = {
|
|
|
48023
48425
|
const host2 = new SootSimBridgeHost2({ port: DEFAULT_SOOTSIM_BRIDGE_PORT3 });
|
|
48024
48426
|
host2.start({ silent: true });
|
|
48025
48427
|
try {
|
|
48026
|
-
const flowContent =
|
|
48428
|
+
const flowContent = fs32.readFileSync(params.flowPath, "utf8");
|
|
48027
48429
|
const fmMatch = flowContent.match(/^---\n([\s\S]*?)\n---\n?/);
|
|
48028
48430
|
const stepsBody = fmMatch ? flowContent.slice(fmMatch[0].length) : flowContent;
|
|
48029
48431
|
const steps = yaml2.parse(stepsBody);
|
|
@@ -48050,7 +48452,7 @@ var skill3 = {
|
|
|
48050
48452
|
});
|
|
48051
48453
|
const driver = new SootSimBridgeFlowRunner2(bridge, {
|
|
48052
48454
|
screenshotDir: context.outputDir,
|
|
48053
|
-
flowDir:
|
|
48455
|
+
flowDir: path36.dirname(path36.resolve(params.flowPath)),
|
|
48054
48456
|
simId,
|
|
48055
48457
|
recordingOutputDir: params.record ? context.outputDir : void 0
|
|
48056
48458
|
});
|
|
@@ -48072,7 +48474,7 @@ var skill3 = {
|
|
|
48072
48474
|
simId,
|
|
48073
48475
|
videoPath: videoPath || void 0
|
|
48074
48476
|
},
|
|
48075
|
-
artifacts: videoPath ? [{ type: "video", name:
|
|
48477
|
+
artifacts: videoPath ? [{ type: "video", name: path36.basename(videoPath), path: videoPath }] : void 0
|
|
48076
48478
|
};
|
|
48077
48479
|
} finally {
|
|
48078
48480
|
try {
|
|
@@ -48119,8 +48521,8 @@ var skill4 = {
|
|
|
48119
48521
|
},
|
|
48120
48522
|
async execute(params, context) {
|
|
48121
48523
|
const { chromium } = await import("playwright");
|
|
48122
|
-
const
|
|
48123
|
-
const
|
|
48524
|
+
const path36 = await import("path");
|
|
48525
|
+
const fs32 = await import("fs");
|
|
48124
48526
|
const browser = await launchReapedChrome((options) => chromium.launch(options), {
|
|
48125
48527
|
headless: true
|
|
48126
48528
|
});
|
|
@@ -48148,9 +48550,9 @@ var skill4 = {
|
|
|
48148
48550
|
...profile,
|
|
48149
48551
|
fps: syncCount > 0 ? (syncCount / (duration / 1e3)).toFixed(1) : "0"
|
|
48150
48552
|
};
|
|
48151
|
-
const reportPath =
|
|
48152
|
-
|
|
48153
|
-
|
|
48553
|
+
const reportPath = path36.join(context.outputDir, "perf-report.json");
|
|
48554
|
+
fs32.mkdirSync(path36.dirname(reportPath), { recursive: true });
|
|
48555
|
+
fs32.writeFileSync(reportPath, JSON.stringify(report, null, 2));
|
|
48154
48556
|
return {
|
|
48155
48557
|
success: true,
|
|
48156
48558
|
message: `${report.fps} fps, ${profile.avgSyncMs?.toFixed(1)}ms avg sync, ${nodeCount} nodes`,
|
|
@@ -48183,8 +48585,8 @@ var skill5 = {
|
|
|
48183
48585
|
},
|
|
48184
48586
|
async execute(params, context) {
|
|
48185
48587
|
const { chromium } = await import("playwright");
|
|
48186
|
-
const
|
|
48187
|
-
const
|
|
48588
|
+
const path36 = await import("path");
|
|
48589
|
+
const fs32 = await import("fs");
|
|
48188
48590
|
const browser = await launchReapedChrome((options) => chromium.launch(options), {
|
|
48189
48591
|
headless: true
|
|
48190
48592
|
});
|
|
@@ -48192,8 +48594,8 @@ var skill5 = {
|
|
|
48192
48594
|
try {
|
|
48193
48595
|
await page.goto(context.url, { waitUntil: "networkidle" });
|
|
48194
48596
|
await page.waitForTimeout(2e3);
|
|
48195
|
-
const outputPath =
|
|
48196
|
-
|
|
48597
|
+
const outputPath = path36.join(context.outputDir, `${params.name}.png`);
|
|
48598
|
+
fs32.mkdirSync(path36.dirname(outputPath), { recursive: true });
|
|
48197
48599
|
await page.screenshot({ path: outputPath });
|
|
48198
48600
|
return {
|
|
48199
48601
|
success: true,
|
|
@@ -48234,8 +48636,8 @@ var skill6 = {
|
|
|
48234
48636
|
},
|
|
48235
48637
|
async execute(params, context) {
|
|
48236
48638
|
const { chromium } = await import("playwright");
|
|
48237
|
-
const
|
|
48238
|
-
const
|
|
48639
|
+
const path36 = await import("path");
|
|
48640
|
+
const fs32 = await import("fs");
|
|
48239
48641
|
const browser = await launchReapedChrome((options) => chromium.launch(options), {
|
|
48240
48642
|
headless: true
|
|
48241
48643
|
});
|
|
@@ -48243,14 +48645,14 @@ var skill6 = {
|
|
|
48243
48645
|
try {
|
|
48244
48646
|
await page.goto(context.url, { waitUntil: "networkidle" });
|
|
48245
48647
|
await page.waitForTimeout(2e3);
|
|
48246
|
-
const currentPath =
|
|
48247
|
-
|
|
48648
|
+
const currentPath = path36.join(context.outputDir, `${params.name}-current.png`);
|
|
48649
|
+
fs32.mkdirSync(path36.dirname(currentPath), { recursive: true });
|
|
48248
48650
|
await page.screenshot({ path: currentPath });
|
|
48249
48651
|
try {
|
|
48250
48652
|
const { PNG } = await import("pngjs");
|
|
48251
48653
|
const pixelmatch = (await import("pixelmatch")).default;
|
|
48252
|
-
const baseline = PNG.sync.read(
|
|
48253
|
-
const current = PNG.sync.read(
|
|
48654
|
+
const baseline = PNG.sync.read(fs32.readFileSync(params.baseline));
|
|
48655
|
+
const current = PNG.sync.read(fs32.readFileSync(currentPath));
|
|
48254
48656
|
const { width, height } = baseline;
|
|
48255
48657
|
const diff = new PNG({ width, height });
|
|
48256
48658
|
const numDiffPixels = pixelmatch(
|
|
@@ -48261,8 +48663,8 @@ var skill6 = {
|
|
|
48261
48663
|
height,
|
|
48262
48664
|
{ threshold: params.threshold || 0.1 }
|
|
48263
48665
|
);
|
|
48264
|
-
const diffPath =
|
|
48265
|
-
|
|
48666
|
+
const diffPath = path36.join(context.outputDir, `${params.name}-diff.png`);
|
|
48667
|
+
fs32.writeFileSync(diffPath, PNG.sync.write(diff));
|
|
48266
48668
|
const totalPixels = width * height;
|
|
48267
48669
|
const diffPercent = (numDiffPixels / totalPixels * 100).toFixed(2);
|
|
48268
48670
|
return {
|
|
@@ -48326,10 +48728,10 @@ var skillRegistry = {
|
|
|
48326
48728
|
},
|
|
48327
48729
|
// load skills from a project manifest (rnx-skills.json)
|
|
48328
48730
|
async loadFromManifest(projectDir) {
|
|
48329
|
-
const manifestPath =
|
|
48330
|
-
if (!
|
|
48731
|
+
const manifestPath = path35.join(projectDir, "rnx-skills.json");
|
|
48732
|
+
if (!fs31.existsSync(manifestPath)) return;
|
|
48331
48733
|
try {
|
|
48332
|
-
const manifest = JSON.parse(
|
|
48734
|
+
const manifest = JSON.parse(fs31.readFileSync(manifestPath, "utf8"));
|
|
48333
48735
|
if (Array.isArray(manifest.skills)) {
|
|
48334
48736
|
for (const entry of manifest.skills) {
|
|
48335
48737
|
if (typeof entry === "string") {
|
|
@@ -48340,7 +48742,7 @@ var skillRegistry = {
|
|
|
48340
48742
|
}
|
|
48341
48743
|
} else if (entry.file) {
|
|
48342
48744
|
try {
|
|
48343
|
-
const mod = await import(
|
|
48745
|
+
const mod = await import(path35.resolve(projectDir, entry.file));
|
|
48344
48746
|
if (mod.skill) this.register(mod.skill);
|
|
48345
48747
|
} catch {
|
|
48346
48748
|
}
|
|
@@ -48353,10 +48755,10 @@ var skillRegistry = {
|
|
|
48353
48755
|
// auto-discover skills based on project dependencies
|
|
48354
48756
|
suggestSkills(projectDir) {
|
|
48355
48757
|
const suggestions = [];
|
|
48356
|
-
const pkgPath =
|
|
48357
|
-
if (!
|
|
48758
|
+
const pkgPath = path35.join(projectDir, "package.json");
|
|
48759
|
+
if (!fs31.existsSync(pkgPath)) return suggestions;
|
|
48358
48760
|
try {
|
|
48359
|
-
const pkg = JSON.parse(
|
|
48761
|
+
const pkg = JSON.parse(fs31.readFileSync(pkgPath, "utf8"));
|
|
48360
48762
|
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
48361
48763
|
if (deps["detox"] || deps["maestro"]) {
|
|
48362
48764
|
suggestions.push("maestro-test");
|