peachsim 0.1.1815 → 0.1.1817

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.
Files changed (97) hide show
  1. package/cli/commands/package.ts +82 -31
  2. package/cli/outbound-endpoints.ts +1 -1
  3. package/cli/packaged-app-launcher.ts +6 -1
  4. package/dist-lib/agent-daemon-client.cjs +1 -1
  5. package/dist-lib/agent-events.cjs +1 -1
  6. package/dist-lib/attached-projects.cjs +1 -1
  7. package/dist-lib/auth/shared-session.cjs +1 -1
  8. package/dist-lib/backend-origin.cjs +1 -1
  9. package/dist-lib/beta.cjs +1 -1
  10. package/dist-lib/beta.mjs +1 -1
  11. package/dist-lib/bridge-constants.cjs +1 -1
  12. package/dist-lib/bridge-contract-input.cjs +1 -1
  13. package/dist-lib/bridge-contract-input.mjs +1 -1
  14. package/dist-lib/bridge-contract.cjs +1 -1
  15. package/dist-lib/bridge-contract.mjs +1 -1
  16. package/dist-lib/bundle-channel.cjs +4418 -5235
  17. package/dist-lib/capture-contract.cjs +1 -1
  18. package/dist-lib/capture-contract.mjs +1 -1
  19. package/dist-lib/cloud-contract.cjs +1 -1
  20. package/dist-lib/cloud-contract.mjs +1 -1
  21. package/dist-lib/cloud-test-args.cjs +1 -1
  22. package/dist-lib/cloud-test-args.mjs +1 -1
  23. package/dist-lib/cloud.cjs +1 -1
  24. package/dist-lib/cloud.mjs +1 -1
  25. package/dist-lib/config.cjs +1 -1
  26. package/dist-lib/config.mjs +1 -1
  27. package/dist-lib/detox/index.cjs +12 -3
  28. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  29. package/dist-lib/expo-swift-bundle.cjs +3932 -4526
  30. package/dist-lib/expo-swift-metadata.cjs +1 -1
  31. package/dist-lib/expo-swift-metadata.mjs +1 -1
  32. package/dist-lib/home-paths.cjs +1 -1
  33. package/dist-lib/host/bridge-host.cjs +3289 -4175
  34. package/dist-lib/host/fetch-proxy-handler.cjs +12 -3
  35. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  36. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  37. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  38. package/dist-lib/host/websocket-proxy.cjs +1 -1
  39. package/dist-lib/index.cjs +13 -24
  40. package/dist-lib/jump-to-source-babel.cjs +1 -1
  41. package/dist-lib/jump-to-source-native.cjs +1 -1
  42. package/dist-lib/kotlin-host.cjs +1 -1
  43. package/dist-lib/menu.cjs +1 -1
  44. package/dist-lib/menu.mjs +1 -1
  45. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  46. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  47. package/dist-lib/metro-production-bundle.cjs +1 -1
  48. package/dist-lib/metro-production-bundle.mjs +1 -1
  49. package/dist-lib/metro.cjs +13 -24
  50. package/dist-lib/native-app-identity-project.cjs +2 -22
  51. package/dist-lib/native-app-identity-project.mjs +2 -22
  52. package/dist-lib/native-app-identity.cjs +1 -1
  53. package/dist-lib/native-app-identity.mjs +1 -1
  54. package/dist-lib/native-firebase-metadata.cjs +1 -1
  55. package/dist-lib/native-firebase-metadata.mjs +1 -1
  56. package/dist-lib/pdfium-raster.cjs +1 -1
  57. package/dist-lib/pdfium-raster.mjs +1 -1
  58. package/dist-lib/plist.cjs +1 -1
  59. package/dist-lib/plist.mjs +1 -1
  60. package/dist-lib/profiles.cjs +1 -1
  61. package/dist-lib/public-brand.cjs +1 -1
  62. package/dist-lib/public-origins-lib-esm.json +24 -24
  63. package/dist-lib/public-origins-lib.json +74 -66
  64. package/dist-lib/react-native-host-modules.cjs +1 -1
  65. package/dist-lib/react-native-host-modules.mjs +1 -1
  66. package/dist-lib/reap-browser.cjs +1 -1
  67. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  68. package/dist-lib/sdk.cjs +1 -1
  69. package/dist-lib/sdk.mjs +1 -1
  70. package/dist-lib/skills.cjs +3793 -4671
  71. package/dist-lib/swift-compile.cjs +216 -242
  72. package/dist-lib/swift-compile.mjs +216 -242
  73. package/dist-lib/swift-package.cjs +1 -1
  74. package/dist-lib/swift-package.mjs +1 -1
  75. package/dist-lib/swift-submit.cjs +1 -1
  76. package/dist-lib/swift-submit.mjs +1 -1
  77. package/dist-lib/swift-toolchain.cjs +1 -1
  78. package/dist-lib/swift.cjs +1 -1
  79. package/dist-lib/vite-swift.cjs +251 -236
  80. package/dist-lib/vite.cjs +12 -3
  81. package/dist-lib/worklet-executable.cjs +1 -1
  82. package/dist-lib/worklet-executable.mjs +1 -1
  83. package/package.json +1 -1
  84. package/src/answeredNativePackages.ts +41 -0
  85. package/src/cli-runtime.ts +2 -9
  86. package/src/expo-discovery-cache.ts +2 -0
  87. package/src/expo-kotlin-host.ts +11 -9
  88. package/src/expo-swift-host.ts +10 -6
  89. package/src/nitro-bundle.ts +8 -6
  90. package/src/nitro-compiler-digest.ts +2 -4
  91. package/src/nitro-superset.lock.json +19 -251
  92. package/src/nitro-superset.ts +59 -63
  93. package/src/react-native-bridge-modules.ts +2 -4
  94. package/src/swift-compile.ts +258 -254
  95. package/src/swift-objc-standin.ts +10 -6
  96. package/src/swift-standins.ts +36 -12
  97. package/src/turbo-source.ts +2 -3
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1815 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1817 | (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;
@@ -3796,26 +3796,6 @@ var NATIVE_GRAPH_INPUTS = {
3796
3796
  target: IOS_SDK_TARGET
3797
3797
  };
3798
3798
  var NATIVE_GRAPH_ID = (0, import_node_crypto3.createHash)("sha256").update(JSON.stringify(NATIVE_GRAPH_INPUTS)).digest("hex");
3799
- function stripExternalSourceMarks(text2) {
3800
- return text2.split("\n").map(
3801
- (line) => line.startsWith("#define PEACH_SWIFT_CLASS(") ? line : line.replace(/PEACH_SWIFT_CLASS\(\w+\)\s*/g, "")
3802
- ).join("\n");
3803
- }
3804
- function iosSdkEntries() {
3805
- const overlays = Object.entries(IOS_SDK_OVERLAYS).map(
3806
- ([module2, text2]) => [
3807
- `usr/lib/swift/${module2}.swiftmodule/arm64-apple-ios-simulator.swiftinterface`,
3808
- `// swift-interface-format-version: 1.0
3809
- // swift-module-flags: -target ${IOS_SDK_TARGET} -enable-objc-interop -enable-library-evolution -module-name ${module2}
3810
- ${text2}`
3811
- ]
3812
- );
3813
- const headers = Object.entries(IOS_SDK_HEADERS).map(
3814
- ([file, text2]) => [file, stripExternalSourceMarks(text2)]
3815
- );
3816
- return [...headers, ...overlays].sort(([a], [b]) => a < b ? -1 : 1);
3817
- }
3818
- var IOS_SDK_ID = (0, import_node_crypto3.createHash)("sha256").update(JSON.stringify(iosSdkEntries())).digest("hex").slice(0, 16);
3819
3799
  function objcSdkIntakeFlags(headers, toolchainBin, minimum) {
3820
3800
  return [
3821
3801
  ...swiftObjCPlatformFlags(toolchainBin, minimum),
@@ -7853,7 +7833,7 @@ var darwinRecordsRegion = (quoted) => quoted.length ? ["-Wl,--start-lib", ...quo
7853
7833
  var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
7854
7834
  var MULTI_MANIFEST_VERSION = 65;
7855
7835
  var SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
7856
- var compilerSourceDigest = true ? "f6bf05da9a8bbde24169c3c8ff29e36d48f13ea9f817f33a350da3c475783ddd" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
7836
+ var compilerSourceDigest = true ? "1519f1f37c446535792f7bb0c9ba9c5e59b0b0f87d7b5c849346abe684325aa7" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
7857
7837
  function swiftArtifactHash(input, release, moduleRoot) {
7858
7838
  const hash = (0, import_node_crypto8.createHash)("sha256");
7859
7839
  hash.update(`swift-compile
@@ -11668,245 +11648,239 @@ function compileSwiftProjectUnit(input, options) {
11668
11648
  `swift-compile: no swift.org toolchain at ${options.toolchainBin}; install ${options.release} and its matching wasm sdk`
11669
11649
  );
11670
11650
  }
11671
- return withSwiftRootLock(
11672
- swiftFrameworkScratch(frameworkKey),
11673
- async (frameworkLease) => {
11674
- const frameworkRoot = stageFrameworkSource(moduleRoot, frameworkKey);
11675
- report("preparing compiler plugins");
11676
- const macroPlugins = await ensureMacroPlugins(
11677
- frameworkRoot,
11678
- options.toolchainBin,
11679
- options.release,
11680
- options.signal,
11681
- frameworkLease
11682
- );
11683
- const sdk = swiftModuleSdk(frameworkRoot).wasmSdkId;
11684
- const icu = swiftIcuAsset(options.toolchainBin, sdk);
11685
- const buildOptions = {
11686
- env: {
11687
- ...options.project?.env ?? process.env,
11688
- // shipped host plugins resolve against the selected compiler's runtime.
11689
- ...process.platform === "linux" ? {
11690
- LD_LIBRARY_PATH: [
11691
- import_node_path19.default.resolve(options.toolchainBin, "../lib/swift/linux"),
11692
- import_node_path19.default.resolve(options.toolchainBin, "../lib/swift/host"),
11693
- process.env.LD_LIBRARY_PATH
11694
- ].filter(Boolean).join(":")
11695
- } : {},
11696
- ...input.lazyDistribution ? { PEACH_DEFER_WASM_LINK: "1" } : {}
11697
- },
11698
- maxBuffer: 64 * 1024 * 1024,
11699
- timeout: options.timeoutMs,
11700
- signal: options.signal,
11701
- lease,
11702
- frameworkLease
11703
- };
11704
- let prebuilt;
11705
- if (!swiftDistributionAt(moduleRoot)) {
11706
- report("compiling framework products");
11707
- prebuilt = await compileFrameworkProducts({
11708
- moduleRoot: frameworkRoot,
11709
- frameworkKey,
11710
- input,
11711
- swift,
11712
- sdk,
11713
- toolchainBin: options.toolchainBin,
11714
- plugins: macroPlugins,
11715
- buildOptions
11716
- });
11717
- await pruneFrameworkScratches(frameworkKey);
11718
- }
11719
- if (options.project) removeProjectLinks(root);
11720
- if (retireStaleSwiftLink(
11721
- root,
11722
- swiftLinkStamp({
11723
- frameworkKey,
11724
- prebuilt
11725
- })
11726
- ))
11727
- report("framework revision changed; rebuilding the app link");
11728
- const preparation = writeSwiftProject(
11729
- layout,
11651
+ const frameworkScratch = swiftFrameworkScratch(frameworkKey);
11652
+ const withFrameworkLock = (work) => distribution ? work() : withSwiftRootLock(frameworkScratch, work, options.signal);
11653
+ return withFrameworkLock(async (frameworkLease) => {
11654
+ const frameworkRoot = stageFrameworkSource(moduleRoot, frameworkKey);
11655
+ report("preparing compiler plugins");
11656
+ const pluginsFor = (pluginLease) => ensureMacroPlugins(
11657
+ frameworkRoot,
11658
+ options.toolchainBin,
11659
+ options.release,
11660
+ options.signal,
11661
+ pluginLease
11662
+ );
11663
+ const macroPlugins = distribution ? await withSwiftRootLock(frameworkScratch, pluginsFor, options.signal) : await pluginsFor(frameworkLease);
11664
+ const sdk = swiftModuleSdk(frameworkRoot).wasmSdkId;
11665
+ const icu = swiftIcuAsset(options.toolchainBin, sdk);
11666
+ const buildOptions = {
11667
+ env: {
11668
+ ...options.project?.env ?? process.env,
11669
+ // shipped host plugins resolve against the selected compiler's runtime.
11670
+ ...process.platform === "linux" ? {
11671
+ LD_LIBRARY_PATH: [
11672
+ import_node_path19.default.resolve(options.toolchainBin, "../lib/swift/linux"),
11673
+ import_node_path19.default.resolve(options.toolchainBin, "../lib/swift/host"),
11674
+ process.env.LD_LIBRARY_PATH
11675
+ ].filter(Boolean).join(":")
11676
+ } : {},
11677
+ ...input.lazyDistribution ? { PEACH_DEFER_WASM_LINK: "1" } : {}
11678
+ },
11679
+ maxBuffer: 64 * 1024 * 1024,
11680
+ timeout: options.timeoutMs,
11681
+ signal: options.signal,
11682
+ lease,
11683
+ frameworkLease
11684
+ };
11685
+ let prebuilt;
11686
+ if (!distribution) {
11687
+ report("compiling framework products");
11688
+ prebuilt = await compileFrameworkProducts({
11689
+ moduleRoot: frameworkRoot,
11690
+ frameworkKey,
11730
11691
  input,
11731
- frameworkRoot,
11692
+ swift,
11693
+ sdk,
11694
+ toolchainBin: options.toolchainBin,
11695
+ plugins: macroPlugins,
11696
+ buildOptions
11697
+ });
11698
+ await pruneFrameworkScratches(frameworkKey);
11699
+ }
11700
+ if (options.project) removeProjectLinks(root);
11701
+ if (retireStaleSwiftLink(
11702
+ root,
11703
+ swiftLinkStamp({
11704
+ frameworkKey,
11732
11705
  prebuilt
11706
+ })
11707
+ ))
11708
+ report("framework revision changed; rebuilding the app link");
11709
+ const preparation = writeSwiftProject(layout, input, frameworkRoot, prebuilt);
11710
+ writeSwiftAutolinkLinker(root, options.toolchainBin);
11711
+ const projectProcess = options.project ? prepareSwiftProjectProcess(root, options.project) : void 0;
11712
+ const appOptions = projectProcess ? {
11713
+ ...buildOptions,
11714
+ uid: projectProcess.uid,
11715
+ gid: projectProcess.gid,
11716
+ confined: projectProcess.env
11717
+ } : buildOptions;
11718
+ const unprepared = preparation.targetFailures.map(
11719
+ (failure) => `error: target ${failure}`
11720
+ );
11721
+ const forwarders = /* @__PURE__ */ new Map();
11722
+ for (const [file, text2] of Object.entries(input.files)) {
11723
+ const parents = /^#include "((?:\.\.\/)+)[^"\n]+"\n$/.exec(text2)?.[1];
11724
+ if (!parents) continue;
11725
+ const directory = import_node_path19.default.posix.dirname(file);
11726
+ forwarders.set(
11727
+ `${import_node_path19.default.join(root, directory)}/${parents.slice(0, -1)}`,
11728
+ import_node_path19.default.posix.join("build", directory, parents).replace(/\/$/, "")
11733
11729
  );
11734
- writeSwiftAutolinkLinker(root, options.toolchainBin);
11735
- const projectProcess = options.project ? prepareSwiftProjectProcess(root, options.project) : void 0;
11736
- const appOptions = projectProcess ? {
11737
- ...buildOptions,
11738
- uid: projectProcess.uid,
11739
- gid: projectProcess.gid,
11740
- confined: projectProcess.env
11741
- } : buildOptions;
11742
- const unprepared = preparation.targetFailures.map(
11743
- (failure) => `error: target ${failure}`
11744
- );
11745
- const forwarders = /* @__PURE__ */ new Map();
11746
- for (const [file, text2] of Object.entries(input.files)) {
11747
- const parents = /^#include "((?:\.\.\/)+)[^"\n]+"\n$/.exec(text2)?.[1];
11748
- if (!parents) continue;
11749
- const directory = import_node_path19.default.posix.dirname(file);
11750
- forwarders.set(
11751
- `${import_node_path19.default.join(root, directory)}/${parents.slice(0, -1)}`,
11752
- import_node_path19.default.posix.join("build", directory, parents).replace(/\/$/, "")
11730
+ }
11731
+ const buildArgs = [
11732
+ "build",
11733
+ ...projectProcess?.cacheOptions ?? swiftPackageCacheOptions(),
11734
+ "--build-system",
11735
+ "native",
11736
+ "-j",
11737
+ BUILD_JOBS,
11738
+ "--package-path",
11739
+ root,
11740
+ ...swiftCompileSdkOptions(frameworkRoot, options.toolchainBin),
11741
+ "--swift-sdk",
11742
+ sdk,
11743
+ ...input.packageFiles || prebuilt ? ["--toolset", import_node_path19.default.join(root, ".peach-target-toolset.json")] : [],
11744
+ "-c",
11745
+ "release",
11746
+ "-Xswiftc",
11747
+ "-num-threads",
11748
+ "-Xswiftc",
11749
+ BUILD_JOBS,
11750
+ ...swiftReproducibleBuildFlags([
11751
+ [import_node_path19.default.dirname(options.toolchainBin), "toolchain"],
11752
+ [frameworkRoot, "framework"],
11753
+ [root, "build"],
11754
+ ...forwarders
11755
+ ]),
11756
+ ...macroPlugins.libraries.flatMap((plugin) => [
11757
+ "-Xswiftc",
11758
+ "-load-plugin-library",
11759
+ "-Xswiftc",
11760
+ plugin
11761
+ ]),
11762
+ ...macroPlugins.executables.flatMap((plugin) => [
11763
+ "-Xswiftc",
11764
+ "-load-plugin-executable",
11765
+ "-Xswiftc",
11766
+ `${plugin}#ExpoModulesMacros`
11767
+ ])
11768
+ ];
11769
+ const linked = builtArtifact(layout);
11770
+ if (input.lazyDistribution) {
11771
+ (0, import_node_fs17.rmSync)(import_node_path19.default.join(root, ".peach-link.rsp"), { force: true });
11772
+ if ((0, import_node_fs17.existsSync)(linked) && (0, import_node_fs17.statSync)(linked).size <= 8)
11773
+ (0, import_node_fs17.rmSync)(linked, { force: true });
11774
+ }
11775
+ report("compiling and linking Swift modules");
11776
+ try {
11777
+ const headerBuilds = preparation.headerProductTarget ? [
11778
+ ...Object.keys(preparation.nativeHeaderDeclarations),
11779
+ preparation.headerProductTarget
11780
+ ] : preparation.headerProducers;
11781
+ for (const build of headerBuilds) {
11782
+ await runCompiler(
11783
+ swift,
11784
+ [...buildArgs, "--target", build],
11785
+ appOptions,
11786
+ SWIFTPM_PROGRESS,
11787
+ SWIFTPM_NOISE
11753
11788
  );
11789
+ for (const producer of build === preparation.headerProductTarget ? preparation.headerProducers : [build]) {
11790
+ const emitted = import_node_path19.default.join(
11791
+ root,
11792
+ ".build",
11793
+ "peach-cxx-headers",
11794
+ `${producer}-Swift.h`
11795
+ );
11796
+ const original = preparation.nativeHeaderDeclarations[producer] ? emitted.replace(/-Swift\.h$/, "-Swift.original.h") : emitted;
11797
+ if ((0, import_node_fs17.existsSync)(original))
11798
+ writeBuildFile(
11799
+ emitted,
11800
+ withoutSwiftDeclarations(
11801
+ clangInterfaceHeader((0, import_node_fs17.readFileSync)(original, "utf8")),
11802
+ new Set(preparation.nativeHeaderDeclarations[producer]),
11803
+ `#import <${producer}/${producer}.h>`
11804
+ )
11805
+ );
11806
+ }
11754
11807
  }
11755
- const buildArgs = [
11756
- "build",
11757
- ...projectProcess?.cacheOptions ?? swiftPackageCacheOptions(),
11758
- "--build-system",
11759
- "native",
11760
- "-j",
11761
- BUILD_JOBS,
11762
- "--package-path",
11808
+ await runCompiler(
11809
+ swift,
11810
+ buildArgs,
11811
+ appOptions,
11812
+ SWIFTPM_PROGRESS,
11813
+ SWIFTPM_NOISE
11814
+ );
11815
+ } catch (error) {
11816
+ const output2 = outputOf(error);
11817
+ const moduleCache = import_node_path19.default.join(
11763
11818
  root,
11764
- ...swiftCompileSdkOptions(frameworkRoot, options.toolchainBin),
11765
- "--swift-sdk",
11766
- sdk,
11767
- ...input.packageFiles || prebuilt ? ["--toolset", import_node_path19.default.join(root, ".peach-target-toolset.json")] : [],
11768
- "-c",
11819
+ ".build",
11820
+ WASM_TRIPLE,
11769
11821
  "release",
11770
- "-Xswiftc",
11771
- "-num-threads",
11772
- "-Xswiftc",
11773
- BUILD_JOBS,
11774
- ...swiftReproducibleBuildFlags([
11775
- [import_node_path19.default.dirname(options.toolchainBin), "toolchain"],
11776
- [frameworkRoot, "framework"],
11777
- [root, "build"],
11778
- ...forwarders
11779
- ]),
11780
- ...macroPlugins.libraries.flatMap((plugin) => [
11781
- "-Xswiftc",
11782
- "-load-plugin-library",
11783
- "-Xswiftc",
11784
- plugin
11785
- ]),
11786
- ...macroPlugins.executables.flatMap((plugin) => [
11787
- "-Xswiftc",
11788
- "-load-plugin-executable",
11789
- "-Xswiftc",
11790
- `${plugin}#ExpoModulesMacros`
11791
- ])
11792
- ];
11793
- const linked = builtArtifact(layout);
11794
- if (input.lazyDistribution) {
11795
- (0, import_node_fs17.rmSync)(import_node_path19.default.join(root, ".peach-link.rsp"), { force: true });
11796
- if ((0, import_node_fs17.existsSync)(linked) && (0, import_node_fs17.statSync)(linked).size <= 8)
11797
- (0, import_node_fs17.rmSync)(linked, { force: true });
11798
- }
11799
- report("compiling and linking Swift modules");
11800
- try {
11801
- const headerBuilds = preparation.headerProductTarget ? [
11802
- ...Object.keys(preparation.nativeHeaderDeclarations),
11803
- preparation.headerProductTarget
11804
- ] : preparation.headerProducers;
11805
- for (const build of headerBuilds) {
11822
+ "ModuleCache"
11823
+ );
11824
+ if (output2.includes("was compiled with module cache path") && (0, import_node_fs17.existsSync)(moduleCache)) {
11825
+ (0, import_node_fs17.rmSync)(moduleCache, { recursive: true, force: true });
11826
+ try {
11806
11827
  await runCompiler(
11807
11828
  swift,
11808
- [...buildArgs, "--target", build],
11829
+ buildArgs,
11809
11830
  appOptions,
11810
11831
  SWIFTPM_PROGRESS,
11811
11832
  SWIFTPM_NOISE
11812
11833
  );
11813
- for (const producer of build === preparation.headerProductTarget ? preparation.headerProducers : [build]) {
11814
- const emitted = import_node_path19.default.join(
11815
- root,
11816
- ".build",
11817
- "peach-cxx-headers",
11818
- `${producer}-Swift.h`
11819
- );
11820
- const original = preparation.nativeHeaderDeclarations[producer] ? emitted.replace(/-Swift\.h$/, "-Swift.original.h") : emitted;
11821
- if ((0, import_node_fs17.existsSync)(original))
11822
- writeBuildFile(
11823
- emitted,
11824
- withoutSwiftDeclarations(
11825
- clangInterfaceHeader((0, import_node_fs17.readFileSync)(original, "utf8")),
11826
- new Set(preparation.nativeHeaderDeclarations[producer]),
11827
- `#import <${producer}/${producer}.h>`
11828
- )
11829
- );
11830
- }
11831
- }
11832
- await runCompiler(
11833
- swift,
11834
- buildArgs,
11835
- appOptions,
11836
- SWIFTPM_PROGRESS,
11837
- SWIFTPM_NOISE
11838
- );
11839
- } catch (error) {
11840
- const output2 = outputOf(error);
11841
- const moduleCache = import_node_path19.default.join(
11842
- root,
11843
- ".build",
11844
- WASM_TRIPLE,
11845
- "release",
11846
- "ModuleCache"
11847
- );
11848
- if (output2.includes("was compiled with module cache path") && (0, import_node_fs17.existsSync)(moduleCache)) {
11849
- (0, import_node_fs17.rmSync)(moduleCache, { recursive: true, force: true });
11850
- try {
11851
- await runCompiler(
11852
- swift,
11853
- buildArgs,
11854
- appOptions,
11855
- SWIFTPM_PROGRESS,
11856
- SWIFTPM_NOISE
11857
- );
11858
- } catch (retryError) {
11859
- throw new Error(
11860
- [
11861
- ...unprepared,
11862
- projectDiagnostic(outputOf(retryError), layout, input.files)
11863
- ].join("\n"),
11864
- { cause: retryError }
11865
- );
11866
- }
11867
- } else {
11834
+ } catch (retryError) {
11868
11835
  throw new Error(
11869
- [...unprepared, projectDiagnostic(output2, layout, input.files)].join(
11870
- "\n"
11871
- ),
11872
- { cause: error }
11836
+ [
11837
+ ...unprepared,
11838
+ projectDiagnostic(outputOf(retryError), layout, input.files)
11839
+ ].join("\n"),
11840
+ { cause: retryError }
11873
11841
  );
11874
11842
  }
11875
- } finally {
11876
- if (options.project) endSwiftProjectProcesses(options.project);
11877
- }
11878
- if (unprepared.length) throw new Error(unprepared.join("\n"));
11879
- if (!(0, import_node_fs17.existsSync)(linked)) {
11880
- const binDir = import_node_path19.default.dirname(linked);
11881
- const found = (0, import_node_fs17.existsSync)(binDir) ? (0, import_node_fs17.readdirSync)(binDir).filter((name2) => name2.endsWith(".wasm")).sort() : [];
11843
+ } else {
11882
11844
  throw new Error(
11883
- `swift-compile: the build produced no ${import_node_path19.default.basename(linked)} (found: ${found.join(", ") || "none"})`
11884
- );
11885
- }
11886
- if (options.project) removeProjectLinks(root);
11887
- const output = options.project ? projectOutputFile(root, linked, options.project) : linked;
11888
- const optimized = `${output}.optimized`;
11889
- if (input.lazyDistribution) {
11890
- pruneSwiftWasmLink(
11891
- root,
11892
- options.toolchainBin,
11893
- frameworkRoot,
11894
- input.staticClangTargets
11845
+ [...unprepared, projectDiagnostic(output2, layout, input.files)].join(
11846
+ "\n"
11847
+ ),
11848
+ { cause: error }
11895
11849
  );
11896
- await optimizeWasm(output, optimized);
11897
11850
  }
11898
- const artifact = {
11899
- hash,
11900
- bytes: (0, import_node_fs17.readFileSync)(input.lazyDistribution ? optimized : output),
11901
- icu: await icu
11902
- };
11903
- if (!options.project) saveCompiledArtifact(root, artifact);
11904
- saveSharedArtifact(sharedRoot, artifact);
11905
- report("compiled artifact verified");
11906
- return retain(root, artifact);
11907
- },
11908
- options.signal
11909
- );
11851
+ } finally {
11852
+ if (options.project) endSwiftProjectProcesses(options.project);
11853
+ }
11854
+ if (unprepared.length) throw new Error(unprepared.join("\n"));
11855
+ if (!(0, import_node_fs17.existsSync)(linked)) {
11856
+ const binDir = import_node_path19.default.dirname(linked);
11857
+ const found = (0, import_node_fs17.existsSync)(binDir) ? (0, import_node_fs17.readdirSync)(binDir).filter((name2) => name2.endsWith(".wasm")).sort() : [];
11858
+ throw new Error(
11859
+ `swift-compile: the build produced no ${import_node_path19.default.basename(linked)} (found: ${found.join(", ") || "none"})`
11860
+ );
11861
+ }
11862
+ if (options.project) removeProjectLinks(root);
11863
+ const output = options.project ? projectOutputFile(root, linked, options.project) : linked;
11864
+ const optimized = `${output}.optimized`;
11865
+ if (input.lazyDistribution) {
11866
+ pruneSwiftWasmLink(
11867
+ root,
11868
+ options.toolchainBin,
11869
+ frameworkRoot,
11870
+ input.staticClangTargets
11871
+ );
11872
+ await optimizeWasm(output, optimized);
11873
+ }
11874
+ const artifact = {
11875
+ hash,
11876
+ bytes: (0, import_node_fs17.readFileSync)(input.lazyDistribution ? optimized : output),
11877
+ icu: await icu
11878
+ };
11879
+ if (!options.project) saveCompiledArtifact(root, artifact);
11880
+ saveSharedArtifact(sharedRoot, artifact);
11881
+ report("compiled artifact verified");
11882
+ return retain(root, artifact);
11883
+ });
11910
11884
  },
11911
11885
  options.signal
11912
11886
  );