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;
@@ -9903,9 +9903,11 @@ ${prefix}${json}${suffix}`;
9903
9903
  const identity = findBundleFooter(source, "globalThis.__sootsimModulePaths=");
9904
9904
  return identity < 0 ? source + footer : source.slice(0, identity) + footer + source.slice(identity);
9905
9905
  }
9906
+ var ROLLDOWN_INVENTORY_HEADER;
9906
9907
  var init_bundleGlobalFooter = __esm({
9907
9908
  "src/bundleGlobalFooter.ts"() {
9908
9909
  "use strict";
9910
+ ROLLDOWN_INVENTORY_HEADER = "X-Peach-Rolldown-Inventory";
9909
9911
  }
9910
9912
  });
9911
9913
 
@@ -10026,7 +10028,7 @@ var init_runtime_assets = __esm({
10026
10028
  var runtime_companion_default;
10027
10029
  var init_runtime_companion = __esm({
10028
10030
  "runtime-companion.json"() {
10029
- runtime_companion_default = { abi: 1, sha256: "d58f0fedc3c0065faaafcf578781567b6cdac88e5c062a8354111d37fdf3c465", file: "node/cli-d58f0fedc3c0065faaafcf578781567b6cdac88e5c062a8354111d37fdf3c465.cjs" };
10031
+ runtime_companion_default = { abi: 1, sha256: "6f6a55398d832d1703346a258bf9f81bf78fded8cf5d83cdf51e5e15ccd7a1ce", file: "node/cli-6f6a55398d832d1703346a258bf9f81bf78fded8cf5d83cdf51e5e15ccd7a1ce.cjs" };
10030
10032
  }
10031
10033
  });
10032
10034
 
@@ -13599,9 +13601,12 @@ async function buildRnxCloudArtifact(bundle, options = {}) {
13599
13601
  if (getCliRuntime().preview_bundle_layout.isRolldownBundle(bundle)) {
13600
13602
  if (mode !== "production")
13601
13603
  throw new Error("peach Cloud One artifacts require a production bundle");
13604
+ const { attachRolldownBundleInventory, stripRolldownBundleInventoryFooter } = getCliRuntime().rolldown_bundle_inventory;
13602
13605
  const { readRolldownProductionInput } = getCliRuntime().rolldown_production_fingerprint;
13603
- code = (0, import_metro_production_bundle.detachRNXMetroSourceMapUrl)(bundle).source;
13604
- modules = (await readRolldownProductionInput(code)).modules.length;
13606
+ const raw2 = (0, import_metro_production_bundle.detachRNXMetroSourceMapUrl)(bundle).source;
13607
+ const annotated = await attachRolldownBundleInventory(raw2);
13608
+ modules = (await readRolldownProductionInput(annotated)).modules.length;
13609
+ code = stripRolldownBundleInventoryFooter(annotated);
13605
13610
  } else {
13606
13611
  const hostVersionEvidence = readHostVersionEvidence(bundle);
13607
13612
  const autolinked = detachAndroidAutolinkingFooter(bundle);
@@ -30802,6 +30807,19 @@ __attribute__((swift_bridge("Swift.String")))
30802
30807
  - (void)appendFormat:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2);
30803
30808
  + (NSMutableString *)stringWithCapacity:(NSUInteger)capacity;
30804
30809
  @end
30810
+ NS_SWIFT_UNAVAILABLE("Use String or NSString instead.")
30811
+ @interface NSSimpleCString : NSString {
30812
+ @package
30813
+ char *bytes;
30814
+ int numBytes;
30815
+ #if __LP64__
30816
+ int _unused;
30817
+ #endif
30818
+ }
30819
+ @end
30820
+ NS_SWIFT_UNAVAILABLE("Use String or NSString instead.")
30821
+ @interface NSConstantString : NSSimpleCString
30822
+ @end
30805
30823
  @interface NSAttributedString : NSObject <NSCopying, NSMutableCopying, NSSecureCoding>
30806
30824
  @property (readonly, copy) NSString *string;
30807
30825
  @end
@@ -33773,6 +33791,11 @@ var SWIFTPM_NOISE = /^(?:\[\d+\/\d+\] |Building for production\.\.\.$|warning: '
33773
33791
  var BUILD_JOBS = String(
33774
33792
  Math.min(4, Math.max(1, Math.floor(import_node_os5.default.availableParallelism() / 2)))
33775
33793
  );
33794
+ var SWIFT_BUILDER_TRANSPORT_MARGIN_MS = 3e5;
33795
+ var SWIFT_BUILDER_DEFAULT_COMPILE_MS = 18e5;
33796
+ function swiftBuilderHopTimeoutMs(compileTimeoutMs) {
33797
+ return (compileTimeoutMs ?? SWIFT_BUILDER_DEFAULT_COMPILE_MS) + SWIFT_BUILDER_TRANSPORT_MARGIN_MS;
33798
+ }
33776
33799
  function swiftDistributionAt(root) {
33777
33800
  const file = import_node_path11.default.join(root, SWIFT_DISTRIBUTION_MANIFEST);
33778
33801
  if (!(0, import_node_fs12.existsSync)(file)) return null;
@@ -34161,7 +34184,7 @@ var EXECUTABLE_LINK_FLAGS = ` "-Xclang-linker", "-O0",
34161
34184
  `;
34162
34185
  var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
34163
34186
  var MULTI_MANIFEST_VERSION = 39;
34164
- var compilerSourceDigest = true ? "f4eb526a3d0d01972f3bb179b60c2b10df37c90e90ad1717a3b4946374cdb248" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
34187
+ var compilerSourceDigest = true ? "042e57f70d169ec5fd94262a87fc4d50da0c31cc6a6c329e56f12d4b7c5484a1" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
34165
34188
  function swiftArtifactHash(input, release, moduleRoot) {
34166
34189
  const hash2 = (0, import_node_crypto9.createHash)("sha256");
34167
34190
  hash2.update(`swift-compile
