peachsim 0.1.1655 → 0.1.1659

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 (235) hide show
  1. package/cli/app-config.ts +4 -0
  2. package/cli/app-stubs.ts +43 -6
  3. package/cli/commands/inspect/shared.ts +5 -2
  4. package/cli/commands/inspect/url.ts +2 -1
  5. package/cli/commands/screenshot.ts +5 -5
  6. package/cli/commands/state.ts +9 -6
  7. package/cli/outbound-endpoints.ts +9 -1
  8. package/cli/output-redaction.ts +49 -0
  9. package/dist-lib/agent-daemon-client.cjs +1 -1
  10. package/dist-lib/agent-events.cjs +1 -1
  11. package/dist-lib/attached-projects.cjs +1 -1
  12. package/dist-lib/auth/shared-session.cjs +1 -1
  13. package/dist-lib/backend-origin.cjs +1 -1
  14. package/dist-lib/beta.cjs +1 -1
  15. package/dist-lib/beta.mjs +1 -1
  16. package/dist-lib/bridge-constants.cjs +1 -1
  17. package/dist-lib/bridge-contract-input.cjs +1 -1
  18. package/dist-lib/bridge-contract-input.mjs +1 -1
  19. package/dist-lib/bridge-contract.cjs +1 -1
  20. package/dist-lib/bridge-contract.mjs +1 -1
  21. package/dist-lib/bundle-channel.cjs +11251 -1123
  22. package/dist-lib/capture-contract.cjs +1 -1
  23. package/dist-lib/capture-contract.mjs +1 -1
  24. package/dist-lib/cloud-contract.cjs +1 -1
  25. package/dist-lib/cloud-contract.mjs +1 -1
  26. package/dist-lib/cloud-test-args.cjs +1 -1
  27. package/dist-lib/cloud-test-args.mjs +1 -1
  28. package/dist-lib/cloud.cjs +1 -1
  29. package/dist-lib/cloud.mjs +1 -1
  30. package/dist-lib/config.cjs +29 -5
  31. package/dist-lib/config.mjs +29 -5
  32. package/dist-lib/detox/index.cjs +19 -5
  33. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  34. package/dist-lib/expo-swift-bundle.cjs +8960 -134
  35. package/dist-lib/expo-swift-metadata.cjs +1 -1
  36. package/dist-lib/expo-swift-metadata.mjs +1 -1
  37. package/dist-lib/home-paths.cjs +1 -1
  38. package/dist-lib/host/bridge-host.cjs +9769 -731
  39. package/dist-lib/host/fetch-proxy-handler.cjs +260 -197
  40. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  41. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  42. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  43. package/dist-lib/host/websocket-proxy.cjs +1 -1
  44. package/dist-lib/index.cjs +653 -338
  45. package/dist-lib/jump-to-source-babel.cjs +1 -1
  46. package/dist-lib/jump-to-source-native.cjs +1 -1
  47. package/dist-lib/kotlin-host.cjs +443 -312
  48. package/dist-lib/menu.cjs +1 -1
  49. package/dist-lib/menu.mjs +1 -1
  50. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  51. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  52. package/dist-lib/metro-production-bundle.cjs +1 -1
  53. package/dist-lib/metro-production-bundle.mjs +1 -1
  54. package/dist-lib/metro.cjs +548 -163
  55. package/dist-lib/native-app-identity-project.cjs +179 -33
  56. package/dist-lib/native-app-identity-project.mjs +179 -33
  57. package/dist-lib/native-app-identity.cjs +1 -1
  58. package/dist-lib/native-app-identity.mjs +1 -1
  59. package/dist-lib/native-firebase-metadata.cjs +1 -1
  60. package/dist-lib/native-firebase-metadata.mjs +1 -1
  61. package/dist-lib/plist.cjs +1 -1
  62. package/dist-lib/plist.mjs +1 -1
  63. package/dist-lib/profiles.cjs +1 -1
  64. package/dist-lib/public-brand.cjs +1 -1
  65. package/dist-lib/public-origins-lib-esm.json +23 -23
  66. package/dist-lib/public-origins-lib.json +96 -63
  67. package/dist-lib/react-native-host-modules.cjs +1 -1
  68. package/dist-lib/react-native-host-modules.mjs +1 -1
  69. package/dist-lib/scripts/dev-server-scanner.cjs +2 -2
  70. package/dist-lib/sdk.cjs +1 -1
  71. package/dist-lib/sdk.mjs +1 -1
  72. package/dist-lib/skills.cjs +10651 -1418
  73. package/dist-lib/swift-compile.cjs +8802 -138
  74. package/dist-lib/swift-compile.mjs +8802 -138
  75. package/dist-lib/swift-package.cjs +1 -1
  76. package/dist-lib/swift-package.mjs +1 -1
  77. package/dist-lib/swift-submit.cjs +1 -1
  78. package/dist-lib/swift-submit.mjs +1 -1
  79. package/dist-lib/swift-toolchain.cjs +1 -1
  80. package/dist-lib/swift.cjs +1 -1
  81. package/dist-lib/vite-swift.cjs +8960 -134
  82. package/dist-lib/vite.cjs +149 -163
  83. package/dist-lib/worklet-executable.cjs +1 -1
  84. package/dist-lib/worklet-executable.mjs +1 -1
  85. package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-gesture-handler.d.ts +1 -0
  86. package/dist-types/packages/peach-engine/src/engine/app-font-registry.d.ts +14 -0
  87. package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +8 -0
  88. package/dist-types/packages/peach-engine/src/engine/node.d.ts +3 -0
  89. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +21 -0
  90. package/dist-types/packages/peach-engine/src/render-worker/gesture-seam-protocol.d.ts +2 -1
  91. package/dist-types/packages/peach-engine/src/render-worker/test-bridge-protocol.d.ts +1 -1
  92. package/dist-types/packages/peach-engine/src/rolldown-bundle-inventory.d.ts +1 -0
  93. package/dist-types/packages/peach-globals/src/index.d.ts +25 -0
  94. package/kotlin/README.md +38 -23
  95. package/kotlin/sdk.tar.gz +0 -0
  96. package/package.json +2 -12
  97. package/runtime-companion.json +1 -1
  98. package/src/bundleGlobalFooter.ts +0 -2
  99. package/src/config.ts +54 -2
  100. package/src/configured-bundle-producer.ts +7 -1
  101. package/src/host/fetch-proxy-handler.ts +14 -50
  102. package/src/host/rolldown-bundle-forward.ts +71 -0
  103. package/src/installed-package-versions.ts +54 -2
  104. package/src/kotlin-host.ts +138 -285
  105. package/src/kotlin-module.ts +4 -7
  106. package/src/kotlin-sdk.ts +81 -0
  107. package/src/kotlin-toolchain.ts +152 -0
  108. package/src/kotlin-view-models.ts +1 -1
  109. package/src/kotlinSdkContract.ts +113 -0
  110. package/src/nitro-adapter.lock.json +3 -3
  111. package/src/nitro-bundle.ts +18 -4
  112. package/src/nitro-compile.ts +5 -1
  113. package/src/nitro-source.ts +112 -28
  114. package/src/nitroContract.ts +16 -4
  115. package/src/swift-compile.ts +12 -3
  116. package/src/swift-host.ts +2 -1
  117. package/src/swift-objc-compile.ts +117 -4
  118. package/src/swift-objc-sdk.ts +8792 -135
  119. package/src/swift-objc-standin.ts +1 -0
  120. package/src/vite-plugin-one.ts +73 -134
  121. package/src/worker-system-chunks.ts +14 -4
  122. package/src/xcode-project.ts +261 -34
  123. package/kotlin/AndroidViewSources/android/content/Context.kt +0 -22
  124. package/kotlin/AndroidViewSources/android/content/res/Configuration.kt +0 -25
  125. package/kotlin/AndroidViewSources/android/content/res/Resources.kt +0 -72
  126. package/kotlin/AndroidViewSources/android/graphics/Canvas.kt +0 -22
  127. package/kotlin/AndroidViewSources/android/graphics/Color.kt +0 -13
  128. package/kotlin/AndroidViewSources/android/graphics/Paint.kt +0 -18
  129. package/kotlin/AndroidViewSources/android/util/DisplayMetrics.kt +0 -12
  130. package/kotlin/AndroidViewSources/android/view/View.kt +0 -211
  131. package/kotlin/AndroidViewSources/android/widget/FrameLayout.kt +0 -61
  132. package/kotlin/AndroidViewSources/android/widget/LinearLayout.kt +0 -49
  133. package/kotlin/AndroidViewSources/dev/peach/app/JavaFormat.kt +0 -272
  134. package/kotlin/AppSources/android/app/Activity.kt +0 -174
  135. package/kotlin/AppSources/android/app/Application.kt +0 -11
  136. package/kotlin/AppSources/android/app/UiModeManager.kt +0 -9
  137. package/kotlin/AppSources/android/content/Intent.kt +0 -16
  138. package/kotlin/AppSources/android/os/Bundle.kt +0 -11
  139. package/kotlin/AppSources/android/util/SuperNotCalledException.kt +0 -3
  140. package/kotlin/AppSources/android/view/Window.kt +0 -182
  141. package/kotlin/AppSources/android/view/WindowInsets.kt +0 -9
  142. package/kotlin/AppSources/android/view/WindowInsetsController.kt +0 -17
  143. package/kotlin/AppSources/android/view/WindowManager.kt +0 -16
  144. package/kotlin/AppSources/android/window/BackEvent.kt +0 -24
  145. package/kotlin/AppSources/android/window/OnBackAnimationCallback.kt +0 -7
  146. package/kotlin/AppSources/android/window/OnBackInvokedDispatcher.kt +0 -84
  147. package/kotlin/AppSources/androidx/activity/ActivityFlags.kt +0 -9
  148. package/kotlin/AppSources/androidx/activity/ActivityViewModelLazy.kt +0 -21
  149. package/kotlin/AppSources/androidx/activity/BackEventCompat.kt +0 -43
  150. package/kotlin/AppSources/androidx/activity/ComponentActivity.kt +0 -122
  151. package/kotlin/AppSources/androidx/activity/EdgeToEdge.kt +0 -75
  152. package/kotlin/AppSources/androidx/activity/ExperimentalActivityApi.kt +0 -6
  153. package/kotlin/AppSources/androidx/activity/OnBackPressedCallback.kt +0 -69
  154. package/kotlin/AppSources/androidx/activity/OnBackPressedDispatcher.kt +0 -144
  155. package/kotlin/AppSources/androidx/activity/OnBackPressedDispatcherOwner.kt +0 -7
  156. package/kotlin/AppSources/androidx/activity/compose/BackHandler.kt +0 -86
  157. package/kotlin/AppSources/androidx/activity/compose/ComponentActivity.kt +0 -29
  158. package/kotlin/AppSources/androidx/activity/compose/internal/BackHandlerCompat.kt +0 -38
  159. package/kotlin/AppSources/androidx/activity/compose/internal/BackHandlerDispatcherCompat.kt +0 -27
  160. package/kotlin/AppSources/androidx/compose/foundation/layout/WindowInsets.kt +0 -15
  161. package/kotlin/AppSources/androidx/compose/ui/platform/AndroidCompositionLocals.kt +0 -27
  162. package/kotlin/AppSources/androidx/compose/ui/platform/ComposeView.kt +0 -68
  163. package/kotlin/AppSources/androidx/compose/ui/res/ColorResources.kt +0 -16
  164. package/kotlin/AppSources/androidx/compose/ui/res/PainterResources.kt +0 -70
  165. package/kotlin/AppSources/androidx/compose/ui/res/StringResources.kt +0 -38
  166. package/kotlin/AppSources/androidx/core/view/WindowCompat.kt +0 -32
  167. package/kotlin/AppSources/androidx/lifecycle/AndroidViewModel.kt +0 -10
  168. package/kotlin/AppSources/dev/peach/app/PeachApp.kt +0 -388
  169. package/kotlin/AppSources/dev/peach/app/PeachDrawable.kt +0 -102
  170. package/kotlin/AppSources/dev/peach/app/PeachWindowHost.kt +0 -14
  171. package/kotlin/CompilerSources/META-INF/services/org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar +0 -1
  172. package/kotlin/CompilerSources/PeachJniIncoming.kt +0 -243
  173. package/kotlin/CompilerSources/PeachJniPlugin.kt +0 -116
  174. package/kotlin/ComposeSources/PeachComposeHost.kt +0 -724
  175. package/kotlin/ComposeSources/PeachMagnifier.kt +0 -185
  176. package/kotlin/ComposeSources/PeachSemantics.kt +0 -127
  177. package/kotlin/ExpoComposeSources/PeachAndroidView.kt +0 -103
  178. package/kotlin/ExpoComposeSources/PeachExpoViewMount.kt +0 -24
  179. package/kotlin/ExpoComposeSources/dev/peach/expo/PeachExpoCompose.kt +0 -28
  180. package/kotlin/ExpoComposeSources/expo/modules/kotlin/views/ExpoComposeView.kt +0 -70
  181. package/kotlin/ExpoSources/dev/peach/expo/PeachExpoRuntime.kt +0 -516
  182. package/kotlin/ExpoSources/dev/peach/expo/PeachExpoTypes.kt +0 -173
  183. package/kotlin/ExpoSources/expo/modules/kotlin/AppContext.kt +0 -20
  184. package/kotlin/ExpoSources/expo/modules/kotlin/Promise.kt +0 -19
  185. package/kotlin/ExpoSources/expo/modules/kotlin/classcomponent/ClassComponentBuilder.kt +0 -198
  186. package/kotlin/ExpoSources/expo/modules/kotlin/exception/CodedException.kt +0 -126
  187. package/kotlin/ExpoSources/expo/modules/kotlin/functions/Functions.kt +0 -132
  188. package/kotlin/ExpoSources/expo/modules/kotlin/jni/JavaScriptTypedArray.kt +0 -81
  189. package/kotlin/ExpoSources/expo/modules/kotlin/modules/Module.kt +0 -98
  190. package/kotlin/ExpoSources/expo/modules/kotlin/objects/ObjectDefinitionBuilder.kt +0 -236
  191. package/kotlin/ExpoSources/expo/modules/kotlin/records/Record.kt +0 -12
  192. package/kotlin/ExpoSources/expo/modules/kotlin/runtime/Runtime.kt +0 -9
  193. package/kotlin/ExpoSources/expo/modules/kotlin/sharedobjects/SharedObject.kt +0 -50
  194. package/kotlin/ExpoSources/expo/modules/kotlin/sharedobjects/SharedObjectRegistry.kt +0 -57
  195. package/kotlin/ExpoSources/expo/modules/kotlin/sharedobjects/SharedRef.kt +0 -19
  196. package/kotlin/ExpoSources/expo/modules/kotlin/typedarray/ConcreteTypedArrays.kt +0 -158
  197. package/kotlin/ExpoSources/expo/modules/kotlin/typedarray/GenericTypedArray.kt +0 -8
  198. package/kotlin/ExpoSources/expo/modules/kotlin/typedarray/TypedArray.kt +0 -29
  199. package/kotlin/ExpoSources/expo/modules/kotlin/typedarray/TypedArrayIterator.kt +0 -9
  200. package/kotlin/ExpoSources/expo/modules/kotlin/types/AnyType.kt +0 -155
  201. package/kotlin/ExpoSources/expo/modules/kotlin/types/Either.kt +0 -91
  202. package/kotlin/ExpoSources/expo/modules/kotlin/types/Enumerable.kt +0 -6
  203. package/kotlin/ExpoSources/expo/modules/kotlin/viewevent/ViewEvent.kt +0 -68
  204. package/kotlin/ExpoSources/expo/modules/kotlin/views/ExpoView.kt +0 -20
  205. package/kotlin/ExpoSources/expo/modules/kotlin/views/ViewDefinitionBuilder.kt +0 -72
  206. package/kotlin/ExpoSources/expo/modules/kotlin/views/ViewProps.kt +0 -36
  207. package/kotlin/JniPlatformSources/androidx/annotation/CallSuper.kt +0 -5
  208. package/kotlin/JniPlatformSources/com/facebook/proguard/annotations/DoNotStrip.kt +0 -5
  209. package/kotlin/JniPlatformSources/dalvik/annotation/optimization/FastNative.kt +0 -5
  210. package/kotlin/JniPlatformSources/kotlin/Synchronized.kt +0 -6
  211. package/kotlin/JniPlatformSources/kotlin/jvm/JvmField.kt +0 -5
  212. package/kotlin/JniPlatformSources/kotlin/jvm/JvmStatic.kt +0 -5
  213. package/kotlin/JniSources/com/facebook/jni/HybridData.kt +0 -66
  214. package/kotlin/JniSources/dev/peach/jni/IncomingBindings.kt +0 -157
  215. package/kotlin/JniSources/dev/peach/jni/NativeBindings.kt +0 -77
  216. package/kotlin/JniTransportSources/dev/peach/jni/integration/JniTransport.kt +0 -89
  217. package/kotlin/Sources/android/os/Build.kt +0 -17
  218. package/kotlin/Sources/android/os/Handler.kt +0 -35
  219. package/kotlin/Sources/android/os/Looper.kt +0 -17
  220. package/kotlin/Sources/android/os/MessageQueue.kt +0 -56
  221. package/kotlin/Sources/android/os/SystemClock.kt +0 -14
  222. package/kotlin/Sources/android/util/Log.kt +0 -64
  223. package/kotlin/Sources/androidx/annotation/DrawableRes.kt +0 -14
  224. package/kotlin/Sources/androidx/annotation/Keep.kt +0 -4
  225. package/kotlin/Sources/dev/onejs/one/OneNativeSourceDispatch.kt +0 -7
  226. package/kotlin/Sources/dev/onejs/one/OneNativeSourceViewDispatch.kt +0 -13
  227. package/kotlin/Sources/dev/onejs/one/source/OneModule.kt +0 -4
  228. package/kotlin/Sources/java/lang/Runnable.kt +0 -6
  229. package/kotlin/Sources/java/security/MessageDigest.kt +0 -114
  230. package/kotlin/Sources/java/util/IllegalFormatCodePointException.kt +0 -10
  231. package/kotlin/Sources/java/util/IllegalFormatException.kt +0 -5
  232. package/kotlin/Sources/kotlin/text/StringFormat.kt +0 -9
  233. package/kotlin/Sources/org/json/JSON.kt +0 -307
  234. package/kotlin/tools/abi-classes.main.kts +0 -41
  235. package/kotlin/tools/expo-types.main.kts +0 -127
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1655 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1659 | (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;
@@ -645,6 +645,13 @@ var init_replacement_module_handler = __esm({
645
645
  }
646
646
  });
