@expo/config-plugins 4.0.2 → 4.0.7
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/README.md +14 -0
- package/build/Plugin.types.d.ts +4 -0
- package/build/Plugin.types.js.map +1 -1
- package/build/android/Updates.d.ts +10 -10
- package/build/android/Updates.js.map +1 -1
- package/build/android/codeMod.d.ts +20 -0
- package/build/android/codeMod.js +109 -0
- package/build/android/codeMod.js.map +1 -0
- package/build/android/index.d.ts +2 -6
- package/build/android/index.js +1 -86
- package/build/android/index.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.js +8 -0
- package/build/index.js.map +1 -1
- package/build/ios/Bitcode.d.ts +33 -0
- package/build/ios/Bitcode.js +131 -0
- package/build/ios/Bitcode.js.map +1 -0
- package/build/ios/Maps.js +1 -0
- package/build/ios/Maps.js.map +1 -1
- package/build/ios/Paths.d.ts +1 -0
- package/build/ios/Paths.js +25 -0
- package/build/ios/Paths.js.map +1 -1
- package/build/ios/Updates.d.ts +10 -10
- package/build/ios/Updates.js.map +1 -1
- package/build/ios/codeMod.d.ts +81 -0
- package/build/ios/codeMod.js +306 -0
- package/build/ios/codeMod.js.map +1 -0
- package/build/ios/index.d.ts +3 -5
- package/build/ios/index.js +6 -57
- package/build/ios/index.js.map +1 -1
- package/build/plugins/android-plugins.d.ts +7 -0
- package/build/plugins/android-plugins.js +19 -2
- package/build/plugins/android-plugins.js.map +1 -1
- package/build/plugins/ios-plugins.d.ts +6 -6
- package/build/plugins/ios-plugins.js.map +1 -1
- package/build/plugins/withAndroidBaseMods.d.ts +2 -0
- package/build/plugins/withAndroidBaseMods.js +32 -0
- package/build/plugins/withAndroidBaseMods.js.map +1 -1
- package/build/plugins/withStaticPlugin.js +16 -5
- package/build/plugins/withStaticPlugin.js.map +1 -1
- package/build/utils/Updates.d.ts +5 -4
- package/build/utils/Updates.js +1 -1
- package/build/utils/Updates.js.map +1 -1
- package/build/utils/commonCodeMod.d.ts +32 -0
- package/build/utils/commonCodeMod.js +71 -0
- package/build/utils/commonCodeMod.js.map +1 -0
- package/build/utils/matchBrackets.d.ts +7 -0
- package/build/utils/matchBrackets.js +80 -0
- package/build/utils/matchBrackets.js.map +1 -0
- package/package.json +3 -3
- package/build/android/Branch.d.ts +0 -5
- package/build/android/Branch.js +0 -54
- package/build/android/Branch.js.map +0 -1
- package/build/android/Facebook.d.ts +0 -13
- package/build/android/Facebook.js +0 -236
- package/build/android/Facebook.js.map +0 -1
- package/build/android/NavigationBar.d.ts +0 -9
- package/build/android/NavigationBar.js +0 -141
- package/build/android/NavigationBar.js.map +0 -1
- package/build/android/RootViewBackgroundColor.d.ts +0 -6
- package/build/android/RootViewBackgroundColor.js +0 -81
- package/build/android/RootViewBackgroundColor.js.map +0 -1
- package/build/android/UserInterfaceStyle.d.ts +0 -11
- package/build/android/UserInterfaceStyle.js +0 -125
- package/build/android/UserInterfaceStyle.js.map +0 -1
- package/build/ios/Branch.d.ts +0 -5
- package/build/ios/Branch.js +0 -42
- package/build/ios/Branch.js.map +0 -1
- package/build/ios/Facebook.d.ts +0 -176
- package/build/ios/Facebook.js +0 -232
- package/build/ios/Facebook.js.map +0 -1
- package/build/ios/RootViewBackgroundColor.d.ts +0 -6
- package/build/ios/RootViewBackgroundColor.js +0 -70
- package/build/ios/RootViewBackgroundColor.js.map +0 -1
- package/build/ios/UserInterfaceStyle.d.ts +0 -5
- package/build/ios/UserInterfaceStyle.js +0 -59
- package/build/ios/UserInterfaceStyle.js.map +0 -1
package/README.md
CHANGED
|
@@ -3,3 +3,17 @@
|
|
|
3
3
|
The Expo config is a powerful tool for generating native app code from a unified JavaScript interface. Most basic functionality can be controlled by using the the [static Expo config](https://docs.expo.dev/versions/latest/config/app/), but some features require manipulation of the native project files. To support complex behavior we've created config plugins, and mods (short for modifiers).
|
|
4
4
|
|
|
5
5
|
For more info, please refer to the official docs: [Config Plugins](https://docs.expo.dev/guides/config-plugins/).
|
|
6
|
+
|
|
7
|
+
## Environment Variables
|
|
8
|
+
|
|
9
|
+
### `EXPO_DEBUG`
|
|
10
|
+
|
|
11
|
+
Print debug information related to static plugin resolution.
|
|
12
|
+
|
|
13
|
+
### `EXPO_CONFIG_PLUGIN_VERBOSE_ERRORS`
|
|
14
|
+
|
|
15
|
+
Show all error info related to static plugin resolution. Requires `EXPO_DEBUG` to be enabled.
|
|
16
|
+
|
|
17
|
+
### `EXPO_USE_UNVERSIONED_PLUGINS`
|
|
18
|
+
|
|
19
|
+
Force using the fallback unversioned plugins instead of a local versioned copy from installed packages, this should only be used for testing the CLI.
|
package/build/Plugin.types.d.ts
CHANGED
|
@@ -99,6 +99,10 @@ export interface ModConfig {
|
|
|
99
99
|
* Modify the `android/app/src/main/<package>/MainActivity.java` as a string.
|
|
100
100
|
*/
|
|
101
101
|
mainActivity?: Mod<AndroidPaths.ApplicationProjectFile>;
|
|
102
|
+
/**
|
|
103
|
+
* Modify the `android/app/src/main/<package>/MainApplication.java` as a string.
|
|
104
|
+
*/
|
|
105
|
+
mainApplication?: Mod<AndroidPaths.ApplicationProjectFile>;
|
|
102
106
|
/**
|
|
103
107
|
* Modify the `android/app/build.gradle` as a string.
|
|
104
108
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Plugin.types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport { JSONObject } from '@expo/json-file';\nimport { XcodeProject } from 'xcode';\n\nimport { Properties } from './android';\nimport { AndroidManifest } from './android/Manifest';\nimport * as AndroidPaths from './android/Paths';\nimport { ResourceXML } from './android/Resources';\nimport { ExpoPlist, InfoPlist } from './ios/IosConfig.types';\nimport { AppDelegateProjectFile } from './ios/Paths';\n\ntype OptionalPromise<T> = Promise<T> | T;\n\ntype Plist = JSONObject;\n\nexport interface ModProps<T = any> {\n /**\n * Project root directory for the universal app.\n */\n readonly projectRoot: string;\n\n /**\n * Project root for the specific platform.\n */\n readonly platformProjectRoot: string;\n\n /**\n * Name of the mod.\n */\n readonly modName: string;\n\n /**\n * Name of the platform used in the mods config.\n */\n readonly platform: ModPlatform;\n\n /**\n * If the mod is being evaluated in introspection mode.\n * No file system modifications should be made when introspect is `true`.\n */\n readonly introspect: boolean;\n\n /**\n * [iOS]: The path component used for querying project files.\n *\n * @example projectRoot/ios/[projectName]/\n */\n readonly projectName?: string;\n\n nextMod?: Mod<T>;\n}\n\n// TODO: Migrate ProjectConfig to using expo instead if exp\nexport interface ExportedConfig extends ExpoConfig {\n mods?: ModConfig | null;\n}\n\nexport interface ExportedConfigWithProps<Data = any> extends ExportedConfig {\n /**\n * The Object representation of a complex file type.\n */\n modResults: Data;\n modRequest: ModProps<Data>;\n}\n\n/**\n * A helper type to get the properties of a plugin.\n */\nexport type PluginParameters<T extends ConfigPlugin<any>> = T extends (\n config: any,\n props: infer P\n) => any\n ? P\n : never;\n\nexport type ConfigPlugin<Props = void> = (config: ExpoConfig, props: Props) => ExpoConfig;\n\nexport type StaticPlugin<T = any> = [string | ConfigPlugin<T>, T];\n\nexport type Mod<Props = any> = ((\n config: ExportedConfigWithProps<Props>\n) => OptionalPromise<ExportedConfigWithProps<Props>>) & {\n /**\n * Indicates that the mod provides data upstream to other mods.\n * This mod should always be the last one added.\n */\n isProvider?: boolean;\n /**\n * If the mod supports introspection, and avoids making any filesystem modifications during compilation.\n * By enabling, this mod, and all of its descendants will be run in introspection mode.\n * This should only be used for static files like JSON or XML, and not for application files that require regexes,\n * or complex static files that require other files to be generated like Xcode `.pbxproj`.\n */\n isIntrospective?: boolean;\n};\n\nexport interface ModConfig {\n android?: {\n /**\n * Dangerously make a modification before any other android mods have been run.\n */\n dangerous?: Mod<unknown>;\n /**\n * Modify the `android/app/src/main/AndroidManifest.xml` as JSON (parsed with [`xml2js`](https://www.npmjs.com/package/xml2js)).\n */\n manifest?: Mod<AndroidManifest>;\n /**\n * Modify the `android/app/src/main/res/values/strings.xml` as JSON (parsed with [`xml2js`](https://www.npmjs.com/package/xml2js)).\n */\n strings?: Mod<ResourceXML>;\n /**\n * Modify the `android/app/src/main/res/values/colors.xml` as JSON (parsed with [`xml2js`](https://www.npmjs.com/package/xml2js)).\n */\n colors?: Mod<ResourceXML>;\n /**\n * Modify the `android/app/src/main/res/values-night/colors.xml` as JSON (parsed with [`xml2js`](https://www.npmjs.com/package/xml2js)).\n */\n colorsNight?: Mod<ResourceXML>;\n /**\n * Modify the `android/app/src/main/res/values/styles.xml` as JSON (parsed with [`xml2js`](https://www.npmjs.com/package/xml2js)).\n */\n styles?: Mod<ResourceXML>;\n /**\n * Modify the `android/app/src/main/<package>/MainActivity.java` as a string.\n */\n mainActivity?: Mod<AndroidPaths.ApplicationProjectFile>;\n /**\n * Modify the `android/app/build.gradle` as a string.\n */\n appBuildGradle?: Mod<AndroidPaths.GradleProjectFile>;\n /**\n * Modify the `android/build.gradle` as a string.\n */\n projectBuildGradle?: Mod<AndroidPaths.GradleProjectFile>;\n /**\n * Modify the `android/settings.gradle` as a string.\n */\n settingsGradle?: Mod<AndroidPaths.GradleProjectFile>;\n /**\n * Modify the `android/gradle.properties` as a `Properties.PropertiesItem[]`.\n */\n gradleProperties?: Mod<Properties.PropertiesItem[]>;\n };\n ios?: {\n /**\n * Dangerously make a modification before any other android mods have been run.\n */\n dangerous?: Mod<unknown>;\n /**\n * Modify the `ios/<name>/Info.plist` as JSON (parsed with [`@expo/plist`](https://www.npmjs.com/package/@expo/plist)).\n */\n infoPlist?: Mod<InfoPlist>;\n /**\n * Modify the `ios/<name>/<product-name>.entitlements` as JSON (parsed with [`@expo/plist`](https://www.npmjs.com/package/@expo/plist)).\n */\n entitlements?: Mod<Plist>;\n /**\n * Modify the `ios/<name>/Expo.plist` as JSON (Expo updates config for iOS) (parsed with [`@expo/plist`](https://www.npmjs.com/package/@expo/plist)).\n */\n expoPlist?: Mod<Plist>;\n /**\n * Modify the `ios/<name>.xcodeproj` as an `XcodeProject` (parsed with [`xcode`](https://www.npmjs.com/package/xcode))\n */\n xcodeproj?: Mod<XcodeProject>;\n /**\n * Modify the `ios/<name>/AppDelegate.m` as a string (dangerous)\n */\n appDelegate?: Mod<AppDelegateProjectFile>;\n /**\n * Modify the `ios/Podfile.properties.json` as key-value pairs\n */\n podfileProperties?: Mod<Record<string, string>>;\n };\n}\n\nexport type ModPlatform = keyof ModConfig;\n\nexport { XcodeProject, InfoPlist, ExpoPlist, AndroidManifest };\n"],"file":"Plugin.types.js"}
|
|
1
|
+
{"version":3,"sources":["../src/Plugin.types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport { JSONObject } from '@expo/json-file';\nimport { XcodeProject } from 'xcode';\n\nimport { Properties } from './android';\nimport { AndroidManifest } from './android/Manifest';\nimport * as AndroidPaths from './android/Paths';\nimport { ResourceXML } from './android/Resources';\nimport { ExpoPlist, InfoPlist } from './ios/IosConfig.types';\nimport { AppDelegateProjectFile } from './ios/Paths';\n\ntype OptionalPromise<T> = Promise<T> | T;\n\ntype Plist = JSONObject;\n\nexport interface ModProps<T = any> {\n /**\n * Project root directory for the universal app.\n */\n readonly projectRoot: string;\n\n /**\n * Project root for the specific platform.\n */\n readonly platformProjectRoot: string;\n\n /**\n * Name of the mod.\n */\n readonly modName: string;\n\n /**\n * Name of the platform used in the mods config.\n */\n readonly platform: ModPlatform;\n\n /**\n * If the mod is being evaluated in introspection mode.\n * No file system modifications should be made when introspect is `true`.\n */\n readonly introspect: boolean;\n\n /**\n * [iOS]: The path component used for querying project files.\n *\n * @example projectRoot/ios/[projectName]/\n */\n readonly projectName?: string;\n\n nextMod?: Mod<T>;\n}\n\n// TODO: Migrate ProjectConfig to using expo instead if exp\nexport interface ExportedConfig extends ExpoConfig {\n mods?: ModConfig | null;\n}\n\nexport interface ExportedConfigWithProps<Data = any> extends ExportedConfig {\n /**\n * The Object representation of a complex file type.\n */\n modResults: Data;\n modRequest: ModProps<Data>;\n}\n\n/**\n * A helper type to get the properties of a plugin.\n */\nexport type PluginParameters<T extends ConfigPlugin<any>> = T extends (\n config: any,\n props: infer P\n) => any\n ? P\n : never;\n\nexport type ConfigPlugin<Props = void> = (config: ExpoConfig, props: Props) => ExpoConfig;\n\nexport type StaticPlugin<T = any> = [string | ConfigPlugin<T>, T];\n\nexport type Mod<Props = any> = ((\n config: ExportedConfigWithProps<Props>\n) => OptionalPromise<ExportedConfigWithProps<Props>>) & {\n /**\n * Indicates that the mod provides data upstream to other mods.\n * This mod should always be the last one added.\n */\n isProvider?: boolean;\n /**\n * If the mod supports introspection, and avoids making any filesystem modifications during compilation.\n * By enabling, this mod, and all of its descendants will be run in introspection mode.\n * This should only be used for static files like JSON or XML, and not for application files that require regexes,\n * or complex static files that require other files to be generated like Xcode `.pbxproj`.\n */\n isIntrospective?: boolean;\n};\n\nexport interface ModConfig {\n android?: {\n /**\n * Dangerously make a modification before any other android mods have been run.\n */\n dangerous?: Mod<unknown>;\n /**\n * Modify the `android/app/src/main/AndroidManifest.xml` as JSON (parsed with [`xml2js`](https://www.npmjs.com/package/xml2js)).\n */\n manifest?: Mod<AndroidManifest>;\n /**\n * Modify the `android/app/src/main/res/values/strings.xml` as JSON (parsed with [`xml2js`](https://www.npmjs.com/package/xml2js)).\n */\n strings?: Mod<ResourceXML>;\n /**\n * Modify the `android/app/src/main/res/values/colors.xml` as JSON (parsed with [`xml2js`](https://www.npmjs.com/package/xml2js)).\n */\n colors?: Mod<ResourceXML>;\n /**\n * Modify the `android/app/src/main/res/values-night/colors.xml` as JSON (parsed with [`xml2js`](https://www.npmjs.com/package/xml2js)).\n */\n colorsNight?: Mod<ResourceXML>;\n /**\n * Modify the `android/app/src/main/res/values/styles.xml` as JSON (parsed with [`xml2js`](https://www.npmjs.com/package/xml2js)).\n */\n styles?: Mod<ResourceXML>;\n /**\n * Modify the `android/app/src/main/<package>/MainActivity.java` as a string.\n */\n mainActivity?: Mod<AndroidPaths.ApplicationProjectFile>;\n /**\n * Modify the `android/app/src/main/<package>/MainApplication.java` as a string.\n */\n mainApplication?: Mod<AndroidPaths.ApplicationProjectFile>;\n /**\n * Modify the `android/app/build.gradle` as a string.\n */\n appBuildGradle?: Mod<AndroidPaths.GradleProjectFile>;\n /**\n * Modify the `android/build.gradle` as a string.\n */\n projectBuildGradle?: Mod<AndroidPaths.GradleProjectFile>;\n /**\n * Modify the `android/settings.gradle` as a string.\n */\n settingsGradle?: Mod<AndroidPaths.GradleProjectFile>;\n /**\n * Modify the `android/gradle.properties` as a `Properties.PropertiesItem[]`.\n */\n gradleProperties?: Mod<Properties.PropertiesItem[]>;\n };\n ios?: {\n /**\n * Dangerously make a modification before any other android mods have been run.\n */\n dangerous?: Mod<unknown>;\n /**\n * Modify the `ios/<name>/Info.plist` as JSON (parsed with [`@expo/plist`](https://www.npmjs.com/package/@expo/plist)).\n */\n infoPlist?: Mod<InfoPlist>;\n /**\n * Modify the `ios/<name>/<product-name>.entitlements` as JSON (parsed with [`@expo/plist`](https://www.npmjs.com/package/@expo/plist)).\n */\n entitlements?: Mod<Plist>;\n /**\n * Modify the `ios/<name>/Expo.plist` as JSON (Expo updates config for iOS) (parsed with [`@expo/plist`](https://www.npmjs.com/package/@expo/plist)).\n */\n expoPlist?: Mod<Plist>;\n /**\n * Modify the `ios/<name>.xcodeproj` as an `XcodeProject` (parsed with [`xcode`](https://www.npmjs.com/package/xcode))\n */\n xcodeproj?: Mod<XcodeProject>;\n /**\n * Modify the `ios/<name>/AppDelegate.m` as a string (dangerous)\n */\n appDelegate?: Mod<AppDelegateProjectFile>;\n /**\n * Modify the `ios/Podfile.properties.json` as key-value pairs\n */\n podfileProperties?: Mod<Record<string, string>>;\n };\n}\n\nexport type ModPlatform = keyof ModConfig;\n\nexport { XcodeProject, InfoPlist, ExpoPlist, AndroidManifest };\n"],"file":"Plugin.types.js"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ExpoConfig } from '@expo/config-types';
|
|
2
1
|
import { ConfigPlugin } from '../Plugin.types';
|
|
2
|
+
import { ExpoConfigUpdates } from '../utils/Updates';
|
|
3
3
|
import { AndroidManifest } from './Manifest';
|
|
4
4
|
export declare enum Config {
|
|
5
5
|
ENABLED = "expo.modules.updates.ENABLED",
|
|
@@ -18,16 +18,16 @@ export declare const withUpdates: ConfigPlugin<{
|
|
|
18
18
|
* runtime version maybe null in projects using classic updates. In that
|
|
19
19
|
* case we use SDK version
|
|
20
20
|
*/
|
|
21
|
-
export declare function getRuntimeVersionNullable(config: Pick<
|
|
22
|
-
export declare function getSDKVersion(config: Pick<
|
|
23
|
-
export declare function getUpdatesEnabled(config: Pick<
|
|
24
|
-
export declare function getUpdatesTimeout(config: Pick<
|
|
25
|
-
export declare function getUpdatesCheckOnLaunch(config: Pick<
|
|
26
|
-
export declare function setUpdatesConfig(config:
|
|
27
|
-
export declare function setVersionsConfig(config: Pick<
|
|
21
|
+
export declare function getRuntimeVersionNullable(config: Pick<ExpoConfigUpdates, 'runtimeVersion'>): string | null;
|
|
22
|
+
export declare function getSDKVersion(config: Pick<ExpoConfigUpdates, 'sdkVersion'>): string | null;
|
|
23
|
+
export declare function getUpdatesEnabled(config: Pick<ExpoConfigUpdates, 'updates'>): boolean;
|
|
24
|
+
export declare function getUpdatesTimeout(config: Pick<ExpoConfigUpdates, 'updates'>): number;
|
|
25
|
+
export declare function getUpdatesCheckOnLaunch(config: Pick<ExpoConfigUpdates, 'updates'>): 'NEVER' | 'ALWAYS';
|
|
26
|
+
export declare function setUpdatesConfig(config: ExpoConfigUpdates, androidManifest: AndroidManifest, username: string | null): AndroidManifest;
|
|
27
|
+
export declare function setVersionsConfig(config: Pick<ExpoConfigUpdates, 'sdkVersion' | 'runtimeVersion'>, androidManifest: AndroidManifest): AndroidManifest;
|
|
28
28
|
export declare function ensureBuildGradleContainsConfigurationScript(projectRoot: string, buildGradleContents: string): string;
|
|
29
29
|
export declare function formatApplyLineForBuildGradle(projectRoot: string): string;
|
|
30
30
|
export declare function isBuildGradleConfigured(projectRoot: string, buildGradleContents: string): boolean;
|
|
31
31
|
export declare function isMainApplicationMetaDataSet(androidManifest: AndroidManifest): boolean;
|
|
32
|
-
export declare function isMainApplicationMetaDataSynced(config:
|
|
33
|
-
export declare function areVersionsSynced(config: Pick<
|
|
32
|
+
export declare function isMainApplicationMetaDataSynced(config: ExpoConfigUpdates, androidManifest: AndroidManifest, username: string | null): boolean;
|
|
33
|
+
export declare function areVersionsSynced(config: Pick<ExpoConfigUpdates, 'runtimeVersion' | 'sdkVersion'>, androidManifest: AndroidManifest): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/android/Updates.ts"],"names":["CREATE_MANIFEST_ANDROID_PATH","Config","withUpdates","config","expoUsername","modResults","setUpdatesConfig","getRuntimeVersionNullable","e","getSDKVersion","sdkVersion","getUpdatesEnabled","updates","enabled","getUpdatesTimeout","fallbackToCacheTimeout","getUpdatesCheckOnLaunch","checkAutomatically","androidManifest","username","mainApplication","ENABLED","String","CHECK_ON_LAUNCH","LAUNCH_WAIT_MS","updateUrl","UPDATE_URL","setVersionsConfig","runtimeVersion","SDK_VERSION","RUNTIME_VERSION","ensureBuildGradleContainsConfigurationScript","projectRoot","buildGradleContents","isBuildGradleConfigured","cleanedUpBuildGradleContents","isBuildGradleMisconfigured","split","some","line","includes","replace","RegExp","gradleScriptApply","formatApplyLineForBuildGradle","updatesGradleScriptPath","resolveFrom","silent","Error","relativePath","path","relative","join","posixPath","process","platform","androidBuildScript","isMainApplicationMetaDataSet","Boolean","isMainApplicationMetaDataSynced","areVersionsSynced","expectedRuntimeVersion","expectedSdkVersion","currentRuntimeVersion","currentSdkVersion"],"mappings":";;;;;;;;;;;;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAQA,MAAMA,4BAA4B,GAAG,qDAArC;IAEYC,M;;;WAAAA,M;AAAAA,EAAAA,M;AAAAA,EAAAA,M;AAAAA,EAAAA,M;AAAAA,EAAAA,M;AAAAA,EAAAA,M;AAAAA,EAAAA,M;AAAAA,EAAAA,M;AAAAA,EAAAA,M;GAAAA,M,sBAAAA,M;;AAWL,MAAMC,WAA0D,GAAG,CACxEC,MADwE,EAExE;AAAEC,EAAAA;AAAF,CAFwE,KAGrE;AACH,SAAO,2CAAoBD,MAApB,EAA4BA,MAAM,IAAI;AAC3CA,IAAAA,MAAM,CAACE,UAAP,GAAoBC,gBAAgB,CAACH,MAAD,EAASA,MAAM,CAACE,UAAhB,EAA4BD,YAA5B,CAApC;AACA,WAAOD,MAAP;AACD,GAHM,CAAP;AAID,CARM;AAUP;AACA;AACA;AACA;;;;;AACO,SAASI,yBAAT,CACLJ,MADK,EAEU;AACf,MAAI;AACF,WAAO,kCAAkBA,MAAlB,EAA0B,SAA1B,CAAP;AACD,GAFD,CAEE,OAAOK,CAAP,EAAU;AACV,WAAO,IAAP;AACD;AACF;;AAEM,SAASC,aAAT,CAAuBN,MAAvB,EAA8E;AACnF,SAAO,OAAOA,MAAM,CAACO,UAAd,KAA6B,QAA7B,GAAwCP,MAAM,CAACO,UAA/C,GAA4D,IAAnE;AACD;;AAEM,SAASC,iBAAT,CAA2BR,MAA3B,EAAyE;AAAA;;AAC9E,SAAO,oB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/config-types';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withAndroidManifest } from '../plugins/android-plugins';\nimport { getRuntimeVersion, getUpdateUrl } from '../utils/Updates';\nimport {\n addMetaDataItemToMainApplication,\n AndroidManifest,\n getMainApplicationMetaDataValue,\n getMainApplicationOrThrow,\n removeMetaDataItemFromMainApplication,\n} from './Manifest';\n\nconst CREATE_MANIFEST_ANDROID_PATH = 'expo-updates/scripts/create-manifest-android.gradle';\n\nexport enum Config {\n ENABLED = 'expo.modules.updates.ENABLED',\n CHECK_ON_LAUNCH = 'expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH',\n LAUNCH_WAIT_MS = 'expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS',\n SDK_VERSION = 'expo.modules.updates.EXPO_SDK_VERSION',\n RUNTIME_VERSION = 'expo.modules.updates.EXPO_RUNTIME_VERSION',\n UPDATE_URL = 'expo.modules.updates.EXPO_UPDATE_URL',\n RELEASE_CHANNEL = 'expo.modules.updates.EXPO_RELEASE_CHANNEL',\n UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY = 'expo.modules.updates.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY',\n}\n\nexport const withUpdates: ConfigPlugin<{ expoUsername: string | null }> = (\n config,\n { expoUsername }\n) => {\n return withAndroidManifest(config, config => {\n config.modResults = setUpdatesConfig(config, config.modResults, expoUsername);\n return config;\n });\n};\n\n/**\n * runtime version maybe null in projects using classic updates. In that\n * case we use SDK version\n */\nexport function getRuntimeVersionNullable(\n config: Pick<ExpoConfig, 'runtimeVersion'>\n): string | null {\n try {\n return getRuntimeVersion(config, 'android');\n } catch (e) {\n return null;\n }\n}\n\nexport function getSDKVersion(config: Pick<ExpoConfig, 'sdkVersion'>): string | null {\n return typeof config.sdkVersion === 'string' ? config.sdkVersion : null;\n}\n\nexport function getUpdatesEnabled(config: Pick<ExpoConfig, 'updates'>): boolean {\n return config.updates?.enabled !== false;\n}\n\nexport function getUpdatesTimeout(config: Pick<ExpoConfig, 'updates'>): number {\n return config.updates?.fallbackToCacheTimeout ?? 0;\n}\n\nexport function getUpdatesCheckOnLaunch(config: Pick<ExpoConfig, 'updates'>): 'NEVER' | 'ALWAYS' {\n if (config.updates?.checkAutomatically === 'ON_ERROR_RECOVERY') {\n return 'NEVER';\n } else if (config.updates?.checkAutomatically === 'ON_LOAD') {\n return 'ALWAYS';\n }\n return 'ALWAYS';\n}\n\nexport function setUpdatesConfig(\n config: ExpoConfig,\n androidManifest: AndroidManifest,\n username: string | null\n): AndroidManifest {\n const mainApplication = getMainApplicationOrThrow(androidManifest);\n\n addMetaDataItemToMainApplication(\n mainApplication,\n Config.ENABLED,\n String(getUpdatesEnabled(config))\n );\n addMetaDataItemToMainApplication(\n mainApplication,\n Config.CHECK_ON_LAUNCH,\n getUpdatesCheckOnLaunch(config)\n );\n addMetaDataItemToMainApplication(\n mainApplication,\n Config.LAUNCH_WAIT_MS,\n String(getUpdatesTimeout(config))\n );\n\n const updateUrl = getUpdateUrl(config, username);\n if (updateUrl) {\n addMetaDataItemToMainApplication(mainApplication, Config.UPDATE_URL, updateUrl);\n } else {\n removeMetaDataItemFromMainApplication(mainApplication, Config.UPDATE_URL);\n }\n\n return setVersionsConfig(config, androidManifest);\n}\n\nexport function setVersionsConfig(\n config: Pick<ExpoConfig, 'sdkVersion' | 'runtimeVersion'>,\n androidManifest: AndroidManifest\n): AndroidManifest {\n const mainApplication = getMainApplicationOrThrow(androidManifest);\n\n const runtimeVersion = getRuntimeVersionNullable(config);\n const sdkVersion = getSDKVersion(config);\n if (runtimeVersion) {\n removeMetaDataItemFromMainApplication(mainApplication, Config.SDK_VERSION);\n addMetaDataItemToMainApplication(mainApplication, Config.RUNTIME_VERSION, runtimeVersion);\n } else if (sdkVersion) {\n removeMetaDataItemFromMainApplication(mainApplication, Config.RUNTIME_VERSION);\n addMetaDataItemToMainApplication(mainApplication, Config.SDK_VERSION, sdkVersion);\n } else {\n removeMetaDataItemFromMainApplication(mainApplication, Config.RUNTIME_VERSION);\n removeMetaDataItemFromMainApplication(mainApplication, Config.SDK_VERSION);\n }\n\n return androidManifest;\n}\nexport function ensureBuildGradleContainsConfigurationScript(\n projectRoot: string,\n buildGradleContents: string\n): string {\n if (!isBuildGradleConfigured(projectRoot, buildGradleContents)) {\n let cleanedUpBuildGradleContents;\n\n const isBuildGradleMisconfigured = buildGradleContents\n .split('\\n')\n .some(line => line.includes(CREATE_MANIFEST_ANDROID_PATH));\n if (isBuildGradleMisconfigured) {\n cleanedUpBuildGradleContents = buildGradleContents.replace(\n new RegExp(`(\\n// Integration with Expo updates)?\\n.*${CREATE_MANIFEST_ANDROID_PATH}.*\\n`),\n ''\n );\n } else {\n cleanedUpBuildGradleContents = buildGradleContents;\n }\n\n const gradleScriptApply = formatApplyLineForBuildGradle(projectRoot);\n return `${cleanedUpBuildGradleContents}\\n// Integration with Expo updates\\n${gradleScriptApply}\\n`;\n } else {\n return buildGradleContents;\n }\n}\n\nexport function formatApplyLineForBuildGradle(projectRoot: string): string {\n const updatesGradleScriptPath = resolveFrom.silent(projectRoot, CREATE_MANIFEST_ANDROID_PATH);\n\n if (!updatesGradleScriptPath) {\n throw new Error(\n \"Could not find the build script for Android. This could happen in case of outdated 'node_modules'. Run 'npm install' to make sure that it's up-to-date.\"\n );\n }\n\n const relativePath = path.relative(\n path.join(projectRoot, 'android', 'app'),\n updatesGradleScriptPath\n );\n const posixPath = process.platform === 'win32' ? relativePath.replace(/\\\\/g, '/') : relativePath;\n\n return `apply from: \"${posixPath}\"`;\n}\n\nexport function isBuildGradleConfigured(projectRoot: string, buildGradleContents: string): boolean {\n const androidBuildScript = formatApplyLineForBuildGradle(projectRoot);\n\n return (\n buildGradleContents\n .replace(/\\r\\n/g, '\\n')\n .split('\\n')\n // Check for both single and double quotes\n .some(line => line === androidBuildScript || line === androidBuildScript.replace(/\"/g, \"'\"))\n );\n}\n\nexport function isMainApplicationMetaDataSet(androidManifest: AndroidManifest): boolean {\n const updateUrl = getMainApplicationMetaDataValue(androidManifest, Config.UPDATE_URL);\n const runtimeVersion = getMainApplicationMetaDataValue(androidManifest, Config.RUNTIME_VERSION);\n const sdkVersion = getMainApplicationMetaDataValue(androidManifest, Config.SDK_VERSION);\n\n return Boolean(updateUrl && (sdkVersion || runtimeVersion));\n}\n\nexport function isMainApplicationMetaDataSynced(\n config: ExpoConfig,\n androidManifest: AndroidManifest,\n username: string | null\n): boolean {\n return (\n getUpdateUrl(config, username) ===\n getMainApplicationMetaDataValue(androidManifest, Config.UPDATE_URL) &&\n String(getUpdatesEnabled(config)) ===\n getMainApplicationMetaDataValue(androidManifest, Config.ENABLED) &&\n String(getUpdatesTimeout(config)) ===\n getMainApplicationMetaDataValue(androidManifest, Config.LAUNCH_WAIT_MS) &&\n getUpdatesCheckOnLaunch(config) ===\n getMainApplicationMetaDataValue(androidManifest, Config.CHECK_ON_LAUNCH) &&\n areVersionsSynced(config, androidManifest)\n );\n}\n\nexport function areVersionsSynced(\n config: Pick<ExpoConfig, 'runtimeVersion' | 'sdkVersion'>,\n androidManifest: AndroidManifest\n): boolean {\n const expectedRuntimeVersion = getRuntimeVersionNullable(config);\n const expectedSdkVersion = getSDKVersion(config);\n\n const currentRuntimeVersion = getMainApplicationMetaDataValue(\n androidManifest,\n Config.RUNTIME_VERSION\n );\n const currentSdkVersion = getMainApplicationMetaDataValue(androidManifest, Config.SDK_VERSION);\n\n if (expectedRuntimeVersion !== null) {\n return currentRuntimeVersion === expectedRuntimeVersion && currentSdkVersion === null;\n } else if (expectedSdkVersion !== null) {\n return currentSdkVersion === expectedSdkVersion && currentRuntimeVersion === null;\n } else {\n return true;\n }\n}\n"],"file":"Updates.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/android/Updates.ts"],"names":["CREATE_MANIFEST_ANDROID_PATH","Config","withUpdates","config","expoUsername","modResults","setUpdatesConfig","getRuntimeVersionNullable","e","getSDKVersion","sdkVersion","getUpdatesEnabled","updates","enabled","getUpdatesTimeout","fallbackToCacheTimeout","getUpdatesCheckOnLaunch","checkAutomatically","androidManifest","username","mainApplication","ENABLED","String","CHECK_ON_LAUNCH","LAUNCH_WAIT_MS","updateUrl","UPDATE_URL","setVersionsConfig","runtimeVersion","SDK_VERSION","RUNTIME_VERSION","ensureBuildGradleContainsConfigurationScript","projectRoot","buildGradleContents","isBuildGradleConfigured","cleanedUpBuildGradleContents","isBuildGradleMisconfigured","split","some","line","includes","replace","RegExp","gradleScriptApply","formatApplyLineForBuildGradle","updatesGradleScriptPath","resolveFrom","silent","Error","relativePath","path","relative","join","posixPath","process","platform","androidBuildScript","isMainApplicationMetaDataSet","Boolean","isMainApplicationMetaDataSynced","areVersionsSynced","expectedRuntimeVersion","expectedSdkVersion","currentRuntimeVersion","currentSdkVersion"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAQA,MAAMA,4BAA4B,GAAG,qDAArC;IAEYC,M;;;WAAAA,M;AAAAA,EAAAA,M;AAAAA,EAAAA,M;AAAAA,EAAAA,M;AAAAA,EAAAA,M;AAAAA,EAAAA,M;AAAAA,EAAAA,M;AAAAA,EAAAA,M;AAAAA,EAAAA,M;GAAAA,M,sBAAAA,M;;AAWL,MAAMC,WAA0D,GAAG,CACxEC,MADwE,EAExE;AAAEC,EAAAA;AAAF,CAFwE,KAGrE;AACH,SAAO,2CAAoBD,MAApB,EAA4BA,MAAM,IAAI;AAC3CA,IAAAA,MAAM,CAACE,UAAP,GAAoBC,gBAAgB,CAACH,MAAD,EAASA,MAAM,CAACE,UAAhB,EAA4BD,YAA5B,CAApC;AACA,WAAOD,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M,CAAC6B,eAFqB,CAA9B;AAIA,QAAMkC,iBAAiB,GAAG,iDAAgC9C,eAAhC,EAAiDjB,MAAM,CAAC4B,WAAxD,CAA1B;;AAEA,MAAIgC,sBAAsB,KAAK,IAA/B,EAAqC;AACnC,WAAOE,qBAAqB,KAAKF,sBAA1B,IAAoDG,iBAAiB,KAAK,IAAjF;AACD,GAFD,MAEO,IAAIF,kBAAkB,KAAK,IAA3B,EAAiC;AACtC,WAAOE,iBAAiB,KAAKF,kBAAtB,IAA4CC,qBAAqB,KAAK,IAA7E;AACD,GAFM,MAEA;AACL,WAAO,IAAP;AACD;AACF","sourcesContent":["import path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withAndroidManifest } from '../plugins/android-plugins';\nimport { ExpoConfigUpdates, getRuntimeVersion, getUpdateUrl } from '../utils/Updates';\nimport {\n addMetaDataItemToMainApplication,\n AndroidManifest,\n getMainApplicationMetaDataValue,\n getMainApplicationOrThrow,\n removeMetaDataItemFromMainApplication,\n} from './Manifest';\n\nconst CREATE_MANIFEST_ANDROID_PATH = 'expo-updates/scripts/create-manifest-android.gradle';\n\nexport enum Config {\n ENABLED = 'expo.modules.updates.ENABLED',\n CHECK_ON_LAUNCH = 'expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH',\n LAUNCH_WAIT_MS = 'expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS',\n SDK_VERSION = 'expo.modules.updates.EXPO_SDK_VERSION',\n RUNTIME_VERSION = 'expo.modules.updates.EXPO_RUNTIME_VERSION',\n UPDATE_URL = 'expo.modules.updates.EXPO_UPDATE_URL',\n RELEASE_CHANNEL = 'expo.modules.updates.EXPO_RELEASE_CHANNEL',\n UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY = 'expo.modules.updates.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY',\n}\n\nexport const withUpdates: ConfigPlugin<{ expoUsername: string | null }> = (\n config,\n { expoUsername }\n) => {\n return withAndroidManifest(config, config => {\n config.modResults = setUpdatesConfig(config, config.modResults, expoUsername);\n return config;\n });\n};\n\n/**\n * runtime version maybe null in projects using classic updates. In that\n * case we use SDK version\n */\nexport function getRuntimeVersionNullable(\n config: Pick<ExpoConfigUpdates, 'runtimeVersion'>\n): string | null {\n try {\n return getRuntimeVersion(config, 'android');\n } catch (e) {\n return null;\n }\n}\n\nexport function getSDKVersion(config: Pick<ExpoConfigUpdates, 'sdkVersion'>): string | null {\n return typeof config.sdkVersion === 'string' ? config.sdkVersion : null;\n}\n\nexport function getUpdatesEnabled(config: Pick<ExpoConfigUpdates, 'updates'>): boolean {\n return config.updates?.enabled !== false;\n}\n\nexport function getUpdatesTimeout(config: Pick<ExpoConfigUpdates, 'updates'>): number {\n return config.updates?.fallbackToCacheTimeout ?? 0;\n}\n\nexport function getUpdatesCheckOnLaunch(\n config: Pick<ExpoConfigUpdates, 'updates'>\n): 'NEVER' | 'ALWAYS' {\n if (config.updates?.checkAutomatically === 'ON_ERROR_RECOVERY') {\n return 'NEVER';\n } else if (config.updates?.checkAutomatically === 'ON_LOAD') {\n return 'ALWAYS';\n }\n return 'ALWAYS';\n}\n\nexport function setUpdatesConfig(\n config: ExpoConfigUpdates,\n androidManifest: AndroidManifest,\n username: string | null\n): AndroidManifest {\n const mainApplication = getMainApplicationOrThrow(androidManifest);\n\n addMetaDataItemToMainApplication(\n mainApplication,\n Config.ENABLED,\n String(getUpdatesEnabled(config))\n );\n addMetaDataItemToMainApplication(\n mainApplication,\n Config.CHECK_ON_LAUNCH,\n getUpdatesCheckOnLaunch(config)\n );\n addMetaDataItemToMainApplication(\n mainApplication,\n Config.LAUNCH_WAIT_MS,\n String(getUpdatesTimeout(config))\n );\n\n const updateUrl = getUpdateUrl(config, username);\n if (updateUrl) {\n addMetaDataItemToMainApplication(mainApplication, Config.UPDATE_URL, updateUrl);\n } else {\n removeMetaDataItemFromMainApplication(mainApplication, Config.UPDATE_URL);\n }\n\n return setVersionsConfig(config, androidManifest);\n}\n\nexport function setVersionsConfig(\n config: Pick<ExpoConfigUpdates, 'sdkVersion' | 'runtimeVersion'>,\n androidManifest: AndroidManifest\n): AndroidManifest {\n const mainApplication = getMainApplicationOrThrow(androidManifest);\n\n const runtimeVersion = getRuntimeVersionNullable(config);\n const sdkVersion = getSDKVersion(config);\n if (runtimeVersion) {\n removeMetaDataItemFromMainApplication(mainApplication, Config.SDK_VERSION);\n addMetaDataItemToMainApplication(mainApplication, Config.RUNTIME_VERSION, runtimeVersion);\n } else if (sdkVersion) {\n removeMetaDataItemFromMainApplication(mainApplication, Config.RUNTIME_VERSION);\n addMetaDataItemToMainApplication(mainApplication, Config.SDK_VERSION, sdkVersion);\n } else {\n removeMetaDataItemFromMainApplication(mainApplication, Config.RUNTIME_VERSION);\n removeMetaDataItemFromMainApplication(mainApplication, Config.SDK_VERSION);\n }\n\n return androidManifest;\n}\nexport function ensureBuildGradleContainsConfigurationScript(\n projectRoot: string,\n buildGradleContents: string\n): string {\n if (!isBuildGradleConfigured(projectRoot, buildGradleContents)) {\n let cleanedUpBuildGradleContents;\n\n const isBuildGradleMisconfigured = buildGradleContents\n .split('\\n')\n .some(line => line.includes(CREATE_MANIFEST_ANDROID_PATH));\n if (isBuildGradleMisconfigured) {\n cleanedUpBuildGradleContents = buildGradleContents.replace(\n new RegExp(`(\\n// Integration with Expo updates)?\\n.*${CREATE_MANIFEST_ANDROID_PATH}.*\\n`),\n ''\n );\n } else {\n cleanedUpBuildGradleContents = buildGradleContents;\n }\n\n const gradleScriptApply = formatApplyLineForBuildGradle(projectRoot);\n return `${cleanedUpBuildGradleContents}\\n// Integration with Expo updates\\n${gradleScriptApply}\\n`;\n } else {\n return buildGradleContents;\n }\n}\n\nexport function formatApplyLineForBuildGradle(projectRoot: string): string {\n const updatesGradleScriptPath = resolveFrom.silent(projectRoot, CREATE_MANIFEST_ANDROID_PATH);\n\n if (!updatesGradleScriptPath) {\n throw new Error(\n \"Could not find the build script for Android. This could happen in case of outdated 'node_modules'. Run 'npm install' to make sure that it's up-to-date.\"\n );\n }\n\n const relativePath = path.relative(\n path.join(projectRoot, 'android', 'app'),\n updatesGradleScriptPath\n );\n const posixPath = process.platform === 'win32' ? relativePath.replace(/\\\\/g, '/') : relativePath;\n\n return `apply from: \"${posixPath}\"`;\n}\n\nexport function isBuildGradleConfigured(projectRoot: string, buildGradleContents: string): boolean {\n const androidBuildScript = formatApplyLineForBuildGradle(projectRoot);\n\n return (\n buildGradleContents\n .replace(/\\r\\n/g, '\\n')\n .split('\\n')\n // Check for both single and double quotes\n .some(line => line === androidBuildScript || line === androidBuildScript.replace(/\"/g, \"'\"))\n );\n}\n\nexport function isMainApplicationMetaDataSet(androidManifest: AndroidManifest): boolean {\n const updateUrl = getMainApplicationMetaDataValue(androidManifest, Config.UPDATE_URL);\n const runtimeVersion = getMainApplicationMetaDataValue(androidManifest, Config.RUNTIME_VERSION);\n const sdkVersion = getMainApplicationMetaDataValue(androidManifest, Config.SDK_VERSION);\n\n return Boolean(updateUrl && (sdkVersion || runtimeVersion));\n}\n\nexport function isMainApplicationMetaDataSynced(\n config: ExpoConfigUpdates,\n androidManifest: AndroidManifest,\n username: string | null\n): boolean {\n return (\n getUpdateUrl(config, username) ===\n getMainApplicationMetaDataValue(androidManifest, Config.UPDATE_URL) &&\n String(getUpdatesEnabled(config)) ===\n getMainApplicationMetaDataValue(androidManifest, Config.ENABLED) &&\n String(getUpdatesTimeout(config)) ===\n getMainApplicationMetaDataValue(androidManifest, Config.LAUNCH_WAIT_MS) &&\n getUpdatesCheckOnLaunch(config) ===\n getMainApplicationMetaDataValue(androidManifest, Config.CHECK_ON_LAUNCH) &&\n areVersionsSynced(config, androidManifest)\n );\n}\n\nexport function areVersionsSynced(\n config: Pick<ExpoConfigUpdates, 'runtimeVersion' | 'sdkVersion'>,\n androidManifest: AndroidManifest\n): boolean {\n const expectedRuntimeVersion = getRuntimeVersionNullable(config);\n const expectedSdkVersion = getSDKVersion(config);\n\n const currentRuntimeVersion = getMainApplicationMetaDataValue(\n androidManifest,\n Config.RUNTIME_VERSION\n );\n const currentSdkVersion = getMainApplicationMetaDataValue(androidManifest, Config.SDK_VERSION);\n\n if (expectedRuntimeVersion !== null) {\n return currentRuntimeVersion === expectedRuntimeVersion && currentSdkVersion === null;\n } else if (expectedSdkVersion !== null) {\n return currentSdkVersion === expectedSdkVersion && currentRuntimeVersion === null;\n } else {\n return true;\n }\n}\n"],"file":"Updates.js"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CodeBlock } from '../utils/commonCodeMod';
|
|
2
|
+
/**
|
|
3
|
+
* Find java or kotlin new class instance code block
|
|
4
|
+
*
|
|
5
|
+
* @param contents source contents
|
|
6
|
+
* @param classDeclaration class declaration or just a class name
|
|
7
|
+
* @param language 'java' | 'kt'
|
|
8
|
+
* @returns `CodeBlock` for start/end offset and code block contents
|
|
9
|
+
*/
|
|
10
|
+
export declare function findNewInstanceCodeBlock(contents: string, classDeclaration: string, language: 'java' | 'kt'): CodeBlock | null;
|
|
11
|
+
/**
|
|
12
|
+
* Append contents to the end of code declaration block, support class or method declarations.
|
|
13
|
+
*
|
|
14
|
+
* @param srcContents source contents
|
|
15
|
+
* @param declaration class declaration or method declaration
|
|
16
|
+
* @param insertion code to append
|
|
17
|
+
* @returns updated contents
|
|
18
|
+
*/
|
|
19
|
+
export declare function appendContentsInsideDeclarationBlock(srcContents: string, declaration: string, insertion: string): string;
|
|
20
|
+
export declare function addImports(source: string, imports: string[], isJava: boolean): string;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.findNewInstanceCodeBlock = findNewInstanceCodeBlock;
|
|
7
|
+
exports.appendContentsInsideDeclarationBlock = appendContentsInsideDeclarationBlock;
|
|
8
|
+
exports.addImports = addImports;
|
|
9
|
+
|
|
10
|
+
function _commonCodeMod() {
|
|
11
|
+
const data = require("../utils/commonCodeMod");
|
|
12
|
+
|
|
13
|
+
_commonCodeMod = function () {
|
|
14
|
+
return data;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function _matchBrackets() {
|
|
21
|
+
const data = require("../utils/matchBrackets");
|
|
22
|
+
|
|
23
|
+
_matchBrackets = function () {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Find java or kotlin new class instance code block
|
|
32
|
+
*
|
|
33
|
+
* @param contents source contents
|
|
34
|
+
* @param classDeclaration class declaration or just a class name
|
|
35
|
+
* @param language 'java' | 'kt'
|
|
36
|
+
* @returns `CodeBlock` for start/end offset and code block contents
|
|
37
|
+
*/
|
|
38
|
+
function findNewInstanceCodeBlock(contents, classDeclaration, language) {
|
|
39
|
+
const isJava = language === 'java';
|
|
40
|
+
let start = isJava ? contents.indexOf(` new ${classDeclaration}(`) : contents.search(new RegExp(` (object\\s*:\\s*)?${classDeclaration}\\(`));
|
|
41
|
+
|
|
42
|
+
if (start < 0) {
|
|
43
|
+
return null;
|
|
44
|
+
} // `+ 1` for the prefix space
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
start += 1;
|
|
48
|
+
let end = (0, _matchBrackets().findMatchingBracketPosition)(contents, '(', start); // For anonymous class, should search further to the {} block.
|
|
49
|
+
// ```java
|
|
50
|
+
// new Foo() {
|
|
51
|
+
// @Override
|
|
52
|
+
// protected void interfaceMethod {}
|
|
53
|
+
// };
|
|
54
|
+
// ```
|
|
55
|
+
//
|
|
56
|
+
// ```kotlin
|
|
57
|
+
// object : Foo() {
|
|
58
|
+
// override fun interfaceMethod {}
|
|
59
|
+
// }
|
|
60
|
+
// ```
|
|
61
|
+
|
|
62
|
+
const nextBrace = contents.indexOf('{', end + 1);
|
|
63
|
+
const isAnonymousClass = nextBrace >= end && !!contents.substring(end + 1, nextBrace).match(/^\s*$/m);
|
|
64
|
+
|
|
65
|
+
if (isAnonymousClass) {
|
|
66
|
+
end = (0, _matchBrackets().findMatchingBracketPosition)(contents, '{', end);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
start,
|
|
71
|
+
end,
|
|
72
|
+
code: contents.substring(start, end + 1)
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Append contents to the end of code declaration block, support class or method declarations.
|
|
77
|
+
*
|
|
78
|
+
* @param srcContents source contents
|
|
79
|
+
* @param declaration class declaration or method declaration
|
|
80
|
+
* @param insertion code to append
|
|
81
|
+
* @returns updated contents
|
|
82
|
+
*/
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
function appendContentsInsideDeclarationBlock(srcContents, declaration, insertion) {
|
|
86
|
+
const start = srcContents.search(new RegExp(`\\s*${declaration}.*?[\\(\\{]`));
|
|
87
|
+
|
|
88
|
+
if (start < 0) {
|
|
89
|
+
throw new Error(`Unable to find code block - declaration[${declaration}]`);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const end = (0, _matchBrackets().findMatchingBracketPosition)(srcContents, '{', start);
|
|
93
|
+
return (0, _commonCodeMod().insertContentsAtOffset)(srcContents, insertion, end);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function addImports(source, imports, isJava) {
|
|
97
|
+
const lines = source.split('\n');
|
|
98
|
+
const lineIndexWithPackageDeclaration = lines.findIndex(line => line.match(/^package .*;?$/));
|
|
99
|
+
|
|
100
|
+
for (const javaImport of imports) {
|
|
101
|
+
if (!source.includes(javaImport)) {
|
|
102
|
+
const importStatement = `import ${javaImport}${isJava ? ';' : ''}`;
|
|
103
|
+
lines.splice(lineIndexWithPackageDeclaration + 1, 0, importStatement);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return lines.join('\n');
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=codeMod.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/android/codeMod.ts"],"names":["findNewInstanceCodeBlock","contents","classDeclaration","language","isJava","start","indexOf","search","RegExp","end","nextBrace","isAnonymousClass","substring","match","code","appendContentsInsideDeclarationBlock","srcContents","declaration","insertion","Error","addImports","source","imports","lines","split","lineIndexWithPackageDeclaration","findIndex","line","javaImport","includes","importStatement","splice","join"],"mappings":";;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,wBAAT,CACLC,QADK,EAELC,gBAFK,EAGLC,QAHK,EAIa;AAClB,QAAMC,MAAM,GAAGD,QAAQ,KAAK,MAA5B;AACA,MAAIE,KAAK,GAAGD,MAAM,GACdH,QAAQ,CAACK,OAAT,CAAkB,QAAOJ,gBAAiB,GAA1C,CADc,GAEdD,QAAQ,CAACM,MAAT,CAAgB,IAAIC,MAAJ,CAAY,sBAAqBN,gBAAiB,KAAlD,CAAhB,CAFJ;;AAGA,MAAIG,KAAK,GAAG,CAAZ,EAAe;AACb,WAAO,IAAP;AACD,GAPiB,CAQlB;;;AACAA,EAAAA,KAAK,IAAI,CAAT;AACA,MAAII,GAAG,GAAG,kDAA4BR,QAA5B,EAAsC,GAAtC,EAA2CI,KAA3C,CAAV,CAVkB,CAYlB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,QAAMK,SAAS,GAAGT,QAAQ,CAACK,OAAT,CAAiB,GAAjB,EAAsBG,GAAG,GAAG,CAA5B,CAAlB;AACA,QAAME,gBAAgB,GACpBD,SAAS,IAAID,GAAb,IAAoB,CAAC,CAACR,QAAQ,CAACW,SAAT,CAAmBH,GAAG,GAAG,CAAzB,EAA4BC,SAA5B,EAAuC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Q,MAAN,CAAaN,+BAA+B,GAAG,CAA/C,EAAkD,CAAlD,EAAqDK,eAArD;AACD;AACF;;AACD,SAAOP,KAAK,CAACS,IAAN,CAAW,IAAX,CAAP;AACD","sourcesContent":["import { CodeBlock, insertContentsAtOffset } from '../utils/commonCodeMod';\nimport { findMatchingBracketPosition } from '../utils/matchBrackets';\n\n/**\n * Find java or kotlin new class instance code block\n *\n * @param contents source contents\n * @param classDeclaration class declaration or just a class name\n * @param language 'java' | 'kt'\n * @returns `CodeBlock` for start/end offset and code block contents\n */\nexport function findNewInstanceCodeBlock(\n contents: string,\n classDeclaration: string,\n language: 'java' | 'kt'\n): CodeBlock | null {\n const isJava = language === 'java';\n let start = isJava\n ? contents.indexOf(` new ${classDeclaration}(`)\n : contents.search(new RegExp(` (object\\\\s*:\\\\s*)?${classDeclaration}\\\\(`));\n if (start < 0) {\n return null;\n }\n // `+ 1` for the prefix space\n start += 1;\n let end = findMatchingBracketPosition(contents, '(', start);\n\n // For anonymous class, should search further to the {} block.\n // ```java\n // new Foo() {\n // @Override\n // protected void interfaceMethod {}\n // };\n // ```\n //\n // ```kotlin\n // object : Foo() {\n // override fun interfaceMethod {}\n // }\n // ```\n const nextBrace = contents.indexOf('{', end + 1);\n const isAnonymousClass =\n nextBrace >= end && !!contents.substring(end + 1, nextBrace).match(/^\\s*$/m);\n if (isAnonymousClass) {\n end = findMatchingBracketPosition(contents, '{', end);\n }\n\n return {\n start,\n end,\n code: contents.substring(start, end + 1),\n };\n}\n\n/**\n * Append contents to the end of code declaration block, support class or method declarations.\n *\n * @param srcContents source contents\n * @param declaration class declaration or method declaration\n * @param insertion code to append\n * @returns updated contents\n */\nexport function appendContentsInsideDeclarationBlock(\n srcContents: string,\n declaration: string,\n insertion: string\n): string {\n const start = srcContents.search(new RegExp(`\\\\s*${declaration}.*?[\\\\(\\\\{]`));\n if (start < 0) {\n throw new Error(`Unable to find code block - declaration[${declaration}]`);\n }\n const end = findMatchingBracketPosition(srcContents, '{', start);\n return insertContentsAtOffset(srcContents, insertion, end);\n}\n\nexport function addImports(source: string, imports: string[], isJava: boolean): string {\n const lines = source.split('\\n');\n const lineIndexWithPackageDeclaration = lines.findIndex(line => line.match(/^package .*;?$/));\n for (const javaImport of imports) {\n if (!source.includes(javaImport)) {\n const importStatement = `import ${javaImport}${isJava ? ';' : ''}`;\n lines.splice(lineIndexWithPackageDeclaration + 1, 0, importStatement);\n }\n }\n return lines.join('\\n');\n}\n"],"file":"codeMod.js"}
|
package/build/android/index.d.ts
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import * as AllowBackup from './AllowBackup';
|
|
2
|
-
import * as Branch from './Branch';
|
|
3
2
|
import * as Colors from './Colors';
|
|
4
3
|
import * as EasBuild from './EasBuild';
|
|
5
|
-
import * as Facebook from './Facebook';
|
|
6
4
|
import * as GoogleMapsApiKey from './GoogleMapsApiKey';
|
|
7
5
|
import * as GoogleServices from './GoogleServices';
|
|
8
6
|
import * as IntentFilters from './IntentFilters';
|
|
9
7
|
import * as JsEngine from './JsEngine';
|
|
10
8
|
import * as Manifest from './Manifest';
|
|
11
9
|
import * as Name from './Name';
|
|
12
|
-
import * as NavigationBar from './NavigationBar';
|
|
13
10
|
import * as Orientation from './Orientation';
|
|
14
11
|
import * as Package from './Package';
|
|
15
12
|
import * as Paths from './Paths';
|
|
@@ -17,13 +14,12 @@ import * as Permissions from './Permissions';
|
|
|
17
14
|
import * as PrimaryColor from './PrimaryColor';
|
|
18
15
|
import * as Properties from './Properties';
|
|
19
16
|
import * as Resources from './Resources';
|
|
20
|
-
import * as RootViewBackgroundColor from './RootViewBackgroundColor';
|
|
21
17
|
import * as Scheme from './Scheme';
|
|
22
18
|
import * as StatusBar from './StatusBar';
|
|
23
19
|
import * as Strings from './Strings';
|
|
24
20
|
import * as Styles from './Styles';
|
|
25
21
|
import * as Updates from './Updates';
|
|
26
|
-
import * as UserInterfaceStyle from './UserInterfaceStyle';
|
|
27
22
|
import * as Version from './Version';
|
|
28
23
|
import * as WindowSoftInputMode from './WindowSoftInputMode';
|
|
29
|
-
export {
|
|
24
|
+
export { Manifest, Colors, Paths, Permissions, Properties, Resources, Scheme, Strings, Styles };
|
|
25
|
+
export { AllowBackup, EasBuild, GoogleMapsApiKey, GoogleServices, IntentFilters, Name, Orientation, Package, PrimaryColor, StatusBar, Updates, Version, JsEngine, WindowSoftInputMode, };
|
package/build/android/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.WindowSoftInputMode = exports.Version = exports.
|
|
6
|
+
exports.WindowSoftInputMode = exports.Version = exports.Updates = exports.Styles = exports.Strings = exports.StatusBar = exports.Scheme = exports.Resources = exports.Properties = exports.PrimaryColor = exports.Permissions = exports.Paths = exports.Package = exports.Orientation = exports.Name = exports.Manifest = exports.JsEngine = exports.IntentFilters = exports.GoogleServices = exports.GoogleMapsApiKey = exports.EasBuild = exports.Colors = exports.AllowBackup = void 0;
|
|
7
7
|
|
|
8
8
|
function AllowBackup() {
|
|
9
9
|
const data = _interopRequireWildcard(require("./AllowBackup"));
|
|
@@ -22,23 +22,6 @@ Object.defineProperty(exports, "AllowBackup", {
|
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
function Branch() {
|
|
26
|
-
const data = _interopRequireWildcard(require("./Branch"));
|
|
27
|
-
|
|
28
|
-
Branch = function () {
|
|
29
|
-
return data;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
return data;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
Object.defineProperty(exports, "Branch", {
|
|
36
|
-
enumerable: true,
|
|
37
|
-
get: function () {
|
|
38
|
-
return Branch();
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
|
|
42
25
|
function Colors() {
|
|
43
26
|
const data = _interopRequireWildcard(require("./Colors"));
|
|
44
27
|
|
|
@@ -73,23 +56,6 @@ Object.defineProperty(exports, "EasBuild", {
|
|
|
73
56
|
}
|
|
74
57
|
});
|
|
75
58
|
|
|
76
|
-
function Facebook() {
|
|
77
|
-
const data = _interopRequireWildcard(require("./Facebook"));
|
|
78
|
-
|
|
79
|
-
Facebook = function () {
|
|
80
|
-
return data;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
return data;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
Object.defineProperty(exports, "Facebook", {
|
|
87
|
-
enumerable: true,
|
|
88
|
-
get: function () {
|
|
89
|
-
return Facebook();
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
|
|
93
59
|
function GoogleMapsApiKey() {
|
|
94
60
|
const data = _interopRequireWildcard(require("./GoogleMapsApiKey"));
|
|
95
61
|
|
|
@@ -192,23 +158,6 @@ Object.defineProperty(exports, "Name", {
|
|
|
192
158
|
}
|
|
193
159
|
});
|
|
194
160
|
|
|
195
|
-
function NavigationBar() {
|
|
196
|
-
const data = _interopRequireWildcard(require("./NavigationBar"));
|
|
197
|
-
|
|
198
|
-
NavigationBar = function () {
|
|
199
|
-
return data;
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
return data;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
Object.defineProperty(exports, "NavigationBar", {
|
|
206
|
-
enumerable: true,
|
|
207
|
-
get: function () {
|
|
208
|
-
return NavigationBar();
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
|
|
212
161
|
function Orientation() {
|
|
213
162
|
const data = _interopRequireWildcard(require("./Orientation"));
|
|
214
163
|
|
|
@@ -328,23 +277,6 @@ Object.defineProperty(exports, "Resources", {
|
|
|
328
277
|
}
|
|
329
278
|
});
|
|
330
279
|
|
|
331
|
-
function RootViewBackgroundColor() {
|
|
332
|
-
const data = _interopRequireWildcard(require("./RootViewBackgroundColor"));
|
|
333
|
-
|
|
334
|
-
RootViewBackgroundColor = function () {
|
|
335
|
-
return data;
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
return data;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
Object.defineProperty(exports, "RootViewBackgroundColor", {
|
|
342
|
-
enumerable: true,
|
|
343
|
-
get: function () {
|
|
344
|
-
return RootViewBackgroundColor();
|
|
345
|
-
}
|
|
346
|
-
});
|
|
347
|
-
|
|
348
280
|
function Scheme() {
|
|
349
281
|
const data = _interopRequireWildcard(require("./Scheme"));
|
|
350
282
|
|
|
@@ -430,23 +362,6 @@ Object.defineProperty(exports, "Updates", {
|
|
|
430
362
|
}
|
|
431
363
|
});
|
|
432
364
|
|
|
433
|
-
function UserInterfaceStyle() {
|
|
434
|
-
const data = _interopRequireWildcard(require("./UserInterfaceStyle"));
|
|
435
|
-
|
|
436
|
-
UserInterfaceStyle = function () {
|
|
437
|
-
return data;
|
|
438
|
-
};
|
|
439
|
-
|
|
440
|
-
return data;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
Object.defineProperty(exports, "UserInterfaceStyle", {
|
|
444
|
-
enumerable: true,
|
|
445
|
-
get: function () {
|
|
446
|
-
return UserInterfaceStyle();
|
|
447
|
-
}
|
|
448
|
-
});
|
|
449
|
-
|
|
450
365
|
function Version() {
|
|
451
366
|
const data = _interopRequireWildcard(require("./Version"));
|
|
452
367
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/android/index.ts"],"names":[],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;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;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA","sourcesContent":["import * as AllowBackup from './AllowBackup';\nimport * as Colors from './Colors';\nimport * as EasBuild from './EasBuild';\nimport * as GoogleMapsApiKey from './GoogleMapsApiKey';\nimport * as GoogleServices from './GoogleServices';\nimport * as IntentFilters from './IntentFilters';\nimport * as JsEngine from './JsEngine';\nimport * as Manifest from './Manifest';\nimport * as Name from './Name';\nimport * as Orientation from './Orientation';\nimport * as Package from './Package';\nimport * as Paths from './Paths';\nimport * as Permissions from './Permissions';\nimport * as PrimaryColor from './PrimaryColor';\nimport * as Properties from './Properties';\nimport * as Resources from './Resources';\nimport * as Scheme from './Scheme';\nimport * as StatusBar from './StatusBar';\nimport * as Strings from './Strings';\nimport * as Styles from './Styles';\nimport * as Updates from './Updates';\nimport * as Version from './Version';\nimport * as WindowSoftInputMode from './WindowSoftInputMode';\n\nexport { Manifest, Colors, Paths, Permissions, Properties, Resources, Scheme, Strings, Styles };\n\nexport {\n AllowBackup,\n EasBuild,\n GoogleMapsApiKey,\n GoogleServices,\n IntentFilters,\n Name,\n Orientation,\n Package,\n PrimaryColor,\n StatusBar,\n Updates,\n Version,\n JsEngine,\n WindowSoftInputMode,\n};\n"],"file":"index.js"}
|
package/build/index.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export { withRunOnce, createRunOncePlugin } from './plugins/withRunOnce';
|
|
|
21
21
|
export { withDangerousMod } from './plugins/withDangerousMod';
|
|
22
22
|
export { withMod, withBaseMod } from './plugins/withMod';
|
|
23
23
|
export { withAppDelegate, withInfoPlist, withEntitlementsPlist, withExpoPlist, withXcodeProject, } from './plugins/ios-plugins';
|
|
24
|
-
export { withAndroidManifest, withStringsXml, withAndroidColors, withAndroidColorsNight, withAndroidStyles, withMainActivity, withProjectBuildGradle, withAppBuildGradle, withSettingsGradle, withGradleProperties, } from './plugins/android-plugins';
|
|
24
|
+
export { withAndroidManifest, withStringsXml, withAndroidColors, withAndroidColorsNight, withAndroidStyles, withMainActivity, withMainApplication, withProjectBuildGradle, withAppBuildGradle, withSettingsGradle, withGradleProperties, } from './plugins/android-plugins';
|
|
25
25
|
export { withStaticPlugin } from './plugins/withStaticPlugin';
|
|
26
26
|
export { compileModsAsync, withDefaultBaseMods, evalModsAsync } from './plugins/mod-compiler';
|
|
27
27
|
export { PluginError } from './utils/errors';
|
package/build/index.js
CHANGED
|
@@ -28,6 +28,7 @@ var _exportNames = {
|
|
|
28
28
|
withAndroidColorsNight: true,
|
|
29
29
|
withAndroidStyles: true,
|
|
30
30
|
withMainActivity: true,
|
|
31
|
+
withMainApplication: true,
|
|
31
32
|
withProjectBuildGradle: true,
|
|
32
33
|
withAppBuildGradle: true,
|
|
33
34
|
withSettingsGradle: true,
|
|
@@ -140,6 +141,12 @@ Object.defineProperty(exports, "withMainActivity", {
|
|
|
140
141
|
return _androidPlugins().withMainActivity;
|
|
141
142
|
}
|
|
142
143
|
});
|
|
144
|
+
Object.defineProperty(exports, "withMainApplication", {
|
|
145
|
+
enumerable: true,
|
|
146
|
+
get: function () {
|
|
147
|
+
return _androidPlugins().withMainApplication;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
143
150
|
Object.defineProperty(exports, "withProjectBuildGradle", {
|
|
144
151
|
enumerable: true,
|
|
145
152
|
get: function () {
|
|
@@ -439,6 +446,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
439
446
|
/**
|
|
440
447
|
* For internal use in Expo CLI
|
|
441
448
|
*/
|
|
449
|
+
// TODO: Remove
|
|
442
450
|
|
|
443
451
|
/**
|
|
444
452
|
* These are the "config-plugins"
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":["BaseMods","withGeneratedBaseMods","provider","withAndroidBaseMods","getAndroidModFileProviders","withIosBaseMods","getIosModFileProviders"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["BaseMods","withGeneratedBaseMods","provider","withAndroidBaseMods","getAndroidModFileProviders","withIosBaseMods","getIosModFileProviders"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAQA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAcA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;AA1DA;AACA;AACA;AAUA;;AAOA;AACA;AACA;AAuCO,MAAMA,QAAQ,GAAG;AACtBC,EAAAA,qBAAqB,EAArBA,sCADsB;AAEtBC,EAAAA,QAAQ,EAARA,yBAFsB;AAGtBC,EAAAA,mBAAmB,EAAnBA,0CAHsB;AAItBC,EAAAA,0BAA0B,EAA1BA,iDAJsB;AAKtBC,EAAAA,eAAe,EAAfA,kCALsB;AAMtBC,EAAAA,sBAAsB,EAAtBA;AANsB,CAAjB","sourcesContent":["/**\n * For internal use in Expo CLI\n */\nimport * as AndroidConfig from './android';\nimport * as IOSConfig from './ios';\nimport { provider, withGeneratedBaseMods } from './plugins/createBaseMod';\nimport { getAndroidModFileProviders, withAndroidBaseMods } from './plugins/withAndroidBaseMods';\nimport { getIosModFileProviders, withIosBaseMods } from './plugins/withIosBaseMods';\nimport * as XML from './utils/XML';\nimport * as History from './utils/history';\nimport * as WarningAggregator from './utils/warnings';\n\n// TODO: Remove\nexport * as Updates from './utils/Updates';\n\nexport { IOSConfig, AndroidConfig };\n\nexport { WarningAggregator, History, XML };\n\n/**\n * These are the \"config-plugins\"\n */\n\nexport * from './Plugin.types';\n\nexport { withPlugins } from './plugins/withPlugins';\n\nexport { withRunOnce, createRunOncePlugin } from './plugins/withRunOnce';\n\nexport { withDangerousMod } from './plugins/withDangerousMod';\nexport { withMod, withBaseMod } from './plugins/withMod';\n\nexport {\n withAppDelegate,\n withInfoPlist,\n withEntitlementsPlist,\n withExpoPlist,\n withXcodeProject,\n} from './plugins/ios-plugins';\n\nexport {\n withAndroidManifest,\n withStringsXml,\n withAndroidColors,\n withAndroidColorsNight,\n withAndroidStyles,\n withMainActivity,\n withMainApplication,\n withProjectBuildGradle,\n withAppBuildGradle,\n withSettingsGradle,\n withGradleProperties,\n} from './plugins/android-plugins';\n\nexport { withStaticPlugin } from './plugins/withStaticPlugin';\n\nexport { compileModsAsync, withDefaultBaseMods, evalModsAsync } from './plugins/mod-compiler';\n\nexport { PluginError } from './utils/errors';\n\nexport const BaseMods = {\n withGeneratedBaseMods,\n provider,\n withAndroidBaseMods,\n getAndroidModFileProviders,\n withIosBaseMods,\n getIosModFileProviders,\n};\n"],"file":"index.js"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ExpoConfig } from '@expo/config-types';
|
|
2
|
+
import { XcodeProject } from 'xcode';
|
|
3
|
+
import { ConfigPlugin } from '../Plugin.types';
|
|
4
|
+
declare type Bitcode = NonNullable<ExpoConfig['ios']>['bitcode'];
|
|
5
|
+
/**
|
|
6
|
+
* Plugin to set a bitcode preference for the Xcode project
|
|
7
|
+
* based on the project's Expo config `ios.bitcode` value.
|
|
8
|
+
*/
|
|
9
|
+
export declare const withBitcode: ConfigPlugin;
|
|
10
|
+
/**
|
|
11
|
+
* Plugin to set a custom bitcode preference for the Xcode project.
|
|
12
|
+
* Does not read from the Expo config `ios.bitcode`.
|
|
13
|
+
*
|
|
14
|
+
* @param bitcode custom bitcode setting.
|
|
15
|
+
*/
|
|
16
|
+
export declare const withCustomBitcode: ConfigPlugin<Bitcode>;
|
|
17
|
+
/**
|
|
18
|
+
* Get the bitcode preference from the Expo config.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getBitcode(config: Pick<ExpoConfig, 'ios'>): Bitcode;
|
|
21
|
+
/**
|
|
22
|
+
* Enable or disable the `ENABLE_BITCODE` property of the project configurations.
|
|
23
|
+
*/
|
|
24
|
+
export declare function setBitcodeWithConfig(config: Pick<ExpoConfig, 'ios'>, { project }: {
|
|
25
|
+
project: XcodeProject;
|
|
26
|
+
}): XcodeProject;
|
|
27
|
+
/**
|
|
28
|
+
* Enable or disable the `ENABLE_BITCODE` property.
|
|
29
|
+
*/
|
|
30
|
+
export declare function setBitcode(bitcode: Bitcode, { project }: {
|
|
31
|
+
project: XcodeProject;
|
|
32
|
+
}): XcodeProject;
|
|
33
|
+
export {};
|