@@ -38358,6 +38381,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
38358
38381
  ] : compileTargets(input);
38359
38382
  const files2 = /* @__PURE__ */ new Map();
38360
38383
  const native = /* @__PURE__ */ new Map();
38384
+ const targetFailures = [];
38361
38385
  const bySourcePath = [...targets].sort(
38362
38386
  (left, right) => right.path.length - left.path.length
38363
38387
  );
@@ -38408,188 +38432,212 @@ function writeSwiftProject(layout, input, moduleRoot) {
38408
38432
  if (units.length === 0) continue;
38409
38433
  const settings = input.nativeTargets?.find((value) => value.name === target.name);
38410
38434
  if (entries.some(([file]) => file.endsWith(".swift")) || settings && units.some(([file]) => /\.mm?$/.test(file))) {
38411
- if (!settings)
38412
- throw new Error(
38413
- `mixed target ${target.name} requires its original native target settings; SwiftPM does not compile mixed source targets`
38435
+ const swift = entries.some(([file]) => file.endsWith(".swift"));
38436
+ try {
38437
+ if (!settings)
38438
+ throw new Error(
38439
+ `mixed target ${target.name} requires its original native target settings; SwiftPM does not compile mixed source targets`
38440
+ );
38441
+ const headers = settings.headers;
38442
+ const roots2 = settings.bridgingHeader ? [settings.bridgingHeader] : settings.publicHeaders;
38443
+ for (const file of headers) {
38444
+ const destination = import_node_path11.default.join(layout.root, file);
38445
+ (0, import_node_fs12.mkdirSync)(import_node_path11.default.dirname(destination), { recursive: true });
38446
+ (0, import_node_fs12.writeFileSync)(destination, input.files[file]);
38447
+ }
38448
+ const search = [
38449
+ .../* @__PURE__ */ new Set([
38450
+ ...settings?.headerSearchPaths ?? [],
38451
+ ...headers.map((file) => import_node_path11.default.posix.dirname(file))
38452
+ ])
38453
+ ].flatMap((dir) => ["-I", import_node_path11.default.join(layout.root, dir)]);
38454
+ const pin = distribution ?? JSON.parse((0, import_node_fs12.readFileSync)(import_node_path11.default.join(moduleRoot, "toolchain.json"), "utf8"));
38455
+ const release = pin.release;
38456
+ const toolchainBin = swiftToolchain(release, swiftModuleSdk(moduleRoot));
38457
+ const sdkHeaders = materializeObjcSdk(
38458
+ import_node_path11.default.join(layout.root, ".build", "peach-objc-sdk")
38414
38459
  );
38415
- const headers = settings.headers;
38416
- const roots2 = settings.bridgingHeader ? [settings.bridgingHeader] : settings.publicHeaders;
38417
- if (!roots2.length)
38418
- throw new Error(`mixed target ${target.name} has no original declaration headers`);
38419
- for (const file of headers) {
38420
- const destination = import_node_path11.default.join(layout.root, file);
38421
- (0, import_node_fs12.mkdirSync)(import_node_path11.default.dirname(destination), { recursive: true });
38422
- (0, import_node_fs12.writeFileSync)(destination, input.files[file]);
38423
- }
38424
- const search = [
38425
- .../* @__PURE__ */ new Set([
38426
- ...settings?.headerSearchPaths ?? [],
38427
- ...headers.map((file) => import_node_path11.default.posix.dirname(file))
38428
- ])
38429
- ].flatMap((dir) => ["-I", import_node_path11.default.join(layout.root, dir)]);
38430
- const pin = distribution ?? JSON.parse((0, import_node_fs12.readFileSync)(import_node_path11.default.join(moduleRoot, "toolchain.json"), "utf8"));
38431
- const release = pin.release;
38432
- const toolchainBin = swiftToolchain(release, swiftModuleSdk(moduleRoot));
38433
- const sdkHeaders = materializeObjcSdk(
38434
- import_node_path11.default.join(layout.root, ".build", "peach-objc-sdk")
38435
- );
38436
- const stageFlags = (flags2, sdkInclude) => flags2.map(
38437
- (flag) => flag.replaceAll(SWIFT_NATIVE_INPUT_ROOT, layout.root).replaceAll(SWIFT_NATIVE_SDK_INCLUDE, sdkInclude)
38438
- );
38439
- const originalFlags = [
38440
- ...settings?.flags ?? [],
38441
- ...search,
38442
- ...(settings?.frameworkSearchPaths ?? []).flatMap((dir) => [
38443
- "-F",
38444
- import_node_path11.default.join(layout.root, dir)
38445
- ]),
38446
- "-I",
38447
- headerDirectory
38448
- ];
38449
- const flags = stageFlags(
38450
- originalFlags,
38451
- import_node_path11.default.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
38452
- );
38453
- const prefixHeader = settings?.prefixHeader ? ["-include", import_node_path11.default.join(layout.root, settings.prefixHeader)] : [];
38454
- const bundleName = entries.some(([file]) => file.endsWith(".swift")) ? void 0 : swiftObjCResourceBundleName({
38455
- target: target.name,
38456
- path: target.path,
38457
- resources: resourceTargets.find((candidate) => candidate.name === target.name)?.resources ?? false,
38458
- usesBundleMacro: entries.some(
38459
- ([file, contents]) => /\.(?:c|cc|cpp|cxx|m|mm|h|hpp|hh|hxx)$/.test(file) && /\bSWIFTPM_MODULE_BUNDLE\b/.test(contents)
38460
- ),
38461
- bundles: input.resourceBundles
38462
- });
38463
- const accessor = bundleName === void 0 ? void 0 : swiftObjCResourceAccessor(bundleName);
38464
- const accessorHeader = import_node_path11.default.join(
38465
- layout.root,
38466
- target.path,
38467
- OBJC_RESOURCE_ACCESSOR_HEADER
38468
- );
38469
- const accessorUnit = `${prefix}${OBJC_RESOURCE_ACCESSOR_BODY}`;
38470
- if (accessor && (input.files[accessorUnit] !== void 0 || input.files[`${prefix}${OBJC_RESOURCE_ACCESSOR_HEADER}`] !== void 0))
38471
- throw new Error(`target ${target.name} already contains its resource accessor`);
38472
- const nativeUnits = accessor ? [...units, [accessorUnit, accessor.body]] : units;
38473
- const accessorFlags = accessor ? ["-include", accessorHeader] : [];
38474
- if (accessor) {
38475
- files2.set(accessorHeader, accessor.header);
38476
- files2.set(import_node_path11.default.join(layout.root, accessorUnit), accessor.body);
38477
- }
38478
- const sourceHeaders = import_node_path11.default.join(
38479
- layout.root,
38480
- ".build",
38481
- "peach-objc-originals",
38482
- target.name
38483
- );
38484
- (0, import_node_fs12.mkdirSync)(sourceHeaders, { recursive: true });
38485
- const modulemap = import_node_path11.default.join(sourceHeaders, "module.modulemap");
38486
- (0, import_node_fs12.writeFileSync)(
38487
- modulemap,
38488
- `module ${swiftTargetModuleName(target.name)} {
38460
+ const stageFlags = (flags2, sdkInclude) => flags2.map(
38461
+ (flag) => flag.replaceAll(SWIFT_NATIVE_INPUT_ROOT, layout.root).replaceAll(SWIFT_NATIVE_SDK_INCLUDE, sdkInclude)
38462
+ );
38463
+ const originalFlags = [
38464
+ ...settings?.flags ?? [],
38465
+ ...search,
38466
+ ...(settings?.frameworkSearchPaths ?? []).flatMap((dir) => [
38467
+ "-F",
38468
+ import_node_path11.default.join(layout.root, dir)
38469
+ ]),
38470
+ "-I",
38471
+ headerDirectory
38472
+ ];
38473
+ const flags = stageFlags(
38474
+ originalFlags,
38475
+ import_node_path11.default.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
38476
+ );
38477
+ const prefixHeader = settings?.prefixHeader ? ["-include", import_node_path11.default.join(layout.root, settings.prefixHeader)] : [];
38478
+ const bundleName = entries.some(([file]) => file.endsWith(".swift")) ? void 0 : swiftObjCResourceBundleName({
38479
+ target: target.name,
38480
+ path: target.path,
38481
+ resources: resourceTargets.find((candidate) => candidate.name === target.name)?.resources ?? false,
38482
+ usesBundleMacro: entries.some(
38483
+ ([file, contents]) => /\.(?:c|cc|cpp|cxx|m|mm|h|hpp|hh|hxx)$/.test(file) && /\bSWIFTPM_MODULE_BUNDLE\b/.test(contents)
38484
+ ),
38485
+ bundles: input.resourceBundles
38486
+ });
38487
+ const accessor = bundleName === void 0 ? void 0 : swiftObjCResourceAccessor(bundleName);
38488
+ const accessorHeader = import_node_path11.default.join(
38489
+ layout.root,
38490
+ target.path,
38491
+ OBJC_RESOURCE_ACCESSOR_HEADER
38492
+ );
38493
+ const accessorUnit = `${prefix}${OBJC_RESOURCE_ACCESSOR_BODY}`;
38494
+ if (accessor && (input.files[accessorUnit] !== void 0 || input.files[`${prefix}${OBJC_RESOURCE_ACCESSOR_HEADER}`] !== void 0))
38495
+ throw new Error(`target ${target.name} already contains its resource accessor`);
38496
+ const nativeUnits = accessor ? [...units, [accessorUnit, accessor.body]] : units;
38497
+ const accessorFlags = accessor ? ["-include", accessorHeader] : [];
38498
+ if (accessor) {
38499
+ files2.set(accessorHeader, accessor.header);
38500
+ files2.set(import_node_path11.default.join(layout.root, accessorUnit), accessor.body);
38501
+ }
38502
+ if (roots2.length) {
38503
+ const sourceHeaders = import_node_path11.default.join(
38504
+ layout.root,
38505
+ ".build",
38506
+ "peach-objc-originals",
38507
+ target.name
38508
+ );
38509
+ (0, import_node_fs12.mkdirSync)(sourceHeaders, { recursive: true });
38510
+ const modulemap = import_node_path11.default.join(sourceHeaders, "module.modulemap");
38511
+ (0, import_node_fs12.writeFileSync)(
38512
+ modulemap,
38513
+ `module ${swiftTargetModuleName(target.name)} {
38489
38514
  ${roots2.map((file) => `header ${JSON.stringify(import_node_path11.default.join(layout.root, file))}`).join("\n")}
38490
38515
  export *
38491
38516
  }
38492
38517
  `
38493
- );
38494
- const view = objcView(
38495
- { module: swiftTargetModuleName(target.name), headers: sourceHeaders, modulemap },
38496
- toolchainBin,
38497
- import_node_path11.default.join(moduleRoot, "ios-simulator-stdlib"),
38498
- import_node_path11.default.join(layout.root, ".build", "peach-objc-sdk"),
38499
- import_node_path11.default.join(layout.root, ".build", "peach-objc-imports", target.name),
38500
- {
38501
- flags: stageFlags(originalFlags, import_node_path11.default.join(sdkHeaders, "usr/include")),
38502
- target: `arm64-apple-ios${settings?.deploymentTarget ?? "16.0"}-simulator`
38518
+ );
38519
+ const view = objcView(
38520
+ {
38521
+ module: swiftTargetModuleName(target.name),
38522
+ headers: sourceHeaders,
38523
+ modulemap
38524
+ },
38525
+ toolchainBin,
38526
+ import_node_path11.default.join(moduleRoot, "ios-simulator-stdlib"),
38527
+ import_node_path11.default.join(layout.root, ".build", "peach-objc-sdk"),
38528
+ import_node_path11.default.join(layout.root, ".build", "peach-objc-imports", target.name),
38529
+ {
38530
+ flags: stageFlags(originalFlags, import_node_path11.default.join(sdkHeaders, "usr/include")),
38531
+ target: `arm64-apple-ios${settings?.deploymentTarget ?? "16.0"}-simulator`
38532
+ }
38533
+ );
38534
+ const defined = /* @__PURE__ */ new Set();
38535
+ const declarations = (node) => {
38536
+ if (!node || typeof node !== "object") return;
38537
+ const name3 = Reflect.get(node, "name");
38538
+ if (Reflect.get(node, "kind") === "ObjCInterfaceDecl" && Reflect.get(node, "super") && typeof name3 === "string")
38539
+ defined.add(name3);
38540
+ const children = Reflect.get(node, "inner");
38541
+ if (Array.isArray(children)) for (const child of children) declarations(child);
38542
+ };
38543
+ declarations(view.clangAST);
38544
+ const foreignTypes = /* @__PURE__ */ new Map();
38545
+ for (const graph of view.graphs)
38546
+ for (const symbol of graph.symbols) {
38547
+ const nativeName = /^c:objc\(cs\)(\w+)$/.exec(
38548
+ symbol.identifier.precise
38549
+ )?.[1];
38550
+ if (nativeName && defined.has(nativeName))
38551
+ foreignTypes.set(symbol.pathComponents[0], nativeName);
38552
+ }
38553
+ imports.set(target.name, {
38554
+ view,
38555
+ classes: [...foreignTypes.values()],
38556
+ headers: roots2.map((file) => import_node_path11.default.join(layout.root, file)),
38557
+ foreignTypes
38558
+ });
38503
38559
  }
38504
- );
38505
- const defined = /* @__PURE__ */ new Set();
38506
- const declarations = (node) => {
38507
- if (!node || typeof node !== "object") return;
38508
- const name3 = Reflect.get(node, "name");
38509
- if (Reflect.get(node, "kind") === "ObjCInterfaceDecl" && Reflect.get(node, "super") && typeof name3 === "string")
38510
- defined.add(name3);
38511
- const children = Reflect.get(node, "inner");
38512
- if (Array.isArray(children)) for (const child of children) declarations(child);
38513
- };
38514
- declarations(view.clangAST);
38515
- const foreignTypes = /* @__PURE__ */ new Map();
38516
- for (const graph of view.graphs)
38517
- for (const symbol of graph.symbols) {
38518
- const nativeName = /^c:objc\(cs\)(\w+)$/.exec(symbol.identifier.precise)?.[1];
38519
- if (nativeName && defined.has(nativeName))
38520
- foreignTypes.set(symbol.pathComponents[0], nativeName);
38521
- }
38522
- imports.set(target.name, {
38523
- view,
38524
- classes: [...foreignTypes.values()],
38525
- headers: roots2.map((file) => import_node_path11.default.join(layout.root, file)),
38526
- foreignTypes
38527
- });
38528
- const thunk = "PeachObjCImports.generated.m";
38529
- const groups = /* @__PURE__ */ new Map();
38530
- for (const [file] of nativeUnits) {
38531
- const origin = settings?.sourceDirectories[file];
38532
- if (origin) (0, import_node_fs12.mkdirSync)(import_node_path11.default.join(layout.root, origin), { recursive: true });
38533
- const perFile = [
38534
- ...origin ? ["-iquote", import_node_path11.default.join(layout.root, origin)] : [],
38535
- ...stageFlags(
38536
- settings?.fileFlags[file] ?? [],
38537
- import_node_path11.default.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
38538
- )
38539
- ];
38540
- const cxx = /\.(?:cc|cpp|cxx|mm)$/.test(file);
38541
- const identity = (0, import_node_crypto9.createHash)("sha256").update(JSON.stringify([cxx, perFile])).digest("hex").slice(0, 12);
38542
- const group = groups.get(identity) ?? {
38543
- name: `${target.name}SwiftImplementation_${identity}`,
38544
- sources: [],
38545
- flags: [...flags, ...prefixHeader, ...accessorFlags, ...perFile],
38546
- cxxFlags: [
38547
- ...flags,
38548
- ...prefixHeader,
38549
- ...accessorFlags,
38560
+ const thunks = roots2.length ? ["PeachObjCImports.generated.m"] : [];
38561
+ const groups = /* @__PURE__ */ new Map();
38562
+ for (const [file] of nativeUnits) {
38563
+ const origin = settings?.sourceDirectories[file];
38564
+ if (origin) (0, import_node_fs12.mkdirSync)(import_node_path11.default.join(layout.root, origin), { recursive: true });
38565
+ const perFile = [
38566
+ ...origin ? ["-iquote", import_node_path11.default.join(layout.root, origin)] : [],
38550
38567
  ...stageFlags(
38551
- cxx ? settings.cxxFlags : [],
38568
+ settings?.fileFlags[file] ?? [],
38552
38569
  import_node_path11.default.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
38553
- ),
38554
- ...perFile
38555
- ]
38556
- };
38557
- group.sources.push(file.slice(prefix.length));
38558
- groups.set(identity, group);
38559
- }
38560
- groups.set("imports", {
38561
- name: `${target.name}ObjCImports`,
38562
- sources: [thunk],
38563
- flags: [...flags, "-fobjc-arc"],
38564
- cxxFlags: [...flags, "-fobjc-arc"]
38565
- });
38566
- const include2 = import_node_path11.default.join(layout.root, target.path, "include");
38567
- files2.set(
38568
- import_node_path11.default.join(include2, "module.modulemap"),
38569
- `module ${target.name}ImplementationDeclarations { export * }
38570
+ )
38571
+ ];
38572
+ const cxx = /\.(?:cc|cpp|cxx|mm)$/.test(file);
38573
+ const identity = (0, import_node_crypto9.createHash)("sha256").update(JSON.stringify([cxx, perFile])).digest("hex").slice(0, 12);
38574
+ const group = groups.get(identity) ?? {
38575
+ name: `${target.name}SwiftImplementation_${identity}`,
38576
+ sources: [],
38577
+ flags: [...flags, ...prefixHeader, ...accessorFlags, ...perFile],
38578
+ cxxFlags: [
38579
+ ...flags,
38580
+ ...prefixHeader,
38581
+ ...accessorFlags,
38582
+ ...stageFlags(
38583
+ cxx ? settings.cxxFlags : [],
38584
+ import_node_path11.default.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
38585
+ ),
38586
+ ...perFile
38587
+ ]
38588
+ };
38589
+ group.sources.push(file.slice(prefix.length));
38590
+ groups.set(identity, group);
38591
+ }
38592
+ if (thunks.length)
38593
+ groups.set("imports", {
38594
+ name: `${target.name}ObjCImports`,
38595
+ sources: thunks,
38596
+ flags: [...flags, "-fobjc-arc"],
38597
+ cxxFlags: [...flags, "-fobjc-arc"]
38598
+ });
38599
+ const include2 = import_node_path11.default.join(layout.root, target.path, "include");
38600
+ files2.set(
38601
+ import_node_path11.default.join(include2, "module.modulemap"),
38602
+ `module ${target.name}ImplementationDeclarations { export * }
38570
38603
  `
38571
- );
38572
- native.set(target.name, {
38573
- mixed: true,
38574
- path: target.path,
38575
- includeDirectory: include2,
38576
- sources: nativeUnits.map(([file]) => file.slice(prefix.length)),
38577
- lateSources: [...nativeUnits.map(([file]) => file.slice(prefix.length)), thunk],
38578
- exclude: [
38579
- ...entries.filter(([file]) => !file.endsWith(".swift") && !file.endsWith(".metal")).map(([file]) => file.slice(prefix.length)),
38580
- ...accessor ? [OBJC_RESOURCE_ACCESSOR_HEADER, OBJC_RESOURCE_ACCESSOR_BODY] : [],
38581
- thunk,
38582
- "include"
38583
- ],
38584
- groups: [...groups.values()],
38585
- late: {
38586
- name: `${target.name}SwiftImplementation`,
38587
- producers: [
38588
- target.name,
38589
- ...(target.dependencies ?? []).filter((dependency) => swiftTargets.has(dependency.name)).map((dependency) => dependency.name)
38590
- ]
38591
- }
38592
- });
38604
+ );
38605
+ native.set(target.name, {
38606
+ mixed: true,
38607
+ path: target.path,
38608
+ includeDirectory: include2,
38609
+ sources: nativeUnits.map(([file]) => file.slice(prefix.length)),
38610
+ lateSources: [
38611
+ ...nativeUnits.map(([file]) => file.slice(prefix.length)),
38612
+ ...thunks
38613
+ ],
38614
+ exclude: [
38615
+ ...entries.filter(([file]) => !file.endsWith(".swift") && !file.endsWith(".metal")).map(([file]) => file.slice(prefix.length)),
38616
+ ...accessor ? [OBJC_RESOURCE_ACCESSOR_HEADER, OBJC_RESOURCE_ACCESSOR_BODY] : [],
38617
+ ...thunks,
38618
+ "include"
38619
+ ],
38620
+ groups: [...groups.values()],
38621
+ late: {
38622
+ name: `${target.name}SwiftImplementation`,
38623
+ producers: [
38624
+ target.name,
38625
+ ...(target.dependencies ?? []).filter((dependency) => swiftTargets.has(dependency.name)).map((dependency) => dependency.name)
38626
+ ]
38627
+ }
38628
+ });
38629
+ } catch (error) {
38630
+ if (!swift || !(error instanceof Error)) throw error;
38631
+ targetFailures.push(`${target.name}: ${error.message}`);
38632
+ native.set(target.name, {
38633
+ mixed: true,
38634
+ path: target.path,
38635
+ includeDirectory: import_node_path11.default.join(layout.root, target.path, "include"),
38636
+ sources: [],
38637
+ lateSources: [],
38638
+ exclude: entries.filter(([file]) => !file.endsWith(".swift") && !file.endsWith(".metal")).map(([file]) => file.slice(prefix.length))
38639
+ });
38640
+ }
38593
38641
  continue;