647
647
 
648
+ // src/assetCatalogContract.ts
649
+ var init_assetCatalogContract = __esm({
650
+ "src/assetCatalogContract.ts"() {
651
+ "use strict";
652
+ }
653
+ });
654
+
648
655
  // ../../node_modules/json5/lib/unicode.js
649
656
  var require_unicode = __commonJS({
650
657
  "../../node_modules/json5/lib/unicode.js"(exports2, module2) {
@@ -2075,6 +2082,19 @@ function readNativeRenderer(value) {
2075
2082
  if (value === "paper" || value === "fabric") return value;
2076
2083
  throw new Error("nativeRenderer must be paper or fabric");
2077
2084
  }
2085
+ function isHybridObjectAnswer(answer) {
2086
+ return answer === "unsupported" || isRecord(answer) && typeof answer.file === "string" && answer.file.length > 0;
2087
+ }
2088
+ function isHybridObjects(value) {
2089
+ return isRecord(value) && Object.entries(value).every(
2090
+ ([name2, answer]) => name2.length > 0 && isHybridObjectAnswer(answer)
2091
+ );
2092
+ }
2093
+ function isPackageHybridObjects(value) {
2094
+ return isRecord(value) && Object.entries(value).every(
2095
+ ([name2, answer]) => name2.length > 0 && typeof answer === "string" && answer.length > 0 && answer !== "noop"
2096
+ );
2097
+ }
2078
2098
  function isPackageStubs(value) {
2079
2099
  if (value === "noop") return true;
2080
2100
  if (!isRecord(value)) return false;
@@ -2082,12 +2102,18 @@ function isPackageStubs(value) {
2082
2102
  (stub) => typeof stub === "string" && stub.length > 0
2083
2103
  )) && (value.views === void 0 || isRecord(value.views) && Object.values(value.views).every(
2084
2104
  (stub) => typeof stub === "string" && stub.length > 0 || isNativeViewSource(stub)
2085
- ));
2105
+ )) && (value.hybridObjects === void 0 || isPackageHybridObjects(value.hybridObjects));
2086
2106
  }
