peachsim 0.1.2278 → 0.1.2298
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/platform.ts +28 -8
- package/cli/commands/shell-url.ts +13 -4
- package/cli/outbound-endpoints.ts +2 -0
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.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/bundle-channel.cjs +3691 -3537
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +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/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +2 -2
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +1995 -1900
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +2875 -2721
- package/dist-lib/host/fetch-proxy-handler.cjs +19 -7
- 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 +55 -21
- 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 +14 -2
- 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 +55 -21
- package/dist-lib/native-app-identity-project.cjs +13 -5
- package/dist-lib/native-app-identity-project.mjs +13 -5
- package/dist-lib/native-app-identity.cjs +11 -3
- package/dist-lib/native-app-identity.mjs +11 -3
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.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/public-origins-lib-esm.json +26 -25
- package/dist-lib/public-origins-lib.json +68 -58
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/reap-browser.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 +3579 -3392
- package/dist-lib/swift-compile.cjs +2 -2
- package/dist-lib/swift-compile.mjs +2 -2
- 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 +467 -447
- package/dist-lib/vite.cjs +19 -7
- package/dist-lib/worklet-executable.cjs +421 -118
- package/dist-lib/worklet-executable.mjs +427 -113
- package/dist-types/packages/peach-engine/src/engine/animation-graph.d.ts +3 -1
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +4 -3
- package/dist-types/packages/peach-engine/src/engine/scene-table.d.ts +13 -9
- package/dist-types/packages/peach-engine/src/engine/scroll-momentum-math.d.ts +14 -15
- package/dist-types/packages/peach-engine/src/engine/scroll-platform.d.ts +17 -22
- package/dist-types/packages/peach-engine/src/engine/scroll-velocity.d.ts +0 -1
- package/dist-types/packages/peach-engine/src/kernel/kernel.d.ts +69 -0
- package/dist-types/packages/peach-engine/src/kernel/worklet-kernel.d.ts +28 -0
- package/dist-types/packages/peach-engine/src/platform/personality.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/render-worker/app-load.d.ts +4 -0
- package/dist-types/packages/peach-engine/src/render-worker/graph-linked-value.d.ts +3 -3
- package/dist-types/packages/peach-engine/src/render-worker/worker-input-runtime.d.ts +3 -3
- package/dist-types/packages/peach-engine/src/render-worker/worklet-serialize.d.ts +5 -0
- package/dist-types/packages/peach-engine/src/render-worker/worklet-wire.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/settings/device-spec-bus.d.ts +5 -0
- package/kotlin/README.md +1 -1
- package/kotlin/sdk.tar.gz +0 -0
- package/kotlin/toolchain.json +5 -1
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXAction.h +34 -0
- package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXAnswerCallAction.h +20 -0
- package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXBase.h +20 -0
- package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXCall.h +28 -0
- package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXCallAction.h +23 -0
- package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXCallController.h +53 -0
- package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXCallDirectory.h +16 -0
- package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXCallDirectoryExtensionContext.h +86 -0
- package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXCallDirectoryManager.h +29 -0
- package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXCallDirectoryProvider.h +21 -0
- package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXCallObserver.h +34 -0
- package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXCallUpdate.h +43 -0
- package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXEndCallAction.h +20 -0
- package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXError.h +66 -0
- package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXHandle.h +31 -0
- package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXPlayDTMFCallAction.h +33 -0
- package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXProvider.h +127 -0
- package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXProviderConfiguration.h +42 -0
- package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXSetGroupCallAction.h +27 -0
- package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXSetHeldCallAction.h +23 -0
- package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXSetMutedCallAction.h +23 -0
- package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXSetTranslatingCallAction.h +40 -0
- package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXStartCallAction.h +33 -0
- package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXTransaction.h +34 -0
- package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CallKit.apinotes +36 -0
- package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CallKit.h +35 -0
- package/sdk/ios/System/Library/Frameworks/CallKit.framework/Modules/module.modulemap +6 -0
- package/sdk/ios/System/Library/Frameworks/React.framework/Headers/React.h +14 -0
- package/src/expo-autolinking.ts +1 -1
- package/src/expo-native-prebuilt.ts +24 -0
- package/src/expo-native-workspace.ts +51 -5
- package/src/expo-swift-host.ts +5 -5
- package/src/kotlin-toolchain.ts +16 -1
- package/src/kotlinSdkContract.ts +2 -1
- package/src/nitro-adapter.lock.json +284 -284
- package/src/nitro-compile.ts +69 -4
- package/src/nitro-superset.lock.json +4 -4
- package/src/one-sdk/source.ts +2 -1
- package/src/prepared-native-inventory.ts +8 -2
- package/src/react-native-autolinking.ts +28 -9
- package/src/swift-compiler-digest.ts +8 -1
- package/src/swift-coverage/xcode-packages.ts +2 -1
- package/src/swift-distribution.lock.json +11 -11
- package/src/swift-helper.ts +38 -0
- package/src/swift-host.ts +3 -1
- package/src/swift-pdf-raster.ts +7 -33
- package/src/turbo-bundle.ts +14 -6
- package/src/turbo-codegen-intake.ts +3 -2
- package/src/turbo-compile.ts +12 -1
- package/src/turbo-runtime.lock.json +22 -22
- package/src/turbo-source.ts +2 -4
- package/src/worklet-executable.ts +4 -1
- package/src/worklet-kernel.ts +370 -0
- package/src/worklets-babel.ts +10 -0
- package/src/xcode-target-members.ts +17 -7
package/dist-lib/vite-swift.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2298 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -1163,8 +1163,8 @@ __export(vite_plugin_swift_exports, {
|
|
|
1163
1163
|
swiftPlugin: () => swiftPlugin
|
|
1164
1164
|
});
|
|
1165
1165
|
module.exports = __toCommonJS(vite_plugin_swift_exports);
|
|
1166
|
-
var
|
|
1167
|
-
var
|
|
1166
|
+
var import_node_fs59 = __toESM(require("node:fs"), 1);
|
|
1167
|
+
var import_node_path59 = __toESM(require("node:path"), 1);
|
|
1168
1168
|
|
|
1169
1169
|
// ../sootsim-swift/src/bundleAssets.ts
|
|
1170
1170
|
var import_svgpath = __toESM(require("svgpath"), 1);
|
|
@@ -1394,8 +1394,8 @@ function imagesetFiles(images) {
|
|
|
1394
1394
|
];
|
|
1395
1395
|
}).sort((a, b) => a.scale - b.scale);
|
|
1396
1396
|
}
|
|
1397
|
-
function flatScale(
|
|
1398
|
-
const match = /@([23])x\.[^./]+$/.exec(
|
|
1397
|
+
function flatScale(path53) {
|
|
1398
|
+
const match = /@([23])x\.[^./]+$/.exec(path53);
|
|
1399
1399
|
return match ? Number(match[1]) : 1;
|
|
1400
1400
|
}
|
|
1401
1401
|
function providesNamespace(text5) {
|
|
@@ -1422,8 +1422,8 @@ function catalogEntryName(contentsPath, kind, readText) {
|
|
|
1422
1422
|
}
|
|
1423
1423
|
return segments.join("/");
|
|
1424
1424
|
}
|
|
1425
|
-
function isFlatResourceImage(
|
|
1426
|
-
return
|
|
1425
|
+
function isFlatResourceImage(path53) {
|
|
1426
|
+
return path53.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path53));
|
|
1427
1427
|
}
|
|
1428
1428
|
function enumerateBundleImages(paths, readText, bundleForFile = () => ".") {
|
|
1429
1429
|
const table = [];
|
|
@@ -1436,7 +1436,7 @@ function enumerateBundleImages(paths, readText, bundleForFile = () => ".") {
|
|
|
1436
1436
|
seen.set(bundlePath, names);
|
|
1437
1437
|
return { bundlePath, names };
|
|
1438
1438
|
};
|
|
1439
|
-
const catalogs = paths.filter((
|
|
1439
|
+
const catalogs = paths.filter((path53) => baseOf(path53) === "Contents.json");
|
|
1440
1440
|
for (const contentsPath of catalogs) {
|
|
1441
1441
|
const name3 = catalogEntryName(contentsPath, ".imageset", readText);
|
|
1442
1442
|
if (name3 === null) continue;
|
|
@@ -1468,13 +1468,13 @@ function enumerateBundleImages(paths, readText, bundleForFile = () => ".") {
|
|
|
1468
1468
|
...intent === "template" || intent === "original" ? { renderingMode: intent } : {}
|
|
1469
1469
|
});
|
|
1470
1470
|
}
|
|
1471
|
-
for (const
|
|
1472
|
-
if (!isFlatResourceImage(
|
|
1473
|
-
const name3 = baseOf(
|
|
1474
|
-
const { bundlePath, names } = namesFor(
|
|
1471
|
+
for (const path53 of paths) {
|
|
1472
|
+
if (!isFlatResourceImage(path53)) continue;
|
|
1473
|
+
const name3 = baseOf(path53).slice(0, -extOf(path53).length);
|
|
1474
|
+
const { bundlePath, names } = namesFor(path53);
|
|
1475
1475
|
if (name3 === "" || names.has(name3)) continue;
|
|
1476
1476
|
names.add(name3);
|
|
1477
|
-
table.push({ name: name3, file:
|
|
1477
|
+
table.push({ name: name3, file: path53, scale: flatScale(path53), bundlePath });
|
|
1478
1478
|
}
|
|
1479
1479
|
return table;
|
|
1480
1480
|
}
|
|
@@ -1509,7 +1509,7 @@ function colorsetValue(color) {
|
|
|
1509
1509
|
}
|
|
1510
1510
|
function enumerateBundleColors(paths, readText) {
|
|
1511
1511
|
const table = {};
|
|
1512
|
-
for (const contentsPath of paths.filter((
|
|
1512
|
+
for (const contentsPath of paths.filter((path53) => baseOf(path53) === "Contents.json")) {
|
|
1513
1513
|
const name3 = catalogEntryName(contentsPath, ".colorset", readText);
|
|
1514
1514
|
if (name3 === null || name3 in table) continue;
|
|
1515
1515
|
let colors;
|
|
@@ -1590,8 +1590,8 @@ function axisExtremes(points) {
|
|
|
1590
1590
|
function pathBounds(d) {
|
|
1591
1591
|
const xs = [];
|
|
1592
1592
|
const ys = [];
|
|
1593
|
-
for (const
|
|
1594
|
-
(0, import_svgpath.default)(
|
|
1593
|
+
for (const path53 of d)
|
|
1594
|
+
(0, import_svgpath.default)(path53).abs().unshort().unarc().iterate((segment, _index, x, y) => {
|
|
1595
1595
|
const [command, ...args] = segment;
|
|
1596
1596
|
if (command === "M" || command === "L") {
|
|
1597
1597
|
xs.push(Number(args[0]));
|
|
@@ -1618,7 +1618,7 @@ function guide(svg, id, axis) {
|
|
|
1618
1618
|
}
|
|
1619
1619
|
function enumerateBundleSymbols(paths, readText, bundleForFile) {
|
|
1620
1620
|
const table = {};
|
|
1621
|
-
for (const contentsPath of paths.filter((
|
|
1621
|
+
for (const contentsPath of paths.filter((path53) => baseOf(path53) === "Contents.json")) {
|
|
1622
1622
|
const name3 = catalogEntryName(contentsPath, ".symbolset", readText);
|
|
1623
1623
|
if (name3 === null) continue;
|
|
1624
1624
|
const bundle = bundleForFile(contentsPath);
|
|
@@ -1677,8 +1677,8 @@ function enumerateBundleSymbols(paths, readText, bundleForFile) {
|
|
|
1677
1677
|
advance,
|
|
1678
1678
|
box: [12 - wide2 / 2, 12 - tall / 2, wide2, tall],
|
|
1679
1679
|
...customLayout ? { customLayout } : {},
|
|
1680
|
-
layers: d.map((
|
|
1681
|
-
d: (0, import_svgpath.default)(
|
|
1680
|
+
layers: d.map((path53) => ({
|
|
1681
|
+
d: (0, import_svgpath.default)(path53).abs().scale(em).translate(translateX, translateY).round(3).toString()
|
|
1682
1682
|
}))
|
|
1683
1683
|
};
|
|
1684
1684
|
table[vectorKey] = vector;
|
|
@@ -1690,21 +1690,21 @@ function enumerateBundleSymbols(paths, readText, bundleForFile) {
|
|
|
1690
1690
|
return table;
|
|
1691
1691
|
}
|
|
1692
1692
|
var COMPILED_EXTENSIONS = /* @__PURE__ */ new Set([".swift", ".metal", ".storyboard", ".xib"]);
|
|
1693
|
-
function isCopiedResource(
|
|
1694
|
-
const segments =
|
|
1693
|
+
function isCopiedResource(path53, copiedBundle) {
|
|
1694
|
+
const segments = path53.split("/");
|
|
1695
1695
|
if (segments.some((segment) => /\.(atlasc|bundle|storyboardc|nib|momd)$/.test(segment)))
|
|
1696
1696
|
return true;
|
|
1697
1697
|
if (segments.some((segment) => /\.xcdatamodeld?$/.test(segment))) return false;
|
|
1698
1698
|
if (copiedBundle) return true;
|
|
1699
|
-
const ext = extOf(
|
|
1699
|
+
const ext = extOf(path53);
|
|
1700
1700
|
if (ext === ".json" || ext === ".xcstrings") return true;
|
|
1701
|
-
return !RASTER_EXTENSIONS.has(ext) && !COMPILED_EXTENSIONS.has(ext) && !
|
|
1701
|
+
return !RASTER_EXTENSIONS.has(ext) && !COMPILED_EXTENSIONS.has(ext) && !path53.split("/").some((segment) => segment.endsWith(".xcassets"));
|
|
1702
1702
|
}
|
|
1703
1703
|
function enumerateBundleResources(paths, copiedBundle = false) {
|
|
1704
1704
|
const found = [];
|
|
1705
1705
|
const seen = /* @__PURE__ */ new Set();
|
|
1706
1706
|
const ordered = [...paths].filter(
|
|
1707
|
-
(
|
|
1707
|
+
(path53) => path53.split("/").includes("Resources") && path53.split("/").every((segment) => segment !== "" && segment !== "..") && isCopiedResource(path53, copiedBundle)
|
|
1708
1708
|
).sort((a, b) => {
|
|
1709
1709
|
const aDepth = a.split("/").length;
|
|
1710
1710
|
const bDepth = b.split("/").length;
|
|
@@ -5688,8 +5688,8 @@ export *
|
|
|
5688
5688
|
}`;
|
|
5689
5689
|
}
|
|
5690
5690
|
function swiftPackageIdentity(url) {
|
|
5691
|
-
const
|
|
5692
|
-
return (
|
|
5691
|
+
const path53 = url.endsWith("/") ? url.slice(0, -1) : url;
|
|
5692
|
+
return (path53.split("/").pop() ?? path53).replace(/\.git$/, "").toLowerCase();
|
|
5693
5693
|
}
|
|
5694
5694
|
var withoutGlogModuleMap = (flags) => flags.filter(
|
|
5695
5695
|
(flag) => !(flag.startsWith("-fmodule-map-file=") && flag.endsWith("/glog.modulemap"))
|
|
@@ -6360,10 +6360,10 @@ function synthesizedInterfaceEnums(interfaceText, module2, graphs) {
|
|
|
6360
6360
|
const enclosing = scopes.length > 0 ? scopes[scopes.length - 1].prefix : [];
|
|
6361
6361
|
if (scope2?.[3] === "enum" && opens > 0 && /(^|\s)(public|open)\s/.test(scope2[2] ?? "") && !/\bwhere\b/.test(first.masked) && first.masked[scope2.index + scope2[0].length] !== "<") {
|
|
6362
6362
|
const name3 = scope2[4];
|
|
6363
|
-
const
|
|
6364
|
-
if (!byPath.has(
|
|
6363
|
+
const path53 = scopeOf(name3, enclosing, false);
|
|
6364
|
+
if (!byPath.has(path53.join(".")) && (path53.length === 1 || byPath.has(path53.slice(0, -1).join(".")))) {
|
|
6365
6365
|
const keptAttrs = [...(scope2[1] ?? "").matchAll(/@\w+(?:\([^)]*\))?/g)].map((attr) => attr[0]).filter((attr) => !attr.startsWith("@objc"));
|
|
6366
|
-
const id = `s:peach-synthesized-${module2}-${
|
|
6366
|
+
const id = `s:peach-synthesized-${module2}-${path53.join(".")}`;
|
|
6367
6367
|
const body = [];
|
|
6368
6368
|
let inner = 1;
|
|
6369
6369
|
let closed = false;
|
|
@@ -6418,15 +6418,15 @@ function synthesizedInterfaceEnums(interfaceText, module2, graphs) {
|
|
|
6418
6418
|
symbols.push({
|
|
6419
6419
|
kind: { identifier: "swift.enum" },
|
|
6420
6420
|
identifier: { precise: id },
|
|
6421
|
-
pathComponents:
|
|
6421
|
+
pathComponents: path53,
|
|
6422
6422
|
declarationFragments: fragments,
|
|
6423
6423
|
accessLevel: "public"
|
|
6424
6424
|
});
|
|
6425
|
-
if (
|
|
6425
|
+
if (path53.length > 1)
|
|
6426
6426
|
relationships.push({
|
|
6427
6427
|
kind: "memberOf",
|
|
6428
6428
|
source: id,
|
|
6429
|
-
target: byPath.get(
|
|
6429
|
+
target: byPath.get(path53.slice(0, -1).join("."))
|
|
6430
6430
|
});
|
|
6431
6431
|
for (const kase of cases) {
|
|
6432
6432
|
const memberId = `${id}-${kase.leaf}`;
|
|
@@ -6435,7 +6435,7 @@ function synthesizedInterfaceEnums(interfaceText, module2, graphs) {
|
|
|
6435
6435
|
symbols.push({
|
|
6436
6436
|
kind: { identifier: "swift.enum.case" },
|
|
6437
6437
|
identifier: { precise: memberId },
|
|
6438
|
-
pathComponents: [...
|
|
6438
|
+
pathComponents: [...path53, kase.leaf],
|
|
6439
6439
|
declarationFragments: [
|
|
6440
6440
|
{ kind: "keyword", spelling: "case" },
|
|
6441
6441
|
{ kind: "text", spelling: " " },
|
|
@@ -6451,7 +6451,7 @@ function synthesizedInterfaceEnums(interfaceText, module2, graphs) {
|
|
|
6451
6451
|
symbols.push({
|
|
6452
6452
|
kind: { identifier: "swift.init" },
|
|
6453
6453
|
identifier: { precise: initId },
|
|
6454
|
-
pathComponents: [...
|
|
6454
|
+
pathComponents: [...path53, "init(rawValue:)"],
|
|
6455
6455
|
declarationFragments: [
|
|
6456
6456
|
{ kind: "keyword", spelling: "init" },
|
|
6457
6457
|
{ kind: "text", spelling: "?(" },
|
|
@@ -6520,7 +6520,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
6520
6520
|
})
|
|
6521
6521
|
)
|
|
6522
6522
|
);
|
|
6523
|
-
const trap = (
|
|
6523
|
+
const trap = (path53) => `fatalError("${path53} is ${options.placeholder === void 0 ? "a binary framework" : "a placeholder"} peach cannot run")`;
|
|
6524
6524
|
const skipped = [];
|
|
6525
6525
|
const behavior = options.behavior ?? /* @__PURE__ */ new Map();
|
|
6526
6526
|
const used = /* @__PURE__ */ new Set();
|
|
@@ -6870,34 +6870,34 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
6870
6870
|
lines.push(...physical);
|
|
6871
6871
|
owners.push(...physical.map(() => current));
|
|
6872
6872
|
};
|
|
6873
|
-
const emitAt = (
|
|
6874
|
-
if (omit.has(
|
|
6873
|
+
const emitAt = (path53, line) => {
|
|
6874
|
+
if (omit.has(path53)) return;
|
|
6875
6875
|
const previous = current;
|
|
6876
|
-
current =
|
|
6876
|
+
current = path53;
|
|
6877
6877
|
emit(line);
|
|
6878
6878
|
current = previous;
|
|
6879
6879
|
};
|
|
6880
6880
|
const emitInertState = (id, indent2, build) => {
|
|
6881
|
-
const
|
|
6881
|
+
const path53 = pathOf(byId.get(id));
|
|
6882
6882
|
emitAt(hiddenInit(id), `${indent2}init(_peachInert: Void) { ${build} }`);
|
|
6883
6883
|
const list2 = conforms.get(id) ?? [];
|
|
6884
6884
|
const has = (name3) => (children.get(id) ?? []).some((member) => leaf(member) === name3);
|
|
6885
6885
|
if (list2.includes("Encodable") && !has("encode(to:)"))
|
|
6886
6886
|
emitAt(
|
|
6887
|
-
`${
|
|
6887
|
+
`${path53}.encode(to:)`,
|
|
6888
6888
|
`${indent2}public func encode(to encoder: Encoder) throws {}`
|
|
6889
6889
|
);
|
|
6890
6890
|
if (list2.includes("Decodable") && !has("init(from:)"))
|
|
6891
6891
|
emitAt(
|
|
6892
|
-
`${
|
|
6892
|
+
`${path53}.init(from:)`,
|
|
6893
6893
|
`${indent2}public init(from decoder: Decoder) throws { self.init(_peachInert: ()) }`
|
|
6894
6894
|
);
|
|
6895
6895
|
};
|
|
6896
6896
|
const scoped = (body) => (symbol2, ...rest) => {
|
|
6897
|
-
const
|
|
6898
|
-
if (omit.has(
|
|
6897
|
+
const path53 = pathOf(symbol2);
|
|
6898
|
+
if (omit.has(path53)) return void skipped.push({ path: path53, reason: omit.get(path53) });
|
|
6899
6899
|
const previous = current;
|
|
6900
|
-
current =
|
|
6900
|
+
current = path53;
|
|
6901
6901
|
try {
|
|
6902
6902
|
body(symbol2, ...rest);
|
|
6903
6903
|
} finally {
|
|
@@ -6929,7 +6929,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
6929
6929
|
};
|
|
6930
6930
|
const emitMember = scoped(
|
|
6931
6931
|
(member, indent2, context) => {
|
|
6932
|
-
const
|
|
6932
|
+
const path53 = pathOf(member);
|
|
6933
6933
|
if (TYPE_KINDS.has(member.kind.identifier)) {
|
|
6934
6934
|
const origin = origins.get(member.identifier.precise)?.split(".")[0];
|
|
6935
6935
|
const parent = owner.get(member.identifier.precise);
|
|
@@ -6946,7 +6946,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
6946
6946
|
))
|
|
6947
6947
|
return;
|
|
6948
6948
|
if (!MEMBER_KINDS.has(member.kind.identifier)) {
|
|
6949
|
-
skipped.push({ path:
|
|
6949
|
+
skipped.push({ path: path53, reason: `unhandled ${member.kind.identifier}` });
|
|
6950
6950
|
return;
|
|
6951
6951
|
}
|
|
6952
6952
|
const { 1: spelledAttrs, 2: rest } = LEADING_ATTRS.exec(text(member));
|
|
@@ -6954,15 +6954,15 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
6954
6954
|
/@(\w+)(?:\([^)]*\))?\s*/g,
|
|
6955
6955
|
(attr, name3) => typeByPath.has(name3) ? "" : attr
|
|
6956
6956
|
) : spelledAttrs;
|
|
6957
|
-
const attrs = options.unobjc?.has(
|
|
6957
|
+
const attrs = options.unobjc?.has(path53) ? wrapped.replace(/@objc(?:\([^)]*\))?\s*/g, "") : wrapped;
|
|
6958
6958
|
const modifiers = /^((?:(?:required|final|override|convenience|unowned(?:\(\w+\))?|weak|lazy|nonisolated|mutating|nonmutating) )*)(.*)$/s.exec(
|
|
6959
6959
|
rest
|
|
6960
6960
|
);
|
|
6961
6961
|
const flags = new Set(
|
|
6962
6962
|
modifiers[1].trim().split(/\s+/).filter(Boolean).map((flag) => flag.replace(/\(.*/, ""))
|
|
6963
6963
|
);
|
|
6964
|
-
const requiredInit = context.inClass && !!options.requiredInits?.has(
|
|
6965
|
-
const restatesRequired = context.inClass &&
|
|
6964
|
+
const requiredInit = context.inClass && !!options.requiredInits?.has(path53);
|
|
6965
|
+
const restatesRequired = context.inClass && path53.endsWith(".init()") && [...superChain(owner.get(member.identifier.precise) ?? "")].some(
|
|
6966
6966
|
(at) => options.requiredInits?.has(`${pathOf(byId.get(at))}.init()`)
|
|
6967
6967
|
);
|
|
6968
6968
|
const protocolInit = member.kind.identifier === "swift.init" && /^c:objc\(pl\)\w+\(im\).*::SYNTHESIZED::c:objc\(cs\)/.test(
|
|
@@ -6972,12 +6972,12 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
6972
6972
|
const final = context.inClass && flags.has("final") ? "final " : "";
|
|
6973
6973
|
const mutating = flags.has("mutating") ? "mutating " : flags.has("nonmutating") ? "nonmutating " : "";
|
|
6974
6974
|
let core = `${flags.has("convenience") ? "convenience " : ""}${modifiers[2]}`;
|
|
6975
|
-
const override = context.inClass && !options.plain?.has(
|
|
6975
|
+
const override = context.inClass && !options.plain?.has(path53) && !restatesRequired && (flags.has("override") || overrides.has(member.identifier.precise) || options.forcedOverride?.has(path53) || isObjC(member) && path53.endsWith(".init()")) ? "override " : "";
|
|
6976
6976
|
const head = `${indent2}${attrs}${access(member, context.openOwner)} ${required ? "required " : ""}${final}${override}${mutating}`;
|
|
6977
|
-
const measured = behavior.get(
|
|
6978
|
-
if (measured) used.add(
|
|
6977
|
+
const measured = behavior.get(path53);
|
|
6978
|
+
if (measured) used.add(path53);
|
|
6979
6979
|
const overloadBody = /\basync\b/.test(core) ? measured?.asyncBody : /\bResult</.test(core) ? measured?.resultBody : void 0;
|
|
6980
|
-
const body = overloadBody ?? measured?.body ?? (options.inert ? inertBody(member) : trap(
|
|
6980
|
+
const body = overloadBody ?? measured?.body ?? (options.inert ? inertBody(member) : trap(path53));
|
|
6981
6981
|
switch (member.kind.identifier) {
|
|
6982
6982
|
case "swift.property":
|
|
6983
6983
|
case "swift.type.property":
|
|
@@ -6990,13 +6990,13 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
6990
6990
|
const parameter = !measured && !options.inert && !settable && /:\s*some\s/.test(decl) ? opaqueParameter(member) : void 0;
|
|
6991
6991
|
const getter = parameter ? `return ({ () -> ${parameter} in ${body} })()` : body;
|
|
6992
6992
|
const computed = decl.replace(/^((?:static |class )*)let /, "$1var ");
|
|
6993
|
-
const wrapper = options.projections?.get(
|
|
6993
|
+
const wrapper = options.projections?.get(path53);
|
|
6994
6994
|
if (wrapper) {
|
|
6995
6995
|
const type = /^var\s+`?\w+`?\s*:\s*(.+)$/s.exec(computed)?.[1];
|
|
6996
|
-
const initial = type && inertValue(type, /* @__PURE__ */ new Set(), [
|
|
6996
|
+
const initial = type && inertValue(type, /* @__PURE__ */ new Set(), [path53]);
|
|
6997
6997
|
if (!initial)
|
|
6998
6998
|
return void skipped.push({
|
|
6999
|
-
path:
|
|
6999
|
+
path: path53,
|
|
7000
7000
|
reason: `wrapped by ${wrapper} with no inert initial value`
|
|
7001
7001
|
});
|
|
7002
7002
|
const own = new RegExp(
|
|
@@ -7017,7 +7017,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
7017
7017
|
return;
|
|
7018
7018
|
}
|
|
7019
7019
|
emit(
|
|
7020
|
-
`${head}${computed} { get${effects} { ${getter} }${settable && !effects ? ` ${parsed.nonmutating ? "nonmutating " : ""}set { ${measured?.set ?? (options.inert ? "" : trap(
|
|
7020
|
+
`${head}${computed} { get${effects} { ${getter} }${settable && !effects ? ` ${parsed.nonmutating ? "nonmutating " : ""}set { ${measured?.set ?? (options.inert ? "" : trap(path53))} }` : ""} }`
|
|
7021
7021
|
);
|
|
7022
7022
|
return;
|
|
7023
7023
|
}
|
|
@@ -7076,7 +7076,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
7076
7076
|
};
|
|
7077
7077
|
const emitType = scoped(
|
|
7078
7078
|
(symbol2, indent2) => {
|
|
7079
|
-
const
|
|
7079
|
+
const path53 = pathOf(symbol2);
|
|
7080
7080
|
const id = symbol2.identifier.precise;
|
|
7081
7081
|
const inner = `${indent2} `;
|
|
7082
7082
|
switch (symbol2.kind.identifier) {
|
|
@@ -7093,10 +7093,10 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
7093
7093
|
case "swift.class": {
|
|
7094
7094
|
const shape = header(symbol2, "class", indent2);
|
|
7095
7095
|
if (!shape)
|
|
7096
|
-
return void skipped.push({ path:
|
|
7097
|
-
const parent = options.superclasses?.get(
|
|
7096
|
+
return void skipped.push({ path: path53, reason: `unparsed class ${text(symbol2)}` });
|
|
7097
|
+
const parent = options.superclasses?.get(path53) ?? superclass.get(id);
|
|
7098
7098
|
const blocked = classBlocked(id);
|
|
7099
|
-
if (blocked) return void skipped.push({ path:
|
|
7099
|
+
if (blocked) return void skipped.push({ path: path53, reason: blocked });
|
|
7100
7100
|
const ancestors = /* @__PURE__ */ new Set();
|
|
7101
7101
|
const inherited = /* @__PURE__ */ new Set();
|
|
7102
7102
|
for (let at = superId.get(id); at; at = superId.get(at)) {
|
|
@@ -7112,7 +7112,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
7112
7112
|
"Equatable",
|
|
7113
7113
|
"CustomStringConvertible",
|
|
7114
7114
|
"CustomDebugStringConvertible"
|
|
7115
|
-
].includes(name3)) && !(name3 === nsObjectProtocol && externalRoot(id) === nsObject) && !options.unconformed?.get(
|
|
7115
|
+
].includes(name3)) && !(name3 === nsObjectProtocol && externalRoot(id) === nsObject) && !options.unconformed?.get(path53)?.has(name3.split(/::|\./).pop()) && !options.unconformed?.get(path53)?.has(name3)
|
|
7116
7116
|
)
|
|
7117
7117
|
].filter((name3, at, all2) => all2.indexOf(name3) === at);
|
|
7118
7118
|
const parentSymbol = superId.has(id) ? byId.get(superId.get(id)) : void 0;
|
|
@@ -7124,9 +7124,9 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
7124
7124
|
`${indent2}${shape.attrs}${objcName ? `@objc(${objcName}) ` : ""}${shape.final}${open ? "open" : "public"} class ${shape.name}${shape.generics}${list2.length ? `: ${list2.join(", ")}` : ""}${selfConforming(shape.where)} {`
|
|
7125
7125
|
);
|
|
7126
7126
|
const members2 = membersOf(id);
|
|
7127
|
-
const extra = options.behavior?.get(
|
|
7127
|
+
const extra = options.behavior?.get(path53)?.members;
|
|
7128
7128
|
if (extra) {
|
|
7129
|
-
used.add(
|
|
7129
|
+
used.add(path53);
|
|
7130
7130
|
emit(`${inner}${extra}`);
|
|
7131
7131
|
}
|
|
7132
7132
|
for (const member of members2)
|
|
@@ -7182,11 +7182,11 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
7182
7182
|
if (protocol && member.kind.identifier === "swift.method" && leaf(member).endsWith("()") && have.has(`instance|leaf|${leaf(member).slice(0, -2)}`))
|
|
7183
7183
|
propertyWitnesses.push({
|
|
7184
7184
|
owner: current,
|
|
7185
|
-
head: `extension ${pathOf(protocol)} where Self: ${
|
|
7185
|
+
head: `extension ${pathOf(protocol)} where Self: ${path53} {`,
|
|
7186
7186
|
member,
|
|
7187
|
-
path:
|
|
7187
|
+
path: path53
|
|
7188
7188
|
});
|
|
7189
|
-
else emitWitness(member, inner,
|
|
7189
|
+
else emitWitness(member, inner, path53, open && isObjC(member));
|
|
7190
7190
|
}
|
|
7191
7191
|
}
|
|
7192
7192
|
if (options.inert && designated2 && classBuild(id) === "hidden")
|
|
@@ -7194,13 +7194,13 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
7194
7194
|
const coder = members2.some((member) => leaf(member) === "init(coder:)");
|
|
7195
7195
|
if (designated2 && !coder && externalRoot(id) !== "NSObject" && externalRoot(id) !== null)
|
|
7196
7196
|
emit(
|
|
7197
|
-
`${inner}public required init${options.coderNonfailable?.has(
|
|
7197
|
+
`${inner}public required init${options.coderNonfailable?.has(path53) ? "" : "?"}(coder: NSCoder) { ${options.inert && !options.coderNonfailable?.has(path53) ? "return nil" : trap(`${path53}.init(coder:)`)} }`
|
|
7198
7198
|
);
|
|
7199
7199
|
if (designated2 && !members2.some((member) => leaf(member) === "init()") && [...superChain(id)].some(
|
|
7200
7200
|
(at) => options.requiredInits?.has(`${pathOf(byId.get(at))}.init()`)
|
|
7201
7201
|
))
|
|
7202
7202
|
emit(
|
|
7203
|
-
`${inner}public required init() { ${options.inert ? superInit(id) : trap(`${
|
|
7203
|
+
`${inner}public required init() { ${options.inert ? superInit(id) : trap(`${path53}.init()`)} }`
|
|
7204
7204
|
);
|
|
7205
7205
|
emit(`${indent2}}`);
|
|
7206
7206
|
return;
|
|
@@ -7208,7 +7208,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
7208
7208
|
case "swift.struct": {
|
|
7209
7209
|
const shape = header(symbol2, "struct", indent2);
|
|
7210
7210
|
if (!shape)
|
|
7211
|
-
return void skipped.push({ path:
|
|
7211
|
+
return void skipped.push({ path: path53, reason: `unparsed struct ${text(symbol2)}` });
|
|
7212
7212
|
const members2 = membersOf(id);
|
|
7213
7213
|
const raw2 = rawType(members2);
|
|
7214
7214
|
const list2 = inheritance(id);
|
|
@@ -7248,7 +7248,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
7248
7248
|
emitInertState(
|
|
7249
7249
|
id,
|
|
7250
7250
|
inner,
|
|
7251
|
-
raw2 ? `self.rawValue = ${inertValue(raw2, /* @__PURE__ */ new Set(), [
|
|
7251
|
+
raw2 ? `self.rawValue = ${inertValue(raw2, /* @__PURE__ */ new Set(), [path53]) ?? "0"}` : ""
|
|
7252
7252
|
);
|
|
7253
7253
|
emit(`${indent2}}`);
|
|
7254
7254
|
return;
|
|
@@ -7256,7 +7256,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
7256
7256
|
case "swift.enum": {
|
|
7257
7257
|
const shape = header(symbol2, "enum", indent2);
|
|
7258
7258
|
if (!shape)
|
|
7259
|
-
return void skipped.push({ path:
|
|
7259
|
+
return void skipped.push({ path: path53, reason: `unparsed enum ${text(symbol2)}` });
|
|
7260
7260
|
const members2 = membersOf(id);
|
|
7261
7261
|
const cases = members2.filter(
|
|
7262
7262
|
(member) => member.kind.identifier === "swift.enum.case"
|
|
@@ -7266,7 +7266,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
7266
7266
|
const missing = raw2 ? cases.filter((member) => !values.has(member.identifier.precise)) : [];
|
|
7267
7267
|
if (raw2 && (isObjC(symbol2) || /^c:@C?M@[^@]+@E@/.test(id)) && missing.length > 0)
|
|
7268
7268
|
return void skipped.push({
|
|
7269
|
-
path:
|
|
7269
|
+
path: path53,
|
|
7270
7270
|
reason: `no header value for ${missing.map(leaf).join(", ")}`
|
|
7271
7271
|
});
|
|
7272
7272
|
const list2 = inheritance(id, raw2 ?? void 0).filter(
|
|
@@ -7305,8 +7305,8 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
7305
7305
|
});
|
|
7306
7306
|
}
|
|
7307
7307
|
if (options.inert) {
|
|
7308
|
-
const value = options.trapped?.has(hiddenInit(id)) ? null : inertValue(
|
|
7309
|
-
emitInertState(id, inner, value === null ? trap(
|
|
7308
|
+
const value = options.trapped?.has(hiddenInit(id)) ? null : inertValue(path53, /* @__PURE__ */ new Set(), []);
|
|
7309
|
+
emitInertState(id, inner, value === null ? trap(path53) : `self = ${value}`);
|
|
7310
7310
|
}
|
|
7311
7311
|
emit(`${indent2}}`);
|
|
7312
7312
|
return;
|
|
@@ -7315,14 +7315,14 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
7315
7315
|
const shape = header(symbol2, "protocol", indent2);
|
|
7316
7316
|
if (!shape)
|
|
7317
7317
|
return void skipped.push({
|
|
7318
|
-
path:
|
|
7318
|
+
path: path53,
|
|
7319
7319
|
reason: `unparsed protocol ${text(symbol2)}`
|
|
7320
7320
|
});
|
|
7321
7321
|
const native = nativeObjcProtocols.has(id);
|
|
7322
7322
|
const objcName = native ? /^c:objc\(pl\)(\w+)$/.exec(id)?.[1] : void 0;
|
|
7323
7323
|
if (native && !objcName)
|
|
7324
7324
|
return void skipped.push({
|
|
7325
|
-
path:
|
|
7325
|
+
path: path53,
|
|
7326
7326
|
reason: `unknown Objective-C protocol identity ${id}`
|
|
7327
7327
|
});
|
|
7328
7328
|
const list2 = [
|
|
@@ -7350,7 +7350,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
7350
7350
|
}
|
|
7351
7351
|
emit(`${indent2}}`);
|
|
7352
7352
|
if (defaults.length > 0) {
|
|
7353
|
-
emit(`${indent2}extension ${
|
|
7353
|
+
emit(`${indent2}extension ${path53} {`);
|
|
7354
7354
|
for (const member of defaults) {
|
|
7355
7355
|
const decl = text(member);
|
|
7356
7356
|
if (optional3.has(member.identifier.precise) && member.kind.identifier === "swift.method" && !decl.replace(/\([^)]*\)/g, "").includes("->") && !/ async\b/.test(decl))
|
|
@@ -7444,7 +7444,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
7444
7444
|
return null;
|
|
7445
7445
|
};
|
|
7446
7446
|
const emitGlobal = scoped((symbol2) => {
|
|
7447
|
-
const
|
|
7447
|
+
const path53 = pathOf(symbol2);
|
|
7448
7448
|
const kind = symbol2.kind.identifier;
|
|
7449
7449
|
if (kind === "swift.func" || kind === "swift.func.op" || kind === "swift.method" || kind === "swift.type.method") {
|
|
7450
7450
|
const { 1: attrs, 2: rest } = LEADING_ATTRS.exec(text(symbol2));
|
|
@@ -7453,20 +7453,20 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
7453
7453
|
if (leaf(symbol2).endsWith("(_:)") && !/^(?:prefix|infix|postfix)\b/.test(spelled2))
|
|
7454
7454
|
spelled2 = `prefix ${spelled2}`;
|
|
7455
7455
|
}
|
|
7456
|
-
const measured = behavior.get(
|
|
7457
|
-
if (measured) used.add(
|
|
7456
|
+
const measured = behavior.get(path53);
|
|
7457
|
+
if (measured) used.add(path53);
|
|
7458
7458
|
const overloadBody = /\basync\b/.test(spelled2) ? measured?.asyncBody : /\bResult</.test(spelled2) ? measured?.resultBody : void 0;
|
|
7459
7459
|
emit(
|
|
7460
|
-
`${attrs}public ${spelled2} { ${overloadBody ?? measured?.body ?? (options.inert ? inertBody(symbol2) : trap(
|
|
7460
|
+
`${attrs}public ${spelled2} { ${overloadBody ?? measured?.body ?? (options.inert ? inertBody(symbol2) : trap(path53))} }`
|
|
7461
7461
|
);
|
|
7462
7462
|
} else if (kind === "swift.var") {
|
|
7463
7463
|
const parsed = splitAccessors(text(symbol2).replace(/^let /, "var "));
|
|
7464
|
-
const measured = behavior.get(
|
|
7465
|
-
if (measured) used.add(
|
|
7464
|
+
const measured = behavior.get(path53);
|
|
7465
|
+
if (measured) used.add(path53);
|
|
7466
7466
|
emit(
|
|
7467
|
-
`public ${parsed.decl} { ${measured?.body ?? (options.inert ? inertBody(symbol2) : trap(
|
|
7467
|
+
`public ${parsed.decl} { ${measured?.body ?? (options.inert ? inertBody(symbol2) : trap(path53))} }`
|
|
7468
7468
|
);
|
|
7469
|
-
} else skipped.push({ path:
|
|
7469
|
+
} else skipped.push({ path: path53, reason: `unhandled top-level ${kind}` });
|
|
7470
7470
|
});
|
|
7471
7471
|
const cExports = new Set(
|
|
7472
7472
|
[...byId.values()].flatMap((symbol2) => {
|
|
@@ -7483,7 +7483,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
7483
7483
|
return !name3 || !cExports.has(`${name3}|${text(symbol2)}`);
|
|
7484
7484
|
}).sort((a, b) => pathOf(a).localeCompare(pathOf(b)));
|
|
7485
7485
|
for (const symbol2 of roots) {
|
|
7486
|
-
const
|
|
7486
|
+
const path53 = pathOf(symbol2);
|
|
7487
7487
|
if (TYPE_KINDS.has(symbol2.kind.identifier)) emitType(symbol2, "");
|
|
7488
7488
|
else emitGlobal(symbol2);
|
|
7489
7489
|
}
|
|
@@ -7544,9 +7544,9 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
7544
7544
|
"#endif",
|
|
7545
7545
|
""
|
|
7546
7546
|
];
|
|
7547
|
-
for (const
|
|
7548
|
-
if (!used.has(
|
|
7549
|
-
skipped.push({ path:
|
|
7547
|
+
for (const path53 of behavior.keys())
|
|
7548
|
+
if (!used.has(path53))
|
|
7549
|
+
skipped.push({ path: path53, reason: "behavior names no emitted declaration" });
|
|
7550
7550
|
return {
|
|
7551
7551
|
source: `${[...banner, ...lines].join("\n")}
|
|
7552
7552
|
`,
|
|
@@ -9648,9 +9648,9 @@ var EXCERPT = /^(\s*)(\d+)( \| )(.*)$/;
|
|
|
9648
9648
|
var MARKER = /^(\s*)( \| )(.*)$/;
|
|
9649
9649
|
function designTimeDiagnostic(output2, files2) {
|
|
9650
9650
|
const rewritten = /* @__PURE__ */ new Map();
|
|
9651
|
-
const linesOf = (
|
|
9651
|
+
const linesOf = (path53) => {
|
|
9652
9652
|
const file = Object.keys(files2).find(
|
|
9653
|
-
(name3) => name3.endsWith(".swift") && (
|
|
9653
|
+
(name3) => name3.endsWith(".swift") && (path53 === name3 || path53.endsWith(`/${name3}`))
|
|
9654
9654
|
);
|
|
9655
9655
|
if (file === void 0) return null;
|
|
9656
9656
|
let lines = rewritten.get(file);
|
|
@@ -18284,7 +18284,7 @@ var darwinRecordsRegion = (quoted2) => quoted2.length ? ["-Wl,--start-lib", ...q
|
|
|
18284
18284
|
var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
18285
18285
|
var MULTI_MANIFEST_VERSION = 68;
|
|
18286
18286
|
var SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
|
|
18287
|
-
var compilerSourceDigest = true ? "
|
|
18287
|
+
var compilerSourceDigest = true ? "954c2461be59202cebfcc9f9ab9775d01da9581bb5babf07b19bf8ef3ed9832a" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
|
|
18288
18288
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
18289
18289
|
const hash = (0, import_node_crypto13.createHash)("sha256");
|
|
18290
18290
|
hash.update(`swift-compile
|
|
@@ -22757,11 +22757,11 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
22757
22757
|
|
|
22758
22758
|
// src/swift-host.ts
|
|
22759
22759
|
var import_node_async_hooks2 = require("node:async_hooks");
|
|
22760
|
-
var
|
|
22761
|
-
var
|
|
22762
|
-
var
|
|
22763
|
-
var
|
|
22764
|
-
var
|
|
22760
|
+
var import_node_child_process36 = require("node:child_process");
|
|
22761
|
+
var import_node_crypto31 = require("node:crypto");
|
|
22762
|
+
var import_node_fs56 = __toESM(require("node:fs"), 1);
|
|
22763
|
+
var import_node_os15 = __toESM(require("node:os"), 1);
|
|
22764
|
+
var import_node_path56 = __toESM(require("node:path"), 1);
|
|
22765
22765
|
|
|
22766
22766
|
// ../sootsim-swift/src/stringCatalog.ts
|
|
22767
22767
|
function isRecord2(value) {
|
|
@@ -22854,31 +22854,31 @@ function tokens(text5) {
|
|
|
22854
22854
|
}
|
|
22855
22855
|
return result;
|
|
22856
22856
|
}
|
|
22857
|
-
function qualified(language, key2,
|
|
22858
|
-
return `(${language}: ${key2}${
|
|
22857
|
+
function qualified(language, key2, path53) {
|
|
22858
|
+
return `(${language}: ${key2}${path53 === "" ? "" : "|==|" + path53})`;
|
|
22859
22859
|
}
|
|
22860
|
-
function requiresNumber(language, key2,
|
|
22860
|
+
function requiresNumber(language, key2, path53) {
|
|
22861
22861
|
return Error(
|
|
22862
|
-
"Plural variation requires referencing the number in the string. To maintain grammatical correctness for strings that do not reference the number of items, use separate top-level strings for one and greater than one. " + qualified(language, key2,
|
|
22862
|
+
"Plural variation requires referencing the number in the string. To maintain grammatical correctness for strings that do not reference the number of items, use separate top-level strings for one and greater than one. " + qualified(language, key2, path53)
|
|
22863
22863
|
);
|
|
22864
22864
|
}
|
|
22865
|
-
function moreThanOne(language, key2,
|
|
22865
|
+
function moreThanOne(language, key2, path53) {
|
|
22866
22866
|
return Error(
|
|
22867
|
-
"Cannot infer format specifier for string group because more than one numerical specifier was found " + qualified(language, key2,
|
|
22867
|
+
"Cannot infer format specifier for string group because more than one numerical specifier was found " + qualified(language, key2, path53)
|
|
22868
22868
|
);
|
|
22869
22869
|
}
|
|
22870
22870
|
function schemaPath(segments) {
|
|
22871
22871
|
return segments.map((segment) => `'${segment}'`).join(" -> ");
|
|
22872
22872
|
}
|
|
22873
|
-
function checkUnitShape(node,
|
|
22873
|
+
function checkUnitShape(node, path53) {
|
|
22874
22874
|
const raw2 = node.stringUnit;
|
|
22875
22875
|
if (raw2 === void 0)
|
|
22876
|
-
throw Error(`Missing required key 'stringUnit' inside ${schemaPath(
|
|
22876
|
+
throw Error(`Missing required key 'stringUnit' inside ${schemaPath(path53)}`);
|
|
22877
22877
|
if (raw2 === null)
|
|
22878
|
-
throw Error(`Missing required value for key 'stringUnit' inside ${schemaPath(
|
|
22878
|
+
throw Error(`Missing required value for key 'stringUnit' inside ${schemaPath(path53)}`);
|
|
22879
22879
|
if (!isRecord2(raw2))
|
|
22880
|
-
throw Error(`Expected dictionary for key 'stringUnit' inside ${schemaPath(
|
|
22881
|
-
const unitPath = [...
|
|
22880
|
+
throw Error(`Expected dictionary for key 'stringUnit' inside ${schemaPath(path53)}`);
|
|
22881
|
+
const unitPath = [...path53, "stringUnit"];
|
|
22882
22882
|
if (!Object.hasOwn(raw2, "state"))
|
|
22883
22883
|
throw Error(`Missing required key 'state' inside ${schemaPath(unitPath)}`);
|
|
22884
22884
|
const state = raw2.state;
|
|
@@ -22895,38 +22895,38 @@ function checkUnitShape(node, path52) {
|
|
|
22895
22895
|
throw Error(`Expected string for key 'value' inside ${schemaPath(unitPath)}`);
|
|
22896
22896
|
return value;
|
|
22897
22897
|
}
|
|
22898
|
-
function checkPluralShape(node,
|
|
22898
|
+
function checkPluralShape(node, path53) {
|
|
22899
22899
|
for (const [category, raw2] of Object.entries(node)) {
|
|
22900
|
-
const categoryPath = [...
|
|
22900
|
+
const categoryPath = [...path53, category];
|
|
22901
22901
|
if (raw2 === null)
|
|
22902
22902
|
throw Error(
|
|
22903
|
-
`Missing required value for key '${category}' inside ${schemaPath(
|
|
22903
|
+
`Missing required value for key '${category}' inside ${schemaPath(path53)}`
|
|
22904
22904
|
);
|
|
22905
22905
|
if (!isRecord2(raw2))
|
|
22906
|
-
throw Error(`Expected dictionary for key '${category}' inside ${schemaPath(
|
|
22906
|
+
throw Error(`Expected dictionary for key '${category}' inside ${schemaPath(path53)}`);
|
|
22907
22907
|
checkUnitShape(raw2, categoryPath);
|
|
22908
22908
|
}
|
|
22909
22909
|
}
|
|
22910
|
-
function checkLocalizationShape(node,
|
|
22910
|
+
function checkLocalizationShape(node, path53, deviceValue = false) {
|
|
22911
22911
|
if (node === null)
|
|
22912
22912
|
throw Error(
|
|
22913
|
-
`Missing required value for key '${
|
|
22913
|
+
`Missing required value for key '${path53[path53.length - 1]}' inside ${schemaPath(path53.slice(0, -1))}`
|
|
22914
22914
|
);
|
|
22915
22915
|
if (!isRecord2(node))
|
|
22916
22916
|
throw Error(
|
|
22917
|
-
`Expected dictionary for key '${
|
|
22917
|
+
`Expected dictionary for key '${path53[path53.length - 1]}' inside ${schemaPath(path53.slice(0, -1))}`
|
|
22918
22918
|
);
|
|
22919
|
-
if (Object.hasOwn(node, "variations")) checkVariationsShape(node.variations,
|
|
22919
|
+
if (Object.hasOwn(node, "variations")) checkVariationsShape(node.variations, path53);
|
|
22920
22920
|
if (!deviceValue && Object.hasOwn(node, "substitutions"))
|
|
22921
|
-
checkSubstitutionsShape(node.substitutions,
|
|
22922
|
-
if (!Object.hasOwn(node, "variations")) checkUnitShape(node,
|
|
22921
|
+
checkSubstitutionsShape(node.substitutions, path53);
|
|
22922
|
+
if (!Object.hasOwn(node, "variations")) checkUnitShape(node, path53);
|
|
22923
22923
|
}
|
|
22924
|
-
function checkVariationsShape(variations,
|
|
22924
|
+
function checkVariationsShape(variations, path53) {
|
|
22925
22925
|
if (variations === null)
|
|
22926
|
-
throw Error(`Missing required value for key 'variations' inside ${schemaPath(
|
|
22926
|
+
throw Error(`Missing required value for key 'variations' inside ${schemaPath(path53)}`);
|
|
22927
22927
|
if (!isRecord2(variations))
|
|
22928
|
-
throw Error(`Expected dictionary for key 'variations' inside ${schemaPath(
|
|
22929
|
-
const variationsPath = [...
|
|
22928
|
+
throw Error(`Expected dictionary for key 'variations' inside ${schemaPath(path53)}`);
|
|
22929
|
+
const variationsPath = [...path53, "variations"];
|
|
22930
22930
|
for (const [type, raw2] of Object.entries(variations)) {
|
|
22931
22931
|
if (raw2 === null)
|
|
22932
22932
|
throw Error(
|
|
@@ -22952,11 +22952,11 @@ function checkVariationsShape(variations, path52) {
|
|
|
22952
22952
|
}
|
|
22953
22953
|
}
|
|
22954
22954
|
}
|
|
22955
|
-
function checkSubstitutionsShape(substitutions,
|
|
22955
|
+
function checkSubstitutionsShape(substitutions, path53) {
|
|
22956
22956
|
if (substitutions === null) return;
|
|
22957
22957
|
if (!isRecord2(substitutions))
|
|
22958
|
-
throw Error(`Expected dictionary for key 'substitutions' inside ${schemaPath(
|
|
22959
|
-
const substitutionsPath = [...
|
|
22958
|
+
throw Error(`Expected dictionary for key 'substitutions' inside ${schemaPath(path53)}`);
|
|
22959
|
+
const substitutionsPath = [...path53, "substitutions"];
|
|
22960
22960
|
for (const [name3, raw2] of Object.entries(substitutions)) {
|
|
22961
22961
|
const subPath = [...substitutionsPath, name3];
|
|
22962
22962
|
if (raw2 === null)
|
|
@@ -22998,10 +22998,10 @@ function scanSpecs(forms) {
|
|
|
22998
22998
|
}
|
|
22999
22999
|
return specs;
|
|
23000
23000
|
}
|
|
23001
|
-
function inferPlural(forms, language, key2,
|
|
23001
|
+
function inferPlural(forms, language, key2, path53) {
|
|
23002
23002
|
const specs = scanSpecs(forms);
|
|
23003
|
-
if (specs.size === 0) throw requiresNumber(language, key2,
|
|
23004
|
-
if (specs.size > 1) throw moreThanOne(language, key2,
|
|
23003
|
+
if (specs.size === 0) throw requiresNumber(language, key2, path53);
|
|
23004
|
+
if (specs.size > 1) throw moreThanOne(language, key2, path53);
|
|
23005
23005
|
return [...specs.values()][0] ?? { specifier: "", argument: 0 };
|
|
23006
23006
|
}
|
|
23007
23007
|
function unit(value) {
|
|
@@ -23833,8 +23833,8 @@ function plist(value, depth) {
|
|
|
23833
23833
|
}
|
|
23834
23834
|
function compileStringCatalog(source, name3) {
|
|
23835
23835
|
return Object.fromEntries(
|
|
23836
|
-
Object.entries(compileCatalogTables(source, name3)).map(([
|
|
23837
|
-
|
|
23836
|
+
Object.entries(compileCatalogTables(source, name3)).map(([path53, table]) => [
|
|
23837
|
+
path53,
|
|
23838
23838
|
'<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n<plist version="1.0">\n' + plist(table, 0) + "</plist>\n"
|
|
23839
23839
|
])
|
|
23840
23840
|
);
|
|
@@ -25109,14 +25109,22 @@ function parseOpenStepPlist(text5) {
|
|
|
25109
25109
|
var NEVER_MEMBER = /(?:^|\/)(?:Info\.plist|[^/]+\.entitlements|[^/]+\.xcconfig|\.DS_Store)$/;
|
|
25110
25110
|
var FOLDER_REFERENCE = /^(?:folder|wrapper\.scnassets)$/;
|
|
25111
25111
|
var BUNDLE_DIR = /\.(xcassets|bundle|lproj|xcdatamodeld|scnassets|spriteatlas|rcproject|storyboardc|icon)$/;
|
|
25112
|
-
|
|
25113
|
-
|
|
25112
|
+
var groupParents = /* @__PURE__ */ new WeakMap();
|
|
25113
|
+
function groupParentsOf(objects) {
|
|
25114
|
+
let parents = groupParents.get(objects);
|
|
25115
|
+
if (parents) return parents;
|
|
25116
|
+
parents = /* @__PURE__ */ new Map();
|
|
25114
25117
|
for (const [id, entry] of Object.entries(objects)) {
|
|
25115
25118
|
if (!isDict(entry)) continue;
|
|
25116
25119
|
if (entry.isa === "PBXGroup" || entry.isa === "PBXVariantGroup") {
|
|
25117
25120
|
for (const child of list(entry.children)) parents.set(child, id);
|
|
25118
25121
|
}
|
|
25119
25122
|
}
|
|
25123
|
+
groupParents.set(objects, parents);
|
|
25124
|
+
return parents;
|
|
25125
|
+
}
|
|
25126
|
+
function xcodePathResolver(objects, projectDir, join9, sourceTreeRoot) {
|
|
25127
|
+
const parents = groupParentsOf(objects);
|
|
25120
25128
|
const paths = /* @__PURE__ */ new Map();
|
|
25121
25129
|
const resolve2 = (id) => {
|
|
25122
25130
|
if (paths.has(id)) return paths.get(id);
|
|
@@ -25429,15 +25437,15 @@ var import_node_fs33 = require("node:fs");
|
|
|
25429
25437
|
var import_node_path33 = require("node:path");
|
|
25430
25438
|
|
|
25431
25439
|
// src/swift-coverage/provenance.ts
|
|
25432
|
-
var swiftCoverageProvenance = true ? JSON.parse('{"swift-coverage/indexdump.ts":"0d82d8eeb96bf377f409ea7e33274c341a710c0e071f6b6e17571a23d8d92412","swift-coverage/indexing.ts":"633ccf19eec1f382a8847d0ee1dca42a2792a3c60aafd43622ed5152b09b8272","swift-coverage/types.ts":"bd8fae54ea6c53e110cd8a5d7b57c1d532dd0166e09fdaea63c4f270c3780dd1","swift-coverage/source.ts":"c151758a9f67631bc61473c375df0dc017da6902a34533b2cf4fc4fd7d19b6ee","swift-coverage/package.ts":"1f0068be7461fa7c5a7a891faf318f305cbed2e94c19667ba76627f7e5be260b","swift-coverage/xcode.ts":"65a500b806ce1c3a496de27f2e0ad77287c0f6795c618342c08af647f92af1fa","swift-coverage/xcode-assets.ts":"d98d6294b359528f7733b26db6f80f554782354faa235605f9562be4ad98b8a3","swift-coverage/xcode-asset-symbols.ts":"1b2a67733bc9d139b351466270205452a6172140bc25080d72619e2952c44671","swift-coverage/xcode-bridging.ts":"33184be8c5daf6646aa5a1276a4e15531f1be27b7c26f56550e0fbb1fc678a11","swift-coverage/xcode-packages.ts":"
|
|
25440
|
+
var swiftCoverageProvenance = true ? JSON.parse('{"swift-coverage/indexdump.ts":"0d82d8eeb96bf377f409ea7e33274c341a710c0e071f6b6e17571a23d8d92412","swift-coverage/indexing.ts":"633ccf19eec1f382a8847d0ee1dca42a2792a3c60aafd43622ed5152b09b8272","swift-coverage/types.ts":"bd8fae54ea6c53e110cd8a5d7b57c1d532dd0166e09fdaea63c4f270c3780dd1","swift-coverage/source.ts":"c151758a9f67631bc61473c375df0dc017da6902a34533b2cf4fc4fd7d19b6ee","swift-coverage/package.ts":"1f0068be7461fa7c5a7a891faf318f305cbed2e94c19667ba76627f7e5be260b","swift-coverage/xcode.ts":"65a500b806ce1c3a496de27f2e0ad77287c0f6795c618342c08af647f92af1fa","swift-coverage/xcode-assets.ts":"d98d6294b359528f7733b26db6f80f554782354faa235605f9562be4ad98b8a3","swift-coverage/xcode-asset-symbols.ts":"1b2a67733bc9d139b351466270205452a6172140bc25080d72619e2952c44671","swift-coverage/xcode-bridging.ts":"33184be8c5daf6646aa5a1276a4e15531f1be27b7c26f56550e0fbb1fc678a11","swift-coverage/xcode-packages.ts":"5c83f56357d880243ab485b260d23abd0094583ffa2287dac6e9e7eb18c3673d","swift-coverage/xcode-strings.ts":"f2dd4c7cd8ef77035184b0132909c2fa09fd20ed06b7757c2f1f960bfdde031c","swift-coverage/reader.ts":"da559b67ecd1161dea70c980b5f98f2c55af3550f0714479100fa5e9e813625c","swift-coverage/provenance.ts":"f5039c16e63c6129e22b71203f58982c68cef6e282a4f236b93da28edd39c108","swift-package-manifest.ts":"bfde06f157f52d3dd76577b3c6059c95c0393180b054ced773624ea89558992b","swift-package.ts":"338cfef9a34a930206ac2e1a8a90b85c8d61f776d9a41e6445dc18e0c5385cdb","swift-source-file.ts":"93fd659ed63a27b67f54a7c229a7ceb636dc9c59e68414920ba36cff1eda1f94","swift-toolchain.ts":"b60efa4eb7516378344cb7c48216aea5fa36590ace91a698655b48cfd0db96fe","home-paths.ts":"d1606390f0e8e50f0ff72544eadb3d49dfabf08e004c1218f2998c36fb8995dd","xcode-header-search.ts":"f8c3d557b4eca5ddad32907545353eb7ad53b2ebd0969d9ed8f7275e109a13b1","xcode-project.ts":"774c42f06f8d5c1f3f3a09f94379db2046af0016f1fcd6cbe595a9c2da5dcf95","xcode-target-members.ts":"2f25aaf5a3aa34395983c75935491c06bd68554c47ff1cb06b49c79499c03db0","xcode-json-project.ts":"41990ebbe4b488eef34e74c4608b4b48e5a5b299ba98ca7fbcfdfa0e77be63b6","openstep-plist.ts":"74e6ce1dac80c9c318e0e9f5e3e8cd19a898a8820c36fc160609695bcb59dcd3"}') : swiftCoverageSourceDigests((0, import_node_path.join)(__sootsim_import_meta_dirname, ".."));
|
|
25433
25441
|
|
|
25434
25442
|
// src/swift-coverage/xcode-asset-symbols.ts
|
|
25435
25443
|
var import_node_fs32 = require("node:fs");
|
|
25436
25444
|
var import_node_path32 = require("node:path");
|
|
25437
25445
|
var Refusal = class extends Error {
|
|
25438
25446
|
};
|
|
25439
|
-
var refuse3 = (
|
|
25440
|
-
throw new Refusal(`Generated asset symbols are unproven for ${
|
|
25447
|
+
var refuse3 = (path53, reason) => {
|
|
25448
|
+
throw new Refusal(`Generated asset symbols are unproven for ${path53}: ${reason}`);
|
|
25441
25449
|
};
|
|
25442
25450
|
var isRecord3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
25443
25451
|
var scope = (source) => ({
|
|
@@ -25725,14 +25733,14 @@ function addAsset(into, asset) {
|
|
|
25725
25733
|
function checkStack(dir, type, devices) {
|
|
25726
25734
|
const sets = (parent, allowed) => (0, import_node_fs32.readdirSync)(parent, { withFileTypes: true }).flatMap((entry) => {
|
|
25727
25735
|
if (entry.name.startsWith(".") || entry.isFile()) return [];
|
|
25728
|
-
const
|
|
25736
|
+
const path53 = (0, import_node_path32.join)(parent, entry.name);
|
|
25729
25737
|
const extension = (0, import_node_path32.extname)(entry.name);
|
|
25730
25738
|
if (!entry.isDirectory() || !allowed.includes(extension))
|
|
25731
25739
|
return refuse3(
|
|
25732
|
-
|
|
25740
|
+
path53,
|
|
25733
25741
|
`image stack content other than ${allowed.join(", ")} is unproven`
|
|
25734
25742
|
);
|
|
25735
|
-
return [{ path:
|
|
25743
|
+
return [{ path: path53, extension }];
|
|
25736
25744
|
});
|
|
25737
25745
|
for (const layer of sets(dir, [`.${type}layer`, ".imageset", ".colorset"])) {
|
|
25738
25746
|
if (layer.extension !== `.${type}layer`) continue;
|
|
@@ -25744,37 +25752,37 @@ function checkStack(dir, type, devices) {
|
|
|
25744
25752
|
function walk(dir, into, devices, extensions) {
|
|
25745
25753
|
for (const entry of (0, import_node_fs32.readdirSync)(dir, { withFileTypes: true })) {
|
|
25746
25754
|
if (entry.name.startsWith(".") || entry.isFile()) continue;
|
|
25747
|
-
const
|
|
25748
|
-
if (!entry.isDirectory()) return refuse3(
|
|
25755
|
+
const path53 = (0, import_node_path32.join)(dir, entry.name);
|
|
25756
|
+
if (!entry.isDirectory()) return refuse3(path53, "it is neither a file nor a directory");
|
|
25749
25757
|
const extension = (0, import_node_path32.extname)(entry.name).slice(1);
|
|
25750
25758
|
const type = extension.toLowerCase();
|
|
25751
25759
|
const base = entry.name.slice(0, entry.name.length - extension.length - 1);
|
|
25752
25760
|
if (type !== extension && knownTypes.has(type))
|
|
25753
|
-
return refuse3(
|
|
25761
|
+
return refuse3(path53, "its type extension is not lowercase");
|
|
25754
25762
|
if (type === "colorset" || type === "imageset" || type === "symbolset") {
|
|
25755
25763
|
addAsset(into, {
|
|
25756
25764
|
kind: type === "colorset" ? "color" : "image",
|
|
25757
25765
|
name: base,
|
|
25758
|
-
...assetState(
|
|
25766
|
+
...assetState(path53, type, devices),
|
|
25759
25767
|
extensions,
|
|
25760
|
-
source:
|
|
25768
|
+
source: path53
|
|
25761
25769
|
});
|
|
25762
25770
|
continue;
|
|
25763
25771
|
}
|
|
25764
25772
|
if (silentTypes.has(type)) continue;
|
|
25765
25773
|
if (stackTypes.has(type)) {
|
|
25766
|
-
checkStack(
|
|
25774
|
+
checkStack(path53, type, devices);
|
|
25767
25775
|
continue;
|
|
25768
25776
|
}
|
|
25769
|
-
if (unprovenTypes.has(type)) return refuse3(
|
|
25777
|
+
if (unprovenTypes.has(type)) return refuse3(path53, `${type} assets are unproven`);
|
|
25770
25778
|
const name3 = type === "spriteatlas" ? base : entry.name;
|
|
25771
|
-
if (!folderProperties((0, import_node_path32.join)(
|
|
25772
|
-
walk(
|
|
25779
|
+
if (!folderProperties((0, import_node_path32.join)(path53, "Contents.json")).namespace) {
|
|
25780
|
+
walk(path53, into, devices, extensions);
|
|
25773
25781
|
continue;
|
|
25774
25782
|
}
|
|
25775
|
-
const child = into.namespaces.get(name3) ?? scope(
|
|
25783
|
+
const child = into.namespaces.get(name3) ?? scope(path53);
|
|
25776
25784
|
into.namespaces.set(name3, child);
|
|
25777
|
-
walk(
|
|
25785
|
+
walk(path53, child, devices, extensions);
|
|
25778
25786
|
}
|
|
25779
25787
|
}
|
|
25780
25788
|
var hasKind = (into, kind) => [...into.assets.values()].some((asset) => asset.kind === kind && asset.included) || [...into.namespaces.values()].some((child) => hasKind(child, kind));
|
|
@@ -25843,11 +25851,11 @@ function members(into, kind, prefix, extensions) {
|
|
|
25843
25851
|
const assets2 = /* @__PURE__ */ new Set();
|
|
25844
25852
|
const out = [];
|
|
25845
25853
|
for (const entry of entries) {
|
|
25846
|
-
const
|
|
25854
|
+
const path53 = `${prefix}${entry.name}`;
|
|
25847
25855
|
const source = entry.child ? entry.child.source : entry.asset.source;
|
|
25848
25856
|
if (Array.from(entry.name).some((char) => char.charCodeAt(0) > 127))
|
|
25849
25857
|
refuse3(source, "its name is not ASCII");
|
|
25850
|
-
const named = (text6) => `The \\"${escape(
|
|
25858
|
+
const named = (text6) => `The \\"${escape(path53)}\\" ${text6}`;
|
|
25851
25859
|
if (entry.child) {
|
|
25852
25860
|
const text6 = symbol(entry.name, true);
|
|
25853
25861
|
if (!text6)
|
|
@@ -25870,9 +25878,9 @@ function members(into, kind, prefix, extensions) {
|
|
|
25870
25878
|
namespaces.add(text6);
|
|
25871
25879
|
out.push({
|
|
25872
25880
|
type: "namespace",
|
|
25873
|
-
path:
|
|
25881
|
+
path: path53,
|
|
25874
25882
|
symbol: spelled(text6),
|
|
25875
|
-
members: members(entry.child, kind, `${
|
|
25883
|
+
members: members(entry.child, kind, `${path53}/`, extensions)
|
|
25876
25884
|
});
|
|
25877
25885
|
}
|
|
25878
25886
|
continue;
|
|
@@ -25899,7 +25907,7 @@ function members(into, kind, prefix, extensions) {
|
|
|
25899
25907
|
else if (!omitted)
|
|
25900
25908
|
out.push({
|
|
25901
25909
|
type: "asset",
|
|
25902
|
-
path:
|
|
25910
|
+
path: path53,
|
|
25903
25911
|
name: entry.name,
|
|
25904
25912
|
symbol: spelled(text5),
|
|
25905
25913
|
thinnable: asset.thinnable,
|
|
@@ -26433,11 +26441,11 @@ function catalogDigest(directory) {
|
|
|
26433
26441
|
for (const entry of (0, import_node_fs33.readdirSync)(dir, { withFileTypes: true }).sort(
|
|
26434
26442
|
(a, b) => a.name.localeCompare(b.name)
|
|
26435
26443
|
)) {
|
|
26436
|
-
const
|
|
26437
|
-
if (entry.isDirectory()) walk3(
|
|
26438
|
-
else if (entry.isFile() && (0, import_node_fs33.statSync)(
|
|
26439
|
-
hashes.push([(0, import_node_path33.relative)(directory,
|
|
26440
|
-
else throw new Error(`Unsupported asset catalog entry: ${
|
|
26444
|
+
const path53 = (0, import_node_path33.join)(dir, entry.name);
|
|
26445
|
+
if (entry.isDirectory()) walk3(path53);
|
|
26446
|
+
else if (entry.isFile() && (0, import_node_fs33.statSync)(path53).size <= 64 * 1024 * 1024)
|
|
26447
|
+
hashes.push([(0, import_node_path33.relative)(directory, path53), sha2562((0, import_node_fs33.readFileSync)(path53))]);
|
|
26448
|
+
else throw new Error(`Unsupported asset catalog entry: ${path53}`);
|
|
26441
26449
|
}
|
|
26442
26450
|
};
|
|
26443
26451
|
walk3(directory);
|
|
@@ -26449,7 +26457,7 @@ function symbolSource(plan, root) {
|
|
|
26449
26457
|
const known = symbolTexts.get(key2);
|
|
26450
26458
|
if (known !== void 0) return { status: "source", text: known };
|
|
26451
26459
|
const source = assetSymbolSource(
|
|
26452
|
-
plan.catalogs.map(({ path:
|
|
26460
|
+
plan.catalogs.map(({ path: path53 }) => (0, import_node_path33.join)(root, path53)),
|
|
26453
26461
|
plan.settings
|
|
26454
26462
|
);
|
|
26455
26463
|
if (source.status === "source") symbolTexts.set(key2, source.text);
|
|
@@ -26508,9 +26516,9 @@ function planAssetSymbols(resources, root, settings) {
|
|
|
26508
26516
|
`Generated asset symbols are proven only for TARGETED_DEVICE_FAMILY 1, 2, 1,2, 1,7, 1,3,7, 1,2,6 or 1,2,7; this target resolves to "${families}".`
|
|
26509
26517
|
);
|
|
26510
26518
|
const plan = {
|
|
26511
|
-
catalogs: catalogs.map((
|
|
26512
|
-
path:
|
|
26513
|
-
sha256: catalogDigest((0, import_node_path33.join)(root,
|
|
26519
|
+
catalogs: catalogs.map((path53) => ({
|
|
26520
|
+
path: path53,
|
|
26521
|
+
sha256: catalogDigest((0, import_node_path33.join)(root, path53))
|
|
26514
26522
|
})),
|
|
26515
26523
|
settings: { deployment: target, devices, extensions: extensions === "YES" }
|
|
26516
26524
|
};
|
|
@@ -32280,7 +32288,7 @@ function resolveSwiftPackages(options) {
|
|
|
32280
32288
|
headers.set(name3, import_node_path42.default.relative(binary.dir, dir));
|
|
32281
32289
|
};
|
|
32282
32290
|
visit(pkg, binary.target);
|
|
32283
|
-
binary.headerDependencies = [...headers].map(([module2,
|
|
32291
|
+
binary.headerDependencies = [...headers].map(([module2, path53]) => ({ module: module2, path: path53 }));
|
|
32284
32292
|
}
|
|
32285
32293
|
for (const owner of options.owners ?? []) {
|
|
32286
32294
|
const found = productClosure(owner.products);
|
|
@@ -32462,7 +32470,7 @@ function sourceClosureDigest(srcDir, entrypoints) {
|
|
|
32462
32470
|
return hash.digest("hex");
|
|
32463
32471
|
}
|
|
32464
32472
|
var standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
|
|
32465
|
-
var STANDIN_SOURCE_DIGEST = true ? "
|
|
32473
|
+
var STANDIN_SOURCE_DIGEST = true ? "8147cd62e6fb2f5e7f46a1f7c728e18c4f15d54e52092dfa86c289b96dff7e9c" : standinSourceDigest();
|
|
32466
32474
|
|
|
32467
32475
|
// src/swift-standins.ts
|
|
32468
32476
|
var import_node_child_process31 = require("node:child_process");
|
|
@@ -33571,8 +33579,8 @@ function withBuiltinStandinBehavior(behavior) {
|
|
|
33571
33579
|
for (const [module2, members2] of Object.entries(BUILTIN_STANDIN_BEHAVIOR))
|
|
33572
33580
|
merged[module2] = {
|
|
33573
33581
|
...Object.fromEntries(
|
|
33574
|
-
Object.entries(members2).map(([
|
|
33575
|
-
|
|
33582
|
+
Object.entries(members2).map(([path53, entry]) => [
|
|
33583
|
+
path53,
|
|
33576
33584
|
{ ...entry, builtin: true }
|
|
33577
33585
|
])
|
|
33578
33586
|
),
|
|
@@ -37498,11 +37506,11 @@ async function xcodeCxxReachable(app, binaries, moduleRoot, clang) {
|
|
|
37498
37506
|
}
|
|
37499
37507
|
|
|
37500
37508
|
// src/swift-pdf-raster.ts
|
|
37501
|
-
var
|
|
37502
|
-
var
|
|
37503
|
-
var
|
|
37504
|
-
var
|
|
37505
|
-
var
|
|
37509
|
+
var import_node_child_process35 = require("node:child_process");
|
|
37510
|
+
var import_node_crypto30 = require("node:crypto");
|
|
37511
|
+
var import_node_fs55 = __toESM(require("node:fs"), 1);
|
|
37512
|
+
var import_node_os14 = __toESM(require("node:os"), 1);
|
|
37513
|
+
var import_node_path55 = __toESM(require("node:path"), 1);
|
|
37506
37514
|
|
|
37507
37515
|
// cli/internal-child-contract.ts
|
|
37508
37516
|
var RNX_INTERNAL_COMMAND = "__internal";
|
|
@@ -37543,8 +37551,8 @@ function sourceEntryPath() {
|
|
|
37543
37551
|
return null;
|
|
37544
37552
|
}
|
|
37545
37553
|
}
|
|
37546
|
-
function isCliEntry(
|
|
37547
|
-
const name3 = (0, import_node_path53.basename)(
|
|
37554
|
+
function isCliEntry(path53) {
|
|
37555
|
+
const name3 = (0, import_node_path53.basename)(path53);
|
|
37548
37556
|
return name3 === "bin.ts" || name3 === "bin.js";
|
|
37549
37557
|
}
|
|
37550
37558
|
function rnxSelfInvocation() {
|
|
@@ -37563,6 +37571,41 @@ function rnxSelfInvocation() {
|
|
|
37563
37571
|
return { executable: process.execPath, prefixArgs: [entry] };
|
|
37564
37572
|
}
|
|
37565
37573
|
|
|
37574
|
+
// src/swift-helper.ts
|
|
37575
|
+
var import_node_child_process34 = require("node:child_process");
|
|
37576
|
+
var import_node_crypto29 = require("node:crypto");
|
|
37577
|
+
var import_node_fs54 = __toESM(require("node:fs"), 1);
|
|
37578
|
+
var import_node_os13 = __toESM(require("node:os"), 1);
|
|
37579
|
+
var import_node_path54 = __toESM(require("node:path"), 1);
|
|
37580
|
+
function compiledSwiftHelper(swift, name3) {
|
|
37581
|
+
const tag = (0, import_node_crypto29.createHash)("sha256").update(swift).digest("hex").slice(0, 16);
|
|
37582
|
+
const binary = import_node_path54.default.join(cacheDir(), `${name3}-${tag}`);
|
|
37583
|
+
try {
|
|
37584
|
+
import_node_fs54.default.accessSync(binary, import_node_fs54.default.constants.X_OK);
|
|
37585
|
+
return binary;
|
|
37586
|
+
} catch {
|
|
37587
|
+
}
|
|
37588
|
+
try {
|
|
37589
|
+
import_node_fs54.default.mkdirSync(cacheDir(), { recursive: true });
|
|
37590
|
+
const source = import_node_path54.default.join(
|
|
37591
|
+
import_node_fs54.default.mkdtempSync(import_node_path54.default.join(import_node_os13.default.tmpdir(), `${name3}-`)),
|
|
37592
|
+
"main.swift"
|
|
37593
|
+
);
|
|
37594
|
+
import_node_fs54.default.writeFileSync(source, swift);
|
|
37595
|
+
try {
|
|
37596
|
+
(0, import_node_child_process34.execFileSync)("xcrun", ["swiftc", "-o", binary, source], { stdio: "pipe" });
|
|
37597
|
+
} finally {
|
|
37598
|
+
import_node_fs54.default.rmSync(import_node_path54.default.dirname(source), { recursive: true, force: true });
|
|
37599
|
+
}
|
|
37600
|
+
import_node_fs54.default.accessSync(binary, import_node_fs54.default.constants.X_OK);
|
|
37601
|
+
return binary;
|
|
37602
|
+
} catch (error) {
|
|
37603
|
+
throw new Error(
|
|
37604
|
+
`${name3} did not compile (xcrun swiftc): ${error instanceof Error ? error.message : String(error)}`
|
|
37605
|
+
);
|
|
37606
|
+
}
|
|
37607
|
+
}
|
|
37608
|
+
|
|
37566
37609
|
// src/swift-pdf-raster.ts
|
|
37567
37610
|
var RASTER_SWIFT = `import Foundation
|
|
37568
37611
|
import CoreGraphics
|
|
@@ -37588,51 +37631,27 @@ guard let dest = CGImageDestinationCreateWithURL(output as CFURL, UTType.png.ide
|
|
|
37588
37631
|
CGImageDestinationAddImage(dest, image, nil)
|
|
37589
37632
|
guard CGImageDestinationFinalize(dest) else { exit(7) }
|
|
37590
37633
|
`;
|
|
37591
|
-
function rasterBinary(swift = RASTER_SWIFT, name3 = "swift-pdf-raster") {
|
|
37592
|
-
const tag = (0, import_node_crypto29.createHash)("sha256").update(swift).digest("hex").slice(0, 16);
|
|
37593
|
-
const binary = import_node_path54.default.join(cacheDir(), `${name3}-${tag}`);
|
|
37594
|
-
try {
|
|
37595
|
-
import_node_fs54.default.accessSync(binary, import_node_fs54.default.constants.X_OK);
|
|
37596
|
-
return binary;
|
|
37597
|
-
} catch {
|
|
37598
|
-
}
|
|
37599
|
-
try {
|
|
37600
|
-
import_node_fs54.default.mkdirSync(cacheDir(), { recursive: true });
|
|
37601
|
-
const source = import_node_path54.default.join(
|
|
37602
|
-
import_node_fs54.default.mkdtempSync(import_node_path54.default.join(import_node_os13.default.tmpdir(), "swift-pdf-raster-")),
|
|
37603
|
-
"raster.swift"
|
|
37604
|
-
);
|
|
37605
|
-
import_node_fs54.default.writeFileSync(source, swift);
|
|
37606
|
-
try {
|
|
37607
|
-
(0, import_node_child_process34.execFileSync)("xcrun", ["swiftc", "-o", binary, source], { stdio: "pipe" });
|
|
37608
|
-
} finally {
|
|
37609
|
-
import_node_fs54.default.rmSync(import_node_path54.default.dirname(source), { recursive: true, force: true });
|
|
37610
|
-
}
|
|
37611
|
-
import_node_fs54.default.accessSync(binary, import_node_fs54.default.constants.X_OK);
|
|
37612
|
-
return binary;
|
|
37613
|
-
} catch (error) {
|
|
37614
|
-
throw new Error(
|
|
37615
|
-
`swift pdf asset rasterizer did not compile (xcrun swiftc): ${error instanceof Error ? error.message : String(error)}`
|
|
37616
|
-
);
|
|
37617
|
-
}
|
|
37618
|
-
}
|
|
37619
37634
|
function rasterizePdfFile(diskPath, pdfSha256) {
|
|
37620
|
-
const renderer = process.platform === "darwin" ? (0,
|
|
37621
|
-
const cached =
|
|
37635
|
+
const renderer = process.platform === "darwin" ? (0, import_node_crypto30.createHash)("sha256").update(RASTER_SWIFT).digest("hex").slice(0, 16) : "pdfium-1";
|
|
37636
|
+
const cached = import_node_path55.default.join(cacheDir(), `swift-pdf-png-${renderer}-${pdfSha256}.png`);
|
|
37622
37637
|
try {
|
|
37623
|
-
return { bytes:
|
|
37638
|
+
return { bytes: import_node_fs55.default.readFileSync(cached) };
|
|
37624
37639
|
} catch {
|
|
37625
37640
|
}
|
|
37626
|
-
const out =
|
|
37627
|
-
|
|
37641
|
+
const out = import_node_path55.default.join(
|
|
37642
|
+
import_node_fs55.default.mkdtempSync(import_node_path55.default.join(import_node_os14.default.tmpdir(), "swift-pdf-png-")),
|
|
37628
37643
|
"out.png"
|
|
37629
37644
|
);
|
|
37630
37645
|
try {
|
|
37631
37646
|
if (process.platform === "darwin") {
|
|
37632
|
-
(0,
|
|
37647
|
+
(0, import_node_child_process35.execFileSync)(
|
|
37648
|
+
compiledSwiftHelper(RASTER_SWIFT, "swift-pdf-raster"),
|
|
37649
|
+
[diskPath, "3", out],
|
|
37650
|
+
{ stdio: "pipe" }
|
|
37651
|
+
);
|
|
37633
37652
|
} else {
|
|
37634
37653
|
const { executable, prefixArgs } = rnxSelfInvocation();
|
|
37635
|
-
(0,
|
|
37654
|
+
(0, import_node_child_process35.execFileSync)(
|
|
37636
37655
|
executable,
|
|
37637
37656
|
[
|
|
37638
37657
|
...prefixArgs,
|
|
@@ -37645,10 +37664,10 @@ function rasterizePdfFile(diskPath, pdfSha256) {
|
|
|
37645
37664
|
{ stdio: "pipe" }
|
|
37646
37665
|
);
|
|
37647
37666
|
}
|
|
37648
|
-
const bytes =
|
|
37667
|
+
const bytes = import_node_fs55.default.readFileSync(out);
|
|
37649
37668
|
try {
|
|
37650
|
-
|
|
37651
|
-
|
|
37669
|
+
import_node_fs55.default.mkdirSync(cacheDir(), { recursive: true });
|
|
37670
|
+
import_node_fs55.default.copyFileSync(out, cached);
|
|
37652
37671
|
} catch {
|
|
37653
37672
|
}
|
|
37654
37673
|
return { bytes: Buffer.from(bytes) };
|
|
@@ -37657,7 +37676,7 @@ function rasterizePdfFile(diskPath, pdfSha256) {
|
|
|
37657
37676
|
`swift pdf asset ${diskPath} did not rasterize (corrupt or oversize pdf, like actool distill failure): ${error instanceof Error ? error.message : String(error)}`
|
|
37658
37677
|
);
|
|
37659
37678
|
} finally {
|
|
37660
|
-
|
|
37679
|
+
import_node_fs55.default.rmSync(import_node_path55.default.dirname(out), { recursive: true, force: true });
|
|
37661
37680
|
}
|
|
37662
37681
|
}
|
|
37663
37682
|
var RASTER_SVG_SWIFT = `import AppKit
|
|
@@ -37681,26 +37700,26 @@ do { try data.write(to: output) } catch { exit(7) }
|
|
|
37681
37700
|
`;
|
|
37682
37701
|
function rasterizeSvgFile(diskPath, svgSha256) {
|
|
37683
37702
|
if (process.platform !== "darwin") return null;
|
|
37684
|
-
const binary =
|
|
37685
|
-
const tag = (0,
|
|
37686
|
-
const cached =
|
|
37687
|
-
if (
|
|
37688
|
-
const out =
|
|
37689
|
-
|
|
37703
|
+
const binary = compiledSwiftHelper(RASTER_SVG_SWIFT, "swift-svg-raster");
|
|
37704
|
+
const tag = (0, import_node_crypto30.createHash)("sha256").update(RASTER_SVG_SWIFT).digest("hex").slice(0, 16);
|
|
37705
|
+
const cached = import_node_path55.default.join(cacheDir(), `swift-svg-png-${tag}-${svgSha256}.png`);
|
|
37706
|
+
if (import_node_fs55.default.existsSync(cached)) return { bytes: import_node_fs55.default.readFileSync(cached) };
|
|
37707
|
+
const out = import_node_path55.default.join(
|
|
37708
|
+
import_node_fs55.default.mkdtempSync(import_node_path55.default.join(import_node_os14.default.tmpdir(), "swift-svg-png-")),
|
|
37690
37709
|
"out.png"
|
|
37691
37710
|
);
|
|
37692
37711
|
try {
|
|
37693
|
-
(0,
|
|
37694
|
-
const bytes =
|
|
37695
|
-
|
|
37696
|
-
|
|
37712
|
+
(0, import_node_child_process35.execFileSync)(binary, [diskPath, "3", out], { stdio: "pipe" });
|
|
37713
|
+
const bytes = import_node_fs55.default.readFileSync(out);
|
|
37714
|
+
import_node_fs55.default.mkdirSync(cacheDir(), { recursive: true });
|
|
37715
|
+
import_node_fs55.default.copyFileSync(out, cached);
|
|
37697
37716
|
return { bytes: Buffer.from(bytes) };
|
|
37698
37717
|
} catch (error) {
|
|
37699
37718
|
throw new Error(
|
|
37700
37719
|
`swift svg asset ${diskPath} did not rasterize: ${error instanceof Error ? error.message : String(error)}`
|
|
37701
37720
|
);
|
|
37702
37721
|
} finally {
|
|
37703
|
-
|
|
37722
|
+
import_node_fs55.default.rmSync(import_node_path55.default.dirname(out), { recursive: true, force: true });
|
|
37704
37723
|
}
|
|
37705
37724
|
}
|
|
37706
37725
|
|
|
@@ -37716,18 +37735,18 @@ var SKIP_ROOT_DIRS = /* @__PURE__ */ new Set(["dist", "types", "build", "ios", "
|
|
|
37716
37735
|
var NATIVE_DESCRIPTOR = ".one-native-source.json";
|
|
37717
37736
|
var NATIVE_GLUE = ".one-native-source.swift.txt";
|
|
37718
37737
|
function swiftPackageId(packagePath) {
|
|
37719
|
-
return
|
|
37738
|
+
return import_node_path56.default.basename(packagePath).replace(/[^A-Za-z0-9_]/g, "_").replace(/^(\d)/, "_$1");
|
|
37720
37739
|
}
|
|
37721
37740
|
function nativeSourceDescriptor(packagePath) {
|
|
37722
|
-
packagePath =
|
|
37741
|
+
packagePath = import_node_fs56.default.realpathSync(packagePath);
|
|
37723
37742
|
if (sourceEntries().has(packagePath)) return null;
|
|
37724
|
-
const file =
|
|
37725
|
-
if (!
|
|
37743
|
+
const file = import_node_path56.default.join(packagePath, NATIVE_DESCRIPTOR);
|
|
37744
|
+
if (!import_node_fs56.default.existsSync(file)) return null;
|
|
37726
37745
|
const value = JSON.parse(
|
|
37727
37746
|
readPackageFile2(packagePath, file, MAX_SWIFT_COMPILE_SOURCE_BYTES).toString("utf8")
|
|
37728
37747
|
);
|
|
37729
37748
|
const invalid = () => new Error(`${file}: invalid One native source descriptor; run one typegen`);
|
|
37730
|
-
if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !
|
|
37749
|
+
if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !import_node_fs56.default.existsSync(import_node_path56.default.join(packagePath, NATIVE_GLUE))) {
|
|
37731
37750
|
throw invalid();
|
|
37732
37751
|
}
|
|
37733
37752
|
if (!isSwiftNativeModules(value) || value.packageId !== swiftPackageId(packagePath)) {
|
|
@@ -37736,9 +37755,9 @@ function nativeSourceDescriptor(packagePath) {
|
|
|
37736
37755
|
return value;
|
|
37737
37756
|
}
|
|
37738
37757
|
function nativeSourceFiles(packagePath) {
|
|
37739
|
-
packagePath =
|
|
37758
|
+
packagePath = import_node_fs56.default.realpathSync(packagePath);
|
|
37740
37759
|
if (sourceEntries().has(packagePath)) return [];
|
|
37741
|
-
return [NATIVE_DESCRIPTOR, NATIVE_GLUE].map((name3) =>
|
|
37760
|
+
return [NATIVE_DESCRIPTOR, NATIVE_GLUE].map((name3) => import_node_path56.default.join(packagePath, name3)).filter((file) => import_node_fs56.default.existsSync(file));
|
|
37742
37761
|
}
|
|
37743
37762
|
var SwiftMissingModulesError = class extends Error {
|
|
37744
37763
|
};
|
|
@@ -37748,7 +37767,7 @@ var projects = () => projectScope.getStore()?.projects ?? sharedProjects;
|
|
|
37748
37767
|
var sharedSourceEntries = /* @__PURE__ */ new Map();
|
|
37749
37768
|
var sourceEntries = () => projectScope.getStore()?.sourceEntries ?? sharedSourceEntries;
|
|
37750
37769
|
function projectFor(packagePath, hosted, signal) {
|
|
37751
|
-
packagePath =
|
|
37770
|
+
packagePath = import_node_fs56.default.realpathSync(packagePath);
|
|
37752
37771
|
const existing = projects().get(packagePath);
|
|
37753
37772
|
if (existing) {
|
|
37754
37773
|
if (signal && existing.signal !== signal) {
|
|
@@ -37792,23 +37811,23 @@ function readXcodeAppTargetPrepared(input, target, configuration, options) {
|
|
|
37792
37811
|
});
|
|
37793
37812
|
const checkouts = remoteSwiftCheckouts(probe.rootDir);
|
|
37794
37813
|
for (const projectDir of probe.projectDirs) {
|
|
37795
|
-
const packages =
|
|
37796
|
-
|
|
37797
|
-
const link =
|
|
37814
|
+
const packages = import_node_path56.default.join(projectDir, ".build", "peach-xcode", "SourcePackages");
|
|
37815
|
+
import_node_fs56.default.mkdirSync(packages, { recursive: true });
|
|
37816
|
+
const link = import_node_path56.default.join(packages, "checkouts");
|
|
37798
37817
|
let linked = null;
|
|
37799
37818
|
try {
|
|
37800
|
-
linked =
|
|
37819
|
+
linked = import_node_fs56.default.lstatSync(link).isSymbolicLink() ? import_node_fs56.default.readlinkSync(link) : null;
|
|
37801
37820
|
} catch {
|
|
37802
37821
|
linked = null;
|
|
37803
37822
|
}
|
|
37804
37823
|
if (linked !== null) {
|
|
37805
|
-
if (
|
|
37806
|
-
|
|
37807
|
-
} else if (
|
|
37824
|
+
if (import_node_path56.default.resolve(packages, linked) === checkouts) continue;
|
|
37825
|
+
import_node_fs56.default.unlinkSync(link);
|
|
37826
|
+
} else if (import_node_fs56.default.existsSync(link)) continue;
|
|
37808
37827
|
try {
|
|
37809
|
-
|
|
37828
|
+
import_node_fs56.default.symlinkSync(checkouts, link);
|
|
37810
37829
|
} catch (error) {
|
|
37811
|
-
if (!(error instanceof Error && "code" in error && error.code === "EEXIST") ||
|
|
37830
|
+
if (!(error instanceof Error && "code" in error && error.code === "EEXIST") || import_node_path56.default.resolve(packages, import_node_fs56.default.readlinkSync(link)) !== checkouts)
|
|
37812
37831
|
throw error;
|
|
37813
37832
|
}
|
|
37814
37833
|
}
|
|
@@ -37826,10 +37845,10 @@ async function wasmPortableAssembly(binaries, toolchainBin, moduleRoot) {
|
|
|
37826
37845
|
);
|
|
37827
37846
|
if (assembly.length === 0) return /* @__PURE__ */ new Set();
|
|
37828
37847
|
const sdk2 = swiftSdkPaths(moduleRoot, toolchainBin);
|
|
37829
|
-
const clang =
|
|
37848
|
+
const clang = import_node_path56.default.join(toolchainBin, "clang");
|
|
37830
37849
|
const empty = (binary, file) => {
|
|
37831
|
-
const source =
|
|
37832
|
-
const key2 = (0,
|
|
37850
|
+
const source = import_node_path56.default.join(binary.dir, file);
|
|
37851
|
+
const key2 = (0, import_node_crypto31.createHash)("sha256").update(
|
|
37833
37852
|
JSON.stringify([
|
|
37834
37853
|
clang,
|
|
37835
37854
|
sdk2.sysroot,
|
|
@@ -37837,11 +37856,11 @@ async function wasmPortableAssembly(binaries, toolchainBin, moduleRoot) {
|
|
|
37837
37856
|
binary.dir,
|
|
37838
37857
|
binary.publicHeaders
|
|
37839
37858
|
])
|
|
37840
|
-
).update(
|
|
37859
|
+
).update(import_node_fs56.default.readFileSync(source)).digest("hex");
|
|
37841
37860
|
const known = emptyWasmAssembly.get(key2);
|
|
37842
37861
|
if (known) return known;
|
|
37843
37862
|
const result = new Promise(
|
|
37844
|
-
(resolve2) => (0,
|
|
37863
|
+
(resolve2) => (0, import_node_child_process36.execFile)(
|
|
37845
37864
|
clang,
|
|
37846
37865
|
[
|
|
37847
37866
|
"-target",
|
|
@@ -37850,9 +37869,9 @@ async function wasmPortableAssembly(binaries, toolchainBin, moduleRoot) {
|
|
|
37850
37869
|
sdk2.sysroot,
|
|
37851
37870
|
...sdk2.cFlags,
|
|
37852
37871
|
"-I",
|
|
37853
|
-
|
|
37872
|
+
import_node_path56.default.join(binary.dir, binary.publicHeaders),
|
|
37854
37873
|
"-I",
|
|
37855
|
-
|
|
37874
|
+
import_node_path56.default.dirname(source),
|
|
37856
37875
|
"-E",
|
|
37857
37876
|
"-P",
|
|
37858
37877
|
"-x",
|
|
@@ -37874,7 +37893,7 @@ async function wasmPortableAssembly(binaries, toolchainBin, moduleRoot) {
|
|
|
37874
37893
|
return new Set(portable.flat());
|
|
37875
37894
|
}
|
|
37876
37895
|
async function swiftPackages(entry, app) {
|
|
37877
|
-
const stamp = (file) =>
|
|
37896
|
+
const stamp = (file) => import_node_fs56.default.existsSync(file) ? (0, import_node_crypto31.createHash)("sha256").update(import_node_fs56.default.readFileSync(file)).digest("hex") : null;
|
|
37878
37897
|
const owners = [...app.frameworks, app].map((target) => ({
|
|
37879
37898
|
module: target.moduleName,
|
|
37880
37899
|
products: target.packageProducts ?? []
|
|
@@ -37883,9 +37902,9 @@ async function swiftPackages(entry, app) {
|
|
|
37883
37902
|
app.linkedProducts,
|
|
37884
37903
|
owners,
|
|
37885
37904
|
app.packageResolved.map((file) => [file, stamp(file)]),
|
|
37886
|
-
app.localPackageDirs.map((dir) => stamp(
|
|
37905
|
+
app.localPackageDirs.map((dir) => stamp(import_node_path56.default.join(dir, "Package.swift"))),
|
|
37887
37906
|
app.linkedProducts.map(
|
|
37888
|
-
({ source }) => source.kind === "local" ? stamp(
|
|
37907
|
+
({ source }) => source.kind === "local" ? stamp(import_node_path56.default.join(source.dir, "Package.swift")) : 0
|
|
37889
37908
|
)
|
|
37890
37909
|
]);
|
|
37891
37910
|
let cached = entry.packages;
|
|
@@ -37935,7 +37954,7 @@ async function swiftPackages(entry, app) {
|
|
|
37935
37954
|
app,
|
|
37936
37955
|
reached,
|
|
37937
37956
|
entry.moduleRoot,
|
|
37938
|
-
|
|
37957
|
+
import_node_path56.default.join(resolved.toolchainBin, "clang++")
|
|
37939
37958
|
);
|
|
37940
37959
|
const portableAssembly = await wasmPortableAssembly(
|
|
37941
37960
|
reached,
|
|
@@ -38007,13 +38026,13 @@ function xcodeInputKey(layout2, file, relative2) {
|
|
|
38007
38026
|
const input = file.endsWith(".swift") ? relative2.split("/").map(
|
|
38008
38027
|
(part) => part === "." || part === ".." ? part : part.replaceAll("%", "%25").replace(/^\./, "%2E")
|
|
38009
38028
|
).join("/") : relative2;
|
|
38010
|
-
return
|
|
38029
|
+
return import_node_path56.default.posix.join(owner, input);
|
|
38011
38030
|
}
|
|
38012
38031
|
const checkouts = layout2.checkouts;
|
|
38013
|
-
return file.startsWith(`${checkouts}${
|
|
38032
|
+
return file.startsWith(`${checkouts}${import_node_path56.default.sep}`) ? import_node_path56.default.posix.join(
|
|
38014
38033
|
XCODE_PACKAGES_DIR,
|
|
38015
|
-
|
|
38016
|
-
) : relative2 === ".." || relative2.startsWith("../") ?
|
|
38034
|
+
import_node_path56.default.relative(checkouts, file).split(import_node_path56.default.sep).join("/")
|
|
38035
|
+
) : relative2 === ".." || relative2.startsWith("../") ? import_node_path56.default.posix.join("external", file.split(import_node_path56.default.sep).join("/")) : relative2;
|
|
38017
38036
|
}
|
|
38018
38037
|
var layoutScope = new import_node_async_hooks2.AsyncLocalStorage();
|
|
38019
38038
|
async function withXcodeLayout(root, run5) {
|
|
@@ -38085,17 +38104,17 @@ async function buildXcodeLayout(root) {
|
|
|
38085
38104
|
const generatedSources = {};
|
|
38086
38105
|
const coreDataClasses = (files3, dir) => {
|
|
38087
38106
|
for (const [name3, text5] of Object.entries(coreDataSources(files3)))
|
|
38088
|
-
generatedSources[
|
|
38107
|
+
generatedSources[import_node_path56.default.posix.join(dir, "GeneratedCoreData", name3)] = text5;
|
|
38089
38108
|
};
|
|
38090
38109
|
const targetAssetSymbols = (module2, dir) => {
|
|
38091
38110
|
const plan = planAssetSymbols(
|
|
38092
|
-
module2.resources.map((file) =>
|
|
38111
|
+
module2.resources.map((file) => import_node_path56.default.relative(root, file)),
|
|
38093
38112
|
root,
|
|
38094
38113
|
module2.assetSettings
|
|
38095
38114
|
);
|
|
38096
38115
|
if (plan.status === "unknown") throw new Error(`${module2.name}: ${plan.reason}`);
|
|
38097
38116
|
if (plan.status === "plan")
|
|
38098
|
-
generatedSources[
|
|
38117
|
+
generatedSources[import_node_path56.default.posix.join(dir, "GeneratedAssetSymbols.swift")] = assetSymbolText(plan.plan, root);
|
|
38099
38118
|
};
|
|
38100
38119
|
targetAssetSymbols(app, XCODE_APP_DIR);
|
|
38101
38120
|
coreDataClasses(app.resources, XCODE_APP_DIR);
|
|
@@ -38113,7 +38132,7 @@ async function buildXcodeLayout(root) {
|
|
|
38113
38132
|
usedNames.add(name3);
|
|
38114
38133
|
}
|
|
38115
38134
|
frameworkNames.set(framework, name3);
|
|
38116
|
-
const dir =
|
|
38135
|
+
const dir = import_node_path56.default.posix.join(XCODE_FRAMEWORKS_DIR, name3);
|
|
38117
38136
|
if (name3 === framework.moduleName)
|
|
38118
38137
|
resourceBundles.push({
|
|
38119
38138
|
target: name3,
|
|
@@ -38174,7 +38193,7 @@ async function buildXcodeLayout(root) {
|
|
|
38174
38193
|
}),
|
|
38175
38194
|
...(framework.packageProducts ?? []).flatMap(({ product, source }) => {
|
|
38176
38195
|
const native = packages.nativeProducts.find(
|
|
38177
|
-
({ name: name3, source: origin }) => name3 === product && (source.kind === "unnamed" || origin === (source.kind === "remote" ? source.url :
|
|
38196
|
+
({ name: name3, source: origin }) => name3 === product && (source.kind === "unnamed" || origin === (source.kind === "remote" ? source.url : import_node_path56.default.resolve(source.dir)))
|
|
38178
38197
|
);
|
|
38179
38198
|
return native ? [
|
|
38180
38199
|
{
|
|
@@ -38191,23 +38210,23 @@ async function buildXcodeLayout(root) {
|
|
|
38191
38210
|
let localPackageRoot = root;
|
|
38192
38211
|
for (const { manifest, remote } of packages.nativePackages) {
|
|
38193
38212
|
if (remote) continue;
|
|
38194
|
-
let relative3 =
|
|
38195
|
-
while (relative3 === ".." || relative3.startsWith(`..${
|
|
38196
|
-
localPackageRoot =
|
|
38197
|
-
relative3 =
|
|
38213
|
+
let relative3 = import_node_path56.default.relative(localPackageRoot, manifest.dir);
|
|
38214
|
+
while (relative3 === ".." || relative3.startsWith(`..${import_node_path56.default.sep}`)) {
|
|
38215
|
+
localPackageRoot = import_node_path56.default.dirname(localPackageRoot);
|
|
38216
|
+
relative3 = import_node_path56.default.relative(localPackageRoot, manifest.dir);
|
|
38198
38217
|
}
|
|
38199
38218
|
}
|
|
38200
38219
|
for (const { manifest, remote } of packages.nativePackages) {
|
|
38201
|
-
const directory = remote ?
|
|
38220
|
+
const directory = remote ? import_node_path56.default.posix.join(
|
|
38202
38221
|
XCODE_PACKAGES_DIR,
|
|
38203
|
-
|
|
38204
|
-
) :
|
|
38222
|
+
import_node_path56.default.relative(remoteSwiftCheckouts(root), manifest.dir).split(import_node_path56.default.sep).join("/")
|
|
38223
|
+
) : import_node_path56.default.posix.join(
|
|
38205
38224
|
SWIFT_LOCAL_PACKAGES_DIR,
|
|
38206
|
-
|
|
38207
|
-
|
|
38225
|
+
import_node_path56.default.basename(localPackageRoot),
|
|
38226
|
+
import_node_path56.default.relative(localPackageRoot, manifest.dir).split(import_node_path56.default.sep).join("/")
|
|
38208
38227
|
);
|
|
38209
38228
|
packagePaths.set(manifest.dir, directory);
|
|
38210
|
-
const manifests =
|
|
38229
|
+
const manifests = import_node_fs56.default.readdirSync(manifest.dir).filter((name3) => /^Package(@swift-[\d.]+)?\.swift$/.test(name3)).map((name3) => import_node_path56.default.join(manifest.dir, name3));
|
|
38211
38230
|
for (const file of /* @__PURE__ */ new Set([
|
|
38212
38231
|
...manifests,
|
|
38213
38232
|
...[...manifest.targets.values()].flatMap((target) => [
|
|
@@ -38217,9 +38236,9 @@ async function buildXcodeLayout(root) {
|
|
|
38217
38236
|
])) {
|
|
38218
38237
|
packageFiles2.set(
|
|
38219
38238
|
file,
|
|
38220
|
-
|
|
38239
|
+
import_node_path56.default.posix.join(
|
|
38221
38240
|
directory,
|
|
38222
|
-
|
|
38241
|
+
import_node_path56.default.relative(manifest.dir, file).split(import_node_path56.default.sep).join("/")
|
|
38223
38242
|
)
|
|
38224
38243
|
);
|
|
38225
38244
|
files2.add(file);
|
|
@@ -38229,7 +38248,7 @@ async function buildXcodeLayout(root) {
|
|
|
38229
38248
|
for (const standin of standins)
|
|
38230
38249
|
targets.push({
|
|
38231
38250
|
name: standin.module,
|
|
38232
|
-
path:
|
|
38251
|
+
path: import_node_path56.default.posix.join(SWIFT_STANDINS_DIR, standin.module),
|
|
38233
38252
|
publicHeadersPath: standin.publicHeadersPath,
|
|
38234
38253
|
dependencies: [
|
|
38235
38254
|
.../* @__PURE__ */ new Set([
|
|
@@ -38257,13 +38276,13 @@ async function buildXcodeLayout(root) {
|
|
|
38257
38276
|
});
|
|
38258
38277
|
const packageConfiguration = app.configuration === "Debug" ? "debug" : "release";
|
|
38259
38278
|
for (const target of packages.targets) {
|
|
38260
|
-
const relative3 =
|
|
38279
|
+
const relative3 = import_node_path56.default.relative(
|
|
38261
38280
|
target.remote ? remoteSwiftCheckouts(root) : root,
|
|
38262
38281
|
target.dir
|
|
38263
38282
|
);
|
|
38264
|
-
if (relative3 === ".." || relative3.startsWith(`..${
|
|
38283
|
+
if (relative3 === ".." || relative3.startsWith(`..${import_node_path56.default.sep}`) || import_node_path56.default.isAbsolute(relative3))
|
|
38265
38284
|
throw new Error(`swift input escapes the selected package: ${target.dir}`);
|
|
38266
|
-
const posix = relative3.split(
|
|
38285
|
+
const posix = relative3.split(import_node_path56.default.sep).join(import_node_path56.default.posix.sep);
|
|
38267
38286
|
const packageMacros = [
|
|
38268
38287
|
"SWIFT_PACKAGE=1",
|
|
38269
38288
|
...packageConfiguration === "debug" ? ["DEBUG=1"] : []
|
|
@@ -38275,9 +38294,10 @@ async function buildXcodeLayout(root) {
|
|
|
38275
38294
|
...target,
|
|
38276
38295
|
cDefines: packageMacros,
|
|
38277
38296
|
cxxDefines: packageMacros,
|
|
38278
|
-
path: target.remote ?
|
|
38297
|
+
path: target.remote ? import_node_path56.default.posix.join(XCODE_PACKAGES_DIR, posix) : posix,
|
|
38279
38298
|
exclude: target.exclude ?? [],
|
|
38280
38299
|
defines: [
|
|
38300
|
+
"Xcode",
|
|
38281
38301
|
...packageConfiguration === "debug" ? ["DEBUG"] : [],
|
|
38282
38302
|
...target.packageDefines.filter(
|
|
38283
38303
|
(define) => define.configuration === null || define.configuration === packageConfiguration
|
|
@@ -38314,7 +38334,7 @@ async function buildXcodeLayout(root) {
|
|
|
38314
38334
|
return flags.length === 0 ? [] : flag === "-I" && directory !== void 0 && rest.length === 0 ? [
|
|
38315
38335
|
{
|
|
38316
38336
|
tool,
|
|
38317
|
-
headerSearchPath:
|
|
38337
|
+
headerSearchPath: import_node_path56.default.relative(target.dir, directory).split(import_node_path56.default.sep).join("/") || "."
|
|
38318
38338
|
}
|
|
38319
38339
|
] : [{ tool, flags }];
|
|
38320
38340
|
})
|
|
@@ -38322,16 +38342,16 @@ async function buildXcodeLayout(root) {
|
|
|
38322
38342
|
if (target.resources) {
|
|
38323
38343
|
resourceBundles.push({
|
|
38324
38344
|
target: target.name,
|
|
38325
|
-
sourcePath: target.remote ?
|
|
38345
|
+
sourcePath: target.remote ? import_node_path56.default.posix.join(XCODE_PACKAGES_DIR, posix) : posix,
|
|
38326
38346
|
path: `${swiftPackageManifest(target.packageDir).name}_${target.name}.bundle`
|
|
38327
38347
|
});
|
|
38328
38348
|
}
|
|
38329
|
-
if (!target.remote) files2.add(
|
|
38349
|
+
if (!target.remote) files2.add(import_node_path56.default.join(target.packageDir, "Package.swift"));
|
|
38330
38350
|
for (const file of target.files) files2.add(file);
|
|
38331
38351
|
const catalogs = [
|
|
38332
38352
|
...new Set(
|
|
38333
38353
|
target.files.flatMap((file) => {
|
|
38334
|
-
const at = file.indexOf(`.xcassets${
|
|
38354
|
+
const at = file.indexOf(`.xcassets${import_node_path56.default.sep}`);
|
|
38335
38355
|
return at >= 0 ? [file.slice(0, at + ".xcassets".length)] : [];
|
|
38336
38356
|
})
|
|
38337
38357
|
)
|
|
@@ -38341,14 +38361,14 @@ async function buildXcodeLayout(root) {
|
|
|
38341
38361
|
throw new Error(
|
|
38342
38362
|
`${target.name}: asset symbols for a package that declares no iOS platform are unproven`
|
|
38343
38363
|
);
|
|
38344
|
-
generatedSources[
|
|
38345
|
-
target.remote ?
|
|
38364
|
+
generatedSources[import_node_path56.default.posix.join(
|
|
38365
|
+
target.remote ? import_node_path56.default.posix.join(XCODE_PACKAGES_DIR, posix) : posix,
|
|
38346
38366
|
"GeneratedAssetSymbols.swift"
|
|
38347
38367
|
)] = generatePackageAssetSymbols(catalogs, target.packageDir, target.iosDeployment);
|
|
38348
38368
|
}
|
|
38349
38369
|
coreDataClasses(
|
|
38350
38370
|
target.files,
|
|
38351
|
-
target.remote ?
|
|
38371
|
+
target.remote ? import_node_path56.default.posix.join(XCODE_PACKAGES_DIR, posix) : posix
|
|
38352
38372
|
);
|
|
38353
38373
|
}
|
|
38354
38374
|
for (const target of targets) {
|
|
@@ -38360,7 +38380,7 @@ async function buildXcodeLayout(root) {
|
|
|
38360
38380
|
const relative2 = (file) => xcodeInputKey(
|
|
38361
38381
|
{ checkouts, targetDirs },
|
|
38362
38382
|
file,
|
|
38363
|
-
|
|
38383
|
+
import_node_path56.default.relative(app.rootDir, file).split(import_node_path56.default.sep).join("/").replaceAll(app.rootDir, SWIFT_NATIVE_INPUT_ROOT) || "."
|
|
38364
38384
|
);
|
|
38365
38385
|
const nativeInputs = await xcodeObjCInputsAsync(
|
|
38366
38386
|
app,
|
|
@@ -38382,7 +38402,7 @@ async function buildXcodeLayout(root) {
|
|
|
38382
38402
|
nativeFiles.set(
|
|
38383
38403
|
file,
|
|
38384
38404
|
Buffer.from(
|
|
38385
|
-
`#include ${JSON.stringify(
|
|
38405
|
+
`#include ${JSON.stringify(import_node_path56.default.relative(import_node_path56.default.dirname(file), real).split(import_node_path56.default.sep).join("/"))}
|
|
38386
38406
|
`
|
|
38387
38407
|
)
|
|
38388
38408
|
);
|
|
@@ -38392,7 +38412,7 @@ async function buildXcodeLayout(root) {
|
|
|
38392
38412
|
(file) => /\.(?:h|hh|hpp|hxx|pch|inc|inl|modulemap)$/.test(file)
|
|
38393
38413
|
);
|
|
38394
38414
|
const nativePath = (file, directory = app.rootDir) => {
|
|
38395
|
-
const requested =
|
|
38415
|
+
const requested = import_node_path56.default.resolve(directory, file);
|
|
38396
38416
|
const absolute = app.moduleMapSources?.[requested] ?? requested;
|
|
38397
38417
|
return absolute === "/usr/include" || absolute.startsWith("/usr/include/") ? SWIFT_NATIVE_SDK_INCLUDE + absolute.slice("/usr/include".length) : `${SWIFT_NATIVE_INPUT_ROOT}/${relative2(absolute)}`;
|
|
38398
38418
|
};
|
|
@@ -38449,7 +38469,7 @@ async function buildXcodeLayout(root) {
|
|
|
38449
38469
|
headerMaps: settings.headerMaps.map((map) => ({
|
|
38450
38470
|
flag: map.flag,
|
|
38451
38471
|
entries: map.entries.flatMap(
|
|
38452
|
-
([key2, file]) => !
|
|
38472
|
+
([key2, file]) => !import_node_path56.default.isAbsolute(file) ? [[key2, file]] : nativeFiles.has(file) ? [[key2, nativePath(file)]] : []
|
|
38453
38473
|
)
|
|
38454
38474
|
})),
|
|
38455
38475
|
productHeaders: Object.fromEntries(
|
|
@@ -38484,7 +38504,7 @@ async function buildXcodeLayout(root) {
|
|
|
38484
38504
|
]) : []
|
|
38485
38505
|
]),
|
|
38486
38506
|
sourceDirectories: Object.fromEntries(
|
|
38487
|
-
target.allSources.filter(isSwiftNativeTranslationUnit).map((file) => [relative2(file), relative2(
|
|
38507
|
+
target.allSources.filter(isSwiftNativeTranslationUnit).map((file) => [relative2(file), relative2(import_node_path56.default.dirname(file))])
|
|
38488
38508
|
)
|
|
38489
38509
|
}
|
|
38490
38510
|
];
|
|
@@ -38499,7 +38519,7 @@ async function buildXcodeLayout(root) {
|
|
|
38499
38519
|
deploymentTarget: settings.deploymentTarget,
|
|
38500
38520
|
headers: nativeHeaders.map(relative2),
|
|
38501
38521
|
publicHeaders: nativeHeaders.filter(
|
|
38502
|
-
(file) => file.startsWith(`${settings.publicHeaders}${
|
|
38522
|
+
(file) => file.startsWith(`${settings.publicHeaders}${import_node_path56.default.sep}`) && /\.(h|hh|hpp|hxx)$/.test(file)
|
|
38503
38523
|
).map(relative2),
|
|
38504
38524
|
flattensPublicHeaders: false,
|
|
38505
38525
|
bridgingHeader: null,
|
|
@@ -38518,7 +38538,7 @@ async function buildXcodeLayout(root) {
|
|
|
38518
38538
|
cxxFlags: nativeFlags(settings.cxxFlags, target.dir),
|
|
38519
38539
|
fileFlags: {},
|
|
38520
38540
|
sourceDirectories: Object.fromEntries(
|
|
38521
|
-
settings.files.map((file) => [relative2(file), relative2(
|
|
38541
|
+
settings.files.map((file) => [relative2(file), relative2(import_node_path56.default.dirname(file))])
|
|
38522
38542
|
)
|
|
38523
38543
|
});
|
|
38524
38544
|
}
|
|
@@ -38626,7 +38646,7 @@ function xcodeManifest(layout2) {
|
|
|
38626
38646
|
).join(", ");
|
|
38627
38647
|
const appProducts = layout2.app.linkedProducts.flatMap(({ product, source }) => {
|
|
38628
38648
|
const native = nativeProducts.find(
|
|
38629
|
-
({ name: name3, source: origin }) => name3 === product && (source.kind === "unnamed" || origin === (source.kind === "remote" ? source.url :
|
|
38649
|
+
({ name: name3, source: origin }) => name3 === product && (source.kind === "unnamed" || origin === (source.kind === "remote" ? source.url : import_node_path56.default.resolve(source.dir)))
|
|
38630
38650
|
);
|
|
38631
38651
|
return native ? [productDependency(native.name, native.packageDir)] : [];
|
|
38632
38652
|
});
|
|
@@ -38665,7 +38685,7 @@ function xcodeManifest(layout2) {
|
|
|
38665
38685
|
].join("\n");
|
|
38666
38686
|
}
|
|
38667
38687
|
function packageFiles(root, includeBuildInputs = true) {
|
|
38668
|
-
const canonicalRoot =
|
|
38688
|
+
const canonicalRoot = import_node_fs56.default.realpathSync(root);
|
|
38669
38689
|
const source = sourceEntries().get(canonicalRoot);
|
|
38670
38690
|
if (source) return [source];
|
|
38671
38691
|
const xcode = xcodeLayout(canonicalRoot);
|
|
@@ -38679,11 +38699,11 @@ function packageFiles(root, includeBuildInputs = true) {
|
|
|
38679
38699
|
function readPackageFile2(root, file, maxBytes) {
|
|
38680
38700
|
if (xcodeProjects().has(root)) {
|
|
38681
38701
|
const checkouts = remoteSwiftCheckouts(root);
|
|
38682
|
-
if (file.startsWith(`${checkouts}${
|
|
38683
|
-
const checkout =
|
|
38702
|
+
if (file.startsWith(`${checkouts}${import_node_path56.default.sep}`)) {
|
|
38703
|
+
const checkout = import_node_path56.default.relative(checkouts, file).split(import_node_path56.default.sep)[0];
|
|
38684
38704
|
if (!checkout || checkout === "..")
|
|
38685
38705
|
throw new Error(`swift input escapes the selected package: ${file}`);
|
|
38686
|
-
return readPackageFile(
|
|
38706
|
+
return readPackageFile(import_node_path56.default.join(checkouts, checkout), file, maxBytes);
|
|
38687
38707
|
}
|
|
38688
38708
|
}
|
|
38689
38709
|
return readPackageFile(root, file, maxBytes);
|
|
@@ -38696,12 +38716,12 @@ function sourceTreeFiles(dir, canonicalRoot) {
|
|
|
38696
38716
|
if (ancestors.has(realDirectory))
|
|
38697
38717
|
throw new Error(`swift input directory cycle: ${dir2}`);
|
|
38698
38718
|
ancestors.add(realDirectory);
|
|
38699
|
-
for (const entry of
|
|
38719
|
+
for (const entry of import_node_fs56.default.readdirSync(dir2, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
|
|
38700
38720
|
if (entry.name.startsWith(".") && entry.name !== NATIVE_DESCRIPTOR && entry.name !== NATIVE_GLUE || entry.name === "node_modules" || // platform project wrappers are excluded only at the package root;
|
|
38701
38721
|
// native target sources can contain upstream ios/android directories.
|
|
38702
38722
|
dir2 === canonicalRoot && SKIP_ROOT_DIRS.has(entry.name))
|
|
38703
38723
|
continue;
|
|
38704
|
-
const full =
|
|
38724
|
+
const full = import_node_path56.default.join(dir2, entry.name);
|
|
38705
38725
|
let real;
|
|
38706
38726
|
try {
|
|
38707
38727
|
real = packageInputPath(canonicalRoot, full);
|
|
@@ -38710,9 +38730,9 @@ function sourceTreeFiles(dir, canonicalRoot) {
|
|
|
38710
38730
|
continue;
|
|
38711
38731
|
throw error;
|
|
38712
38732
|
}
|
|
38713
|
-
const stat =
|
|
38733
|
+
const stat = import_node_fs56.default.statSync(real);
|
|
38714
38734
|
if (stat.isDirectory()) {
|
|
38715
|
-
if (
|
|
38735
|
+
if (import_node_fs56.default.existsSync(import_node_path56.default.join(full, "Package.swift"))) continue;
|
|
38716
38736
|
walk3(full);
|
|
38717
38737
|
} else if (stat.isFile()) {
|
|
38718
38738
|
found.push(full);
|
|
@@ -38720,7 +38740,7 @@ function sourceTreeFiles(dir, canonicalRoot) {
|
|
|
38720
38740
|
}
|
|
38721
38741
|
ancestors.delete(realDirectory);
|
|
38722
38742
|
};
|
|
38723
|
-
if (
|
|
38743
|
+
if (import_node_fs56.default.existsSync(dir)) walk3(packageInputPath(canonicalRoot, dir));
|
|
38724
38744
|
return found;
|
|
38725
38745
|
}
|
|
38726
38746
|
function isPackageSource(file) {
|
|
@@ -38733,7 +38753,7 @@ function xcodeFlatResources(app) {
|
|
|
38733
38753
|
if (!app) return /* @__PURE__ */ new Set();
|
|
38734
38754
|
return new Set(
|
|
38735
38755
|
app.resources.filter(
|
|
38736
|
-
(file) => !Object.hasOwn(app.resourceNames, file) && !file.split(
|
|
38756
|
+
(file) => !Object.hasOwn(app.resourceNames, file) && !file.split(import_node_path56.default.sep).some((segment) => segment.endsWith(".xcassets"))
|
|
38737
38757
|
)
|
|
38738
38758
|
);
|
|
38739
38759
|
}
|
|
@@ -38743,7 +38763,7 @@ function bundleResourcePath(flatResources, disk, file) {
|
|
|
38743
38763
|
function resourceCandidateFiles(root) {
|
|
38744
38764
|
return packageFiles(root, false).filter(
|
|
38745
38765
|
(file) => !isPackageSource(file) && !file.endsWith(".xcconfig") && !["project.pbxproj", "project.xcproj", "Package.resolved"].includes(
|
|
38746
|
-
|
|
38766
|
+
import_node_path56.default.basename(file)
|
|
38747
38767
|
)
|
|
38748
38768
|
);
|
|
38749
38769
|
}
|
|
@@ -38781,7 +38801,7 @@ function buildSwiftResourceTable(project, baseUrl, inputs) {
|
|
|
38781
38801
|
const limits = inputLimits(Boolean(project.hosted));
|
|
38782
38802
|
const absolute = resourceCandidateFiles(project.packagePath);
|
|
38783
38803
|
const relative2 = absolute.map(
|
|
38784
|
-
(file) =>
|
|
38804
|
+
(file) => import_node_path56.default.relative(project.packagePath, file).split(import_node_path56.default.sep).join(import_node_path56.default.posix.sep)
|
|
38785
38805
|
);
|
|
38786
38806
|
const byRelative = new Map(absolute.map((file, index) => [relative2[index], file]));
|
|
38787
38807
|
const readContents2 = (candidate) => {
|
|
@@ -38860,7 +38880,7 @@ function buildSwiftResourceTable(project, baseUrl, inputs) {
|
|
|
38860
38880
|
const source = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(
|
|
38861
38881
|
bytes
|
|
38862
38882
|
);
|
|
38863
|
-
const sha2564 = (0,
|
|
38883
|
+
const sha2564 = (0, import_node_crypto31.createHash)("sha256").update(bytes).digest("hex");
|
|
38864
38884
|
const bundle = swiftResourceBundleForFile(bundles, key2);
|
|
38865
38885
|
if (!bundle && inputs["Package.swift"])
|
|
38866
38886
|
throw new Error(`metal source ${key2} has no resource target bundle`);
|
|
@@ -38881,37 +38901,37 @@ function buildSwiftResourceTable(project, baseUrl, inputs) {
|
|
|
38881
38901
|
throw new Error("swift image pack exceeds the compile service caps");
|
|
38882
38902
|
}
|
|
38883
38903
|
let bytes;
|
|
38884
|
-
let ext =
|
|
38885
|
-
let uploadName =
|
|
38904
|
+
let ext = import_node_path56.default.posix.extname(file).toLowerCase();
|
|
38905
|
+
let uploadName = import_node_path56.default.posix.basename(file);
|
|
38886
38906
|
let variantScale = scale;
|
|
38887
38907
|
if (ext === ".pdf") {
|
|
38888
38908
|
const pdfBytes = readPackageFile2(project.packagePath, disk, limits.imageBytes);
|
|
38889
|
-
const pdfHash = (0,
|
|
38909
|
+
const pdfHash = (0, import_node_crypto31.createHash)("sha256").update(pdfBytes).digest("hex");
|
|
38890
38910
|
const raster = rasterizePdfFile(disk, pdfHash);
|
|
38891
38911
|
bytes = raster.bytes;
|
|
38892
38912
|
if (bytes.length > limits.imageBytes) {
|
|
38893
38913
|
throw new Error(`swift image ${file} raster exceeds the per-image cap`);
|
|
38894
38914
|
}
|
|
38895
38915
|
ext = ".png";
|
|
38896
|
-
uploadName = `${
|
|
38916
|
+
uploadName = `${import_node_path56.default.posix.basename(file, import_node_path56.default.posix.extname(file))}.png`;
|
|
38897
38917
|
} else {
|
|
38898
|
-
if (imageBytes +
|
|
38918
|
+
if (imageBytes + import_node_fs56.default.statSync(disk).size > limits.imageTotalBytes) {
|
|
38899
38919
|
throw new Error("swift image pack exceeds the compile service caps");
|
|
38900
38920
|
}
|
|
38901
38921
|
bytes = readPackageFile2(project.packagePath, disk, limits.imageBytes);
|
|
38902
|
-
const svg = ext === ".svg" ? rasterizeSvgFile(disk, (0,
|
|
38922
|
+
const svg = ext === ".svg" ? rasterizeSvgFile(disk, (0, import_node_crypto31.createHash)("sha256").update(bytes).digest("hex")) : null;
|
|
38903
38923
|
if (svg) {
|
|
38904
38924
|
bytes = svg.bytes;
|
|
38905
38925
|
variantScale = 3;
|
|
38906
38926
|
ext = ".png";
|
|
38907
|
-
uploadName = `${
|
|
38927
|
+
uploadName = `${import_node_path56.default.posix.basename(file, import_node_path56.default.posix.extname(file))}.png`;
|
|
38908
38928
|
}
|
|
38909
38929
|
}
|
|
38910
38930
|
if (imageBytes + bytes.length > limits.imageTotalBytes) {
|
|
38911
38931
|
throw new Error("swift image pack exceeds the compile service caps");
|
|
38912
38932
|
}
|
|
38913
38933
|
imageBytes += bytes.length;
|
|
38914
|
-
const hash = (0,
|
|
38934
|
+
const hash = (0, import_node_crypto31.createHash)("sha256").update(bytes).digest("hex").slice(0, 16);
|
|
38915
38935
|
const bundle = table[bundlePath] ?? /* @__PURE__ */ Object.create(null);
|
|
38916
38936
|
const variants = bundle[name3] ??= [];
|
|
38917
38937
|
variants.push({
|
|
@@ -38957,10 +38977,10 @@ function declaredAppFonts(infoPlist) {
|
|
|
38957
38977
|
return Array.isArray(declared) ? declared.filter((name3) => typeof name3 === "string") : [];
|
|
38958
38978
|
}
|
|
38959
38979
|
function buildSwiftBundleFiles(packagePath, hosted, inputs, resourceBundles) {
|
|
38960
|
-
packagePath =
|
|
38980
|
+
packagePath = import_node_fs56.default.realpathSync(packagePath);
|
|
38961
38981
|
const limits = inputLimits(hosted);
|
|
38962
38982
|
const relative2 = resourceCandidateFiles(packagePath).map(
|
|
38963
|
-
(file) =>
|
|
38983
|
+
(file) => import_node_path56.default.relative(packagePath, file).split(import_node_path56.default.sep).join(import_node_path56.default.posix.sep)
|
|
38964
38984
|
);
|
|
38965
38985
|
const files2 = {};
|
|
38966
38986
|
const watched = [];
|
|
@@ -38984,26 +39004,26 @@ function buildSwiftBundleFiles(packagePath, hosted, inputs, resourceBundles) {
|
|
|
38984
39004
|
addFile("Info.plist", bytes);
|
|
38985
39005
|
if (xcode.app.infoPlistFile)
|
|
38986
39006
|
watched.push(
|
|
38987
|
-
|
|
39007
|
+
import_node_path56.default.relative(packagePath, xcode.app.infoPlistFile).split(import_node_path56.default.sep).join("/")
|
|
38988
39008
|
);
|
|
38989
39009
|
const resourcesByName = new Map(
|
|
38990
|
-
xcode.app.resources.map((file) => [
|
|
39010
|
+
xcode.app.resources.map((file) => [import_node_path56.default.basename(file), file])
|
|
38991
39011
|
);
|
|
38992
39012
|
for (const declared of declaredAppFonts(xcode.app.infoPlist)) {
|
|
38993
|
-
const file = resourcesByName.get(
|
|
39013
|
+
const file = resourcesByName.get(import_node_path56.default.basename(declared));
|
|
38994
39014
|
if (!file) continue;
|
|
38995
|
-
const relative3 =
|
|
38996
|
-
if (relative3.startsWith("..") ||
|
|
38997
|
-
const key2 =
|
|
39015
|
+
const relative3 = import_node_path56.default.relative(packagePath, file);
|
|
39016
|
+
if (relative3.startsWith("..") || import_node_path56.default.isAbsolute(relative3)) continue;
|
|
39017
|
+
const key2 = import_node_path56.default.basename(declared);
|
|
38998
39018
|
if (Object.hasOwn(files2, key2)) continue;
|
|
38999
39019
|
addFile(key2, readPackageFile2(packagePath, file, limits.resourceBytes));
|
|
39000
|
-
watched.push(relative3.split(
|
|
39020
|
+
watched.push(relative3.split(import_node_path56.default.sep).join("/"));
|
|
39001
39021
|
}
|
|
39002
39022
|
}
|
|
39003
39023
|
const groups = /* @__PURE__ */ new Map();
|
|
39004
39024
|
const flatResources = xcodeFlatResources(xcode?.app);
|
|
39005
39025
|
for (const file of relative2) {
|
|
39006
|
-
const disk =
|
|
39026
|
+
const disk = import_node_path56.default.join(packagePath, ...file.split("/"));
|
|
39007
39027
|
const folderName = xcode?.app.resourceNames[disk];
|
|
39008
39028
|
if (folderName) {
|
|
39009
39029
|
watched.push(file);
|
|
@@ -39027,10 +39047,10 @@ function buildSwiftBundleFiles(packagePath, hosted, inputs, resourceBundles) {
|
|
|
39027
39047
|
for (const product of xcode?.app.resourceProducts ?? []) {
|
|
39028
39048
|
if ("sourceRoot" in product) {
|
|
39029
39049
|
for (const file of product.resources) {
|
|
39030
|
-
const relative3 =
|
|
39031
|
-
watched.push(
|
|
39050
|
+
const relative3 = import_node_path56.default.relative(product.sourceRoot, file);
|
|
39051
|
+
watched.push(import_node_path56.default.relative(packagePath, file).split(import_node_path56.default.sep).join("/"));
|
|
39032
39052
|
addFile(
|
|
39033
|
-
`${product.path}/${relative3.split(
|
|
39053
|
+
`${product.path}/${relative3.split(import_node_path56.default.sep).join("/")}`,
|
|
39034
39054
|
readPackageFile2(packagePath, file, limits.resourceBytes)
|
|
39035
39055
|
);
|
|
39036
39056
|
}
|
|
@@ -39042,7 +39062,7 @@ function buildSwiftBundleFiles(packagePath, hosted, inputs, resourceBundles) {
|
|
|
39042
39062
|
group.set(
|
|
39043
39063
|
// pod resources may live outside the preview package. the shared
|
|
39044
39064
|
// enumerator flattens ordinary files and preserves localized folders.
|
|
39045
|
-
`Resources/${
|
|
39065
|
+
`Resources/${import_node_path56.default.relative(import_node_path56.default.parse(file).root, file).split(import_node_path56.default.sep).join("/")}`,
|
|
39046
39066
|
file
|
|
39047
39067
|
);
|
|
39048
39068
|
groups.set(product.path, group);
|
|
@@ -39051,8 +39071,8 @@ function buildSwiftBundleFiles(packagePath, hosted, inputs, resourceBundles) {
|
|
|
39051
39071
|
const prefix = bundlePath === "." ? "" : `${bundlePath}/`;
|
|
39052
39072
|
const models = [...members2].filter(([key2]) => bundlePath !== "." || key2.split("/").includes("Resources")).map(([, disk]) => disk);
|
|
39053
39073
|
for (const model of coreDataModelDirectories(models)) {
|
|
39054
|
-
for (const disk of models.filter((file) => file.startsWith(`${model}${
|
|
39055
|
-
watched.push(
|
|
39074
|
+
for (const disk of models.filter((file) => file.startsWith(`${model}${import_node_path56.default.sep}`)))
|
|
39075
|
+
watched.push(import_node_path56.default.relative(packagePath, disk).split(import_node_path56.default.sep).join("/"));
|
|
39056
39076
|
for (const [name3, bytes] of Object.entries(compileCoreDataModel(model)))
|
|
39057
39077
|
addFile(`${prefix}${name3}`, bytes);
|
|
39058
39078
|
}
|
|
@@ -39061,7 +39081,7 @@ function buildSwiftBundleFiles(packagePath, hosted, inputs, resourceBundles) {
|
|
|
39061
39081
|
bundlePath.endsWith(".bundle")
|
|
39062
39082
|
)) {
|
|
39063
39083
|
const disk = members2.get(file);
|
|
39064
|
-
watched.push(
|
|
39084
|
+
watched.push(import_node_path56.default.relative(packagePath, disk).split(import_node_path56.default.sep).join("/"));
|
|
39065
39085
|
const bytes = readPackageFile2(packagePath, disk, limits.resourceBytes);
|
|
39066
39086
|
addFile(`${prefix}${base}`, bytes);
|
|
39067
39087
|
if (base.endsWith(".xcstrings")) {
|
|
@@ -39074,14 +39094,14 @@ function buildSwiftBundleFiles(packagePath, hosted, inputs, resourceBundles) {
|
|
|
39074
39094
|
}
|
|
39075
39095
|
}
|
|
39076
39096
|
if (xcode?.app.postBundleScripts.length) {
|
|
39077
|
-
const dir =
|
|
39078
|
-
const wrapper =
|
|
39079
|
-
const bundle =
|
|
39097
|
+
const dir = import_node_fs56.default.mkdtempSync(import_node_path56.default.join(import_node_os15.default.tmpdir(), "peach-xcode-bundle-"));
|
|
39098
|
+
const wrapper = import_node_path56.default.basename(xcode.app.settings("UNLOCALIZED_RESOURCES_FOLDER_PATH")) || `${xcode.app.name}.app`;
|
|
39099
|
+
const bundle = import_node_path56.default.join(dir, wrapper);
|
|
39080
39100
|
try {
|
|
39081
39101
|
for (const [name3, encoded] of Object.entries(files2)) {
|
|
39082
|
-
const destination =
|
|
39083
|
-
|
|
39084
|
-
|
|
39102
|
+
const destination = import_node_path56.default.join(bundle, name3);
|
|
39103
|
+
import_node_fs56.default.mkdirSync(import_node_path56.default.dirname(destination), { recursive: true });
|
|
39104
|
+
import_node_fs56.default.writeFileSync(destination, Buffer.from(encoded, "base64"));
|
|
39085
39105
|
}
|
|
39086
39106
|
for (const phase of xcode.app.postBundleScripts) {
|
|
39087
39107
|
const env = {
|
|
@@ -39100,16 +39120,16 @@ function buildSwiftBundleFiles(packagePath, hosted, inputs, resourceBundles) {
|
|
|
39100
39120
|
SCRIPT_OUTPUT_FILE_LIST_COUNT: "0"
|
|
39101
39121
|
};
|
|
39102
39122
|
const inputPath = (raw2) => {
|
|
39103
|
-
const file =
|
|
39123
|
+
const file = import_node_path56.default.resolve(
|
|
39104
39124
|
phase.directory,
|
|
39105
39125
|
expand(raw2, (key2) => env[key2] ?? "")
|
|
39106
39126
|
);
|
|
39107
|
-
if (!
|
|
39127
|
+
if (!import_node_fs56.default.existsSync(file))
|
|
39108
39128
|
throw new Error(
|
|
39109
39129
|
`${xcode.app.name}: Run Script "${phase.name}" missing input ${file}`
|
|
39110
39130
|
);
|
|
39111
|
-
if (!file.startsWith(`${dir}${
|
|
39112
|
-
watched.push(
|
|
39131
|
+
if (!file.startsWith(`${dir}${import_node_path56.default.sep}`))
|
|
39132
|
+
watched.push(import_node_path56.default.relative(packagePath, file).split(import_node_path56.default.sep).join("/"));
|
|
39113
39133
|
return file;
|
|
39114
39134
|
};
|
|
39115
39135
|
phase.inputPaths.forEach((raw2, index) => {
|
|
@@ -39118,14 +39138,14 @@ function buildSwiftBundleFiles(packagePath, hosted, inputs, resourceBundles) {
|
|
|
39118
39138
|
phase.inputFileListPaths.forEach((raw2, index) => {
|
|
39119
39139
|
const source = inputPath(raw2);
|
|
39120
39140
|
const entries = fileListEntries(source, inputPath);
|
|
39121
|
-
const expanded =
|
|
39122
|
-
|
|
39141
|
+
const expanded = import_node_path56.default.join(dir, `Input-${index}.xcfilelist`);
|
|
39142
|
+
import_node_fs56.default.writeFileSync(expanded, `${entries.join("\n")}
|
|
39123
39143
|
`);
|
|
39124
39144
|
env[`SCRIPT_INPUT_FILE_LIST_${index}`] = expanded;
|
|
39125
39145
|
});
|
|
39126
39146
|
try {
|
|
39127
39147
|
const [shell, ...args] = phase.command;
|
|
39128
|
-
(0,
|
|
39148
|
+
(0, import_node_child_process36.execFileSync)(shell, args, {
|
|
39129
39149
|
cwd: phase.directory,
|
|
39130
39150
|
env,
|
|
39131
39151
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -39140,21 +39160,21 @@ function buildSwiftBundleFiles(packagePath, hosted, inputs, resourceBundles) {
|
|
|
39140
39160
|
}
|
|
39141
39161
|
for (const key2 of Object.keys(files2)) delete files2[key2];
|
|
39142
39162
|
total = 0;
|
|
39143
|
-
for (const entry of
|
|
39163
|
+
for (const entry of import_node_fs56.default.readdirSync(bundle, {
|
|
39144
39164
|
recursive: true,
|
|
39145
39165
|
withFileTypes: true
|
|
39146
39166
|
})) {
|
|
39147
39167
|
if (!entry.isFile()) continue;
|
|
39148
|
-
const file =
|
|
39149
|
-
const name3 =
|
|
39150
|
-
if (
|
|
39168
|
+
const file = import_node_path56.default.join(entry.parentPath, entry.name);
|
|
39169
|
+
const name3 = import_node_path56.default.relative(bundle, file).split(import_node_path56.default.sep).join("/");
|
|
39170
|
+
if (import_node_fs56.default.statSync(file).size > limits.resourceBytes)
|
|
39151
39171
|
throw new Error(
|
|
39152
39172
|
`swift bundle resource ${name3} exceeds ${limits.resourceBytes} bytes`
|
|
39153
39173
|
);
|
|
39154
|
-
addFile(name3,
|
|
39174
|
+
addFile(name3, import_node_fs56.default.readFileSync(file));
|
|
39155
39175
|
}
|
|
39156
39176
|
} finally {
|
|
39157
|
-
|
|
39177
|
+
import_node_fs56.default.rmSync(dir, { recursive: true, force: true });
|
|
39158
39178
|
}
|
|
39159
39179
|
}
|
|
39160
39180
|
return { files: files2, bundles, watched };
|
|
@@ -39164,12 +39184,12 @@ function serveSwiftResource(project, key2) {
|
|
|
39164
39184
|
}
|
|
39165
39185
|
function linkedModuleRoots(packagePath) {
|
|
39166
39186
|
if (privateSwiftDistributionRoot()) return [];
|
|
39167
|
-
packagePath =
|
|
39187
|
+
packagePath = import_node_fs56.default.realpathSync(packagePath);
|
|
39168
39188
|
let manifest;
|
|
39169
39189
|
try {
|
|
39170
39190
|
manifest = readPackageFile2(
|
|
39171
39191
|
packagePath,
|
|
39172
|
-
|
|
39192
|
+
import_node_path56.default.join(packagePath, "Package.swift"),
|
|
39173
39193
|
MAX_SWIFT_COMPILE_SOURCE_BYTES
|
|
39174
39194
|
).toString("utf8");
|
|
39175
39195
|
} catch {
|
|
@@ -39178,13 +39198,13 @@ function linkedModuleRoots(packagePath) {
|
|
|
39178
39198
|
const roots = /* @__PURE__ */ new Set();
|
|
39179
39199
|
const dependency = /\.package\(\s*path:\s*"([^"]+)"\s*\)/g;
|
|
39180
39200
|
for (const match of manifest.replace(/^\s*\/\/.*$/gm, "").matchAll(dependency)) {
|
|
39181
|
-
const root =
|
|
39182
|
-
if (
|
|
39201
|
+
const root = import_node_path56.default.resolve(packagePath, match[1]);
|
|
39202
|
+
if (import_node_fs56.default.existsSync(import_node_path56.default.join(root, "Package.swift"))) roots.add(root);
|
|
39183
39203
|
}
|
|
39184
39204
|
return [...roots].sort();
|
|
39185
39205
|
}
|
|
39186
39206
|
function sourceStamp(packagePath, moduleRootOverride, hosted = false) {
|
|
39187
|
-
const hash = (0,
|
|
39207
|
+
const hash = (0, import_node_crypto31.createHash)("sha256");
|
|
39188
39208
|
hash.update(packagePath);
|
|
39189
39209
|
hash.update(JSON.stringify(xcodeProjects().get(packagePath)?.behavior ?? {}));
|
|
39190
39210
|
const libraries = projects().get(packagePath)?.libraries;
|
|
@@ -39200,8 +39220,8 @@ function sourceStamp(packagePath, moduleRootOverride, hosted = false) {
|
|
|
39200
39220
|
hash.update(JSON.stringify(projects().get(packagePath)?.bundleFiles ?? null));
|
|
39201
39221
|
const projectInputs = new Set(packageFiles(packagePath));
|
|
39202
39222
|
for (const file of [...projectInputs].sort()) {
|
|
39203
|
-
hash.update(
|
|
39204
|
-
const stat =
|
|
39223
|
+
hash.update(import_node_path56.default.relative(packagePath, file));
|
|
39224
|
+
const stat = import_node_fs56.default.statSync(file);
|
|
39205
39225
|
hash.update(`${stat.mtimeMs}/${stat.ctimeMs}/${stat.size}`);
|
|
39206
39226
|
}
|
|
39207
39227
|
hash.update(moduleStamp(packagePath, moduleRootOverride, hosted));
|
|
@@ -39209,24 +39229,24 @@ function sourceStamp(packagePath, moduleRootOverride, hosted = false) {
|
|
|
39209
39229
|
}
|
|
39210
39230
|
function moduleStamp(packagePath, moduleRootOverride, hosted) {
|
|
39211
39231
|
const moduleRoot = hosted ? void 0 : moduleRootOverride ?? linkedModuleRoots(packagePath).find(
|
|
39212
|
-
(root) =>
|
|
39232
|
+
(root) => import_node_fs56.default.existsSync(import_node_path56.default.join(root, "toolchain.json"))
|
|
39213
39233
|
);
|
|
39214
39234
|
if (!moduleRoot) return "";
|
|
39215
|
-
const hash = (0,
|
|
39235
|
+
const hash = (0, import_node_crypto31.createHash)("sha256");
|
|
39216
39236
|
hash.update(moduleRoot);
|
|
39217
39237
|
for (const relative2 of swiftModuleInputFiles(moduleRoot)) {
|
|
39218
39238
|
hash.update(relative2);
|
|
39219
|
-
hash.update(String(
|
|
39239
|
+
hash.update(String(import_node_fs56.default.statSync(import_node_path56.default.join(moduleRoot, relative2)).mtimeMs));
|
|
39220
39240
|
}
|
|
39221
39241
|
return hash.digest("hex");
|
|
39222
39242
|
}
|
|
39223
39243
|
function otherInputs(input) {
|
|
39224
39244
|
const { files: _files, ...rest } = input;
|
|
39225
|
-
return (0,
|
|
39245
|
+
return (0, import_node_crypto31.createHash)("sha256").update(JSON.stringify(rest)).digest("hex");
|
|
39226
39246
|
}
|
|
39227
39247
|
function entryRootId(packagePath, file) {
|
|
39228
|
-
const relative2 =
|
|
39229
|
-
return `${
|
|
39248
|
+
const relative2 = import_node_path56.default.relative(packagePath, file).split(import_node_path56.default.sep).join(import_node_path56.default.posix.sep);
|
|
39249
|
+
return `${import_node_path56.default.basename(packagePath)}${import_node_path56.default.posix.sep}${relative2}`;
|
|
39230
39250
|
}
|
|
39231
39251
|
function icuUrl(origin, artifact) {
|
|
39232
39252
|
return "url" in artifact.icu ? artifact.icu.url : `${origin}${ICU_PATH}${swiftIcuAddress(artifact.icu)}`;
|
|
@@ -39236,11 +39256,11 @@ function standinLibraries(binaries, standins, rootDir, toolchain) {
|
|
|
39236
39256
|
for (const standin of standins) {
|
|
39237
39257
|
if (!standin.prebuilt) continue;
|
|
39238
39258
|
const bytes = Buffer.from(standin.prebuilt.library, "base64");
|
|
39239
|
-
const digest = (0,
|
|
39240
|
-
const dir =
|
|
39241
|
-
|
|
39242
|
-
const library =
|
|
39243
|
-
if (!
|
|
39259
|
+
const digest = (0, import_node_crypto31.createHash)("sha256").update(bytes).digest("hex");
|
|
39260
|
+
const dir = import_node_path56.default.join(swiftCacheDir(), "native-archives", digest);
|
|
39261
|
+
import_node_fs56.default.mkdirSync(dir, { recursive: true });
|
|
39262
|
+
const library = import_node_path56.default.join(dir, `lib${standin.module}.a`);
|
|
39263
|
+
if (!import_node_fs56.default.existsSync(library)) import_node_fs56.default.writeFileSync(library, bytes);
|
|
39244
39264
|
linked.set(library, [standin]);
|
|
39245
39265
|
}
|
|
39246
39266
|
for (const binary of binaries) {
|
|
@@ -39258,13 +39278,13 @@ function packageSources(packagePath, hosted = false, linked = /* @__PURE__ */ ne
|
|
|
39258
39278
|
const xcode = xcodeLayout(packagePath);
|
|
39259
39279
|
const manifests = new Set(
|
|
39260
39280
|
xcode?.packages.targets.map(
|
|
39261
|
-
(target) =>
|
|
39281
|
+
(target) => import_node_path56.default.join(target.packageDir, "Package.swift")
|
|
39262
39282
|
)
|
|
39263
39283
|
);
|
|
39264
39284
|
const files2 = {};
|
|
39265
39285
|
const limits = inputLimits(hosted);
|
|
39266
39286
|
for (const file of sourceFiles(packagePath)) {
|
|
39267
|
-
const relative2 =
|
|
39287
|
+
const relative2 = import_node_path56.default.relative(packagePath, file).split(import_node_path56.default.sep).join(import_node_path56.default.posix.sep);
|
|
39268
39288
|
if (manifests.has(file) || xcode?.packageFiles.has(file)) continue;
|
|
39269
39289
|
files2[xcode ? xcodeInputKey(xcode, file, relative2) : relative2] = (xcode?.nativeFiles.get(file) ?? readPackageFile2(packagePath, file, limits.sourceBytes)).toString("utf8");
|
|
39270
39290
|
}
|
|
@@ -39273,23 +39293,23 @@ function packageSources(packagePath, hosted = false, linked = /* @__PURE__ */ ne
|
|
|
39273
39293
|
files2[xcodeInputKey(
|
|
39274
39294
|
xcode,
|
|
39275
39295
|
file,
|
|
39276
|
-
|
|
39296
|
+
import_node_path56.default.relative(packagePath, file).split(import_node_path56.default.sep).join("/")
|
|
39277
39297
|
)] = contents.toString("utf8");
|
|
39278
39298
|
files2["Package.swift"] = xcodeManifest(xcode);
|
|
39279
39299
|
Object.assign(files2, xcode.generatedSources);
|
|
39280
39300
|
for (const standin of xcode.standins)
|
|
39281
39301
|
for (const [file, text5] of Object.entries(standin.files))
|
|
39282
|
-
files2[
|
|
39302
|
+
files2[import_node_path56.default.posix.join(SWIFT_STANDINS_DIR, standin.module, file)] = linked.has(standin) && (file === `${standin.module}.c` || file === `${standin.module}.cpp`) ? `// ${standin.target}'s WebAssembly library defines ${standin.module}'s functions.
|
|
39283
39303
|
` : text5;
|
|
39284
39304
|
}
|
|
39285
39305
|
return files2;
|
|
39286
39306
|
}
|
|
39287
39307
|
function packageSnapshot(project, entry, moduleRoot) {
|
|
39288
39308
|
moduleRoot ??= xcodeProjects().get(project.packagePath)?.moduleRoot ?? linkedModuleRoots(project.packagePath).find(
|
|
39289
|
-
(root) =>
|
|
39309
|
+
(root) => import_node_fs56.default.existsSync(import_node_path56.default.join(root, "toolchain.json"))
|
|
39290
39310
|
);
|
|
39291
39311
|
const layout2 = xcodeLayout(project.packagePath);
|
|
39292
|
-
const pin2 = moduleRoot ? swiftDistributionAt(moduleRoot) ?? JSON.parse(
|
|
39312
|
+
const pin2 = moduleRoot ? swiftDistributionAt(moduleRoot) ?? JSON.parse(import_node_fs56.default.readFileSync(import_node_path56.default.join(moduleRoot, "toolchain.json"), "utf8")) : null;
|
|
39293
39313
|
const linked = layout2 ? standinLibraries(
|
|
39294
39314
|
layout2.binaries,
|
|
39295
39315
|
layout2.standins,
|
|
@@ -39311,10 +39331,10 @@ function packageSnapshot(project, entry, moduleRoot) {
|
|
|
39311
39331
|
};
|
|
39312
39332
|
const packageReals = /* @__PURE__ */ new Map();
|
|
39313
39333
|
for (const [file, relative2] of layout2?.packageFiles ?? [])
|
|
39314
|
-
if (!
|
|
39315
|
-
packageReals.set(
|
|
39334
|
+
if (!import_node_fs56.default.lstatSync(file).isSymbolicLink())
|
|
39335
|
+
packageReals.set(import_node_fs56.default.realpathSync(file), relative2);
|
|
39316
39336
|
for (const [file, relative2] of layout2?.packageFiles ?? []) {
|
|
39317
|
-
const real =
|
|
39337
|
+
const real = import_node_fs56.default.realpathSync(file);
|
|
39318
39338
|
const target = packageReals.get(real);
|
|
39319
39339
|
if (target !== void 0 && target !== relative2 && /\.(?:h|hh|hpp|hxx)$/.test(file))
|
|
39320
39340
|
headerAliases[relative2] = target;
|
|
@@ -39329,12 +39349,12 @@ function packageSnapshot(project, entry, moduleRoot) {
|
|
|
39329
39349
|
if (layout2 && !project.hosted) {
|
|
39330
39350
|
for (const file of layout2.files) {
|
|
39331
39351
|
if (!layout2.targetDirs.has(file) || packaged.has(file)) continue;
|
|
39332
|
-
const relative2 =
|
|
39352
|
+
const relative2 = import_node_path56.default.relative(project.packagePath, file).split(import_node_path56.default.sep).join("/");
|
|
39333
39353
|
if (swiftProjectFileProblem(relative2) !== void 0) continue;
|
|
39334
39354
|
const key2 = xcodeInputKey(layout2, file, relative2);
|
|
39335
39355
|
if (files2[key2] !== void 0) continue;
|
|
39336
|
-
const absolute =
|
|
39337
|
-
if (!
|
|
39356
|
+
const absolute = import_node_fs56.default.realpathSync(file);
|
|
39357
|
+
if (!import_node_fs56.default.statSync(absolute).isFile()) continue;
|
|
39338
39358
|
projectFiles[relative2] = readPackageFile2(
|
|
39339
39359
|
project.packagePath,
|
|
39340
39360
|
absolute,
|
|
@@ -39365,7 +39385,7 @@ function packageSnapshot(project, entry, moduleRoot) {
|
|
|
39365
39385
|
(layout2?.packages.nativePackages ?? []).flatMap(
|
|
39366
39386
|
({ manifest, guestTargets: targets }) => targets.filter((target) => target.type === "regular").flatMap(
|
|
39367
39387
|
(target) => swiftTargetFiles(manifest, target).filter((file) => file.endsWith(".swift")).flatMap(
|
|
39368
|
-
(file) => swiftImportNames(
|
|
39388
|
+
(file) => swiftImportNames(import_node_fs56.default.readFileSync(file, "utf8"))
|
|
39369
39389
|
)
|
|
39370
39390
|
)
|
|
39371
39391
|
)
|
|
@@ -39377,10 +39397,10 @@ function packageSnapshot(project, entry, moduleRoot) {
|
|
|
39377
39397
|
sourceLinkGraph: layout2.sourceLinkGraph,
|
|
39378
39398
|
defaultLocalization: layout2.app.developmentRegion
|
|
39379
39399
|
} : {},
|
|
39380
|
-
entry: layout2 ? xcodeInputKey(layout2,
|
|
39400
|
+
entry: layout2 ? xcodeInputKey(layout2, import_node_path56.default.resolve(project.packagePath, entry), entry) : entry,
|
|
39381
39401
|
resourcePaths: swiftImplicitResourcePaths(
|
|
39382
39402
|
resourceCandidateFiles(project.packagePath).map((file) => {
|
|
39383
|
-
const relative2 =
|
|
39403
|
+
const relative2 = import_node_path56.default.relative(project.packagePath, file).split(import_node_path56.default.sep).join(import_node_path56.default.posix.sep);
|
|
39384
39404
|
return layout2 ? xcodeInputKey(layout2, file, relative2) : relative2;
|
|
39385
39405
|
})
|
|
39386
39406
|
),
|
|
@@ -39400,7 +39420,7 @@ function packageSnapshot(project, entry, moduleRoot) {
|
|
|
39400
39420
|
...Object.fromEntries(
|
|
39401
39421
|
[...linked].map(([library, [first]]) => [
|
|
39402
39422
|
first.module,
|
|
39403
|
-
|
|
39423
|
+
import_node_fs56.default.readFileSync(library).toString("base64")
|
|
39404
39424
|
])
|
|
39405
39425
|
)
|
|
39406
39426
|
}
|
|
@@ -39408,7 +39428,7 @@ function packageSnapshot(project, entry, moduleRoot) {
|
|
|
39408
39428
|
...native ? {
|
|
39409
39429
|
glue: readPackageFile2(
|
|
39410
39430
|
project.packagePath,
|
|
39411
|
-
|
|
39431
|
+
import_node_path56.default.join(project.packagePath, NATIVE_GLUE),
|
|
39412
39432
|
inputLimits(Boolean(project.hosted)).sourceBytes
|
|
39413
39433
|
).toString("utf8")
|
|
39414
39434
|
} : {}
|
|
@@ -39449,17 +39469,17 @@ function compileInput(packagePath, entry) {
|
|
|
39449
39469
|
}
|
|
39450
39470
|
function swiftBuildRoot(packagePath, moduleRoot) {
|
|
39451
39471
|
if (process.env.CONTRAST_SWIFT_BUILD_ROOT) return process.env.CONTRAST_SWIFT_BUILD_ROOT;
|
|
39452
|
-
const resolvedPath =
|
|
39453
|
-
const parts = resolvedPath.split(
|
|
39472
|
+
const resolvedPath = import_node_path56.default.resolve(packagePath);
|
|
39473
|
+
const parts = resolvedPath.split(import_node_path56.default.sep);
|
|
39454
39474
|
const scopedAt = Math.max(
|
|
39455
39475
|
parts.lastIndexOf("peach-expo-swift"),
|
|
39456
39476
|
parts.lastIndexOf("peach-nitro-swift")
|
|
39457
39477
|
);
|
|
39458
|
-
const buildKeyPath = scopedAt >= 0 && parts.length >= scopedAt + 3 ? parts.slice(0, scopedAt + 2).join(
|
|
39459
|
-
return
|
|
39478
|
+
const buildKeyPath = scopedAt >= 0 && parts.length >= scopedAt + 3 ? parts.slice(0, scopedAt + 2).join(import_node_path56.default.sep) : sourceEntries().get(resolvedPath) ?? resolvedPath;
|
|
39479
|
+
return import_node_path56.default.join(
|
|
39460
39480
|
swiftCacheDir(),
|
|
39461
39481
|
"swift-builds",
|
|
39462
|
-
(0,
|
|
39482
|
+
(0, import_node_crypto31.createHash)("sha256").update(`${moduleRoot}\0${buildKeyPath}`).digest("hex").slice(0, 16)
|
|
39463
39483
|
);
|
|
39464
39484
|
}
|
|
39465
39485
|
async function compile(packagePath, stamp, moduleRootOverride, hosted, snapshot, signal) {
|
|
@@ -39482,7 +39502,7 @@ async function compile(packagePath, stamp, moduleRootOverride, hosted, snapshot,
|
|
|
39482
39502
|
package: content
|
|
39483
39503
|
};
|
|
39484
39504
|
const moduleRoot = moduleRootOverride ?? linkedModuleRoots(packagePath).find(
|
|
39485
|
-
(root) =>
|
|
39505
|
+
(root) => import_node_fs56.default.existsSync(import_node_path56.default.join(root, "toolchain.json"))
|
|
39486
39506
|
) ?? await swiftDistributionRoot(signal);
|
|
39487
39507
|
const toolchain = swiftModuleToolchain(moduleRoot);
|
|
39488
39508
|
const input = snapshotCompileInput(snapshot);
|
|
@@ -39646,10 +39666,10 @@ async function missingModulesMessage(packagePath, missing) {
|
|
|
39646
39666
|
`Peach does not provide ${missing.size} module${missing.size === 1 ? "" : "s"} this app imports:`,
|
|
39647
39667
|
...[...missing].map(([name3, files2]) => {
|
|
39648
39668
|
const gap = gaps.get(name3);
|
|
39649
|
-
return ` ${name3.padEnd(width)} ${files2.length} file${files2.length === 1 ? "" : "s"}${gap ? `, ${gap.source.includes("://") ? `package ${gap.source}` : gap.source.startsWith("/") ? `package ${
|
|
39669
|
+
return ` ${name3.padEnd(width)} ${files2.length} file${files2.length === 1 ? "" : "s"}${gap ? `, ${gap.source.includes("://") ? `package ${gap.source}` : gap.source.startsWith("/") ? `package ${import_node_path56.default.relative(packagePath, gap.source) || "."}` : gap.source} (${gap.reason})` : ""}`;
|
|
39650
39670
|
}),
|
|
39651
39671
|
...workspace ? [
|
|
39652
|
-
`${
|
|
39672
|
+
`${import_node_path56.default.basename(opened)} is part of ${import_node_path56.default.relative(process.cwd(), workspace)}, which holds its local packages and Package.resolved pins; pass the workspace to build what Xcode builds there.`
|
|
39653
39673
|
] : []
|
|
39654
39674
|
].join("\n");
|
|
39655
39675
|
}
|
|
@@ -39671,7 +39691,7 @@ async function compileRemote(packagePath, snapshot, hosted, ownerSignal) {
|
|
|
39671
39691
|
const bytes = sources.reduce((total2, text5) => total2 + Buffer.byteLength(text5), 0) + packageSources2.reduce((total2, encoded) => total2 + swiftPackageInputBytes(encoded), 0);
|
|
39672
39692
|
if (count > MAX_SWIFT_COMPILE_FILES || bytes > MAX_SWIFT_COMPILE_SOURCE_BYTES) {
|
|
39673
39693
|
throw new Error(
|
|
39674
|
-
`${
|
|
39694
|
+
`${import_node_path56.default.basename(packagePath)} has ${count} input files (${bytes} bytes; packages: ${swiftPackageInputNames(snapshot.packageFiles).join(", ") || "none"}), 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`
|
|
39675
39695
|
);
|
|
39676
39696
|
}
|
|
39677
39697
|
const descriptor = snapshot.native;
|
|
@@ -39697,11 +39717,11 @@ async function compileRemote(packagePath, snapshot, hosted, ownerSignal) {
|
|
|
39697
39717
|
},
|
|
39698
39718
|
origin,
|
|
39699
39719
|
signal,
|
|
39700
|
-
(stage) => console.error(`Peach: compiling ${
|
|
39720
|
+
(stage) => console.error(`Peach: compiling ${import_node_path56.default.basename(packagePath)}: ${stage}`)
|
|
39701
39721
|
);
|
|
39702
39722
|
if (descriptor && address.native?.hash !== descriptor.hash) {
|
|
39703
39723
|
throw new Error(
|
|
39704
|
-
`${
|
|
39724
|
+
`${import_node_path56.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`
|
|
39705
39725
|
);
|
|
39706
39726
|
}
|
|
39707
39727
|
const response = await fetch(address.url, { signal });
|
|
@@ -39804,16 +39824,16 @@ function scopedArtifact(project, entry, moduleRoot, signal) {
|
|
|
39804
39824
|
return fresh;
|
|
39805
39825
|
}
|
|
39806
39826
|
async function swiftPackageWatchFiles(packagePath, moduleRoot) {
|
|
39807
|
-
packagePath =
|
|
39827
|
+
packagePath = import_node_fs56.default.realpathSync(packagePath);
|
|
39808
39828
|
return withXcodeLayout(packagePath, () => [
|
|
39809
|
-
...xcodeProjects().has(packagePath) || sourceEntries().has(packagePath) ? [] : [
|
|
39829
|
+
...xcodeProjects().has(packagePath) || sourceEntries().has(packagePath) ? [] : [import_node_path56.default.join(packagePath, "Package.swift")],
|
|
39810
39830
|
...packageFiles(packagePath),
|
|
39811
39831
|
...nativeSourceFiles(packagePath),
|
|
39812
|
-
...moduleRoot ? swiftModuleInputFiles(moduleRoot).map((file) =>
|
|
39832
|
+
...moduleRoot ? swiftModuleInputFiles(moduleRoot).map((file) => import_node_path56.default.join(moduleRoot, file)) : []
|
|
39813
39833
|
]);
|
|
39814
39834
|
}
|
|
39815
39835
|
async function swiftPackageMetadata(packagePath, packageName, moduleRoot, origin, hosted, signal) {
|
|
39816
|
-
packagePath =
|
|
39836
|
+
packagePath = import_node_fs56.default.realpathSync(packagePath);
|
|
39817
39837
|
const project = projectFor(packagePath, hosted, signal);
|
|
39818
39838
|
const limits = inputLimits(Boolean(project.hosted));
|
|
39819
39839
|
const registered = xcodeProjects().get(packagePath);
|
|
@@ -39869,7 +39889,7 @@ async function swiftPackageMetadata(packagePath, packageName, moduleRoot, origin
|
|
|
39869
39889
|
`swift package ${packageName} needs exactly one application entry source or generated native modules; found ${mains.length}`
|
|
39870
39890
|
);
|
|
39871
39891
|
}
|
|
39872
|
-
const entry = mains.length === 1 ?
|
|
39892
|
+
const entry = mains.length === 1 ? import_node_path56.default.relative(packagePath, mains[0]).split(import_node_path56.default.sep).join(import_node_path56.default.posix.sep) : Object.entries(native?.files ?? {}).find(
|
|
39873
39893
|
([_file, names]) => names.length > 0
|
|
39874
39894
|
)?.[0];
|
|
39875
39895
|
if (!entry) throw new Error(`swift package ${packageName} has no native module source`);
|
|
@@ -39976,7 +39996,7 @@ async function serveSwiftPackageAsset(pathname, res) {
|
|
|
39976
39996
|
return true;
|
|
39977
39997
|
}
|
|
39978
39998
|
function disposeSwiftProject(packagePath, signal) {
|
|
39979
|
-
packagePath =
|
|
39999
|
+
packagePath = import_node_fs56.default.realpathSync(packagePath);
|
|
39980
40000
|
const project = projects().get(packagePath);
|
|
39981
40001
|
if (signal && project && project.signal !== signal) return;
|
|
39982
40002
|
projects().delete(packagePath);
|
|
@@ -40016,17 +40036,17 @@ function swiftViteLifetime(server) {
|
|
|
40016
40036
|
}
|
|
40017
40037
|
|
|
40018
40038
|
// src/one-widget-package.ts
|
|
40019
|
-
var
|
|
40020
|
-
var
|
|
40021
|
-
var
|
|
40022
|
-
var
|
|
40039
|
+
var import_node_crypto33 = require("node:crypto");
|
|
40040
|
+
var import_node_fs58 = __toESM(require("node:fs"), 1);
|
|
40041
|
+
var import_node_os16 = __toESM(require("node:os"), 1);
|
|
40042
|
+
var import_node_path58 = __toESM(require("node:path"), 1);
|
|
40023
40043
|
|
|
40024
40044
|
// src/one-widget-metadata.ts
|
|
40025
|
-
var
|
|
40026
|
-
var
|
|
40027
|
-
var
|
|
40045
|
+
var import_node_child_process37 = require("node:child_process");
|
|
40046
|
+
var import_node_crypto32 = require("node:crypto");
|
|
40047
|
+
var import_node_fs57 = __toESM(require("node:fs"), 1);
|
|
40028
40048
|
var import_node_module = require("node:module");
|
|
40029
|
-
var
|
|
40049
|
+
var import_node_path57 = __toESM(require("node:path"), 1);
|
|
40030
40050
|
var import_node_util8 = require("node:util");
|
|
40031
40051
|
|
|
40032
40052
|
// src/backend-origin.ts
|
|
@@ -40044,7 +40064,7 @@ function isHomeWidgetFamily(value) {
|
|
|
40044
40064
|
}
|
|
40045
40065
|
|
|
40046
40066
|
// src/one-widget-metadata.ts
|
|
40047
|
-
var run4 = (0, import_node_util8.promisify)(
|
|
40067
|
+
var run4 = (0, import_node_util8.promisify)(import_node_child_process37.execFile);
|
|
40048
40068
|
var ONE_WIDGET_PACKAGE = "OneWidgets";
|
|
40049
40069
|
var configs = /* @__PURE__ */ new Map();
|
|
40050
40070
|
var reads = /* @__PURE__ */ new Map();
|
|
@@ -40065,8 +40085,8 @@ fs.writeFileSync(process.argv[2], JSON.stringify({
|
|
|
40065
40085
|
function configStamp(files2) {
|
|
40066
40086
|
return JSON.stringify(
|
|
40067
40087
|
files2.map((file) => {
|
|
40068
|
-
if (!
|
|
40069
|
-
const stat =
|
|
40088
|
+
if (!import_node_fs57.default.existsSync(file)) return [file, null];
|
|
40089
|
+
const stat = import_node_fs57.default.statSync(file);
|
|
40070
40090
|
return [file, stat.mtimeMs, stat.ctimeMs, stat.size];
|
|
40071
40091
|
})
|
|
40072
40092
|
);
|
|
@@ -40077,13 +40097,13 @@ async function readConfig(root) {
|
|
|
40077
40097
|
const reading = reads.get(root);
|
|
40078
40098
|
if (reading) return reading;
|
|
40079
40099
|
const promise = (async () => {
|
|
40080
|
-
(0, import_node_module.createRequire)(
|
|
40081
|
-
const cache =
|
|
40082
|
-
|
|
40083
|
-
const directory =
|
|
40084
|
-
const script =
|
|
40085
|
-
const result =
|
|
40086
|
-
|
|
40100
|
+
(0, import_node_module.createRequire)(import_node_path57.default.join(root, "package.json")).resolve("one/vite");
|
|
40101
|
+
const cache = import_node_path57.default.join(root, "node_modules/.cache/peach-widget-config");
|
|
40102
|
+
import_node_fs57.default.mkdirSync(cache, { recursive: true });
|
|
40103
|
+
const directory = import_node_fs57.default.mkdtempSync(import_node_path57.default.join(cache, "read-"));
|
|
40104
|
+
const script = import_node_path57.default.join(directory, "read.mjs");
|
|
40105
|
+
const result = import_node_path57.default.join(directory, "result.json");
|
|
40106
|
+
import_node_fs57.default.writeFileSync(script, CONFIG_CHILD);
|
|
40087
40107
|
try {
|
|
40088
40108
|
await run4(process.execPath, [script, result], {
|
|
40089
40109
|
cwd: root,
|
|
@@ -40091,7 +40111,7 @@ async function readConfig(root) {
|
|
|
40091
40111
|
timeout: 3e4,
|
|
40092
40112
|
maxBuffer: 1024 * 1024
|
|
40093
40113
|
});
|
|
40094
|
-
const value = JSON.parse(
|
|
40114
|
+
const value = JSON.parse(import_node_fs57.default.readFileSync(result, "utf8"));
|
|
40095
40115
|
if (!isRecord(value) || !Array.isArray(value.watched) || !value.watched.every((file) => typeof file === "string"))
|
|
40096
40116
|
throw new Error("One config loader returned invalid dependencies");
|
|
40097
40117
|
if (!Array.isArray(value.urlSchemes) || !value.urlSchemes.every(
|
|
@@ -40114,8 +40134,8 @@ async function readConfig(root) {
|
|
|
40114
40134
|
}
|
|
40115
40135
|
const watched = [
|
|
40116
40136
|
.../* @__PURE__ */ new Set([
|
|
40117
|
-
|
|
40118
|
-
...value.watched.map((file) =>
|
|
40137
|
+
import_node_path57.default.join(root, "package.json"),
|
|
40138
|
+
...value.watched.map((file) => import_node_path57.default.resolve(root, file))
|
|
40119
40139
|
])
|
|
40120
40140
|
];
|
|
40121
40141
|
const loaded2 = {
|
|
@@ -40127,7 +40147,7 @@ async function readConfig(root) {
|
|
|
40127
40147
|
configs.set(root, loaded2);
|
|
40128
40148
|
return loaded2;
|
|
40129
40149
|
} finally {
|
|
40130
|
-
|
|
40150
|
+
import_node_fs57.default.rmSync(directory, { recursive: true, force: true });
|
|
40131
40151
|
}
|
|
40132
40152
|
})();
|
|
40133
40153
|
reads.set(root, promise);
|
|
@@ -40148,13 +40168,13 @@ function declaredFamilies(source) {
|
|
|
40148
40168
|
return home;
|
|
40149
40169
|
}
|
|
40150
40170
|
async function readOneWidgetSources(appRoot) {
|
|
40151
|
-
const root =
|
|
40171
|
+
const root = import_node_fs57.default.realpathSync(appRoot);
|
|
40152
40172
|
const config = await readConfig(root);
|
|
40153
40173
|
if (!config.widget) return null;
|
|
40154
40174
|
const widget = config.widget;
|
|
40155
40175
|
const sourceFiles2 = {
|
|
40156
|
-
"OneWidget.swift":
|
|
40157
|
-
"OneWidgetContract.swift":
|
|
40176
|
+
"OneWidget.swift": import_node_path57.default.join(root, "ios/OneWidgets/OneWidget.swift"),
|
|
40177
|
+
"OneWidgetContract.swift": import_node_path57.default.join(
|
|
40158
40178
|
root,
|
|
40159
40179
|
"ios",
|
|
40160
40180
|
widget.appName,
|
|
@@ -40164,14 +40184,14 @@ async function readOneWidgetSources(appRoot) {
|
|
|
40164
40184
|
const files2 = /* @__PURE__ */ new Map();
|
|
40165
40185
|
const sources = {};
|
|
40166
40186
|
for (const [name3, file] of Object.entries(sourceFiles2)) {
|
|
40167
|
-
if (!
|
|
40187
|
+
if (!import_node_fs57.default.existsSync(file))
|
|
40168
40188
|
throw new Error(`missing One widget prebuild source ${file}; run one prebuild`);
|
|
40169
40189
|
const bytes = readPackageFile(root, file, MAX_SWIFT_COMPILE_SOURCE_BYTES);
|
|
40170
40190
|
const text5 = bytes.toString("utf8");
|
|
40171
40191
|
if (!Buffer.from(text5).equals(bytes))
|
|
40172
40192
|
throw new Error(`One widget prebuild source is not UTF-8: ${file}`);
|
|
40173
40193
|
files2.set(name3, text5);
|
|
40174
|
-
sources[
|
|
40194
|
+
sources[import_node_path57.default.relative(root, file).split(import_node_path57.default.sep).join("/")] = (0, import_node_crypto32.createHash)("sha256").update(bytes).digest("hex");
|
|
40175
40195
|
}
|
|
40176
40196
|
const contract = files2.get("OneWidgetContract.swift") ?? "";
|
|
40177
40197
|
const source = files2.get("OneWidget.swift") ?? "";
|
|
@@ -40208,16 +40228,16 @@ async function oneWidgetPackage(appRoot) {
|
|
|
40208
40228
|
""
|
|
40209
40229
|
].join("\n")
|
|
40210
40230
|
);
|
|
40211
|
-
const packagePath =
|
|
40212
|
-
|
|
40231
|
+
const packagePath = import_node_path58.default.join(
|
|
40232
|
+
import_node_os16.default.tmpdir(),
|
|
40213
40233
|
"peach-one-widgets",
|
|
40214
|
-
(0,
|
|
40234
|
+
(0, import_node_crypto33.createHash)("sha256").update(root).digest("hex"),
|
|
40215
40235
|
ONE_WIDGET_PACKAGE
|
|
40216
40236
|
);
|
|
40217
|
-
|
|
40237
|
+
import_node_fs58.default.mkdirSync(packagePath, { recursive: true });
|
|
40218
40238
|
syncSwiftTree(
|
|
40219
40239
|
packagePath,
|
|
40220
|
-
new Map([...files2].map(([file, text5]) => [
|
|
40240
|
+
new Map([...files2].map(([file, text5]) => [import_node_path58.default.join(packagePath, file), text5]))
|
|
40221
40241
|
);
|
|
40222
40242
|
return {
|
|
40223
40243
|
packagePath,
|
|
@@ -40240,12 +40260,12 @@ function artifactUrl(project, artifact) {
|
|
|
40240
40260
|
return `${serverOrigin()}${ARTIFACT_PATH2}${artifact.hash}.wasm`;
|
|
40241
40261
|
}
|
|
40242
40262
|
function packageFor(file) {
|
|
40243
|
-
let dir =
|
|
40263
|
+
let dir = import_node_path59.default.dirname(file);
|
|
40244
40264
|
const stop = devServer?.config.root;
|
|
40245
40265
|
for (; ; ) {
|
|
40246
|
-
if (
|
|
40247
|
-
if (stop !== void 0 && dir === stop ||
|
|
40248
|
-
dir =
|
|
40266
|
+
if (import_node_fs59.default.existsSync(import_node_path59.default.join(dir, "Package.swift"))) return dir;
|
|
40267
|
+
if (stop !== void 0 && dir === stop || import_node_path59.default.dirname(dir) === dir) break;
|
|
40268
|
+
dir = import_node_path59.default.dirname(dir);
|
|
40249
40269
|
}
|
|
40250
40270
|
throw new Error(
|
|
40251
40271
|
`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`
|
|
@@ -40267,9 +40287,9 @@ function swiftPlugin(options = {}) {
|
|
|
40267
40287
|
if (!resolved) throw new Error(`cannot resolve swift source ${source}`);
|
|
40268
40288
|
let id = resolved.id;
|
|
40269
40289
|
if (importer && (source.startsWith("./") || source.startsWith("../"))) {
|
|
40270
|
-
const raw2 =
|
|
40290
|
+
const raw2 = import_node_path59.default.resolve(import_node_path59.default.dirname(importer.split("?")[0] ?? importer), source);
|
|
40271
40291
|
try {
|
|
40272
|
-
if (
|
|
40292
|
+
if (import_node_fs59.default.realpathSync(raw2) === import_node_fs59.default.realpathSync(resolved.id)) id = raw2;
|
|
40273
40293
|
} catch {
|
|
40274
40294
|
}
|
|
40275
40295
|
}
|
|
@@ -40280,23 +40300,23 @@ function swiftPlugin(options = {}) {
|
|
|
40280
40300
|
const owner = lifetime;
|
|
40281
40301
|
owner?.signal.throwIfAborted();
|
|
40282
40302
|
const file = id.slice(VIRTUAL_PREFIX.length);
|
|
40283
|
-
if (!
|
|
40303
|
+
if (!import_node_fs59.default.existsSync(file)) throw new Error(`swift source ${file} no longer exists`);
|
|
40284
40304
|
const packagePath = options.packagePath ?? packageFor(file);
|
|
40285
40305
|
const project = projectFor(packagePath, void 0, owner?.signal);
|
|
40286
40306
|
owner?.projects.add(project.packagePath);
|
|
40287
|
-
const entry =
|
|
40307
|
+
const entry = import_node_path59.default.relative(packagePath, file).split(import_node_path59.default.sep).join(import_node_path59.default.posix.sep);
|
|
40288
40308
|
for (const source of [
|
|
40289
40309
|
...sourceFiles(packagePath),
|
|
40290
40310
|
...nativeSourceFiles(packagePath)
|
|
40291
40311
|
])
|
|
40292
40312
|
this.addWatchFile(source);
|
|
40293
|
-
this.addWatchFile(
|
|
40313
|
+
this.addWatchFile(import_node_path59.default.join(packagePath, "Package.swift"));
|
|
40294
40314
|
const moduleRoot = linkedModuleRoots(packagePath).find(
|
|
40295
|
-
(root) =>
|
|
40315
|
+
(root) => import_node_fs59.default.existsSync(import_node_path59.default.join(root, "toolchain.json"))
|
|
40296
40316
|
);
|
|
40297
40317
|
if (moduleRoot)
|
|
40298
40318
|
for (const relative2 of swiftModuleInputFiles(moduleRoot))
|
|
40299
|
-
this.addWatchFile(
|
|
40319
|
+
this.addWatchFile(import_node_path59.default.join(moduleRoot, relative2));
|
|
40300
40320
|
let artifact;
|
|
40301
40321
|
try {
|
|
40302
40322
|
const pending = artifactFor(project, entry);
|
|
@@ -40321,7 +40341,7 @@ function swiftPlugin(options = {}) {
|
|
|
40321
40341
|
...artifact.package.resources.watched,
|
|
40322
40342
|
...artifact.package.bundleFiles.watched
|
|
40323
40343
|
])
|
|
40324
|
-
this.addWatchFile(
|
|
40344
|
+
this.addWatchFile(import_node_path59.default.join(packagePath, ...watched.split(import_node_path59.default.posix.sep)));
|
|
40325
40345
|
const colors = artifact.package.resources.colors;
|
|
40326
40346
|
const symbols = artifact.package.resources.symbols;
|
|
40327
40347
|
const bundleFiles = artifact.package.bundleFiles.files;
|