@callstack/react-native-brownfield 5.2.0 → 6.0.0

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 (117) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/android/build.gradle +1 -0
  3. package/android/consumer-rules.pro +6 -0
  4. package/android/src/main/java/com/callstack/reactnativebrownfield/BrownfieldPerformance.kt +384 -0
  5. package/android/src/main/java/com/callstack/reactnativebrownfield/BrownfieldPerformanceModule.kt +15 -0
  6. package/android/src/main/java/com/callstack/reactnativebrownfield/ReactDelegateWrapper.kt +8 -5
  7. package/android/src/main/java/com/callstack/reactnativebrownfield/ReactNativeBrownfield.kt +78 -23
  8. package/android/src/main/java/com/callstack/reactnativebrownfield/ReactNativeBrownfieldPackage.kt +1 -0
  9. package/android/src/main/java/com/callstack/reactnativebrownfield/ReactNativeFragment.kt +89 -3
  10. package/android/src/main/java/com/callstack/reactnativebrownfield/constants/ReactNativeFragmentArgNames.kt +2 -0
  11. package/android/src/test/java/com/callstack/reactnativebrownfield/PerformanceMetricsTest.kt +54 -0
  12. package/gradle-plugin/brownfield/src/main/kotlin/com/callstack/react/brownfield/plugin/RNSourceSets.kt +59 -15
  13. package/gradle-plugin/brownfield/src/test/kotlin/com/callstack/react/brownfield/plugin/AgpCompatibilityMatrixTest.kt +6 -8
  14. package/gradle-plugin/brownfield/src/test/kotlin/com/callstack/react/brownfield/plugin/LegacyConsumerConfigurationTest.kt +6 -4
  15. package/gradle-plugin/brownfield/src/test/kotlin/com/callstack/react/brownfield/plugin/RNBundleTaskStubs.kt +27 -0
  16. package/ios/BrownfieldDisplayMetrics.swift +265 -0
  17. package/ios/BrownfieldPerformanceBridge.h +8 -0
  18. package/ios/BrownfieldPerformanceBridge.mm +103 -0
  19. package/ios/Expo/ExpoHostRuntime.swift +58 -14
  20. package/ios/Expo/ExpoUpdatesStartup.swift +49 -0
  21. package/ios/JSBundleLoadObserver.swift +56 -19
  22. package/ios/JSBundleTimingObserver.h +26 -0
  23. package/ios/JSBundleTimingObserver.m +140 -0
  24. package/ios/ReactHostPreloading.swift +7 -3
  25. package/ios/ReactNativeBrownfield.swift +82 -14
  26. package/ios/ReactNativeBrownfield.xcodeproj/project.pbxproj +16 -0
  27. package/ios/Vanilla/ReactNativeHostRuntime.swift +1 -1
  28. package/ios/Views/ReactNativeView.swift +21 -3
  29. package/ios/Views/ReactNativeViewController.swift +44 -42
  30. package/lib/commonjs/expo-config-plugin/android/withAndroidModuleFiles.js +1 -1
  31. package/lib/commonjs/expo-config-plugin/android/withAndroidModuleFiles.js.map +1 -1
  32. package/lib/commonjs/expo-config-plugin/ios/podfileHelpers.js +1 -1
  33. package/lib/commonjs/expo-config-plugin/ios/podfileHelpers.js.map +1 -1
  34. package/lib/commonjs/expo-config-plugin/ios/withBrownfieldIos.js +1 -1
  35. package/lib/commonjs/expo-config-plugin/ios/withBrownfieldIos.js.map +1 -1
  36. package/lib/commonjs/expo-config-plugin/ios/withIosFrameworkFiles.js +1 -1
  37. package/lib/commonjs/expo-config-plugin/ios/withIosFrameworkFiles.js.map +1 -1
  38. package/lib/commonjs/expo-config-plugin/ios/xcodeHelpers.js +2 -2
  39. package/lib/commonjs/expo-config-plugin/ios/xcodeHelpers.js.map +1 -1
  40. package/lib/commonjs/expo-config-plugin/template/android/ReactNativeHostManager.vanilla.kt +35 -0
  41. package/lib/commonjs/expo-config-plugin/template/android/consumer-rules.pro +7 -0
  42. package/lib/commonjs/expo-config-plugin/template/ios/FrameworkInterface.vanilla.swift +12 -0
  43. package/lib/commonjs/expo-config-plugin/template/ios/PodfileTargetBlock.vanilla.rb +5 -0
  44. package/lib/commonjs/index.js +1 -1
  45. package/lib/commonjs/index.js.map +1 -1
  46. package/lib/commonjs/scaffold/index.js +2 -0
  47. package/lib/commonjs/scaffold/index.js.map +1 -0
  48. package/lib/commonjs/scaffold/projectFiles.js +2 -0
  49. package/lib/commonjs/scaffold/projectFiles.js.map +1 -0
  50. package/lib/commonjs/scaffold/xcode.d.js +2 -0
  51. package/lib/commonjs/scaffold/xcode.d.js.map +1 -0
  52. package/lib/module/expo-config-plugin/android/withAndroidModuleFiles.js +1 -1
  53. package/lib/module/expo-config-plugin/android/withAndroidModuleFiles.js.map +1 -1
  54. package/lib/module/expo-config-plugin/ios/podfileHelpers.js +1 -1
  55. package/lib/module/expo-config-plugin/ios/podfileHelpers.js.map +1 -1
  56. package/lib/module/expo-config-plugin/ios/withBrownfieldIos.js +1 -1
  57. package/lib/module/expo-config-plugin/ios/withBrownfieldIos.js.map +1 -1
  58. package/lib/module/expo-config-plugin/ios/withIosFrameworkFiles.js +1 -1
  59. package/lib/module/expo-config-plugin/ios/withIosFrameworkFiles.js.map +1 -1
  60. package/lib/module/expo-config-plugin/ios/xcodeHelpers.js +2 -2
  61. package/lib/module/expo-config-plugin/ios/xcodeHelpers.js.map +1 -1
  62. package/lib/module/expo-config-plugin/template/android/ReactNativeHostManager.vanilla.kt +35 -0
  63. package/lib/module/expo-config-plugin/template/android/consumer-rules.pro +7 -0
  64. package/lib/module/expo-config-plugin/template/ios/FrameworkInterface.vanilla.swift +12 -0
  65. package/lib/module/expo-config-plugin/template/ios/PodfileTargetBlock.vanilla.rb +5 -0
  66. package/lib/module/index.js +1 -1
  67. package/lib/module/index.js.map +1 -1
  68. package/lib/module/scaffold/index.js +2 -0
  69. package/lib/module/scaffold/index.js.map +1 -0
  70. package/lib/module/scaffold/projectFiles.js +2 -0
  71. package/lib/module/scaffold/projectFiles.js.map +1 -0
  72. package/lib/module/scaffold/xcode.d.js +2 -0
  73. package/lib/module/scaffold/xcode.d.js.map +1 -0
  74. package/lib/typescript/commonjs/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts +10 -2
  75. package/lib/typescript/commonjs/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts.map +1 -1
  76. package/lib/typescript/commonjs/src/expo-config-plugin/ios/podfileHelpers.d.ts +4 -2
  77. package/lib/typescript/commonjs/src/expo-config-plugin/ios/podfileHelpers.d.ts.map +1 -1
  78. package/lib/typescript/commonjs/src/expo-config-plugin/ios/withBrownfieldIos.d.ts.map +1 -1
  79. package/lib/typescript/commonjs/src/expo-config-plugin/ios/withIosFrameworkFiles.d.ts +11 -2
  80. package/lib/typescript/commonjs/src/expo-config-plugin/ios/withIosFrameworkFiles.d.ts.map +1 -1
  81. package/lib/typescript/commonjs/src/expo-config-plugin/ios/xcodeHelpers.d.ts +6 -2
  82. package/lib/typescript/commonjs/src/expo-config-plugin/ios/xcodeHelpers.d.ts.map +1 -1
  83. package/lib/typescript/commonjs/src/index.d.ts +7 -0
  84. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  85. package/lib/typescript/commonjs/src/scaffold/index.d.ts +23 -0
  86. package/lib/typescript/commonjs/src/scaffold/index.d.ts.map +1 -0
  87. package/lib/typescript/commonjs/src/scaffold/projectFiles.d.ts +63 -0
  88. package/lib/typescript/commonjs/src/scaffold/projectFiles.d.ts.map +1 -0
  89. package/lib/typescript/module/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts +10 -2
  90. package/lib/typescript/module/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts.map +1 -1
  91. package/lib/typescript/module/src/expo-config-plugin/ios/podfileHelpers.d.ts +4 -2
  92. package/lib/typescript/module/src/expo-config-plugin/ios/podfileHelpers.d.ts.map +1 -1
  93. package/lib/typescript/module/src/expo-config-plugin/ios/withBrownfieldIos.d.ts.map +1 -1
  94. package/lib/typescript/module/src/expo-config-plugin/ios/withIosFrameworkFiles.d.ts +11 -2
  95. package/lib/typescript/module/src/expo-config-plugin/ios/withIosFrameworkFiles.d.ts.map +1 -1
  96. package/lib/typescript/module/src/expo-config-plugin/ios/xcodeHelpers.d.ts +6 -2
  97. package/lib/typescript/module/src/expo-config-plugin/ios/xcodeHelpers.d.ts.map +1 -1
  98. package/lib/typescript/module/src/index.d.ts +7 -0
  99. package/lib/typescript/module/src/index.d.ts.map +1 -1
  100. package/lib/typescript/module/src/scaffold/index.d.ts +23 -0
  101. package/lib/typescript/module/src/scaffold/index.d.ts.map +1 -0
  102. package/lib/typescript/module/src/scaffold/projectFiles.d.ts +63 -0
  103. package/lib/typescript/module/src/scaffold/projectFiles.d.ts.map +1 -0
  104. package/package.json +16 -2
  105. package/src/expo-config-plugin/android/withAndroidModuleFiles.ts +33 -5
  106. package/src/expo-config-plugin/ios/podfileHelpers.ts +24 -6
  107. package/src/expo-config-plugin/ios/withBrownfieldIos.ts +5 -2
  108. package/src/expo-config-plugin/ios/withIosFrameworkFiles.ts +21 -6
  109. package/src/expo-config-plugin/ios/xcodeHelpers.ts +77 -5
  110. package/src/expo-config-plugin/template/android/ReactNativeHostManager.vanilla.kt +35 -0
  111. package/src/expo-config-plugin/template/android/consumer-rules.pro +7 -0
  112. package/src/expo-config-plugin/template/ios/FrameworkInterface.vanilla.swift +12 -0
  113. package/src/expo-config-plugin/template/ios/PodfileTargetBlock.vanilla.rb +5 -0
  114. package/src/index.ts +20 -1
  115. package/src/scaffold/index.ts +395 -0
  116. package/src/scaffold/projectFiles.ts +243 -0
  117. package/src/scaffold/xcode.d.ts +4 -0