2087
2107
  function collectConfiguredFileModules(config) {
2088
2108
  return [
2089
2109
  ...new Set(
2090
- ["modules", "turboModules", "nativeModules", "nativeViews"].flatMap((key) => {
2110
+ [
2111
+ "modules",
2112
+ "turboModules",
2113
+ "nativeModules",
2114
+ "nativeViews",
2115
+ "nativeHybridObjects"
2116
+ ].flatMap((key) => {
2091
2117
  const entries = config && Reflect.get(config, key);
2092
2118
  if (!isRecord(entries)) return [];
2093
2119
  return Object.values(entries).flatMap(
@@ -2105,12 +2131,13 @@ function isPeachConfig(value) {
2105
2131
  "turboModules",
2106
2132
  "nativeModules",
2107
2133
  "nativeViews",
2134
+ "nativeHybridObjects",
2108
2135
  "env",
2109
2136
  "network",
2110
2137
  "settings",
2111
2138
  "initialProps",
2112
2139
  "initialState"
2113
- ].every((key) => value[key] === void 0 || isRecord(value[key])) && (value.packages === void 0 || isRecord(value.packages) && Object.values(value.packages).every(isPackageStubs)) && (value.nativeViews === void 0 || isRecord(value.nativeViews) && Object.values(value.nativeViews).every(
2140
+ ].every((key) => value[key] === void 0 || isRecord(value[key])) && (value.packages === void 0 || isRecord(value.packages) && Object.values(value.packages).every(isPackageStubs)) && (value.nativeHybridObjects === void 0 || isHybridObjects(value.nativeHybridObjects)) && (value.nativeViews === void 0 || isRecord(value.nativeViews) && Object.values(value.nativeViews).every(
2114
2141
  (entry) => entry === "noop" || isNativeViewSource(entry) || isRecord(entry) && typeof entry.file === "string" && entry.file.length > 0
2115
2142
  ));
2116
2143
  }
@@ -2155,7 +2182,7 @@ function hasOwnKeys(value) {
2155
2182
  }
2156
2183
  function hasPeachConfig(config) {
2157
2184
  if (!config) return false;
2158
- return config.nativeRenderer !== void 0 || config.mapKit !== void 0 || typeof config.runtimeVersion === "string" && config.runtimeVersion.length > 0 || hasOwnKeys(config.modules) || hasOwnKeys(config.turboModules) || hasOwnKeys(config.nativeModules) || hasOwnKeys(config.nativeViews) || hasOwnKeys(config.env) || hasOwnKeys(config.network?.remap) || hasOwnKeys(config.settings) || hasOwnKeys(config.initialProps) || hasOwnKeys(config.initialState);
2185
+ return config.nativeRenderer !== void 0 || config.mapKit !== void 0 || typeof config.runtimeVersion === "string" && config.runtimeVersion.length > 0 || hasOwnKeys(config.modules) || hasOwnKeys(config.turboModules) || hasOwnKeys(config.nativeModules) || hasOwnKeys(config.nativeViews) || hasOwnKeys(config.nativeHybridObjects) || hasOwnKeys(config.env) || hasOwnKeys(config.network?.remap) || hasOwnKeys(config.settings) || hasOwnKeys(config.initialProps) || hasOwnKeys(config.initialState);
2159
2186
  }
2160
2187
  function mergePeachConfig(base, override) {
2161
2188
  if (!hasPeachConfig(base) && !hasPeachConfig(override)) return void 0;
@@ -2172,6 +2199,10 @@ function mergePeachConfig(base, override) {
2172
2199
  ...override.nativeModules || {}
2173
2200
  },
2174
2201
  nativeViews: { ...base.nativeViews || {}, ...override.nativeViews || {} },
2202
+ nativeHybridObjects: {
2203
+ ...base.nativeHybridObjects || {},
2204
+ ...override.nativeHybridObjects || {}
2205
+ },
2175
2206
  env: { ...base.env || {}, ...override.env || {} },
2176
2207
  network: {
2177
2208
  remap: { ...base.network?.remap || {}, ...override.network?.remap || {} }
@@ -2239,6 +2270,178 @@ var init_public_brand = __esm({
2239
2270
  }
2240
2271
  });
2241
2272
 
2273
+ // src/swift-source-file.ts
2274
+ function readPackageFile(root, file, maxBytes) {
2275
+ const canonicalRoot = import_node_fs9.default.realpathSync(root);
2276
+ const relative3 = import_node_path9.default.relative(canonicalRoot, import_node_fs9.default.realpathSync(file));
2277
+ if (relative3 === ".." || relative3.startsWith(`..${import_node_path9.default.sep}`) || import_node_path9.default.isAbsolute(relative3)) {
2278
+ throw new Error(`swift input escapes the selected package: ${file}`);
2279
+ }
2280
+ let ancestor = import_node_path9.default.resolve(file);
2281
+ while (ancestor !== canonicalRoot) {
2282
+ if (import_node_fs9.default.lstatSync(ancestor).isSymbolicLink()) {
2283
+ throw new Error(`swift input is a symlink: ${ancestor}`);
2284
+ }
2285
+ const parent = import_node_path9.default.dirname(ancestor);
2286
+ if (parent === ancestor)
2287
+ throw new Error(`swift input escapes the selected package: ${file}`);
2288
+ ancestor = parent;
2289
+ }
2290
+ const expected = import_node_fs9.default.statSync(file);
2291
+ const fd = import_node_fs9.default.openSync(file, import_node_fs9.default.constants.O_RDONLY | import_node_fs9.default.constants.O_NOFOLLOW);
2292
+ try {
2293
+ const stat = import_node_fs9.default.fstatSync(fd);
2294
+ if (stat.dev !== expected.dev || stat.ino !== expected.ino) {
2295
+ throw new Error(`swift input changed while opening: ${file}`);
2296
+ }
2297
+ if (!stat.isFile() || stat.size > maxBytes) {
2298
+ throw new Error(`swift input exceeds ${maxBytes} bytes: ${file}`);
2299
+ }
2300
+ const bytes = Buffer.alloc(stat.size + 1);
2301
+ let offset = 0;
2302
+ while (offset < bytes.length) {
2303
+ const count = import_node_fs9.default.readSync(fd, bytes, offset, bytes.length - offset, null);
2304
+ if (count === 0) break;
2305
+ offset += count;
2306
+ }
2307
+ if (offset !== stat.size || import_node_fs9.default.fstatSync(fd).size !== stat.size) {
2308
+ throw new Error(`swift input changed while reading: ${file}`);
2309
+ }
2310
+ return bytes.subarray(0, offset);
2311
+ } finally {
2312
+ import_node_fs9.default.closeSync(fd);
2313
+ }
2314
+ }
2315
+ var import_node_fs9, import_node_path9;
2316
+ var init_swift_source_file = __esm({
2317
+ "src/swift-source-file.ts"() {
2318
+ "use strict";
2319
+ import_node_fs9 = __toESM(require("node:fs"), 1);
2320
+ import_node_path9 = __toESM(require("node:path"), 1);
2321
+ }
2322
+ });
2323
+
2324
+ // src/swiftContract.ts
2325
+ var init_swiftContract = __esm({
2326
+ "src/swiftContract.ts"() {
2327
+ "use strict";
2328
+ init_assetCatalogContract();
2329
+ }
2330
+ });
2331
+
2332
+ // src/swift-submit.ts
2333
+ var DEFAULT_SWIFT_COMPILE_BUILD_MS, MAX_SWIFT_COMPILE_BUILD_MS, MAX_SWIFT_COMPILE_SOURCE_BYTES, MAX_SWIFT_COMPILE_RESOURCE_BYTES, MAX_SWIFT_COMPILE_RESOURCE_TOTAL_BYTES, MAX_SWIFT_COMPILE_METAL_BYTES, MAX_SWIFT_COMPILE_METAL_TOTAL_BYTES, MAX_SWIFT_COMPILE_IMAGE_BYTES, MAX_SWIFT_COMPILE_IMAGE_TOTAL_BYTES;
2334
+ var init_swift_submit = __esm({
2335
+ "src/swift-submit.ts"() {
2336
+ "use strict";
2337
+ init_is_record();
2338
+ init_swiftContract();
2339
+ DEFAULT_SWIFT_COMPILE_BUILD_MS = 10 * 6e4;
2340
+ MAX_SWIFT_COMPILE_BUILD_MS = 60 * 6e4;
2341
+ MAX_SWIFT_COMPILE_SOURCE_BYTES = 2 * 1024 * 1024;
2342
+ MAX_SWIFT_COMPILE_RESOURCE_BYTES = 2 * 1024 * 1024;
2343
+ MAX_SWIFT_COMPILE_RESOURCE_TOTAL_BYTES = 8 * 1024 * 1024;
2344
+ MAX_SWIFT_COMPILE_METAL_BYTES = 2 * 1024 * 1024;
2345
+ MAX_SWIFT_COMPILE_METAL_TOTAL_BYTES = 8 * 1024 * 1024;
2346
+ MAX_SWIFT_COMPILE_IMAGE_BYTES = 4 * 1024 * 1024;
2347
+ MAX_SWIFT_COMPILE_IMAGE_TOTAL_BYTES = 16 * 1024 * 1024;
2348
+ }
2349
+ });
2350
+
2351
+ // src/nitro-source.ts
2352
+ function object(value) {
2353
+ return value !== null && typeof value === "object" && !Array.isArray(value);
2354
+ }
2355
+ function readJson(root, relative3) {
2356
+ return JSON.parse(
2357
+ readPackageFile(
2358
+ root,
2359
+ import_node_path10.default.join(root, relative3),
2360
+ MAX_SWIFT_COMPILE_SOURCE_BYTES
2361
+ ).toString("utf8")
2362
+ );
2363
+ }
2364
+ function registrations(root) {
2365
+ const directory = import_node_path10.default.join(root, "nitrogen/generated/ios");
2366
+ const initializers = import_node_fs10.default.readdirSync(directory).filter((file) => file.endsWith("Autolinking.mm"));
2367
+ if (initializers.length !== 1)
2368
+ throw new Error(`${root}: expected one generated Nitro iOS initializer`);
2369
+ const source = readPackageFile(
2370
+ root,
2371
+ import_node_path10.default.join(directory, initializers[0]),
2372
+ MAX_SWIFT_COMPILE_SOURCE_BYTES
2373
+ ).toString("utf8");
2374
+ const namespaces = [
2375
+ ...source.matchAll(/\busing namespace (margelo::nitro(?:::[A-Za-z_]\w*)*)\s*;/g)
2376
+ ];
2377
+ const namespace = namespaces[1]?.[1];
2378
+ if (namespaces.length !== 2 || namespaces[0]?.[1] !== "margelo::nitro" || !namespace)
2379
+ throw new Error(`${root}: invalid generated Nitro C++ namespace`);
2380
+ const classes = [];
2381
+ let swiftModule = null;
2382
+ for (const registration of source.matchAll(
2383
+ /\bHybridObjectRegistry::registerHybridObjectConstructor\(\s*("(?:[^"\\]|\\.)*")\s*,\s*\[\]\(\)\s*->\s*std::shared_ptr<HybridObject>\s*\{([\s\S]*?)\}\s*\);/g
2384
+ )) {
2385
+ const name2 = JSON.parse(registration[1]);
2386
+ const body = registration[2];
2387
+ if (typeof name2 !== "string" || name2.length === 0)
2388
+ throw new Error(`${root}: invalid generated Nitro registration name`);
2389
+ const cpp = /return\s+std::make_shared<([A-Za-z_]\w*)>\(\);/.exec(body);
2390
+ const swift = /=\s*([A-Za-z_]\w*)::([A-Za-z_]\w*)::create([A-Za-z_]\w*)\(\);\s*return hybridObject;/.exec(
2391
+ body
2392
+ );
2393
+ if (cpp && !swift) {
2394
+ classes.push({ name: name2, implementation: cpp[1], language: "c++" });
2395
+ } else if (swift && !cpp && swift[2] === `${swift[1]}Autolinking` && swift[3] === name2 && (swiftModule === null || swiftModule === swift[1])) {
2396
+ swiftModule = swift[1];
2397
+ classes.push({ name: name2, language: "swift" });
2398
+ } else {
2399
+ throw new Error(`${root}: unsupported generated Nitro iOS registration ${name2}`);
2400
+ }
2401
+ }
2402
+ const count = [
2403
+ ...source.matchAll(/\bHybridObjectRegistry::registerHybridObjectConstructor\s*\(/g)
2404
+ ].length;
2405
+ if (classes.length === 0 || classes.length !== count)
2406
+ throw new Error(`${root}: incomplete generated Nitro iOS registrations`);
2407
+ if (new Set(classes.map(({ name: name2 }) => name2)).size !== classes.length)
2408
+ throw new Error(`${root}: duplicate generated Nitro iOS registration`);
2409
+ classes.sort((a, b) => a.name.localeCompare(b.name));
2410
+ return { namespace, swiftModule, classes, views: viewNames(root, classes) };
2411
+ }
2412
+ function viewNames(root, classes) {
2413
+ const directory = import_node_path10.default.join(root, "nitrogen/generated/shared/json");
2414
+ if (!import_node_fs10.default.existsSync(directory)) return /* @__PURE__ */ new Set();
2415
+ const views = /* @__PURE__ */ new Set();
2416
+ for (const file of import_node_fs10.default.readdirSync(directory)) {
2417
+ if (!file.endsWith("Config.json")) continue;
2418
+ const config = readJson(root, import_node_path10.default.join("nitrogen/generated/shared/json", file));
2419
+ const name2 = object(config) ? config.uiViewClassName : void 0;
2420
+ if (typeof name2 === "string" && classes.some((entry) => entry.name === name2))
2421
+ views.add(name2);
2422
+ }
2423
+ return views;
2424
+ }
2425
+ function hasNitroIosInitializer(root) {
2426
+ const generated = import_node_path10.default.join(root, "nitrogen/generated/ios");
2427
+ return import_node_fs10.default.existsSync(generated) && import_node_fs10.default.readdirSync(generated).some((file) => file.endsWith("Autolinking.mm"));
2428
+ }
2429
+ function nitroRegisteredNames(root) {
2430
+ if (!hasNitroIosInitializer(root)) return null;
2431
+ const { classes, views } = registrations(root);
2432
+ return { names: classes.map(({ name: name2 }) => name2), views: [...views].sort() };
2433
+ }
2434
+ var import_node_fs10, import_node_path10;
2435
+ var init_nitro_source = __esm({
2436
+ "src/nitro-source.ts"() {
2437
+ "use strict";
2438
+ import_node_fs10 = __toESM(require("node:fs"), 1);
2439
+ import_node_path10 = __toESM(require("node:path"), 1);
2440
+ init_swift_source_file();
2441
+ init_swift_submit();
2442
+ }
2443
+ });
2444
+
2242
2445
  // src/visit-parsed-program.ts
2243
2446
  function visitParsedProgram(program, visitor) {
2244
2447
  function visit3(value) {
@@ -2317,17 +2520,17 @@ function visit(node, visitor) {
2317
2520
  } else
2318
2521
  visit_(null, node, visitor_, Object.freeze([]));
2319
2522
  }
2320
- function visit_(key, node, visitor, path14) {
2321
- const ctrl = callVisitor(key, node, visitor, path14);
2523
+ function visit_(key, node, visitor, path16) {
2524
+ const ctrl = callVisitor(key, node, visitor, path16);
2322
2525
  if (isNode(ctrl) || isPair(ctrl)) {
2323
- replaceNode(key, path14, ctrl);
2324
- return visit_(key, ctrl, visitor, path14);
2526
+ replaceNode(key, path16, ctrl);
2527
+ return visit_(key, ctrl, visitor, path16);
2325
2528
  }
2326
2529
  if (typeof ctrl !== "symbol") {
2327
2530
  if (isCollection(node)) {
2328
- path14 = Object.freeze(path14.concat(node));
2531
+ path16 = Object.freeze(path16.concat(node));
2329
2532
  for (let i = 0; i < node.items.length; ++i) {
2330
- const ci = visit_(i, node.items[i], visitor, path14);
2533
+ const ci = visit_(i, node.items[i], visitor, path16);
2331
2534
  if (typeof ci === "number")
2332
2535
  i = ci - 1;
2333
2536
  else if (ci === BREAK)
@@ -2338,13 +2541,13 @@ function visit_(key, node, visitor, path14) {
2338
2541
  }
2339
2542
  }
2340
2543
  } else if (isPair(node)) {
2341
- path14 = Object.freeze(path14.concat(node));
2342
- const ck = visit_("key", node.key, visitor, path14);
2544
+ path16 = Object.freeze(path16.concat(node));
2545
+ const ck = visit_("key", node.key, visitor, path16);
2343
2546
  if (ck === BREAK)
2344
2547
  return BREAK;
2345
2548
  else if (ck === REMOVE)
2346
2549
  node.key = null;
2347
- const cv = visit_("value", node.value, visitor, path14);
2550
+ const cv = visit_("value", node.value, visitor, path16);
2348
2551
  if (cv === BREAK)
2349
2552
  return BREAK;
2350
2553
  else if (cv === REMOVE)
@@ -2362,17 +2565,17 @@ async function visitAsync(node, visitor) {
2362
2565
  } else
2363
2566
  await visitAsync_(null, node, visitor_, Object.freeze([]));
2364
2567
  }
2365
- async function visitAsync_(key, node, visitor, path14) {
2366
- const ctrl = await callVisitor(key, node, visitor, path14);
2568
+ async function visitAsync_(key, node, visitor, path16) {
2569
+ const ctrl = await callVisitor(key, node, visitor, path16);
2367
2570
  if (isNode(ctrl) || isPair(ctrl)) {
2368
- replaceNode(key, path14, ctrl);
2369
- return visitAsync_(key, ctrl, visitor, path14);
2571
+ replaceNode(key, path16, ctrl);
2572
+ return visitAsync_(key, ctrl, visitor, path16);
2370
2573
  }
2371
2574
  if (typeof ctrl !== "symbol") {
2372
2575
  if (isCollection(node)) {
2373
- path14 = Object.freeze(path14.concat(node));
2576
+ path16 = Object.freeze(path16.concat(node));
2374
2577
  for (let i = 0; i < node.items.length; ++i) {
2375
- const ci = await visitAsync_(i, node.items[i], visitor, path14);
2578
+ const ci = await visitAsync_(i, node.items[i], visitor, path16);
2376
2579
  if (typeof ci === "number")
2377
2580
  i = ci - 1;
2378
2581
  else if (ci === BREAK)
@@ -2383,13 +2586,13 @@ async function visitAsync_(key, node, visitor, path14) {
2383
2586
  }
2384
2587
  }
2385
2588
  } else if (isPair(node)) {
2386
- path14 = Object.freeze(path14.concat(node));
2387
- const ck = await visitAsync_("key", node.key, visitor, path14);
2589
+ path16 = Object.freeze(path16.concat(node));
2590
+ const ck = await visitAsync_("key", node.key, visitor, path16);
2388
2591
  if (ck === BREAK)
2389
2592
  return BREAK;
2390
2593
  else if (ck === REMOVE)
2391
2594
  node.key = null;
2392
- const cv = await visitAsync_("value", node.value, visitor, path14);
2595
+ const cv = await visitAsync_("value", node.value, visitor, path16);
2393
2596
  if (cv === BREAK)
2394
2597
  return BREAK;
2395
2598
  else if (cv === REMOVE)
@@ -2416,23 +2619,23 @@ function initVisitor(visitor) {
2416
2619
  }
2417
2620
  return visitor;
2418
2621
  }
2419
- function callVisitor(key, node, visitor, path14) {
2622
+ function callVisitor(key, node, visitor, path16) {
2420
2623
  if (typeof visitor === "function")
2421
- return visitor(key, node, path14);
2624
+ return visitor(key, node, path16);
2422
2625
  if (isMap(node))
2423
- return visitor.Map?.(key, node, path14);
2626
+ return visitor.Map?.(key, node, path16);
2424
2627
  if (isSeq(node))
2425
- return visitor.Seq?.(key, node, path14);
2628
+ return visitor.Seq?.(key, node, path16);
2426
2629
  if (isPair(node))
2427
- return visitor.Pair?.(key, node, path14);
2630
+ return visitor.Pair?.(key, node, path16);
2428
2631
  if (isScalar(node))
2429
- return visitor.Scalar?.(key, node, path14);
2632
+ return visitor.Scalar?.(key, node, path16);
2430
2633
  if (isAlias(node))
2431
- return visitor.Alias?.(key, node, path14);
2634
+ return visitor.Alias?.(key, node, path16);
2432
2635
  return void 0;
2433
2636
  }
2434
- function replaceNode(key, path14, node) {
2435
- const parent = path14[path14.length - 1];
2637
+ function replaceNode(key, path16, node) {
2638
+ const parent = path16[path16.length - 1];
2436
2639
  if (isCollection(parent)) {
2437
2640
  parent.items[key] = node;
2438
2641
  } else if (isPair(parent)) {
@@ -2983,10 +3186,10 @@ var init_createNode = __esm({
2983
3186
  });
2984
3187
 
2985
3188
  // ../../node_modules/yaml/browser/dist/nodes/Collection.js
2986
- function collectionFromPath(schema4, path14, value) {
3189
+ function collectionFromPath(schema4, path16, value) {
2987
3190
  let v = value;
2988
- for (let i = path14.length - 1; i >= 0; --i) {
2989
- const k = path14[i];
3191
+ for (let i = path16.length - 1; i >= 0; --i) {
3192
+ const k = path16[i];
2990
3193
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
2991
3194
  const a = [];
2992
3195
  a[k] = v;
@@ -3011,7 +3214,7 @@ var init_Collection = __esm({
3011
3214
  init_createNode();
3012
3215
  init_identity();
3013
3216
  init_Node();
3014
- isEmptyPath = (path14) => path14 == null || typeof path14 === "object" && !!path14[Symbol.iterator]().next().done;
3217
+ isEmptyPath = (path16) => path16 == null || typeof path16 === "object" && !!path16[Symbol.iterator]().next().done;
3015
3218
  Collection = class extends NodeBase {
3016
3219
  constructor(type, schema4) {
3017
3220
  super(type);
@@ -3041,11 +3244,11 @@ var init_Collection = __esm({
3041
3244
  * be a Pair instance or a `{ key, value }` object, which may not have a key
3042
3245
  * that already exists in the map.
3043
3246
  */
3044
- addIn(path14, value) {
3045
- if (isEmptyPath(path14))
3247
+ addIn(path16, value) {
3248
+ if (isEmptyPath(path16))
3046
3249
  this.add(value);
3047
3250
  else {
3048
- const [key, ...rest] = path14;
3251
+ const [key, ...rest] = path16;
3049
3252
  const node = this.get(key, true);
3050
3253
  if (isCollection(node))
3051
3254
  node.addIn(rest, value);
@@ -3059,8 +3262,8 @@ var init_Collection = __esm({
3059
3262
  * Removes a value from the collection.
3060
3263
  * @returns `true` if the item was found and removed.
3061
3264
  */
3062
- deleteIn(path14) {
3063
- const [key, ...rest] = path14;
3265
+ deleteIn(path16) {
3266
+ const [key, ...rest] = path16;
3064
3267
  if (rest.length === 0)
3065
3268
  return this.delete(key);
3066
3269
  const node = this.get(key, true);
@@ -3074,8 +3277,8 @@ var init_Collection = __esm({
3074
3277
  * scalar values from their surrounding node; to disable set `keepScalar` to
3075
3278
  * `true` (collections are always returned intact).
3076
3279
  */
3077
- getIn(path14, keepScalar) {
3078
- const [key, ...rest] = path14;
3280
+ getIn(path16, keepScalar) {
3281
+ const [key, ...rest] = path16;
3079
3282
  const node = this.get(key, true);
3080
3283
  if (rest.length === 0)
3081
3284
  return !keepScalar && isScalar(node) ? node.value : node;
@@ -3093,8 +3296,8 @@ var init_Collection = __esm({
3093
3296
  /**
3094
3297
  * Checks if the collection includes a value with the key `key`.
3095
3298
  */
3096
- hasIn(path14) {
3097
- const [key, ...rest] = path14;
3299
+ hasIn(path16) {
3300
+ const [key, ...rest] = path16;
3098
3301
  if (rest.length === 0)
3099
3302
  return this.has(key);
3100
3303
  const node = this.get(key, true);
@@ -3104,8 +3307,8 @@ var init_Collection = __esm({
3104
3307
  * Sets a value in this collection. For `!!set`, `value` needs to be a
3105
3308
  * boolean to add/remove the item from the set.
3106
3309
  */
3107
- setIn(path14, value) {
3108
- const [key, ...rest] = path14;
3310
+ setIn(path16, value) {
3311
+ const [key, ...rest] = path16;
3109
3312
  if (rest.length === 0) {
3110
3313
  this.set(key, value);
3111
3314
  } else {
@@ -5024,15 +5227,15 @@ function visit2(cst, visitor) {
5024
5227
  cst = { start: cst.start, value: cst.value };
5025
5228
  _visit(Object.freeze([]), cst, visitor);
5026
5229
  }
5027
- function _visit(path14, item, visitor) {
5028
- let ctrl = visitor(item, path14);
5230
+ function _visit(path16, item, visitor) {
5231
+ let ctrl = visitor(item, path16);
5029
5232
  if (typeof ctrl === "symbol")
5030
5233
  return ctrl;
5031
5234
  for (const field of ["key", "value"]) {
5032
5235
  const token = item[field];
5033
5236
  if (token && "items" in token) {
5034
5237
  for (let i = 0; i < token.items.length; ++i) {
5035
- const ci = _visit(Object.freeze(path14.concat([[field, i]])), token.items[i], visitor);
5238
+ const ci = _visit(Object.freeze(path16.concat([[field, i]])), token.items[i], visitor);
5036
5239
  if (typeof ci === "number")
5037
5240
  i = ci - 1;
5038
5241
  else if (ci === BREAK2)
@@ -5043,10 +5246,10 @@ function _visit(path14, item, visitor) {
5043
5246
  }
5044
5247
  }
5045
5248
  if (typeof ctrl === "function" && field === "key")
5046
- ctrl = ctrl(item, path14);
5249
+ ctrl = ctrl(item, path16);
5047
5250
  }
5048
5251
  }
5049
- return typeof ctrl === "function" ? ctrl(item, path14) : ctrl;
5252
+ return typeof ctrl === "function" ? ctrl(item, path16) : ctrl;
5050
5253
  }
5051
5254
  var BREAK2, SKIP2, REMOVE2;
5052
5255
  var init_cst_visit = __esm({
@@ -5057,9 +5260,9 @@ var init_cst_visit = __esm({
5057
5260
  visit2.BREAK = BREAK2;
5058
5261
  visit2.SKIP = SKIP2;
5059
5262
  visit2.REMOVE = REMOVE2;
5060
- visit2.itemAtPath = (cst, path14) => {
5263
+ visit2.itemAtPath = (cst, path16) => {
5061
5264
  let item = cst;
5062
- for (const [field, index] of path14) {
5265
+ for (const [field, index] of path16) {
5063
5266
  const tok = item?.[field];
5064
5267
  if (tok && "items" in tok) {
5065
5268
  item = tok.items[index];
@@ -5068,9 +5271,9 @@ var init_cst_visit = __esm({
5068
5271
  }
5069
5272
  return item;
5070
5273
  };
5071
- visit2.parentCollection = (cst, path14) => {
5072
- const parent = visit2.itemAtPath(cst, path14.slice(0, -1));
5073
- const field = path14[path14.length - 1][0];
5274
+ visit2.parentCollection = (cst, path16) => {
5275
+ const parent = visit2.itemAtPath(cst, path16.slice(0, -1));
5276
+ const field = path16[path16.length - 1][0];
5074
5277
  const coll = parent?.[field];
5075
5278
  if (coll && "items" in coll)
5076
5279
  return coll;
@@ -5158,24 +5361,24 @@ var init_browser = __esm({
5158
5361
  });
5159
5362
 
5160
5363
  // cli/commands/nodeRepoFileReader.ts
5161
- var import_node_fs9, nodeRepoFileReader;
5364
+ var import_node_fs11, nodeRepoFileReader;
5162
5365
  var init_nodeRepoFileReader = __esm({
5163
5366
  "cli/commands/nodeRepoFileReader.ts"() {
5164
5367
  "use strict";
5165
- import_node_fs9 = require("node:fs");
5368
+ import_node_fs11 = require("node:fs");
5166
5369
  nodeRepoFileReader = {
5167
- exists: import_node_fs9.existsSync,
5168
- readText: (filePath) => (0, import_node_fs9.readFileSync)(filePath, "utf8"),
5169
- entries: (directory) => (0, import_node_fs9.readdirSync)(directory, { withFileTypes: true }).map((entry) => ({
5370
+ exists: import_node_fs11.existsSync,
5371
+ readText: (filePath) => (0, import_node_fs11.readFileSync)(filePath, "utf8"),
5372
+ entries: (directory) => (0, import_node_fs11.readdirSync)(directory, { withFileTypes: true }).map((entry) => ({
5170
5373
  name: entry.name,
5171
5374
  directory: entry.isDirectory()
5172
5375
  })),
5173
- isDirectory: (filePath) => (0, import_node_fs9.statSync)(filePath).isDirectory(),
5376
+ isDirectory: (filePath) => (0, import_node_fs11.statSync)(filePath).isDirectory(),
5174
5377
  readMetadata(filePath) {
5175
5378
  try {
5176
- const info = (0, import_node_fs9.lstatSync)(filePath);
5379
+ const info = (0, import_node_fs11.lstatSync)(filePath);
5177
5380
  if (!info.isFile() || info.size > 4 * 1024 * 1024) return null;
5178
- return (0, import_node_fs9.readFileSync)(filePath, "utf8");
5381
+ return (0, import_node_fs11.readFileSync)(filePath, "utf8");
5179
5382
  } catch {
5180
5383
  return null;
5181
5384
  }
@@ -5198,7 +5401,7 @@ function scanRepository(root) {
5198
5401
  directories.push(next.dir);
5199
5402
  let handle;
5200
5403
  try {
5201
- handle = (0, import_node_fs10.opendirSync)(next.dir);
5404
+ handle = (0, import_node_fs12.opendirSync)(next.dir);
5202
5405
  } catch {
5203
5406
  unreadable++;
5204
5407
  continue;
@@ -5213,7 +5416,7 @@ function scanRepository(root) {
5213
5416
  truncated = true;
5214
5417
  continue;
5215
5418
  }
5216
- pending.push({ dir: (0, import_node_path9.join)(next.dir, entry.name), depth: next.depth + 1 });
5419
+ pending.push({ dir: (0, import_node_path11.join)(next.dir, entry.name), depth: next.depth + 1 });
5217
5420
  }
5218
5421
  } finally {
5219
5422
  handle.closeSync();
@@ -5232,8 +5435,8 @@ function metadataValue(value, key) {
5232
5435
  if (!value || typeof value !== "object") return void 0;
5233
5436
  return Object.getOwnPropertyDescriptor(value, key)?.value;
5234
5437
  }
5235
- function readProjectJson(path14, files = nodeRepoFileReader) {
5236
- const text2 = readProjectMetadata(path14, files);
5438
+ function readProjectJson(path16, files = nodeRepoFileReader) {
5439
+ const text2 = readProjectMetadata(path16, files);
5237
5440
  if (text2 === null) return null;
5238
5441
  try {
5239
5442
  const value = JSON.parse(text2);
@@ -5243,7 +5446,7 @@ function readProjectJson(path14, files = nodeRepoFileReader) {
5243
5446
  }
5244
5447
  }
5245
5448
  function readProjectManifest(dir, files = nodeRepoFileReader) {
5246
- const parsed = readProjectJson((0, import_node_path9.join)(dir, "package.json"), files);
5449
+ const parsed = readProjectJson((0, import_node_path11.join)(dir, "package.json"), files);
5247
5450
  if (!parsed || typeof parsed !== "object") return null;
5248
5451
  const record = (value) => {
5249
5452
  if (!value || typeof value !== "object") return {};
@@ -5260,12 +5463,12 @@ function readProjectManifest(dir, files = nodeRepoFileReader) {
5260
5463
  devDependencies: record(metadataValue(parsed, "devDependencies"))
5261
5464
  };
5262
5465
  }
5263
- var import_node_fs10, import_node_path9, import_json52, REPORT_SKIP_DIRS;
5466
+ var import_node_fs12, import_node_path11, import_json52, REPORT_SKIP_DIRS;
5264
5467
  var init_detect = __esm({
5265
5468
  "cli/commands/detect.ts"() {
5266
5469
  "use strict";
5267
- import_node_fs10 = require("node:fs");
5268
- import_node_path9 = require("node:path");
5470
+ import_node_fs12 = require("node:fs");
5471
+ import_node_path11 = require("node:path");
5269
5472
  import_json52 = __toESM(require_lib(), 1);
5270
5473
  init_browser();
5271
5474
  init_nodeRepoFileReader();
@@ -5311,10 +5514,10 @@ function resolveAppStubs(appDir, config, configDir) {
5311
5514
  const target = stubTarget ?? name2;
5312
5515
  const field = installed.peach;
5313
5516
  const versions = isRecord(field) ? field.versions : void 0;
5314
- const stubs2 = isRecord(field) ? { modules: field.modules, views: field.views } : field;
5517
+ const stubs2 = isRecord(field) ? { modules: field.modules, views: field.views, hybridObjects: field.hybridObjects } : field;
5315
5518
  if (!isPackageStubs(stubs2) || versions !== void 0 && typeof versions !== "string")
5316
5519
  throw new Error(
5317
- `${name2}'s package.json "peach" field must be "noop" or { versions?, modules?, views? } whose values are "noop" or file paths`
5520
+ `${name2}'s package.json "peach" field must be "noop" or { versions?, modules?, views?, hybridObjects? } whose values are "noop" or file paths ("unsupported" or a file path for hybridObjects, never "noop")`
5318
5521
  );
5319
5522
  const providerVersion = typeof installed.version === "string" ? installed.version : null;
5320
5523
  const targetDir = stubTarget ? installedPackageDir(appDir, target) : dir;
@@ -5371,9 +5574,13 @@ function resolveAppStubs(appDir, config, configDir) {
5371
5574
  sources.sort((a, b) => ORDER[a.origin] - ORDER[b.origin]);
5372
5575
  const nativeModules = {};
5373
5576
  const nativeViews = {};
5577
+ const nativeHybridObjects = {};
5374
5578
  const applied = [];
5375
5579
  for (const source of sources) {
5376
- const { modules, views } = expandStubs(appDir, source);
5580
+ const { modules, views, hybridObjects } = expandStubs(appDir, source);
5581
+ assertRegisteredHybridObjects(appDir, source, hybridObjects);
5582
+ for (const [name2, answer] of Object.entries(hybridObjects))
5583
+ nativeHybridObjects[name2] = answer === "unsupported" ? answer : { file: (0, import_node_path12.resolve)(source.baseDir, answer) };
5377
5584
  for (const [name2, stub] of Object.entries(modules))
5378
5585
  nativeModules[name2] = lowerStub(stub, source.baseDir);
5379
5586
  for (const [name2, stub] of Object.entries(views))
@@ -5396,13 +5603,22 @@ function resolveAppStubs(appDir, config, configDir) {
5396
5603
  }
5397
5604
  const stubs = { applied, skipped };
5398
5605
  if (!config && applied.length === 0) return { config, stubs };
5399
- const lowered = { ...config, nativeModules, nativeViews };
5606
+ const lowered = {
5607
+ ...config,
5608
+ nativeModules,
5609
+ nativeViews,
5610
+ nativeHybridObjects
5611
+ };
5400
5612
  delete lowered.packages;
5401
5613
  return { config: lowered, stubs };
5402
5614
  }
5403
5615
  function expandStubs(appDir, source) {
5404
5616
  if (source.stubs !== "noop")
5405
- return { modules: source.stubs.modules ?? {}, views: source.stubs.views ?? {} };
5617
+ return {
5618
+ modules: source.stubs.modules ?? {},
5619
+ views: source.stubs.views ?? {},
5620
+ hybridObjects: source.stubs.hybridObjects ?? {}
5621
+ };
5406
5622
  const dir = installedPackageDir(appDir, source.target);
5407
5623
  if (!dir)
5408
5624
  throw new Error(
@@ -5414,13 +5630,24 @@ function expandStubs(appDir, source) {
5414
5630
  if (request.kind === "module") modules[request.name] = "noop";
5415
5631
  else views[request.name] = "noop";
5416
5632
  }
5417
- return { modules, views };
5633
+ return { modules, views, hybridObjects: {} };
5634
+ }
5635
+ function assertRegisteredHybridObjects(appDir, source, hybridObjects) {
5636
+ const declared = Object.keys(hybridObjects);
5637
+ if (declared.length === 0) return;
5638
+ const dir = installedPackageDir(appDir, source.target);
5639
+ const registered = dir && nitroRegisteredNames(dir)?.names || [];
5640
+ for (const name2 of declared)
5641
+ if (!registered.includes(name2))
5642
+ throw new Error(
5643
+ `packages[${JSON.stringify(source.target)}].hybridObjects: ${source.target} does not register the Nitro HybridObject ${JSON.stringify(name2)} for iOS (registered: ${registered.join(", ") || "none"})`
5644
+ );
5418
5645
  }
5419
5646
  function lowerStub(stub, baseDir) {
5420
- return stub === "noop" ? stub : { file: (0, import_node_path10.resolve)(baseDir, stub) };
5647
+ return stub === "noop" ? stub : { file: (0, import_node_path12.resolve)(baseDir, stub) };
5421
5648
  }
5422
5649
  function readPackageJson(dir) {
5423
- const text2 = readSmallFile((0, import_node_path10.join)(dir, "package.json"));
5650
+ const text2 = readSmallFile((0, import_node_path12.join)(dir, "package.json"));
5424
5651
  if (!text2) return null;
5425
5652
  try {
5426
5653
  const parsed = JSON.parse(text2);
@@ -5432,9 +5659,9 @@ function readPackageJson(dir) {
5432
5659
  function installedPackageDir(appDir, name2) {
5433
5660
  let current = appDir;
5434
5661
  while (true) {
5435
- const dir = (0, import_node_path10.join)(current, "node_modules", name2);
5436
- if ((0, import_node_fs11.existsSync)((0, import_node_path10.join)(dir, "package.json"))) return (0, import_node_fs11.realpathSync)(dir);
5437
- const parent = (0, import_node_path10.dirname)(current);
5662
+ const dir = (0, import_node_path12.join)(current, "node_modules", name2);
5663
+ if ((0, import_node_fs13.existsSync)((0, import_node_path12.join)(dir, "package.json"))) return (0, import_node_fs13.realpathSync)(dir);
5664
+ const parent = (0, import_node_path12.dirname)(current);
5438
5665
  if (parent === current) return null;
5439
5666
  current = parent;
5440
5667
  }
@@ -5526,7 +5753,7 @@ function mergeRequests(previous, next) {
5526
5753
  function packageNativeRequests(dir) {
5527
5754
  const found = /* @__PURE__ */ new Map();
5528
5755
  const directories = scanRepository(dir).directories.filter((sub) => {
5529
- const segments = (0, import_node_path10.relative)(dir, sub).split("/");
5756
+ const segments = (0, import_node_path12.relative)(dir, sub).split("/");
5530
5757
  return !NATIVE_SOURCE_DIRS.has(segments[0]) && !segments.some((segment) => PACKAGE_SKIP_DIRS.has(segment));
5531
5758
  });
5532
5759
  let files = 0;
@@ -5534,7 +5761,7 @@ function packageNativeRequests(dir) {
5534
5761
  for (const name2 of listDir(sub)) {
5535
5762
  if (!SOURCE_FILE.test(name2) || name2.endsWith(".d.ts") || files >= 2e3) continue;
5536
5763
  files++;
5537
- const file = (0, import_node_path10.join)(sub, name2);
5764
+ const file = (0, import_node_path12.join)(sub, name2);
5538
5765
  const text2 = readSmallFile(file);
5539
5766
  if (!text2) continue;
5540
5767
  for (const { line: _line, ...request } of sourceNativeRequests(file, text2, true))
@@ -5653,27 +5880,27 @@ function wireSlotMigration(appDir, configPath, wire, kept = []) {
5653
5880
  }
5654
5881
  function listDir(dir) {
5655
5882
  try {
5656
- return (0, import_node_fs11.readdirSync)(dir);
5883
+ return (0, import_node_fs13.readdirSync)(dir);
5657
5884
  } catch {
5658
5885
  return [];
5659
5886
  }
5660
5887
  }
5661
5888
  function readSmallFile(file) {
5662
5889
  try {
5663
- return (0, import_node_fs11.statSync)(file).size <= 1024 * 1024 ? (0, import_node_fs11.readFileSync)(file, "utf8") : null;
5890
+ return (0, import_node_fs13.statSync)(file).size <= 1024 * 1024 ? (0, import_node_fs13.readFileSync)(file, "utf8") : null;
5664
5891
  } catch {
5665
5892
  return null;
5666
5893
  }
5667
5894
  }
5668
5895
  function hasNativeCode(dir, platform) {
5669
- const expoConfig = (0, import_node_path10.join)(dir, "expo-module.config.json");
5896
+ const expoConfig = (0, import_node_path12.join)(dir, "expo-module.config.json");
5670
5897
  const platforms = metadataValue(readProjectJson(expoConfig), "platforms");
5671
5898
  if (Array.isArray(platforms))
5672
5899
  return platforms.includes(platform) || platform === "ios" && platforms.includes("apple");
5673
- if ([platform, "expo-module.config.json"].some((entry) => (0, import_node_fs11.existsSync)((0, import_node_path10.join)(dir, entry))))
5900
+ if ([platform, "expo-module.config.json"].some((entry) => (0, import_node_fs13.existsSync)((0, import_node_path12.join)(dir, entry))))
5674
5901
  return true;
5675
5902
  if (listDir(dir).some((name2) => name2.endsWith(".podspec"))) return true;
5676
- const manifest = readSmallFile((0, import_node_path10.join)(dir, "package.json"));
5903
+ const manifest = readSmallFile((0, import_node_path12.join)(dir, "package.json"));
5677
5904
  return manifest !== null && manifest.includes('"codegenConfig"');
5678
5905
  }
5679
5906
  function scanLocalNative(appDir, pkg, answered, platform, knownPackages = /* @__PURE__ */ new Set(), includeLegacy = false, providers) {
@@ -5686,7 +5913,7 @@ function scanLocalNative(appDir, pkg, answered, platform, knownPackages = /* @__
5686
5913
  (excluded) => dir === excluded || dir.startsWith(`${excluded}/`)
5687
5914
  ))
5688
5915
  continue;
5689
- if ((0, import_node_fs11.existsSync)((0, import_node_path10.join)(dir, "expo-module.config.json"))) {
5916
+ if ((0, import_node_fs13.existsSync)((0, import_node_path12.join)(dir, "expo-module.config.json"))) {
5690
5917
  if (platform && !hasNativeCode(dir, platform)) {
5691
5918
  excludedModuleDirs.push(dir);
5692
5919
  continue;
@@ -5695,7 +5922,7 @@ function scanLocalNative(appDir, pkg, answered, platform, knownPackages = /* @__
5695
5922
  }
5696
5923
  for (const name2 of listDir(dir)) {
5697
5924
  if (SOURCE_FILE.test(name2) && !name2.endsWith(".d.ts"))
5698
- sourceFiles.push((0, import_node_path10.join)(dir, name2));
5925
+ sourceFiles.push((0, import_node_path12.join)(dir, name2));
5699
5926
  }
5700
5927
  }
5701
5928
  }
@@ -5705,7 +5932,7 @@ function scanLocalNative(appDir, pkg, answered, platform, knownPackages = /* @__
5705
5932
  scanRepository(dir).directories.flatMap(
5706
5933
  (sub) => listDir(sub).filter(
5707
5934
  (name2) => NATIVE_SOURCE_FILE.test(name2) && (!platform || (platform === "ios" ? name2.endsWith(".swift") : name2.endsWith(".kt")))
5708
- ).map((name2) => (0, import_node_path10.join)(sub, name2))
5935
+ ).map((name2) => (0, import_node_path12.join)(sub, name2))
5709
5936
  )
5710
5937
  ])
5711
5938
  );
@@ -5714,7 +5941,7 @@ function scanLocalNative(appDir, pkg, answered, platform, knownPackages = /* @__
5714
5941
  const known = owners.get(dir);
5715
5942
  if (known) return known;
5716
5943
  const name2 = readPackageJson(dir)?.name;
5717
- const parent = (0, import_node_path10.dirname)(dir);
5944
+ const parent = (0, import_node_path12.dirname)(dir);
5718
5945
  const result = typeof name2 === "string" ? name2 : parent === dir ? pkg.name ?? "app" : owner(parent);
5719
5946
  owners.set(dir, result);
5720
5947
  return result;
@@ -5728,18 +5955,18 @@ function scanLocalNative(appDir, pkg, answered, platform, knownPackages = /* @__
5728
5955
  return;
5729
5956
  }
5730
5957
  providers ??= dependencyNativeOwners(appDir, pkg);
5731
- const packageName = providers.get(key) ?? owner((0, import_node_path10.dirname)(file));
5958
+ const packageName = providers.get(key) ?? owner((0, import_node_path12.dirname)(file));
5732
5959
  if (knownPackages.has(packageName)) return;
5733
5960
  const moduleDir = expoModuleDirs.find((dir) => file.startsWith(`${dir}/`)) ?? null;
5734
5961
  found.set(key, {
5735
5962
  kind,
5736
5963
  name: name2,
5737
5964
  package: packageName,
5738
- path: `${(0, import_node_path10.relative)(appDir, file)}:${line}`,
5739
- expoModule: moduleDir ? (0, import_node_path10.relative)(appDir, moduleDir) || "." : null,
5965
+ path: `${(0, import_node_path12.relative)(appDir, file)}:${line}`,
5966
+ expoModule: moduleDir ? (0, import_node_path12.relative)(appDir, moduleDir) || "." : null,
5740
5967
  optional,
5741
5968
  swift: moduleDir ? (nativeFilesByModule.get(moduleDir) ?? []).some(
5742
- (path14) => path14.endsWith(".swift") && [...(readSmallFile(path14) ?? "").matchAll(/\bName\(\s*"(\w+)"\s*\)/g)].some(
5969
+ (path16) => path16.endsWith(".swift") && [...(readSmallFile(path16) ?? "").matchAll(/\bName\(\s*"(\w+)"\s*\)/g)].some(
5743
5970
  (match) => match[1] === name2
5744
5971
  )
5745
5972
  ) : false,
@@ -5780,34 +6007,35 @@ function workspacePackageDirs(appDir, pkg) {
5780
6007
  for (const name2 of Object.keys({ ...pkg.dependencies, ...pkg.devDependencies })) {
5781
6008
  let current = appDir;
5782
6009
  while (true) {
5783
- const link = (0, import_node_path10.join)(current, "node_modules", name2);
5784
- if ((0, import_node_fs11.existsSync)(link)) {
5785
- if ((0, import_node_fs11.lstatSync)(link).isSymbolicLink()) {
5786
- const target = (0, import_node_fs11.realpathSync)(link);
6010
+ const link = (0, import_node_path12.join)(current, "node_modules", name2);
6011
+ if ((0, import_node_fs13.existsSync)(link)) {
6012
+ if ((0, import_node_fs13.lstatSync)(link).isSymbolicLink()) {
6013
+ const target = (0, import_node_fs13.realpathSync)(link);
5787
6014
  if (!target.split("/").includes("node_modules") && !target.startsWith(`${appDir}/`)) {
5788
6015
  dirs.add(target);
5789
6016
  }
5790
6017
  }
5791
6018
  break;
5792
6019
  }
5793
- const parent = (0, import_node_path10.dirname)(current);
6020
+ const parent = (0, import_node_path12.dirname)(current);
5794
6021
  if (parent === current) break;
5795
6022
  current = parent;
5796
6023
  }
5797
6024
  }
5798
6025
  return [...dirs];
5799
6026
  }
5800
- var import_node_fs11, import_node_path10, import_version_range, import_oxc_parser2, import_sucrase, SOURCE_FILE, NATIVE_LOOKUP, NATIVE_SOURCE_DIRS, PACKAGE_SKIP_DIRS, NATIVE_SOURCE_FILE;
6027
+ var import_node_fs13, import_node_path12, import_version_range, import_oxc_parser2, import_sucrase, SOURCE_FILE, NATIVE_LOOKUP, NATIVE_SOURCE_DIRS, PACKAGE_SKIP_DIRS, NATIVE_SOURCE_FILE;
5801
6028
  var init_app_stubs = __esm({
5802
6029
  "cli/app-stubs.ts"() {
5803
6030
  "use strict";
5804
- import_node_fs11 = require("node:fs");
5805
- import_node_path10 = require("node:path");
6031
+ import_node_fs13 = require("node:fs");
6032
+ import_node_path12 = require("node:path");
5806
6033
  import_version_range = require("@peach/compat/version-range");
5807
6034
  import_oxc_parser2 = require("oxc-parser");
5808
6035
  import_sucrase = require("sucrase");
5809
6036
  init_config();
5810
6037
  init_is_record();
6038
+ init_nitro_source();
5811
6039
  init_public_brand();
5812
6040
  init_visit_parsed_program();
5813
6041
  init_detect();
@@ -5837,12 +6065,12 @@ function resolveFileEntries(entries, configDir) {
5837
6065
  return Object.fromEntries(
5838
6066
  Object.entries(entries).map(([name2, resolution]) => [
5839
6067
  name2,
5840
- resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file: import_node_path11.default.resolve(configDir, resolution.file) } : resolution
6068
+ resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file: import_node_path13.default.resolve(configDir, resolution.file) } : resolution
5841
6069
  ])
5842
6070
  );
5843
6071
  }
5844
6072
  function resolveConfigReplacementFiles(config, configPath) {
5845
- const configDir = import_node_path11.default.dirname(configPath);
6073
+ const configDir = import_node_path13.default.dirname(configPath);
5846
6074
  return {
5847
6075
  ...config,
5848
6076
  modules: resolveFileEntries(config.modules, configDir)
@@ -5858,7 +6086,7 @@ async function loadRNXAppStubs(project) {
5858
6086
  return resolveAppStubs(
5859
6087
  project.appDir,
5860
6088
  config,
5861
- project.configPath ? import_node_path11.default.dirname(project.configPath) : project.appDir
6089
+ project.configPath ? import_node_path13.default.dirname(project.configPath) : project.appDir
5862
6090
  );
5863
6091
  } catch (error) {
5864
6092
  const message = error instanceof Error ? error.message : String(error);
@@ -5877,10 +6105,14 @@ async function loadConfigFile(project) {
5877
6105
  [`${rnxPublicBrand.packageName}/config`]: config_exports
5878
6106
  }
5879
6107
  });
5880
- const loaded2 = project.configPath.endsWith(".json") ? JSON.parse((0, import_node_fs12.readFileSync)(project.configPath, "utf8")) : await jiti.import(project.configPath, { default: true });
6108
+ const loaded2 = project.configPath.endsWith(".json") ? JSON.parse((0, import_node_fs14.readFileSync)(project.configPath, "utf8")) : await jiti.import(project.configPath, { default: true });
5881
6109
  if (!isPeachConfig(loaded2)) {
5882
6110
  throw new Error("the default export must be a peach config object");
5883
6111
  }
6112
+ if (loaded2.nativeHybridObjects !== void 0)
6113
+ throw new Error(
6114
+ 'nativeHybridObjects moved under packages, keyed by the package that registers each name: packages: { "<package>": { hybridObjects: { <Name>: "unsupported" | "./file.ts" } } }'
6115
+ );
5884
6116
  const wire = WIRE_SLOTS.filter((slot) => loaded2[slot] !== void 0);
5885
6117
  if (wire.length > 0) {
5886
6118
  const slots = WIRE_SLOTS;
@@ -5909,12 +6141,12 @@ async function resolveRNXAppConfig(startDir = process.cwd()) {
5909
6141
  const project = resolveAppProject(startDir);
5910
6142
  return { project, ...await loadRNXAppStubs(project) };
5911
6143
  }
5912
- var import_node_fs12, import_node_path11, import_jiti, WIRE_SLOTS;
6144
+ var import_node_fs14, import_node_path13, import_jiti, WIRE_SLOTS;
5913
6145
  var init_app_config = __esm({
5914
6146
  "cli/app-config.ts"() {
5915
6147
  "use strict";
5916
- import_node_fs12 = require("node:fs");
5917
- import_node_path11 = __toESM(require("node:path"), 1);
6148
+ import_node_fs14 = require("node:fs");
6149
+ import_node_path13 = __toESM(require("node:path"), 1);
5918
6150
  import_jiti = require("jiti");
5919
6151
  init_config();
5920
6152
  init_config();
@@ -6010,14 +6242,14 @@ async function produceConfiguredBundle(source, config, runtimePackages) {
6010
6242
  const neededPackages = /* @__PURE__ */ new Set();
6011
6243
  const factories = [];
6012
6244
  const visit3 = (filePath) => {
6013
- const real = import_node_fs13.default.realpathSync(filePath);
6245
+ const real = import_node_fs15.default.realpathSync(filePath);
6014
6246
  const previous = files.get(real);
6015
6247
  if (previous !== void 0) return previous;
6016
6248
  const id = "peach-config-file:" + files.size;
6017
6249
  files.set(real, id);
6018
6250
  const compiled = compileReplacementModule({
6019
6251
  filePath: real,
6020
- source: import_node_fs13.default.readFileSync(real, "utf8"),
6252
+ source: import_node_fs15.default.readFileSync(real, "utf8"),
6021
6253
  runtimePackages,
6022
6254
  localModuleUrl: (specifier) => visit3(resolveReplacementModuleFile(real, specifier))
6023
6255
  });
@@ -6030,12 +6262,18 @@ async function produceConfiguredBundle(source, config, runtimePackages) {
6030
6262
  );
6031
6263
  return id;
6032
6264
  };
6033
- for (const key of ["modules", "turboModules", "nativeModules", "nativeViews"]) {
6265
+ for (const key of [
6266
+ "modules",
6267
+ "turboModules",
6268
+ "nativeModules",
6269
+ "nativeViews",
6270
+ "nativeHybridObjects"
6271
+ ]) {
6034
6272
  const entries = Reflect.get(packagedConfig, key);
6035
6273
  if (!entries || typeof entries !== "object") continue;
6036
6274
  for (const resolution of Object.values(entries)) {
6037
6275
  if (resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string") {
6038
- resolution.file = visit3(import_node_path12.default.resolve(resolution.file));
6276
+ resolution.file = visit3(import_node_path14.default.resolve(resolution.file));
6039
6277
  }
6040
6278
  }
6041
6279
  }
@@ -6059,12 +6297,12 @@ async function produceConfiguredBundle(source, config, runtimePackages) {
6059
6297
  const identityStart = findBundleFooter(source, "globalThis.__sootsimModulePaths=");
6060
6298
  return prefix2 + (identityStart < 0 ? source + footer : source.slice(0, identityStart) + footer + source.slice(identityStart));
6061
6299
  }
6062
- var import_node_fs13, import_node_path12, import_sucrase2, import_terser;
6300
+ var import_node_fs15, import_node_path14, import_sucrase2, import_terser;
6063
6301
  var init_configured_bundle_producer = __esm({
6064
6302
  "src/configured-bundle-producer.ts"() {
6065
6303
  "use strict";
6066
- import_node_fs13 = __toESM(require("node:fs"), 1);
6067
- import_node_path12 = __toESM(require("node:path"), 1);
6304
+ import_node_fs15 = __toESM(require("node:fs"), 1);
6305
+ import_node_path14 = __toESM(require("node:path"), 1);
6068
6306
  import_sucrase2 = require("sucrase");
6069
6307
  import_terser = require("terser");
6070
6308
  init_dependencies();
@@ -8765,6 +9003,7 @@ init_bundleGlobalFooter();
8765
9003
  init_is_record();
8766
9004
 
8767
9005
  // src/nativeAppIconContract.ts
9006
+ init_assetCatalogContract();
8768
9007
  init_is_record();
8769
9008
  function resolveNativeAppIconArtwork(resources, readText, resourceUri, icons, primaryName, alternateNames, resolveReference) {
8770
9009
  const members = new Set(resources);
@@ -9155,10 +9394,10 @@ function appTargetReleaseSettings(pbxproj, targetName, infoPlistRelativePath) {
9155
9394
  var APP_DELEGATE_PATH_RE = /(?:^|\/)ios\/([^/]+)\/AppDelegate\.(?:swift|mm|m)$/;
9156
9395
  function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri) {
9157
9396
  const pbxprojPath = Object.keys(files).find(
9158
- (path14) => /(?:^|\/)ios\/[^/]+\.xcodeproj\/project\.pbxproj$/.test(path14)
9397
+ (path16) => /(?:^|\/)ios\/[^/]+\.xcodeproj\/project\.pbxproj$/.test(path16)
9159
9398
  ) ?? Object.keys(files).find(
9160
- (path14) => /(?:^|\/)[^/]+\.xcodeproj\/project\.pbxproj$/.test(path14)
9161
- ) ?? Object.keys(files).find((path14) => /(?:^|\/)project\.pbxproj$/.test(path14));
9399
+ (path16) => /(?:^|\/)[^/]+\.xcodeproj\/project\.pbxproj$/.test(path16)
9400
+ ) ?? Object.keys(files).find((path16) => /(?:^|\/)project\.pbxproj$/.test(path16));
9162
9401
  if (!pbxprojPath) return null;
9163
9402
  const pbxproj = files[pbxprojPath];
9164
9403
  let objects = {};
@@ -9200,7 +9439,7 @@ function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri)
9200
9439
  } else if (applicationTargetNames.size === 1) {
9201
9440
  targetName = [...applicationTargetNames][0];
9202
9441
  } else if (applicationTargetNames.size > 1) {
9203
- const delegateTargets = Object.keys(files).filter((path14) => !path14.includes("/Pods/")).map((path14) => path14.match(APP_DELEGATE_PATH_RE)?.[1]).filter(
9442
+ const delegateTargets = Object.keys(files).filter((path16) => !path16.includes("/Pods/")).map((path16) => path16.match(APP_DELEGATE_PATH_RE)?.[1]).filter(
9204
9443
  (name2) => typeof name2 === "string" && applicationTargetNames.has(name2)
9205
9444
  );
9206
9445
  if (delegateTargets.length === 1) {
@@ -9409,7 +9648,7 @@ function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri)
9409
9648
  return `${base.startsWith("/") ? "/" : ""}${segments.join("/")}`;
9410
9649
  };
9411
9650
  const project = Object.values(objects).find(
9412
- (object) => isRecord(object) && object.isa === "PBXProject"
9651
+ (object2) => isRecord(object2) && object2.isa === "PBXProject"
9413
9652
  );
9414
9653
  const projectDir = join4(
9415
9654
  pbxprojPath.replace(/(?:^|\/)[^/]+\.xcodeproj\/project\.pbxproj$/, ""),
@@ -9424,7 +9663,7 @@ function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri)
9424
9663
  if (Object.hasOwn(files, file)) return [file];
9425
9664
  const prefix2 = file === "" ? "" : `${file.replace(/\/$/, "")}/`;
9426
9665
  return paths.filter(
9427
- (path14) => path14.startsWith(prefix2) && !/(?:^|\/)\./.test(path14.slice(prefix2.length))
9666
+ (path16) => path16.startsWith(prefix2) && !/(?:^|\/)\./.test(path16.slice(prefix2.length))
9428
9667
  );
9429
9668
  },
9430
9669
  join4,
@@ -9435,7 +9674,7 @@ function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri)
9435
9674
  }
9436
9675
  const rootModuleName = readRootModuleName(
9437
9676
  Object.entries(files).filter(
9438
- ([path14]) => !path14.includes("/Pods/") && (/(?:^|\/)ios\/AppDelegate\.(?:swift|mm|m)$/.test(path14) || path14.match(APP_DELEGATE_PATH_RE)?.[1] === targetName)
9677
+ ([path16]) => !path16.includes("/Pods/") && (/(?:^|\/)ios\/AppDelegate\.(?:swift|mm|m)$/.test(path16) || path16.match(APP_DELEGATE_PATH_RE)?.[1] === targetName)
9439
9678
  ).map(([, source]) => source)
9440
9679
  );
9441
9680
  return {
@@ -9873,6 +10112,11 @@ function isJsonObject(value) {
9873
10112
 
9874
10113
  // src/xcode-project.ts
9875
10114
  var APPLICATION = "com.apple.product-type.application";
10115
+ var FRAMEWORK_PRODUCTS = /* @__PURE__ */ new Set([
10116
+ "com.apple.product-type.framework",
10117
+ "com.apple.product-type.framework.static"
10118
+ ]);
10119
+ var HEADER_FILE = /\.(h|hh|hpp|hxx|pch)$/;
9876
10120
  var MODULE_PRODUCTS = /* @__PURE__ */ new Set([
9877
10121
  "com.apple.product-type.framework",
9878
10122
  "com.apple.product-type.framework.static",
@@ -10005,11 +10249,11 @@ function loadProject(xcodeproj) {
10005
10249
  throw new Error(`${projectFile} has no objects table`);
10006
10250
  }
10007
10251
  const objects = root.objects;
10008
- const object = (id) => {
10252
+ const object2 = (id) => {
10009
10253
  const found = id === void 0 ? void 0 : objects[id];
10010
10254
  return isDict(found) ? found : void 0;
10011
10255
  };
10012
- const project = object(str(root.rootObject));
10256
+ const project = object2(str(root.rootObject));
10013
10257
  if (!project || project.isa !== "PBXProject") {
10014
10258
  throw new Error(`${projectFile} has no PBXProject root`);
10015
10259
  }
@@ -10023,7 +10267,7 @@ function loadProject(xcodeproj) {
10023
10267
  objects,
10024
10268
  project,
10025
10269
  projectDir,
10026
- object,
10270
+ object: object2,
10027
10271
  resolvePath
10028
10272
  };
10029
10273
  loaded.set(projectFile, { mtimeMs, project: result });
@@ -10036,7 +10280,7 @@ function defaultConfiguration(project) {
10036
10280
  );
10037
10281
  return names.includes("Debug") ? "Debug" : str(configList?.defaultConfigurationName) ?? names[0] ?? "Debug";
10038
10282
  }
10039
- function targetSettings(ref, configuration, builtins, options = {}) {
10283
+ function targetSettings(ref, configuration, builtins, options = {}, overrides = {}) {
10040
10284
  const { project, target } = ref;
10041
10285
  const xcconfigs = [];
10042
10286
  const level = (listId) => {
@@ -10073,7 +10317,8 @@ function targetSettings(ref, configuration, builtins, options = {}) {
10073
10317
  const levels = [
10074
10318
  { ...builtins, CONFIGURATION: configuration },
10075
10319
  ...level(str(project.project.buildConfigurationList)),
10076
- ...level(str(target.buildConfigurationList))
10320
+ ...level(str(target.buildConfigurationList)),
10321
+ overrides
10077
10322
  ];
10078
10323
  const resolving2 = /* @__PURE__ */ new Set();
10079
10324
  const valueAt = (key, top) => {
@@ -10366,14 +10611,51 @@ function commonAncestor(dirs) {
10366
10611
  }
10367
10612
  return common;
10368
10613
  }
10369
- function workspaceProjects(xcodeprojOrWorkspace) {
10614
+ var isPodsProject = (xcodeproj) => import_node_path5.default.basename(xcodeproj) === "Pods.xcodeproj" && import_node_path5.default.basename(import_node_path5.default.dirname(xcodeproj)) === "Pods";
10615
+ function installedPodsSandbox(pods) {
10616
+ const podfileLock = import_node_path5.default.join(import_node_path5.default.dirname(pods), "Podfile.lock");
10617
+ const manifestLock = import_node_path5.default.join(pods, "Manifest.lock");
10618
+ if (!import_node_fs5.default.existsSync(podfileLock))
10619
+ throw new Error(
10620
+ `${pods} has no ${podfileLock}: run \`pod install\` in ${import_node_path5.default.dirname(pods)}`
10621
+ );
10622
+ if (!import_node_fs5.default.existsSync(manifestLock) || !import_node_fs5.default.readFileSync(manifestLock).equals(import_node_fs5.default.readFileSync(podfileLock)))
10623
+ throw new Error(
10624
+ `The sandbox is not in sync with the Podfile.lock: ${manifestLock} differs from ${podfileLock}. Run \`pod install\` in ${import_node_path5.default.dirname(pods)}`
10625
+ );
10626
+ const specChecksums = {};
10627
+ const lines = import_node_fs5.default.readFileSync(manifestLock, "utf8").split("\n");
10628
+ const start = lines.indexOf("SPEC CHECKSUMS:");
10629
+ for (const line of start === -1 ? [] : lines.slice(start + 1)) {
10630
+ const entry = /^ {2}"?([^":]+)"?: ([0-9a-f]+)$/.exec(line);
10631
+ if (!entry) break;
10632
+ specChecksums[entry[1]] = entry[2];
10633
+ }
10634
+ const specs = import_node_path5.default.join(pods, "Local Podspecs");
10635
+ return {
10636
+ podfileLock,
10637
+ manifestLock,
10638
+ specChecksums,
10639
+ localPodspecs: isDirectory(specs) ? import_node_fs5.default.readdirSync(specs).filter((name2) => name2.endsWith(".podspec.json")).sort().map((name2) => import_node_path5.default.join(specs, name2)) : []
10640
+ };
10641
+ }
10642
+ function workspaceProjects(xcodeprojOrWorkspace, installedPods = false) {
10370
10643
  const listed = xcodeprojOrWorkspace.endsWith(".xcworkspace") ? workspaceReferences(xcodeprojOrWorkspace) : [xcodeprojOrWorkspace];
10371
10644
  const projects = [];
10372
10645
  const projectAt = /* @__PURE__ */ new Map();
10646
+ let cocoapods = null;
10373
10647
  const addProject = (xcodeproj) => {
10374
- if (!xcodeProjectFile(xcodeproj)) return;
10648
+ if (!xcodeProjectFile(xcodeproj)) {
10649
+ if (installedPods && isPodsProject(xcodeproj))
10650
+ throw new Error(
10651
+ `${import_node_path5.default.basename(xcodeprojOrWorkspace)} builds ${xcodeproj}, which is not installed: run \`pod install\` in ${import_node_path5.default.dirname(import_node_path5.default.dirname(xcodeproj))}`
10652
+ );
10653
+ return;
10654
+ }
10375
10655
  const key = import_node_fs5.default.realpathSync(xcodeproj);
10376
- if (projectAt.has(key) || key.split(import_node_path5.default.sep).includes("Pods")) return;
10656
+ if (projectAt.has(key) || !installedPods && key.split(import_node_path5.default.sep).includes("Pods"))
10657
+ return;
10658
+ if (isPodsProject(key)) cocoapods = installedPodsSandbox(import_node_path5.default.dirname(key));
10377
10659
  const project = loadProject(key);
10378
10660
  projectAt.set(key, project);
10379
10661
  projects.push(project);
@@ -10391,7 +10673,12 @@ function workspaceProjects(xcodeprojOrWorkspace) {
10391
10673
  if (projects.length === 0) {
10392
10674
  throw new Error(`${import_node_path5.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
10393
10675
  }
10394
- return { listed, projects, projectAt };
10676
+ const podfile = import_node_path5.default.join(import_node_path5.default.dirname(xcodeprojOrWorkspace), "Podfile");
10677
+ if (installedPods && !cocoapods && import_node_fs5.default.existsSync(podfile))
10678
+ throw new Error(
10679
+ `${podfile} is not installed into ${import_node_path5.default.basename(xcodeprojOrWorkspace)}: run \`pod install\` in ${import_node_path5.default.dirname(podfile)} and open the workspace it writes`
10680
+ );
10681
+ return { listed, projects, projectAt, cocoapods };
10395
10682
  }
10396
10683
  var targetRefs = /* @__PURE__ */ new WeakMap();
10397
10684
  function nativeTargets(project) {
@@ -10427,7 +10714,10 @@ function listXcodeAppTargets(xcodeprojOrWorkspace, options = {}) {
10427
10714
  function readXcodeAppTarget(input, targetName, configurationName, options = {}) {
10428
10715
  const xcodeprojOrWorkspace = import_node_fs5.default.realpathSync(input);
10429
10716
  const workspace = xcodeprojOrWorkspace.endsWith(".xcworkspace") ? xcodeprojOrWorkspace : null;
10430
- const { listed, projects, projectAt } = workspaceProjects(xcodeprojOrWorkspace);
10717
+ const { listed, projects, projectAt, cocoapods } = workspaceProjects(
10718
+ xcodeprojOrWorkspace,
10719
+ options.installedPods
10720
+ );
10431
10721
  const allTargets = projects.flatMap(nativeTargets);
10432
10722
  const appTargets = allTargets.filter((ref) => isIosAppTarget(ref, options));
10433
10723
  const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
@@ -10490,7 +10780,61 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
10490
10780
  order.push(ref);
10491
10781
  };
10492
10782
  visit3(app);
10783
+ const headerPhase = (ref) => list(ref.target.buildPhases).flatMap((phaseId) => {
10784
+ const phase = ref.project.object(phaseId);
10785
+ if (phase?.isa !== "PBXHeadersBuildPhase") return [];
10786
+ return list(phase.files).flatMap((id) => {
10787
+ const file = ref.project.object(id);
10788
+ const resolved = ref.project.resolvePath(str(file?.fileRef) ?? "");
10789
+ const attributes = isDict(file?.settings) ? list(file.settings.ATTRIBUTES) : [];
10790
+ if (!resolved) return [];
10791
+ return [
10792
+ {
10793
+ file: resolved,
10794
+ visibility: attributes.includes("Public") ? "Public" : attributes.includes("Private") ? "Private" : "Project"
10795
+ }
10796
+ ];
10797
+ });
10798
+ });
10799
+ const productName = (ref) => targetSettings(
10800
+ ref,
10801
+ configuration,
10802
+ { TARGET_NAME: str(ref.target.name) ?? ref.id },
10803
+ options
10804
+ ).get("PRODUCT_NAME");
10805
+ const projectHeaderMaps = /* @__PURE__ */ new Map();
10806
+ const projectHeaderMap = (project) => {
10807
+ const cached = projectHeaderMaps.get(project);
10808
+ if (cached) return cached;
10809
+ const entries = /* @__PURE__ */ new Map();
10810
+ for (const ref of nativeTargets(project)) {
10811
+ const framework = FRAMEWORK_PRODUCTS.has(str(ref.target.productType) ?? "");
10812
+ const product = framework ? productName(ref) : "";
10813
+ for (const { file, visibility } of headerPhase(ref)) {
10814
+ const name2 = import_node_path5.default.basename(file);
10815
+ if (!entries.has(name2))
10816
+ entries.set(
10817
+ name2,
10818
+ framework && visibility !== "Project" ? `${product}/${name2}` : file
10819
+ );
10820
+ }
10821
+ }
10822
+ for (const id of Object.keys(project.objects)) {
10823
+ if (project.object(id)?.isa !== "PBXFileReference") continue;
10824
+ const file = project.resolvePath(id);
10825
+ if (file && HEADER_FILE.test(file) && !entries.has(import_node_path5.default.basename(file)))
10826
+ entries.set(import_node_path5.default.basename(file), file);
10827
+ }
10828
+ const map2 = [...entries];
10829
+ projectHeaderMaps.set(project, map2);
10830
+ return map2;
10831
+ };
10493
10832
  const xcconfigs = /* @__PURE__ */ new Set();
10833
+ const buildDir = (project) => import_node_path5.default.join(project.projectDir, ".build/peach-xcode/Build");
10834
+ const podsBuild = {
10835
+ SYMROOT: import_node_path5.default.join(buildDir(app.project), "Products"),
10836
+ OBJROOT: import_node_path5.default.join(buildDir(app.project), "Intermediates.noindex")
10837
+ };
10494
10838
  const moduleTarget = (ref) => {
10495
10839
  const name2 = str(ref.target.name) ?? ref.id;
10496
10840
  const {
@@ -10506,12 +10850,9 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
10506
10850
  SRCROOT: ref.project.projectDir,
10507
10851
  SOURCE_ROOT: ref.project.projectDir,
10508
10852
  PROJECT_DIR: ref.project.projectDir,
10509
- SYMROOT: import_node_path5.default.join(ref.project.projectDir, ".build/peach-xcode/Build/Products"),
10853
+ SYMROOT: import_node_path5.default.join(buildDir(ref.project), "Products"),
10510
10854
  BUILD_DIR: "$(SYMROOT)",
10511
- OBJROOT: import_node_path5.default.join(
10512
- ref.project.projectDir,
10513
- ".build/peach-xcode/Build/Intermediates.noindex"
10514
- ),
10855
+ OBJROOT: import_node_path5.default.join(buildDir(ref.project), "Intermediates.noindex"),
10515
10856
  CONFIGURATION_BUILD_DIR: "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)",
10516
10857
  BUILT_PRODUCTS_DIR: "$(CONFIGURATION_BUILD_DIR)",
10517
10858
  TARGET_BUILD_DIR: "$(CONFIGURATION_BUILD_DIR)",
@@ -10527,7 +10868,8 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
10527
10868
  ACTION: "build",
10528
10869
  DEVELOPMENT_LANGUAGE: str(ref.project.project.developmentRegion) ?? "en"
10529
10870
  },
10530
- options
10871
+ options,
10872
+ isPodsProject(ref.project.xcodeproj) ? podsBuild : {}
10531
10873
  );
10532
10874
  for (const file of read) xcconfigs.add(file);
10533
10875
  const swiftVersion = Number.parseFloat(settings2("SWIFT_VERSION") || "5");
@@ -10537,6 +10879,20 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
10537
10879
  (file) => /\.(c|cc|cpp|cxx|m|mm)$/.test(file)
10538
10880
  );
10539
10881
  const absolute = (file) => import_node_path5.default.resolve(ref.project.projectDir, file);
10882
+ const framework = FRAMEWORK_PRODUCTS.has(str(ref.target.productType) ?? "");
10883
+ const product = settings2("PRODUCT_NAME");
10884
+ const headerFiles = headerPhase(ref);
10885
+ const ownHeaders = /* @__PURE__ */ new Map();
10886
+ for (const { file, visibility } of headerFiles) {
10887
+ const name3 = import_node_path5.default.basename(file);
10888
+ const published = framework && visibility !== "Project";
10889
+ if (!ownHeaders.has(name3))
10890
+ ownHeaders.set(name3, published ? `${product}/${name3}` : file);
10891
+ if (framework && !published && !ownHeaders.has(`${product}/${name3}`))
10892
+ ownHeaders.set(`${product}/${name3}`, file);
10893
+ }
10894
+ const wrapper = import_node_path5.default.join(settings2("BUILT_PRODUCTS_DIR"), `${product}.framework`);
10895
+ const moduleMap = settings2("DEFINES_MODULE") === "YES" && settings2("MODULEMAP_FILE") ? absolute(settings2("MODULEMAP_FILE")) : null;
10540
10896
  const fileFlags = {};
10541
10897
  for (const phaseId of list(ref.target.buildPhases)) {
10542
10898
  const phase = ref.project.object(phaseId);
@@ -10566,22 +10922,15 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
10566
10922
  iosDeploymentTarget: settings2("IPHONEOS_DEPLOYMENT_TARGET") || null,
10567
10923
  ...implementations.some((file) => /\.mm?$/.test(file)) ? {
10568
10924
  objc: {
10569
- publicHeaders: list(ref.target.buildPhases).flatMap((phaseId) => {
10570
- const phase = ref.project.object(phaseId);
10571
- if (phase?.isa !== "PBXHeadersBuildPhase") return [];
10572
- return list(phase.files).flatMap((id) => {
10573
- const file = ref.project.object(id);
10574
- const attributes = isDict(file?.settings) ? list(file.settings.ATTRIBUTES) : [];
10575
- const resolved = ref.project.resolvePath(str(file?.fileRef) ?? "");
10576
- return attributes.includes("Public") && resolved ? [resolved] : [];
10577
- });
10578
- }),
10925
+ publicHeaders: headerFiles.flatMap(
10926
+ ({ file, visibility }) => visibility === "Public" ? [file] : []
10927
+ ),
10579
10928
  headers: [
10580
10929
  .../* @__PURE__ */ new Set([
10581
10930
  ...headers,
10582
10931
  ...Object.keys(ref.project.objects).flatMap((id) => {
10583
10932
  const file = ref.project.resolvePath(id);
10584
- return file && /\.(h|hh|hpp|hxx|pch)$/.test(file) && import_node_fs5.default.existsSync(file) ? [file] : [];
10933
+ return file && HEADER_FILE.test(file) && import_node_fs5.default.existsSync(file) ? [file] : [];
10585
10934
  })
10586
10935
  ])
10587
10936
  ],
@@ -10591,9 +10940,13 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
10591
10940
  ...settingList(settings2("HEADER_SEARCH_PATHS")),
10592
10941
  ...settingList(settings2("USER_HEADER_SEARCH_PATHS"))
10593
10942
  ].flatMap((raw) => expandSearchPath(absolute(raw), searchRules)),
10594
- frameworkSearchPaths: settingList(
10595
- settings2("FRAMEWORK_SEARCH_PATHS")
10596
- ).flatMap((raw) => expandSearchPath(absolute(raw), searchRules)),
10943
+ // xcode searches the target's own products directory first
10944
+ frameworkSearchPaths: [
10945
+ settings2("BUILT_PRODUCTS_DIR"),
10946
+ ...settingList(settings2("FRAMEWORK_SEARCH_PATHS")).flatMap(
10947
+ (raw) => expandSearchPath(absolute(raw), searchRules)
10948
+ )
10949
+ ],
10597
10950
  flags: [
10598
10951
  settings2("CLANG_ENABLE_OBJC_ARC") === "YES" ? "-fobjc-arc" : "-fno-objc-arc",
10599
10952
  ...settings2("CLANG_ENABLE_OBJC_WEAK") === "YES" ? ["-fobjc-weak"] : [],
@@ -10608,14 +10961,40 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
10608
10961
  ...settings2("CLANG_CXX_LANGUAGE_STANDARD") ? [`-std=${settings2("CLANG_CXX_LANGUAGE_STANDARD")}`] : [],
10609
10962
  ...settingList(settings2("OTHER_CPLUSPLUSFLAGS"))
10610
10963
  ],
10611
- fileFlags
10964
+ fileFlags,
10965
+ headerMaps: settings2("USE_HEADERMAP") === "NO" ? [] : [
10966
+ { flag: "-I", entries: [...ownHeaders] },
10967
+ {
10968
+ flag: "-iquote",
10969
+ entries: projectHeaderMap(ref.project)
10970
+ }
10971
+ ],
10972
+ productHeaders: framework ? Object.fromEntries([
10973
+ ...headerFiles.flatMap(
10974
+ ({ file, visibility }) => visibility === "Project" ? [] : [
10975
+ [
10976
+ import_node_path5.default.join(
10977
+ wrapper,
10978
+ visibility === "Public" ? "Headers" : "PrivateHeaders",
10979
+ import_node_path5.default.basename(file)
10980
+ ),
10981
+ file
10982
+ ]
10983
+ ]
10984
+ ),
10985
+ ...moduleMap ? [[import_node_path5.default.join(wrapper, "Modules", "module.modulemap"), moduleMap]] : []
10986
+ ]) : {}
10612
10987
  }
10613
10988
  } : {}
10614
10989
  }
10615
10990
  };
10616
10991
  };
10617
10992
  const { settings, keys: settingKeys, module: module2 } = moduleTarget(app);
10618
- const frameworks = order.slice(0, -1).map((ref) => moduleTarget(ref).module);
10993
+ const frameworkTargets = order.slice(0, -1).map((ref) => ({ ref, framework: moduleTarget(ref).module }));
10994
+ const frameworks = frameworkTargets.map(({ framework }) => framework);
10995
+ const podSourceDirs = frameworkTargets.flatMap(
10996
+ ({ ref, framework }) => isPodsProject(ref.project.xcodeproj) ? [...framework.allSources, ...framework.objc?.headers ?? []].map((file) => import_node_path5.default.dirname(file)).filter((dir) => import_node_fs5.default.existsSync(dir)) : []
10997
+ );
10619
10998
  const expandValue = (value) => {
10620
10999
  if (typeof value === "string") return expand(value, settings);
10621
11000
  if (Array.isArray(value)) return value.map(expandValue);
@@ -10741,11 +11120,16 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
10741
11120
  ...localPackageDirs,
10742
11121
  ...linkedProducts.flatMap(
10743
11122
  ({ source }) => source.kind === "local" && import_node_fs5.default.existsSync(source.dir) ? [source.dir] : []
10744
- )
11123
+ ),
11124
+ ...new Set(podSourceDirs)
10745
11125
  ].map((dir) => import_node_fs5.default.realpathSync(dir))
10746
11126
  ),
10747
11127
  projectFiles: [
10748
- .../* @__PURE__ */ new Set([...used.map((project) => project.projectFile), ...xcconfigs])
11128
+ .../* @__PURE__ */ new Set([
11129
+ ...used.map((project) => project.projectFile),
11130
+ ...xcconfigs,
11131
+ ...cocoapods ? [cocoapods.podfileLock, cocoapods.manifestLock, ...cocoapods.localPodspecs] : []
11132
+ ])
10749
11133
  ].sort(),
10750
11134
  appIconName: settings("ASSETCATALOG_COMPILER_APPICON_NAME"),
10751
11135
  infoPlist: import_plist2.default.build(info),
@@ -10759,7 +11143,8 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
10759
11143
  packageResolved,
10760
11144
  appTargets: appTargetNames,
10761
11145
  configuration,
10762
- settings
11146
+ settings,
11147
+ cocoapods
10763
11148
  };
10764
11149
  }
10765
11150