peachsim 0.1.2220 → 0.1.2222

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 (128) hide show
  1. package/cli/commands/compat.ts +4 -4
  2. package/cli/commands/inspect.ts +4 -4
  3. package/cli/commands/report-issue.ts +1 -1
  4. package/cli/runtime-compat.ts +7 -2
  5. package/dist-lib/agent-daemon-client.cjs +1 -1
  6. package/dist-lib/agent-events.cjs +1 -1
  7. package/dist-lib/attached-projects.cjs +1 -1
  8. package/dist-lib/auth/shared-session.cjs +1 -1
  9. package/dist-lib/backend-origin.cjs +1 -1
  10. package/dist-lib/beta.cjs +1 -1
  11. package/dist-lib/beta.mjs +1 -1
  12. package/dist-lib/bridge-constants.cjs +1 -1
  13. package/dist-lib/bridge-contract-input.cjs +1 -1
  14. package/dist-lib/bridge-contract-input.mjs +1 -1
  15. package/dist-lib/bridge-contract.cjs +1 -1
  16. package/dist-lib/bridge-contract.mjs +1 -1
  17. package/dist-lib/bundle-channel.cjs +475 -381
  18. package/dist-lib/capture-contract.cjs +1 -1
  19. package/dist-lib/capture-contract.mjs +1 -1
  20. package/dist-lib/cloud-contract.cjs +1 -1
  21. package/dist-lib/cloud-contract.mjs +1 -1
  22. package/dist-lib/cloud-test-args.cjs +1 -1
  23. package/dist-lib/cloud-test-args.mjs +1 -1
  24. package/dist-lib/cloud.cjs +1 -1
  25. package/dist-lib/cloud.mjs +1 -1
  26. package/dist-lib/config.cjs +1 -1
  27. package/dist-lib/config.mjs +1 -1
  28. package/dist-lib/detox/index.cjs +3 -2
  29. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  30. package/dist-lib/expo-swift-bundle.cjs +472 -379
  31. package/dist-lib/expo-swift-metadata.cjs +1 -1
  32. package/dist-lib/expo-swift-metadata.mjs +1 -1
  33. package/dist-lib/home-paths.cjs +1 -1
  34. package/dist-lib/host/bridge-host.cjs +695 -574
  35. package/dist-lib/host/fetch-proxy-handler.cjs +10 -7
  36. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  37. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  38. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  39. package/dist-lib/host/websocket-proxy.cjs +1 -1
  40. package/dist-lib/index.cjs +8232 -7815
  41. package/dist-lib/jump-to-source-babel.cjs +1 -1
  42. package/dist-lib/jump-to-source-native.cjs +1 -1
  43. package/dist-lib/kotlin-host.cjs +1 -1
  44. package/dist-lib/menu.cjs +1 -1
  45. package/dist-lib/menu.mjs +1 -1
  46. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  47. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  48. package/dist-lib/metro-production-bundle.cjs +1 -1
  49. package/dist-lib/metro-production-bundle.mjs +1 -1
  50. package/dist-lib/metro.cjs +8146 -7737
  51. package/dist-lib/native-app-identity-project.cjs +331 -13
  52. package/dist-lib/native-app-identity-project.mjs +331 -13
  53. package/dist-lib/native-app-identity.cjs +16 -3
  54. package/dist-lib/native-app-identity.mjs +16 -3
  55. package/dist-lib/native-firebase-metadata.cjs +1 -1
  56. package/dist-lib/native-firebase-metadata.mjs +1 -1
  57. package/dist-lib/pdfium-raster.cjs +1 -1
  58. package/dist-lib/pdfium-raster.mjs +1 -1
  59. package/dist-lib/plist.cjs +1 -1
  60. package/dist-lib/plist.mjs +1 -1
  61. package/dist-lib/profiles.cjs +1 -1
  62. package/dist-lib/public-brand.cjs +1 -1
  63. package/dist-lib/public-origins-lib-esm.json +25 -24
  64. package/dist-lib/public-origins-lib.json +99 -96
  65. package/dist-lib/react-native-host-modules.cjs +1 -1
  66. package/dist-lib/react-native-host-modules.mjs +1 -1
  67. package/dist-lib/reap-browser.cjs +1 -1
  68. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  69. package/dist-lib/sdk.cjs +1 -1
  70. package/dist-lib/sdk.mjs +1 -1
  71. package/dist-lib/skills.cjs +532 -420
  72. package/dist-lib/swift-compile.cjs +84 -49
  73. package/dist-lib/swift-compile.mjs +84 -49
  74. package/dist-lib/swift-package.cjs +1 -1
  75. package/dist-lib/swift-package.mjs +1 -1
  76. package/dist-lib/swift-submit.cjs +1 -1
  77. package/dist-lib/swift-submit.mjs +1 -1
  78. package/dist-lib/swift-toolchain.cjs +1 -1
  79. package/dist-lib/swift.cjs +1 -1
  80. package/dist-lib/vite-swift.cjs +158 -69
  81. package/dist-lib/vite.cjs +2930 -2800
  82. package/dist-lib/worklet-executable.cjs +1 -1
  83. package/dist-lib/worklet-executable.mjs +1 -1
  84. package/dist-types/packages/peach-engine/src/cli-companion.d.ts +1 -0
  85. package/dist-types/packages/peach-engine/src/cli-host-terser.d.ts +7 -0
  86. package/dist-types/packages/peach-engine/src/engine/glass-material.d.ts +1 -1
  87. package/dist-types/packages/peach-engine/src/engine/liquid-glass.d.ts +1 -0
  88. package/dist-types/packages/peach-engine/src/engine/native-layout.d.ts +1 -0
  89. package/dist-types/packages/peach-engine/src/engine/node.d.ts +5 -0
  90. package/dist-types/packages/peach-engine/src/engine/scene-table.d.ts +8 -1
  91. package/dist-types/packages/peach-engine/src/engine/types.d.ts +3 -0
  92. package/dist-types/packages/peach-engine/src/engine/yoga-layout.d.ts +1 -1
  93. package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +2 -2
  94. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +1 -0
  95. package/dist-types/packages/peach-engine/src/render-worker/shell-tree-wire.d.ts +1 -2
  96. package/dist-types/packages/peach-kit/src/internal.d.ts +1 -0
  97. package/dist-types/packages/peach-kit/src/ios-tint.d.ts +1 -0
  98. package/dist-types/packages/peach-kit/src/transitions/screen-transition-math.d.ts +25 -0
  99. package/kotlin/sdk.tar.gz +0 -0
  100. package/package.json +1 -1
  101. package/runtime-companion.json +1 -1
  102. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNAnimation.h +4 -4
  103. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNCameraController.h +1 -1
  104. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNConstraint.h +5 -5
  105. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNGeometry.h +1 -1
  106. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNLevelOfDetail.h +1 -1
  107. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNParametricGeometry.h +9 -9
  108. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNParticleSystem.h +1 -1
  109. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNPhysicsBehavior.h +7 -7
  110. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNRenderer.h +1 -1
  111. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNShadable.h +1 -1
  112. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNTechnique.h +1 -1
  113. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/NSLayoutConstraint.h +1 -8
  114. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Modules/module.modulemap +1 -0
  115. package/sdk/ios/System/Library/Frameworks/UIKitTypes.framework/Headers/UIKitTypes.h +1 -0
  116. package/sdk/ios/System/Library/Frameworks/UIKitTypes.framework/Headers/UILayoutPriority.h +11 -0
  117. package/src/cli-runtime.ts +1 -0
  118. package/src/expo-native-workspace.ts +14 -10
  119. package/src/expo-workspace-exclusion.ts +10 -7
  120. package/src/react-native-autolinking.ts +2 -1
  121. package/src/runtime-delivery.ts +7 -0
  122. package/src/swift-compile.ts +90 -54
  123. package/src/swift-coverage/xcode-assets.ts +4 -2
  124. package/src/swift-host.ts +53 -14
  125. package/src/swift-objc-import.ts +4 -0
  126. package/src/wasm-optimize.ts +5 -1
  127. package/src/xcode-project.ts +26 -5
  128. package/src/xcode-target-members.ts +25 -3
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2220 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2222 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -39,7 +39,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
39
39
  var define_SWIFT_COVERAGE_SOURCE_DIGESTS_default;