@@ -1 +1 @@
1
- {"version":3,"file":"xcodeHelpers.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/ios/xcodeHelpers.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,YAAY,EAElB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,UAAU,CAAC;AAIlE;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,QAAQ,CAAC,YAAY,CAAC,EAClC,OAAO,EAAE,iCAAiC,GACzC;IACD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,mBAAmB,EAAE,OAAO,CAAC;CAC9B,CAoIA;AAED,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,YAAY,EACrB,mBAAmB,EAAE,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E,OAAO,GAAG,SAAS,CAAC;CACpC,EACD,EACE,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,aAAa,EAAE,mBAAmB,GACnC,EAAE,iCAAiC,GACnC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC,CA8B3C;AAED,wBAAgB,qDAAqD,CACnE,WAAW,EAAE,MAAM,GAClB,MAAM,CAoCR;AAgCD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,MAAM,GACjB,IAAI,CA+FN;AAuED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,kBAAkB,CAAC,EAC/C,aAAa,EAAE,MAAM,GAAG,IAAI,GAC3B,MAAM,GAAG,IAAI,CAqBf;AAED,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,QAAQ,CAAC,YAAY,CAAC,EAClC,EACE,wBAAwB,GACzB,EAAE;IACD,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC,GACA,MAAM,CAYR"}
1
+ {"version":3,"file":"xcodeHelpers.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/ios/xcodeHelpers.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,YAAY,EAElB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,UAAU,CAAC;AAyClE;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,QAAQ,CAAC,YAAY,CAAC,EAClC,OAAO,EAAE,iCAAiC,EAC1C,iBAAiB,CAAC,EAAE;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GACA;IACD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,mBAAmB,EAAE,OAAO,CAAC;CAC9B,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gBAAgB,EAAE,EAAE,0BAA0B,GAC3E,OAAO,CAwBT;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,EACE,aAAa,GACd,EAAE;IACD,sDAAsD;IACtD,aAAa,EAAE,OAAO,GAAG,SAAS,CAAC;CACpC,EACD,EACE,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,aAAa,EAAE,mBAAmB,GACnC,EAAE,iCAAiC,GACnC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC,CA8B3C;AAED,wBAAgB,qDAAqD,CACnE,WAAW,EAAE,MAAM,GAClB,MAAM,CAoCR;AAgCD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,MAAM,GACjB,IAAI,CAsGN;AAuED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,kBAAkB,CAAC,EAC/C,aAAa,EAAE,MAAM,GAAG,IAAI,GAC3B,MAAM,GAAG,IAAI,CAqBf;AAED,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,QAAQ,CAAC,YAAY,CAAC,EAClC,EACE,wBAAwB,GACzB,EAAE;IACD,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC,GACA,MAAM,CAYR"}
@@ -3,6 +3,13 @@ export interface MessageEvent {
3
3
  data: unknown;
4
4
  }
