peachsim 0.1.1654 → 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 (82) hide show
  1. package/dist-lib/agent-daemon-client.cjs +1 -1
  2. package/dist-lib/agent-events.cjs +1 -1
  3. package/dist-lib/attached-projects.cjs +1 -1
  4. package/dist-lib/auth/shared-session.cjs +1 -1
  5. package/dist-lib/backend-origin.cjs +1 -1
  6. package/dist-lib/beta.cjs +1 -1
  7. package/dist-lib/beta.mjs +1 -1
  8. package/dist-lib/bridge-constants.cjs +1 -1
  9. package/dist-lib/bridge-contract-input.cjs +1 -1
  10. package/dist-lib/bridge-contract-input.mjs +1 -1
  11. package/dist-lib/bridge-contract.cjs +1 -1
  12. package/dist-lib/bridge-contract.mjs +1 -1
  13. package/dist-lib/bundle-channel.cjs +237 -196
  14. package/dist-lib/capture-contract.cjs +1 -1
  15. package/dist-lib/capture-contract.mjs +1 -1
  16. package/dist-lib/cloud-contract.cjs +1 -1
  17. package/dist-lib/cloud-contract.mjs +1 -1
  18. package/dist-lib/cloud-test-args.cjs +1 -1
  19. package/dist-lib/cloud-test-args.mjs +1 -1
  20. package/dist-lib/cloud.cjs +1 -1
  21. package/dist-lib/cloud.mjs +1 -1
  22. package/dist-lib/config.cjs +1 -1
  23. package/dist-lib/config.mjs +1 -1
  24. package/dist-lib/detox/index.cjs +2 -2
  25. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  26. package/dist-lib/expo-swift-bundle.cjs +237 -196
  27. package/dist-lib/expo-swift-metadata.cjs +1 -1
  28. package/dist-lib/expo-swift-metadata.mjs +1 -1
  29. package/dist-lib/home-paths.cjs +1 -1
  30. package/dist-lib/host/bridge-host.cjs +264 -208
  31. package/dist-lib/host/fetch-proxy-handler.cjs +28 -13
  32. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  33. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  34. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  35. package/dist-lib/host/websocket-proxy.cjs +1 -1
  36. package/dist-lib/index.cjs +2 -2
  37. package/dist-lib/jump-to-source-babel.cjs +1 -1
  38. package/dist-lib/jump-to-source-native.cjs +1 -1
  39. package/dist-lib/kotlin-host.cjs +1 -1
  40. package/dist-lib/menu.cjs +1 -1
  41. package/dist-lib/menu.mjs +1 -1
  42. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  43. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  44. package/dist-lib/metro-production-bundle.cjs +1 -1
  45. package/dist-lib/metro-production-bundle.mjs +1 -1
  46. package/dist-lib/metro.cjs +1 -1
  47. package/dist-lib/native-app-identity-project.cjs +1 -1
  48. package/dist-lib/native-app-identity-project.mjs +1 -1
  49. package/dist-lib/native-app-identity.cjs +1 -1
  50. package/dist-lib/native-app-identity.mjs +1 -1
  51. package/dist-lib/native-firebase-metadata.cjs +1 -1
  52. package/dist-lib/native-firebase-metadata.mjs +1 -1
  53. package/dist-lib/plist.cjs +1 -1
  54. package/dist-lib/plist.mjs +1 -1
  55. package/dist-lib/profiles.cjs +1 -1
  56. package/dist-lib/public-brand.cjs +1 -1
  57. package/dist-lib/public-origins-lib-esm.json +23 -23
  58. package/dist-lib/public-origins-lib.json +51 -51
  59. package/dist-lib/react-native-host-modules.cjs +1 -1
  60. package/dist-lib/react-native-host-modules.mjs +1 -1
  61. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  62. package/dist-lib/sdk.cjs +1 -1
  63. package/dist-lib/sdk.mjs +1 -1
  64. package/dist-lib/skills.cjs +265 -209
  65. package/dist-lib/swift-compile.cjs +237 -196
  66. package/dist-lib/swift-compile.mjs +237 -196
  67. package/dist-lib/swift-package.cjs +1 -1
  68. package/dist-lib/swift-package.mjs +1 -1
  69. package/dist-lib/swift-submit.cjs +1 -1
  70. package/dist-lib/swift-submit.mjs +1 -1
  71. package/dist-lib/swift-toolchain.cjs +1 -1
  72. package/dist-lib/swift.cjs +1 -1
  73. package/dist-lib/vite-swift.cjs +237 -196
  74. package/dist-lib/vite.cjs +2 -2
  75. package/dist-lib/worklet-executable.cjs +1 -1
  76. package/dist-lib/worklet-executable.mjs +1 -1
  77. package/dist-types/packages/peach-engine/src/rolldown-bundle-inventory.d.ts +4 -0
  78. package/package.json +1 -1
  79. package/runtime-companion.json +1 -1
  80. package/src/host/fetch-proxy-handler.ts +27 -10
  81. package/src/swift-compile.ts +286 -237
  82. package/src/swiftContract.ts +2 -0
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1654 | (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;
@@ -50346,6 +50346,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
50346
50346
  ] : compileTargets(input);