40
40
  var init_define_SWIFT_COVERAGE_SOURCE_DIGESTS = __esm({
41
41
  "<define:__SWIFT_COVERAGE_SOURCE_DIGESTS__>"() {
42
- define_SWIFT_COVERAGE_SOURCE_DIGESTS_default = { "swift-coverage/indexdump.ts": "0d82d8eeb96bf377f409ea7e33274c341a710c0e071f6b6e17571a23d8d92412", "swift-coverage/indexing.ts": "633ccf19eec1f382a8847d0ee1dca42a2792a3c60aafd43622ed5152b09b8272", "swift-coverage/types.ts": "bd8fae54ea6c53e110cd8a5d7b57c1d532dd0166e09fdaea63c4f270c3780dd1", "swift-coverage/source.ts": "c151758a9f67631bc61473c375df0dc017da6902a34533b2cf4fc4fd7d19b6ee", "swift-coverage/package.ts": "1f0068be7461fa7c5a7a891faf318f305cbed2e94c19667ba76627f7e5be260b", "swift-coverage/xcode.ts": "65a500b806ce1c3a496de27f2e0ad77287c0f6795c618342c08af647f92af1fa", "swift-coverage/xcode-assets.ts": "99e03b74c961d2449afd58c2cbc415ba91d1d469a4f89e461c137fd6c305b27c", "swift-coverage/xcode-asset-symbols.ts": "1b2a67733bc9d139b351466270205452a6172140bc25080d72619e2952c44671", "swift-coverage/xcode-bridging.ts": "33184be8c5daf6646aa5a1276a4e15531f1be27b7c26f56550e0fbb1fc678a11", "swift-coverage/xcode-packages.ts": "8e6020d17d24474150a5a50d042aca6261819ef75c79680a287a66f395909915", "swift-coverage/xcode-strings.ts": "f2dd4c7cd8ef77035184b0132909c2fa09fd20ed06b7757c2f1f960bfdde031c", "swift-coverage/reader.ts": "da559b67ecd1161dea70c980b5f98f2c55af3550f0714479100fa5e9e813625c", "swift-coverage/provenance.ts": "eb3b41ae8b58b48f6758f084800f188dfb1edb227e483abdd6b80cde66e849b9", "swift-package-manifest.ts": "29c2661be4b952101c9b9b8fd861560e6ce63b25dd4464f47475aaf72024f4fe", "swift-package.ts": "338cfef9a34a930206ac2e1a8a90b85c8d61f776d9a41e6445dc18e0c5385cdb", "swift-source-file.ts": "93fd659ed63a27b67f54a7c229a7ceb636dc9c59e68414920ba36cff1eda1f94", "swift-toolchain.ts": "25505683ca29a0b380413bf2a5026d4967eacf886e35bc11ece6e15317e5bb02", "home-paths.ts": "d1606390f0e8e50f0ff72544eadb3d49dfabf08e004c1218f2998c36fb8995dd", "xcode-header-search.ts": "f8c3d557b4eca5ddad32907545353eb7ad53b2ebd0969d9ed8f7275e109a13b1", "xcode-project.ts": "86f79e98323ec065e0e5195324c75ca608f490efbd95dcc25c53d5aa0b9aecc9", "xcode-target-members.ts": "ad7589132bffab265e8a10b64e24484fe88b4a2b1cc0ee19a97f151a002eca77", "xcode-json-project.ts": "41990ebbe4b488eef34e74c4608b4b48e5a5b299ba98ca7fbcfdfa0e77be63b6", "openstep-plist.ts": "74e6ce1dac80c9c318e0e9f5e3e8cd19a898a8820c36fc160609695bcb59dcd3" };
42
+ define_SWIFT_COVERAGE_SOURCE_DIGESTS_default = { "swift-coverage/indexdump.ts": "0d82d8eeb96bf377f409ea7e33274c341a710c0e071f6b6e17571a23d8d92412", "swift-coverage/indexing.ts": "633ccf19eec1f382a8847d0ee1dca42a2792a3c60aafd43622ed5152b09b8272", "swift-coverage/types.ts": "bd8fae54ea6c53e110cd8a5d7b57c1d532dd0166e09fdaea63c4f270c3780dd1", "swift-coverage/source.ts": "c151758a9f67631bc61473c375df0dc017da6902a34533b2cf4fc4fd7d19b6ee", "swift-coverage/package.ts": "1f0068be7461fa7c5a7a891faf318f305cbed2e94c19667ba76627f7e5be260b", "swift-coverage/xcode.ts": "65a500b806ce1c3a496de27f2e0ad77287c0f6795c618342c08af647f92af1fa", "swift-coverage/xcode-assets.ts": "d98d6294b359528f7733b26db6f80f554782354faa235605f9562be4ad98b8a3", "swift-coverage/xcode-asset-symbols.ts": "1b2a67733bc9d139b351466270205452a6172140bc25080d72619e2952c44671", "swift-coverage/xcode-bridging.ts": "33184be8c5daf6646aa5a1276a4e15531f1be27b7c26f56550e0fbb1fc678a11", "swift-coverage/xcode-packages.ts": "8e6020d17d24474150a5a50d042aca6261819ef75c79680a287a66f395909915", "swift-coverage/xcode-strings.ts": "f2dd4c7cd8ef77035184b0132909c2fa09fd20ed06b7757c2f1f960bfdde031c", "swift-coverage/reader.ts": "da559b67ecd1161dea70c980b5f98f2c55af3550f0714479100fa5e9e813625c", "swift-coverage/provenance.ts": "eb3b41ae8b58b48f6758f084800f188dfb1edb227e483abdd6b80cde66e849b9", "swift-package-manifest.ts": "29c2661be4b952101c9b9b8fd861560e6ce63b25dd4464f47475aaf72024f4fe", "swift-package.ts": "338cfef9a34a930206ac2e1a8a90b85c8d61f776d9a41e6445dc18e0c5385cdb", "swift-source-file.ts": "93fd659ed63a27b67f54a7c229a7ceb636dc9c59e68414920ba36cff1eda1f94", "swift-toolchain.ts": "25505683ca29a0b380413bf2a5026d4967eacf886e35bc11ece6e15317e5bb02", "home-paths.ts": "d1606390f0e8e50f0ff72544eadb3d49dfabf08e004c1218f2998c36fb8995dd", "xcode-header-search.ts": "f8c3d557b4eca5ddad32907545353eb7ad53b2ebd0969d9ed8f7275e109a13b1", "xcode-project.ts": "b6e04100805ba81f14d751383416fd4aab46901a6f94f5b62f831e66c28001c1", "xcode-target-members.ts": "d49af77a690cff481b38333b5f63f6600123b1bb57f410b0adb298b010d2047b", "xcode-json-project.ts": "41990ebbe4b488eef34e74c4608b4b48e5a5b299ba98ca7fbcfdfa0e77be63b6", "openstep-plist.ts": "74e6ce1dac80c9c318e0e9f5e3e8cd19a898a8820c36fc160609695bcb59dcd3" };
43
43
  }
44
44
  });