5
5
  declare const ReactNativeBrownfield: {
6
+ /**
7
+ * Finish this presentation's full-display measurement after data and UI are ready.
8
+ * Pass the `brownfieldPresentationID` injected into the root component's props.
9
+ * Native must opt in with `waitForFullDisplay: true`. Repeated/stale IDs are ignored.
10
+ * @platform android, ios
11
+ */
12
+ markFullyDisplayed: (presentationID: string) => void;
6
13
  /**
7
14
  * Pop to the native screen.
8
15
  * @param animated - Whether to animate the transition (iOS only).
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAIA,YAAY,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,CAAC;CACf;AAED,QAAA,MAAM,qBAAqB;IACzB;;;;;;OAMG;6BACsB,OAAO,KAAG,IAAI;IAUvC;;;;;;;OAOG;oDAC6C,OAAO,KAAG,IAAI;IAU9D;;;;;;;;;OASG;wBACiB,OAAO,KAAG,IAAI;IAKlC;;;;;;;;;;;;OAYG;0BAES,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,KACtC;QAAE,MAAM,EAAE,MAAM,IAAI,CAAA;KAAE;CAY1B,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAWA,YAAY,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,CAAC;CACf;AAED,QAAA,MAAM,qBAAqB;IACzB;;;;;OAKG;yCACkC,MAAM,KAAG,IAAI;IAMlD;;;;;;OAMG;6BACsB,OAAO,KAAG,IAAI;IAUvC;;;;;;;OAOG;oDAC6C,OAAO,KAAG,IAAI;IAU9D;;;;;;;;;OASG;wBACiB,OAAO,KAAG,IAAI;IAKlC;;;;;;;;;;;;OAYG;0BAES,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,KACtC;QAAE,MAAM,EAAE,MAAM,IAAI,CAAA;KAAE;CAY1B,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
@@ -0,0 +1,23 @@
1
+ export type BrownfieldScaffoldOptions = {
2
+ /**
3
+ * React Native project root directory (contains package.json).
4
+ * Defaults to current working directory.
5
+ */
6
+ projectRoot?: string;
7
+ /**
8
+ * iOS framework target name (also framework directory name).
9
+ * Defaults to "BrownfieldLib".
10
+ */
11
+ iosFrameworkName?: string;
12
+ /**
13
+ * Android library module folder / Gradle module name.
14
+ * Defaults to "brownfieldlib".
15
+ */
16
+ androidModuleName?: string;
17
+ /**
18
+ * Enables verbose logging.
19
+ */
20
+ debug?: boolean;
21
+ };
22
+ export declare function scaffoldBrownfieldInRncCliProject(options?: BrownfieldScaffoldOptions): Promise<void>;
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/scaffold/index.ts"],"names":[],"mappings":"AA8CA,MAAM,MAAM,yBAAyB,GAAG;IACtC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAoGF,wBAAsB,iCAAiC,CACrD,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,IAAI,CAAC,CA+Nf"}
@@ -0,0 +1,63 @@
1
+ export declare const BROWNFIELD_RUNTIME_PACKAGE_NAME = "@callstack/react-native-brownfield";
2
+ export declare const BROWNFIELD_CLI_PACKAGE_NAME = "@callstack/brownfield-cli";
3
+ /**
4
+ * Match the docs convention (getting-started/quick-start + expo.mdx): both
5
+ * packages are regular dependencies. The brownfield CLI ships as a dependency
6
+ * of the runtime package, so a consistent caret range pinned to this package's
7
+ * own published version keeps the two in lockstep (they are released together).
8
+ */
9
+ export declare function resolveBrownfieldPackageVersionRange(): string;
10
+ /**
11
+ * Adds @callstack/react-native-brownfield (the Kotlin/Swift host code the
12
+ * scaffolded module imports) and @callstack/brownfield-cli (the `brownfield`
13
+ * bin used by the package:* scripts) to the app's dependencies.
14
+ * Existing declarations are never overwritten. Returns the names added.
15
+ */
16
+ export declare function addBrownfieldDependencies(projectRoot: string): string[];
17
+ /**
18
+ * Adds the `package:ios` / `package:android` scripts from the docs' manual
19
+ * steps (settings come from the generated brownfield.config.json, so no flags
20
+ * are duplicated here). Existing scripts with the same names are kept.
21
+ */
22
+ export declare function addBrownfieldPackageScripts(projectRoot: string): string[];
23
+ export type BrownfieldFileConfig = {
24
+ $schema: string;
25
+ ios: {
26
+ scheme: string;
27
+ configuration: string;
28
+ };
29
+ android: {
30
+ moduleName: string;
31
+ variant: string;
32
+ };
33
+ };
34
+ /**
35
+ * Builds the brownfield.config.json content for the scaffolded targets,
36
+ * matching the manual steps in docs getting-started/ios.mdx (step 5) and
37
+ * android.mdx (step 7) and the CLI config schema (packages/cli/src/types.ts,
38
+ * strict additionalProperties: false).
39
+ *
40
+ * Idempotency strategy: the content is derived deterministically from the
41
+ * scaffolded project state (framework/module names), so re-running the
42
+ * scaffold overwrites with byte-identical content. Users customizing it are
43
+ * taking over responsibility; a re-scaffold with the same names is a no-op.
44
+ */
45
+ export declare function createBrownfieldFileConfig({ iosFrameworkName, androidModuleName, }: {
46
+ iosFrameworkName: string;
47
+ androidModuleName: string;
48
+ }): BrownfieldFileConfig;
49
+ /**
50
+ * Writes brownfield.config.json at the project root. Deterministic output:
51
+ * same inputs -> same bytes, so re-running the scaffold never duplicates or
52
+ * drifts the file.
53
+ *
54
+ * Skips writing (returns null) when another Brownfield config source already
55
+ * exists: packages/cli loadBrownfieldConfig fails hard on multiple config
56
+ * files, so an existing brownfield.config.js or a legacy `brownfield` key in
57
+ * package.json takes precedence over generating a JSON one.
58
+ */
59
+ export declare function writeBrownfieldFileConfig(projectRoot: string, names: {
60
+ iosFrameworkName: string;
61
+ androidModuleName: string;
62
+ }): string | null;
63
+ //# sourceMappingURL=projectFiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projectFiles.d.ts","sourceRoot":"","sources":["../../../../../src/scaffold/projectFiles.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,+BAA+B,uCACN,CAAC;AACvC,eAAO,MAAM,2BAA2B,8BAA8B,CAAC;AAEvE;;;;;GAKG;AACH,wBAAgB,oCAAoC,IAAI,MAAM,CAE7D;AA4ED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAmBvE;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAsBzE;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE;QACH,MAAM,EAAE,MAAM,CAAC;QACf,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,OAAO,EAAE;QACP,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,gBAAgB,EAChB,iBAAiB,GAClB,EAAE;IACD,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,GAAG,oBAAoB,CAcvB;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,iBAAiB,EAAE,MAAM,CAAA;CAAE,GAC7D,MAAM,GAAG,IAAI,CAmCf"}
@@ -8,15 +8,23 @@ import { type AndroidManifestMetaDataEntry, type AndroidStringResourceEntry } fr
8
8
  export declare const EXPO_SDK_OMIT_TARGET_SDK_FROM_MAJOR = 58;