50347
50347
  const files2 = /* @__PURE__ */ new Map();
50348
50348
  const native = /* @__PURE__ */ new Map();
50349
+ const targetFailures = [];
50349
50350
  const bySourcePath = [...targets].sort(
50350
50351
  (left, right) => right.path.length - left.path.length
50351
50352
  );
@@ -50396,188 +50397,212 @@ function writeSwiftProject(layout, input, moduleRoot) {
50396
50397
  if (units.length === 0) continue;
50397
50398
  const settings = input.nativeTargets?.find((value) => value.name === target.name);
50398
50399
  if (entries.some(([file]) => file.endsWith(".swift")) || settings && units.some(([file]) => /\.mm?$/.test(file))) {
50399
- if (!settings)
50400
- throw new Error(
50401
- `mixed target ${target.name} requires its original native target settings; SwiftPM does not compile mixed source targets`
50400
+ const swift = entries.some(([file]) => file.endsWith(".swift"));
50401
+ try {
50402
+ if (!settings)
50403
+ throw new Error(
50404
+ `mixed target ${target.name} requires its original native target settings; SwiftPM does not compile mixed source targets`
50405
+ );
50406
+ const headers = settings.headers;
50407
+ const roots2 = settings.bridgingHeader ? [settings.bridgingHeader] : settings.publicHeaders;
50408
+ for (const file of headers) {
50409
+ const destination = import_node_path11.default.join(layout.root, file);
50410
+ (0, import_node_fs13.mkdirSync)(import_node_path11.default.dirname(destination), { recursive: true });
50411
+ (0, import_node_fs13.writeFileSync)(destination, input.files[file]);
50412
+ }
50413
+ const search = [
50414
+ .../* @__PURE__ */ new Set([
50415
+ ...settings?.headerSearchPaths ?? [],
50416
+ ...headers.map((file) => import_node_path11.default.posix.dirname(file))
50417
+ ])
50418
+ ].flatMap((dir) => ["-I", import_node_path11.default.join(layout.root, dir)]);
50419
+ const pin = distribution ?? JSON.parse((0, import_node_fs13.readFileSync)(import_node_path11.default.join(moduleRoot, "toolchain.json"), "utf8"));
50420
+ const release = pin.release;
50421
+ const toolchainBin = swiftToolchain(release, swiftModuleSdk(moduleRoot));
50422
+ const sdkHeaders = materializeObjcSdk(
50423
+ import_node_path11.default.join(layout.root, ".build", "peach-objc-sdk")
50402
50424
  );
50403
- const headers = settings.headers;
50404
- const roots2 = settings.bridgingHeader ? [settings.bridgingHeader] : settings.publicHeaders;
50405
- if (!roots2.length)
50406
- throw new Error(`mixed target ${target.name} has no original declaration headers`);
50407
- for (const file of headers) {
50408
- const destination = import_node_path11.default.join(layout.root, file);
50409
- (0, import_node_fs13.mkdirSync)(import_node_path11.default.dirname(destination), { recursive: true });
50410
- (0, import_node_fs13.writeFileSync)(destination, input.files[file]);
50411
- }
50412
- const search = [
50413
- .../* @__PURE__ */ new Set([
50414
- ...settings?.headerSearchPaths ?? [],
50415
- ...headers.map((file) => import_node_path11.default.posix.dirname(file))
50416
- ])
50417
- ].flatMap((dir) => ["-I", import_node_path11.default.join(layout.root, dir)]);
50418
- const pin = distribution ?? JSON.parse((0, import_node_fs13.readFileSync)(import_node_path11.default.join(moduleRoot, "toolchain.json"), "utf8"));
50419
- const release = pin.release;
50420
- const toolchainBin = swiftToolchain(release, swiftModuleSdk(moduleRoot));
50421
- const sdkHeaders = materializeObjcSdk(
50422
- import_node_path11.default.join(layout.root, ".build", "peach-objc-sdk")
50423
- );
50424
- const stageFlags = (flags2, sdkInclude) => flags2.map(
50425
- (flag) => flag.replaceAll(SWIFT_NATIVE_INPUT_ROOT, layout.root).replaceAll(SWIFT_NATIVE_SDK_INCLUDE, sdkInclude)
50426
- );
50427
- const originalFlags = [
50428
- ...settings?.flags ?? [],
50429
- ...search,
50430
- ...(settings?.frameworkSearchPaths ?? []).flatMap((dir) => [
50431
- "-F",
50432
- import_node_path11.default.join(layout.root, dir)
50433
- ]),
50434
- "-I",
50435
- headerDirectory
50436
- ];
50437
- const flags = stageFlags(
50438
- originalFlags,
50439
- import_node_path11.default.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
50440
- );
50441
- const prefixHeader = settings?.prefixHeader ? ["-include", import_node_path11.default.join(layout.root, settings.prefixHeader)] : [];
50442
- const bundleName = entries.some(([file]) => file.endsWith(".swift")) ? void 0 : swiftObjCResourceBundleName({
50443
- target: target.name,
50444
- path: target.path,
50445
- resources: resourceTargets.find((candidate) => candidate.name === target.name)?.resources ?? false,
50446
- usesBundleMacro: entries.some(
50447
- ([file, contents]) => /\.(?:c|cc|cpp|cxx|m|mm|h|hpp|hh|hxx)$/.test(file) && /\bSWIFTPM_MODULE_BUNDLE\b/.test(contents)
50448
- ),
50449
- bundles: input.resourceBundles
50450
- });
50451
- const accessor = bundleName === void 0 ? void 0 : swiftObjCResourceAccessor(bundleName);
50452
- const accessorHeader = import_node_path11.default.join(
50453
- layout.root,
50454
- target.path,
50455
- OBJC_RESOURCE_ACCESSOR_HEADER
50456
- );
50457
- const accessorUnit = `${prefix}${OBJC_RESOURCE_ACCESSOR_BODY}`;
50458
- if (accessor && (input.files[accessorUnit] !== void 0 || input.files[`${prefix}${OBJC_RESOURCE_ACCESSOR_HEADER}`] !== void 0))
50459
- throw new Error(`target ${target.name} already contains its resource accessor`);
50460
- const nativeUnits = accessor ? [...units, [accessorUnit, accessor.body]] : units;
50461
- const accessorFlags = accessor ? ["-include", accessorHeader] : [];
50462
- if (accessor) {
50463
- files2.set(accessorHeader, accessor.header);
50464
- files2.set(import_node_path11.default.join(layout.root, accessorUnit), accessor.body);
50465
- }
50466
- const sourceHeaders = import_node_path11.default.join(
50467
- layout.root,
50468
- ".build",
50469
- "peach-objc-originals",
50470
- target.name
50471
- );
50472
- (0, import_node_fs13.mkdirSync)(sourceHeaders, { recursive: true });
50473
- const modulemap = import_node_path11.default.join(sourceHeaders, "module.modulemap");
50474
- (0, import_node_fs13.writeFileSync)(
50475
- modulemap,
50476
- `module ${swiftTargetModuleName(target.name)} {
50425
+ const stageFlags = (flags2, sdkInclude) => flags2.map(
50426
+ (flag) => flag.replaceAll(SWIFT_NATIVE_INPUT_ROOT, layout.root).replaceAll(SWIFT_NATIVE_SDK_INCLUDE, sdkInclude)
50427
+ );
50428
+ const originalFlags = [
50429
+ ...settings?.flags ?? [],
50430
+ ...search,
50431
+ ...(settings?.frameworkSearchPaths ?? []).flatMap((dir) => [
50432
+ "-F",
50433
+ import_node_path11.default.join(layout.root, dir)
50434
+ ]),
50435
+ "-I",
50436
+ headerDirectory
50437
+ ];
50438
+ const flags = stageFlags(
50439
+ originalFlags,
50440
+ import_node_path11.default.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
50441
+ );
50442
+ const prefixHeader = settings?.prefixHeader ? ["-include", import_node_path11.default.join(layout.root, settings.prefixHeader)] : [];
50443
+ const bundleName = entries.some(([file]) => file.endsWith(".swift")) ? void 0 : swiftObjCResourceBundleName({
50444
+ target: target.name,
50445
+ path: target.path,
50446
+ resources: resourceTargets.find((candidate) => candidate.name === target.name)?.resources ?? false,
50447
+ usesBundleMacro: entries.some(
50448
+ ([file, contents]) => /\.(?:c|cc|cpp|cxx|m|mm|h|hpp|hh|hxx)$/.test(file) && /\bSWIFTPM_MODULE_BUNDLE\b/.test(contents)
50449
+ ),
50450
+ bundles: input.resourceBundles
50451
+ });
50452
+ const accessor = bundleName === void 0 ? void 0 : swiftObjCResourceAccessor(bundleName);
50453
+ const accessorHeader = import_node_path11.default.join(
50454
+ layout.root,
50455
+ target.path,
50456
+ OBJC_RESOURCE_ACCESSOR_HEADER
50457
+ );
50458
+ const accessorUnit = `${prefix}${OBJC_RESOURCE_ACCESSOR_BODY}`;
50459
+ if (accessor && (input.files[accessorUnit] !== void 0 || input.files[`${prefix}${OBJC_RESOURCE_ACCESSOR_HEADER}`] !== void 0))
50460
+ throw new Error(`target ${target.name} already contains its resource accessor`);
50461
+ const nativeUnits = accessor ? [...units, [accessorUnit, accessor.body]] : units;
50462
+ const accessorFlags = accessor ? ["-include", accessorHeader] : [];
50463
+ if (accessor) {
50464
+ files2.set(accessorHeader, accessor.header);
50465
+ files2.set(import_node_path11.default.join(layout.root, accessorUnit), accessor.body);
50466
+ }
50467
+ if (roots2.length) {
50468
+ const sourceHeaders = import_node_path11.default.join(
50469
+ layout.root,
50470
+ ".build",
50471
+ "peach-objc-originals",
50472
+ target.name
50473
+ );
50474
+ (0, import_node_fs13.mkdirSync)(sourceHeaders, { recursive: true });
50475
+ const modulemap = import_node_path11.default.join(sourceHeaders, "module.modulemap");
50476
+ (0, import_node_fs13.writeFileSync)(
50477
+ modulemap,
50478
+ `module ${swiftTargetModuleName(target.name)} {
50477
50479
  ${roots2.map((file) => `header ${JSON.stringify(import_node_path11.default.join(layout.root, file))}`).join("\n")}
50478
50480
  export *
50479
50481
  }
50480
50482
  `
50481
- );
50482
- const view = objcView(
50483
- { module: swiftTargetModuleName(target.name), headers: sourceHeaders, modulemap },
50484
- toolchainBin,
50485
- import_node_path11.default.join(moduleRoot, "ios-simulator-stdlib"),
50486
- import_node_path11.default.join(layout.root, ".build", "peach-objc-sdk"),
50487
- import_node_path11.default.join(layout.root, ".build", "peach-objc-imports", target.name),
50488
- {
50489
- flags: stageFlags(originalFlags, import_node_path11.default.join(sdkHeaders, "usr/include")),
50490
- target: `arm64-apple-ios${settings?.deploymentTarget ?? "16.0"}-simulator`
50483
+ );
50484
+ const view = objcView(
50485
+ {
50486
+ module: swiftTargetModuleName(target.name),
50487
+ headers: sourceHeaders,
50488
+ modulemap
50489
+ },
50490
+ toolchainBin,
50491
+ import_node_path11.default.join(moduleRoot, "ios-simulator-stdlib"),
50492
+ import_node_path11.default.join(layout.root, ".build", "peach-objc-sdk"),
50493
+ import_node_path11.default.join(layout.root, ".build", "peach-objc-imports", target.name),
50494
+ {
50495
+ flags: stageFlags(originalFlags, import_node_path11.default.join(sdkHeaders, "usr/include")),
50496
+ target: `arm64-apple-ios${settings?.deploymentTarget ?? "16.0"}-simulator`
50497
+ }
50498
+ );
50499
+ const defined = /* @__PURE__ */ new Set();
50500
+ const declarations = (node) => {
50501
+ if (!node || typeof node !== "object") return;
50502
+ const name3 = Reflect.get(node, "name");
50503
+ if (Reflect.get(node, "kind") === "ObjCInterfaceDecl" && Reflect.get(node, "super") && typeof name3 === "string")
50504
+ defined.add(name3);
50505
+ const children = Reflect.get(node, "inner");
50506
+ if (Array.isArray(children)) for (const child of children) declarations(child);
50507
+ };
50508
+ declarations(view.clangAST);
50509
+ const foreignTypes = /* @__PURE__ */ new Map();
50510
+ for (const graph of view.graphs)
50511
+ for (const symbol of graph.symbols) {
50512
+ const nativeName = /^c:objc\(cs\)(\w+)$/.exec(
50513
+ symbol.identifier.precise
50514
+ )?.[1];
50515
+ if (nativeName && defined.has(nativeName))
50516
+ foreignTypes.set(symbol.pathComponents[0], nativeName);
50517
+ }
50518
+ imports.set(target.name, {
50519
+ view,
50520
+ classes: [...foreignTypes.values()],
50521
+ headers: roots2.map((file) => import_node_path11.default.join(layout.root, file)),
50522
+ foreignTypes
50523
+ });
50491
50524
  }
50492
- );
50493
- const defined = /* @__PURE__ */ new Set();
50494
- const declarations = (node) => {
50495
- if (!node || typeof node !== "object") return;
50496
- const name3 = Reflect.get(node, "name");
50497
- if (Reflect.get(node, "kind") === "ObjCInterfaceDecl" && Reflect.get(node, "super") && typeof name3 === "string")
50498
- defined.add(name3);
50499
- const children = Reflect.get(node, "inner");
50500
- if (Array.isArray(children)) for (const child of children) declarations(child);
50501
- };
50502
- declarations(view.clangAST);
50503
- const foreignTypes = /* @__PURE__ */ new Map();
50504
- for (const graph of view.graphs)
50505
- for (const symbol of graph.symbols) {
50506
- const nativeName = /^c:objc\(cs\)(\w+)$/.exec(symbol.identifier.precise)?.[1];
50507
- if (nativeName && defined.has(nativeName))
50508
- foreignTypes.set(symbol.pathComponents[0], nativeName);
50509
- }
50510
- imports.set(target.name, {
50511
- view,
50512
- classes: [...foreignTypes.values()],
50513
- headers: roots2.map((file) => import_node_path11.default.join(layout.root, file)),
50514
- foreignTypes
50515
- });
50516
- const thunk = "PeachObjCImports.generated.m";
50517
- const groups = /* @__PURE__ */ new Map();
50518
- for (const [file] of nativeUnits) {
50519
- const origin = settings?.sourceDirectories[file];
50520
- if (origin) (0, import_node_fs13.mkdirSync)(import_node_path11.default.join(layout.root, origin), { recursive: true });
50521
- const perFile = [
50522
- ...origin ? ["-iquote", import_node_path11.default.join(layout.root, origin)] : [],
50523
- ...stageFlags(
50524
- settings?.fileFlags[file] ?? [],
50525
- import_node_path11.default.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
50526
- )
50527
- ];
50528
- const cxx = /\.(?:cc|cpp|cxx|mm)$/.test(file);
50529
- const identity = (0, import_node_crypto11.createHash)("sha256").update(JSON.stringify([cxx, perFile])).digest("hex").slice(0, 12);
50530
- const group = groups.get(identity) ?? {
50531
- name: `${target.name}SwiftImplementation_${identity}`,
50532
- sources: [],
50533
- flags: [...flags, ...prefixHeader, ...accessorFlags, ...perFile],
50534
- cxxFlags: [
50535
- ...flags,
50536
- ...prefixHeader,
50537
- ...accessorFlags,
50525
+ const thunks = roots2.length ? ["PeachObjCImports.generated.m"] : [];
50526
+ const groups = /* @__PURE__ */ new Map();
50527
+ for (const [file] of nativeUnits) {
50528
+ const origin = settings?.sourceDirectories[file];
50529
+ if (origin) (0, import_node_fs13.mkdirSync)(import_node_path11.default.join(layout.root, origin), { recursive: true });
50530
+ const perFile = [
50531
+ ...origin ? ["-iquote", import_node_path11.default.join(layout.root, origin)] : [],
50538
50532
  ...stageFlags(
50539
- cxx ? settings.cxxFlags : [],
50533
+ settings?.fileFlags[file] ?? [],
50540
50534
  import_node_path11.default.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
50541
- ),
50542
- ...perFile
50543
- ]
50544
- };
50545
- group.sources.push(file.slice(prefix.length));
50546
- groups.set(identity, group);
50547
- }
50548
- groups.set("imports", {
50549
- name: `${target.name}ObjCImports`,
50550
- sources: [thunk],
50551
- flags: [...flags, "-fobjc-arc"],
50552
- cxxFlags: [...flags, "-fobjc-arc"]
50553
- });
50554
- const include2 = import_node_path11.default.join(layout.root, target.path, "include");
50555
- files2.set(
50556
- import_node_path11.default.join(include2, "module.modulemap"),
50557
- `module ${target.name}ImplementationDeclarations { export * }
50535
+ )
50536
+ ];
50537
+ const cxx = /\.(?:cc|cpp|cxx|mm)$/.test(file);
50538
+ const identity = (0, import_node_crypto11.createHash)("sha256").update(JSON.stringify([cxx, perFile])).digest("hex").slice(0, 12);
50539
+ const group = groups.get(identity) ?? {
50540
+ name: `${target.name}SwiftImplementation_${identity}`,
50541
+ sources: [],
50542
+ flags: [...flags, ...prefixHeader, ...accessorFlags, ...perFile],
50543
+ cxxFlags: [
50544
+ ...flags,
50545
+ ...prefixHeader,
50546
+ ...accessorFlags,
50547
+ ...stageFlags(
50548
+ cxx ? settings.cxxFlags : [],
50549
+ import_node_path11.default.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
50550
+ ),
50551
+ ...perFile
50552
+ ]
50553
+ };
50554
+ group.sources.push(file.slice(prefix.length));
50555
+ groups.set(identity, group);
50556
+ }
50557
+ if (thunks.length)
50558
+ groups.set("imports", {
50559
+ name: `${target.name}ObjCImports`,
50560
+ sources: thunks,
50561
+ flags: [...flags, "-fobjc-arc"],
50562
+ cxxFlags: [...flags, "-fobjc-arc"]
50563
+ });
50564
+ const include2 = import_node_path11.default.join(layout.root, target.path, "include");
50565
+ files2.set(
50566
+ import_node_path11.default.join(include2, "module.modulemap"),
50567
+ `module ${target.name}ImplementationDeclarations { export * }
50558
50568
  `
50559
- );
50560
- native.set(target.name, {
50561
- mixed: true,
50562
- path: target.path,
50563
- includeDirectory: include2,
50564
- sources: nativeUnits.map(([file]) => file.slice(prefix.length)),
50565
- lateSources: [...nativeUnits.map(([file]) => file.slice(prefix.length)), thunk],
50566
- exclude: [
50567
- ...entries.filter(([file]) => !file.endsWith(".swift") && !file.endsWith(".metal")).map(([file]) => file.slice(prefix.length)),
50568
- ...accessor ? [OBJC_RESOURCE_ACCESSOR_HEADER, OBJC_RESOURCE_ACCESSOR_BODY] : [],
50569
- thunk,
50570
- "include"
50571
- ],
50572
- groups: [...groups.values()],
50573
- late: {
50574
- name: `${target.name}SwiftImplementation`,
50575
- producers: [
50576
- target.name,
50577
- ...(target.dependencies ?? []).filter((dependency) => swiftTargets.has(dependency.name)).map((dependency) => dependency.name)
50578
- ]
50579
- }
50580
- });
50569
+ );
50570
+ native.set(target.name, {
50571
+ mixed: true,
50572
+ path: target.path,
50573
+ includeDirectory: include2,
50574
+ sources: nativeUnits.map(([file]) => file.slice(prefix.length)),
50575
+ lateSources: [
50576
+ ...nativeUnits.map(([file]) => file.slice(prefix.length)),
50577
+ ...thunks
50578
+ ],
50579
+ exclude: [
50580
+ ...entries.filter(([file]) => !file.endsWith(".swift") && !file.endsWith(".metal")).map(([file]) => file.slice(prefix.length)),
50581
+ ...accessor ? [OBJC_RESOURCE_ACCESSOR_HEADER, OBJC_RESOURCE_ACCESSOR_BODY] : [],
50582
+ ...thunks,
50583
+ "include"
50584
+ ],
50585
+ groups: [...groups.values()],
50586
+ late: {
50587
+ name: `${target.name}SwiftImplementation`,
50588
+ producers: [
50589
+ target.name,
50590
+ ...(target.dependencies ?? []).filter((dependency) => swiftTargets.has(dependency.name)).map((dependency) => dependency.name)
50591
+ ]
50592
+ }
50593
+ });
50594
+ } catch (error) {
50595
+ if (!swift || !(error instanceof Error)) throw error;
50596
+ targetFailures.push(`${target.name}: ${error.message}`);
50597
+ native.set(target.name, {
50598
+ mixed: true,
50599
+ path: target.path,
50600
+ includeDirectory: import_node_path11.default.join(layout.root, target.path, "include"),
50601
+ sources: [],
50602
+ lateSources: [],
50603
+ exclude: entries.filter(([file]) => !file.endsWith(".swift") && !file.endsWith(".metal")).map(([file]) => file.slice(prefix.length))
50604
+ });
50605
+ }
50581
50606
  continue;