45
45
 
@@ -15267,7 +15267,8 @@ var FEATURES = [
15267
15267
  "reference-types",
15268
15268
  "sign-ext"
15269
15269
  ];
15270
- var WASM_OPTIMIZE_IDENTITY = `wasm-opt ${import_wasm_opt.BINARYEN_VERSION} -Oz ${FEATURES.join(",")}`;
15270
+ var KEEP_WASM_NAMES = process.env.PEACH_SWIFT_NAMES === "1";
15271
+ var WASM_OPTIMIZE_IDENTITY = `wasm-opt ${import_wasm_opt.BINARYEN_VERSION} -Oz ${FEATURES.join(",")}${KEEP_WASM_NAMES ? " -g" : ""}`;
15271
15272
  var PINNED_BINARYEN_VERSION = "132";
15272
15273
  var BINARYEN_RELEASES = /* @__PURE__ */ new Map([
15273
15274
  [
@@ -15303,6 +15304,7 @@ async function runWasmOpt(file, output2, skipPasses, binary) {
15303
15304
  const result = await (0, import_wasm_opt.wasmOpt)(
15304
15305
  [
15305
15306
  "-Oz",
15307
+ ...KEEP_WASM_NAMES ? ["-g"] : [],
15306
15308
  ...skipPasses.flatMap((pass) => ["--skip-pass", pass]),
15307
15309
  ...FEATURES.map((feature) => `--enable-${feature}`),
15308
15310
  file,
@@ -16073,7 +16075,7 @@ function swiftSubmoduleImports(sources) {
16073
16075
  }
16074
16076
  return imports2;
16075
16077
  }
16076
- function swiftObjCModuleMap(module2, headers, submodules = /* @__PURE__ */ new Set()) {
16078
+ function swiftObjCModuleMap(module2, headers, submodules = /* @__PURE__ */ new Set(), swiftHeader) {
16077
16079
  const header = (file) => `header ${JSON.stringify(file)}`;
16078
16080
  const stem = (file) => file.slice(file.lastIndexOf("/") + 1).replace(/\.[^.]*$/, "");
16079
16081
  return [
@@ -16081,6 +16083,7 @@ function swiftObjCModuleMap(module2, headers, submodules = /* @__PURE__ */ new S
16081
16083
  ...headers.map(
16082
16084
  (file) => submodules.has(stem(file)) ? ` module ${stem(file)} { ${header(file)} export * }` : ` ${header(file)}`
16083
16085
  ),
16086
+ ...swiftHeader ? [" module Swift {", ` ${header(swiftHeader)}`, " requires objc", " }"] : [],
16084
16087
  " export *",
16085
16088
  "}",
16086
16089
  ""
@@ -16625,7 +16628,10 @@ function swiftModuleInterface(moduleRoot, name3, interfaceRoot) {
16625
16628
  if (declared.size === 0) return null;
16626
16629
  return { declared, header: clangInterfaceHeader((0, import_node_fs27.readFileSync)(built2, "utf8")) };
16627
16630
  }
16628
- var clangInterfaceHeader = (header) => header.replace(/^@import (?:UIKitCore|UIKitText);$/gm, "@import UIKit;").replace(/^@import CoreFoundation;$/gm, "@import Foundation;").replace(/\b_TtC10Foundation\d+(NS\w+)\b/g, "$1").replace(/\b__attribute__\(\(objc_subclassing_restricted\)\)\s*/g, "");
16631
+ var clangInterfaceHeader = (header) => header.replace(/^@import (?:UIKitCore|UIKitText);$/gm, "@import UIKit;").replace(
16632
+ /^@import (?:CoreFoundation|FoundationNetworking);$/gm,
16633
+ "@import Foundation;"
16634
+ ).replace(/\b_TtC10Foundation\d+(NS\w+)\b/g, "$1").replace(/\b__attribute__\(\(objc_subclassing_restricted\)\)\s*/g, "");
16629
16635
  var swiftInterfaceDeclarations = (header) => /* @__PURE__ */ new Set([
16630
16636
  ...[
16631
16637
  ...header.matchAll(
@@ -16918,7 +16924,8 @@ var OPTIONAL_FRAMEWORK_DEPENDENCIES = {
16918
16924
  PeachCFNetwork: [],
16919
16925
  JavaScriptCore: ["PeachJavaScriptCore"],
16920
16926
  PeachJavaScriptCore: [],
16921
- GameplayKit: [],
16927
+ // GameplayKit names SpriteKit and SceneKit nodes, as on iOS
16928
+ GameplayKit: ["SpriteKit", "SceneKit", "PeachBox2D", "simd", "GLKit"],
16922
16929
  simd: [],
16923
16930
  ModelIO: ["simd"],
16924
16931
  GLKit: ["ModelIO"],
@@ -17429,10 +17436,21 @@ function swiftTargetDependencies(files2, targets, frameworks = OPTIONAL_FRAMEWOR
17429
17436
  return siblings;
17430
17437
  }
17431
17438
  var ONE_PRODUCT = '.product(name: "One", package: "sootsim-swift")';
17432
- var SPRITEKIT_PRODUCT = '.product(name: "SpriteKit", package: "sootsim-swift")';
17433
- var importsSpriteKit = (files2) => Object.entries(files2).some(
17434
- ([file, contents]) => file.endsWith(".swift") && swiftImportNames(contents).includes("SpriteKit")
17435
- );
17439
+ var GAME_FAMILY = ["SpriteKit", "SceneKit"];
17440
+ var gameProducts = (files2) => {
17441
+ const imported = new Set(
17442
+ Object.entries(files2).flatMap(
17443
+ ([file, contents]) => file.endsWith(".swift") ? swiftImportNames(contents) : []
17444
+ )
17445
+ );
17446
+ if (imported.has("SceneKit")) return [...GAME_FAMILY];
17447
+ return imported.has("SpriteKit") ? ["SpriteKit"] : [];
17448
+ };
17449
+ var gameProduct = (name3) => `.product(name: "${name3}", package: "sootsim-swift")`;
17450
+ var GAME_REACH = {
17451
+ SpriteKit: ["SpriteKit", "PeachBox2D", "simd", "GLKit"],
17452
+ SceneKit: ["SceneKit"]
17453
+ };
17436
17454
  var FOUNDATION_IMPLICIT_MODULES = [
17437
17455
  "PeachObjC",
17438
17456
  "Dispatch",
@@ -17459,7 +17477,7 @@ var darwinRecordsRegion = (quoted) => quoted.length ? ["-Wl,--start-lib", ...quo
17459
17477
  var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
17460
17478
  var MULTI_MANIFEST_VERSION = 68;
17461
17479
  var SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
17462
- var compilerSourceDigest = true ? "0a0bc1c871aee83ea273120655f55a43ddccde646478a452b4c73d2daefd58c3" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
17480
+ var compilerSourceDigest = true ? "eba60b7a2e9485f928a6ec2e544e10d84b2b33430be66b9e069c9797a927af86" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
17463
17481
  function swiftArtifactHash(input, release, moduleRoot) {
17464
17482
  const hash = (0, import_node_crypto13.createHash)("sha256");
17465
17483
  hash.update(`swift-compile
@@ -17467,6 +17485,7 @@ ${release}
17467
17485
  `);
17468
17486
  hash.update(compilerSourceDigest);
17469
17487
  if (input.oneModule) hash.update("one-module\n");
17488
+ if (KEEP_WASM_NAMES) hash.update("names\n");
17470
17489
  hash.update(swiftModuleDigest(moduleRoot));
17471
17490
  if (input.optimize) hash.update(`optimize
17472
17491
  ${WASM_OPTIMIZE_IDENTITY}
@@ -17581,7 +17600,14 @@ function toolsetOrdersLibcxxBeforeDarwinOverlay(options) {
17581
17600
  return libcxx >= 0 && overlay > libcxx;
17582
17601
  }
17583
17602
  function emitSwiftPackageManifest(args) {
17584
- const { targets, siblings, moduleRoot, oneModule, spriteKit, distribution } = args;
17603
+ const {
17604
+ targets,
17605
+ siblings,
17606
+ moduleRoot,
17607
+ oneModule,
17608
+ gameProducts: gameProducts2 = [],
17609
+ distribution
17610
+ } = args;
17585
17611
  const prebuilt = args.prebuilt;
17586
17612
  const linkedObjects = Boolean(distribution || prebuilt);
17587
17613
  const cxxFlagsFor = (flags) => args.deferDarwinOverlay ? withoutWasmOverlayIsystem(flags) : flags;
@@ -17610,9 +17636,8 @@ function emitSwiftPackageManifest(args) {
17610
17636
  for (const name3 of [...siblings.values()].flat())
17611
17637
  if (OPTIONAL_FRAMEWORKS.has(name3) && !targets.some((target) => target.name === name3))
17612
17638
  reach(name3);
17613
- if (spriteKit) {
17614
- for (const name3 of ["SpriteKit", "PeachBox2D", "simd", "GLKit"]) reach(name3);
17615
- }
17639
+ for (const product of gameProducts2)
17640
+ for (const name3 of GAME_REACH[product] ?? []) reach(name3);
17616
17641
  let distributionLinkPath;
17617
17642
  const distributionLink = args.distributionLink;
17618
17643
  if (distribution && distributionLink) {
@@ -17635,7 +17660,7 @@ function emitSwiftPackageManifest(args) {
17635
17660
  (object4) => !isProvider(object4) && !replacedObjects.has(object4)
17636
17661
  );
17637
17662
  const objects = available.filter(
17638
- (object4) => !targets.some((target) => object4.startsWith(`lib/${target.name}-`)) && [...OPTIONAL_FRAMEWORKS, "SpriteKit", "PeachBox2D"].every(
17663
+ (object4) => !targets.some((target) => object4.startsWith(`lib/${target.name}-`)) && [...OPTIONAL_FRAMEWORKS, ...GAME_FAMILY, "PeachBox2D"].every(
17639
17664
  (name3) => !object4.startsWith(`lib/${name3}-`) || reachedFrameworks.has(name3)
17640
17665
  )
17641
17666
  );
@@ -17752,6 +17777,10 @@ function emitSwiftPackageManifest(args) {
17752
17777
  includeImportContext(dependency);
17753
17778
  const importedNativeFlags = [
17754
17779
  ...args.nativeImportFlags?.get(target.name) ?? [],
17780
+ ...[...importContext].flatMap((name3) => {
17781
+ const map = name3 === target.name ? void 0 : args.nativeSwiftHeaderMaps?.get(name3);
17782
+ return map ? ["-fmodule-map-file=" + map] : [];
17783
+ }),
17755
17784
  ...[...importContext].flatMap((name3) => args.native?.get(name3)?.importFlags ?? []),
17756
17785
  ...[...importContext].flatMap((name3) => {
17757
17786
  const flags = targets.find((target2) => target2.name === name3)?.swiftFlags ?? [];
@@ -17794,7 +17823,7 @@ function emitSwiftPackageManifest(args) {
17794
17823
  ...linkedObjects || clang && !target.executable ? [] : [
17795
17824
  '.product(name: "SwiftUI", package: "sootsim-swift")',
17796
17825
  ...oneModule ? [ONE_PRODUCT] : [],
17797
- ...spriteKit ? [SPRITEKIT_PRODUCT] : []
17826
+ ...gameProducts2.map(gameProduct)
17798
17827
  ],
17799
17828
  ...(siblings.get(target.name) ?? []).flatMap(
17800
17829
  (dependency) => clang && // textual native headers can include one another without imposing
@@ -17826,7 +17855,7 @@ function emitSwiftPackageManifest(args) {
17826
17855
  .unsafeFlags(${flagArray(`[
17827
17856
  ${REACTOR_FLAG}${executableLinkFlags(args.root)} "-Xlinker", "--export-if-defined=__main_argc_argv"${library},
17828
17857
  ]`)}),
17829
- .unsafeFlags(["-Xlinker", "--strip-all"], .when(configuration: .release)),
17858
+ ${KEEP_WASM_NAMES ? "" : '.unsafeFlags(["-Xlinker", "--strip-all"], .when(configuration: .release)),'}
17830
17859
  ]` : librarySettings.length > 0 ? `,
17831
17860
  linkerSettings: [${librarySettings.join(", ")}]` : "";
17832
17861
  const cDefines = macroSettings(target.cDefines);
@@ -18431,8 +18460,6 @@ var FOUNDATION_OVERLAY_GLOBALS = /* @__PURE__ */ new Set([
18431
18460
  "NSURLProtectionSpaceHTTPS",
18432
18461
  "NSURLProtectionSpaceHTTPSProxy",
18433
18462
  "NSURLProtectionSpaceSOCKSProxy",
18434
- "NSURLSessionDownloadTaskResumeData",
18435
- "NSURLSessionTransferSizeUnknown",
18436
18463
  "NSURLSessionUploadTaskResumeData",
18437
18464
  "NSUTF16BigEndianStringEncoding",
18438
18465
  "NSUTF16LittleEndianStringEncoding",
@@ -19523,6 +19550,7 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
19523
19550
  )
19524
19551
  );
19525
19552
  const importModuleMaps = /* @__PURE__ */ new Map();
19553
+ const sourceModuleMaps = /* @__PURE__ */ new Map();
19526
19554
  const generatedModuleMaps = [];
19527
19555
  for (const target of targets) {
19528
19556
  const prefix = target.path === "." ? "" : `${target.path}/`;
@@ -19757,6 +19785,10 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
19757
19785
  stageTargetFile(target.name, import_node_path27.default.join(layout2.root, modulemap), moduleContents, {
19758
19786
  allowExisting: true
19759
19787
  });
19788
+ sourceModuleMaps.set(swiftTargetModuleName(target.name), {
19789
+ path: import_node_path27.default.join(layout2.root, modulemap),
19790
+ contents: moduleContents.toString()
19791
+ });
19760
19792
  if (modulemap.endsWith("/Modules/module.modulemap")) {
19761
19793
  const framework = import_node_path27.default.posix.dirname(import_node_path27.default.posix.dirname(modulemap));
19762
19794
  for (const [, header] of moduleContents.toString().matchAll(/\bheader\s+"([^"]+)"/g))
@@ -20031,6 +20063,7 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
20031
20063
  if (native.size > 0) (0, import_node_fs27.mkdirSync)(headerDirectory, { recursive: true });
20032
20064
  const headerAliasFlags = Object.keys(input.headerAliases ?? {}).length > 0 ? ["-ivfsoverlay", headerSearch.files[0]] : [];
20033
20065
  const nativeHeaderFlags = [...headerAliasFlags];
20066
+ const nativeSwiftHeaderMaps = /* @__PURE__ */ new Map();
20034
20067
  const originalMaps = /* @__PURE__ */ new Map();
20035
20068
  for (const target of input.nativeTargets ?? []) {
20036
20069
  for (const flag of [...target.flags, ...target.cxxFlags]) {
@@ -20061,30 +20094,33 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
20061
20094
  );
20062
20095
  const moduleName = swiftTargetModuleName(name3);
20063
20096
  const originalMap = originalMaps.get(moduleName);
20064
- const originalTokens = originalMap ? moduleMapTokens(input.files[originalMap]) : [];
20065
- if (originalMap && originalTokens.some(
20097
+ const stagedMap = sourceModuleMaps.get(moduleName);
20098
+ const originalPath = originalMap ? import_node_path27.default.join(layout2.root, originalMap) : stagedMap?.path;
20099
+ const originalContents = originalMap ? input.files[originalMap] : stagedMap?.contents;
20100
+ const originalTokens = originalContents ? moduleMapTokens(originalContents) : [];
20101
+ if (originalPath && originalTokens.some(
20066
20102
  (token, index) => token === "module" && (originalTokens[index + 1] === "Swift" || originalTokens[index + 1] === `${moduleName}.Swift`)
20067
20103
  )) {
20068
- nativeHeaderFlags.push("-fmodule-map-file=" + import_node_path27.default.join(layout2.root, originalMap));
20104
+ nativeHeaderFlags.push("-fmodule-map-file=" + originalPath);
20105
+ nativeSwiftHeaderMaps.set(name3, originalPath);
20069
20106
  continue;
20070
20107
  }
20071
20108
  files2.set(
20072
20109
  modulemap,
20073
- originalMap ? `extern module ${moduleName} ${JSON.stringify(import_node_path27.default.join(layout2.root, originalMap))}
20110
+ originalPath ? `extern module ${moduleName} ${JSON.stringify(originalPath)}
20074
20111
  module ${moduleName}.Swift {
20075
20112
  header ${JSON.stringify(import_node_path27.default.join(headerDirectory, name3 + "-Swift.h"))}
20076
20113
  requires objc
20077
20114
  }
20078
20115
  ` : swiftObjCModuleMap(
20079
20116
  moduleName,
20080
- [
20081
- ...(input.nativeTargets?.find((target) => target.name === name3)?.publicHeaders ?? []).map((header) => import_node_path27.default.join(layout2.root, header)),
20082
- import_node_path27.default.join(headerDirectory, name3 + "-Swift.h")
20083
- ],
20084
- submoduleImports.get(moduleName)
20117
+ (input.nativeTargets?.find((target) => target.name === name3)?.publicHeaders ?? []).map((header) => import_node_path27.default.join(layout2.root, header)),
20118
+ submoduleImports.get(moduleName),
20119
+ import_node_path27.default.join(headerDirectory, name3 + "-Swift.h")
20085
20120
  )
20086
20121
  );
20087
20122
  nativeHeaderFlags.push("-fmodule-map-file=" + modulemap);
20123
+ nativeSwiftHeaderMaps.set(name3, modulemap);
20088
20124
  }
20089
20125
  const modulePlan = (0, import_node_crypto13.createHash)("sha256").update(
20090
20126
  swiftModuleInputFiles(moduleRoot).join("\n")
@@ -20335,14 +20371,17 @@ module ${moduleName}.Swift {
20335
20371
  manifest = manifest.replace(product, `${product}
20336
20372
  ${ONE_PRODUCT},`).replace(flags, `${flags}${ONE_IMPLICIT_FLAGS}`);
20337
20373
  }
20338
- if (importsSpriteKit(input.files)) {
20374
+ const games = gameProducts(input.files);
20375
+ if (games.length > 0) {
20339
20376
  const anchor = '.product(name: "CoreLocation", package: "sootsim-swift"),';
20340
20377
  if (!manifest.includes(anchor))
20341
20378
  throw new Error(
20342
- "scripts/contrast-app-Package.swift lost the line the SpriteKit product links at"
20379
+ "scripts/contrast-app-Package.swift lost the line the game products link at"
20343
20380
  );
20344
- manifest = manifest.replace(anchor, `${anchor}
20345
- ${SPRITEKIT_PRODUCT},`);
20381
+ manifest = manifest.replace(
20382
+ anchor,
20383
+ [anchor, ...games.map((name3) => `${gameProduct(name3)},`)].join("\n ")
20384
+ );
20346
20385
  }
20347
20386
  files2.set(import_node_path27.default.join(layout2.root, "Package.swift"), manifest + moduleFiles);
20348
20387
  } else {
@@ -20441,6 +20480,7 @@ module ${moduleName}.Swift {
20441
20480
  nativeFlags,
20442
20481
  nativeImportFlags,
20443
20482
  nativeHeaderFlags,
20483
+ nativeSwiftHeaderMaps,
20444
20484
  nativeHeaderDeclarations,
20445
20485
  objcImplementationModules: new Set(
20446
20486
  targets.filter(
@@ -20456,7 +20496,7 @@ module ${moduleName}.Swift {
20456
20496
  siblings: moduleSiblings,
20457
20497
  moduleRoot,
20458
20498
  oneModule: input.oneModule,
20459
- spriteKit: importsSpriteKit(input.files),
20499
+ gameProducts: gameProducts(input.files),
20460
20500
  distribution: distribution ?? void 0,
20461
20501
  moduleExcludes,
20462
20502
  deferDarwinOverlay: native.size > 0 && toolsetOrdersLibcxxBeforeDarwinOverlay(
@@ -20598,30 +20638,30 @@ module ${moduleName}.Swift {
20598
20638
  )
20599
20639
  ])
20600
20640
  );
20641
+ const producerSet = /* @__PURE__ */ new Set([...Object.keys(nativeHeaderDeclarations), ...producers]);
20642
+ const orderedProducers = [];
20601
20643
  const included = /* @__PURE__ */ new Set();
20602
20644
  const include = (name3) => {
20603
20645
  if (included.has(name3)) return;
20604
20646
  included.add(name3);
20605
20647
  for (const dependency of dependencies.get(name3) ?? []) include(dependency);
20648
+ if (producerSet.has(name3)) orderedProducers.push(name3);
20606
20649
  };
20607
- for (const producer of producers)
20650
+ for (const producer of producerSet)
20608
20651
  for (const dependency of dependencies.get(producer) ?? []) include(dependency);
20652
+ const needsHeaderStages = [...producerSet].some((name3) => included.has(name3));
20653
+ for (const producer of producerSet) include(producer);
20609
20654
  return {
20610
20655
  nativeBuildTargets: [...native].flatMap(([name3, plan]) => [
20611
20656
  ...!plan.mixed && plan.sources.length > 0 ? [name3] : [],
20612
20657
  ...plan.groups?.map((group) => group.name) ?? (plan.late ? [plan.late.name] : [])
20613
20658
  ]),
20614
- headerProducers: [
20615
- .../* @__PURE__ */ new Set([
20616
- ...Object.keys(nativeHeaderDeclarations),
20617
- ...producers.filter((name3) => !included.has(name3))
20618
- ])
20619
- ],
20659
+ headerProducers: orderedProducers,
20620
20660
  emittedHeaderProducers: [
20621
20661
  .../* @__PURE__ */ new Set([...Object.keys(nativeHeaderDeclarations), ...producers])
20622
20662
  ],
20623
20663
  nativeHeaderDeclarations,
20624
- headerProductTarget,
20664
+ headerProductTarget: needsHeaderStages ? void 0 : headerProductTarget,
20625
20665
  targetFailures,
20626
20666
  generatedOwners,
20627
20667
  targetToolset
@@ -20863,14 +20903,9 @@ function linkedFrameworkTargets(moduleRoot, input) {
20863
20903
  ))
20864
20904
  reach(match[1]);
20865
20905
  }
20866
- if (importsSpriteKit(input.files))
20867
- for (const name3 of ["SpriteKit", "PeachBox2D", "simd", "GLKit"]) reach(name3);
20868
- const wanted = [
20869
- "PeachApp",
20870
- ...input.oneModule ? ["One"] : [],
20871
- ...importsSpriteKit(input.files) ? ["SpriteKit"] : [],
20872
- ...reached
20873
- ];
20906
+ const games = gameProducts(input.files);
20907
+ for (const product of games) for (const name3 of GAME_REACH[product] ?? []) reach(name3);
20908
+ const wanted = ["PeachApp", ...input.oneModule ? ["One"] : [], ...games, ...reached];
20874
20909
  const linked = [...new Set(wanted)].filter((name3) => libraries.has(name3));
20875
20910
  if (!linked.includes("PeachApp"))
20876
20911
  throw new Error("swift-compile: the framework package declares no PeachApp library");
@@ -23541,6 +23576,7 @@ function parseOpenStepPlist(text5) {
23541
23576
  // src/xcode-target-members.ts
23542
23577
  init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
23543
23578
  var NEVER_MEMBER = /(?:^|\/)(?:Info\.plist|[^/]+\.entitlements|[^/]+\.xcconfig|\.DS_Store)$/;
23579
+ var FOLDER_REFERENCE = /^(?:folder|wrapper\.scnassets)$/;
23544
23580
  var BUNDLE_DIR = /\.(xcassets|bundle|lproj|xcdatamodeld|scnassets|spriteatlas|rcproject|storyboardc|icon)$/;
23545
23581
  function xcodePathResolver(objects, projectDir, join9, sourceTreeRoot) {
23546
23582
  const parents = /* @__PURE__ */ new Map();
@@ -23607,8 +23643,20 @@ function xcodeTargetMemberVisitor(objects) {
23607
23643
  for (const id of refs) {
23608
23644
  const file = resolvePath(id);
23609
23645
  if (file === null) continue;
23610
- if (phase.isa === "PBXSourcesBuildPhase") visit(file, "source");
23611
- else for (const inner of filesUnder(file)) visit(inner, "resource");
23646
+ if (phase.isa === "PBXSourcesBuildPhase") {
23647
+ visit(file, "source");
23648
+ continue;
23649
+ }
23650
+ const ref = objects[id];
23651
+ const type = isDict(ref) ? str(ref.lastKnownFileType) ?? str(ref.explicitFileType) ?? "" : "";
23652
+ const root = file.replace(/[\\/]+$/, "");
23653
+ const folder = FOLDER_REFERENCE.test(type) ? root.split(/[\\/]/).pop() : void 0;
23654
+ for (const inner of filesUnder(file))
23655
+ visit(
23656
+ inner,
23657
+ "resource",
23658
+ folder && `${folder}/${inner.slice(root.length + 1).replaceAll("\\", "/")}`
23659
+ );
23612
23660
  }
23613
23661
  }
23614
23662
  }
@@ -24962,12 +25010,13 @@ function planAssetSymbols(resources, root, settings) {
24962
25010
  "2": ["ipad"],
24963
25011
  "1,2": ["iphone", "ipad"],
24964
25012
  "1,7": ["iphone"],
25013
+ "1,3,7": ["iphone"],
24965
25014
  "1,2,6": ["iphone", "ipad"],
24966
25015
  "1,2,7": ["iphone", "ipad"]
24967
25016
  }[families];
24968
25017
  if (!devices)
24969
25018
  return unknown2(
24970
- `Generated asset symbols are proven only for TARGETED_DEVICE_FAMILY 1, 2, 1,2, 1,7, 1,2,6 or 1,2,7; this target resolves to "${families}".`
25019
+ `Generated asset symbols are proven only for TARGETED_DEVICE_FAMILY 1, 2, 1,2, 1,7, 1,3,7, 1,2,6 or 1,2,7; this target resolves to "${families}".`
24971
25020
  );
24972
25021
  const plan = {
24973
25022
  catalogs: catalogs.map((path51) => ({
@@ -28330,6 +28379,7 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
28330
28379
  const allSources = /* @__PURE__ */ new Set();
28331
28380
  const headers = /* @__PURE__ */ new Set();
28332
28381
  const resources = /* @__PURE__ */ new Set();
28382
+ const resourceNames = {};
28333
28383
  const scriptForOutput = /* @__PURE__ */ new Map();
28334
28384
  const copiedFiles = [];
28335
28385
  let generatedInfoPlist = false;
@@ -28499,13 +28549,14 @@ ${output2}`
28499
28549
  xcodePathResolver(project.objects, project.projectDir, import_node_path39.default.join, settings),
28500
28550
  (file) => isDirectory(file) ? walkFiles(file) : import_node_fs38.default.existsSync(file) ? [file] : [],
28501
28551
  import_node_path39.default.join,
28502
- (file, kind) => {
28552
+ (file, kind, bundleName) => {
28503
28553
  if (kind === "header") {
28504
28554
  headers.add(file);
28505
28555
  return;
28506
28556
  }
28507
28557
  if (kind === "resource") {
28508
28558
  resources.add(file);
28559
+ if (bundleName) resourceNames[file] = bundleName;
28509
28560
  return;
28510
28561
  }
28511
28562
  if (!import_node_fs38.default.existsSync(file)) {
@@ -28629,6 +28680,7 @@ ${output2}`
28629
28680
  return {
28630
28681
  sources: [...sources].sort(),
28631
28682
  resources: [...resources].sort(),
28683
+ resourceNames,
28632
28684
  copiedFiles,
28633
28685
  generatedInfoPlist,
28634
28686
  allSources: [...allSources].sort(),
@@ -29687,10 +29739,14 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
29687
29739
  byProduct.has(import_node_path39.default.basename(rawPath)))
29688
29740
  continue;
29689
29741
  const resolved = fileId ? project.resolvePath(fileId) : null;
29690
- if (fileId && resolved !== null && !import_node_fs38.default.existsSync(resolved))
29691
- throw new Error(
29692
- `${str(target.name) ?? "target"}: linked framework ${name3} (${fileId}) points at missing ${resolved} in ${project.projectFile}`
29693
- );
29742
+ if (fileId && resolved !== null && !import_node_fs38.default.existsSync(resolved)) {
29743
+ if (!ios_sdk_frameworks_default.frameworks.includes(name3))
29744
+ throw new Error(
29745
+ `${str(target.name) ?? "target"}: linked framework ${name3} (${fileId}) points at missing ${resolved} in ${project.projectFile}`
29746
+ );
29747
+ sdkFrameworks.add(name3);
29748
+ continue;
29749
+ }
29694
29750
  if (!binaryFrameworks.get(name3)) binaryFrameworks.set(name3, resolved);
29695
29751
  }
29696
29752
  }
@@ -29767,7 +29823,12 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
29767
29823
  ...linkedProducts.flatMap(
29768
29824
  ({ source }) => source.kind === "local" && import_node_fs38.default.existsSync(source.dir) ? [source.dir] : []
29769
29825
  ),
29770
- ...new Set(podSourceDirs)
29826
+ ...new Set(podSourceDirs),
29827
+ // a target's own files may sit beside the project, such as an asset
29828
+ // catalog one folder up, and xcode builds them from there
29829
+ ...new Set(
29830
+ [...module2.allSources, ...module2.resources].filter((file) => import_node_fs38.default.existsSync(file)).map((file) => import_node_path39.default.dirname(file))
29831
+ )
29771
29832
  ].map((dir) => import_node_fs38.default.realpathSync.native(dir))
29772
29833
  ),
29773
29834
  projectFiles: [
@@ -30876,7 +30937,7 @@ function sourceClosureDigest(srcDir, entrypoints) {
30876
30937
  return hash.digest("hex");
30877
30938
  }
30878
30939
  var standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
30879
- var STANDIN_SOURCE_DIGEST = true ? "c0f609da62368c513c186d23bc8aa8e450d27efae5b8c2e7cdf50d34fa734ff0" : standinSourceDigest();
30940
+ var STANDIN_SOURCE_DIGEST = true ? "1a62599378cd7cdf32385f588eb3f983f07ea222d145ec5b6dc34cce9104f46c" : standinSourceDigest();
30880
30941
 
30881
30942
  // src/swift-standins.ts
30882
30943
  init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
@@ -37067,6 +37128,17 @@ function isPackageSource(file) {
37067
37128
  function sourceFiles(root) {
37068
37129
  return packageFiles(root, false).filter(isPackageSource);
37069
37130
  }
37131
+ function xcodeFlatResources(app) {
37132
+ if (!app) return /* @__PURE__ */ new Set();
37133
+ return new Set(
37134
+ app.resources.filter(
37135
+ (file) => !Object.hasOwn(app.resourceNames, file) && !file.split(import_node_path54.default.sep).some((segment) => segment.endsWith(".xcassets"))
37136
+ )
37137
+ );
37138
+ }
37139
+ function bundleResourcePath(flatResources, disk, file) {
37140
+ return flatResources.has(disk) && !file.split("/").includes("Resources") ? `Resources/${file}` : file;
37141
+ }
37070
37142
  function resourceCandidateFiles(root) {
37071
37143
  return packageFiles(root, false).filter(
37072
37144
  (file) => !isPackageSource(file) && !file.endsWith(".xcconfig") && !["project.pbxproj", "project.xcproj", "Package.resolved"].includes(
@@ -37125,12 +37197,24 @@ function buildSwiftResourceTable(project, baseUrl, inputs) {
37125
37197
  const disk = byRelative.get(file);
37126
37198
  return !disk || !layout2?.targetDirs.get(disk)?.startsWith(`${XCODE_FRAMEWORKS_DIR}/`);
37127
37199
  });
37128
- const found = enumerateBundleImages(relative2, readContents2, (file) => {
37129
- const disk = byRelative.get(file);
37130
- if (!disk) throw new Error(`image source ${file} has no input file`);
37131
- const key2 = layout2 ? xcodeInputKey(layout2, disk, file) : file;
37132
- return swiftResourceBundleForFile(bundles, key2)?.path ?? ".";
37133
- });
37200
+ const flatResources = xcodeFlatResources(layout2?.app);
37201
+ const bundled = new Map(
37202
+ relative2.map((file) => [
37203
+ bundleResourcePath(flatResources, byRelative.get(file), file),
37204
+ file
37205
+ ])
37206
+ );
37207
+ const found = enumerateBundleImages(
37208
+ [...bundled.keys()],
37209
+ (file) => readContents2(bundled.get(file) ?? file),
37210
+ (marked) => {
37211
+ const file = bundled.get(marked) ?? marked;
37212
+ const disk = byRelative.get(file);
37213
+ if (!disk) throw new Error(`image source ${file} has no input file`);
37214
+ const key2 = layout2 ? xcodeInputKey(layout2, disk, file) : file;
37215
+ return swiftResourceBundleForFile(bundles, key2)?.path ?? ".";
37216
+ }
37217
+ ).map((image) => ({ ...image, file: bundled.get(image.file) ?? image.file }));
37134
37218
  const colors = enumerateBundleColors(catalogFiles, readContents2);
37135
37219
  const symbols = enumerateBundleSymbols(catalogFiles, readContents2, (file) => {
37136
37220
  const disk = byRelative.get(file);
@@ -37314,15 +37398,20 @@ function buildSwiftBundleFiles(packagePath, hosted, inputs, resourceBundles) {
37314
37398
  }
37315
37399
  }
37316
37400
  const groups = /* @__PURE__ */ new Map();
37317
- const appResources = new Set(xcode?.app.resources ?? []);
37401
+ const flatResources = xcodeFlatResources(xcode?.app);
37318
37402
  for (const file of relative2) {
37319
37403
  const disk = import_node_path54.default.join(packagePath, ...file.split("/"));
37404
+ const folderName = xcode?.app.resourceNames[disk];
37405
+ if (folderName) {
37406
+ watched.push(file);
37407
+ addFile(folderName, readPackageFile2(packagePath, disk, limits.resourceBytes));
37408
+ continue;
37409
+ }
37320
37410
  const key2 = xcode ? xcodeInputKey(xcode, disk, file) : file;
37321
37411
  const bundle = swiftResourceBundleForFile(bundles, key2);
37322
37412
  const bundlePath = bundle?.path ?? ".";
37323
37413
  const group = groups.get(bundlePath) ?? /* @__PURE__ */ new Map();
37324
- const resource = appResources.has(disk) && !file.split("/").includes("Resources") ? `Resources/${file}` : file;
37325
- group.set(resource, disk);
37414
+ group.set(bundleResourcePath(flatResources, disk, file), disk);
37326
37415
  groups.set(bundlePath, group);
37327
37416
  }
37328
37417
  for (const bundle of bundles) {