9
9
  export declare function resolveCompileSdkVersionExpression(config: ResolvedBrownfieldPluginConfigWithAndroid): string;
10
10
  export declare function resolveTargetSdkVersionExpression(config: ResolvedBrownfieldPluginConfigWithAndroid): string;
11
- export declare function renderTargetSdkBlock(config: ResolvedBrownfieldPluginConfigWithAndroid, expoMajor?: number): string;
11
+ export declare function renderTargetSdkBlock(config: ResolvedBrownfieldPluginConfigWithAndroid, expoMajor?: number, templateVariant?: 'expo' | 'vanilla'): string;
12
12
  /**
13
13
  * Creates the Android library module directory structure and files
14
14
  */
15
- export declare function createAndroidModule({ androidDir, config, rnVersion, projectRoot, expoMajor, }: {
15
+ export declare function createAndroidModule({ androidDir, config, rnVersion, projectRoot, expoMajor, templateVariant, }: {
16
16
  /**
17
17
  * Expo app root (used to detect optional dependencies such as expo-updates)
18
18
  */
19
19
  projectRoot?: string;
20
+ /**
21
+ * Source template flavor. 'vanilla' is used by the RN CLI scaffold for
22
+ * non-Expo projects; Expo keeps the default 'expo' variant.
23
+ * Note: expresses the same Expo-vs-vanilla axis as `useExpoHost` in the
24
+ * iOS helpers (withIosFrameworkFiles/xcodeHelpers), with opposite
25
+ * polarity: 'vanilla' here === `useExpoHost: false` there.
26
+ */
27
+ templateVariant?: 'expo' | 'vanilla';
20
28
  /**
21
29
  * The root Android directory path
22
30
  */
@@ -1 +1 @@
1
- {"version":3,"file":"withAndroidModuleFiles.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/android/withAndroidModuleFiles.ts"],"names":[],"mappings":"AAGA,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAE3E,OAAO,KAAK,EAEV,yCAAyC,EAC1C,MAAM,UAAU,CAAC;AAIlB,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,EAGhC,MAAM,yBAAyB,CAAC;AAQjC;;;GAGG;AACH,eAAO,MAAM,mCAAmC,KAAK,CAAC;AAatD,wBAAgB,kCAAkC,CAChD,MAAM,EAAE,yCAAyC,GAChD,MAAM,CAMR;AAED,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,yCAAyC,GAChD,MAAM,CAMR;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,yCAAyC,EACjD,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CASR;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,UAAU,EACV,MAAM,EACN,SAAS,EACT,WAAW,EACX,SAAS,GACV,EAAE;IACD;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,MAAM,EAAE,yCAAyC,CAAC;CACnD,GAAG,IAAI,CA0FP;AAED,wBAAgB,yBAAyB,CAAC,EACxC,UAAU,EACV,MAAM,EACN,mBAAmB,GACpB,EAAE;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,yCAAyC,CAAC;IAClD,mBAAmB,EAAE,4BAA4B,EAAE,CAAC;CACrD,GAAG,IAAI,CASP;AAED,wBAAgB,gCAAgC,CAAC,EAC/C,UAAU,EACV,MAAM,EACN,0BAA0B,GAC3B,EAAE;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,yCAAyC,CAAC;IAClD,0BAA0B,EAAE,0BAA0B,EAAE,CAAC;CAC1D,GAAG,IAAI,CAUP;AAkBD,wBAAgB,wCAAwC,CAAC,EACvD,UAAU,EACV,MAAM,GACP,EAAE;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,yCAAyC,CAAC;CACnD,GAAG,IAAI,CAsBP;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,YAAY,CAC/C,yCAAyC,CAsC1C,CAAC"}
1
+ {"version":3,"file":"withAndroidModuleFiles.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/android/withAndroidModuleFiles.ts"],"names":[],"mappings":"AAGA,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAE3E,OAAO,KAAK,EAEV,yCAAyC,EAC1C,MAAM,UAAU,CAAC;AAIlB,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,EAGhC,MAAM,yBAAyB,CAAC;AAQjC;;;GAGG;AAC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,CAAC;IACnB,MAAM,EAAE,yCAAyC,CAAC;CACnD,GAAG,IAAI,CAsBP;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,YAAY,CAC/C,yCAAyC,CAsC1C,CAAC"}
@@ -2,8 +2,10 @@
2
2
  * Modifies the Podfile to include the Brownfield framework target
3
3
  * @param podfile The original Podfile content
4
4
  * @param frameworkName The name of the framework target to add
5
- * @param expoMajor The major version of the Expo SDK
5
+ * @param expoMajor The major version of the Expo SDK. Omit for vanilla
6
+ * (non-Expo) projects: the vanilla target block is inserted and no
7
+ * Expo-only hooks are applied.
6
8
  * @returns The modified Podfile content
7
9
  */
8
- export declare function modifyPodfile(podfile: string, frameworkName: string, expoMajor: number): string;
10
+ export declare function modifyPodfile(podfile: string, frameworkName: string, expoMajor?: number): string;
9
11
  //# sourceMappingURL=podfileHelpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"podfileHelpers.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/ios/podfileHelpers.ts"],"names":[],"mappings":"AAoDA;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,GAChB,MAAM,CAqDR"}
1
+ {"version":3,"file":"podfileHelpers.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/ios/podfileHelpers.ts"],"names":[],"mappings":"AAoDA;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAqER"}
@@ -1 +1 @@
1
- {"version":3,"file":"withBrownfieldIos.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/ios/withBrownfieldIos.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAY9B,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,UAAU,CAAC;AAItE;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,EAAE,YAAY,CAC1C,qCAAqC,CAoEtC,CAAC"}
1
+ {"version":3,"file":"withBrownfieldIos.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/ios/withBrownfieldIos.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAY9B,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,UAAU,CAAC;AAItE;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,EAAE,YAAY,CAC1C,qCAAqC,CAuEtC,CAAC"}
@@ -5,13 +5,22 @@ import type { RenderedTemplateFile, ResolvedBrownfieldPluginConfigWithIos } from
5
5
  * @param ios The iOS Brownfield plugin configuration
6
6
  * @returns The list of framework source files
7
7
  */
8
- export declare function getFrameworkSourceFiles(ios: ResolvedBrownfieldPluginConfigWithIos['ios']): RenderedTemplateFile[];
8
+ export declare function getFrameworkSourceFiles(ios: ResolvedBrownfieldPluginConfigWithIos['ios'], options?: {
9
+ /**
10
+ * Whether the packaged framework is expected to use the Expo host.
11
+ * This influences template selection for the generated framework sources.
12
+ * Note: expresses the same Expo-vs-vanilla axis as `templateVariant` in
13
+ * the Android helper (withAndroidModuleFiles.createAndroidModule), with
14
+ * opposite polarity: `false` here === 'vanilla' there.
15
+ */
16
+ useExpoHost?: boolean;
17
+ }): RenderedTemplateFile[];
9
18
  /**
10
19
  * Creates the iOS framework directory structure and files
11
20
  * @param iosDir The root iOS directory path
12
21
  * @param config The resolved Brownfield plugin configuration
13
22
  */
14
- export declare function createIosFramework(iosDir: string, config: ResolvedBrownfieldPluginConfigWithIos): void;
23
+ export declare function createIosFramework(iosDir: string, config: ResolvedBrownfieldPluginConfigWithIos, options?: Parameters<typeof getFrameworkSourceFiles>[1]): void;
15
24
  /**
16
25
  * Dangerous mod that creates the iOS framework directory and files
17
26
  */
@@ -1 +1 @@
1
- {"version":3,"file":"withIosFrameworkFiles.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/ios/withIosFrameworkFiles.ts"],"names":[],"mappings":"AAGA,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAE3E,OAAO,KAAK,EACV,oBAAoB,EACpB,qCAAqC,EACtC,MAAM,UAAU,CAAC;AAIlB;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,qCAAqC,CAAC,KAAK,CAAC,GAChD,oBAAoB,EAAE,CAexB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,qCAAqC,QA6B9C;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,YAAY,CAC9C,qCAAqC,CAYtC,CAAC"}
1
+ {"version":3,"file":"withIosFrameworkFiles.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/ios/withIosFrameworkFiles.ts"],"names":[],"mappings":"AAGA,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAE3E,OAAO,KAAK,EACV,oBAAoB,EACpB,qCAAqC,EACtC,MAAM,UAAU,CAAC;AAIlB;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,qCAAqC,CAAC,KAAK,CAAC,EACjD,OAAO,CAAC,EAAE;IACR;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GACA,oBAAoB,EAAE,CAmBxB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,qCAAqC,EAC7C,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC,CAAC,CAAC,QA6BxD;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,YAAY,CAC9C,qCAAqC,CAYtC,CAAC"}
@@ -6,11 +6,15 @@ import type { ResolvedBrownfieldPluginIosConfig } from '../types';
6
6
  * @param project The Xcode project to modify
