vxrn 2.0.0-beta.148.1 → 2.0.0-beta.158.1

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 (39) hide show
  1. package/dist/constants/defaults.mjs +3 -0
  2. package/dist/constants/defaults.mjs.map +1 -1
  3. package/dist/constants/defaults.native.js +3 -0
  4. package/dist/constants/defaults.native.js.map +1 -1
  5. package/dist/exports/prebuildWithoutExpo.mjs +132 -4
  6. package/dist/exports/prebuildWithoutExpo.mjs.map +1 -1
  7. package/dist/exports/prebuildWithoutExpo.native.js +175 -21
  8. package/dist/exports/prebuildWithoutExpo.native.js.map +1 -1
  9. package/dist/rn-commands/bundle/buildBundle.mjs +2 -2
  10. package/dist/rn-commands/bundle/buildBundle.mjs.map +1 -1
  11. package/dist/rn-commands/bundle/buildBundle.native.js +2 -2
  12. package/dist/rn-commands/bundle/buildBundle.native.js.map +1 -1
  13. package/dist/utils/createNativeDevEngine.mjs +122 -16
  14. package/dist/utils/createNativeDevEngine.mjs.map +1 -1
  15. package/dist/utils/createNativeDevEngine.native.js +127 -18
  16. package/dist/utils/createNativeDevEngine.native.js.map +1 -1
  17. package/dist/utils/nativeSourceContract.mjs +146 -29
  18. package/dist/utils/nativeSourceContract.mjs.map +1 -1
  19. package/dist/utils/nativeSourceContract.native.js +182 -29
  20. package/dist/utils/nativeSourceContract.native.js.map +1 -1
  21. package/package.json +10 -10
  22. package/src/constants/defaults.ts +4 -0
  23. package/src/exports/prebuildWithoutExpo.test.ts +146 -0
  24. package/src/exports/prebuildWithoutExpo.ts +165 -4
  25. package/src/native-source-contract.ts +2 -0
  26. package/src/rn-commands/bundle/buildBundle.ts +2 -2
  27. package/src/utils/createNativeDevEngine.test.ts +290 -4
  28. package/src/utils/createNativeDevEngine.ts +155 -43
  29. package/src/utils/nativeSourceContract.test.ts +34 -1
  30. package/src/utils/nativeSourceContract.ts +164 -30
  31. package/types/constants/defaults.d.ts.map +1 -1
  32. package/types/exports/prebuildWithoutExpo.d.ts +6 -0
  33. package/types/exports/prebuildWithoutExpo.d.ts.map +1 -1
  34. package/types/native-source-contract.d.ts +1 -1
  35. package/types/native-source-contract.d.ts.map +1 -1
  36. package/types/utils/createNativeDevEngine.d.ts +7 -22
  37. package/types/utils/createNativeDevEngine.d.ts.map +1 -1
  38. package/types/utils/nativeSourceContract.d.ts +15 -0
  39. package/types/utils/nativeSourceContract.d.ts.map +1 -1
@@ -158,7 +158,7 @@ function patchIosInfoPlistSceneManifest(rendered) {
158
158
  </dict>
159
159
  ${anchor}`);
160
160
  }
161
- function patchIosAppDelegateSceneLifecycle(rendered, appName, backgroundTasks) {
161
+ function patchIosAppDelegateSceneLifecycle(rendered, appName, backgroundTasks, appIntents) {
162
162
  var anchor = `@main
163
163
  class AppDelegate: UIResponder, UIApplicationDelegate {
164
164
  var window: UIWindow?
@@ -206,16 +206,18 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
206
206
  reactNativeDelegate = delegate
207
207
  reactNativeFactory = factory
208
208
  ${backgroundTasks ? ` OneBackgroundTasksRegisterHost(factory, launchOptions)
209
+ ` : ""}${appIntents ? ` OneAppIntentsRegisterHost(factory, launchOptions)
209
210
  ` : ""} return true
210
211
  }
211
212
  }`);
212
213
  }
213
214
  var ONE_BRIDGING_HEADER_NAME = "One-Bridging-Header.h";
214
215
  function renderOneBridgingHeader(app) {
215
- var _app_ios;
216
+ var _app_ios, _app_ios1;
216
217
  var imports = [nativeProjectPatches.ONE_LAUNCH_SCREEN.bridgingHeaderImport];
217
218
  if (app.updates !== void 0) imports.push(updatesHost.bridgingHeaderImport);
218
219
  if (((_app_ios = app.ios) === null || _app_ios === void 0 ? void 0 : _app_ios.backgroundTasks) !== void 0) imports.push("#import \"OneBackgroundTasksBridge.h\"");
220
+ if (((_app_ios1 = app.ios) === null || _app_ios1 === void 0 ? void 0 : _app_ios1.appIntents) !== void 0) imports.push("#import \"OneAppIntentsBridge.h\"");
219
221
  return `// generated by one prebuild: exposes One's c entry points to AppDelegate