50582
50607
  }
50583
50608
  const includes = `${prefix}include/`;
@@ -50740,20 +50765,27 @@ export *
50740
50765
  for (const name3 of objcProducers) {
50741
50766
  const target = targets.find((value) => value.name === name3);
50742
50767
  const prefix = target.path === "." ? "" : `${target.path}/`;
50743
- const exported = swiftObjCExports({
50744
- module: swiftTargetModuleName(name3),
50745
- sources: Object.entries(input.files).filter(
50746
- ([file]) => file.startsWith(prefix) && file.endsWith(".swift") && !targets.some(
50747
- (candidate) => candidate.name !== name3 && candidate.path !== "." && candidate.path.startsWith(prefix) && file.startsWith(`${candidate.path}/`)
50748
- ) && !target.exclude?.some(
50749
- (excluded) => file.slice(prefix.length) === excluded || file.slice(prefix.length).startsWith(`${excluded}/`)
50750
- )
50751
- ),
50752
- mask: swiftCodeMask,
50753
- declarationStart,
50754
- selector: objcSelectorName,
50755
- foreignTypes: imports.get(name3)?.foreignTypes
50756
- });
50768
+ let exported;
50769
+ try {
50770
+ exported = swiftObjCExports({
50771
+ module: swiftTargetModuleName(name3),
50772
+ sources: Object.entries(input.files).filter(
50773
+ ([file]) => file.startsWith(prefix) && file.endsWith(".swift") && !targets.some(
50774
+ (candidate) => candidate.name !== name3 && candidate.path !== "." && candidate.path.startsWith(prefix) && file.startsWith(`${candidate.path}/`)
50775
+ ) && !target.exclude?.some(
50776
+ (excluded) => file.slice(prefix.length) === excluded || file.slice(prefix.length).startsWith(`${excluded}/`)
50777
+ )
50778
+ ),
50779
+ mask: swiftCodeMask,
50780
+ declarationStart,
50781
+ selector: objcSelectorName,
50782
+ foreignTypes: imports.get(name3)?.foreignTypes
50783
+ });
50784
+ } catch (error) {
50785
+ if (!(error instanceof Error)) throw error;
50786
+ targetFailures.push(`${name3}: ${error.message}`);
50787
+ continue;
50788
+ }
50757
50789
  const original = imports.get(name3);
50758
50790
  if (!exported && !original) continue;
50759
50791
  objcModules.add(name3);
@@ -51025,6 +51057,7 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
51025
51057
  for (const dependency of dependencies.get(producer) ?? []) include(dependency);
51026
51058
  return {
51027
51059
  headerProducers: producers.filter((name3) => !included.has(name3)),
51060
+ targetFailures,
51028
51061
  ...rootOwner && objcExports ? {
51029
51062
  objcImplementations: {
51030
51063
  owner: import_node_path11.default.join(layout.root, rootOwner),
@@ -51243,6 +51276,9 @@ function compileSwiftProjectUnit(input, options) {
51243
51276
  return retain(root, built2);
51244
51277
  }
51245
51278
  const preparation = writeSwiftProject(layout, input, moduleRoot);
51279
+ const unprepared = preparation.targetFailures.map(
51280
+ (failure3) => `error: target ${failure3}`
51281
+ );
51246
51282
  const swift = import_node_path11.default.join(options.toolchainBin, "swift");
51247
51283
  if (!(0, import_node_fs13.existsSync)(swift)) {
51248
51284
  throw new Error(
@@ -51392,18 +51428,23 @@ function compileSwiftProjectUnit(input, options) {
51392
51428
  );
51393
51429
  } catch (retryError) {
51394
51430
  throw new Error(
51395
- projectDiagnostic(outputOf(retryError), layout, input.files),
51396
- {
51397
- cause: retryError
51398
- }
51431
+ [
51432
+ ...unprepared,
51433
+ projectDiagnostic(outputOf(retryError), layout, input.files)
51434
+ ].join("\n"),
51435
+ { cause: retryError }
51399
51436
  );
51400
51437
  }
51401
51438
  } else {
51402
- throw new Error(projectDiagnostic(output, layout, input.files), {
51403
- cause: error
51404
- });
51439
+ throw new Error(
51440
+ [...unprepared, projectDiagnostic(output, layout, input.files)].join(
51441
+ "\n"
51442
+ ),
51443
+ { cause: error }
51444
+ );
51405
51445
  }
51406
51446
  }
51447
+ if (unprepared.length) throw new Error(unprepared.join("\n"));
51407
51448
  const artifact = {
51408
51449
  hash: hash2,
51409
51450
  bytes: (0, import_node_fs13.readFileSync)(builtArtifact(layout)),
@@ -51526,7 +51567,7 @@ var init_swift_compile = __esm({
51526
51567
  `;
51527
51568
  REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
51528
51569
  MULTI_MANIFEST_VERSION = 39;
51529
- compilerSourceDigest = true ? "bcd59db8ba588a1eb76c6f08e64f5b5b6acda2e913adef5edd85345fef2c0cc7" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
51570
+ compilerSourceDigest = true ? "042e57f70d169ec5fd94262a87fc4d50da0c31cc6a6c329e56f12d4b7c5484a1" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
51530
51571
  DIRECTIVE = /^[ \t]*#(?:if|elseif)\b/;
51531
51572
  OS_IOS = /\b(?:os\(\s*iOS\s*\)|targetEnvironment\(\s*simulator\s*\))/g;
51532
51573
  OBJC_ATTRIBUTE = /^@(?:objcMembers\b|objc\b(?:(\s*)\(([^()]*)\))?|IBAction\b)/;
@@ -64634,7 +64675,7 @@ var init_runtime_assets = __esm({
64634
64675
  var runtime_companion_default;
64635
64676
  var init_runtime_companion = __esm({
64636
64677
  "runtime-companion.json"() {
64637
- runtime_companion_default = { abi: 1, sha256: "a1b49c57129dd06888a9cdfbb05051be3626e8233980236705a3efd52b651623", file: "node/cli-a1b49c57129dd06888a9cdfbb05051be3626e8233980236705a3efd52b651623.cjs" };
64678
+ runtime_companion_default = { abi: 1, sha256: "6f6a55398d832d1703346a258bf9f81bf78fded8cf5d83cdf51e5e15ccd7a1ce", file: "node/cli-6f6a55398d832d1703346a258bf9f81bf78fded8cf5d83cdf51e5e15ccd7a1ce.cjs" };
64638
64679
  }
64639
64680
  });
64640
64681
 
@@ -71112,18 +71153,32 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
71112
71153
  await route.respond(proxyRes, hopCookies);
71113
71154
  res.statusCode = status;
71114
71155
  if (isBundleProxyRequestUrl(req.url) && method === "GET" && status === 200 && targetUrl.pathname.endsWith(".bundle") && proxyRes.headers["x-peach-rolldown-inventory"] !== "1") {
71115
- const chunks = [];
71116
- for await (const chunk of proxyRes) {
71117
- chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
71118
- }
71119
- const payload = Buffer.concat(chunks).toString("utf8");
71120
- const contentType2 = typeof proxyRes.headers["content-type"] === "string" ? proxyRes.headers["content-type"] : void 0;
71121
- const annotated = await getCliRuntime().rolldown_bundle_inventory.attachRolldownBundleHttpPayload(
71122
- payload,
71123
- contentType2
71124
- );
71156
+ const contentType2 = typeof proxyRes.headers["content-type"] === "string" ? proxyRes.headers["content-type"] : "";
71157
+ const inventory = getCliRuntime().rolldown_bundle_inventory;
71125
71158
  res.removeHeader("content-length");
71126
- res.end(Buffer.from(annotated, "utf8"));
71159
+ const annotate = async function* () {
71160
+ const decoder = new TextDecoder();
71161
+ let payload = "";
71162
+ let sent = 0;
71163
+ let bundleStarted = false;
71164
+ for await (const chunk of proxyRes) {
71165
+ payload += decoder.decode(chunk, { stream: true });
71166
+ if (bundleStarted) continue;
71167
+ const releasable = inventory.releasableMultipartPrefix(payload, contentType2);
71168
+ bundleStarted = releasable.bundleStarted;
71169
+ if (releasable.length > sent) {
71170
+ yield Buffer.from(payload.slice(sent, releasable.length), "utf8");
71171
+ sent = releasable.length;
71172
+ }
71173
+ }
71174
+ payload += decoder.decode();
71175
+ const annotated = await inventory.attachRolldownBundleHttpPayload(
71176
+ payload,
71177
+ contentType2
71178
+ );
71179
+ yield Buffer.from(annotated.slice(sent), "utf8");
71180
+ };
71181
+ await (0, import_promises5.pipeline)(import_stream.Readable.from(annotate(), { objectMode: false }), res);
71127
71182
  return;
71128
71183
  }
71129
71184
  await (0, import_promises5.pipeline)(proxyRes, res);
@@ -71170,13 +71225,14 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
71170
71225
  else req.socket.destroy();
71171
71226
  }
71172
71227
  }
71173
- var import_http2, import_https, import_node_http2, import_promises5, fetchProxyHttpAgent, fetchProxyHttpsAgent, FETCH_PROXY_CORS_HEADERS, APP_API_HEADER_REWRITES;
71228
+ var import_http2, import_https, import_node_http2, import_stream, import_promises5, fetchProxyHttpAgent, fetchProxyHttpsAgent, FETCH_PROXY_CORS_HEADERS, APP_API_HEADER_REWRITES;
71174
71229
  var init_fetch_proxy_handler = __esm({
71175
71230
  "src/host/fetch-proxy-handler.ts"() {
71176
71231
  "use strict";
71177
71232
  import_http2 = __toESM(require("http"), 1);
71178
71233
  import_https = __toESM(require("https"), 1);
71179
71234
  import_node_http2 = require("node:http2");
71235
+ import_stream = require("stream");
71180
71236
  import_promises5 = require("stream/promises");
71181
71237
  init_backend_origin();
71182
71238
  init_bundleGlobalFooter();