7
7
  * @param options Framework target options
8
8
  */
9
- export declare function addFrameworkTarget(project: XcodeProject, modRequest: ModProps<XcodeProject>, options: ResolvedBrownfieldPluginIosConfig): {
9
+ export declare function addFrameworkTarget(project: XcodeProject, modRequest: ModProps<XcodeProject>, options: ResolvedBrownfieldPluginIosConfig, brownfieldOptions?: {
10
+ useExpoHost?: boolean;
11
+ }): {
10
12
  frameworkTargetUUID: string;
11
13
  targetAlreadyExists: boolean;
12
14
  };
13
- export declare function addSourceFilesBuildPhase(project: XcodeProject, frameworkTargetUUID: string, options: ResolvedBrownfieldPluginIosConfig): void;
15
+ export declare function addSourceFilesBuildPhase(project: XcodeProject, frameworkTargetUUID: string, options: ResolvedBrownfieldPluginIosConfig, brownfieldOptions?: {
16
+ useExpoHost?: boolean;
17
+ }): void;
14
18
  export type PbxReferenceLike = {
15
19
  value?: string;
16
20
  comment?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"xcodeHelpers.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/ios/xcodeHelpers.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,YAAY,EAElB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,UAAU,CAAC;AAIlE;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,QAAQ,CAAC,YAAY,CAAC,EAClC,OAAO,EAAE,iCAAiC,GACzC;IACD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,mBAAmB,EAAE,OAAO,CAAC;CAC9B,CAoIA;AAED,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,YAAY,EACrB,mBAAmB,EAAE,MAAM,EAC3B,OAAO,EAAE,iCAAiC,QAkB3C;AAED,MAAM,MAAM,gBAAgB,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,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AAE,mBAAmB,GACnC,EAAE,iCAAiC,GACnC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC,CA8B3C;AAED,wBAAgB,qDAAqD,CACnE,WAAW,EAAE,MAAM,GAClB,MAAM,CAoCR;AAgCD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,MAAM,GACjB,IAAI,CA+FN;AAuED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,kBAAkB,CAAC,EAC/C,aAAa,EAAE,MAAM,GAAG,IAAI,GAC3B,MAAM,GAAG,IAAI,CAqBf;AAED,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,QAAQ,CAAC,YAAY,CAAC,EAClC,EACE,wBAAwB,GACzB,EAAE;IACD,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC,GACA,MAAM,CAYR"}
1
+ {"version":3,"file":"xcodeHelpers.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/ios/xcodeHelpers.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,YAAY,EAElB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,UAAU,CAAC;AAyClE;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,QAAQ,CAAC,YAAY,CAAC,EAClC,OAAO,EAAE,iCAAiC,EAC1C,iBAAiB,CAAC,EAAE;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GACA;IACD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,mBAAmB,EAAE,OAAO,CAAC;CAC9B,CAsIA;AAED,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,YAAY,EACrB,mBAAmB,EAAE,MAAM,EAC3B,OAAO,EAAE,iCAA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ACd,EAAE;IACD,sDAAsD;IACtD,aAAa,EAAE,OAAO,GAAG,SAAS,CAAC;CACpC,EACD,EACE,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,aAAa,EAAE,mBAAmB,GACnC,EAAE,iCAAiC,GACnC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC,CA8B3C;AAED,wBAAgB,qDAAqD,CACnE,WAAW,EAAE,MAAM,GAClB,MAAM,CAoCR;AAgCD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,MAAM,GACjB,IAAI,CAsGN;AAuED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,kBAAkB,CAAC,EAC/C,aAAa,EAAE,MAAM,GAAG,IAAI,GAC3B,MAAM,GAAG,IAAI,CAqBf;AAED,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,QAAQ,CAAC,YAAY,CAAC,EAClC,EACE,wBAAwB,GACzB,EAAE;IACD,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC,GACA,MAAM,CAYR"}
@@ -3,6 +3,13 @@ export interface MessageEvent {
3
3
  data: unknown;
4
4
  }
5
5
  declare const ReactNativeBrownfield: {
6
+ /**
7
+ * Finish this presentation's full-display measurement after data and UI are ready.
8
+ * Pass the `brownfieldPresentationID` injected into the root component's props.
9
+ * Native must opt in with `waitForFullDisplay: true`. Repeated/stale IDs are ignored.
10
+ * @platform android, ios
11
+ */
12
+ markFullyDisplayed: (presentationID: string) => void;
6
13
  /**
7
14
  * Pop to the native screen.
8
15
  * @param animated - Whether to animate the transition (iOS only).
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAIA,YAAY,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,CAAC;CACf;AAED,QAAA,MAAM,qBAAqB;IACzB;;;;;;OAMG;6BACsB,OAAO,KAAG,IAAI;IAUvC;;;;;;;OAOG;oDAC6C,OAAO,KAAG,IAAI;IAU9D;;;;;;;;;OASG;wBACiB,OAAO,KAAG,IAAI;IAKlC;;;;;;;;;;;;OAYG;0BAES,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,KACtC;QAAE,MAAM,EAAE,MAAM,IAAI,CAAA;KAAE;CAY1B,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAWA,YAAY,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,CAAC;CACf;AAED,QAAA,MAAM,qBAAqB;IACzB;;;;;OAKG;yCACkC,MAAM,KAAG,IAAI;IAMlD;;;;;;OAMG;6BACsB,OAAO,KAAG,IAAI;IAUvC;;;;;;;OAOG;oDAC6C,OAAO,KAAG,IAAI;IAU9D;;;;;;;;;OASG;wBACiB,OAAO,KAAG,IAAI;IAKlC;;;;;;;;;;;;OAYG;0BAES,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,KACtC;QAAE,MAAM,EAAE,MAAM,IAAI,CAAA;KAAE;CAY1B,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
@@ -0,0 +1,23 @@
1
+ export type BrownfieldScaffoldOptions = {
2
+ /**
3
+ * React Native project root directory (contains package.json).
4
+ * Defaults to current working directory.
5
+ */
6
+ projectRoot?: string;
7
+ /**
8
+ * iOS framework target name (also framework directory name).
9
+ * Defaults to "BrownfieldLib".
10
+ */
11
+ iosFrameworkName?: string;
12
+ /**
13
+ * Android library module folder / Gradle module name.
14
+ * Defaults to "brownfieldlib".
15
+ */
16
+ androidModuleName?: string;
17
+ /**
18
+ * Enables verbose logging.
19
+ */
20
+ debug?: boolean;
21
+ };
22
+ export declare function scaffoldBrownfieldInRncCliProject(options?: BrownfieldScaffoldOptions): Promise<void>;
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/scaffold/index.ts"],"names":[],"mappings":"AA8CA,MAAM,MAAM,yBAAyB,GAAG;IACtC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAoGF,wBAAsB,iCAAiC,CACrD,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,IAAI,CAAC,CA+Nf"}
@@ -0,0 +1,63 @@
1
+ export declare const BROWNFIELD_RUNTIME_PACKAGE_NAME = "@callstack/react-native-brownfield";
2
+ export declare const BROWNFIELD_CLI_PACKAGE_NAME = "@callstack/brownfield-cli";
3
+ /**
4
+ * Match the docs convention (getting-started/quick-start + expo.mdx): both
5
+ * packages are regular dependencies. The brownfield CLI ships as a dependency
6
+ * of the runtime package, so a consistent caret range pinned to this package's
7
+ * own published version keeps the two in lockstep (they are released together).
8
+ */
9
+ export declare function resolveBrownfieldPackageVersionRange(): string;
10
+ /**
11
+ * Adds @callstack/react-native-brownfield (the Kotlin/Swift host code the
12
+ * scaffolded module imports) and @callstack/brownfield-cli (the `brownfield`
13
+ * bin used by the package:* scripts) to the app's dependencies.
14
+ * Existing declarations are never overwritten. Returns the names added.
15
+ */
16
+ export declare function addBrownfieldDependencies(projectRoot: string): string[];
17
+ /**
18
+ * Adds the `package:ios` / `package:android` scripts from the docs' manual
19
+ * steps (settings come from the generated brownfield.config.json, so no flags
20
+ * are duplicated here). Existing scripts with the same names are kept.
21
+ */
22
+ export declare function addBrownfieldPackageScripts(projectRoot: string): string[];
23
+ export type BrownfieldFileConfig = {
24
+ $schema: string;
25
+ ios: {
26
+ scheme: string;
27
+ configuration: string;
28
+ };
29
+ android: {
30
+ moduleName: string;
31
+ variant: string;
32
+ };
33
+ };
34
+ /**
35
+ * Builds the brownfield.config.json content for the scaffolded targets,
36
+ * matching the manual steps in docs getting-started/ios.mdx (step 5) and
37
+ * android.mdx (step 7) and the CLI config schema (packages/cli/src/types.ts,
38
+ * strict additionalProperties: false).
39
+ *
40
+ * Idempotency strategy: the content is derived deterministically from the
41
+ * scaffolded project state (framework/module names), so re-running the
42
+ * scaffold overwrites with byte-identical content. Users customizing it are
43
+ * taking over responsibility; a re-scaffold with the same names is a no-op.
44
+ */
45
+ export declare function createBrownfieldFileConfig({ iosFrameworkName, androidModuleName, }: {
46
+ iosFrameworkName: string;
47
+ androidModuleName: string;
48
+ }): BrownfieldFileConfig;
49
+ /**
50
+ * Writes brownfield.config.json at the project root. Deterministic output:
51
+ * same inputs -> same bytes, so re-running the scaffold never duplicates or
52
+ * drifts the file.
53
+ *
54
+ * Skips writing (returns null) when another Brownfield config source already
55
+ * exists: packages/cli loadBrownfieldConfig fails hard on multiple config
56
+ * files, so an existing brownfield.config.js or a legacy `brownfield` key in
57
+ * package.json takes precedence over generating a JSON one.
58
+ */
59
+ export declare function writeBrownfieldFileConfig(projectRoot: string, names: {
60
+ iosFrameworkName: string;
61
+ androidModuleName: string;
62
+ }): string | null;
63
+ //# sourceMappingURL=projectFiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projectFiles.d.ts","sourceRoot":"","sources":["../../../../../src/scaffold/projectFiles.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,+BAA+B,uCACN,CAAC;AACvC,eAAO,MAAM,2BAA2B,8BAA8B,CAAC;AAEvE;;;;;GAKG;AACH,wBAAgB,oCAAoC,IAAI,MAAM,CAE7D;AA4ED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAmBvE;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAsBzE;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE;QACH,MAAM,EAAE,MAAM,CAAC;QACf,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,OAAO,EAAE;QACP,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,gBAAgB,EAChB,iBAAiB,GAClB,EAAE;IACD,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,GAAG,oBAAoB,CAcvB;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,iBAAiB,EAAE,MAAM,CAAA;CAAE,GAC7D,MAAM,GAAG,IAAI,CAmCf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@callstack/react-native-brownfield",
3
- "version": "5.2.0",
3
+ "version": "6.0.0",
4
4
  "license": "MIT",
5
5
  "author": "Michal Chudziak <mike.chudziak@callstack.com>",
6
6
  "bin": {
@@ -41,6 +41,17 @@
41
41
  "default": "./lib/commonjs/expo-config-plugin/app.plugin.js"
42
42
  }
43
43
  },
