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/vite-swift.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;
|
|
@@ -287,8 +287,8 @@ __export(vite_plugin_swift_exports, {
|
|
|
287
287
|
swiftPlugin: () => swiftPlugin
|
|
288
288
|
});
|
|
289
289
|
module.exports = __toCommonJS(vite_plugin_swift_exports);
|
|
290
|
-
var
|
|
291
|
-
var
|
|
290
|
+
var import_node_fs12 = __toESM(require("node:fs"), 1);
|
|
291
|
+
var import_node_path14 = __toESM(require("node:path"), 1);
|
|
292
292
|
|
|
293
293
|
// ../sootsim-swift/src/entryModule.ts
|
|
294
294
|
function nativeExportLines(args, commonjs) {
|
|
@@ -1227,14 +1227,14 @@ function liftExtensionOverrides(source, extraObjCExtensions) {
|
|
|
1227
1227
|
const args = forwardedArguments(source.slice(open + 1, close));
|
|
1228
1228
|
if (args === null) continue;
|
|
1229
1229
|
const call = (clause.includes("->") ? "return " : "") + (/\b(?:throws|rethrows)\b/.test(clause) ? "try " : "") + (/\basync\b/.test(clause) ? "await " : "") + `__peach_ext_${name}(${args})`;
|
|
1230
|
-
const
|
|
1230
|
+
const signature2 = `func ${name}${func[3] ?? ""}${source.slice(open, close + 1)}${clause ? ` ${clause}` : ""}`;
|
|
1231
1231
|
const nameAt = at + rest.indexOf(name, rest.indexOf("func", "override".length + func[1].length) + 4);
|
|
1232
1232
|
lifted.push({
|
|
1233
1233
|
type: top.name,
|
|
1234
1234
|
member: name,
|
|
1235
1235
|
at,
|
|
1236
1236
|
modifiers,
|
|
1237
|
-
decl:
|
|
1237
|
+
decl: signature2,
|
|
1238
1238
|
forward: `{ ${call} };`,
|
|
1239
1239
|
nameAt,
|
|
1240
1240
|
edits: [
|
|
@@ -1958,11 +1958,10 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
1958
1958
|
}
|
|
1959
1959
|
|
|
1960
1960
|
// src/swift-host.ts
|
|
1961
|
-
var
|
|
1962
|
-
var
|
|
1963
|
-
var
|
|
1964
|
-
var
|
|
1965
|
-
var import_node_path12 = __toESM(require("node:path"), 1);
|
|
1961
|
+
var import_node_crypto6 = require("node:crypto");
|
|
1962
|
+
var import_node_fs11 = __toESM(require("node:fs"), 1);
|
|
1963
|
+
var import_node_os7 = __toESM(require("node:os"), 1);
|
|
1964
|
+
var import_node_path13 = __toESM(require("node:path"), 1);
|
|
1966
1965
|
|
|
1967
1966
|
// ../sootsim-swift/src/bundleAssets.ts
|
|
1968
1967
|
var import_svgpath = __toESM(require("svgpath"), 1);
|
|
@@ -1996,8 +1995,8 @@ function pickImagesetFile(images) {
|
|
|
1996
1995
|
scale: pick.scale === "2x" ? 2 : pick.scale === "3x" ? 3 : 1
|
|
1997
1996
|
};
|
|
1998
1997
|
}
|
|
1999
|
-
function flatScale(
|
|
2000
|
-
const match = /@([23])x\.[^./]+$/.exec(
|
|
1998
|
+
function flatScale(path14) {
|
|
1999
|
+
const match = /@([23])x\.[^./]+$/.exec(path14);
|
|
2001
2000
|
return match ? Number(match[1]) : 1;
|
|
2002
2001
|
}
|
|
2003
2002
|
function providesNamespace(text2) {
|
|
@@ -2024,13 +2023,13 @@ function catalogEntryName(contentsPath, kind, readText) {
|
|
|
2024
2023
|
}
|
|
2025
2024
|
return segments.join("/");
|
|
2026
2025
|
}
|
|
2027
|
-
function isFlatResourceImage(
|
|
2028
|
-
return
|
|
2026
|
+
function isFlatResourceImage(path14) {
|
|
2027
|
+
return path14.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path14));
|
|
2029
2028
|
}
|
|
2030
2029
|
function enumerateBundleImages(paths, readText) {
|
|
2031
2030
|
const table = [];
|
|
2032
2031
|
const seen = /* @__PURE__ */ new Set();
|
|
2033
|
-
const catalogs = paths.filter((
|
|
2032
|
+
const catalogs = paths.filter((path14) => baseOf(path14) === "Contents.json");
|
|
2034
2033
|
for (const contentsPath of catalogs) {
|
|
2035
2034
|
const name = catalogEntryName(contentsPath, ".imageset", readText);
|
|
2036
2035
|
if (name === null || seen.has(name)) continue;
|
|
@@ -2051,12 +2050,12 @@ function enumerateBundleImages(paths, readText) {
|
|
|
2051
2050
|
seen.add(name);
|
|
2052
2051
|
table.push({ name, file: `${dir}/${pick.filename}`, scale: pick.scale });
|
|
2053
2052
|
}
|
|
2054
|
-
for (const
|
|
2055
|
-
if (!isFlatResourceImage(
|
|
2056
|
-
const name = baseOf(
|
|
2053
|
+
for (const path14 of paths) {
|
|
2054
|
+
if (!isFlatResourceImage(path14)) continue;
|
|
2055
|
+
const name = baseOf(path14).slice(0, -extOf(path14).length);
|
|
2057
2056
|
if (name === "" || seen.has(name)) continue;
|
|
2058
2057
|
seen.add(name);
|
|
2059
|
-
table.push({ name, file:
|
|
2058
|
+
table.push({ name, file: path14, scale: flatScale(path14) });
|
|
2060
2059
|
}
|
|
2061
2060
|
return table;
|
|
2062
2061
|
}
|
|
@@ -2085,7 +2084,7 @@ function colorsetValue(color) {
|
|
|
2085
2084
|
}
|
|
2086
2085
|
function enumerateBundleColors(paths, readText) {
|
|
2087
2086
|
const table = {};
|
|
2088
|
-
for (const contentsPath of paths.filter((
|
|
2087
|
+
for (const contentsPath of paths.filter((path14) => baseOf(path14) === "Contents.json")) {
|
|
2089
2088
|
const name = catalogEntryName(contentsPath, ".colorset", readText);
|
|
2090
2089
|
if (name === null || name in table) continue;
|
|
2091
2090
|
let colors;
|
|
@@ -2150,8 +2149,8 @@ function axisExtremes(points) {
|
|
|
2150
2149
|
function pathBounds(d) {
|
|
2151
2150
|
const xs = [];
|
|
2152
2151
|
const ys = [];
|
|
2153
|
-
for (const
|
|
2154
|
-
(0, import_svgpath.default)(
|
|
2152
|
+
for (const path14 of d)
|
|
2153
|
+
(0, import_svgpath.default)(path14).abs().unshort().unarc().iterate((segment, _index, x, y) => {
|
|
2155
2154
|
const [command, ...args] = segment;
|
|
2156
2155
|
if (command === "M" || command === "L") {
|
|
2157
2156
|
xs.push(Number(args[0]));
|
|
@@ -2178,7 +2177,7 @@ function guide(svg, id, axis) {
|
|
|
2178
2177
|
}
|
|
2179
2178
|
function enumerateBundleSymbols(paths, readText) {
|
|
2180
2179
|
const table = {};
|
|
2181
|
-
for (const contentsPath of paths.filter((
|
|
2180
|
+
for (const contentsPath of paths.filter((path14) => baseOf(path14) === "Contents.json")) {
|
|
2182
2181
|
const name = catalogEntryName(contentsPath, ".symbolset", readText);
|
|
2183
2182
|
if (name === null || name in table) continue;
|
|
2184
2183
|
let symbols;
|
|
@@ -2211,8 +2210,8 @@ function enumerateBundleSymbols(paths, readText) {
|
|
|
2211
2210
|
viewBox: "0 0 24 24",
|
|
2212
2211
|
advance,
|
|
2213
2212
|
box: [12 - advance / 2, 12 - tall / 2, advance, tall],
|
|
2214
|
-
layers: d.map((
|
|
2215
|
-
d: (0, import_svgpath.default)(
|
|
2213
|
+
layers: d.map((path14) => ({
|
|
2214
|
+
d: (0, import_svgpath.default)(path14).abs().scale(scale).translate(translateX, translateY).round(3).toString()
|
|
2216
2215
|
}))
|
|
2217
2216
|
};
|
|
2218
2217
|
}
|
|
@@ -2222,7 +2221,7 @@ function enumerateBundleJson(paths) {
|
|
|
2222
2221
|
const found = [];
|
|
2223
2222
|
const seen = /* @__PURE__ */ new Set();
|
|
2224
2223
|
const ordered = [...paths].filter(
|
|
2225
|
-
(
|
|
2224
|
+
(path14) => path14.split("/").includes("Resources") && path14.split("/").every((segment) => segment !== "" && segment !== "..") && (extOf(path14) === ".json" || extOf(path14) === ".xcstrings")
|
|
2226
2225
|
).sort((a, b) => {
|
|
2227
2226
|
const aDepth = a.split("/").length;
|
|
2228
2227
|
const bDepth = b.split("/").length;
|
|
@@ -2437,25 +2436,400 @@ function resolveContrastBackendOrigin(currentOrigin) {
|
|
|
2437
2436
|
return DEFAULT_CONTRAST_BACKEND_ORIGIN;
|
|
2438
2437
|
}
|
|
2439
2438
|
|
|
2440
|
-
// src/
|
|
2441
|
-
var
|
|
2442
|
-
|
|
2439
|
+
// src/ios-sdk-frameworks.json
|
|
2440
|
+
var ios_sdk_frameworks_default = {
|
|
2441
|
+
sdk: "iphonesimulator27.1",
|
|
2442
|
+
frameworks: [
|
|
2443
|
+
"ARKit",
|
|
2444
|
+
"AVFAudio",
|
|
2445
|
+
"AVFoundation",
|
|
2446
|
+
"AVKit",
|
|
2447
|
+
"AVRouting",
|
|
2448
|
+
"Accelerate",
|
|
2449
|
+
"Accessibility",
|
|
2450
|
+
"AccessoryLiveActivities",
|
|
2451
|
+
"AccessoryNotifications",
|
|
2452
|
+
"AccessorySetupKit",
|
|
2453
|
+
"AccessoryTransportExtension",
|
|
2454
|
+
"Accounts",
|
|
2455
|
+
"ActivityKit",
|
|
2456
|
+
"AdAttributionKit",
|
|
2457
|
+
"AdServices",
|
|
2458
|
+
"AdSupport",
|
|
2459
|
+
"AddressBook",
|
|
2460
|
+
"AddressBookUI",
|
|
2461
|
+
"AlarmKit",
|
|
2462
|
+
"AppClip",
|
|
2463
|
+
"AppIntents",
|
|
2464
|
+
"AppIntentsTypeSupport",
|
|
2465
|
+
"AppMigrationKit",
|
|
2466
|
+
"AppTrackingTransparency",
|
|
2467
|
+
"AssetsLibrary",
|
|
2468
|
+
"AudioToolbox",
|
|
2469
|
+
"AudioUnit",
|
|
2470
|
+
"AuthenticationServices",
|
|
2471
|
+
"AutomatedDeviceEnrollment",
|
|
2472
|
+
"AutomaticAssessmentConfiguration",
|
|
2473
|
+
"BackgroundAssets",
|
|
2474
|
+
"BackgroundTasks",
|
|
2475
|
+
"BrowserEngineCore",
|
|
2476
|
+
"BrowserEngineKit",
|
|
2477
|
+
"BrowserKit",
|
|
2478
|
+
"BusinessChat",
|
|
2479
|
+
"CFNetwork",
|
|
2480
|
+
"CallKit",
|
|
2481
|
+
"CarKey",
|
|
2482
|
+
"CarPlay",
|
|
2483
|
+
"Charts",
|
|
2484
|
+
"ClassKit",
|
|
2485
|
+
"ClassKitUI",
|
|
2486
|
+
"ClockKit",
|
|
2487
|
+
"CloudKit",
|
|
2488
|
+
"ColorSync",
|
|
2489
|
+
"Combine",
|
|
2490
|
+
"ComputeGraph",
|
|
2491
|
+
"ContactProvider",
|
|
2492
|
+
"Contacts",
|
|
2493
|
+
"ContactsUI",
|
|
2494
|
+
"CoreAudio",
|
|
2495
|
+
"CoreAudioKit",
|
|
2496
|
+
"CoreAudioTypes",
|
|
2497
|
+
"CoreBluetooth",
|
|
2498
|
+
"CoreData",
|
|
2499
|
+
"CoreFoundation",
|
|
2500
|
+
"CoreGraphics",
|
|
2501
|
+
"CoreHaptics",
|
|
2502
|
+
"CoreImage",
|
|
2503
|
+
"CoreLocation",
|
|
2504
|
+
"CoreLocationUI",
|
|
2505
|
+
"CoreMIDI",
|
|
2506
|
+
"CoreML",
|
|
2507
|
+
"CoreMedia",
|
|
2508
|
+
"CoreMotion",
|
|
2509
|
+
"CoreNFC",
|
|
2510
|
+
"CoreServices",
|
|
2511
|
+
"CoreSpotlight",
|
|
2512
|
+
"CoreTelephony",
|
|
2513
|
+
"CoreText",
|
|
2514
|
+
"CoreTransferable",
|
|
2515
|
+
"CoreVideo",
|
|
2516
|
+
"CreateMLComponents",
|
|
2517
|
+
"CryptoKit",
|
|
2518
|
+
"CryptoTokenKit",
|
|
2519
|
+
"DataDetection",
|
|
2520
|
+
"DeclaredAgeRange",
|
|
2521
|
+
"DeveloperToolsSupport",
|
|
2522
|
+
"DeviceActivity",
|
|
2523
|
+
"DeviceCheck",
|
|
2524
|
+
"DeviceDiscoveryExtension",
|
|
2525
|
+
"DeviceDiscoveryUI",
|
|
2526
|
+
"EnergyKit",
|
|
2527
|
+
"EventKit",
|
|
2528
|
+
"EventKitUI",
|
|
2529
|
+
"ExposureNotification",
|
|
2530
|
+
"ExtensionFoundation",
|
|
2531
|
+
"ExtensionKit",
|
|
2532
|
+
"ExternalAccessory",
|
|
2533
|
+
"FamilyControls",
|
|
2534
|
+
"FileProvider",
|
|
2535
|
+
"FileProviderUI",
|
|
2536
|
+
"FinanceKit",
|
|
2537
|
+
"FinanceKitUI",
|
|
2538
|
+
"Foundation",
|
|
2539
|
+
"FoundationModels",
|
|
2540
|
+
"GLKit",
|
|
2541
|
+
"GSS",
|
|
2542
|
+
"GameController",
|
|
2543
|
+
"GameKit",
|
|
2544
|
+
"GameSave",
|
|
2545
|
+
"GameplayKit",
|
|
2546
|
+
"GeoToolbox",
|
|
2547
|
+
"GroupActivities",
|
|
2548
|
+
"HealthKit",
|
|
2549
|
+
"HealthKitUI",
|
|
2550
|
+
"HomeKit",
|
|
2551
|
+
"IOKit",
|
|
2552
|
+
"IOSurface",
|
|
2553
|
+
"IdentityDocumentServices",
|
|
2554
|
+
"IdentityDocumentServicesUI",
|
|
2555
|
+
"IdentityLookup",
|
|
2556
|
+
"IdentityLookupUI",
|
|
2557
|
+
"ImageCaptureCore",
|
|
2558
|
+
"ImageIO",
|
|
2559
|
+
"ImagePlayground",
|
|
2560
|
+
"ImmersiveMediaSupport",
|
|
2561
|
+
"Intents",
|
|
2562
|
+
"IntentsUI",
|
|
2563
|
+
"JavaScriptCore",
|
|
2564
|
+
"LinkPresentation",
|
|
2565
|
+
"LinkSecurity",
|
|
2566
|
+
"LiveCommunicationKit",
|
|
2567
|
+
"LocalAuthentication",
|
|
2568
|
+
"LocalAuthenticationEmbeddedUI",
|
|
2569
|
+
"LockedCameraCapture",
|
|
2570
|
+
"ManagedApp",
|
|
2571
|
+
"ManagedAppDistribution",
|
|
2572
|
+
"ManagedSettings",
|
|
2573
|
+
"ManagedSettingsUI",
|
|
2574
|
+
"MapKit",
|
|
2575
|
+
"MarketplaceKit",
|
|
2576
|
+
"Matter",
|
|
2577
|
+
"MatterSupport",
|
|
2578
|
+
"MediaAccessibility",
|
|
2579
|
+
"MediaIntelligence",
|
|
2580
|
+
"MediaIntents",
|
|
2581
|
+
"MediaPlayer",
|
|
2582
|
+
"MediaToolbox",
|
|
2583
|
+
"MessageUI",
|
|
2584
|
+
"Messages",
|
|
2585
|
+
"Metal",
|
|
2586
|
+
"MetalKit",
|
|
2587
|
+
"MetalPerformancePrimitives",
|
|
2588
|
+
"MetalPerformanceShaders",
|
|
2589
|
+
"MetalPerformanceShadersGraph",
|
|
2590
|
+
"MetricKit",
|
|
2591
|
+
"MobileCoreServices",
|
|
2592
|
+
"ModelIO",
|
|
2593
|
+
"MultipeerConnectivity",
|
|
2594
|
+
"MusicKit",
|
|
2595
|
+
"MusicUnderstanding",
|
|
2596
|
+
"NaturalLanguage",
|
|
2597
|
+
"NearbyInteraction",
|
|
2598
|
+
"Network",
|
|
2599
|
+
"NetworkExtension",
|
|
2600
|
+
"NotificationCenter",
|
|
2601
|
+
"NowPlaying",
|
|
2602
|
+
"OSLog",
|
|
2603
|
+
"OpenAL",
|
|
2604
|
+
"OpenGLES",
|
|
2605
|
+
"PDFKit",
|
|
2606
|
+
"PHASE",
|
|
2607
|
+
"PaperKit",
|
|
2608
|
+
"PassKit",
|
|
2609
|
+
"PencilKit",
|
|
2610
|
+
"PermissionKit",
|
|
2611
|
+
"Photos",
|
|
2612
|
+
"PhotosUI",
|
|
2613
|
+
"ProximityReader",
|
|
2614
|
+
"PushKit",
|
|
2615
|
+
"PushToTalk",
|
|
2616
|
+
"QuartzCore",
|
|
2617
|
+
"QuickLook",
|
|
2618
|
+
"QuickLookThumbnailing",
|
|
2619
|
+
"RealityFoundation",
|
|
2620
|
+
"RealityKit",
|
|
2621
|
+
"RelevanceKit",
|
|
2622
|
+
"ReplayKit",
|
|
2623
|
+
"RoomPlan",
|
|
2624
|
+
"SafariServices",
|
|
2625
|
+
"SafetyKit",
|
|
2626
|
+
"SceneKit",
|
|
2627
|
+
"ScreenTime",
|
|
2628
|
+
"SecureElementCredential",
|
|
2629
|
+
"Security",
|
|
2630
|
+
"SecurityUI",
|
|
2631
|
+
"SensitiveContentAnalysis",
|
|
2632
|
+
"SensorKit",
|
|
2633
|
+
"ServicesAccountLinking",
|
|
2634
|
+
"SharedWithYou",
|
|
2635
|
+
"SharedWithYouCore",
|
|
2636
|
+
"ShazamKit",
|
|
2637
|
+
"Social",
|
|
2638
|
+
"SoundAnalysis",
|
|
2639
|
+
"Speech",
|
|
2640
|
+
"SpriteKit",
|
|
2641
|
+
"StateReporting",
|
|
2642
|
+
"StoreKit",
|
|
2643
|
+
"SuggestedActions",
|
|
2644
|
+
"SwiftData",
|
|
2645
|
+
"SwiftUI",
|
|
2646
|
+
"SwiftUICore",
|
|
2647
|
+
"Symbols",
|
|
2648
|
+
"SystemConfiguration",
|
|
2649
|
+
"SystemExtensions",
|
|
2650
|
+
"TabularData",
|
|
2651
|
+
"TelephonyMessagingKit",
|
|
2652
|
+
"TipKit",
|
|
2653
|
+
"TouchController",
|
|
2654
|
+
"Translation",
|
|
2655
|
+
"TranslationUIProvider",
|
|
2656
|
+
"TrustInsights",
|
|
2657
|
+
"Twitter",
|
|
2658
|
+
"UIKit",
|
|
2659
|
+
"USDKit",
|
|
2660
|
+
"UniformTypeIdentifiers",
|
|
2661
|
+
"UserNotifications",
|
|
2662
|
+
"UserNotificationsUI",
|
|
2663
|
+
"VideoSubscriberAccount",
|
|
2664
|
+
"VideoToolbox",
|
|
2665
|
+
"Vision",
|
|
2666
|
+
"VisionKit",
|
|
2667
|
+
"WatchConnectivity",
|
|
2668
|
+
"WeatherKit",
|
|
2669
|
+
"WebKit",
|
|
2670
|
+
"WiFiAware",
|
|
2671
|
+
"WidgetKit",
|
|
2672
|
+
"WorkoutKit",
|
|
2673
|
+
"_AVKit_SwiftUI",
|
|
2674
|
+
"_AdAttributionKit_StoreKit",
|
|
2675
|
+
"_AppIntents_HealthKit",
|
|
2676
|
+
"_AppIntents_SwiftUI",
|
|
2677
|
+
"_AppIntents_UIKit",
|
|
2678
|
+
"_AuthenticationServices_SwiftUI",
|
|
2679
|
+
"_Contacts_AppIntents",
|
|
2680
|
+
"_CoreData_CloudKit",
|
|
2681
|
+
"_CoreLocationUI_SwiftUI",
|
|
2682
|
+
"_CoreNFC_UIKit",
|
|
2683
|
+
"_CoreSpotlight_FoundationModels",
|
|
2684
|
+
"_DataDetection_SwiftUI",
|
|
2685
|
+
"_DeviceActivity_SwiftUI",
|
|
2686
|
+
"_DeviceDiscoveryUI_SwiftUI",
|
|
2687
|
+
"_FinanceKit_AppIntents",
|
|
2688
|
+
"_FoundationModels_SwiftUI",
|
|
2689
|
+
"_FoundationModels_UIKit",
|
|
2690
|
+
"_GameController_SwiftUI",
|
|
2691
|
+
"_GeoToolbox_AppIntents",
|
|
2692
|
+
"_GroupActivities_UIKit",
|
|
2693
|
+
"_HomeKit_SwiftUI",
|
|
2694
|
+
"_Intents_TipKit",
|
|
2695
|
+
"_LinkPresentation_AppIntents",
|
|
2696
|
+
"_LocationEssentials",
|
|
2697
|
+
"_MapKit_SwiftUI",
|
|
2698
|
+
"_MarketplaceKit_UIKit",
|
|
2699
|
+
"_MediaIntents_AppIntents",
|
|
2700
|
+
"_MediaPlayer_AppIntents",
|
|
2701
|
+
"_MusicKit_SwiftUI",
|
|
2702
|
+
"_NowPlaying_AppIntents",
|
|
2703
|
+
"_PassKit_SwiftUI",
|
|
2704
|
+
"_PermissionKit_SwiftUI",
|
|
2705
|
+
"_PermissionKit_UIKit",
|
|
2706
|
+
"_PhotosUI_SwiftUI",
|
|
2707
|
+
"_PhotosUI_WidgetKit",
|
|
2708
|
+
"_Photos_AppIntents",
|
|
2709
|
+
"_QuickLook_SwiftUI",
|
|
2710
|
+
"_RealityKit_ComputeGraph",
|
|
2711
|
+
"_RealityKit_SwiftUI",
|
|
2712
|
+
"_RelevanceKit_MapKit",
|
|
2713
|
+
"_SceneKit_SwiftUI",
|
|
2714
|
+
"_SecureElementCredential_SwiftUI",
|
|
2715
|
+
"_SecureElementCredential_UIKit",
|
|
2716
|
+
"_SharedWithYou_AppIntents",
|
|
2717
|
+
"_SpriteKit_SwiftUI",
|
|
2718
|
+
"_StoreKit_SwiftUI",
|
|
2719
|
+
"_SwiftData_CoreData",
|
|
2720
|
+
"_SwiftData_SwiftUI",
|
|
2721
|
+
"_Translation_SwiftUI",
|
|
2722
|
+
"_USDKit_RealityKit",
|
|
2723
|
+
"_UserNotifications_AppIntents",
|
|
2724
|
+
"_WebKit_SwiftUI",
|
|
2725
|
+
"_WorkoutKit_SwiftUI",
|
|
2726
|
+
"iAd"
|
|
2727
|
+
]
|
|
2728
|
+
};
|
|
2443
2729
|
|
|
2444
|
-
//
|
|
2445
|
-
var
|
|
2446
|
-
var import_node_crypto3 = __toESM(require("node:crypto"), 1);
|
|
2730
|
+
// src/swift-binary-modules.ts
|
|
2731
|
+
var import_node_crypto3 = require("node:crypto");
|
|
2447
2732
|
var import_node_fs4 = __toESM(require("node:fs"), 1);
|
|
2448
2733
|
var import_node_os3 = __toESM(require("node:os"), 1);
|
|
2449
2734
|
var import_node_path5 = __toESM(require("node:path"), 1);
|
|
2735
|
+
var cacheDir = import_node_path5.default.join(import_node_os3.default.tmpdir(), "peach-swift-binary-modules");
|
|
2736
|
+
function frameworkModules(paths) {
|
|
2737
|
+
const modules = /* @__PURE__ */ new Set();
|
|
2738
|
+
for (const file of paths) {
|
|
2739
|
+
const segment = file.split("/").find((part) => part.endsWith(".framework"));
|
|
2740
|
+
if (segment) modules.add(segment.slice(0, -".framework".length));
|
|
2741
|
+
}
|
|
2742
|
+
return [...modules].sort();
|
|
2743
|
+
}
|
|
2744
|
+
async function range(url, spec) {
|
|
2745
|
+
const response = await fetch(url, {
|
|
2746
|
+
headers: { range: `bytes=${spec}` },
|
|
2747
|
+
signal: AbortSignal.timeout(2e4)
|
|
2748
|
+
});
|
|
2749
|
+
const match = /^bytes (\d+)-\d+\/(\d+)$/.exec(
|
|
2750
|
+
response.headers.get("content-range") ?? ""
|
|
2751
|
+
);
|
|
2752
|
+
if (response.status !== 206 || !match)
|
|
2753
|
+
throw new Error(`${url} answered ${response.status} to a range request`);
|
|
2754
|
+
return {
|
|
2755
|
+
bytes: Buffer.from(await response.arrayBuffer()),
|
|
2756
|
+
start: Number(match[1]),
|
|
2757
|
+
total: Number(match[2])
|
|
2758
|
+
};
|
|
2759
|
+
}
|
|
2760
|
+
var signature = (bytes, value) => {
|
|
2761
|
+
const needle = Buffer.alloc(4);
|
|
2762
|
+
needle.writeUInt32LE(value);
|
|
2763
|
+
return bytes.lastIndexOf(needle);
|
|
2764
|
+
};
|
|
2765
|
+
async function zipEntries(url) {
|
|
2766
|
+
const { total } = await range(url, "0-0");
|
|
2767
|
+
const tail = await range(url, `${Math.max(0, total - 65558)}-${total - 1}`);
|
|
2768
|
+
const end = signature(tail.bytes, 101010256);
|
|
2769
|
+
if (end < 0) throw new Error(`${url} has no zip end record`);
|
|
2770
|
+
let size = tail.bytes.readUInt32LE(end + 12);
|
|
2771
|
+
let offset = tail.bytes.readUInt32LE(end + 16);
|
|
2772
|
+
if (offset === 4294967295 || size === 4294967295) {
|
|
2773
|
+
const locator = end - 20;
|
|
2774
|
+
if (locator < 0 || tail.bytes.readUInt32LE(locator) !== 117853008)
|
|
2775
|
+
throw new Error(`${url} has no zip64 locator`);
|
|
2776
|
+
const recordAt = Number(tail.bytes.readBigUInt64LE(locator + 8));
|
|
2777
|
+
const record2 = recordAt >= tail.start ? tail.bytes.subarray(recordAt - tail.start) : (await range(url, `${recordAt}-${recordAt + 55}`)).bytes;
|
|
2778
|
+
size = Number(record2.readBigUInt64LE(40));
|
|
2779
|
+
offset = Number(record2.readBigUInt64LE(48));
|
|
2780
|
+
}
|
|
2781
|
+
const directory = offset >= tail.start ? tail.bytes.subarray(offset - tail.start, offset - tail.start + size) : (await range(url, `${offset}-${offset + size - 1}`)).bytes;
|
|
2782
|
+
const names = [];
|
|
2783
|
+
for (let at = 0; at + 46 <= directory.length; ) {
|
|
2784
|
+
if (directory.readUInt32LE(at) !== 33639248) break;
|
|
2785
|
+
const nameLength = directory.readUInt16LE(at + 28);
|
|
2786
|
+
names.push(directory.toString("utf8", at + 46, at + 46 + nameLength));
|
|
2787
|
+
at += 46 + nameLength + directory.readUInt16LE(at + 30) + directory.readUInt16LE(at + 32);
|
|
2788
|
+
}
|
|
2789
|
+
return names;
|
|
2790
|
+
}
|
|
2791
|
+
function localEntries(dir) {
|
|
2792
|
+
if (!import_node_fs4.default.existsSync(dir)) return [];
|
|
2793
|
+
return import_node_fs4.default.readdirSync(dir, { withFileTypes: true }).filter((slice) => slice.isDirectory()).flatMap(
|
|
2794
|
+
(slice) => import_node_fs4.default.readdirSync(import_node_path5.default.join(dir, slice.name)).map((entry) => `${slice.name}/${entry}`)
|
|
2795
|
+
);
|
|
2796
|
+
}
|
|
2797
|
+
async function swiftBinaryModules(binary) {
|
|
2798
|
+
if (!binary.url) return frameworkModules(localEntries(binary.dir));
|
|
2799
|
+
const cached = import_node_path5.default.join(
|
|
2800
|
+
cacheDir,
|
|
2801
|
+
`${(0, import_node_crypto3.createHash)("sha256").update(binary.url).digest("hex").slice(0, 32)}.json`
|
|
2802
|
+
);
|
|
2803
|
+
if (import_node_fs4.default.existsSync(cached)) {
|
|
2804
|
+
const value = JSON.parse(import_node_fs4.default.readFileSync(cached, "utf8"));
|
|
2805
|
+
if (Array.isArray(value) && value.every((name) => typeof name === "string"))
|
|
2806
|
+
return value;
|
|
2807
|
+
}
|
|
2808
|
+
const modules = frameworkModules(await zipEntries(binary.url));
|
|
2809
|
+
import_node_fs4.default.mkdirSync(cacheDir, { recursive: true });
|
|
2810
|
+
import_node_fs4.default.writeFileSync(cached, JSON.stringify(modules));
|
|
2811
|
+
return modules;
|
|
2812
|
+
}
|
|
2813
|
+
|
|
2814
|
+
// src/swift-distribution.ts
|
|
2815
|
+
var import_node_fs7 = __toESM(require("node:fs"), 1);
|
|
2816
|
+
var import_node_path8 = __toESM(require("node:path"), 1);
|
|
2817
|
+
|
|
2818
|
+
// ../contrast-runtime-delivery/src/index.ts
|
|
2819
|
+
var import_node_child_process3 = require("node:child_process");
|
|
2820
|
+
var import_node_crypto4 = __toESM(require("node:crypto"), 1);
|
|
2821
|
+
var import_node_fs5 = __toESM(require("node:fs"), 1);
|
|
2822
|
+
var import_node_os4 = __toESM(require("node:os"), 1);
|
|
2823
|
+
var import_node_path6 = __toESM(require("node:path"), 1);
|
|
2450
2824
|
var import_node_stream = require("node:stream");
|
|
2451
2825
|
var import_promises = require("node:stream/promises");
|
|
2452
2826
|
async function installVerifiedTarball(tarball) {
|
|
2453
2827
|
const { url, digest, destDir, installedMarker, label } = tarball;
|
|
2454
|
-
const downloadDir =
|
|
2455
|
-
const archivePath =
|
|
2456
|
-
|
|
2457
|
-
const tmpDir =
|
|
2458
|
-
|
|
2828
|
+
const downloadDir = import_node_fs5.default.mkdtempSync(import_node_path6.default.join(import_node_os4.default.tmpdir(), "runtime-delivery-download-"));
|
|
2829
|
+
const archivePath = import_node_path6.default.join(downloadDir, "archive");
|
|
2830
|
+
import_node_fs5.default.mkdirSync(import_node_path6.default.dirname(destDir), { recursive: true });
|
|
2831
|
+
const tmpDir = import_node_fs5.default.mkdtempSync(
|
|
2832
|
+
import_node_path6.default.join(import_node_path6.default.dirname(destDir), `.installing-${import_node_path6.default.basename(destDir)}-`)
|
|
2459
2833
|
);
|
|
2460
2834
|
try {
|
|
2461
2835
|
await downloadToFile(url, archivePath);
|
|
@@ -2467,33 +2841,33 @@ async function installVerifiedTarball(tarball) {
|
|
|
2467
2841
|
}
|
|
2468
2842
|
if (new URL(url).pathname.endsWith(".zip")) await extractZip(archivePath, tmpDir);
|
|
2469
2843
|
else await extractTarball(archivePath, tmpDir, tarball.stripComponents ?? 0);
|
|
2470
|
-
if (!
|
|
2844
|
+
if (!import_node_fs5.default.existsSync(import_node_path6.default.join(tmpDir, installedMarker))) {
|
|
2471
2845
|
throw new Error(`extracted tarball for ${label} is missing ${installedMarker}`);
|
|
2472
2846
|
}
|
|
2473
2847
|
tarball.verify?.(tmpDir);
|
|
2474
2848
|
try {
|
|
2475
|
-
|
|
2849
|
+
import_node_fs5.default.renameSync(tmpDir, destDir);
|
|
2476
2850
|
} catch (err) {
|
|
2477
2851
|
if (!isErrnoCode(err, "ENOTEMPTY", "EEXIST")) throw err;
|
|
2478
2852
|
const aside = `${tmpDir}-replaced`;
|
|
2479
2853
|
try {
|
|
2480
|
-
|
|
2854
|
+
import_node_fs5.default.renameSync(destDir, aside);
|
|
2481
2855
|
} catch (moveErr) {
|
|
2482
2856
|
if (!isErrnoCode(moveErr, "ENOENT")) throw moveErr;
|
|
2483
2857
|
}
|
|
2484
2858
|
try {
|
|
2485
|
-
|
|
2859
|
+
import_node_fs5.default.renameSync(tmpDir, destDir);
|
|
2486
2860
|
} catch (landErr) {
|
|
2487
|
-
if (!isErrnoCode(landErr, "ENOTEMPTY", "EEXIST") || !
|
|
2861
|
+
if (!isErrnoCode(landErr, "ENOTEMPTY", "EEXIST") || !import_node_fs5.default.existsSync(import_node_path6.default.join(destDir, installedMarker))) {
|
|
2488
2862
|
throw landErr;
|
|
2489
2863
|
}
|
|
2490
2864
|
} finally {
|
|
2491
|
-
|
|
2865
|
+
import_node_fs5.default.rmSync(aside, { recursive: true, force: true });
|
|
2492
2866
|
}
|
|
2493
2867
|
}
|
|
2494
2868
|
} finally {
|
|
2495
|
-
|
|
2496
|
-
|
|
2869
|
+
import_node_fs5.default.rmSync(tmpDir, { recursive: true, force: true });
|
|
2870
|
+
import_node_fs5.default.rmSync(downloadDir, { recursive: true, force: true });
|
|
2497
2871
|
}
|
|
2498
2872
|
}
|
|
2499
2873
|
function isErrnoCode(err, ...codes) {
|
|
@@ -2504,17 +2878,17 @@ async function downloadToFile(url, destPath) {
|
|
|
2504
2878
|
if (!res.ok || !res.body) {
|
|
2505
2879
|
throw new Error(`download failed: ${res.status} ${res.statusText} (${url})`);
|
|
2506
2880
|
}
|
|
2507
|
-
|
|
2881
|
+
import_node_fs5.default.mkdirSync(import_node_path6.default.dirname(destPath), { recursive: true });
|
|
2508
2882
|
const tmp = `${destPath}.partial`;
|
|
2509
2883
|
try {
|
|
2510
2884
|
await (0, import_promises.pipeline)(
|
|
2511
2885
|
import_node_stream.Readable.fromWeb(res.body),
|
|
2512
|
-
|
|
2886
|
+
import_node_fs5.default.createWriteStream(tmp)
|
|
2513
2887
|
);
|
|
2514
|
-
|
|
2888
|
+
import_node_fs5.default.renameSync(tmp, destPath);
|
|
2515
2889
|
} catch (err) {
|
|
2516
2890
|
try {
|
|
2517
|
-
|
|
2891
|
+
import_node_fs5.default.unlinkSync(tmp);
|
|
2518
2892
|
} catch {
|
|
2519
2893
|
}
|
|
2520
2894
|
throw err;
|
|
@@ -2522,8 +2896,8 @@ async function downloadToFile(url, destPath) {
|
|
|
2522
2896
|
}
|
|
2523
2897
|
function digestFile(filePath, algorithm, encoding) {
|
|
2524
2898
|
return new Promise((resolve2, reject) => {
|
|
2525
|
-
const hash =
|
|
2526
|
-
const stream =
|
|
2899
|
+
const hash = import_node_crypto4.default.createHash(algorithm);
|
|
2900
|
+
const stream = import_node_fs5.default.createReadStream(filePath);
|
|
2527
2901
|
stream.on("data", (chunk) => hash.update(chunk));
|
|
2528
2902
|
stream.on("error", reject);
|
|
2529
2903
|
stream.on("end", () => resolve2(hash.digest(encoding)));
|
|
@@ -2576,30 +2950,30 @@ var swift_distribution_lock_default = {
|
|
|
2576
2950
|
|
|
2577
2951
|
// src/swift-toolchain.ts
|
|
2578
2952
|
var import_node_child_process4 = require("node:child_process");
|
|
2579
|
-
var
|
|
2580
|
-
var
|
|
2581
|
-
var
|
|
2953
|
+
var import_node_fs6 = __toESM(require("node:fs"), 1);
|
|
2954
|
+
var import_node_os5 = __toESM(require("node:os"), 1);
|
|
2955
|
+
var import_node_path7 = __toESM(require("node:path"), 1);
|
|
2582
2956
|
function swiftToolchainBin(release) {
|
|
2583
2957
|
if (process.platform === "darwin") {
|
|
2584
|
-
const dirs = [
|
|
2585
|
-
(base) =>
|
|
2958
|
+
const dirs = [import_node_os5.default.homedir(), "/"].map(
|
|
2959
|
+
(base) => import_node_path7.default.join(base, `Library/Developer/Toolchains/${release}.xctoolchain/usr/bin`)
|
|
2586
2960
|
);
|
|
2587
|
-
return dirs.find((dir) =>
|
|
2961
|
+
return dirs.find((dir) => import_node_fs6.default.existsSync(import_node_path7.default.join(dir, "swift"))) ?? dirs[0];
|
|
2588
2962
|
}
|
|
2589
2963
|
if (process.env.CONTRAST_SWIFT_TOOLCHAINS) {
|
|
2590
|
-
return
|
|
2964
|
+
return import_node_path7.default.join(process.env.CONTRAST_SWIFT_TOOLCHAINS, release, "usr/bin");
|
|
2591
2965
|
}
|
|
2592
|
-
const image =
|
|
2593
|
-
if (
|
|
2594
|
-
return (process.env.PATH ?? "").split(
|
|
2966
|
+
const image = import_node_path7.default.join("/opt/swift", release, "usr/bin");
|
|
2967
|
+
if (import_node_fs6.default.existsSync(import_node_path7.default.join(image, "swift"))) return image;
|
|
2968
|
+
return (process.env.PATH ?? "").split(import_node_path7.default.delimiter).find((dir) => dir && import_node_fs6.default.existsSync(import_node_path7.default.join(dir, "swift"))) ?? image;
|
|
2595
2969
|
}
|
|
2596
2970
|
var verified = /* @__PURE__ */ new Map();
|
|
2597
2971
|
function swiftToolchain(release, sdk) {
|
|
2598
2972
|
const cached = verified.get(`${release}\0${sdk.wasmSdkId}`);
|
|
2599
2973
|
if (cached) return cached;
|
|
2600
2974
|
const bin = swiftToolchainBin(release);
|
|
2601
|
-
const swift =
|
|
2602
|
-
const version =
|
|
2975
|
+
const swift = import_node_path7.default.join(bin, "swift");
|
|
2976
|
+
const version = import_node_fs6.default.existsSync(swift) ? (0, import_node_child_process4.execFileSync)(swift, ["--version"], {
|
|
2603
2977
|
encoding: "utf8",
|
|
2604
2978
|
stdio: ["ignore", "pipe", "pipe"]
|
|
2605
2979
|
}) : "";
|
|
@@ -2660,11 +3034,11 @@ function swiftDistributionRoot() {
|
|
|
2660
3034
|
);
|
|
2661
3035
|
}
|
|
2662
3036
|
swiftToolchain(lock.release, lock);
|
|
2663
|
-
const dir =
|
|
3037
|
+
const dir = import_node_path8.default.join(rnxHomeDir(), "swift", `${lock.id}-${host2}`);
|
|
2664
3038
|
let pending = installs.get(dir);
|
|
2665
3039
|
if (!pending) {
|
|
2666
3040
|
pending = (async () => {
|
|
2667
|
-
if (!
|
|
3041
|
+
if (!import_node_fs7.default.existsSync(import_node_path8.default.join(dir, SWIFT_DISTRIBUTION_MANIFEST))) {
|
|
2668
3042
|
process.stderr.write(
|
|
2669
3043
|
`peach: downloading Swift distribution ${lock.id} (${host2})\u2026
|
|
2670
3044
|
`
|
|
@@ -2693,7 +3067,7 @@ function swiftDistributionRoot() {
|
|
|
2693
3067
|
return pending;
|
|
2694
3068
|
}
|
|
2695
3069
|
function swiftModuleToolchain(root) {
|
|
2696
|
-
const pin = swiftDistributionAt(root) ?? JSON.parse(
|
|
3070
|
+
const pin = swiftDistributionAt(root) ?? JSON.parse(import_node_fs7.default.readFileSync(import_node_path8.default.join(root, "toolchain.json"), "utf8"));
|
|
2697
3071
|
return {
|
|
2698
3072
|
release: pin.release,
|
|
2699
3073
|
toolchainBin: swiftToolchain(pin.release, swiftModuleSdk(root))
|
|
@@ -2702,15 +3076,15 @@ function swiftModuleToolchain(root) {
|
|
|
2702
3076
|
|
|
2703
3077
|
// src/swift-packages.ts
|
|
2704
3078
|
var import_node_child_process6 = require("node:child_process");
|
|
2705
|
-
var
|
|
2706
|
-
var
|
|
3079
|
+
var import_node_fs9 = __toESM(require("node:fs"), 1);
|
|
3080
|
+
var import_node_path10 = __toESM(require("node:path"), 1);
|
|
2707
3081
|
|
|
2708
3082
|
// src/swift-package-manifest.ts
|
|
2709
3083
|
var import_node_child_process5 = require("node:child_process");
|
|
2710
|
-
var
|
|
2711
|
-
var
|
|
2712
|
-
var
|
|
2713
|
-
var
|
|
3084
|
+
var import_node_crypto5 = require("node:crypto");
|
|
3085
|
+
var import_node_fs8 = __toESM(require("node:fs"), 1);
|
|
3086
|
+
var import_node_os6 = __toESM(require("node:os"), 1);
|
|
3087
|
+
var import_node_path9 = __toESM(require("node:path"), 1);
|
|
2714
3088
|
var TARGET_TYPES = [
|
|
2715
3089
|
"regular",
|
|
2716
3090
|
"executable",
|
|
@@ -2725,19 +3099,19 @@ var record = (value) => value && typeof value === "object" && !Array.isArray(val
|
|
|
2725
3099
|
var array = (value) => Array.isArray(value) ? value : [];
|
|
2726
3100
|
var string = (value) => typeof value === "string" ? value : void 0;
|
|
2727
3101
|
function swiftCommand() {
|
|
2728
|
-
return process.platform === "darwin" ? { file: "xcrun", args: ["swift"] } : { file:
|
|
3102
|
+
return process.platform === "darwin" ? { file: "xcrun", args: ["swift"] } : { file: import_node_path9.default.join(swiftToolchainBin(swift_distribution_lock_default.release), "swift"), args: [] };
|
|
2729
3103
|
}
|
|
2730
|
-
var
|
|
3104
|
+
var cacheDir2 = import_node_path9.default.join(import_node_os6.default.tmpdir(), "peach-swift-manifests");
|
|
2731
3105
|
var evaluated = /* @__PURE__ */ new Map();
|
|
2732
3106
|
function dump(dir) {
|
|
2733
|
-
const manifests =
|
|
3107
|
+
const manifests = import_node_fs8.default.readdirSync(dir).filter((name) => /^Package(@swift-[\d.]+)?\.swift$/.test(name)).sort();
|
|
2734
3108
|
const command = swiftCommand();
|
|
2735
|
-
const key = (0,
|
|
2736
|
-
manifests.map((name) => `${name}\0${
|
|
3109
|
+
const key = (0, import_node_crypto5.createHash)("sha256").update(JSON.stringify([command, import_node_path9.default.resolve(dir)])).update(
|
|
3110
|
+
manifests.map((name) => `${name}\0${import_node_fs8.default.readFileSync(import_node_path9.default.join(dir, name), "utf8")}`).join("\0")
|
|
2737
3111
|
).digest("hex").slice(0, 32);
|
|
2738
|
-
const cached =
|
|
2739
|
-
if (
|
|
2740
|
-
return { key, raw: record(JSON.parse(
|
|
3112
|
+
const cached = import_node_path9.default.join(cacheDir2, `${key}.json`);
|
|
3113
|
+
if (import_node_fs8.default.existsSync(cached))
|
|
3114
|
+
return { key, raw: record(JSON.parse(import_node_fs8.default.readFileSync(cached, "utf8"))) };
|
|
2741
3115
|
let output;
|
|
2742
3116
|
try {
|
|
2743
3117
|
output = (0, import_node_child_process5.execFileSync)(
|
|
@@ -2749,7 +3123,7 @@ function dump(dir) {
|
|
|
2749
3123
|
dir,
|
|
2750
3124
|
// swiftpm's scratch files never land in the app's own package
|
|
2751
3125
|
"--scratch-path",
|
|
2752
|
-
|
|
3126
|
+
import_node_path9.default.join(cacheDir2, `${key}.build`),
|
|
2753
3127
|
"dump-package"
|
|
2754
3128
|
],
|
|
2755
3129
|
{
|
|
@@ -2761,11 +3135,11 @@ function dump(dir) {
|
|
|
2761
3135
|
} catch (error) {
|
|
2762
3136
|
const stderr = error instanceof Error && "stderr" in error ? String(error.stderr).trim() : "";
|
|
2763
3137
|
throw new Error(
|
|
2764
|
-
`swiftpm could not evaluate ${
|
|
3138
|
+
`swiftpm could not evaluate ${import_node_path9.default.join(dir, "Package.swift")}${stderr ? `: ${stderr}` : ""}`
|
|
2765
3139
|
);
|
|
2766
3140
|
}
|
|
2767
|
-
|
|
2768
|
-
|
|
3141
|
+
import_node_fs8.default.mkdirSync(cacheDir2, { recursive: true });
|
|
3142
|
+
import_node_fs8.default.writeFileSync(cached, output);
|
|
2769
3143
|
return { key, raw: record(JSON.parse(output)) };
|
|
2770
3144
|
}
|
|
2771
3145
|
function defaultTraits(manifest) {
|
|
@@ -2793,7 +3167,7 @@ function linksOnIOS(condition, traits) {
|
|
|
2793
3167
|
return gates.length === 0 || gates.some((name) => traits.has(string(name) ?? ""));
|
|
2794
3168
|
}
|
|
2795
3169
|
function swiftPackageManifest(dir) {
|
|
2796
|
-
dir =
|
|
3170
|
+
dir = import_node_fs8.default.realpathSync(dir);
|
|
2797
3171
|
const { key, raw: raw2 } = dump(dir);
|
|
2798
3172
|
const known = evaluated.get(key);
|
|
2799
3173
|
if (known) return known;
|
|
@@ -2841,7 +3215,7 @@ function swiftPackageManifest(dir) {
|
|
|
2841
3215
|
if (!name || !isTargetType(kind)) continue;
|
|
2842
3216
|
const declared = string(target.path);
|
|
2843
3217
|
const roots = kind === "test" ? ["Tests"] : ["Sources", "Source", "src", "srcs"];
|
|
2844
|
-
const targetDir = declared ?
|
|
3218
|
+
const targetDir = declared ? import_node_path9.default.resolve(dir, declared) : roots.map((root) => import_node_path9.default.join(dir, root, name)).find((candidate) => import_node_fs8.default.existsSync(candidate)) ?? import_node_path9.default.join(dir, roots[0], name);
|
|
2845
3219
|
const dependencies = [];
|
|
2846
3220
|
for (const dependency of array(target.dependencies)) {
|
|
2847
3221
|
const { target: local, product, byName } = record(dependency);
|
|
@@ -2883,30 +3257,31 @@ function swiftPackageManifest(dir) {
|
|
|
2883
3257
|
dependencies,
|
|
2884
3258
|
languageMode,
|
|
2885
3259
|
mainActorIsolation,
|
|
2886
|
-
declaresResources: array(target.resources).length > 0
|
|
3260
|
+
declaresResources: array(target.resources).length > 0,
|
|
3261
|
+
url: string(target.url) ?? null
|
|
2887
3262
|
});
|
|
2888
3263
|
}
|
|
2889
3264
|
const manifest = { dir, products, targets, packages };
|
|
2890
3265
|
evaluated.set(key, manifest);
|
|
2891
3266
|
return manifest;
|
|
2892
3267
|
}
|
|
2893
|
-
var within = (file, roots) => roots.some((root) => file === root || file.startsWith(`${root}${
|
|
3268
|
+
var within = (file, roots) => roots.some((root) => file === root || file.startsWith(`${root}${import_node_path9.default.sep}`));
|
|
2894
3269
|
function walk(dir) {
|
|
2895
|
-
if (!
|
|
2896
|
-
if (
|
|
3270
|
+
if (!import_node_fs8.default.existsSync(dir)) return [];
|
|
3271
|
+
if (import_node_fs8.default.statSync(dir).isFile()) return [dir];
|
|
2897
3272
|
const out = [];
|
|
2898
|
-
for (const entry of
|
|
3273
|
+
for (const entry of import_node_fs8.default.readdirSync(dir, { withFileTypes: true })) {
|
|
2899
3274
|
if (entry.name.startsWith(".")) continue;
|
|
2900
|
-
const full =
|
|
3275
|
+
const full = import_node_path9.default.join(dir, entry.name);
|
|
2901
3276
|
if (entry.isDirectory()) out.push(...walk(full));
|
|
2902
3277
|
else if (entry.isFile()) out.push(full);
|
|
2903
3278
|
}
|
|
2904
3279
|
return out;
|
|
2905
3280
|
}
|
|
2906
3281
|
function swiftTargetFiles(manifest, target) {
|
|
2907
|
-
const included = target.sources ? target.sources.map((source) =>
|
|
3282
|
+
const included = target.sources ? target.sources.map((source) => import_node_path9.default.resolve(target.dir, source)) : [target.dir];
|
|
2908
3283
|
const excluded = [
|
|
2909
|
-
...target.exclude.map((file) =>
|
|
3284
|
+
...target.exclude.map((file) => import_node_path9.default.resolve(target.dir, file)),
|
|
2910
3285
|
...[...manifest.targets.values()].flatMap(
|
|
2911
3286
|
(other) => other !== target && within(other.dir, [target.dir]) && other.dir !== target.dir ? [other.dir] : []
|
|
2912
3287
|
)
|
|
@@ -2915,10 +3290,12 @@ function swiftTargetFiles(manifest, target) {
|
|
|
2915
3290
|
}
|
|
2916
3291
|
|
|
2917
3292
|
// src/swift-packages.ts
|
|
2918
|
-
var REMOTE_CHECKOUTS =
|
|
3293
|
+
var REMOTE_CHECKOUTS = import_node_path10.default.join(".build", "peach", "checkouts");
|
|
2919
3294
|
var C_FAMILY = /\.(c|cc|cpp|cxx|m|mm|s|S)$/;
|
|
3295
|
+
var BINARY = "is a binary framework";
|
|
3296
|
+
var blocker = (reasons) => reasons.find((reason) => reason?.includes(BINARY)) ?? reasons.find((reason) => reason !== null) ?? null;
|
|
2920
3297
|
function readPins(resolved) {
|
|
2921
|
-
const data = JSON.parse(
|
|
3298
|
+
const data = JSON.parse(import_node_fs9.default.readFileSync(resolved, "utf8"));
|
|
2922
3299
|
const pins = data && typeof data === "object" && "pins" in data && Array.isArray(data.pins) ? data.pins : null;
|
|
2923
3300
|
if (!pins)
|
|
2924
3301
|
throw new Error(`${resolved} has no pins; resolve packages in a current Xcode`);
|
|
@@ -2934,23 +3311,23 @@ function readPins(resolved) {
|
|
|
2934
3311
|
}
|
|
2935
3312
|
var verified2 = /* @__PURE__ */ new Set();
|
|
2936
3313
|
function checkout(checkouts, identity, pin) {
|
|
2937
|
-
const dir =
|
|
3314
|
+
const dir = import_node_path10.default.join(checkouts, identity);
|
|
2938
3315
|
const key = `${dir}\0${pin.revision}`;
|
|
2939
3316
|
if (verified2.has(key)) return dir;
|
|
2940
3317
|
const git = (...args) => (0, import_node_child_process6.execFileSync)("git", ["-C", dir, ...args], {
|
|
2941
3318
|
encoding: "utf8",
|
|
2942
3319
|
stdio: ["ignore", "pipe", "pipe"]
|
|
2943
3320
|
}).trim();
|
|
2944
|
-
const current =
|
|
3321
|
+
const current = import_node_fs9.default.existsSync(import_node_path10.default.join(dir, ".git")) ? git("rev-parse", "HEAD") : "";
|
|
2945
3322
|
if (current !== pin.revision) {
|
|
2946
|
-
|
|
2947
|
-
|
|
3323
|
+
import_node_fs9.default.rmSync(dir, { recursive: true, force: true });
|
|
3324
|
+
import_node_fs9.default.mkdirSync(dir, { recursive: true });
|
|
2948
3325
|
try {
|
|
2949
3326
|
git("init", "-q");
|
|
2950
3327
|
git("fetch", "-q", "--depth", "1", pin.location, pin.revision);
|
|
2951
3328
|
git("checkout", "-q", "FETCH_HEAD");
|
|
2952
3329
|
} catch (error) {
|
|
2953
|
-
|
|
3330
|
+
import_node_fs9.default.rmSync(dir, { recursive: true, force: true });
|
|
2954
3331
|
const stderr = error instanceof Error && "stderr" in error ? String(error.stderr).trim() : "";
|
|
2955
3332
|
throw new Error(
|
|
2956
3333
|
`could not fetch ${pin.location} at ${pin.revision}${stderr ? `: ${stderr}` : ""}`
|
|
@@ -2966,13 +3343,14 @@ function resolveSwiftPackages(options) {
|
|
|
2966
3343
|
const result = {
|
|
2967
3344
|
targets: [],
|
|
2968
3345
|
unavailable: /* @__PURE__ */ new Map(),
|
|
2969
|
-
modules: /* @__PURE__ */ new Map()
|
|
3346
|
+
modules: /* @__PURE__ */ new Map(),
|
|
3347
|
+
binaries: []
|
|
2970
3348
|
};
|
|
2971
3349
|
const pins = resolved ? readPins(resolved) : null;
|
|
2972
|
-
const checkouts =
|
|
3350
|
+
const checkouts = import_node_path10.default.join(rootDir, REMOTE_CHECKOUTS);
|
|
2973
3351
|
const packages = /* @__PURE__ */ new Map();
|
|
2974
3352
|
const load2 = (source) => {
|
|
2975
|
-
const key = source.kind === "local" ?
|
|
3353
|
+
const key = source.kind === "local" ? import_node_path10.default.resolve(source.dir) : source.url;
|
|
2976
3354
|
const cached = packages.get(key);
|
|
2977
3355
|
if (cached !== void 0) return cached;
|
|
2978
3356
|
let loaded2;
|
|
@@ -2984,8 +3362,8 @@ function resolveSwiftPackages(options) {
|
|
|
2984
3362
|
if (!pin) {
|
|
2985
3363
|
loaded2 = pins ? `package ${identity} is not pinned in Package.resolved` : "no Package.resolved pins it; resolve packages in Xcode once";
|
|
2986
3364
|
} else {
|
|
2987
|
-
|
|
2988
|
-
|
|
3365
|
+
import_node_fs9.default.mkdirSync(checkouts, { recursive: true });
|
|
3366
|
+
import_node_fs9.default.writeFileSync(import_node_path10.default.join(import_node_path10.default.dirname(checkouts), ".gitignore"), "*\n");
|
|
2989
3367
|
loaded2 = {
|
|
2990
3368
|
source: source.url,
|
|
2991
3369
|
remote: true,
|
|
@@ -3005,8 +3383,8 @@ function resolveSwiftPackages(options) {
|
|
|
3005
3383
|
const outcome = (() => {
|
|
3006
3384
|
if (provided.has(name)) return null;
|
|
3007
3385
|
const target = pkg.manifest.targets.get(name);
|
|
3008
|
-
if (!target) return `${
|
|
3009
|
-
if (target.type === "binary") return `${name}
|
|
3386
|
+
if (!target) return `${import_node_path10.default.basename(pkg.manifest.dir)} declares no target ${name}`;
|
|
3387
|
+
if (target.type === "binary") return `${name} ${BINARY}`;
|
|
3010
3388
|
if (target.type === "system") return `${name} is a system C library`;
|
|
3011
3389
|
if (target.type !== "regular") return `${name} is a ${target.type} target`;
|
|
3012
3390
|
const files = swiftTargetFiles(pkg.manifest, target);
|
|
@@ -3017,9 +3395,9 @@ function resolveSwiftPackages(options) {
|
|
|
3017
3395
|
const nested = resolveDependencyProduct(pkg, dependency.package, dependency.name);
|
|
3018
3396
|
return nested && `${dependency.name}: ${nested}`;
|
|
3019
3397
|
});
|
|
3020
|
-
const blocked = reasons
|
|
3398
|
+
const blocked = blocker(reasons);
|
|
3021
3399
|
if (blocked) return blocked;
|
|
3022
|
-
const relative = files.map((file) =>
|
|
3400
|
+
const relative = files.map((file) => import_node_path10.default.relative(target.dir, file));
|
|
3023
3401
|
targets.set(`${pkg.manifest.dir}\0${name}`, {
|
|
3024
3402
|
name,
|
|
3025
3403
|
path: "",
|
|
@@ -3041,7 +3419,7 @@ function resolveSwiftPackages(options) {
|
|
|
3041
3419
|
const resolveProduct = (pkg, product) => {
|
|
3042
3420
|
if (provided.has(product)) return null;
|
|
3043
3421
|
const roots = pkg.manifest.products.get(product);
|
|
3044
|
-
const reason = !roots ? `${
|
|
3422
|
+
const reason = !roots ? `${import_node_path10.default.basename(pkg.manifest.dir)} has no library ${product}` : blocker(roots.map((name) => resolveTarget(pkg, name)));
|
|
3045
3423
|
productOutcomes.set(`${pkg.manifest.dir}\0${product}`, { pkg, reason });
|
|
3046
3424
|
return reason;
|
|
3047
3425
|
};
|
|
@@ -3049,7 +3427,7 @@ function resolveSwiftPackages(options) {
|
|
|
3049
3427
|
if (provided.has(product)) return null;
|
|
3050
3428
|
const dependency = pkg.manifest.packages.get(packageName);
|
|
3051
3429
|
if (!dependency)
|
|
3052
|
-
return `${
|
|
3430
|
+
return `${import_node_path10.default.basename(pkg.manifest.dir)} names no package ${packageName}`;
|
|
3053
3431
|
if ("dir" in dependency) {
|
|
3054
3432
|
const loaded3 = load2({ kind: "local", dir: dependency.dir });
|
|
3055
3433
|
return typeof loaded3 === "string" ? loaded3 : resolveProduct(loaded3, product);
|
|
@@ -3076,6 +3454,13 @@ function resolveSwiftPackages(options) {
|
|
|
3076
3454
|
if (target.type === "test" || target.type === "plugin" || target.type === "macro")
|
|
3077
3455
|
continue;
|
|
3078
3456
|
if (target.type === "executable") continue;
|
|
3457
|
+
if (target.type === "binary")
|
|
3458
|
+
result.binaries.push({
|
|
3459
|
+
target: name,
|
|
3460
|
+
source: pkg.source,
|
|
3461
|
+
url: target.url,
|
|
3462
|
+
dir: target.dir
|
|
3463
|
+
});
|
|
3079
3464
|
const reason = resolveTarget(pkg, name);
|
|
3080
3465
|
if (reason && !result.modules.has(name))
|
|
3081
3466
|
result.modules.set(name, { source: pkg.source, reason });
|
|
@@ -3095,7 +3480,7 @@ function resolveSwiftPackages(options) {
|
|
|
3095
3480
|
if (dependency.kind === "target") reach(pkg, dependency.name);
|
|
3096
3481
|
else {
|
|
3097
3482
|
const source = pkg.manifest.packages.get(dependency.package);
|
|
3098
|
-
const nested = source && ("dir" in source ? packages.get(
|
|
3483
|
+
const nested = source && ("dir" in source ? packages.get(import_node_path10.default.resolve(source.dir)) : packages.get(source.url));
|
|
3099
3484
|
if (nested && typeof nested !== "string")
|
|
3100
3485
|
for (const root of nested.manifest.products.get(dependency.name) ?? [])
|
|
3101
3486
|
reach(nested, root);
|
|
@@ -3103,7 +3488,7 @@ function resolveSwiftPackages(options) {
|
|
|
3103
3488
|
}
|
|
3104
3489
|
};
|
|
3105
3490
|
for (const { product, source } of products) {
|
|
3106
|
-
const pkg = source.kind === "unnamed" ? unnamed().find((candidate) => candidate.manifest.products.has(product)) : packages.get(source.kind === "local" ?
|
|
3491
|
+
const pkg = source.kind === "unnamed" ? unnamed().find((candidate) => candidate.manifest.products.has(product)) : packages.get(source.kind === "local" ? import_node_path10.default.resolve(source.dir) : source.url);
|
|
3107
3492
|
if (!pkg || typeof pkg === "string") continue;
|
|
3108
3493
|
for (const root of pkg.manifest.products.get(product) ?? []) reach(pkg, root);
|
|
3109
3494
|
}
|
|
@@ -3248,12 +3633,12 @@ async function compileSwiftProject(submit, work, origin, signal) {
|
|
|
3248
3633
|
}
|
|
3249
3634
|
|
|
3250
3635
|
// src/xcode-project.ts
|
|
3251
|
-
var
|
|
3252
|
-
var
|
|
3636
|
+
var import_node_fs10 = __toESM(require("node:fs"), 1);
|
|
3637
|
+
var import_node_path12 = __toESM(require("node:path"), 1);
|
|
3253
3638
|
var import_plist = __toESM(require_plist(), 1);
|
|
3254
3639
|
|
|
3255
3640
|
// src/xcode-json-project.ts
|
|
3256
|
-
var
|
|
3641
|
+
var import_node_path11 = __toESM(require("node:path"), 1);
|
|
3257
3642
|
var import_json5 = __toESM(require("json5"), 1);
|
|
3258
3643
|
var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3259
3644
|
var text = (value) => typeof value === "string" ? value : void 0;
|
|
@@ -3269,7 +3654,7 @@ var PHASE_ISA = {
|
|
|
3269
3654
|
function readXcodeJsonProject(xcodeproj, source) {
|
|
3270
3655
|
const json = import_json5.default.parse(source);
|
|
3271
3656
|
if (!isJsonObject(json)) throw new Error(`${xcodeproj}/project.xcproj is not an object`);
|
|
3272
|
-
const projectDir =
|
|
3657
|
+
const projectDir = import_node_path11.default.dirname(xcodeproj);
|
|
3273
3658
|
const objects = {};
|
|
3274
3659
|
let next = 0;
|
|
3275
3660
|
const add = (entry, id) => {
|
|
@@ -3282,7 +3667,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
3282
3667
|
const base = /^<([A-Z]+)>\/(.*)$/.exec(raw2);
|
|
3283
3668
|
if (base) {
|
|
3284
3669
|
if (base[1] === "PROJECT")
|
|
3285
|
-
return { sourceTree: "<absolute>", path:
|
|
3670
|
+
return { sourceTree: "<absolute>", path: import_node_path11.default.join(projectDir, base[2]) };
|
|
3286
3671
|
if (base[1] === "PRODUCTS")
|
|
3287
3672
|
return { sourceTree: "BUILT_PRODUCTS_DIR", path: base[2] };
|
|
3288
3673
|
return null;
|
|
@@ -3290,7 +3675,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
3290
3675
|
const unescaped = raw2.replaceAll("\\<", "<");
|
|
3291
3676
|
if (unescaped.startsWith("/")) return { sourceTree: "<absolute>", path: unescaped };
|
|
3292
3677
|
if (unescaped.startsWith("~")) return null;
|
|
3293
|
-
return groupDir === null ? null : { sourceTree: "<absolute>", path:
|
|
3678
|
+
return groupDir === null ? null : { sourceTree: "<absolute>", path: import_node_path11.default.join(groupDir, unescaped) };
|
|
3294
3679
|
};
|
|
3295
3680
|
const memberships = [];
|
|
3296
3681
|
const folders = [];
|
|
@@ -3301,7 +3686,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
3301
3686
|
const kind = text(entry.kind) ?? "file-reference";
|
|
3302
3687
|
const raw2 = text(entry.path) ?? "";
|
|
3303
3688
|
const located = raw2 === "" ? null : locate(raw2, parent.dir);
|
|
3304
|
-
const name = text(entry.name) ??
|
|
3689
|
+
const name = text(entry.name) ?? import_node_path11.default.basename(raw2);
|
|
3305
3690
|
const node = { id: "", name, dir: null, parent, children: [] };
|
|
3306
3691
|
if (kind === "group" || kind === "variant-group" || kind === "version-group") {
|
|
3307
3692
|
node.dir = raw2 === "" ? parent.dir : located?.sourceTree === "<absolute>" ? located.path : null;
|
|
@@ -3416,7 +3801,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
3416
3801
|
if (!isObject(entry)) continue;
|
|
3417
3802
|
const repository = text(entry.repository);
|
|
3418
3803
|
const local = text(entry.path);
|
|
3419
|
-
const name = local !== void 0 ?
|
|
3804
|
+
const name = local !== void 0 ? import_node_path11.default.basename(import_node_path11.default.resolve(import_node_path11.default.dirname(xcodeproj), local)) : import_node_path11.default.basename(repository ?? "").replace(/\.git$/, "");
|
|
3420
3805
|
const id = text(entry.kind) === "local" && local !== void 0 ? add({ isa: "XCLocalSwiftPackageReference", relativePath: local }) : add({ isa: "XCRemoteSwiftPackageReference", repositoryURL: repository ?? "" });
|
|
3421
3806
|
packageIds.set(name.toLowerCase(), id);
|
|
3422
3807
|
}
|
|
@@ -3693,28 +4078,28 @@ var CONDITIONS = {
|
|
|
3693
4078
|
variant: "normal"
|
|
3694
4079
|
};
|
|
3695
4080
|
function walkFiles(dir) {
|
|
3696
|
-
if (!
|
|
4081
|
+
if (!import_node_fs10.default.existsSync(dir)) return [];
|
|
3697
4082
|
const out = [];
|
|
3698
|
-
for (const entry of
|
|
4083
|
+
for (const entry of import_node_fs10.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
|
|
3699
4084
|
if (entry.name.startsWith(".")) continue;
|
|
3700
|
-
const full =
|
|
4085
|
+
const full = import_node_path12.default.join(dir, entry.name);
|
|
3701
4086
|
if (entry.isDirectory()) out.push(...walkFiles(full));
|
|
3702
4087
|
else if (entry.isFile()) out.push(full);
|
|
3703
4088
|
}
|
|
3704
4089
|
return out;
|
|
3705
4090
|
}
|
|
3706
|
-
var isDirectory = (dir) =>
|
|
4091
|
+
var isDirectory = (dir) => import_node_fs10.default.existsSync(dir) && import_node_fs10.default.statSync(dir).isDirectory();
|
|
3707
4092
|
function readXcconfig(file, seen = /* @__PURE__ */ new Set()) {
|
|
3708
|
-
if (seen.has(file) || !
|
|
4093
|
+
if (seen.has(file) || !import_node_fs10.default.existsSync(file)) return {};
|
|
3709
4094
|
seen.add(file);
|
|
3710
4095
|
const settings = {};
|
|
3711
|
-
for (const raw2 of
|
|
4096
|
+
for (const raw2 of import_node_fs10.default.readFileSync(file, "utf8").split("\n")) {
|
|
3712
4097
|
const line = raw2.replace(/\/\/.*$/, "").trim();
|
|
3713
4098
|
const include = /^#include\??\s+"([^"]+)"/.exec(line);
|
|
3714
4099
|
if (include) {
|
|
3715
4100
|
Object.assign(
|
|
3716
4101
|
settings,
|
|
3717
|
-
readXcconfig(
|
|
4102
|
+
readXcconfig(import_node_path12.default.resolve(import_node_path12.default.dirname(file), include[1]), seen)
|
|
3718
4103
|
);
|
|
3719
4104
|
continue;
|
|
3720
4105
|
}
|
|
@@ -3764,22 +4149,22 @@ function decodeXml(text2) {
|
|
|
3764
4149
|
return text2.replaceAll(""", '"').replaceAll("'", "'").replaceAll("<", "<").replaceAll(">", ">").replaceAll("&", "&");
|
|
3765
4150
|
}
|
|
3766
4151
|
function workspaceReferences(workspace) {
|
|
3767
|
-
const data =
|
|
3768
|
-
if (!
|
|
4152
|
+
const data = import_node_path12.default.join(workspace, "contents.xcworkspacedata");
|
|
4153
|
+
if (!import_node_fs10.default.existsSync(data))
|
|
3769
4154
|
throw new Error(`${workspace} has no contents.xcworkspacedata`);
|
|
3770
|
-
const container =
|
|
4155
|
+
const container = import_node_path12.default.dirname(workspace);
|
|
3771
4156
|
const locate = (location, base) => {
|
|
3772
4157
|
const colon = location.indexOf(":");
|
|
3773
4158
|
const kind = location.slice(0, colon);
|
|
3774
4159
|
const rest = location.slice(colon + 1);
|
|
3775
|
-
if (kind === "group") return
|
|
3776
|
-
if (kind === "container" || kind === "self") return
|
|
3777
|
-
if (kind === "absolute") return
|
|
3778
|
-
throw new Error(`${
|
|
4160
|
+
if (kind === "group") return import_node_path12.default.resolve(base, rest);
|
|
4161
|
+
if (kind === "container" || kind === "self") return import_node_path12.default.resolve(container, rest);
|
|
4162
|
+
if (kind === "absolute") return import_node_path12.default.resolve(rest);
|
|
4163
|
+
throw new Error(`${import_node_path12.default.basename(workspace)} has an unsupported location ${location}`);
|
|
3779
4164
|
};
|
|
3780
4165
|
const groups = [container];
|
|
3781
4166
|
const references = [];
|
|
3782
|
-
for (const [, closing, tag, attributes, selfClosing] of
|
|
4167
|
+
for (const [, closing, tag, attributes, selfClosing] of import_node_fs10.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
|
|
3783
4168
|
if (closing) {
|
|
3784
4169
|
if (tag === "Group") groups.pop();
|
|
3785
4170
|
continue;
|
|
@@ -3795,8 +4180,8 @@ function workspaceReferences(workspace) {
|
|
|
3795
4180
|
var loaded = /* @__PURE__ */ new Map();
|
|
3796
4181
|
function xcodeProjectFile(xcodeproj) {
|
|
3797
4182
|
for (const name of ["project.pbxproj", "project.xcproj"]) {
|
|
3798
|
-
const file =
|
|
3799
|
-
if (
|
|
4183
|
+
const file = import_node_path12.default.join(xcodeproj, name);
|
|
4184
|
+
if (import_node_fs10.default.existsSync(file)) return file;
|
|
3800
4185
|
}
|
|
3801
4186
|
return null;
|
|
3802
4187
|
}
|
|
@@ -3804,10 +4189,10 @@ function loadProject(xcodeproj) {
|
|
|
3804
4189
|
const projectFile = xcodeProjectFile(xcodeproj);
|
|
3805
4190
|
if (!projectFile)
|
|
3806
4191
|
throw new Error(`${xcodeproj} has no project.pbxproj or project.xcproj`);
|
|
3807
|
-
const mtimeMs =
|
|
4192
|
+
const mtimeMs = import_node_fs10.default.statSync(projectFile).mtimeMs;
|
|
3808
4193
|
const cached = loaded.get(projectFile);
|
|
3809
4194
|
if (cached?.mtimeMs === mtimeMs) return cached.project;
|
|
3810
|
-
const source =
|
|
4195
|
+
const source = import_node_fs10.default.readFileSync(projectFile, "utf8");
|
|
3811
4196
|
const root = projectFile.endsWith(".xcproj") ? readXcodeJsonProject(xcodeproj, source) : parseOpenStepPlist(source);
|
|
3812
4197
|
if (!isDict(root) || !isDict(root.objects)) {
|
|
3813
4198
|
throw new Error(`${projectFile} has no objects table`);
|
|
@@ -3821,8 +4206,8 @@ function loadProject(xcodeproj) {
|
|
|
3821
4206
|
if (!project || project.isa !== "PBXProject") {
|
|
3822
4207
|
throw new Error(`${projectFile} has no PBXProject root`);
|
|
3823
4208
|
}
|
|
3824
|
-
const projectDir =
|
|
3825
|
-
|
|
4209
|
+
const projectDir = import_node_fs10.default.realpathSync(
|
|
4210
|
+
import_node_path12.default.resolve(import_node_path12.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
|
|
3826
4211
|
);
|
|
3827
4212
|
const parent = /* @__PURE__ */ new Map();
|
|
3828
4213
|
for (const [id, entry] of Object.entries(objects)) {
|
|
@@ -3840,11 +4225,11 @@ function loadProject(xcodeproj) {
|
|
|
3840
4225
|
const own = str(entry.path) ?? "";
|
|
3841
4226
|
const tree = str(entry.sourceTree) ?? "<group>";
|
|
3842
4227
|
if (tree === "<absolute>") result2 = own;
|
|
3843
|
-
else if (tree === "SOURCE_ROOT") result2 =
|
|
4228
|
+
else if (tree === "SOURCE_ROOT") result2 = import_node_path12.default.join(projectDir, own);
|
|
3844
4229
|
else if (tree === "<group>") {
|
|
3845
4230
|
const up = parent.get(id);
|
|
3846
4231
|
const base = up ? resolvePath(up) : projectDir;
|
|
3847
|
-
result2 = base === null ? null :
|
|
4232
|
+
result2 = base === null ? null : import_node_path12.default.join(base, own);
|
|
3848
4233
|
}
|
|
3849
4234
|
}
|
|
3850
4235
|
resolvedPaths.set(id, result2);
|
|
@@ -3944,7 +4329,7 @@ function targetMembers(ref) {
|
|
|
3944
4329
|
const addResource = (file) => {
|
|
3945
4330
|
if (isDirectory(file)) {
|
|
3946
4331
|
for (const inner of walkFiles(file)) resources.add(inner);
|
|
3947
|
-
} else if (
|
|
4332
|
+
} else if (import_node_fs10.default.existsSync(file)) resources.add(file);
|
|
3948
4333
|
};
|
|
3949
4334
|
const fileRefPaths = (refId) => {
|
|
3950
4335
|
const entry = project.object(refId);
|
|
@@ -3965,7 +4350,7 @@ function targetMembers(ref) {
|
|
|
3965
4350
|
for (const buildFileId of list(phase.files)) {
|
|
3966
4351
|
for (const file of fileRefPaths(str(project.object(buildFileId)?.fileRef) ?? "")) {
|
|
3967
4352
|
if (phase.isa === "PBXSourcesBuildPhase") {
|
|
3968
|
-
if (!
|
|
4353
|
+
if (!import_node_fs10.default.existsSync(file)) continue;
|
|
3969
4354
|
allSources.add(file);
|
|
3970
4355
|
if (file.endsWith(".swift")) sources.add(file);
|
|
3971
4356
|
} else if (phase.isa === "PBXResourcesBuildPhase") addResource(file);
|
|
@@ -3973,7 +4358,7 @@ function targetMembers(ref) {
|
|
|
3973
4358
|
}
|
|
3974
4359
|
}
|
|
3975
4360
|
const addSynchronized = (folder, relative) => {
|
|
3976
|
-
const file =
|
|
4361
|
+
const file = import_node_path12.default.join(folder, relative);
|
|
3977
4362
|
if (NEVER_MEMBER.test(relative)) return;
|
|
3978
4363
|
if (file.endsWith(".swift")) {
|
|
3979
4364
|
if (!relative.split("/").some((segment) => BUNDLE_DIR.test(segment))) {
|
|
@@ -3998,7 +4383,7 @@ function targetMembers(ref) {
|
|
|
3998
4383
|
}
|
|
3999
4384
|
if (owned.has(groupId)) {
|
|
4000
4385
|
for (const file of walkFiles(folder)) {
|
|
4001
|
-
const relative =
|
|
4386
|
+
const relative = import_node_path12.default.relative(folder, file).split(import_node_path12.default.sep).join("/");
|
|
4002
4387
|
if ([...exceptions].some(
|
|
4003
4388
|
(exception) => relative === exception || relative.startsWith(`${exception}/`)
|
|
4004
4389
|
))
|
|
@@ -4007,14 +4392,14 @@ function targetMembers(ref) {
|
|
|
4007
4392
|
}
|
|
4008
4393
|
} else {
|
|
4009
4394
|
for (const relative of exceptions) {
|
|
4010
|
-
const file =
|
|
4395
|
+
const file = import_node_path12.default.join(folder, relative);
|
|
4011
4396
|
if (isDirectory(file)) {
|
|
4012
4397
|
for (const inner of walkFiles(file))
|
|
4013
4398
|
addSynchronized(
|
|
4014
4399
|
folder,
|
|
4015
|
-
|
|
4400
|
+
import_node_path12.default.relative(folder, inner).split(import_node_path12.default.sep).join("/")
|
|
4016
4401
|
);
|
|
4017
|
-
} else if (
|
|
4402
|
+
} else if (import_node_fs10.default.existsSync(file)) addSynchronized(folder, relative);
|
|
4018
4403
|
}
|
|
4019
4404
|
}
|
|
4020
4405
|
}
|
|
@@ -4027,8 +4412,8 @@ function targetMembers(ref) {
|
|
|
4027
4412
|
function commonAncestor(dirs) {
|
|
4028
4413
|
let common = dirs[0];
|
|
4029
4414
|
for (const dir of dirs) {
|
|
4030
|
-
while (common !==
|
|
4031
|
-
common =
|
|
4415
|
+
while (common !== import_node_path12.default.dirname(common) && import_node_path12.default.relative(common, dir).startsWith(".."))
|
|
4416
|
+
common = import_node_path12.default.dirname(common);
|
|
4032
4417
|
}
|
|
4033
4418
|
return common;
|
|
4034
4419
|
}
|
|
@@ -4037,8 +4422,8 @@ function workspaceProjects(xcodeprojOrWorkspace) {
|
|
|
4037
4422
|
const projects2 = [];
|
|
4038
4423
|
const projectAt = /* @__PURE__ */ new Map();
|
|
4039
4424
|
const addProject = (xcodeproj) => {
|
|
4040
|
-
const key =
|
|
4041
|
-
if (projectAt.has(key) || key.split(
|
|
4425
|
+
const key = import_node_path12.default.resolve(xcodeproj);
|
|
4426
|
+
if (projectAt.has(key) || key.split(import_node_path12.default.sep).includes("Pods")) return;
|
|
4042
4427
|
if (!xcodeProjectFile(key)) return;
|
|
4043
4428
|
const project = loadProject(key);
|
|
4044
4429
|
projectAt.set(key, project);
|
|
@@ -4055,7 +4440,7 @@ function workspaceProjects(xcodeprojOrWorkspace) {
|
|
|
4055
4440
|
for (const reference of listed)
|
|
4056
4441
|
if (reference.endsWith(".xcodeproj")) addProject(reference);
|
|
4057
4442
|
if (projects2.length === 0) {
|
|
4058
|
-
throw new Error(`${
|
|
4443
|
+
throw new Error(`${import_node_path12.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
|
|
4059
4444
|
}
|
|
4060
4445
|
return { listed, projects: projects2, projectAt };
|
|
4061
4446
|
}
|
|
@@ -4077,7 +4462,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
4077
4462
|
const allTargets = projects2.flatMap(nativeTargets);
|
|
4078
4463
|
const appTargets = allTargets.filter((ref) => ref.target.productType === APPLICATION);
|
|
4079
4464
|
const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
|
|
4080
|
-
const container =
|
|
4465
|
+
const container = import_node_path12.default.basename(xcodeprojOrWorkspace);
|
|
4081
4466
|
const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
|
|
4082
4467
|
if (named.length !== 1) {
|
|
4083
4468
|
throw new Error(
|
|
@@ -4089,14 +4474,14 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
4089
4474
|
for (const ref of allTargets) {
|
|
4090
4475
|
const product = ref.project.object(str(ref.target.productReference));
|
|
4091
4476
|
const file = str(product?.path);
|
|
4092
|
-
if (file && !byProduct.has(
|
|
4093
|
-
byProduct.set(
|
|
4477
|
+
if (file && !byProduct.has(import_node_path12.default.basename(file)))
|
|
4478
|
+
byProduct.set(import_node_path12.default.basename(file), ref);
|
|
4094
4479
|
}
|
|
4095
4480
|
const proxied = (project, proxyId) => {
|
|
4096
4481
|
const proxy = project.object(proxyId);
|
|
4097
4482
|
if (proxy?.isa !== "PBXContainerItemProxy") return void 0;
|
|
4098
4483
|
const portal = str(proxy.containerPortal);
|
|
4099
|
-
const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(
|
|
4484
|
+
const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path12.default.resolve(project.resolvePath(portal ?? "") ?? ""));
|
|
4100
4485
|
const remote = str(proxy.remoteGlobalIDString);
|
|
4101
4486
|
if (!owner || !remote) return void 0;
|
|
4102
4487
|
return nativeTargets(owner).find(
|
|
@@ -4117,7 +4502,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
4117
4502
|
if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
|
|
4118
4503
|
for (const buildFileId of list(phase.files)) {
|
|
4119
4504
|
const file = project.object(str(project.object(buildFileId)?.fileRef));
|
|
4120
|
-
const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(
|
|
4505
|
+
const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path12.default.basename(str(file.path) ?? "")) : void 0;
|
|
4121
4506
|
if (resolved) found.push(resolved);
|
|
4122
4507
|
}
|
|
4123
4508
|
}
|
|
@@ -4138,7 +4523,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
4138
4523
|
const name = str(ref.target.name) ?? ref.id;
|
|
4139
4524
|
const { get: settings2, keys } = targetSettings(ref, {
|
|
4140
4525
|
TARGET_NAME: name,
|
|
4141
|
-
PROJECT_NAME:
|
|
4526
|
+
PROJECT_NAME: import_node_path12.default.basename(ref.project.xcodeproj, ".xcodeproj"),
|
|
4142
4527
|
SRCROOT: ref.project.projectDir,
|
|
4143
4528
|
SOURCE_ROOT: ref.project.projectDir,
|
|
4144
4529
|
PROJECT_DIR: ref.project.projectDir,
|
|
@@ -4169,8 +4554,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
4169
4554
|
}
|
|
4170
4555
|
return value;
|
|
4171
4556
|
};
|
|
4172
|
-
const infoPlistFile = settings("INFOPLIST_FILE") ?
|
|
4173
|
-
const sourceInfo = infoPlistFile ? import_plist.default.parse(
|
|
4557
|
+
const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path12.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
|
|
4558
|
+
const sourceInfo = infoPlistFile ? import_plist.default.parse(import_node_fs10.default.readFileSync(infoPlistFile, "utf8")) : {};
|
|
4174
4559
|
if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
|
|
4175
4560
|
throw new Error(`${module2.name} Info.plist must contain a dictionary`);
|
|
4176
4561
|
}
|
|
@@ -4188,12 +4573,12 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
4188
4573
|
};
|
|
4189
4574
|
}
|
|
4190
4575
|
const localPackageDirs = [
|
|
4191
|
-
...listed.filter((reference) =>
|
|
4576
|
+
...listed.filter((reference) => import_node_fs10.default.existsSync(import_node_path12.default.join(reference, "Package.swift"))),
|
|
4192
4577
|
...projects2.flatMap(
|
|
4193
4578
|
(project) => Object.entries(project.objects).flatMap(([id, entry]) => {
|
|
4194
4579
|
if (!isDict(entry)) return [];
|
|
4195
|
-
const candidate = entry.isa === "XCLocalSwiftPackageReference" ?
|
|
4196
|
-
return candidate &&
|
|
4580
|
+
const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path12.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
|
|
4581
|
+
return candidate && import_node_fs10.default.existsSync(import_node_path12.default.join(candidate, "Package.swift")) ? [candidate] : [];
|
|
4197
4582
|
})
|
|
4198
4583
|
)
|
|
4199
4584
|
];
|
|
@@ -4217,7 +4602,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
4217
4602
|
product,
|
|
4218
4603
|
source: reference?.isa === "XCRemoteSwiftPackageReference" ? { kind: "remote", url: str(reference.repositoryURL) ?? "" } : reference?.isa === "XCLocalSwiftPackageReference" ? {
|
|
4219
4604
|
kind: "local",
|
|
4220
|
-
dir:
|
|
4605
|
+
dir: import_node_path12.default.resolve(
|
|
4221
4606
|
project.projectDir,
|
|
4222
4607
|
str(reference.relativePath) ?? ""
|
|
4223
4608
|
)
|
|
@@ -4239,8 +4624,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
4239
4624
|
}
|
|
4240
4625
|
}
|
|
4241
4626
|
}
|
|
4242
|
-
const resolvedFile =
|
|
4243
|
-
workspace ??
|
|
4627
|
+
const resolvedFile = import_node_path12.default.join(
|
|
4628
|
+
workspace ?? import_node_path12.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
|
|
4244
4629
|
"xcshareddata",
|
|
4245
4630
|
"swiftpm",
|
|
4246
4631
|
"Package.resolved"
|
|
@@ -4250,13 +4635,13 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
4250
4635
|
...module2,
|
|
4251
4636
|
rootDir: commonAncestor(
|
|
4252
4637
|
[
|
|
4253
|
-
workspace ?
|
|
4638
|
+
workspace ? import_node_path12.default.dirname(workspace) : app.project.projectDir,
|
|
4254
4639
|
...used.map((project) => project.projectDir),
|
|
4255
4640
|
...localPackageDirs,
|
|
4256
4641
|
...linkedProducts.flatMap(
|
|
4257
|
-
({ source }) => source.kind === "local" &&
|
|
4642
|
+
({ source }) => source.kind === "local" && import_node_fs10.default.existsSync(source.dir) ? [source.dir] : []
|
|
4258
4643
|
)
|
|
4259
|
-
].map((dir) =>
|
|
4644
|
+
].map((dir) => import_node_fs10.default.realpathSync(dir))
|
|
4260
4645
|
),
|
|
4261
4646
|
projectFiles: [...new Set(used.map((project) => project.projectFile))].sort(),
|
|
4262
4647
|
infoPlist: import_plist.default.build(info),
|
|
@@ -4264,10 +4649,10 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
4264
4649
|
frameworks,
|
|
4265
4650
|
linkedProducts,
|
|
4266
4651
|
localPackageDirs: [
|
|
4267
|
-
...new Set(localPackageDirs.map((dir) =>
|
|
4652
|
+
...new Set(localPackageDirs.map((dir) => import_node_fs10.default.realpathSync(dir)))
|
|
4268
4653
|
].sort(),
|
|
4269
4654
|
binaryFrameworks: [...binaryFrameworks].sort(),
|
|
4270
|
-
packageResolved:
|
|
4655
|
+
packageResolved: import_node_fs10.default.existsSync(resolvedFile) ? resolvedFile : null,
|
|
4271
4656
|
appTargets: appTargetNames
|
|
4272
4657
|
};
|
|
4273
4658
|
}
|
|
@@ -4287,17 +4672,17 @@ var SKIP_SOURCE_DIRS = /* @__PURE__ */ new Set([
|
|
|
4287
4672
|
var NATIVE_DESCRIPTOR = ".one-native-source.json";
|
|
4288
4673
|
var NATIVE_GLUE = ".one-native-source.swift.txt";
|
|
4289
4674
|
function swiftPackageId(packagePath) {
|
|
4290
|
-
return
|
|
4675
|
+
return import_node_path13.default.basename(packagePath).replace(/[^A-Za-z0-9_]/g, "_").replace(/^(\d)/, "_$1");
|
|
4291
4676
|
}
|
|
4292
4677
|
function nativeSourceDescriptor(packagePath) {
|
|
4293
|
-
packagePath =
|
|
4294
|
-
const file =
|
|
4295
|
-
if (!
|
|
4678
|
+
packagePath = import_node_fs11.default.realpathSync(packagePath);
|
|
4679
|
+
const file = import_node_path13.default.join(packagePath, NATIVE_DESCRIPTOR);
|
|
4680
|
+
if (!import_node_fs11.default.existsSync(file)) return null;
|
|
4296
4681
|
const value = JSON.parse(
|
|
4297
4682
|
readPackageFile(packagePath, file, MAX_SWIFT_COMPILE_SOURCE_BYTES).toString("utf8")
|
|
4298
4683
|
);
|
|
4299
4684
|
const invalid = () => new Error(`${file}: invalid One native source descriptor; run one typegen`);
|
|
4300
|
-
if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !
|
|
4685
|
+
if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !import_node_fs11.default.existsSync(import_node_path13.default.join(packagePath, NATIVE_GLUE))) {
|
|
4301
4686
|
throw invalid();
|
|
4302
4687
|
}
|
|
4303
4688
|
if (!isSwiftNativeModules(value) || value.packageId !== swiftPackageId(packagePath)) {
|
|
@@ -4306,12 +4691,12 @@ function nativeSourceDescriptor(packagePath) {
|
|
|
4306
4691
|
return value;
|
|
4307
4692
|
}
|
|
4308
4693
|
function nativeSourceFiles(packagePath) {
|
|
4309
|
-
packagePath =
|
|
4310
|
-
return [NATIVE_DESCRIPTOR, NATIVE_GLUE].map((name) =>
|
|
4694
|
+
packagePath = import_node_fs11.default.realpathSync(packagePath);
|
|
4695
|
+
return [NATIVE_DESCRIPTOR, NATIVE_GLUE].map((name) => import_node_path13.default.join(packagePath, name)).filter((file) => import_node_fs11.default.existsSync(file));
|
|
4311
4696
|
}
|
|
4312
4697
|
var projects = /* @__PURE__ */ new Map();
|
|
4313
4698
|
function projectFor(packagePath, hosted) {
|
|
4314
|
-
packagePath =
|
|
4699
|
+
packagePath = import_node_fs11.default.realpathSync(packagePath);
|
|
4315
4700
|
const existing = projects.get(packagePath);
|
|
4316
4701
|
if (existing) {
|
|
4317
4702
|
if (hosted && !existing.hosted) {
|
|
@@ -4333,14 +4718,14 @@ function projectFor(packagePath, hosted) {
|
|
|
4333
4718
|
}
|
|
4334
4719
|
var xcodeProjects = /* @__PURE__ */ new Map();
|
|
4335
4720
|
function swiftPackages(entry, app) {
|
|
4336
|
-
const stamp = (file) => file &&
|
|
4721
|
+
const stamp = (file) => file && import_node_fs11.default.existsSync(file) ? import_node_fs11.default.statSync(file).mtimeMs : 0;
|
|
4337
4722
|
const key = JSON.stringify([
|
|
4338
4723
|
app.linkedProducts,
|
|
4339
4724
|
app.packageResolved,
|
|
4340
4725
|
stamp(app.packageResolved),
|
|
4341
|
-
app.localPackageDirs.map((dir) => stamp(
|
|
4726
|
+
app.localPackageDirs.map((dir) => stamp(import_node_path13.default.join(dir, "Package.swift"))),
|
|
4342
4727
|
app.linkedProducts.map(
|
|
4343
|
-
({ source }) => source.kind === "local" ? stamp(
|
|
4728
|
+
({ source }) => source.kind === "local" ? stamp(import_node_path13.default.join(source.dir, "Package.swift")) : 0
|
|
4344
4729
|
)
|
|
4345
4730
|
]);
|
|
4346
4731
|
if (entry.packages?.key !== key) {
|
|
@@ -4360,11 +4745,11 @@ function swiftPackages(entry, app) {
|
|
|
4360
4745
|
var XCODE_APP_DIR = "__app__";
|
|
4361
4746
|
var XCODE_FRAMEWORKS_DIR = "__frameworks__";
|
|
4362
4747
|
var XCODE_PACKAGES_DIR = "__packages__";
|
|
4363
|
-
var CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(
|
|
4748
|
+
var CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(import_node_path13.default.sep).join(import_node_path13.default.posix.sep)}/`;
|
|
4364
4749
|
function xcodeInputKey(layout, file, relative) {
|
|
4365
4750
|
const owner = layout.targetDirs.get(file);
|
|
4366
|
-
if (owner) return
|
|
4367
|
-
return relative.startsWith(CHECKOUTS_PREFIX) ?
|
|
4751
|
+
if (owner) return import_node_path13.default.posix.join(owner, relative);
|
|
4752
|
+
return relative.startsWith(CHECKOUTS_PREFIX) ? import_node_path13.default.posix.join(XCODE_PACKAGES_DIR, relative.slice(CHECKOUTS_PREFIX.length)) : relative;
|
|
4368
4753
|
}
|
|
4369
4754
|
function xcodeLayout(root) {
|
|
4370
4755
|
const registered = xcodeProjects.get(root);
|
|
@@ -4375,7 +4760,7 @@ function xcodeLayout(root) {
|
|
|
4375
4760
|
const targetDirs = new Map(app.sources.map((file) => [file, XCODE_APP_DIR]));
|
|
4376
4761
|
const targets = [];
|
|
4377
4762
|
for (const framework of app.frameworks) {
|
|
4378
|
-
const dir =
|
|
4763
|
+
const dir = import_node_path13.default.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName);
|
|
4379
4764
|
for (const file of framework.sources) {
|
|
4380
4765
|
if (targetDirs.has(file)) continue;
|
|
4381
4766
|
targetDirs.set(file, dir);
|
|
@@ -4393,19 +4778,19 @@ function xcodeLayout(root) {
|
|
|
4393
4778
|
}
|
|
4394
4779
|
const packages = swiftPackages(registered, app);
|
|
4395
4780
|
for (const target of packages.targets) {
|
|
4396
|
-
const relative =
|
|
4397
|
-
target.remote ?
|
|
4781
|
+
const relative = import_node_path13.default.relative(
|
|
4782
|
+
target.remote ? import_node_path13.default.join(root, REMOTE_CHECKOUTS) : root,
|
|
4398
4783
|
target.dir
|
|
4399
4784
|
);
|
|
4400
|
-
if (relative === ".." || relative.startsWith(`..${
|
|
4785
|
+
if (relative === ".." || relative.startsWith(`..${import_node_path13.default.sep}`) || import_node_path13.default.isAbsolute(relative))
|
|
4401
4786
|
throw new Error(`swift input escapes the selected package: ${target.dir}`);
|
|
4402
|
-
const posix = relative.split(
|
|
4787
|
+
const posix = relative.split(import_node_path13.default.sep).join(import_node_path13.default.posix.sep);
|
|
4403
4788
|
targets.push({
|
|
4404
4789
|
...target,
|
|
4405
|
-
path: target.remote ?
|
|
4790
|
+
path: target.remote ? import_node_path13.default.posix.join(XCODE_PACKAGES_DIR, posix) : posix,
|
|
4406
4791
|
exclude: []
|
|
4407
4792
|
});
|
|
4408
|
-
if (!target.remote) files.add(
|
|
4793
|
+
if (!target.remote) files.add(import_node_path13.default.join(target.packageDir, "Package.swift"));
|
|
4409
4794
|
for (const file of target.files) files.add(file);
|
|
4410
4795
|
}
|
|
4411
4796
|
for (const target of targets) {
|
|
@@ -4434,25 +4819,25 @@ function xcodeManifest(layout) {
|
|
|
4434
4819
|
].join("\n");
|
|
4435
4820
|
}
|
|
4436
4821
|
function packageFiles(root) {
|
|
4437
|
-
const canonicalRoot =
|
|
4822
|
+
const canonicalRoot = import_node_fs11.default.realpathSync(root);
|
|
4438
4823
|
const xcode = xcodeLayout(canonicalRoot);
|
|
4439
4824
|
return xcode ? xcode.files : sourceTreeFiles(canonicalRoot, canonicalRoot);
|
|
4440
4825
|
}
|
|
4441
4826
|
function sourceTreeFiles(dir, canonicalRoot) {
|
|
4442
4827
|
const found = [];
|
|
4443
4828
|
const walk2 = (dir2) => {
|
|
4444
|
-
for (const entry of
|
|
4829
|
+
for (const entry of import_node_fs11.default.readdirSync(dir2, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
|
|
4445
4830
|
if (entry.name.startsWith(".") && entry.name !== NATIVE_DESCRIPTOR && entry.name !== NATIVE_GLUE || SKIP_SOURCE_DIRS.has(entry.name))
|
|
4446
4831
|
continue;
|
|
4447
|
-
const full =
|
|
4832
|
+
const full = import_node_path13.default.join(dir2, entry.name);
|
|
4448
4833
|
if (entry.isSymbolicLink()) throw new Error(`swift input is a symlink: ${full}`);
|
|
4449
|
-
const real =
|
|
4450
|
-
const relative =
|
|
4451
|
-
if (relative.startsWith(`..${
|
|
4834
|
+
const real = import_node_fs11.default.realpathSync(full);
|
|
4835
|
+
const relative = import_node_path13.default.relative(canonicalRoot, real);
|
|
4836
|
+
if (relative.startsWith(`..${import_node_path13.default.sep}`) || relative === ".." || import_node_path13.default.isAbsolute(relative)) {
|
|
4452
4837
|
throw new Error(`swift input escapes the selected package: ${full}`);
|
|
4453
4838
|
}
|
|
4454
4839
|
if (entry.isDirectory()) {
|
|
4455
|
-
if (
|
|
4840
|
+
if (import_node_fs11.default.existsSync(import_node_path13.default.join(full, "Package.swift"))) continue;
|
|
4456
4841
|
walk2(full);
|
|
4457
4842
|
} else if (entry.isFile()) {
|
|
4458
4843
|
found.push(full);
|
|
@@ -4460,29 +4845,29 @@ function sourceTreeFiles(dir, canonicalRoot) {
|
|
|
4460
4845
|
}
|
|
4461
4846
|
}
|
|
4462
4847
|
};
|
|
4463
|
-
if (
|
|
4848
|
+
if (import_node_fs11.default.existsSync(dir)) walk2(import_node_fs11.default.realpathSync(dir));
|
|
4464
4849
|
return found;
|
|
4465
4850
|
}
|
|
4466
4851
|
function readPackageFile(root, file, maxBytes) {
|
|
4467
|
-
const canonicalRoot =
|
|
4468
|
-
const relative =
|
|
4469
|
-
if (relative === ".." || relative.startsWith(`..${
|
|
4852
|
+
const canonicalRoot = import_node_fs11.default.realpathSync(root);
|
|
4853
|
+
const relative = import_node_path13.default.relative(canonicalRoot, import_node_fs11.default.realpathSync(file));
|
|
4854
|
+
if (relative === ".." || relative.startsWith(`..${import_node_path13.default.sep}`) || import_node_path13.default.isAbsolute(relative)) {
|
|
4470
4855
|
throw new Error(`swift input escapes the selected package: ${file}`);
|
|
4471
4856
|
}
|
|
4472
|
-
let ancestor =
|
|
4857
|
+
let ancestor = import_node_path13.default.resolve(file);
|
|
4473
4858
|
while (ancestor !== canonicalRoot) {
|
|
4474
|
-
if (
|
|
4859
|
+
if (import_node_fs11.default.lstatSync(ancestor).isSymbolicLink()) {
|
|
4475
4860
|
throw new Error(`swift input is a symlink: ${ancestor}`);
|
|
4476
4861
|
}
|
|
4477
|
-
const parent =
|
|
4862
|
+
const parent = import_node_path13.default.dirname(ancestor);
|
|
4478
4863
|
if (parent === ancestor)
|
|
4479
4864
|
throw new Error(`swift input escapes the selected package: ${file}`);
|
|
4480
4865
|
ancestor = parent;
|
|
4481
4866
|
}
|
|
4482
|
-
const expected =
|
|
4483
|
-
const fd =
|
|
4867
|
+
const expected = import_node_fs11.default.statSync(file);
|
|
4868
|
+
const fd = import_node_fs11.default.openSync(file, import_node_fs11.default.constants.O_RDONLY | import_node_fs11.default.constants.O_NOFOLLOW);
|
|
4484
4869
|
try {
|
|
4485
|
-
const stat =
|
|
4870
|
+
const stat = import_node_fs11.default.fstatSync(fd);
|
|
4486
4871
|
if (stat.dev !== expected.dev || stat.ino !== expected.ino) {
|
|
4487
4872
|
throw new Error(`swift input changed while opening: ${file}`);
|
|
4488
4873
|
}
|
|
@@ -4492,16 +4877,16 @@ function readPackageFile(root, file, maxBytes) {
|
|
|
4492
4877
|
const bytes = Buffer.alloc(stat.size + 1);
|
|
4493
4878
|
let offset = 0;
|
|
4494
4879
|
while (offset < bytes.length) {
|
|
4495
|
-
const count =
|
|
4880
|
+
const count = import_node_fs11.default.readSync(fd, bytes, offset, bytes.length - offset, null);
|
|
4496
4881
|
if (count === 0) break;
|
|
4497
4882
|
offset += count;
|
|
4498
4883
|
}
|
|
4499
|
-
if (offset !== stat.size ||
|
|
4884
|
+
if (offset !== stat.size || import_node_fs11.default.fstatSync(fd).size !== stat.size) {
|
|
4500
4885
|
throw new Error(`swift input changed while reading: ${file}`);
|
|
4501
4886
|
}
|
|
4502
4887
|
return bytes.subarray(0, offset);
|
|
4503
4888
|
} finally {
|
|
4504
|
-
|
|
4889
|
+
import_node_fs11.default.closeSync(fd);
|
|
4505
4890
|
}
|
|
4506
4891
|
}
|
|
4507
4892
|
function sourceFiles(root) {
|
|
@@ -4509,7 +4894,7 @@ function sourceFiles(root) {
|
|
|
4509
4894
|
}
|
|
4510
4895
|
function resourceCandidateFiles(root) {
|
|
4511
4896
|
return packageFiles(root).filter(
|
|
4512
|
-
(file) => !file.endsWith(".swift") && !["project.pbxproj", "project.xcproj"].includes(
|
|
4897
|
+
(file) => !file.endsWith(".swift") && !["project.pbxproj", "project.xcproj"].includes(import_node_path13.default.basename(file))
|
|
4513
4898
|
);
|
|
4514
4899
|
}
|
|
4515
4900
|
var HOSTED_LIMITS = {
|
|
@@ -4543,7 +4928,7 @@ function buildSwiftResourceTable(project, baseUrl) {
|
|
|
4543
4928
|
const limits = inputLimits(Boolean(project.hosted));
|
|
4544
4929
|
const absolute = resourceCandidateFiles(project.packagePath);
|
|
4545
4930
|
const relative = absolute.map(
|
|
4546
|
-
(file) =>
|
|
4931
|
+
(file) => import_node_path13.default.relative(project.packagePath, file).split(import_node_path13.default.sep).join(import_node_path13.default.posix.sep)
|
|
4547
4932
|
);
|
|
4548
4933
|
const byRelative = new Map(absolute.map((file, index) => [relative[index], file]));
|
|
4549
4934
|
const readContents = (candidate) => {
|
|
@@ -4565,16 +4950,16 @@ function buildSwiftResourceTable(project, baseUrl) {
|
|
|
4565
4950
|
for (const { name, file, scale } of found) {
|
|
4566
4951
|
const disk = byRelative.get(file);
|
|
4567
4952
|
if (!disk) continue;
|
|
4568
|
-
if (Object.keys(images).length >= limits.images || imageBytes +
|
|
4953
|
+
if (Object.keys(images).length >= limits.images || imageBytes + import_node_fs11.default.statSync(disk).size > limits.imageTotalBytes) {
|
|
4569
4954
|
throw new Error("swift image pack exceeds the compile service caps");
|
|
4570
4955
|
}
|
|
4571
4956
|
const bytes = readPackageFile(project.packagePath, disk, limits.imageBytes);
|
|
4572
4957
|
imageBytes += bytes.length;
|
|
4573
|
-
const hash = (0,
|
|
4574
|
-
const ext =
|
|
4958
|
+
const hash = (0, import_node_crypto6.createHash)("sha256").update(bytes).digest("hex").slice(0, 16);
|
|
4959
|
+
const ext = import_node_path13.default.posix.extname(file).toLowerCase();
|
|
4575
4960
|
table[name] = { uri: `${baseUrl}${RESOURCE_PATH}${hash}${ext}`, scale };
|
|
4576
4961
|
images[name] = {
|
|
4577
|
-
file:
|
|
4962
|
+
file: import_node_path13.default.posix.basename(file),
|
|
4578
4963
|
data: bytes.toString("base64")
|
|
4579
4964
|
};
|
|
4580
4965
|
watched.push(file);
|
|
@@ -4598,10 +4983,10 @@ function buildSwiftResourceTable(project, baseUrl) {
|
|
|
4598
4983
|
return { table, images, colors, symbols, watched };
|
|
4599
4984
|
}
|
|
4600
4985
|
function buildSwiftBundleFiles(packagePath, hosted) {
|
|
4601
|
-
packagePath =
|
|
4986
|
+
packagePath = import_node_fs11.default.realpathSync(packagePath);
|
|
4602
4987
|
const limits = inputLimits(hosted);
|
|
4603
4988
|
const relative = resourceCandidateFiles(packagePath).map(
|
|
4604
|
-
(file) =>
|
|
4989
|
+
(file) => import_node_path13.default.relative(packagePath, file).split(import_node_path13.default.sep).join(import_node_path13.default.posix.sep)
|
|
4605
4990
|
);
|
|
4606
4991
|
const files = {};
|
|
4607
4992
|
const watched = [];
|
|
@@ -4615,13 +5000,13 @@ function buildSwiftBundleFiles(packagePath, hosted) {
|
|
|
4615
5000
|
total += bytes.length;
|
|
4616
5001
|
if (xcode.app.infoPlistFile)
|
|
4617
5002
|
watched.push(
|
|
4618
|
-
|
|
5003
|
+
import_node_path13.default.relative(packagePath, xcode.app.infoPlistFile).split(import_node_path13.default.sep).join("/")
|
|
4619
5004
|
);
|
|
4620
5005
|
}
|
|
4621
5006
|
for (const { base, file } of enumerateBundleJson(relative)) {
|
|
4622
5007
|
watched.push(file);
|
|
4623
|
-
const disk =
|
|
4624
|
-
if (Object.keys(files).length >= limits.resources || total +
|
|
5008
|
+
const disk = import_node_path13.default.join(packagePath, ...file.split("/"));
|
|
5009
|
+
if (Object.keys(files).length >= limits.resources || total + import_node_fs11.default.statSync(disk).size > limits.resourceTotalBytes) {
|
|
4625
5010
|
throw new Error(
|
|
4626
5011
|
`swift bundle pack exceeds ${limits.resources} files / ${limits.resourceTotalBytes} bytes`
|
|
4627
5012
|
);
|
|
@@ -4636,12 +5021,12 @@ function serveSwiftResource(project, key) {
|
|
|
4636
5021
|
return project.resourceFiles.get(key) ?? project.resourcesPrevious.get(key) ?? null;
|
|
4637
5022
|
}
|
|
4638
5023
|
function linkedModuleRoots(packagePath) {
|
|
4639
|
-
packagePath =
|
|
5024
|
+
packagePath = import_node_fs11.default.realpathSync(packagePath);
|
|
4640
5025
|
let manifest;
|
|
4641
5026
|
try {
|
|
4642
5027
|
manifest = readPackageFile(
|
|
4643
5028
|
packagePath,
|
|
4644
|
-
|
|
5029
|
+
import_node_path13.default.join(packagePath, "Package.swift"),
|
|
4645
5030
|
MAX_SWIFT_COMPILE_SOURCE_BYTES
|
|
4646
5031
|
).toString("utf8");
|
|
4647
5032
|
} catch {
|
|
@@ -4650,35 +5035,35 @@ function linkedModuleRoots(packagePath) {
|
|
|
4650
5035
|
const roots = /* @__PURE__ */ new Set();
|
|
4651
5036
|
const dependency = /\.package\(\s*path:\s*"([^"]+)"\s*\)/g;
|
|
4652
5037
|
for (const match of manifest.replace(/^\s*\/\/.*$/gm, "").matchAll(dependency)) {
|
|
4653
|
-
const root =
|
|
4654
|
-
if (
|
|
5038
|
+
const root = import_node_path13.default.resolve(packagePath, match[1]);
|
|
5039
|
+
if (import_node_fs11.default.existsSync(import_node_path13.default.join(root, "Package.swift"))) roots.add(root);
|
|
4655
5040
|
}
|
|
4656
5041
|
return [...roots].sort();
|
|
4657
5042
|
}
|
|
4658
5043
|
function sourceStamp(packagePath, moduleRootOverride, hosted = false) {
|
|
4659
|
-
const hash = (0,
|
|
5044
|
+
const hash = (0, import_node_crypto6.createHash)("sha256");
|
|
4660
5045
|
hash.update(packagePath);
|
|
4661
5046
|
const projectInputs = new Set(packageFiles(packagePath));
|
|
4662
5047
|
for (const file of [...projectInputs].sort()) {
|
|
4663
|
-
hash.update(
|
|
4664
|
-
const stat =
|
|
5048
|
+
hash.update(import_node_path13.default.relative(packagePath, file));
|
|
5049
|
+
const stat = import_node_fs11.default.statSync(file);
|
|
4665
5050
|
hash.update(`${stat.mtimeMs}/${stat.ctimeMs}/${stat.size}`);
|
|
4666
5051
|
}
|
|
4667
5052
|
const moduleRoot = hosted ? void 0 : moduleRootOverride ?? linkedModuleRoots(packagePath).find(
|
|
4668
|
-
(root) =>
|
|
5053
|
+
(root) => import_node_fs11.default.existsSync(import_node_path13.default.join(root, "toolchain.json"))
|
|
4669
5054
|
);
|
|
4670
5055
|
if (moduleRoot) {
|
|
4671
5056
|
hash.update(moduleRoot);
|
|
4672
5057
|
for (const relative of swiftModuleInputFiles(moduleRoot)) {
|
|
4673
5058
|
hash.update(relative);
|
|
4674
|
-
hash.update(String(
|
|
5059
|
+
hash.update(String(import_node_fs11.default.statSync(import_node_path13.default.join(moduleRoot, relative)).mtimeMs));
|
|
4675
5060
|
}
|
|
4676
5061
|
}
|
|
4677
5062
|
return hash.digest("hex").slice(0, 16);
|
|
4678
5063
|
}
|
|
4679
5064
|
function entryRootId(packagePath, file) {
|
|
4680
|
-
const relative =
|
|
4681
|
-
return `${
|
|
5065
|
+
const relative = import_node_path13.default.relative(packagePath, file).split(import_node_path13.default.sep).join(import_node_path13.default.posix.sep);
|
|
5066
|
+
return `${import_node_path13.default.basename(packagePath)}${import_node_path13.default.posix.sep}${relative}`;
|
|
4682
5067
|
}
|
|
4683
5068
|
function icuUrl(origin, artifact) {
|
|
4684
5069
|
return "url" in artifact.icu ? artifact.icu.url : `${origin}${ICU_PATH}${artifact.icu.sha256}`;
|
|
@@ -4687,8 +5072,8 @@ function packageSources(packagePath) {
|
|
|
4687
5072
|
const xcode = xcodeLayout(packagePath);
|
|
4688
5073
|
const files = {};
|
|
4689
5074
|
for (const file of sourceFiles(packagePath)) {
|
|
4690
|
-
const relative =
|
|
4691
|
-
if (xcode &&
|
|
5075
|
+
const relative = import_node_path13.default.relative(packagePath, file).split(import_node_path13.default.sep).join(import_node_path13.default.posix.sep);
|
|
5076
|
+
if (xcode && import_node_path13.default.basename(file) === "Package.swift") continue;
|
|
4692
5077
|
files[xcode ? xcodeInputKey(xcode, file, relative) : relative] = readPackageFile(
|
|
4693
5078
|
packagePath,
|
|
4694
5079
|
file,
|
|
@@ -4705,7 +5090,7 @@ function packageSnapshot(project) {
|
|
|
4705
5090
|
files,
|
|
4706
5091
|
resourcePaths: swiftImplicitResourcePaths(
|
|
4707
5092
|
resourceCandidateFiles(project.packagePath).map(
|
|
4708
|
-
(file) =>
|
|
5093
|
+
(file) => import_node_path13.default.relative(project.packagePath, file).split(import_node_path13.default.sep).join(import_node_path13.default.posix.sep)
|
|
4709
5094
|
)
|
|
4710
5095
|
),
|
|
4711
5096
|
resources: buildSwiftResourceTable(project, ""),
|
|
@@ -4714,7 +5099,7 @@ function packageSnapshot(project) {
|
|
|
4714
5099
|
...native ? {
|
|
4715
5100
|
glue: readPackageFile(
|
|
4716
5101
|
project.packagePath,
|
|
4717
|
-
|
|
5102
|
+
import_node_path13.default.join(project.packagePath, NATIVE_GLUE),
|
|
4718
5103
|
MAX_SWIFT_COMPILE_SOURCE_BYTES
|
|
4719
5104
|
).toString("utf8")
|
|
4720
5105
|
} : {}
|
|
@@ -4753,7 +5138,7 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
|
|
|
4753
5138
|
package: content
|
|
4754
5139
|
};
|
|
4755
5140
|
const moduleRoot = moduleRootOverride ?? linkedModuleRoots(packagePath).find(
|
|
4756
|
-
(root) =>
|
|
5141
|
+
(root) => import_node_fs11.default.existsSync(import_node_path13.default.join(root, "toolchain.json"))
|
|
4757
5142
|
) ?? await swiftDistributionRoot();
|
|
4758
5143
|
if (!moduleRoot)
|
|
4759
5144
|
return {
|
|
@@ -4772,17 +5157,17 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
|
|
|
4772
5157
|
...targets.length > 0 ? targets : ["App"]
|
|
4773
5158
|
])
|
|
4774
5159
|
);
|
|
4775
|
-
if (missing.size > 0) throw new Error(missingModulesMessage(packagePath, missing));
|
|
5160
|
+
if (missing.size > 0) throw new Error(await missingModulesMessage(packagePath, missing));
|
|
4776
5161
|
const artifact = await compileSwiftProjectUnit(input, {
|
|
4777
5162
|
// the compile rewrites Sources/App in its root before swiftpm builds, and
|
|
4778
5163
|
// its lock orders one process only: two vites on one root (a lane's dev
|
|
4779
5164
|
// server and a capture, or two checkouts) build each other's sources. so
|
|
4780
5165
|
// each app and module checkout gets its own root, which keeps the same
|
|
4781
5166
|
// app's incremental build across restarts.
|
|
4782
|
-
buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ??
|
|
4783
|
-
|
|
5167
|
+
buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ?? import_node_path13.default.join(
|
|
5168
|
+
import_node_os7.default.tmpdir(),
|
|
4784
5169
|
"contrast-swift-build",
|
|
4785
|
-
(0,
|
|
5170
|
+
(0, import_node_crypto6.createHash)("sha256").update(`${moduleRoot}\0${import_node_path13.default.resolve(packagePath)}`).digest("hex").slice(0, 16)
|
|
4786
5171
|
),
|
|
4787
5172
|
moduleRoot,
|
|
4788
5173
|
...toolchain
|
|
@@ -4849,21 +5234,8 @@ var UNPROVIDED_PLATFORM_MODULES = {
|
|
|
4849
5234
|
Darwin: "Peach compiles for WebAssembly, which has no Darwin; C library names come through Foundation",
|
|
4850
5235
|
MachO: "Peach compiles for WebAssembly, which has no Mach-O images"
|
|
4851
5236
|
};
|
|
4852
|
-
var
|
|
4853
|
-
function
|
|
4854
|
-
if (iosSdkFrameworks) return iosSdkFrameworks;
|
|
4855
|
-
iosSdkFrameworks = /* @__PURE__ */ new Set();
|
|
4856
|
-
if (process.platform !== "darwin") return iosSdkFrameworks;
|
|
4857
|
-
const sdk = (0, import_node_child_process7.execFileSync)("xcrun", ["--sdk", "iphonesimulator", "--show-sdk-path"], {
|
|
4858
|
-
encoding: "utf8",
|
|
4859
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
4860
|
-
}).trim();
|
|
4861
|
-
for (const entry of import_node_fs10.default.readdirSync(import_node_path12.default.join(sdk, "System/Library/Frameworks")))
|
|
4862
|
-
if (entry.endsWith(".framework"))
|
|
4863
|
-
iosSdkFrameworks.add(entry.slice(0, -".framework".length));
|
|
4864
|
-
return iosSdkFrameworks;
|
|
4865
|
-
}
|
|
4866
|
-
function missingModulesMessage(packagePath, missing) {
|
|
5237
|
+
var IOS_SDK_FRAMEWORKS = new Set(ios_sdk_frameworks_default.frameworks);
|
|
5238
|
+
async function missingModulesMessage(packagePath, missing) {
|
|
4867
5239
|
const layout = xcodeLayout(packagePath);
|
|
4868
5240
|
const gaps = new Map([
|
|
4869
5241
|
...(layout?.app.binaryFrameworks ?? []).map(
|
|
@@ -4875,7 +5247,7 @@ function missingModulesMessage(packagePath, missing) {
|
|
|
4875
5247
|
name,
|
|
4876
5248
|
{ source: "the iOS SDK", reason: UNPROVIDED_PLATFORM_MODULES[name] }
|
|
4877
5249
|
]
|
|
4878
|
-
] :
|
|
5250
|
+
] : IOS_SDK_FRAMEWORKS.has(name) ? [
|
|
4879
5251
|
[
|
|
4880
5252
|
name,
|
|
4881
5253
|
{ source: "the iOS SDK", reason: "a framework Peach does not provide" }
|
|
@@ -4885,12 +5257,29 @@ function missingModulesMessage(packagePath, missing) {
|
|
|
4885
5257
|
...layout?.packages.modules ?? [],
|
|
4886
5258
|
...layout?.packages.unavailable ?? []
|
|
4887
5259
|
]);
|
|
5260
|
+
const packaged = new Set(
|
|
5261
|
+
[...missing.keys()].filter(
|
|
5262
|
+
(name) => !UNPROVIDED_PLATFORM_MODULES[name] && !IOS_SDK_FRAMEWORKS.has(name)
|
|
5263
|
+
)
|
|
5264
|
+
);
|
|
5265
|
+
if (packaged.size > 0)
|
|
5266
|
+
await Promise.all(
|
|
5267
|
+
(layout?.packages.binaries ?? []).map(async (binary) => {
|
|
5268
|
+
const modules = await swiftBinaryModules(binary).catch(() => []);
|
|
5269
|
+
for (const name of modules)
|
|
5270
|
+
if (packaged.has(name))
|
|
5271
|
+
gaps.set(name, {
|
|
5272
|
+
source: binary.source,
|
|
5273
|
+
reason: `${binary.target} is a binary framework`
|
|
5274
|
+
});
|
|
5275
|
+
})
|
|
5276
|
+
);
|
|
4888
5277
|
const width = Math.max(...[...missing.keys()].map((name) => name.length));
|
|
4889
5278
|
return [
|
|
4890
5279
|
`Peach does not provide ${missing.size} module${missing.size === 1 ? "" : "s"} this app imports:`,
|
|
4891
5280
|
...[...missing].map(([name, files]) => {
|
|
4892
5281
|
const gap = gaps.get(name);
|
|
4893
|
-
return ` ${name.padEnd(width)} ${files.length} file${files.length === 1 ? "" : "s"}${gap ? `, ${gap.source.includes("://") ? `package ${gap.source}` : gap.source.startsWith("/") ? `package ${
|
|
5282
|
+
return ` ${name.padEnd(width)} ${files.length} file${files.length === 1 ? "" : "s"}${gap ? `, ${gap.source.includes("://") ? `package ${gap.source}` : gap.source.startsWith("/") ? `package ${import_node_path13.default.relative(packagePath, gap.source) || "."}` : gap.source} (${gap.reason})` : ""}`;
|
|
4894
5283
|
})
|
|
4895
5284
|
].join("\n");
|
|
4896
5285
|
}
|
|
@@ -4898,7 +5287,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
|
|
|
4898
5287
|
const auth = hosted ? null : resolveCliAuth();
|
|
4899
5288
|
if (!hosted && (!auth || auth.kind === "github")) {
|
|
4900
5289
|
throw new Error(
|
|
4901
|
-
`compiling ${
|
|
5290
|
+
`compiling ${import_node_path13.default.basename(packagePath)} for Peach needs \`peach login\` or PEACH_API_KEY: this peachsim has no local SwiftUI module, so Contrast compiles it`
|
|
4902
5291
|
);
|
|
4903
5292
|
}
|
|
4904
5293
|
const origin = hosted?.origin ?? resolveContrastBackendOrigin(auth?.kind === "session" ? auth.origin : null);
|
|
@@ -4917,7 +5306,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
|
|
|
4917
5306
|
const bytes = sources.reduce((total2, text2) => total2 + Buffer.byteLength(text2), 0);
|
|
4918
5307
|
if (sources.length > MAX_SWIFT_COMPILE_FILES || bytes > MAX_SWIFT_COMPILE_SOURCE_BYTES) {
|
|
4919
5308
|
throw new Error(
|
|
4920
|
-
`${
|
|
5309
|
+
`${import_node_path13.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`
|
|
4921
5310
|
);
|
|
4922
5311
|
}
|
|
4923
5312
|
const descriptor = snapshot.native;
|
|
@@ -4936,7 +5325,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
|
|
|
4936
5325
|
);
|
|
4937
5326
|
if (descriptor && address.native?.hash !== descriptor.hash) {
|
|
4938
5327
|
throw new Error(
|
|
4939
|
-
`${
|
|
5328
|
+
`${import_node_path13.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`
|
|
4940
5329
|
);
|
|
4941
5330
|
}
|
|
4942
5331
|
const response = await fetch(address.url, { signal });
|
|
@@ -5009,17 +5398,17 @@ function artifactFor(project, entry, moduleRoot) {
|
|
|
5009
5398
|
return fresh;
|
|
5010
5399
|
}
|
|
5011
5400
|
function swiftPackageWatchFiles(packagePath, moduleRoot) {
|
|
5012
|
-
packagePath =
|
|
5401
|
+
packagePath = import_node_fs11.default.realpathSync(packagePath);
|
|
5013
5402
|
return [
|
|
5014
|
-
...xcodeProjects.has(packagePath) ? [] : [
|
|
5403
|
+
...xcodeProjects.has(packagePath) ? [] : [import_node_path13.default.join(packagePath, "Package.swift")],
|
|
5015
5404
|
...sourceFiles(packagePath),
|
|
5016
5405
|
...nativeSourceFiles(packagePath),
|
|
5017
5406
|
...resourceCandidateFiles(packagePath),
|
|
5018
|
-
...moduleRoot ? swiftModuleInputFiles(moduleRoot).map((file) =>
|
|
5407
|
+
...moduleRoot ? swiftModuleInputFiles(moduleRoot).map((file) => import_node_path13.default.join(moduleRoot, file)) : []
|
|
5019
5408
|
];
|
|
5020
5409
|
}
|
|
5021
5410
|
async function swiftPackageMetadata(packagePath, packageName, moduleRoot, origin, hosted) {
|
|
5022
|
-
packagePath =
|
|
5411
|
+
packagePath = import_node_fs11.default.realpathSync(packagePath);
|
|
5023
5412
|
const mains = sourceFiles(packagePath).filter(
|
|
5024
5413
|
(file) => swiftApplicationEntry(
|
|
5025
5414
|
file,
|
|
@@ -5033,7 +5422,7 @@ async function swiftPackageMetadata(packagePath, packageName, moduleRoot, origin
|
|
|
5033
5422
|
);
|
|
5034
5423
|
}
|
|
5035
5424
|
const project = projectFor(packagePath, hosted);
|
|
5036
|
-
const entry = mains.length === 1 ?
|
|
5425
|
+
const entry = mains.length === 1 ? import_node_path13.default.relative(packagePath, mains[0]).split(import_node_path13.default.sep).join(import_node_path13.default.posix.sep) : Object.entries(native?.files ?? {}).find(
|
|
5037
5426
|
([_file, names]) => names.length > 0
|
|
5038
5427
|
)?.[0];
|
|
5039
5428
|
if (!entry) throw new Error(`swift package ${packageName} has no native module source`);
|
|
@@ -5122,12 +5511,12 @@ function artifactUrl(project, artifact) {
|
|
|
5122
5511
|
return `${serverOrigin()}${ARTIFACT_PATH2}${artifact.hash}.wasm`;
|
|
5123
5512
|
}
|
|
5124
5513
|
function packageFor(file) {
|
|
5125
|
-
let dir =
|
|
5514
|
+
let dir = import_node_path14.default.dirname(file);
|
|
5126
5515
|
const stop = devServer?.config.root;
|
|
5127
5516
|
for (; ; ) {
|
|
5128
|
-
if (
|
|
5129
|
-
if (stop !== void 0 && dir === stop ||
|
|
5130
|
-
dir =
|
|
5517
|
+
if (import_node_fs12.default.existsSync(import_node_path14.default.join(dir, "Package.swift"))) return dir;
|
|
5518
|
+
if (stop !== void 0 && dir === stop || import_node_path14.default.dirname(dir) === dir) break;
|
|
5519
|
+
dir = import_node_path14.default.dirname(dir);
|
|
5131
5520
|
}
|
|
5132
5521
|
throw new Error(
|
|
5133
5522
|
`no Package.swift above ${file}${stop === void 0 ? "" : ` (searched up to ${stop})`}; a .swift import needs a swiftpm package like the one in packages/sootsim-swift/example`
|
|
@@ -5148,9 +5537,9 @@ function swiftPlugin(options = {}) {
|
|
|
5148
5537
|
if (!resolved) throw new Error(`cannot resolve swift source ${source}`);
|
|
5149
5538
|
let id = resolved.id;
|
|
5150
5539
|
if (importer && (source.startsWith("./") || source.startsWith("../"))) {
|
|
5151
|
-
const raw2 =
|
|
5540
|
+
const raw2 = import_node_path14.default.resolve(import_node_path14.default.dirname(importer.split("?")[0] ?? importer), source);
|
|
5152
5541
|
try {
|
|
5153
|
-
if (
|
|
5542
|
+
if (import_node_fs12.default.realpathSync(raw2) === import_node_fs12.default.realpathSync(resolved.id)) id = raw2;
|
|
5154
5543
|
} catch {
|
|
5155
5544
|
}
|
|
5156
5545
|
}
|
|
@@ -5159,22 +5548,22 @@ function swiftPlugin(options = {}) {
|
|
|
5159
5548
|
async load(id) {
|
|
5160
5549
|
if (!id.startsWith(VIRTUAL_PREFIX)) return null;
|
|
5161
5550
|
const file = id.slice(VIRTUAL_PREFIX.length);
|
|
5162
|
-
if (!
|
|
5551
|
+
if (!import_node_fs12.default.existsSync(file)) throw new Error(`swift source ${file} no longer exists`);
|
|
5163
5552
|
const packagePath = options.packagePath ?? packageFor(file);
|
|
5164
5553
|
const project = projectFor(packagePath);
|
|
5165
|
-
const entry =
|
|
5554
|
+
const entry = import_node_path14.default.relative(packagePath, file).split(import_node_path14.default.sep).join(import_node_path14.default.posix.sep);
|
|
5166
5555
|
for (const source of [
|
|
5167
5556
|
...sourceFiles(packagePath),
|
|
5168
5557
|
...nativeSourceFiles(packagePath)
|
|
5169
5558
|
])
|
|
5170
5559
|
this.addWatchFile(source);
|
|
5171
|
-
this.addWatchFile(
|
|
5560
|
+
this.addWatchFile(import_node_path14.default.join(packagePath, "Package.swift"));
|
|
5172
5561
|
const moduleRoot = linkedModuleRoots(packagePath).find(
|
|
5173
|
-
(root) =>
|
|
5562
|
+
(root) => import_node_fs12.default.existsSync(import_node_path14.default.join(root, "toolchain.json"))
|
|
5174
5563
|
);
|
|
5175
5564
|
if (moduleRoot)
|
|
5176
5565
|
for (const relative of swiftModuleInputFiles(moduleRoot))
|
|
5177
|
-
this.addWatchFile(
|
|
5566
|
+
this.addWatchFile(import_node_path14.default.join(moduleRoot, relative));
|
|
5178
5567
|
let artifact;
|
|
5179
5568
|
try {
|
|
5180
5569
|
artifact = await artifactFor(project, entry);
|
|
@@ -5193,7 +5582,7 @@ function swiftPlugin(options = {}) {
|
|
|
5193
5582
|
...artifact.package.resources.watched,
|
|
5194
5583
|
...artifact.package.bundleFiles.watched
|
|
5195
5584
|
])
|
|
5196
|
-
this.addWatchFile(
|
|
5585
|
+
this.addWatchFile(import_node_path14.default.join(packagePath, ...watched.split(import_node_path14.default.posix.sep)));
|
|
5197
5586
|
const colors = artifact.package.resources.colors;
|
|
5198
5587
|
const symbols = artifact.package.resources.symbols;
|
|
5199
5588
|
const bundleFiles = artifact.package.bundleFiles.files;
|