38594
38642
  }
38595
38643
  const includes = `${prefix}include/`;
@@ -38752,20 +38800,27 @@ export *
38752
38800
  for (const name3 of objcProducers) {
38753
38801
  const target = targets.find((value) => value.name === name3);
38754
38802
  const prefix = target.path === "." ? "" : `${target.path}/`;
38755
- const exported = swiftObjCExports({
38756
- module: swiftTargetModuleName(name3),
38757
- sources: Object.entries(input.files).filter(
38758
- ([file]) => file.startsWith(prefix) && file.endsWith(".swift") && !targets.some(
38759
- (candidate) => candidate.name !== name3 && candidate.path !== "." && candidate.path.startsWith(prefix) && file.startsWith(`${candidate.path}/`)
38760
- ) && !target.exclude?.some(
38761
- (excluded) => file.slice(prefix.length) === excluded || file.slice(prefix.length).startsWith(`${excluded}/`)
38762
- )
38763
- ),
38764
- mask: swiftCodeMask,
38765
- declarationStart,
38766
- selector: objcSelectorName,
38767
- foreignTypes: imports.get(name3)?.foreignTypes
38768
- });
38803
+ let exported;
38804
+ try {
38805
+ exported = swiftObjCExports({
38806
+ module: swiftTargetModuleName(name3),
38807
+ sources: Object.entries(input.files).filter(
38808
+ ([file]) => file.startsWith(prefix) && file.endsWith(".swift") && !targets.some(
38809
+ (candidate) => candidate.name !== name3 && candidate.path !== "." && candidate.path.startsWith(prefix) && file.startsWith(`${candidate.path}/`)
38810
+ ) && !target.exclude?.some(
38811
+ (excluded) => file.slice(prefix.length) === excluded || file.slice(prefix.length).startsWith(`${excluded}/`)
38812
+ )
38813
+ ),
38814
+ mask: swiftCodeMask,
38815
+ declarationStart,
38816
+ selector: objcSelectorName,
38817
+ foreignTypes: imports.get(name3)?.foreignTypes
38818
+ });
38819
+ } catch (error) {
38820
+ if (!(error instanceof Error)) throw error;
38821
+ targetFailures.push(`${name3}: ${error.message}`);
38822
+ continue;
38823
+ }
38769
38824
  const original = imports.get(name3);
38770
38825
  if (!exported && !original) continue;
38771
38826
  objcModules.add(name3);
@@ -39037,6 +39092,7 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
39037
39092
  for (const dependency of dependencies.get(producer) ?? []) include(dependency);
39038
39093
  return {
39039
39094
  headerProducers: producers.filter((name3) => !included.has(name3)),
39095
+ targetFailures,
39040
39096
  ...rootOwner && objcExports ? {
39041
39097
  objcImplementations: {
39042
39098
  owner: import_node_path11.default.join(layout.root, rootOwner),
@@ -39227,7 +39283,7 @@ function compileSwiftProjectUnit(input, options) {
39227
39283
  ],
39228
39284
  {
39229
39285
  cwd: repo,
39230
- timeout: options.timeoutMs,
39286
+ timeout: options.timeoutMs === void 0 ? void 0 : swiftBuilderHopTimeoutMs(options.timeoutMs),
39231
39287
  maxBuffer: 64 * 1024 * 1024,
39232
39288
  signal: options.signal
39233
39289
  },
@@ -39259,6 +39315,9 @@ function compileSwiftProjectUnit(input, options) {
39259
39315
  return retain(root, built2);
39260
39316
  }
39261
39317
  const preparation = writeSwiftProject(layout, input, moduleRoot);
39318
+ const unprepared = preparation.targetFailures.map(
39319
+ (failure2) => `error: target ${failure2}`
39320
+ );
39262
39321
  const swift = import_node_path11.default.join(options.toolchainBin, "swift");
39263
39322
  if (!(0, import_node_fs12.existsSync)(swift)) {
39264
39323
  throw new Error(
@@ -39408,18 +39467,23 @@ function compileSwiftProjectUnit(input, options) {
39408
39467
  );
39409
39468
  } catch (retryError) {
39410
39469
  throw new Error(
39411
- projectDiagnostic(outputOf(retryError), layout, input.files),
39412
- {
39413
- cause: retryError
39414
- }
39470
+ [
39471
+ ...unprepared,
39472
+ projectDiagnostic(outputOf(retryError), layout, input.files)
39473
+ ].join("\n"),
39474
+ { cause: retryError }
39415
39475
  );
39416
39476
  }
39417
39477
  } else {
39418
- throw new Error(projectDiagnostic(output, layout, input.files), {
39419
- cause: error
39420
- });
39478
+ throw new Error(
39479
+ [...unprepared, projectDiagnostic(output, layout, input.files)].join(
39480
+ "\n"
39481
+ ),
39482
+ { cause: error }
39483
+ );
39421
39484
  }
39422
39485
  }
39486
+ if (unprepared.length) throw new Error(unprepared.join("\n"));
39423
39487
  const artifact = {
39424
39488
  hash: hash2,
39425
39489
  bytes: (0, import_node_fs12.readFileSync)(builtArtifact(layout)),
@@ -41323,12 +41387,12 @@ init_home_paths();
41323
41387
 
41324
41388
  // src/swift-distribution.lock.json
41325
41389
  var swift_distribution_lock_default = {
41326
- id: "e3bdd3d8fa4f9993",
41390
+ id: "ca4dfda0ca14bc49",
41327
41391
  release: "swift-6.4.0-RELEASE-custom-0d775d32d7c74eae",
41328
41392
  wasmSdkId: "swift-6.4.0-RELEASE_wasm-peach-f02bd198",
41329
41393
  wasmSdkUrl: "https://r2.sootsim.com/swift-wasm-sdk/swift-6.4.0-RELEASE_wasm-peach-f02bd198.artifactbundle.tar.gz",
41330
41394
  wasmSdkChecksum: "1e19ea768fd4e821aae34b8966c4ddcee45615c4b3cf018979b061aee2fb5504",
41331
- source: "5791eeff9ca9c054514aeb4a6599e1de8e1e4711",
41395
+ source: "33e8641403dd73a7ce0ca902007e3a36407e1f0b",
41332
41396
  targets: [
41333
41397
  "ImagePlayground",
41334
41398
  "QuickLookThumbnailing",
@@ -41373,6 +41437,7 @@ var swift_distribution_lock_default = {
41373
41437
  "PeachObjCRuntime",
41374
41438
  "PeachObjC",
41375
41439
  "UIUtilities",
41440
+ "UIKitEnums",
41376
41441
  "UIKitCore",
41377
41442
  "PeachICU",
41378
41443
  "PeachCMark",
@@ -41488,33 +41553,14 @@ var swift_distribution_lock_default = {
41488
41553
  "PeachBox2D"
41489
41554
  ],
41490
41555
  systemEnvironment: {
41491
- scenePhase: [
41492
- "string:active",
41493
- "string:inactive",
41494
- "string:background"
41495
- ],
41496
- deviceModel: [
41497
- "string"
41498
- ],
41499
- systemName: [
41500
- "string"
41501
- ],
41502
- systemVersion: [
41503
- "string"
41504
- ],
41505
- colorScheme: [
41506
- "string:light",
41507
- "string:dark"
41508
- ],
41509
- semanticColors: [
41510
- "object"
41511
- ],
41512
- imageAssets: [
41513
- "object"
41514
- ],
41515
- locale: [
41516
- "string"
41517
- ],
41556
+ scenePhase: ["string:active", "string:inactive", "string:background"],
41557
+ deviceModel: ["string"],
41558
+ systemName: ["string"],
41559
+ systemVersion: ["string"],
41560
+ colorScheme: ["string:light", "string:dark"],
41561
+ semanticColors: ["object"],
41562
+ imageAssets: ["object"],
41563
+ locale: ["string"],
41518
41564
  dynamicTypeSize: [
41519
41565
  "string:xSmall",
41520
41566
  "string:small",
@@ -41529,30 +41575,22 @@ var swift_distribution_lock_default = {
41529
41575
  "string:accessibility4",
41530
41576
  "string:accessibility5"
41531
41577
  ],
41532
- horizontalSizeClass: [
41533
- "string:compact",
41534
- "string:regular"
41535
- ],
41536
- verticalSizeClass: [
41537
- "string:compact",
41538
- "string:regular"
41539
- ],
41540
- accessibilityReduceMotion: [
41541
- "bool"
41542
- ]
41578
+ horizontalSizeClass: ["string:compact", "string:regular"],
41579
+ verticalSizeClass: ["string:compact", "string:regular"],
41580
+ accessibilityReduceMotion: ["bool"]
41543
41581
  },
41544
41582
  hosts: {
41545
41583
  "darwin-arm64": {
41546
- sha256: "278cf5301795dd1e9f0f044bdb4e079b45ab4eb72a6e72331b06916115e34902",
41547
- size: 71532233
41584
+ sha256: "8679052c4c2b21ad748a8db40cdbc0c91ab14a29fc06bbed777efb57030c01fa",
41585
+ size: 70963039
41548
41586
  },
41549
41587
  "linux-x64": {
41550
- sha256: "920c6fe08ba45930880fee133a3cb85b310d713a4d60404f29d03555d3df879c",
41551
- size: 71538725
41588
+ sha256: "a1719d844e2f45e8c9a2ccb9dbe7857978918639a3933c225a328d84cae235cf",
41589
+ size: 70968746
41552
41590
  },
41553
41591
  "linux-arm64": {
41554
- sha256: "d3a3421e0c80cc698869bc39dd538d42b0e053db02526d3f5f22acf8e7c6dca9",
41555
- size: 71536749
41592
+ sha256: "3da8f2c920e65c633b5310c778b4a5c54b0f5f8278d58fd109f3db4310794c04",
41593
+ size: 70967077
41556
41594
  }
41557
41595
  }
41558
41596
  };
@@ -50504,8 +50542,11 @@ function mapFrameworkToProjectFramework(fw) {
50504
50542
  var import_http2 = __toESM(require("http"), 1);
50505
50543
  var import_https = __toESM(require("https"), 1);
50506
50544
  var import_node_http2 = require("node:http2");
50545
+ var import_stream = require("stream");
50507
50546
  var import_promises5 = require("stream/promises");
50508
50547
  init_backend_origin();
50548
+ init_bundleGlobalFooter();
50549
+ init_cli_runtime();
50509
50550
  init_packageVersionsContract();
50510
50551
 
50511
50552
  // src/host/dev-server-package-versions.ts
@@ -53834,6 +53875,10 @@ async function handleFetchProxyRequest(req, res) {
53834
53875
  if (packageVersions)
53835
53876
  res.setHeader(PACKAGE_VERSIONS_HEADER, JSON.stringify(packageVersions));
53836
53877
  }
53878
+ if (isBundleProxyRequestUrl(req.url) && req.method === "GET" && upstream.statusCode === 200 && upstreamUrl.pathname.endsWith(".bundle") && upstream.headers["x-peach-rolldown-inventory"] !== "1") {
53879
+ res.setHeader(ROLLDOWN_INVENTORY_HEADER, "1");
53880
+ res.removeHeader("content-length");
53881
+ }
53837
53882
  applyFetchProxyCors(req, res);
53838
53883
  if (setCookies.length > 0)
53839
53884
  res.setHeader("x-sootsim-set-cookie", setCookies.join(", "));
@@ -53997,6 +54042,35 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
53997
54042
  if (redirects > 0) res.setHeader(FETCH_PROXY_RESPONSE_URL_HEADER, targetUrl.href);
53998
54043
  await route.respond(proxyRes, hopCookies);
53999
54044
  res.statusCode = status;
54045
+ if (isBundleProxyRequestUrl(req.url) && method === "GET" && status === 200 && targetUrl.pathname.endsWith(".bundle") && proxyRes.headers["x-peach-rolldown-inventory"] !== "1") {
54046
+ const contentType2 = typeof proxyRes.headers["content-type"] === "string" ? proxyRes.headers["content-type"] : "";
54047
+ const inventory = getCliRuntime().rolldown_bundle_inventory;
54048
+ res.removeHeader("content-length");
54049
+ const annotate = async function* () {
54050
+ const decoder = new TextDecoder();
54051
+ let payload = "";
54052
+ let sent = 0;
54053
+ let bundleStarted = false;
54054
+ for await (const chunk of proxyRes) {
54055
+ payload += decoder.decode(chunk, { stream: true });
54056
+ if (bundleStarted) continue;
54057
+ const releasable = inventory.releasableMultipartPrefix(payload, contentType2);
54058
+ bundleStarted = releasable.bundleStarted;
54059
+ if (releasable.length > sent) {
54060
+ yield Buffer.from(payload.slice(sent, releasable.length), "utf8");
54061
+ sent = releasable.length;
54062
+ }
54063
+ }
54064
+ payload += decoder.decode();
54065
+ const annotated = await inventory.attachRolldownBundleHttpPayload(
54066
+ payload,
54067
+ contentType2
54068
+ );
54069
+ yield Buffer.from(annotated.slice(sent), "utf8");
54070
+ };
54071
+ await (0, import_promises5.pipeline)(import_stream.Readable.from(annotate(), { objectMode: false }), res);
54072
+ return;
54073
+ }
54000
54074
  await (0, import_promises5.pipeline)(proxyRes, res);
54001
54075
  };
54002
54076
  let body;