44
+ "./scaffold": {
45
+ "source": "./src/scaffold/index.ts",
46
+ "import": {
47
+ "types": "./lib/typescript/module/src/scaffold/index.d.ts",
48
+ "default": "./lib/module/scaffold/index.js"
49
+ },
50
+ "require": {
51
+ "types": "./lib/typescript/commonjs/src/scaffold/index.d.ts",
52
+ "default": "./lib/commonjs/scaffold/index.js"
53
+ }
54
+ },
44
55
  "./package.json": "./package.json"
45
56
  },
46
57
  "scripts": {
@@ -89,7 +100,10 @@
89
100
  "@expo/config-plugins": ">=54 <100"
90
101
  },
91
102
  "dependencies": {
92
- "@callstack/brownfield-cli": "^5.2.0"
103
+ "@callstack/brownfield-cli": "^6.0.0",
104
+ "@react-native-community/cli-config": "^20.0.0",
105
+ "@react-native-community/cli-types": "^20.0.0",
106
+ "xcode": "^3.0.1"
93
107
  },
94
108
  "devDependencies": {
95
109
  "@babel/core": "^7.29.6",
@@ -62,8 +62,15 @@ export function resolveTargetSdkVersionExpression(
62
62
 
63
63
  export function renderTargetSdkBlock(
64
64
  config: ResolvedBrownfieldPluginConfigWithAndroid,
65
- expoMajor?: number
65
+ expoMajor?: number,
66
+ templateVariant: 'expo' | 'vanilla' = 'expo'
66
67
  ): string {
68
+ // RN CLI (vanilla) projects target AGP 9, where library modules must not
69
+ // set `targetSdk` (compilation fails with "Unresolved reference 'targetSdk'").
70
+ if (templateVariant === 'vanilla') {
71
+ return '';
72
+ }
73
+
67
74
  if (
68
75
  expoMajor !== undefined &&
69
76
  expoMajor >= EXPO_SDK_OMIT_TARGET_SDK_FROM_MAJOR
@@ -83,11 +90,22 @@ export function createAndroidModule({
83
90
  rnVersion,
84
91
  projectRoot,
85
92
  expoMajor,
93
+ templateVariant = 'expo',
86
94
  }: {
87
95
  /**
88
96
  * Expo app root (used to detect optional dependencies such as expo-updates)
89
97
  */
90
98
  projectRoot?: string;
99
+
100
+ /**
101
+ * Source template flavor. 'vanilla' is used by the RN CLI scaffold for
102
+ * non-Expo projects; Expo keeps the default 'expo' variant.
103
+ * Note: expresses the same Expo-vs-vanilla axis as `useExpoHost` in the
104
+ * iOS helpers (withIosFrameworkFiles/xcodeHelpers), with opposite
105
+ * polarity: 'vanilla' here === `useExpoHost: false` there.
106
+ */
107
+ templateVariant?: 'expo' | 'vanilla';
108
+
91
109
  /**
92
110
  * The root Android directory path
93
111
  */
@@ -116,7 +134,11 @@ export function createAndroidModule({
116
134
  const hermesArtifact = getHermesArtifact(rnVersion, projectRoot);
117
135
  const compileSdkVersionExpression =
118
136
  resolveCompileSdkVersionExpression(config);
119
- const targetSdkBlock = renderTargetSdkBlock(config, expoMajor);
137
+ const targetSdkBlock = renderTargetSdkBlock(
138
+ config,
139
+ expoMajor,
140
+ templateVariant
141
+ );
120
142
  const minifyEnabled =
121
143
  (android as { minifyEnabled?: boolean }).minifyEnabled ?? false;
122
144
  const extraProguardRules =
@@ -157,9 +179,15 @@ export function createAndroidModule({
157
179
  },
158
180
  {
159
181
  relativePath: `src/main/java/${config.android.packageName.replace(/\./g, '/')}/ReactNativeHostManager.kt`,
160
- content: renderTemplate('android', 'ReactNativeHostManager.post55.kt', {
161
- '{{PACKAGE_NAME}}': android.packageName,
162
- }),
182
+ content: renderTemplate(
183
+ 'android',
184
+ templateVariant === 'vanilla'
185
+ ? 'ReactNativeHostManager.vanilla.kt'
186
+ : 'ReactNativeHostManager.post55.kt',
187
+ {
188
+ '{{PACKAGE_NAME}}': android.packageName,
189
+ }
190
+ ),
163
191
  },
164
192
  {
165
193
  relativePath: 'consumer-rules.pro',
@@ -54,13 +54,15 @@ function ensureExpoDefinesForSDK55AndAbove(
54
54
  * Modifies the Podfile to include the Brownfield framework target
55
55
  * @param podfile The original Podfile content
56
56
  * @param frameworkName The name of the framework target to add
57
- * @param expoMajor The major version of the Expo SDK
57
+ * @param expoMajor The major version of the Expo SDK. Omit for vanilla
58
+ * (non-Expo) projects: the vanilla target block is inserted and no
59
+ * Expo-only hooks are applied.
58
60
  * @returns The modified Podfile content
59
61
  */
60
62
  export function modifyPodfile(
61
63
  podfile: string,
62
64
  frameworkName: string,
63
- expoMajor: number
65
+ expoMajor?: number
64
66
  ): string {
65
67
  // check if the framework target is already included
66
68
  if (podfile.includes(`target '${frameworkName}'`)) {
@@ -73,9 +75,18 @@ export function modifyPodfile(
73
75
  Logger.logDebug(`Modifying Podfile for framework: ${frameworkName}`);
74
76
 
75
77
  // insert the framework target after the main target's "do"
76
- const frameworkTargetBlock = renderTemplate('ios', 'PodfileTargetBlock.rb', {
77
- '{{FRAMEWORK_NAME}}': frameworkName,
78
- });
78
+ // Vanilla means the caller passed no Expo SDK version at all (undefined).
79
+ // Negative values mean "Expo detected but unknown version" and must still
80
+ // hit the unsupported-version error path below, not the vanilla path.
81
+ const frameworkTargetBlock = renderTemplate(
82
+ 'ios',
83
+ typeof expoMajor === 'number'
84
+ ? 'PodfileTargetBlock.rb'
85
+ : 'PodfileTargetBlock.vanilla.rb',
86
+ {
87
+ '{{FRAMEWORK_NAME}}': frameworkName,
88
+ }
89
+ );
79
90
 
80
91
  // find insertion point after the first target's content begins, before the end of the target block
81
92
  const mainTargetMatch = podfile.match(
@@ -101,8 +112,15 @@ export function modifyPodfile(
101
112
 
102
113
  Logger.logDebug(`Added framework target "${frameworkName}" to Podfile`);
103
114
 
115
+ // Vanilla projects (expoMajor === undefined) get no Expo-only hooks.
116
+ // Early-returning here lets TypeScript narrow `expoMajor` to `number`
117
+ // for the rest of the function (no casts needed below).
118
+ if (typeof expoMajor !== 'number') {
119
+ return modifiedPodfile;
120
+ }
121
+
104
122
  if (expoMajor < MIN_SUPPORTED_EXPO_SDK_MAJOR_VERSION) {
105
- const versionLabel = expoMajor < 0 ? 'unknown' : expoMajor.toString();
123
+ const versionLabel = expoMajor < 0 ? 'unknown' : String(expoMajor);
106
124
  throw new SourceModificationError(
107
125
  `Expo SDK ${versionLabel} is not supported. Please use Expo SDK ${MIN_SUPPORTED_EXPO_SDK_MAJOR_VERSION} or newer. For older versions, please see the matrix of supported versions: https://oss.callstack.com/react-native-brownfield/docs/getting-started/introduction#expo-version-compatibility`
108
126
  );
@@ -47,7 +47,8 @@ export const withBrownfieldIos: ConfigPlugin<
47
47
  const { frameworkTargetUUID, targetAlreadyExists } = addFrameworkTarget(
48
48
  project,
49
49
  modRequest,
50
- iosProps
50
+ iosProps,
51
+ { useExpoHost: true }
51
52
  );
52
53
 
53
54
  // Ensure Expo.plist is present in the framework resources phase when
@@ -73,7 +74,9 @@ export const withBrownfieldIos: ConfigPlugin<
73
74
  // copy the "Bundle React Native code and images" build phase from the main target to the framework target
74
75
  copyBundleReactNativePhase(project, frameworkTargetUUID);
75
76
 
76
- addSourceFilesBuildPhase(project, frameworkTargetUUID, iosProps);
77
+ addSourceFilesBuildPhase(project, frameworkTargetUUID, iosProps, {
78
+ useExpoHost: true,
79
+ });
77
80
 
78
81
  return xcodeConfig;
79
82
  });
@@ -16,14 +16,28 @@ import { renderTemplate } from '../template/engine';
16
16
  * @returns The list of framework source files
17
17
  */
18
18
  export function getFrameworkSourceFiles(
19
- ios: ResolvedBrownfieldPluginConfigWithIos['ios']
19
+ ios: ResolvedBrownfieldPluginConfigWithIos['ios'],
20
+ options?: {
21
+ /**
22
+ * Whether the packaged framework is expected to use the Expo host.
23
+ * This influences template selection for the generated framework sources.
24
+ * Note: expresses the same Expo-vs-vanilla axis as `templateVariant` in
25
+ * the Android helper (withAndroidModuleFiles.createAndroidModule), with
26
+ * opposite polarity: `false` here === 'vanilla' there.
27
+ */
28
+ useExpoHost?: boolean;
29
+ }
20
30
  ): RenderedTemplateFile[] {
31
+ const useExpoHost = options?.useExpoHost ?? true;
32
+
21
33
  return [
22
34
  {
23
35
  relativePath: `${ios.frameworkName}.swift`,
24
- content: renderTemplate('ios', 'FrameworkInterface.swift', {
25
- '{{BUNDLE_IDENTIFIER}}': ios.bundleIdentifier,
26
- }),
36
+ content: useExpoHost
37
+ ? renderTemplate('ios', 'FrameworkInterface.swift', {
38
+ '{{BUNDLE_IDENTIFIER}}': ios.bundleIdentifier,
39
+ })
40
+ : renderTemplate('ios', 'FrameworkInterface.vanilla.swift', {}),
27
41
  },
28
42
  {
29
43
  relativePath: 'Info.plist',
@@ -41,7 +55,8 @@ export function getFrameworkSourceFiles(
41
55
  */
42
56
  export function createIosFramework(
43
57
  iosDir: string,
44
- config: ResolvedBrownfieldPluginConfigWithIos
58
+ config: ResolvedBrownfieldPluginConfigWithIos,
59
+ options?: Parameters<typeof getFrameworkSourceFiles>[1]
45
60
  ) {
46
61
  const { ios } = config;
47
62
  const frameworkDir = path.join(iosDir, ios.frameworkName);
@@ -61,7 +76,7 @@ export function createIosFramework(
61
76
  }
62
77
 
63
78
  // write files
64
- for (const file of getFrameworkSourceFiles(ios)) {
79
+ for (const file of getFrameworkSourceFiles(ios, options)) {
65
80
  const filePath = path.join(frameworkDir, file.relativePath);
66
81
 
67
82
  fs.writeFileSync(filePath, file.content, 'utf8');