expo-build-properties 0.4.1 → 0.5.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.
package/CHANGELOG.md CHANGED
@@ -10,7 +10,13 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
- ## 0.4.12022-11-24
13
+ ## 0.5.02023-02-03
14
+
15
+ ### 🎉 New features
16
+
17
+ - Add support for enabling [React Native new architecture mode](https://reactnative.dev/docs/new-architecture-intro). ([#20861](https://github.com/expo/expo/pull/20861) by [@gabrieldonadel](https://github.com/gabrieldonadel))
18
+
19
+ ## 0.4.1 - 2022-11-24
14
20
 
15
21
  ### 🐛 Bug fixes
16
22
 
package/README.md CHANGED
@@ -43,7 +43,7 @@ Add plugin to `app.json`. For example:
43
43
 
44
44
  Contributions are very welcome! Please refer to guidelines described in the [contributing guide][contributing].
45
45
 
46
- [docs-main]: https://github.com/expo/expo/blob/main/docs/pages/versions/unversioned/sdk/build-properties.md
46
+ [docs-main]: https://github.com/expo/expo/blob/main/docs/pages/versions/unversioned/sdk/build-properties.mdx
47
47
  [docs-stable]: https://docs.expo.dev/versions/latest/sdk/build-properties/
48
48
  [contributing]: https://github.com/expo/expo#contributing
49
49
  [config-plugins]: https://docs.expo.dev/guides/config-plugins/
package/build/android.js CHANGED
@@ -10,6 +10,10 @@ const path_1 = __importDefault(require("path"));
10
10
  const fileContentsUtils_1 = require("./fileContentsUtils");
11
11
  const { createBuildGradlePropsConfigPlugin } = config_plugins_1.AndroidConfig.BuildProperties;
12
12
  exports.withAndroidBuildProperties = createBuildGradlePropsConfigPlugin([
13
+ {
14
+ propName: 'newArchEnabled',
15
+ propValueGetter: (config) => config.android?.newArchEnabled?.toString(),
16
+ },
13
17
  {
14
18
  propName: 'android.minSdkVersion',
15
19
  propValueGetter: (config) => config.android?.minSdkVersion?.toString(),
package/build/ios.js CHANGED
@@ -4,6 +4,10 @@ exports.withIosDeploymentTarget = exports.withIosBuildProperties = void 0;
4
4
  const config_plugins_1 = require("expo/config-plugins");
5
5
  const { createBuildPodfilePropsConfigPlugin } = config_plugins_1.IOSConfig.BuildProperties;
6
6
  exports.withIosBuildProperties = createBuildPodfilePropsConfigPlugin([
7
+ {
8
+ propName: 'newArchEnabled',
9
+ propValueGetter: (config) => config.ios?.newArchEnabled?.toString(),
10
+ },
7
11
  {
8
12
  propName: 'ios.useFrameworks',
9
13
  propValueGetter: (config) => config.ios?.useFrameworks,
@@ -1,55 +1,101 @@
1
1
  /**
2
- * Configuration for `expo-build-properties`
2
+ * Interface representing base build properties configuration.
3
3
  */
4
4
  export interface PluginConfigType {
5
+ /**
6
+ * Interface representing available configuration for Android native build properties.
7
+ * @platform android
8
+ */
5
9
  android?: PluginConfigTypeAndroid;
10
+ /**
11
+ * Interface representing available configuration for iOS native build properties.
12
+ * @platform ios
13
+ */
6
14
  ios?: PluginConfigTypeIos;
7
15
  }
8
16
  /**
9
- * Config for Android native build properties
17
+ * Interface representing available configuration for Android native build properties.
18
+ * @platform android
10
19
  */
11
20
  export interface PluginConfigTypeAndroid {
12
- /** Override the default `minSdkVersion` version number in `build.gradle` */
21
+ /**
22
+ * Enable React Native new architecture for Android platform.
23
+ */
24
+ newArchEnabled?: boolean;
25
+ /**
26
+ * Override the default `minSdkVersion` version number in **build.gradle**.
27
+ * */
13
28
  minSdkVersion?: number;
14
- /** Override the default `compileSdkVersion` version number in `build.gradle` */
29
+ /**
30
+ * Override the default `compileSdkVersion` version number in **build.gradle**.
31
+ */
15
32
  compileSdkVersion?: number;
16
- /** Override the default `targetSdkVersion` version number in `build.gradle` */
33
+ /**
34
+ * Override the default `targetSdkVersion` version number in **build.gradle**.
35
+ */
17
36
  targetSdkVersion?: number;
18
- /** Override the default `buildToolsVersion` version number in `build.gradle` */
37
+ /**
38
+ * Override the default `buildToolsVersion` version number in **build.gradle**.
39
+ */
19
40
  buildToolsVersion?: string;
20
- /** Override the default Kotlin version when building the app */
41
+ /**
42
+ * Override the Kotlin version used when building the app.
43
+ */
21
44
  kotlinVersion?: string;
22
- /** Enable Proguard (R8) in release builds to obfuscate Java code and reduce app size */
45
+ /**
46
+ * Enable [Proguard or R8](https://developer.android.com/studio/build/shrink-code) in release builds to obfuscate Java code and reduce app size.
47
+ */
23
48
  enableProguardInReleaseBuilds?: boolean;
24
- /** Append custom [Proguard rules](https://www.guardsquare.com/manual/configuration/usage) to `android/app/proguard-rules.pro` */
49
+ /**
50
+ * Append custom [Proguard rules](https://www.guardsquare.com/manual/configuration/usage) to **android/app/proguard-rules.pro**.
51
+ */
25
52
  extraProguardRules?: string;
26
- /** AGP [PackagingOptions](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/dsl/PackagingOptions) */
53
+ /**
54
+ * Interface representing available configuration for Android Gradle plugin [PackagingOptions](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/dsl/PackagingOptions).
55
+ */
27
56
  packagingOptions?: PluginConfigTypeAndroidPackagingOptions;
28
57
  }
29
58
  /**
30
- * Config for iOS native build properties
59
+ * Interface representing available configuration for iOS native build properties.
60
+ * @platform ios
31
61
  */
32
62
  export interface PluginConfigTypeIos {
33
63
  /**
34
- * Override the default iOS *Deployment Target* version in the following projects:
35
- * - in CocoaPods projects
36
- * - `PBXNativeTarget` with `com.apple.product-type.application` productType in the app project
64
+ * Enable React Native new architecture for iOS platform.
65
+ */
66
+ newArchEnabled?: boolean;
67
+ /**
68
+ * Override the default iOS "Deployment Target" version in the following projects:
69
+ * - in CocoaPods projects,
70
+ * - `PBXNativeTarget` with "com.apple.product-type.application" `productType` in the app project.
37
71
  */
38
72
  deploymentTarget?: string;
39
- /** Enable [`use_frameworks!`](https://guides.cocoapods.org/syntax/podfile.html#use_frameworks_bang) in `Podfile` */
73
+ /**
74
+ * Enable [`use_frameworks!`](https://guides.cocoapods.org/syntax/podfile.html#use_frameworks_bang)
75
+ * in `Podfile` to use frameworks instead of static libraries for Pods.
76
+ */
40
77
  useFrameworks?: 'static' | 'dynamic';
41
78
  }
42
79
  /**
43
- * AGP [PackagingOptions](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/dsl/PackagingOptions)
80
+ * Interface representing available configuration for Android Gradle plugin [PackagingOptions](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/dsl/PackagingOptions).
81
+ * @platform android
44
82
  */
45
83
  export interface PluginConfigTypeAndroidPackagingOptions {
46
- /** Adds a first-pick pattern */
84
+ /**
85
+ * Array of patterns for native libraries where only the first occurrence is packaged in the APK.
86
+ */
47
87
  pickFirst?: string[];
48
- /** Adds an excluded pattern */
88
+ /**
89
+ * Array of patterns for native libraries that should be excluded from being packaged in the APK.
90
+ */
49
91
  exclude?: string[];
50
- /** Adds a merge pattern */
92
+ /**
93
+ * Array of patterns for native libraries where all occurrences are concatenated and packaged in the APK.
94
+ */
51
95
  merge?: string[];
52
- /** Adds a doNotStrip pattern */
96
+ /**
97
+ * Array of patterns for native libraries that should not be stripped of debug symbols.
98
+ */
53
99
  doNotStrip?: string[];
54
100
  }
55
101
  /**
@@ -7,7 +7,7 @@ exports.validateConfig = void 0;
7
7
  const ajv_1 = __importDefault(require("ajv"));
8
8
  const semver_1 = __importDefault(require("semver"));
9
9
  /**
10
- * The minimal supported versions. These values should align to SDK
10
+ * The minimal supported versions. These values should align to SDK.
11
11
  * @ignore
12
12
  */
13
13
  const EXPO_SDK_MINIMAL_SUPPORTED_VERSIONS = {
@@ -27,6 +27,7 @@ const schema = {
27
27
  android: {
28
28
  type: 'object',
29
29
  properties: {
30
+ newArchEnabled: { type: 'boolean', nullable: true },
30
31
  minSdkVersion: { type: 'integer', nullable: true },
31
32
  compileSdkVersion: { type: 'integer', nullable: true },
32
33
  targetSdkVersion: { type: 'integer', nullable: true },
@@ -50,6 +51,7 @@ const schema = {
50
51
  ios: {
51
52
  type: 'object',
52
53
  properties: {
54
+ newArchEnabled: { type: 'boolean', nullable: true },
53
55
  deploymentTarget: { type: 'string', pattern: '\\d+\\.\\d+', nullable: true },
54
56
  useFrameworks: { type: 'string', enum: ['static', 'dynamic'], nullable: true },
55
57
  },
@@ -57,12 +59,12 @@ const schema = {
57
59
  },
58
60
  },
59
61
  };
62
+ // note(Kudo): For the implementation, we check items one by one because Ajv does not well support custom error message.
60
63
  /**
61
- * Check versions to meet expo minimal supported versions.
64
+ * Checks if specified versions meets Expo minimal supported versions.
62
65
  * Will throw error message whenever there are invalid versions.
63
- * For the implementation, we check items one by one because ajv does not well support custom error message.
64
66
  *
65
- * @param config the validated config passed from ajv
67
+ * @param config The validated config passed from Ajv.
66
68
  * @ignore
67
69
  */
68
70
  function maybeThrowInvalidVersions(config) {
@@ -1,10 +1,9 @@
1
- import type { ConfigPlugin } from 'expo/config-plugins';
1
+ import { ConfigPlugin } from 'expo/config-plugins';
2
2
  import { PluginConfigType } from './pluginConfig';
3
3
  /**
4
- * Config plugin to customize native Android or iOS build properties for managed apps
5
- *
6
- * @param config ExpoConfig
7
- * @param props Configuration for the config plugin
4
+ * Config plugin allowing customizing native Android and iOS build properties for managed apps.
5
+ * @param config Expo config for application.
6
+ * @param props Configuration for the build properties plugin.
8
7
  */
9
8
  export declare const withBuildProperties: ConfigPlugin<PluginConfigType>;
10
9
  export default withBuildProperties;
@@ -5,10 +5,9 @@ const android_1 = require("./android");
5
5
  const ios_1 = require("./ios");
6
6
  const pluginConfig_1 = require("./pluginConfig");
7
7
  /**
8
- * Config plugin to customize native Android or iOS build properties for managed apps
9
- *
10
- * @param config ExpoConfig
11
- * @param props Configuration for the config plugin
8
+ * Config plugin allowing customizing native Android and iOS build properties for managed apps.
9
+ * @param config Expo config for application.
10
+ * @param props Configuration for the build properties plugin.
12
11
  */
13
12
  const withBuildProperties = (config, props) => {
14
13
  const pluginConfig = (0, pluginConfig_1.validateConfig)(props || {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-build-properties",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Config plugin to customize native build properties on prebuild",
5
5
  "main": "build/withBuildProperties.js",
6
6
  "types": "build/withBuildProperties.d.ts",
@@ -37,11 +37,8 @@
37
37
  "devDependencies": {
38
38
  "expo-module-scripts": "^3.0.0"
39
39
  },
40
- "jest": {
41
- "preset": "expo-module-scripts"
42
- },
43
40
  "peerDependencies": {
44
41
  "expo": "*"
45
42
  },
46
- "gitHead": "1c5b1b798ecf9801a8004614140441c4d37f3935"
43
+ "gitHead": "1815e2eaad8c753588c7b1eb74420174a28e01f4"
47
44
  }
package/src/android.ts CHANGED
@@ -9,6 +9,10 @@ const { createBuildGradlePropsConfigPlugin } = AndroidConfig.BuildProperties;
9
9
 
10
10
  export const withAndroidBuildProperties = createBuildGradlePropsConfigPlugin<PluginConfigType>(
11
11
  [
12
+ {
13
+ propName: 'newArchEnabled',
14
+ propValueGetter: (config) => config.android?.newArchEnabled?.toString(),
15
+ },
12
16
  {
13
17
  propName: 'android.minSdkVersion',
14
18
  propValueGetter: (config) => config.android?.minSdkVersion?.toString(),
package/src/ios.ts CHANGED
@@ -6,6 +6,10 @@ const { createBuildPodfilePropsConfigPlugin } = IOSConfig.BuildProperties;
6
6
 
7
7
  export const withIosBuildProperties = createBuildPodfilePropsConfigPlugin<PluginConfigType>(
8
8
  [
9
+ {
10
+ propName: 'newArchEnabled',
11
+ propValueGetter: (config) => config.ios?.newArchEnabled?.toString(),
12
+ },
9
13
  {
10
14
  propName: 'ios.useFrameworks',
11
15
  propValueGetter: (config) => config.ios?.useFrameworks,
@@ -2,7 +2,7 @@ import Ajv, { JSONSchemaType } from 'ajv';
2
2
  import semver from 'semver';
3
3
 
4
4
  /**
5
- * The minimal supported versions. These values should align to SDK
5
+ * The minimal supported versions. These values should align to SDK.
6
6
  * @ignore
7
7
  */
8
8
  const EXPO_SDK_MINIMAL_SUPPORTED_VERSIONS = {
@@ -18,71 +18,106 @@ const EXPO_SDK_MINIMAL_SUPPORTED_VERSIONS = {
18
18
  };
19
19
 
20
20
  /**
21
- * Configuration for `expo-build-properties`
21
+ * Interface representing base build properties configuration.
22
22
  */
23
23
  export interface PluginConfigType {
24
+ /**
25
+ * Interface representing available configuration for Android native build properties.
26
+ * @platform android
27
+ */
24
28
  android?: PluginConfigTypeAndroid;
29
+ /**
30
+ * Interface representing available configuration for iOS native build properties.
31
+ * @platform ios
32
+ */
25
33
  ios?: PluginConfigTypeIos;
26
34
  }
27
35
 
28
36
  /**
29
- * Config for Android native build properties
37
+ * Interface representing available configuration for Android native build properties.
38
+ * @platform android
30
39
  */
31
40
  export interface PluginConfigTypeAndroid {
32
- /** Override the default `minSdkVersion` version number in `build.gradle` */
41
+ /**
42
+ * Enable React Native new architecture for Android platform.
43
+ */
44
+ newArchEnabled?: boolean;
45
+ /**
46
+ * Override the default `minSdkVersion` version number in **build.gradle**.
47
+ * */
33
48
  minSdkVersion?: number;
34
-
35
- /** Override the default `compileSdkVersion` version number in `build.gradle` */
49
+ /**
50
+ * Override the default `compileSdkVersion` version number in **build.gradle**.
51
+ */
36
52
  compileSdkVersion?: number;
37
-
38
- /** Override the default `targetSdkVersion` version number in `build.gradle` */
53
+ /**
54
+ * Override the default `targetSdkVersion` version number in **build.gradle**.
55
+ */
39
56
  targetSdkVersion?: number;
40
-
41
- /** Override the default `buildToolsVersion` version number in `build.gradle` */
57
+ /**
58
+ * Override the default `buildToolsVersion` version number in **build.gradle**.
59
+ */
42
60
  buildToolsVersion?: string;
43
-
44
- /** Override the default Kotlin version when building the app */
61
+ /**
62
+ * Override the Kotlin version used when building the app.
63
+ */
45
64
  kotlinVersion?: string;
46
-
47
- /** Enable Proguard (R8) in release builds to obfuscate Java code and reduce app size */
65
+ /**
66
+ * Enable [Proguard or R8](https://developer.android.com/studio/build/shrink-code) in release builds to obfuscate Java code and reduce app size.
67
+ */
48
68
  enableProguardInReleaseBuilds?: boolean;
49
-
50
- /** Append custom [Proguard rules](https://www.guardsquare.com/manual/configuration/usage) to `android/app/proguard-rules.pro` */
69
+ /**
70
+ * Append custom [Proguard rules](https://www.guardsquare.com/manual/configuration/usage) to **android/app/proguard-rules.pro**.
71
+ */
51
72
  extraProguardRules?: string;
52
-
53
- /** AGP [PackagingOptions](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/dsl/PackagingOptions) */
73
+ /**
74
+ * Interface representing available configuration for Android Gradle plugin [PackagingOptions](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/dsl/PackagingOptions).
75
+ */
54
76
  packagingOptions?: PluginConfigTypeAndroidPackagingOptions;
55
77
  }
56
78
 
57
79
  /**
58
- * Config for iOS native build properties
80
+ * Interface representing available configuration for iOS native build properties.
81
+ * @platform ios
59
82
  */
60
83
  export interface PluginConfigTypeIos {
61
84
  /**
62
- * Override the default iOS *Deployment Target* version in the following projects:
63
- * - in CocoaPods projects
64
- * - `PBXNativeTarget` with `com.apple.product-type.application` productType in the app project
85
+ * Enable React Native new architecture for iOS platform.
86
+ */
87
+ newArchEnabled?: boolean;
88
+ /**
89
+ * Override the default iOS "Deployment Target" version in the following projects:
90
+ * - in CocoaPods projects,
91
+ * - `PBXNativeTarget` with "com.apple.product-type.application" `productType` in the app project.
65
92
  */
66
93
  deploymentTarget?: string;
67
-
68
- /** Enable [`use_frameworks!`](https://guides.cocoapods.org/syntax/podfile.html#use_frameworks_bang) in `Podfile` */
94
+ /**
95
+ * Enable [`use_frameworks!`](https://guides.cocoapods.org/syntax/podfile.html#use_frameworks_bang)
96
+ * in `Podfile` to use frameworks instead of static libraries for Pods.
97
+ */
69
98
  useFrameworks?: 'static' | 'dynamic';
70
99
  }
71
100
 
72
101
  /**
73
- * AGP [PackagingOptions](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/dsl/PackagingOptions)
102
+ * Interface representing available configuration for Android Gradle plugin [PackagingOptions](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/dsl/PackagingOptions).
103
+ * @platform android
74
104
  */
75
105
  export interface PluginConfigTypeAndroidPackagingOptions {
76
- /** Adds a first-pick pattern */
106
+ /**
107
+ * Array of patterns for native libraries where only the first occurrence is packaged in the APK.
108
+ */
77
109
  pickFirst?: string[];
78
-
79
- /** Adds an excluded pattern */
110
+ /**
111
+ * Array of patterns for native libraries that should be excluded from being packaged in the APK.
112
+ */
80
113
  exclude?: string[];
81
-
82
- /** Adds a merge pattern */
114
+ /**
115
+ * Array of patterns for native libraries where all occurrences are concatenated and packaged in the APK.
116
+ */
83
117
  merge?: string[];
84
-
85
- /** Adds a doNotStrip pattern */
118
+ /**
119
+ * Array of patterns for native libraries that should not be stripped of debug symbols.
120
+ */
86
121
  doNotStrip?: string[];
87
122
  }
88
123
 
@@ -92,6 +127,7 @@ const schema: JSONSchemaType<PluginConfigType> = {
92
127
  android: {
93
128
  type: 'object',
94
129
  properties: {
130
+ newArchEnabled: { type: 'boolean', nullable: true },
95
131
  minSdkVersion: { type: 'integer', nullable: true },
96
132
  compileSdkVersion: { type: 'integer', nullable: true },
97
133
  targetSdkVersion: { type: 'integer', nullable: true },
@@ -117,6 +153,7 @@ const schema: JSONSchemaType<PluginConfigType> = {
117
153
  ios: {
118
154
  type: 'object',
119
155
  properties: {
156
+ newArchEnabled: { type: 'boolean', nullable: true },
120
157
  deploymentTarget: { type: 'string', pattern: '\\d+\\.\\d+', nullable: true },
121
158
  useFrameworks: { type: 'string', enum: ['static', 'dynamic'], nullable: true },
122
159
  },
@@ -125,12 +162,12 @@ const schema: JSONSchemaType<PluginConfigType> = {
125
162
  },
126
163
  };
127
164
 
165
+ // note(Kudo): For the implementation, we check items one by one because Ajv does not well support custom error message.
128
166
  /**
129
- * Check versions to meet expo minimal supported versions.
167
+ * Checks if specified versions meets Expo minimal supported versions.
130
168
  * Will throw error message whenever there are invalid versions.
131
- * For the implementation, we check items one by one because ajv does not well support custom error message.
132
169
  *
133
- * @param config the validated config passed from ajv
170
+ * @param config The validated config passed from Ajv.
134
171
  * @ignore
135
172
  */
136
173
  function maybeThrowInvalidVersions(config: PluginConfigType) {
@@ -1,4 +1,4 @@
1
- import type { ConfigPlugin } from 'expo/config-plugins';
1
+ import { ConfigPlugin } from 'expo/config-plugins';
2
2
 
3
3
  import {
4
4
  withAndroidBuildProperties,
@@ -9,10 +9,9 @@ import { withIosBuildProperties, withIosDeploymentTarget } from './ios';
9
9
  import { PluginConfigType, validateConfig } from './pluginConfig';
10
10
 
11
11
  /**
12
- * Config plugin to customize native Android or iOS build properties for managed apps
13
- *
14
- * @param config ExpoConfig
15
- * @param props Configuration for the config plugin
12
+ * Config plugin allowing customizing native Android and iOS build properties for managed apps.
13
+ * @param config Expo config for application.
14
+ * @param props Configuration for the build properties plugin.
16
15
  */
17
16
  export const withBuildProperties: ConfigPlugin<PluginConfigType> = (config, props) => {
18
17
  const pluginConfig = validateConfig(props || {});