peachsim 0.1.2405 → 0.1.2408
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/agent-note.ts +231 -0
- package/cli/cli-update.ts +2 -2
- package/cli/cloud-dispatch.ts +1 -1
- package/cli/commands/agent.ts +29 -26
- package/cli/commands/stream.ts +11 -7
- package/cli/main.ts +16 -2
- package/cli/outbound-endpoints.ts +16 -1
- package/dist-lib/agent-daemon-client.cjs +23 -3
- 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 +201 -60
- 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 +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +200 -59
- 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 +356 -100
- package/dist-lib/host/fetch-proxy-handler.cjs +4 -4
- 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 +4 -4
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +4 -4
- package/dist-lib/native-app-identity-project.cjs +3 -3
- package/dist-lib/native-app-identity-project.mjs +3 -3
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/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 +24 -24
- package/dist-lib/public-origins-lib.json +56 -55
- 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 +367 -106
- package/dist-lib/swift-compile.cjs +195 -54
- package/dist-lib/swift-compile.mjs +195 -54
- 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 +198 -57
- package/dist-lib/vite.cjs +4 -4
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/install.sh +1 -1
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/skills/peach-setup/SKILL.md +8 -3
- package/src/agent-daemon-client.ts +35 -2
- package/src/agent-prompt.ts +68 -0
- package/src/canvas-agent-note-delivery.ts +83 -0
- package/src/host/agent-host.ts +128 -18
- package/src/swift-compile.ts +124 -66
- package/src/swift-host.ts +2 -1
- package/src/swift-objc-import.ts +99 -0
- package/src/xcode-header-search.ts +33 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2408 | (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;
|
|
@@ -12079,6 +12079,78 @@ function swiftClangImporterFlags(flags) {
|
|
|
12079
12079
|
(flag) => flag !== "-fobjc-arc" && flag !== "-fno-objc-arc" && !/^-std=(?:c(?!\+\+)|gnu(?!\+\+)|iso9899:)/.test(flag)
|
|
12080
12080
|
);
|
|
12081
12081
|
}
|
|
12082
|
+
var CLANG_PATH_OPTIONS = /* @__PURE__ */ new Set([
|
|
12083
|
+
"-I",
|
|
12084
|
+
"-F",
|
|
12085
|
+
"-idirafter",
|
|
12086
|
+
"-iframework",
|
|
12087
|
+
"-iframeworkwithsysroot",
|
|
12088
|
+
"-imacros",
|
|
12089
|
+
"-include",
|
|
12090
|
+
"-iprefix",
|
|
12091
|
+
"-iquote",
|
|
12092
|
+
"-isystem",
|
|
12093
|
+
"-isysroot",
|
|
12094
|
+
"-ivfsoverlay",
|
|
12095
|
+
"-iwithprefix",
|
|
12096
|
+
"-iwithprefixbefore",
|
|
12097
|
+
"--sysroot"
|
|
12098
|
+
]);
|
|
12099
|
+
function compactSwiftClangDefines(flags) {
|
|
12100
|
+
const definitions = /* @__PURE__ */ new Map();
|
|
12101
|
+
const macros = [];
|
|
12102
|
+
for (let index = 0; index < flags.length; index++) {
|
|
12103
|
+
if (flags[index].startsWith("@")) return flags;
|
|
12104
|
+
if (flags[index] !== "-Xcc") continue;
|
|
12105
|
+
const flag = flags[++index];
|
|
12106
|
+
if (flag === void 0 || flags[index - 2] === "-Xfrontend" || flag === "-Xclang" || flag === "-Xpreprocessor" || flag.startsWith("-Wp,") || flag.startsWith("--config") || flag.startsWith("@"))
|
|
12107
|
+
return flags;
|
|
12108
|
+
if (CLANG_PATH_OPTIONS.has(flag) && flags[index + 1] === "-Xcc") {
|
|
12109
|
+
index += 2;
|
|
12110
|
+
continue;
|
|
12111
|
+
}
|
|
12112
|
+
if (!flag.startsWith("-D") && !flag.startsWith("-U")) continue;
|
|
12113
|
+
const name2 = /^-[DU]([A-Za-z_$][\w$]*)(?=[(=]|$)/.exec(flag)?.[1];
|
|
12114
|
+
if (!name2) return flags;
|
|
12115
|
+
const previous = definitions.get(name2);
|
|
12116
|
+
definitions.set(name2, previous === void 0 || previous === flag ? flag : null);
|
|
12117
|
+
macros.push({ index, name: name2, flag });
|
|
12118
|
+
}
|
|
12119
|
+
const seen = /* @__PURE__ */ new Set();
|
|
12120
|
+
const duplicates = /* @__PURE__ */ new Set();
|
|
12121
|
+
for (const { index, name: name2, flag } of macros) {
|
|
12122
|
+
if (definitions.get(name2) !== flag) continue;
|
|
12123
|
+
if (seen.has(name2)) {
|
|
12124
|
+
duplicates.add(index - 1);
|
|
12125
|
+
duplicates.add(index);
|
|
12126
|
+
}
|
|
12127
|
+
seen.add(name2);
|
|
12128
|
+
}
|
|
12129
|
+
return duplicates.size === 0 ? flags : flags.filter((_, index) => !duplicates.has(index));
|
|
12130
|
+
}
|
|
12131
|
+
function compactSwiftClangOverlays(flags, generated) {
|
|
12132
|
+
if (generated.size === 0) return flags;
|
|
12133
|
+
const overlays = /* @__PURE__ */ new Map();
|
|
12134
|
+
const duplicates = /* @__PURE__ */ new Set();
|
|
12135
|
+
for (let index = 0; index < flags.length; index++) {
|
|
12136
|
+
const flag = flags[index];
|
|
12137
|
+
if (flag.startsWith("@")) return flags;
|
|
12138
|
+
if (flag === "-Xcc" && flags[index - 1] === "-Xfrontend") return flags;
|
|
12139
|
+
if (flags[index - 1] === "-Xcc" && (flag.startsWith("--config") || flag === "-Xclang"))
|
|
12140
|
+
return flags;
|
|
12141
|
+
if (!flag.startsWith("-ivfsoverlay") && !flag.startsWith("-vfsoverlay")) continue;
|
|
12142
|
+
if (flag !== "-ivfsoverlay" || flags[index - 1] !== "-Xcc" || flags[index + 1] !== "-Xcc")
|
|
12143
|
+
return flags;
|
|
12144
|
+
const file = flags[index + 2];
|
|
12145
|
+
if (file === void 0 || !generated.has(file)) return flags;
|
|
12146
|
+
const previous = overlays.get(file);
|
|
12147
|
+
if (previous !== void 0)
|
|
12148
|
+
for (let offset = -1; offset < 3; offset++) duplicates.add(previous + offset);
|
|
12149
|
+
overlays.set(file, index);
|
|
12150
|
+
index += 2;
|
|
12151
|
+
}
|
|
12152
|
+
return duplicates.size === 0 ? flags : flags.filter((_, index) => !duplicates.has(index));
|
|
12153
|
+
}
|
|
12082
12154
|
var SWIFT_SUBMODULE_IMPORT = /^[ \t]*(?:@\w+(?:\([^)]*\))?[ \t]+)*import[ \t]+([A-Za-z_]\w*)\.([A-Za-z_]\w*)[ \t]*(?:\/\/.*)?$/gm;
|
|
12083
12155
|
function swiftSubmoduleImports(sources) {
|
|
12084
12156
|
const imports = /* @__PURE__ */ new Map();
|
|
@@ -12598,6 +12670,30 @@ function isSwiftResourceBundles(value) {
|
|
|
12598
12670
|
// src/xcode-header-search.ts
|
|
12599
12671
|
var import_node_fs24 = __toESM(require("node:fs"), 1);
|
|
12600
12672
|
var import_node_path25 = __toESM(require("node:path"), 1);
|
|
12673
|
+
function coalescibleHeaderOverlays(files) {
|
|
12674
|
+
const aliases = /* @__PURE__ */ new Map();
|
|
12675
|
+
const key = (file) => file.replace(/[A-Z]/g, (letter) => letter.toLowerCase());
|
|
12676
|
+
const index = (directory, entry) => {
|
|
12677
|
+
const name2 = import_node_path25.default.resolve(directory, entry.name);
|
|
12678
|
+
if (entry.type === "directory")
|
|
12679
|
+
return entry.contents.every((child) => index(name2, child));
|
|
12680
|
+
const source = entry["external-contents"];
|
|
12681
|
+
const previous = aliases.get(key(name2));
|
|
12682
|
+
if (previous !== void 0 && previous !== source) return false;
|
|
12683
|
+
aliases.set(key(name2), source);
|
|
12684
|
+
return true;
|
|
12685
|
+
};
|
|
12686
|
+
for (const file of files) {
|
|
12687
|
+
const overlay = JSON.parse(import_node_fs24.default.readFileSync(file, "utf8"));
|
|
12688
|
+
if (!overlay.roots.every((entry) => index(import_node_path25.default.dirname(file), entry)))
|
|
12689
|
+
return /* @__PURE__ */ new Set();
|
|
12690
|
+
}
|
|
12691
|
+
for (const file of [...files, ...aliases.values()]) {
|
|
12692
|
+
const source = aliases.get(key(import_node_path25.default.normalize(file)));
|
|
12693
|
+
if (source !== void 0 && source !== file) return /* @__PURE__ */ new Set();
|
|
12694
|
+
}
|
|
12695
|
+
return files;
|
|
12696
|
+
}
|
|
12601
12697
|
function headerMap(entries) {
|
|
12602
12698
|
const unique = /* @__PURE__ */ new Map();
|
|
12603
12699
|
for (const entry of entries)
|
|
@@ -13670,6 +13766,15 @@ function swiftTargetDependencies(files, targets, frameworks = OPTIONAL_FRAMEWORK
|
|
|
13670
13766
|
)
|
|
13671
13767
|
);
|
|
13672
13768
|
const names = /* @__PURE__ */ new Set([...frameworks, ...targets.map((target) => target.name)]);
|
|
13769
|
+
const entriesByPrefix = new Map(
|
|
13770
|
+
targets.map(({ path: path25 }) => [path25 === "." ? "" : `${path25}/`, []])
|
|
13771
|
+
);
|
|
13772
|
+
for (const entry of Object.entries(files)) {
|
|
13773
|
+
const [file] = entry;
|
|
13774
|
+
entriesByPrefix.get("")?.push(entry);
|
|
13775
|
+
for (let end = file.indexOf("/"); end !== -1; end = file.indexOf("/", end + 1))
|
|
13776
|
+
entriesByPrefix.get(file.slice(0, end + 1))?.push(entry);
|
|
13777
|
+
}
|
|
13673
13778
|
const siblings = /* @__PURE__ */ new Map();
|
|
13674
13779
|
for (const target of targets) {
|
|
13675
13780
|
const prefix = target.path === "." ? "" : `${target.path}/`;
|
|
@@ -13683,8 +13788,11 @@ function swiftTargetDependencies(files, targets, frameworks = OPTIONAL_FRAMEWORK
|
|
|
13683
13788
|
(dependency) => dependency.kind === "target" && dependency.name !== target.name && names.has(dependency.name) || dependency.kind === "product" && dependency.package === "sootsim-swift" && OPTIONAL_FRAMEWORKS.has(dependency.name) ? [dependency.name] : []
|
|
13684
13789
|
)
|
|
13685
13790
|
);
|
|
13686
|
-
|
|
13687
|
-
|
|
13791
|
+
const nested = target.sources === void 0 ? targets.flatMap(
|
|
13792
|
+
(candidate) => candidate.name !== target.name && candidate.path !== "." && candidate.path.startsWith(prefix) ? [`${candidate.path}/`] : []
|
|
13793
|
+
) : [];
|
|
13794
|
+
for (const [file, contents2] of entriesByPrefix.get(prefix) ?? []) {
|
|
13795
|
+
if (file === "Package.swift") continue;
|
|
13688
13796
|
const relative = file.slice(prefix.length);
|
|
13689
13797
|
if (target.sources !== void 0 && !target.sources.some(
|
|
13690
13798
|
(source) => source === "." || relative === source || relative.startsWith(`${source}/`)
|
|
@@ -13694,10 +13802,7 @@ function swiftTargetDependencies(files, targets, frameworks = OPTIONAL_FRAMEWORK
|
|
|
13694
13802
|
(excluded) => relative === excluded || relative.startsWith(`${excluded}/`)
|
|
13695
13803
|
))
|
|
13696
13804
|
continue;
|
|
13697
|
-
if (
|
|
13698
|
-
(candidate) => candidate.name !== target.name && candidate.path !== "." && candidate.path.startsWith(prefix) && file.startsWith(`${candidate.path}/`)
|
|
13699
|
-
))
|
|
13700
|
-
continue;
|
|
13805
|
+
if (nested.some((path25) => file.startsWith(path25))) continue;
|
|
13701
13806
|
const imports = file.endsWith(".swift") ? swiftImportNames(contents2) : SWIFT_NATIVE_SOURCE_EXTENSIONS.some((extension) => file.endsWith(extension)) ? clangImportNames(contents2, ownsHeader) : [];
|
|
13702
13807
|
for (const name2 of imports) {
|
|
13703
13808
|
if (names.has(name2) && name2 !== target.name && !(target.dependencies !== void 0 && localNames.has(name2)))
|
|
@@ -13758,9 +13863,9 @@ var executableLinkFlags = (root) => ` "-Xclang-linker", "-O0",
|
|
|
13758
13863
|
`;
|
|
13759
13864
|
var darwinRecordsRegion = (quoted2) => quoted2.length ? ["-Wl,--start-lib", ...quoted2, "-Wl,--end-lib"] : [];
|
|
13760
13865
|
var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
13761
|
-
var MULTI_MANIFEST_VERSION =
|
|
13866
|
+
var MULTI_MANIFEST_VERSION = 71;
|
|
13762
13867
|
var SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
|
|
13763
|
-
var compilerSourceDigest = true ? "
|
|
13868
|
+
var compilerSourceDigest = true ? "36b1496faf39a688e5ab3ee63bdab89a3afde2b9c6355443c3162f4b1e3b9144" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
|
|
13764
13869
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
13765
13870
|
const hash = (0, import_node_crypto14.createHash)("sha256");
|
|
13766
13871
|
hash.update(`swift-compile
|
|
@@ -13992,7 +14097,9 @@ function emitSwiftPackageManifest(args) {
|
|
|
13992
14097
|
const flags = JSON.parse(literal2.replace(/,\s*]$/, "]")).filter(
|
|
13993
14098
|
(flag, index, all) => !mapsPackageModule(flag) && !(flag === "-Xcc" && mapsPackageModule(all[index + 1] ?? ""))
|
|
13994
14099
|
);
|
|
13995
|
-
const
|
|
14100
|
+
const macros = compactSwiftClangDefines(flags);
|
|
14101
|
+
const compact = args.coalescibleOverlays ? compactSwiftClangOverlays(macros, args.coalescibleOverlays) : macros;
|
|
14102
|
+
const content = compact.map((flag) => JSON.stringify(flag)).join("\n") + "\n";
|
|
13996
14103
|
const digest = (0, import_node_crypto14.createHash)("sha256").update(content).digest("hex");
|
|
13997
14104
|
const file = import_node_path26.default.join(args.root, ".peach-swift-arguments", `${digest}.rsp`);
|
|
13998
14105
|
args.files.set(file, content);
|
|
@@ -14083,7 +14190,7 @@ function emitSwiftPackageManifest(args) {
|
|
|
14083
14190
|
].map((flag) => `, ${JSON.stringify(flag)}`).join("");
|
|
14084
14191
|
const header = args.headerDirectory && (args.nativeHeaderDeclarations?.[target.name] || [...args.native?.values() ?? []].some(
|
|
14085
14192
|
(value) => value.late?.producers.includes(target.name)
|
|
14086
|
-
)) ? `, "-emit-objc-header-path", ${JSON.stringify(import_node_path26.default.join(args.headerDirectory, `${target.name}-Swift
|
|
14193
|
+
)) ? `, "-emit-objc-header-path", ${JSON.stringify(import_node_path26.default.join(args.headerDirectory, `${target.name}-Swift.original.h`))}` : "";
|
|
14087
14194
|
const clangMode = target.cxxInterop ? "" : ', "-Xcc", "-fno-cxx-modules"';
|
|
14088
14195
|
const deployment = `, "-Xfrontend", "-peach-ios-deployment-target", "-Xfrontend", ${JSON.stringify(target.iosDeploymentTarget ?? SWIFTPM_DEFAULT_IOS_DEPLOYMENT_TARGET)}`;
|
|
14089
14196
|
const swiftSettings = `swiftSettings: [.swiftLanguageMode(.v${target.languageMode}),${isolation}${interoperability}${defines}${features}${upcoming} .unsafeFlags(${swiftFlagArray(`["-Osize", "-Xfrontend", "-enable-cross-import-overlays"${overlayFlags}${FOUNDATION_IMPLICIT_FLAGS}${oneModule ? ONE_IMPLICIT_FLAGS : ""}${imports}${nativeImportFlags}${objcFlags}${header}${clangMode}${deployment}${upstream}]`)})]`;
|
|
@@ -16731,6 +16838,9 @@ module ${moduleName}.Swift {
|
|
|
16731
16838
|
nativeHeaderDeclarations[module2] = [...declared];
|
|
16732
16839
|
}
|
|
16733
16840
|
const nativeFlags = native.size > 0 ? /* @__PURE__ */ new Map() : void 0;
|
|
16841
|
+
const generatedOverlays = new Set(
|
|
16842
|
+
headerSearch.files.filter((file) => file.endsWith(".yaml"))
|
|
16843
|
+
);
|
|
16734
16844
|
if (nativeFlags) {
|
|
16735
16845
|
const toolchainBin = nativeToolchain();
|
|
16736
16846
|
const headers = import_node_path26.default.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "darwin");
|
|
@@ -16751,8 +16861,11 @@ module ${moduleName}.Swift {
|
|
|
16751
16861
|
throw new Error(
|
|
16752
16862
|
target.name + ": missing or unsupported declared iOS deployment target " + JSON.stringify(version2)
|
|
16753
16863
|
);
|
|
16864
|
+
const sdkIntake = objcSdkIntakeFlags(headers, toolchainBin, minimum);
|
|
16865
|
+
const sdkOverlay = sdkIntake.indexOf("-ivfsoverlay");
|
|
16866
|
+
if (sdkOverlay >= 0) generatedOverlays.add(sdkIntake[sdkOverlay + 1]);
|
|
16754
16867
|
const intake = [
|
|
16755
|
-
...
|
|
16868
|
+
...sdkIntake,
|
|
16756
16869
|
"-ivfsoverlay",
|
|
16757
16870
|
headerSearch.files[0],
|
|
16758
16871
|
"-I",
|
|
@@ -16921,6 +17034,7 @@ module ${moduleName}.Swift {
|
|
|
16921
17034
|
sourceSwiftTargets: swiftTargets,
|
|
16922
17035
|
nativeFlags,
|
|
16923
17036
|
nativeImportFlags,
|
|
17037
|
+
coalescibleOverlays: nativeFlags ? coalescibleHeaderOverlays(generatedOverlays) : void 0,
|
|
16924
17038
|
nativeHeaderFlags,
|
|
16925
17039
|
nativeSwiftHeaderMaps,
|
|
16926
17040
|
nativeHeaderDeclarations,
|
|
@@ -18231,6 +18345,7 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
18231
18345
|
report("compiling and linking Swift modules");
|
|
18232
18346
|
const frameworkInterfaces = /* @__PURE__ */ new Map();
|
|
18233
18347
|
const nativeDeclarations = /* @__PURE__ */ new Map();
|
|
18348
|
+
const nativeHeaders = Object.entries(input.files).filter(([name2]) => name2.endsWith(".h") && !name2.endsWith("-Swift.h")).map(([, source]) => source);
|
|
18234
18349
|
for (const [file, contents2] of Object.entries(input.files)) {
|
|
18235
18350
|
if (!file.endsWith(".modulemap")) continue;
|
|
18236
18351
|
const name2 = moduleMapName(contents2);
|
|
@@ -18318,54 +18433,83 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
18318
18433
|
);
|
|
18319
18434
|
return value;
|
|
18320
18435
|
};
|
|
18321
|
-
|
|
18322
|
-
|
|
18323
|
-
|
|
18324
|
-
|
|
18325
|
-
|
|
18326
|
-
|
|
18327
|
-
|
|
18328
|
-
|
|
18436
|
+
const compileApp = async () => {
|
|
18437
|
+
const stages = [
|
|
18438
|
+
...preparation.headerBuilds,
|
|
18439
|
+
...preparation.nativeProductTarget ? [{ target: preparation.nativeProductTarget, producers: [] }] : []
|
|
18440
|
+
];
|
|
18441
|
+
const checkpoints = import_node_path26.default.join(root, ".build", "peach-product-checkpoints");
|
|
18442
|
+
const recipe = (0, import_node_crypto14.createHash)("sha256").update(hash).update((0, import_node_fs25.readFileSync)(import_node_path26.default.join(root, "Package.swift"))).update(JSON.stringify(buildArgs)).digest("hex");
|
|
18443
|
+
for (const { target, producers } of stages) {
|
|
18444
|
+
const receipt = import_node_path26.default.join(
|
|
18445
|
+
checkpoints,
|
|
18446
|
+
(0, import_node_crypto14.createHash)("sha256").update(target).digest("hex")
|
|
18329
18447
|
);
|
|
18330
|
-
|
|
18331
|
-
const
|
|
18448
|
+
const headers = producers.map((producer) => {
|
|
18449
|
+
const stem = import_node_path26.default.join(
|
|
18332
18450
|
root,
|
|
18333
18451
|
".build",
|
|
18334
18452
|
"peach-cxx-headers",
|
|
18335
|
-
`${producer}-Swift
|
|
18453
|
+
`${producer}-Swift`
|
|
18336
18454
|
);
|
|
18337
|
-
|
|
18338
|
-
|
|
18339
|
-
|
|
18340
|
-
|
|
18341
|
-
|
|
18342
|
-
|
|
18343
|
-
|
|
18344
|
-
|
|
18345
|
-
|
|
18346
|
-
|
|
18347
|
-
|
|
18348
|
-
|
|
18349
|
-
generated,
|
|
18350
|
-
Object.entries(input.files).filter(
|
|
18351
|
-
([name2]) => name2.endsWith(".h") && !name2.endsWith("-Swift.h")
|
|
18352
|
-
).map(([, source]) => source)
|
|
18353
|
-
)
|
|
18354
|
-
]),
|
|
18355
|
-
`#import <${producer}/${producer}.h>`
|
|
18356
|
-
)
|
|
18455
|
+
return {
|
|
18456
|
+
producer,
|
|
18457
|
+
original: `${stem}.original.h`,
|
|
18458
|
+
emitted: `${stem}.h`
|
|
18459
|
+
};
|
|
18460
|
+
});
|
|
18461
|
+
const fingerprint = () => {
|
|
18462
|
+
const digest = (0, import_node_crypto14.createHash)("sha256").update(recipe);
|
|
18463
|
+
for (const { emitted } of headers) {
|
|
18464
|
+
if (!(0, import_node_fs25.existsSync)(emitted)) return;
|
|
18465
|
+
digest.update(
|
|
18466
|
+
(0, import_node_crypto14.createHash)("sha256").update((0, import_node_fs25.readFileSync)(emitted)).digest()
|
|
18357
18467
|
);
|
|
18358
18468
|
}
|
|
18359
|
-
|
|
18360
|
-
|
|
18361
|
-
|
|
18469
|
+
return digest.digest("hex");
|
|
18470
|
+
};
|
|
18471
|
+
if (!options.project && (0, import_node_fs25.existsSync)(receipt) && (0, import_node_fs25.readFileSync)(receipt, "utf8") === fingerprint())
|
|
18472
|
+
continue;
|
|
18473
|
+
if (!options.project) (0, import_node_fs25.rmSync)(receipt, { force: true });
|
|
18474
|
+
for (const { producer, original } of headers)
|
|
18475
|
+
if (!(0, import_node_fs25.existsSync)(original))
|
|
18476
|
+
(0, import_node_fs25.rmSync)(
|
|
18477
|
+
import_node_path26.default.join(
|
|
18478
|
+
root,
|
|
18479
|
+
".build",
|
|
18480
|
+
WASM_TRIPLE,
|
|
18481
|
+
"release",
|
|
18482
|
+
"Modules",
|
|
18483
|
+
`${swiftTargetModuleName(producer)}.swiftmodule`
|
|
18484
|
+
),
|
|
18485
|
+
{ force: true }
|
|
18486
|
+
);
|
|
18362
18487
|
await runCompiler(
|
|
18363
18488
|
swift,
|
|
18364
|
-
[...buildArgs, "--target",
|
|
18489
|
+
[...buildArgs, "--target", target],
|
|
18365
18490
|
appOptions,
|
|
18366
18491
|
SWIFTPM_PROGRESS,
|
|
18367
18492
|
SWIFTPM_NOISE
|
|
18368
18493
|
);
|
|
18494
|
+
for (const { producer, original, emitted } of headers) {
|
|
18495
|
+
const generated = clangInterfaceHeader((0, import_node_fs25.readFileSync)(original, "utf8"));
|
|
18496
|
+
writeBuildFile(
|
|
18497
|
+
emitted,
|
|
18498
|
+
withoutSwiftDeclarations(
|
|
18499
|
+
swiftHeaderWithSuperclassImports(generated, frameworkInterface),
|
|
18500
|
+
/* @__PURE__ */ new Set([
|
|
18501
|
+
...preparation.nativeHeaderDeclarations[producer] ?? [],
|
|
18502
|
+
...nativelyDeclaredFunctions(generated, nativeHeaders)
|
|
18503
|
+
]),
|
|
18504
|
+
`#import <${producer}/${producer}.h>`
|
|
18505
|
+
)
|
|
18506
|
+
);
|
|
18507
|
+
}
|
|
18508
|
+
if (!options.project) {
|
|
18509
|
+
(0, import_node_fs25.mkdirSync)(checkpoints, { recursive: true });
|
|
18510
|
+
(0, import_node_fs25.writeFileSync)(`${receipt}.partial`, fingerprint());
|
|
18511
|
+
(0, import_node_fs25.renameSync)(`${receipt}.partial`, receipt);
|
|
18512
|
+
}
|
|
18369
18513
|
}
|
|
18370
18514
|
await runCompiler(
|
|
18371
18515
|
swift,
|
|
@@ -18374,6 +18518,9 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
18374
18518
|
SWIFTPM_PROGRESS,
|
|
18375
18519
|
SWIFTPM_NOISE
|
|
18376
18520
|
);
|
|
18521
|
+
};
|
|
18522
|
+
try {
|
|
18523
|
+
await compileApp();
|
|
18377
18524
|
} catch (error) {
|
|
18378
18525
|
const output2 = outputOf(error);
|
|
18379
18526
|
const moduleCache = import_node_path26.default.join(
|
|
@@ -18386,13 +18533,7 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
18386
18533
|
if (output2.includes("was compiled with module cache path") && (0, import_node_fs25.existsSync)(moduleCache)) {
|
|
18387
18534
|
(0, import_node_fs25.rmSync)(moduleCache, { recursive: true, force: true });
|
|
18388
18535
|
try {
|
|
18389
|
-
await
|
|
18390
|
-
swift,
|
|
18391
|
-
buildArgs,
|
|
18392
|
-
appOptions,
|
|
18393
|
-
SWIFTPM_PROGRESS,
|
|
18394
|
-
SWIFTPM_NOISE
|
|
18395
|
-
);
|
|
18536
|
+
await compileApp();
|
|
18396
18537
|
} catch (retryError) {
|
|
18397
18538
|
throw new Error(
|
|
18398
18539
|
[
|