220
222
  // without importing the One module.
221
223
  ${imports.join("\n")}
@@ -268,6 +270,102 @@ function patchIosPbxprojSceneDelegate(rendered, appName) {
268
270
  }
269
271
  return patched;
270
272
  }
273
+ function patchIosPbxprojAppIntents(rendered, appName) {
274
+ var name = "OneAppIntents.swift";
275
+ var fileRef = pbxprojId("one-app-intents-file");
276
+ var buildFile = pbxprojId("one-app-intents-build");
277
+ var edits = [
278
+ ["/* AppDelegate.swift in Sources */ = {isa = PBXBuildFile;", ` ${buildFile} /* ${name} in Sources */ = {isa = PBXBuildFile; fileRef = ${fileRef} /* ${name} */; };`],
279
+ ["/* AppDelegate.swift */ = {isa = PBXFileReference;", ` ${fileRef} /* ${name} */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ${name}; path = ${appName}/${name}; sourceTree = "<group>"; };`],
280
+ ["/* AppDelegate.swift */,", ` ${fileRef} /* ${name} */,`],
281
+ ["/* AppDelegate.swift in Sources */,", ` ${buildFile} /* ${name} in Sources */,`]
282
+ ];
283
+ var patched = rendered;
284
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
285
+ try {
286
+ for (var _iterator = edits[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
287
+ var [anchor, insertion] = _step.value;
288
+ var next = insertAfterLine(patched, anchor, insertion);
289
+ if (next === patched) {
290
+ throw new Error(`[vxrn] prebuild template project.pbxproj lost its AppDelegate.swift anchor (${anchor})`);
291
+ }
292
+ patched = next;
293
+ }
294
+ } catch (err) {
295
+ _didIteratorError = true;
296
+ _iteratorError = err;
297
+ } finally {
298
+ try {
299
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
300
+ _iterator.return();
301
+ }
302
+ } finally {
303
+ if (_didIteratorError) {
304
+ throw _iteratorError;
305
+ }
306
+ }
307
+ }
308
+ return patched;
309
+ }
310
+ function swiftLiteral(value) {
311
+ return JSON.stringify(value).replace(/\\u([0-9a-fA-F]{4})/g, function(_match, hex) {
312
+ return `\\u{${hex}}`;
313
+ });
314
+ }
315
+ function swiftShortcutPhrase(value) {
316
+ return `"${value.split("{app}").map(function(part) {
317
+ return swiftLiteral(part).slice(1, -1);
318
+ }).join("\\(.applicationName)")}"`;
319
+ }
320
+ function renderIosAppIntentsSwift(actions) {
321
+ var types = actions.map(function(action, index) {
322
+ var summaryTitle = swiftLiteral(action.title).slice(1, -1);
323
+ var text = action.textParameterTitle === void 0 ? "" : `
324
+ @Parameter(title: ${swiftLiteral(action.textParameterTitle)}) var text: String
325
+
326
+ static var parameterSummary: some ParameterSummary {
327
+ Summary("${summaryTitle} \\(\\.$text)")
328
+ }
329
+ `;
330
+ return `struct OneAppIntent${index}: AppIntent {
331
+ static let title: LocalizedStringResource = ${swiftLiteral(action.title)}
332
+ ${text}
333
+ func perform() async throws -> some IntentResult & ReturnsValue<String> {
334
+ let result = try await oneAppIntentsRun(${swiftLiteral(action.id)}, ${text ? "text" : "nil"})
335
+ return .result(value: result)
336
+ }
337
+ }`;
338
+ });
339
+ var shortcuts = actions.map(function(action, index) {
340
+ return ` AppShortcut(
341
+ intent: OneAppIntent${index}(),
342
+ phrases: [${swiftShortcutPhrase(action.shortcutPhrase)}],
343
+ shortTitle: ${swiftLiteral(action.title)},
344
+ systemImageName: "bolt.fill"
345
+ )`;
346
+ }).join("\n");
347
+ return `import AppIntents
348
+ import Foundation
349
+
350
+ private func oneAppIntentsRun(_ identifier: String, _ text: String?) async throws -> String {
351
+ try await withCheckedThrowingContinuation { continuation in
352
+ OneAppIntentsPerform(identifier, text) { result, error in
353
+ if let error { continuation.resume(throwing: error) }
354
+ else if let result { continuation.resume(returning: result) }
355
+ else { continuation.resume(throwing: NSError(domain: "OneAppIntents", code: 3)) }
356
+ }
357
+ }
358
+ }
359
+
360
+ ${types.join("\n\n")}
361
+
362
+ struct OneAppShortcuts: AppShortcutsProvider {
363
+ static var appShortcuts: [AppShortcut] {
364
+ ${shortcuts}
365
+ }
366
+ }
367
+ `;
368
+ }
271
369
  function fontFileName(font) {
272
370
  return path.basename(font);
273
371
  }
