peachsim 0.1.1653 → 0.1.1655

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 (111) hide show
  1. package/cli/app-stubs.ts +97 -14
  2. package/cli/bridge-diagnostics.ts +10 -7
  3. package/cli/cloud-client.ts +11 -2
  4. package/cli/commands/doctor.ts +20 -10
  5. package/cli/commands/inspect/core.ts +2 -1
  6. package/cli/commands/inspect/shared.ts +2 -0
  7. package/cli/commands/inspect.ts +11 -2
  8. package/cli/output-redaction.ts +22 -6
  9. package/cli/pause-aware-timeout.ts +24 -10
  10. package/cli/ws-bridge.ts +17 -1
  11. package/dist-lib/agent-daemon-client.cjs +1 -1
  12. package/dist-lib/agent-events.cjs +1 -1
  13. package/dist-lib/attached-projects.cjs +1 -1
  14. package/dist-lib/auth/shared-session.cjs +1 -1
  15. package/dist-lib/backend-origin.cjs +1 -1
  16. package/dist-lib/beta.cjs +1 -1
  17. package/dist-lib/beta.mjs +1 -1
  18. package/dist-lib/bridge-constants.cjs +1 -1
  19. package/dist-lib/bridge-contract-input.cjs +1 -1
  20. package/dist-lib/bridge-contract-input.mjs +1 -1
  21. package/dist-lib/bridge-contract.cjs +1 -1
  22. package/dist-lib/bridge-contract.mjs +1 -1
  23. package/dist-lib/bundle-channel.cjs +277 -244
  24. package/dist-lib/capture-contract.cjs +1 -1
  25. package/dist-lib/capture-contract.mjs +1 -1
  26. package/dist-lib/cloud-contract.cjs +1 -1
  27. package/dist-lib/cloud-contract.mjs +1 -1
  28. package/dist-lib/cloud-test-args.cjs +1 -1
  29. package/dist-lib/cloud-test-args.mjs +1 -1
  30. package/dist-lib/cloud.cjs +1 -1
  31. package/dist-lib/cloud.mjs +1 -1
  32. package/dist-lib/config.cjs +1 -1
  33. package/dist-lib/config.mjs +1 -1
  34. package/dist-lib/detox/index.cjs +47 -12
  35. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  36. package/dist-lib/expo-swift-bundle.cjs +276 -243
  37. package/dist-lib/expo-swift-metadata.cjs +1 -1
  38. package/dist-lib/expo-swift-metadata.mjs +1 -1
  39. package/dist-lib/home-paths.cjs +1 -1
  40. package/dist-lib/host/bridge-host.cjs +320 -246
  41. package/dist-lib/host/fetch-proxy-handler.cjs +191 -31
  42. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  43. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  44. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  45. package/dist-lib/host/websocket-proxy.cjs +1 -1
  46. package/dist-lib/index.cjs +633 -373
  47. package/dist-lib/jump-to-source-babel.cjs +1 -1
  48. package/dist-lib/jump-to-source-native.cjs +1 -1
  49. package/dist-lib/kotlin-host.cjs +1 -1
  50. package/dist-lib/menu.cjs +1 -1
  51. package/dist-lib/menu.mjs +1 -1
  52. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  53. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  54. package/dist-lib/metro-production-bundle.cjs +1 -1
  55. package/dist-lib/metro-production-bundle.mjs +1 -1
  56. package/dist-lib/metro.cjs +62 -14
  57. package/dist-lib/native-app-identity-project.cjs +1 -1
  58. package/dist-lib/native-app-identity-project.mjs +1 -1
  59. package/dist-lib/native-app-identity.cjs +1 -1
  60. package/dist-lib/native-app-identity.mjs +1 -1
  61. package/dist-lib/native-firebase-metadata.cjs +1 -1
  62. package/dist-lib/native-firebase-metadata.mjs +1 -1
  63. package/dist-lib/plist.cjs +1 -1
  64. package/dist-lib/plist.mjs +1 -1
  65. package/dist-lib/profiles.cjs +1 -1
  66. package/dist-lib/public-brand.cjs +1 -1
  67. package/dist-lib/public-origins-lib-esm.json +23 -23
  68. package/dist-lib/public-origins-lib.json +62 -54
  69. package/dist-lib/react-native-host-modules.cjs +1 -1
  70. package/dist-lib/react-native-host-modules.mjs +1 -1
  71. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  72. package/dist-lib/sdk.cjs +2 -2
  73. package/dist-lib/sdk.mjs +2 -2
  74. package/dist-lib/skills.cjs +535 -380
  75. package/dist-lib/swift-compile.cjs +258 -197
  76. package/dist-lib/swift-compile.mjs +257 -197
  77. package/dist-lib/swift-package.cjs +1 -1
  78. package/dist-lib/swift-package.mjs +1 -1
  79. package/dist-lib/swift-submit.cjs +1 -1
  80. package/dist-lib/swift-submit.mjs +1 -1
  81. package/dist-lib/swift-toolchain.cjs +1 -1
  82. package/dist-lib/swift.cjs +1 -1
  83. package/dist-lib/vite-swift.cjs +276 -243
  84. package/dist-lib/vite.cjs +385 -200
  85. package/dist-lib/worklet-executable.cjs +1 -1
  86. package/dist-lib/worklet-executable.mjs +1 -1
  87. package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-gesture-handler.d.ts +1 -0
  88. package/dist-types/packages/peach-compat/src/stubs/screen-transition-math.d.ts +10 -7
  89. package/dist-types/packages/peach-engine/src/capture/browser-composite.d.ts +10 -0
  90. package/dist-types/packages/peach-engine/src/cli-companion.d.ts +1 -0
  91. package/dist-types/packages/peach-engine/src/engine/node.d.ts +3 -1
  92. package/dist-types/packages/peach-engine/src/engine/scene-table.d.ts +1 -1
  93. package/dist-types/packages/peach-engine/src/engine/text-first-baseline.d.ts +23 -0
  94. package/dist-types/packages/peach-engine/src/engine/types.d.ts +1 -1
  95. package/dist-types/packages/peach-engine/src/engine/visible-frame.d.ts +1 -0
  96. package/dist-types/packages/peach-engine/src/observability/types.d.ts +1 -0
  97. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +38 -0
  98. package/dist-types/packages/peach-engine/src/rolldown-bundle-inventory.d.ts +9 -0
  99. package/package.json +5 -1
  100. package/runtime-companion.json +1 -1
  101. package/src/bridge-contract.ts +2 -0
  102. package/src/bundleGlobalFooter.ts +9 -0
  103. package/src/host/fetch-proxy-handler.ts +54 -0
  104. package/src/sfSymbolMetricsContract.ts +268 -0
  105. package/src/swift-compile.ts +302 -238
  106. package/src/swift-distribution.lock.json +20 -46
  107. package/src/swift-objc-metadata.ts +21 -7
  108. package/src/swift-objc-sdk.ts +13 -0
  109. package/src/swiftContract.ts +2 -0
  110. package/src/vite-plugin-one.ts +161 -16
  111. package/src/host/lease-owner.test.ts +0 -49
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1653 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1655 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -49,6 +49,7 @@ __export(swift_compile_exports, {
49
49
  swiftApplicationEntry: () => swiftApplicationEntry,
50
50
  swiftArtifactHash: () => swiftArtifactHash,
51
51
  swiftAvailableModules: () => swiftAvailableModules,
52
+ swiftBuilderHopTimeoutMs: () => swiftBuilderHopTimeoutMs,
52
53
  swiftCodeMask: () => swiftCodeMask,
53
54
  swiftDistributionAt: () => swiftDistributionAt,
54
55
  swiftIcuAsset: () => swiftIcuAsset,
@@ -22767,6 +22768,19 @@ __attribute__((swift_bridge("Swift.String")))
22767
22768
  - (void)appendFormat:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2);
22768
22769
  + (NSMutableString *)stringWithCapacity:(NSUInteger)capacity;
22769
22770
  @end
22771
+ NS_SWIFT_UNAVAILABLE("Use String or NSString instead.")
22772
+ @interface NSSimpleCString : NSString {
22773
+ @package
22774
+ char *bytes;
22775
+ int numBytes;
22776
+ #if __LP64__
22777
+ int _unused;
22778
+ #endif
22779
+ }
22780
+ @end
22781
+ NS_SWIFT_UNAVAILABLE("Use String or NSString instead.")
22782
+ @interface NSConstantString : NSSimpleCString
22783
+ @end
22770
22784
  @interface NSAttributedString : NSObject <NSCopying, NSMutableCopying, NSSecureCoding>
22771
22785
  @property (readonly, copy) NSString *string;
22772
22786
  @end
@@ -25599,6 +25613,11 @@ var SWIFTPM_NOISE = /^(?:\[\d+\/\d+\] |Building for production\.\.\.$|warning: '
25599
25613
  var BUILD_JOBS = String(
25600
25614
  Math.min(4, Math.max(1, Math.floor(import_node_os4.default.availableParallelism() / 2)))
25601
25615
  );
25616
+ var SWIFT_BUILDER_TRANSPORT_MARGIN_MS = 3e5;
25617
+ var SWIFT_BUILDER_DEFAULT_COMPILE_MS = 18e5;
25618
+ function swiftBuilderHopTimeoutMs(compileTimeoutMs) {
25619
+ return (compileTimeoutMs ?? SWIFT_BUILDER_DEFAULT_COMPILE_MS) + SWIFT_BUILDER_TRANSPORT_MARGIN_MS;
25620
+ }
25602
25621
  function swiftDistributionAt(root) {
25603
25622
  const file = import_node_path7.default.join(root, SWIFT_DISTRIBUTION_MANIFEST);
25604
25623
  if (!(0, import_node_fs6.existsSync)(file)) return null;
@@ -25991,7 +26010,7 @@ var EXECUTABLE_LINK_FLAGS = ` "-Xclang-linker", "-O0",
25991
26010
  `;
25992
26011
  var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
25993
26012
  var MULTI_MANIFEST_VERSION = 39;
25994
- var compilerSourceDigest = true ? "f4eb526a3d0d01972f3bb179b60c2b10df37c90e90ad1717a3b4946374cdb248" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
26013
+ var compilerSourceDigest = true ? "042e57f70d169ec5fd94262a87fc4d50da0c31cc6a6c329e56f12d4b7c5484a1" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
25995
26014
  function swiftArtifactHash(input, release, moduleRoot) {
25996
26015
  const hash2 = (0, import_node_crypto7.createHash)("sha256");
25997
26016
  hash2.update(`swift-compile
@@ -30233,6 +30252,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
30233
30252
  ] : compileTargets(input);
30234
30253
  const files = /* @__PURE__ */ new Map();
30235
30254
  const native = /* @__PURE__ */ new Map();
30255
+ const targetFailures = [];
30236
30256
  const bySourcePath = [...targets].sort(
30237
30257
  (left, right) => right.path.length - left.path.length
30238
30258
  );
@@ -30283,188 +30303,212 @@ function writeSwiftProject(layout, input, moduleRoot) {
30283
30303
  if (units.length === 0) continue;
30284
30304
  const settings = input.nativeTargets?.find((value) => value.name === target.name);
30285
30305
  if (entries.some(([file]) => file.endsWith(".swift")) || settings && units.some(([file]) => /\.mm?$/.test(file))) {
30286
- if (!settings)
30287
- throw new Error(
30288
- `mixed target ${target.name} requires its original native target settings; SwiftPM does not compile mixed source targets`
30306
+ const swift = entries.some(([file]) => file.endsWith(".swift"));
30307
+ try {
30308
+ if (!settings)
30309
+ throw new Error(
30310
+ `mixed target ${target.name} requires its original native target settings; SwiftPM does not compile mixed source targets`
30311
+ );
30312
+ const headers = settings.headers;
30313
+ const roots2 = settings.bridgingHeader ? [settings.bridgingHeader] : settings.publicHeaders;
30314
+ for (const file of headers) {
30315
+ const destination = import_node_path7.default.join(layout.root, file);
30316
+ (0, import_node_fs6.mkdirSync)(import_node_path7.default.dirname(destination), { recursive: true });
30317
+ (0, import_node_fs6.writeFileSync)(destination, input.files[file]);
30318
+ }
30319
+ const search = [
30320
+ .../* @__PURE__ */ new Set([
30321
+ ...settings?.headerSearchPaths ?? [],
30322
+ ...headers.map((file) => import_node_path7.default.posix.dirname(file))
30323
+ ])
30324
+ ].flatMap((dir) => ["-I", import_node_path7.default.join(layout.root, dir)]);
30325
+ const pin = distribution ?? JSON.parse((0, import_node_fs6.readFileSync)(import_node_path7.default.join(moduleRoot, "toolchain.json"), "utf8"));
30326
+ const release = pin.release;
30327
+ const toolchainBin = swiftToolchain(release, swiftModuleSdk(moduleRoot));
30328
+ const sdkHeaders = materializeObjcSdk(
30329
+ import_node_path7.default.join(layout.root, ".build", "peach-objc-sdk")
30289
30330
  );
30290
- const headers = settings.headers;
30291
- const roots2 = settings.bridgingHeader ? [settings.bridgingHeader] : settings.publicHeaders;
30292
- if (!roots2.length)
30293
- throw new Error(`mixed target ${target.name} has no original declaration headers`);
30294
- for (const file of headers) {
30295
- const destination = import_node_path7.default.join(layout.root, file);
30296
- (0, import_node_fs6.mkdirSync)(import_node_path7.default.dirname(destination), { recursive: true });
30297
- (0, import_node_fs6.writeFileSync)(destination, input.files[file]);
30298
- }
30299
- const search = [
30300
- .../* @__PURE__ */ new Set([
30301
- ...settings?.headerSearchPaths ?? [],
30302
- ...headers.map((file) => import_node_path7.default.posix.dirname(file))
30303
- ])
30304
- ].flatMap((dir) => ["-I", import_node_path7.default.join(layout.root, dir)]);
30305
- const pin = distribution ?? JSON.parse((0, import_node_fs6.readFileSync)(import_node_path7.default.join(moduleRoot, "toolchain.json"), "utf8"));
30306
- const release = pin.release;
30307
- const toolchainBin = swiftToolchain(release, swiftModuleSdk(moduleRoot));
30308
- const sdkHeaders = materializeObjcSdk(
30309
- import_node_path7.default.join(layout.root, ".build", "peach-objc-sdk")
30310
- );
30311
- const stageFlags = (flags2, sdkInclude) => flags2.map(
30312
- (flag) => flag.replaceAll(SWIFT_NATIVE_INPUT_ROOT, layout.root).replaceAll(SWIFT_NATIVE_SDK_INCLUDE, sdkInclude)
30313
- );
30314
- const originalFlags = [
30315
- ...settings?.flags ?? [],
30316
- ...search,
30317
- ...(settings?.frameworkSearchPaths ?? []).flatMap((dir) => [
30318
- "-F",
30319
- import_node_path7.default.join(layout.root, dir)
30320
- ]),
30321
- "-I",
30322
- headerDirectory
30323
- ];
30324
- const flags = stageFlags(
30325
- originalFlags,
30326
- import_node_path7.default.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
30327
- );
30328
- const prefixHeader = settings?.prefixHeader ? ["-include", import_node_path7.default.join(layout.root, settings.prefixHeader)] : [];
30329
- const bundleName = entries.some(([file]) => file.endsWith(".swift")) ? void 0 : swiftObjCResourceBundleName({
30330
- target: target.name,
30331
- path: target.path,
30332
- resources: resourceTargets.find((candidate) => candidate.name === target.name)?.resources ?? false,
30333
- usesBundleMacro: entries.some(
30334
- ([file, contents]) => /\.(?:c|cc|cpp|cxx|m|mm|h|hpp|hh|hxx)$/.test(file) && /\bSWIFTPM_MODULE_BUNDLE\b/.test(contents)
30335
- ),
30336
- bundles: input.resourceBundles
30337
- });
30338
- const accessor = bundleName === void 0 ? void 0 : swiftObjCResourceAccessor(bundleName);
30339
- const accessorHeader = import_node_path7.default.join(
30340
- layout.root,
30341
- target.path,
30342
- OBJC_RESOURCE_ACCESSOR_HEADER
30343
- );
30344
- const accessorUnit = `${prefix}${OBJC_RESOURCE_ACCESSOR_BODY}`;
30345
- if (accessor && (input.files[accessorUnit] !== void 0 || input.files[`${prefix}${OBJC_RESOURCE_ACCESSOR_HEADER}`] !== void 0))
30346
- throw new Error(`target ${target.name} already contains its resource accessor`);
30347
- const nativeUnits = accessor ? [...units, [accessorUnit, accessor.body]] : units;
30348
- const accessorFlags = accessor ? ["-include", accessorHeader] : [];
30349
- if (accessor) {
30350
- files.set(accessorHeader, accessor.header);
30351
- files.set(import_node_path7.default.join(layout.root, accessorUnit), accessor.body);
30352
- }
30353
- const sourceHeaders = import_node_path7.default.join(
30354
- layout.root,
30355
- ".build",
30356
- "peach-objc-originals",
30357
- target.name
30358
- );
30359
- (0, import_node_fs6.mkdirSync)(sourceHeaders, { recursive: true });
30360
- const modulemap = import_node_path7.default.join(sourceHeaders, "module.modulemap");
30361
- (0, import_node_fs6.writeFileSync)(
30362
- modulemap,
30363
- `module ${swiftTargetModuleName(target.name)} {
30331
+ const stageFlags = (flags2, sdkInclude) => flags2.map(
30332
+ (flag) => flag.replaceAll(SWIFT_NATIVE_INPUT_ROOT, layout.root).replaceAll(SWIFT_NATIVE_SDK_INCLUDE, sdkInclude)
30333
+ );
30334
+ const originalFlags = [
30335
+ ...settings?.flags ?? [],
30336
+ ...search,
30337
+ ...(settings?.frameworkSearchPaths ?? []).flatMap((dir) => [
30338
+ "-F",
30339
+ import_node_path7.default.join(layout.root, dir)
30340
+ ]),
30341
+ "-I",
30342
+ headerDirectory
30343
+ ];
30344
+ const flags = stageFlags(
30345
+ originalFlags,
30346
+ import_node_path7.default.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
30347
+ );
30348
+ const prefixHeader = settings?.prefixHeader ? ["-include", import_node_path7.default.join(layout.root, settings.prefixHeader)] : [];
30349
+ const bundleName = entries.some(([file]) => file.endsWith(".swift")) ? void 0 : swiftObjCResourceBundleName({
30350
+ target: target.name,
30351
+ path: target.path,
30352
+ resources: resourceTargets.find((candidate) => candidate.name === target.name)?.resources ?? false,
30353
+ usesBundleMacro: entries.some(
30354
+ ([file, contents]) => /\.(?:c|cc|cpp|cxx|m|mm|h|hpp|hh|hxx)$/.test(file) && /\bSWIFTPM_MODULE_BUNDLE\b/.test(contents)
30355
+ ),
30356
+ bundles: input.resourceBundles
30357
+ });
30358
+ const accessor = bundleName === void 0 ? void 0 : swiftObjCResourceAccessor(bundleName);
30359
+ const accessorHeader = import_node_path7.default.join(
30360
+ layout.root,
30361
+ target.path,
30362
+ OBJC_RESOURCE_ACCESSOR_HEADER
30363
+ );
30364
+ const accessorUnit = `${prefix}${OBJC_RESOURCE_ACCESSOR_BODY}`;
30365
+ if (accessor && (input.files[accessorUnit] !== void 0 || input.files[`${prefix}${OBJC_RESOURCE_ACCESSOR_HEADER}`] !== void 0))
30366
+ throw new Error(`target ${target.name} already contains its resource accessor`);
30367
+ const nativeUnits = accessor ? [...units, [accessorUnit, accessor.body]] : units;
30368
+ const accessorFlags = accessor ? ["-include", accessorHeader] : [];
30369
+ if (accessor) {
30370
+ files.set(accessorHeader, accessor.header);
30371
+ files.set(import_node_path7.default.join(layout.root, accessorUnit), accessor.body);
30372
+ }
30373
+ if (roots2.length) {
30374
+ const sourceHeaders = import_node_path7.default.join(
30375
+ layout.root,
30376
+ ".build",
30377
+ "peach-objc-originals",
30378
+ target.name
30379
+ );
30380
+ (0, import_node_fs6.mkdirSync)(sourceHeaders, { recursive: true });
30381
+ const modulemap = import_node_path7.default.join(sourceHeaders, "module.modulemap");
30382
+ (0, import_node_fs6.writeFileSync)(
30383
+ modulemap,
30384
+ `module ${swiftTargetModuleName(target.name)} {
30364
30385
  ${roots2.map((file) => `header ${JSON.stringify(import_node_path7.default.join(layout.root, file))}`).join("\n")}
30365
30386
  export *
30366
30387
  }
30367
30388
  `
30368
- );
30369
- const view = objcView(
30370
- { module: swiftTargetModuleName(target.name), headers: sourceHeaders, modulemap },
30371
- toolchainBin,
30372
- import_node_path7.default.join(moduleRoot, "ios-simulator-stdlib"),
30373
- import_node_path7.default.join(layout.root, ".build", "peach-objc-sdk"),
30374
- import_node_path7.default.join(layout.root, ".build", "peach-objc-imports", target.name),
30375
- {
30376
- flags: stageFlags(originalFlags, import_node_path7.default.join(sdkHeaders, "usr/include")),
30377
- target: `arm64-apple-ios${settings?.deploymentTarget ?? "16.0"}-simulator`
30378
- }
30379
- );
30380
- const defined = /* @__PURE__ */ new Set();
30381
- const declarations = (node) => {
30382
- if (!node || typeof node !== "object") return;
30383
- const name2 = Reflect.get(node, "name");
30384
- if (Reflect.get(node, "kind") === "ObjCInterfaceDecl" && Reflect.get(node, "super") && typeof name2 === "string")
30385
- defined.add(name2);
30386
- const children = Reflect.get(node, "inner");
30387
- if (Array.isArray(children)) for (const child of children) declarations(child);
30388
- };
30389
- declarations(view.clangAST);
30390
- const foreignTypes = /* @__PURE__ */ new Map();
30391
- for (const graph of view.graphs)
30392
- for (const symbol of graph.symbols) {
30393
- const nativeName = /^c:objc\(cs\)(\w+)$/.exec(symbol.identifier.precise)?.[1];
30394
- if (nativeName && defined.has(nativeName))
30395
- foreignTypes.set(symbol.pathComponents[0], nativeName);
30389
+ );
30390
+ const view = objcView(
30391
+ {
30392
+ module: swiftTargetModuleName(target.name),
30393
+ headers: sourceHeaders,
30394
+ modulemap
30395
+ },
30396
+ toolchainBin,
30397
+ import_node_path7.default.join(moduleRoot, "ios-simulator-stdlib"),
30398
+ import_node_path7.default.join(layout.root, ".build", "peach-objc-sdk"),
30399
+ import_node_path7.default.join(layout.root, ".build", "peach-objc-imports", target.name),
30400
+ {
30401
+ flags: stageFlags(originalFlags, import_node_path7.default.join(sdkHeaders, "usr/include")),
30402
+ target: `arm64-apple-ios${settings?.deploymentTarget ?? "16.0"}-simulator`
30403
+ }
30404
+ );
30405
+ const defined = /* @__PURE__ */ new Set();
30406
+ const declarations = (node) => {
30407
+ if (!node || typeof node !== "object") return;
30408
+ const name2 = Reflect.get(node, "name");
30409
+ if (Reflect.get(node, "kind") === "ObjCInterfaceDecl" && Reflect.get(node, "super") && typeof name2 === "string")
30410
+ defined.add(name2);
30411
+ const children = Reflect.get(node, "inner");
30412
+ if (Array.isArray(children)) for (const child of children) declarations(child);
30413
+ };
30414
+ declarations(view.clangAST);
30415
+ const foreignTypes = /* @__PURE__ */ new Map();
30416
+ for (const graph of view.graphs)
30417
+ for (const symbol of graph.symbols) {
30418
+ const nativeName = /^c:objc\(cs\)(\w+)$/.exec(
30419
+ symbol.identifier.precise
30420
+ )?.[1];
30421
+ if (nativeName && defined.has(nativeName))
30422
+ foreignTypes.set(symbol.pathComponents[0], nativeName);
30423
+ }
30424
+ imports.set(target.name, {
30425
+ view,
30426
+ classes: [...foreignTypes.values()],
30427
+ headers: roots2.map((file) => import_node_path7.default.join(layout.root, file)),
30428
+ foreignTypes
30429
+ });
30396
30430
  }
30397
- imports.set(target.name, {
30398
- view,
30399
- classes: [...foreignTypes.values()],
30400
- headers: roots2.map((file) => import_node_path7.default.join(layout.root, file)),
30401
- foreignTypes
30402
- });
30403
- const thunk = "PeachObjCImports.generated.m";
30404
- const groups = /* @__PURE__ */ new Map();
30405
- for (const [file] of nativeUnits) {
30406
- const origin = settings?.sourceDirectories[file];
30407
- if (origin) (0, import_node_fs6.mkdirSync)(import_node_path7.default.join(layout.root, origin), { recursive: true });
30408
- const perFile = [
30409
- ...origin ? ["-iquote", import_node_path7.default.join(layout.root, origin)] : [],
30410
- ...stageFlags(
30411
- settings?.fileFlags[file] ?? [],
30412
- import_node_path7.default.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
30413
- )
30414
- ];
30415
- const cxx = /\.(?:cc|cpp|cxx|mm)$/.test(file);
30416
- const identity = (0, import_node_crypto7.createHash)("sha256").update(JSON.stringify([cxx, perFile])).digest("hex").slice(0, 12);
30417
- const group = groups.get(identity) ?? {
30418
- name: `${target.name}SwiftImplementation_${identity}`,
30419
- sources: [],
30420
- flags: [...flags, ...prefixHeader, ...accessorFlags, ...perFile],
30421
- cxxFlags: [
30422
- ...flags,
30423
- ...prefixHeader,
30424
- ...accessorFlags,
30431
+ const thunks = roots2.length ? ["PeachObjCImports.generated.m"] : [];
30432
+ const groups = /* @__PURE__ */ new Map();
30433
+ for (const [file] of nativeUnits) {
30434
+ const origin = settings?.sourceDirectories[file];
30435
+ if (origin) (0, import_node_fs6.mkdirSync)(import_node_path7.default.join(layout.root, origin), { recursive: true });
30436
+ const perFile = [
30437
+ ...origin ? ["-iquote", import_node_path7.default.join(layout.root, origin)] : [],
30425
30438
  ...stageFlags(
30426
- cxx ? settings.cxxFlags : [],
30439
+ settings?.fileFlags[file] ?? [],
30427
30440
  import_node_path7.default.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
30428
- ),
30429
- ...perFile
30430
- ]
30431
- };
30432
- group.sources.push(file.slice(prefix.length));
30433
- groups.set(identity, group);
30434
- }
30435
- groups.set("imports", {
30436
- name: `${target.name}ObjCImports`,
30437
- sources: [thunk],
30438
- flags: [...flags, "-fobjc-arc"],
30439
- cxxFlags: [...flags, "-fobjc-arc"]
30440
- });
30441
- const include2 = import_node_path7.default.join(layout.root, target.path, "include");
30442
- files.set(
30443
- import_node_path7.default.join(include2, "module.modulemap"),
30444
- `module ${target.name}ImplementationDeclarations { export * }
30445
- `
30446
- );
30447
- native.set(target.name, {
30448
- mixed: true,
30449
- path: target.path,
30450
- includeDirectory: include2,
30451
- sources: nativeUnits.map(([file]) => file.slice(prefix.length)),
30452
- lateSources: [...nativeUnits.map(([file]) => file.slice(prefix.length)), thunk],
30453
- exclude: [
30454
- ...entries.filter(([file]) => !file.endsWith(".swift") && !file.endsWith(".metal")).map(([file]) => file.slice(prefix.length)),
30455
- ...accessor ? [OBJC_RESOURCE_ACCESSOR_HEADER, OBJC_RESOURCE_ACCESSOR_BODY] : [],
30456
- thunk,
30457
- "include"
30458
- ],
30459
- groups: [...groups.values()],
30460
- late: {
30461
- name: `${target.name}SwiftImplementation`,
30462
- producers: [
30463
- target.name,
30464
- ...(target.dependencies ?? []).filter((dependency) => swiftTargets.has(dependency.name)).map((dependency) => dependency.name)
30465
- ]
30441
+ )
30442
+ ];
30443
+ const cxx = /\.(?:cc|cpp|cxx|mm)$/.test(file);
30444
+ const identity = (0, import_node_crypto7.createHash)("sha256").update(JSON.stringify([cxx, perFile])).digest("hex").slice(0, 12);
30445
+ const group = groups.get(identity) ?? {
30446
+ name: `${target.name}SwiftImplementation_${identity}`,
30447
+ sources: [],
30448
+ flags: [...flags, ...prefixHeader, ...accessorFlags, ...perFile],
30449
+ cxxFlags: [
30450
+ ...flags,
30451
+ ...prefixHeader,
30452
+ ...accessorFlags,
30453
+ ...stageFlags(
30454
+ cxx ? settings.cxxFlags : [],
30455
+ import_node_path7.default.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
30456
+ ),
30457
+ ...perFile
30458
+ ]
30459
+ };
30460
+ group.sources.push(file.slice(prefix.length));
30461
+ groups.set(identity, group);
30466
30462
  }
30467
- });
30463
+ if (thunks.length)
30464
+ groups.set("imports", {
30465
+ name: `${target.name}ObjCImports`,
30466
+ sources: thunks,
30467
+ flags: [...flags, "-fobjc-arc"],
30468
+ cxxFlags: [...flags, "-fobjc-arc"]
30469
+ });
30470
+ const include2 = import_node_path7.default.join(layout.root, target.path, "include");
30471
+ files.set(
30472
+ import_node_path7.default.join(include2, "module.modulemap"),
30473
+ `module ${target.name}ImplementationDeclarations { export * }
30474
+ `
30475
+ );
30476
+ native.set(target.name, {
30477
+ mixed: true,
30478
+ path: target.path,
30479
+ includeDirectory: include2,
30480
+ sources: nativeUnits.map(([file]) => file.slice(prefix.length)),
30481
+ lateSources: [
30482
+ ...nativeUnits.map(([file]) => file.slice(prefix.length)),
30483
+ ...thunks
30484
+ ],
30485
+ exclude: [
30486
+ ...entries.filter(([file]) => !file.endsWith(".swift") && !file.endsWith(".metal")).map(([file]) => file.slice(prefix.length)),
30487
+ ...accessor ? [OBJC_RESOURCE_ACCESSOR_HEADER, OBJC_RESOURCE_ACCESSOR_BODY] : [],
30488
+ ...thunks,
30489
+ "include"
30490
+ ],
30491
+ groups: [...groups.values()],
30492
+ late: {
30493
+ name: `${target.name}SwiftImplementation`,
30494
+ producers: [
30495
+ target.name,
30496
+ ...(target.dependencies ?? []).filter((dependency) => swiftTargets.has(dependency.name)).map((dependency) => dependency.name)
30497
+ ]
30498
+ }
30499
+ });
30500
+ } catch (error) {
30501
+ if (!swift || !(error instanceof Error)) throw error;
30502
+ targetFailures.push(`${target.name}: ${error.message}`);
30503
+ native.set(target.name, {
30504
+ mixed: true,
30505
+ path: target.path,
30506
+ includeDirectory: import_node_path7.default.join(layout.root, target.path, "include"),
30507
+ sources: [],
30508
+ lateSources: [],
30509
+ exclude: entries.filter(([file]) => !file.endsWith(".swift") && !file.endsWith(".metal")).map(([file]) => file.slice(prefix.length))
30510
+ });
30511
+ }
30468
30512
  continue;
30469
30513
  }
30470
30514
  const includes = `${prefix}include/`;
@@ -30627,20 +30671,27 @@ export *
30627
30671
  for (const name2 of objcProducers) {
30628
30672
  const target = targets.find((value) => value.name === name2);
30629
30673
  const prefix = target.path === "." ? "" : `${target.path}/`;
30630
- const exported = swiftObjCExports({
30631
- module: swiftTargetModuleName(name2),
30632
- sources: Object.entries(input.files).filter(
30633
- ([file]) => file.startsWith(prefix) && file.endsWith(".swift") && !targets.some(
30634
- (candidate) => candidate.name !== name2 && candidate.path !== "." && candidate.path.startsWith(prefix) && file.startsWith(`${candidate.path}/`)
30635
- ) && !target.exclude?.some(
30636
- (excluded) => file.slice(prefix.length) === excluded || file.slice(prefix.length).startsWith(`${excluded}/`)
30637
- )
30638
- ),
30639
- mask: swiftCodeMask,
30640
- declarationStart,
30641
- selector: objcSelectorName,
30642
- foreignTypes: imports.get(name2)?.foreignTypes
30643
- });
30674
+ let exported;
30675
+ try {
30676
+ exported = swiftObjCExports({
30677
+ module: swiftTargetModuleName(name2),
30678
+ sources: Object.entries(input.files).filter(
30679
+ ([file]) => file.startsWith(prefix) && file.endsWith(".swift") && !targets.some(
30680
+ (candidate) => candidate.name !== name2 && candidate.path !== "." && candidate.path.startsWith(prefix) && file.startsWith(`${candidate.path}/`)
30681
+ ) && !target.exclude?.some(
30682
+ (excluded) => file.slice(prefix.length) === excluded || file.slice(prefix.length).startsWith(`${excluded}/`)
30683
+ )
30684
+ ),
30685
+ mask: swiftCodeMask,
30686
+ declarationStart,
30687
+ selector: objcSelectorName,
30688
+ foreignTypes: imports.get(name2)?.foreignTypes
30689
+ });
30690
+ } catch (error) {
30691
+ if (!(error instanceof Error)) throw error;
30692
+ targetFailures.push(`${name2}: ${error.message}`);
30693
+ continue;
30694
+ }
30644
30695
  const original = imports.get(name2);
30645
30696
  if (!exported && !original) continue;
30646
30697
  objcModules.add(name2);
@@ -30912,6 +30963,7 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
30912
30963
  for (const dependency of dependencies.get(producer) ?? []) include(dependency);
30913
30964
  return {
30914
30965
  headerProducers: producers.filter((name2) => !included.has(name2)),
30966
+ targetFailures,
30915
30967
  ...rootOwner && objcExports ? {
30916
30968
  objcImplementations: {
30917
30969
  owner: import_node_path7.default.join(layout.root, rootOwner),
@@ -31102,7 +31154,7 @@ function compileSwiftProjectUnit(input, options) {
31102
31154
  ],
31103
31155
  {
31104
31156
  cwd: repo,
31105
- timeout: options.timeoutMs,
31157
+ timeout: options.timeoutMs === void 0 ? void 0 : swiftBuilderHopTimeoutMs(options.timeoutMs),
31106
31158
  maxBuffer: 64 * 1024 * 1024,
31107
31159
  signal: options.signal
31108
31160
  },
@@ -31134,6 +31186,9 @@ function compileSwiftProjectUnit(input, options) {
31134
31186
  return retain(root, built);
31135
31187
  }
31136
31188
  const preparation = writeSwiftProject(layout, input, moduleRoot);
31189
+ const unprepared = preparation.targetFailures.map(
31190
+ (failure) => `error: target ${failure}`
31191
+ );
31137
31192
  const swift = import_node_path7.default.join(options.toolchainBin, "swift");
31138
31193
  if (!(0, import_node_fs6.existsSync)(swift)) {
31139
31194
  throw new Error(
@@ -31283,18 +31338,23 @@ function compileSwiftProjectUnit(input, options) {
31283
31338
  );
31284
31339
  } catch (retryError) {
31285
31340
  throw new Error(
31286
- projectDiagnostic(outputOf(retryError), layout, input.files),
31287
- {
31288
- cause: retryError
31289
- }
31341
+ [
31342
+ ...unprepared,
31343
+ projectDiagnostic(outputOf(retryError), layout, input.files)
31344
+ ].join("\n"),
31345
+ { cause: retryError }
31290
31346
  );
31291
31347
  }
31292
31348
  } else {
31293
- throw new Error(projectDiagnostic(output, layout, input.files), {
31294
- cause: error
31295
- });
31349
+ throw new Error(
31350
+ [...unprepared, projectDiagnostic(output, layout, input.files)].join(
31351
+ "\n"
31352
+ ),
31353
+ { cause: error }
31354
+ );
31296
31355
  }
31297
31356
  }
31357
+ if (unprepared.length) throw new Error(unprepared.join("\n"));
31298
31358
  const artifact = {
31299
31359
  hash: hash2,
31300
31360
  bytes: (0, import_node_fs6.readFileSync)(builtArtifact(layout)),
@@ -31330,6 +31390,7 @@ function compileSwiftProjectUnit(input, options) {
31330
31390
  swiftApplicationEntry,
31331
31391
  swiftArtifactHash,
31332
31392
  swiftAvailableModules,
31393
+ swiftBuilderHopTimeoutMs,
31333
31394
  swiftCodeMask,
31334
31395
  swiftDistributionAt,
31335
31396
  swiftIcuAsset,