@@ -630,6 +728,11 @@ function generateSceneDelegate(args) {
630
728
  FSExtra.writeFileSync(path.join(dest, app.name, `${app.name}.entitlements`), renderEntitlements(entitlements));
631
729
  }
632
730
  }
731
+ function generateIosAppIntents(dest, platform, app) {
732
+ var _app_ios;
733
+ if (platform !== "ios" || !((_app_ios = app.ios) === null || _app_ios === void 0 ? void 0 : _app_ios.appIntents)) return;
734
+ FSExtra.writeFileSync(path.join(dest, app.name, "OneAppIntents.swift"), renderIosAppIntentsSwift(app.ios.appIntents.actions));
735
+ }
633
736
  function generateIosWidgets(dest, app) {
634
737
  var _app_ios, _app_ios1;
635
738
  var widgets = (_app_ios = app.ios) === null || _app_ios === void 0 ? void 0 : _app_ios.widgets;
@@ -1727,7 +1830,7 @@ function renderPrebuildFile(args) {
1727
1830
  }
1728
1831
  if (platform === "ios" && relativePath.endsWith("/Info.plist")) {
1729
1832
  var _ref, _ref1, _ref2;
1730
- var _app_ios2, _app_ios3, _app_ios4, _app_photoLibrary, _app_notifications2, _app_ios5, _app_ios_backgroundTasks, _app_ios6, _app_ios_backgroundTasks1, _app_ios7, _app_audio, _app_location, _app_fonts, _app_ios8;
1833
+ var _app_ios2, _app_ios3, _app_ios4, _app_photoLibrary, _app_notifications2, _app_ios5, _app_ios_backgroundTasks, _app_ios6, _app_ios_backgroundTasks1, _app_ios7, _app_ios8, _app_audio, _app_location, _app_fonts, _app_ios9;
1731
1834
  var stamps = [];
1732
1835
  if (schemes.length) {
1733
1836
  stamps.push(` <key>CFBundleURLTypes</key>
@@ -1786,6 +1889,14 @@ ${identifiers.map(function(identifier) {
1786
1889
  stamps.push(plistArray("OneBackgroundRefreshTaskIdentifiers", refreshTasks));
1787
1890
  stamps.push(plistArray("OneBackgroundProcessingTaskIdentifiers", processingTasks));
1788
1891
  }
1892
+ if ((_app_ios8 = app.ios) === null || _app_ios8 === void 0 ? void 0 : _app_ios8.appIntents) {
1893
+ stamps.push(` <key>OneAppIntentIdentifiers</key>
1894
+ <array>
1895
+ ${app.ios.appIntents.actions.map(function(action) {
1896
+ return ` <string>${escapeXml(action.id)}</string>`;
1897
+ }).join("\n")}
1898
+ </array>`);
1899
+ }
1789
1900
  var backgroundModes = [
1790
1901
  ...app.pictureInPicture || ((_app_audio = app.audio) === null || _app_audio === void 0 ? void 0 : _app_audio.background) ? ["audio"] : [],
1791
1902
  ...((_app_location = app.location) === null || _app_location === void 0 ? void 0 : _app_location.background) ? ["location"] : [],
@@ -1844,7 +1955,7 @@ ${phoneOrientations.map(function(orientation) {
1844
1955
  }
1845
1956
  stamps.push(renderPlistEntries({ [key]: value2 }, " "));
1846
1957
  };
1847
- for (var _iterator1 = Object.entries((_ref2 = (_app_ios8 = app.ios) === null || _app_ios8 === void 0 ? void 0 : _app_ios8.infoPlist) !== null && _ref2 !== void 0 ? _ref2 : {})[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) _loop();
1958
+ for (var _iterator1 = Object.entries((_ref2 = (_app_ios9 = app.ios) === null || _app_ios9 === void 0 ? void 0 : _app_ios9.infoPlist) !== null && _ref2 !== void 0 ? _ref2 : {})[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) _loop();
1848
1959
  } catch (err) {
1849
1960
  _didIteratorError1 = true;
1850
1961
  _iteratorError1 = err;
@@ -2034,15 +2145,15 @@ ${schemes.map(function(scheme) {
2034
2145
  </activity>`);
2035
2146
  }
2036
2147
  if (platform === "ios" && relativePath.endsWith(".xcodeproj/project.pbxproj")) {
2037
- var _app_ios9;
2038
- rendered = rendered.replace(/TARGETED_DEVICE_FAMILY = "1,2";/g, `TARGETED_DEVICE_FAMILY = "${((_app_ios9 = app.ios) === null || _app_ios9 === void 0 ? void 0 : _app_ios9.tablet) ? "1,2" : "1"}";`);
2148
+ var _app_ios10;
2149
+ rendered = rendered.replace(/TARGETED_DEVICE_FAMILY = "1,2";/g, `TARGETED_DEVICE_FAMILY = "${((_app_ios10 = app.ios) === null || _app_ios10 === void 0 ? void 0 : _app_ios10.tablet) ? "1,2" : "1"}";`);
2039
2150
  }
2040
2151
  if (platform === "ios" && relativePath.endsWith(".xcodeproj/project.pbxproj")) {
2041
- var _app_ios10;
2152
+ var _app_ios11;
2042
2153
  if (app.version !== void 0) {
2043
2154
  rendered = rendered.replace(/MARKETING_VERSION = [^;]+;/g, `MARKETING_VERSION = "${app.version}";`);
2044
2155
  }
2045
- if (((_app_ios10 = app.ios) === null || _app_ios10 === void 0 ? void 0 : _app_ios10.buildNumber) !== void 0) {
2156
+ if (((_app_ios11 = app.ios) === null || _app_ios11 === void 0 ? void 0 : _app_ios11.buildNumber) !== void 0) {
2046
2157
  rendered = rendered.replace(/CURRENT_PROJECT_VERSION = [^;]+;/g, `CURRENT_PROJECT_VERSION = ${app.ios.buildNumber};`);
2047
2158
  }
2048
2159
  }
@@ -2056,7 +2167,7 @@ ${schemes.map(function(scheme) {
2056
2167
  ASSETCATALOG_COMPILER_ALTERNATE_APPICON_NAMES = "${names}";`);
2057
2168
  }
2058
2169
  if (platform === "ios" && relativePath.endsWith("/Info.plist")) {
2059
- var _app_imagePicker2, _app_ios11, _app_audio1;
2170
+ var _app_imagePicker2, _app_ios12, _app_audio1;
2060
2171
  var usage = /* @__PURE__ */ new Map();
2061
2172
  if (((_app_imagePicker2 = app.imagePicker) === null || _app_imagePicker2 === void 0 ? void 0 : _app_imagePicker2.camera) !== void 0) {
2062
2173
  usage.set("NSCameraUsageDescription", app.imagePicker.camera);
@@ -2083,7 +2194,7 @@ ${schemes.map(function(scheme) {
2083
2194
  if (app.location !== void 0) {
2084
2195
  usage.set("NSLocationWhenInUseUsageDescription", app.location.whenInUse);
2085
2196
  }
2086
- if (((_app_ios11 = app.ios) === null || _app_ios11 === void 0 ? void 0 : _app_ios11.faceIdUsageDescription) !== void 0) {
2197
+ if (((_app_ios12 = app.ios) === null || _app_ios12 === void 0 ? void 0 : _app_ios12.faceIdUsageDescription) !== void 0) {
2087
2198
  usage.set("NSFaceIDUsageDescription", app.ios.faceIdUsageDescription);
2088
2199
  }
2089
2200
  if (app.speech !== void 0) {
@@ -2138,8 +2249,8 @@ ${schemes.map(function(scheme) {
2138
2249
  rendered = patchIosInfoPlistSceneManifest(rendered);
2139
2250
  }
2140
2251
  if (platform === "ios" && relativePath.endsWith("/AppDelegate.swift")) {
2141
- var _app_ios12;
2142
- rendered = patchIosAppDelegateSceneLifecycle(rendered, appName, !!((_app_ios12 = app.ios) === null || _app_ios12 === void 0 ? void 0 : _app_ios12.backgroundTasks));
2252
+ var _app_ios13, _app_ios14;
2253
+ rendered = patchIosAppDelegateSceneLifecycle(rendered, appName, !!((_app_ios13 = app.ios) === null || _app_ios13 === void 0 ? void 0 : _app_ios13.backgroundTasks), !!((_app_ios14 = app.ios) === null || _app_ios14 === void 0 ? void 0 : _app_ios14.appIntents));
2143
2254
  rendered = nativeProjectPatches.holdLaunchScreenOverRootView(rendered);
2144
2255
  if (app.updates !== void 0) {
2145
2256
  rendered = nativeProjectPatches.pointReleaseBundleURLAtOneUpdates(rendered);
@@ -2160,27 +2271,28 @@ end`);
2160
2271
  }
2161
2272
  }
2162
2273
  if (platform === "ios" && relativePath.endsWith(".xcodeproj/project.pbxproj")) {
2163
- var _app_updates, _app_ios13, _app_ios14;
2274
+ var _app_updates, _app_ios15, _app_ios16, _app_ios17;
2164
2275
  rendered = patchIosBundlePhase(rendered, (_app_updates = app.updates) === null || _app_updates === void 0 ? void 0 : _app_updates.runtimeVersion);
2165
2276
  rendered = patchIosPbxprojSceneDelegate(rendered, appName);
2277
+ if ((_app_ios15 = app.ios) === null || _app_ios15 === void 0 ? void 0 : _app_ios15.appIntents) rendered = patchIosPbxprojAppIntents(rendered, appName);
2166
2278
  rendered = patchIosPbxprojOneBridgingHeader(rendered, appName);
2167
- if (Object.keys(appEntitlements(app)).length && !((_app_ios13 = app.ios) === null || _app_ios13 === void 0 ? void 0 : _app_ios13.widgets)) {
2279
+ if (Object.keys(appEntitlements(app)).length && !((_app_ios16 = app.ios) === null || _app_ios16 === void 0 ? void 0 : _app_ios16.widgets)) {
2168
2280
  rendered = patchIosPbxprojAppEntitlements(rendered, appName);
2169
2281
  }
2170
- if ((_app_ios14 = app.ios) === null || _app_ios14 === void 0 ? void 0 : _app_ios14.widgets) rendered = patchIosPbxprojWidgets(rendered, app);
2282
+ if ((_app_ios17 = app.ios) === null || _app_ios17 === void 0 ? void 0 : _app_ios17.widgets) rendered = patchIosPbxprojWidgets(rendered, app);
2171
2283
  if (iosResourceFiles(app).length) {
2172
2284
  rendered = patchIosPbxprojResources(rendered, appName, iosResourceFiles(app));
2173
2285
  }
2174
2286
  }
2175
2287
  if (platform === "ios" && relativePath === "Podfile") {
2176
- var _app_ios15, _app_ios16, _app_ios17;
2177
- if ((_app_ios15 = app.ios) === null || _app_ios15 === void 0 ? void 0 : _app_ios15.ccache) rendered = `ENV['USE_CCACHE'] ||= '1'
2288
+ var _app_ios18, _app_ios19, _app_ios20;
2289
+ if ((_app_ios18 = app.ios) === null || _app_ios18 === void 0 ? void 0 : _app_ios18.ccache) rendered = `ENV['USE_CCACHE'] ||= '1'
2178
2290
  ${rendered}`;
2179
- if ((_app_ios16 = app.ios) === null || _app_ios16 === void 0 ? void 0 : _app_ios16.useFrameworks) {
2291
+ if ((_app_ios19 = app.ios) === null || _app_ios19 === void 0 ? void 0 : _app_ios19.useFrameworks) {
2180
2292
  rendered = rendered.replace(/^(platform :ios, .+)$/m, `$1
2181
2293
  use_frameworks! :linkage => :${app.ios.useFrameworks}`);
2182
2294
  }
2183
- if ((_app_ios17 = app.ios) === null || _app_ios17 === void 0 ? void 0 : _app_ios17.screensGamma) {
2295
+ if ((_app_ios20 = app.ios) === null || _app_ios20 === void 0 ? void 0 : _app_ios20.screensGamma) {
2184
2296
  rendered = nativeProjectPatches.injectReactNativeScreensGammaIntoPodfile(rendered);
2185
2297
  }
2186
2298
  rendered = nativeProjectPatches.injectFmtCxx17FixIntoPodfile(rendered);
@@ -2386,6 +2498,7 @@ var generateForPlatform = async function(root, platform, app) {
2386
2498
  platform,
2387
2499
  app
2388
2500
  });
2501
+ generateIosAppIntents(dest, platform, app);
2389
2502
  if (platform === "ios") generateOneBridgingHeader(dest, app);
2390
2503
  if (platform === "ios") generateIosWidgets(dest, app);
2391
2504
  if (platform === "ios") await generateSwiftPackages({
@@ -2397,6 +2510,41 @@ var generateForPlatform = async function(root, platform, app) {
2397
2510
  dest
2398
2511
  });
2399
2512
  };
2513
+ function enableAppComposeIntegration(dest) {
2514
+ var rootBuildGradlePath = path.join(dest, "build.gradle");
2515
+ if (FSExtra.existsSync(rootBuildGradlePath)) {
2516
+ var content = FSExtra.readFileSync(rootBuildGradlePath, "utf8");
2517
+ var composePluginClasspath = " classpath(\"org.jetbrains.kotlin.plugin.compose:org.jetbrains.kotlin.plugin.compose.gradle.plugin:$kotlinVersion\")";
2518
+ if (!content.includes("org.jetbrains.kotlin.plugin.compose")) {
2519
+ var anchor = content.includes("classpath(\"org.jetbrains.kotlin:kotlin-gradle-plugin\")") ? "classpath(\"org.jetbrains.kotlin:kotlin-gradle-plugin\")" : "classpath \"org.jetbrains.kotlin:kotlin-gradle-plugin\"";
2520
+ content = insertAfterLine(content, anchor, composePluginClasspath);
2521
+ FSExtra.writeFileSync(rootBuildGradlePath, content, "utf8");
2522
+ }
2523
+ }
2524
+ var appBuildGradlePath = path.join(dest, "app/build.gradle");
2525
+ if (FSExtra.existsSync(appBuildGradlePath)) {
2526
+ var content1 = FSExtra.readFileSync(appBuildGradlePath, "utf8");
2527
+ if (!content1.includes("org.jetbrains.kotlin.plugin.compose")) {
2528
+ var pluginAnchor = content1.includes("apply plugin: \"org.jetbrains.kotlin.android\"") ? "apply plugin: \"org.jetbrains.kotlin.android\"" : "apply plugin: 'org.jetbrains.kotlin.android'";
2529
+ content1 = insertAfterLine(content1, pluginAnchor, "apply plugin: \"org.jetbrains.kotlin.plugin.compose\"");
2530
+ }
2531
+ if (!content1.includes("compose true")) {
2532
+ content1 = insertAfterLine(content1, "android {", " buildFeatures {\n compose true\n }");
2533
+ }
2534
+ if (!content1.includes("androidx.compose.ui:ui")) {
2535
+ var composeDeps = [
2536
+ " def composeUiVersion = rootProject.ext.has(\"composeUiVersion\") ? rootProject.ext.get(\"composeUiVersion\") : \"1.11.4\"",
2537
+ " def material3Version = rootProject.ext.has(\"material3Version\") ? rootProject.ext.get(\"material3Version\") : \"1.5.0-alpha17\"",
2538
+ " implementation \"androidx.compose.ui:ui:$composeUiVersion\"",
2539
+ " implementation \"androidx.compose.foundation:foundation:$composeUiVersion\"",
2540
+ " implementation \"androidx.compose.material3:material3:$material3Version\""
2541
+ ].join("\n");
2542
+ var depsAnchor = content1.includes("implementation(\"com.facebook.react:react-android\")") ? "implementation(\"com.facebook.react:react-android\")" : "implementation \"com.facebook.react:react-android\"";
2543
+ content1 = insertAfterLine(content1, depsAnchor, composeDeps);
2544
+ }
2545
+ FSExtra.writeFileSync(appBuildGradlePath, content1, "utf8");
2546
+ }
2547
+ }
2400
2548
  async function generateKotlinSources(param) {
2401
2549
  var { root, dest } = param;
2402
2550
  var skip = /* @__PURE__ */ new Set([
@@ -2412,6 +2560,7 @@ async function generateKotlinSources(param) {
2412
2560
  ]);
2413
2561
  var sources = [];
2414
2562
  var collect = function(dir) {
2563
+ if (dir !== root && FSExtra.existsSync(path.join(dir, "package.json"))) return;
2415
2564
  var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = void 0;
2416
2565
  try {
2417
2566
  for (var _iterator2 = FSExtra.readdirSync(dir, { withFileTypes: true })[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
@@ -2439,6 +2588,7 @@ async function generateKotlinSources(param) {
2439
2588
  collect(root);
2440
2589
  if (sources.length === 0) return;
2441
2590
  var { kotlinSourceId, renderKotlinSourceGlue, writeNativeSourceDeclaration } = await import("../utils/nativeSourceContract.native.js");
2591
+ var hasViews = false;
2442
2592
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
2443
2593
  try {
2444
2594
  for (var _iterator = sources[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
@@ -2448,7 +2598,8 @@ async function generateKotlinSources(param) {
2448
2598
  FSExtra.mkdirSync(target, { recursive: true });
2449
2599
  FSExtra.copyFileSync(source, path.join(target, path.basename(source)));
2450
2600
  var contract = writeNativeSourceDeclaration(source);
2451
- if (contract.modules.length > 0) {
2601
+ if (contract.views.length > 0) hasViews = true;
2602
+ if (contract.modules.length > 0 || contract.views.length > 0) {
2452
2603
  FSExtra.writeFileSync(path.join(target, `OneNativeSource_${id}.kt`), renderKotlinSourceGlue(id, contract).source);
2453
2604
  }
2454
2605
  }
@@ -2466,6 +2617,9 @@ async function generateKotlinSources(param) {
2466
2617
  }
2467
2618
  }
2468
2619
  }
2620
+ if (hasViews) {
2621
+ enableAppComposeIntegration(dest);
2622
+ }
2469
2623
  }
2470
2624
  async function generateSwiftPackages(param) {
2471
2625
  var { root, dest } = param;
@@ -2667,5 +2821,5 @@ var transformPath = function(filePath) {
2667
2821
  return filePath.replace("_BUCK", "BUCK").replace("_gitignore", ".gitignore").replace("_gitattributes", ".gitattributes").replace("_babelrc", ".babelrc").replace("_editorconfig", ".editorconfig").replace("_eslintrc.js", ".eslintrc.js").replace("_flowconfig", ".flowconfig").replace("_buckconfig", ".buckconfig").replace("_prettierrc.js", ".prettierrc.js").replace("_bundle", ".bundle").replace("_ruby-version", ".ruby-version").replace("_node-version", ".node-version").replace("_watchmanconfig", ".watchmanconfig").replace("_xcode.env", ".xcode.env");
2668
2822
  };
2669
2823
 
2670
- export { applyAndroidDependencyPatches, generateForPlatform, getNativeDependencyInventory, installNativeDependencies, renderPrebuildFile, renderSceneDelegateSwift, validatePrebuildApp };
2824
+ export { applyAndroidDependencyPatches, enableAppComposeIntegration, generateForPlatform, generateKotlinSources, getNativeDependencyInventory, installNativeDependencies, renderIosAppIntentsSwift, renderPrebuildFile, renderSceneDelegateSwift, validatePrebuildApp };
2671
2825
  //# sourceMappingURL=prebuildWithoutExpo.native.js.map