@expo/config-plugins 5.0.3 → 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.
- package/build/Plugin.types.d.ts +7 -7
- package/build/Plugin.types.js +0 -9
- package/build/Plugin.types.js.map +1 -1
- package/build/android/AllowBackup.js +0 -15
- package/build/android/AllowBackup.js.map +1 -1
- package/build/android/BuildProperties.js +2 -16
- package/build/android/BuildProperties.js.map +1 -1
- package/build/android/Colors.js +3 -25
- package/build/android/Colors.js.map +1 -1
- package/build/android/EasBuild.js +2 -22
- package/build/android/EasBuild.js.map +1 -1
- package/build/android/EasBuildGradleScript.js.map +1 -1
- package/build/android/GoogleMapsApiKey.js +0 -12
- package/build/android/GoogleMapsApiKey.js.map +1 -1
- package/build/android/GoogleServices.js +10 -48
- package/build/android/GoogleServices.js.map +1 -1
- package/build/android/IntentFilters.d.ts +1 -1
- package/build/android/IntentFilters.js +8 -24
- package/build/android/IntentFilters.js.map +1 -1
- package/build/android/Manifest.d.ts +19 -19
- package/build/android/Manifest.js +7 -66
- package/build/android/Manifest.js.map +1 -1
- package/build/android/Name.js +6 -27
- package/build/android/Name.js.map +1 -1
- package/build/android/Orientation.js +2 -12
- package/build/android/Orientation.js.map +1 -1
- package/build/android/Package.js +26 -111
- package/build/android/Package.js.map +1 -1
- package/build/android/Paths.d.ts +2 -2
- package/build/android/Paths.js +0 -47
- package/build/android/Paths.js.map +1 -1
- package/build/android/Permissions.js +8 -52
- package/build/android/Permissions.js.map +1 -1
- package/build/android/PrimaryColor.js +0 -18
- package/build/android/PrimaryColor.js.map +1 -1
- package/build/android/Properties.d.ts +1 -1
- package/build/android/Properties.js +0 -9
- package/build/android/Properties.js.map +1 -1
- package/build/android/Resources.d.ts +4 -4
- package/build/android/Resources.js +9 -29
- package/build/android/Resources.js.map +1 -1
- package/build/android/Scheme.d.ts +1 -1
- package/build/android/Scheme.js +13 -66
- package/build/android/Scheme.js.map +1 -1
- package/build/android/StatusBar.js +5 -33
- package/build/android/StatusBar.js.map +1 -1
- package/build/android/Strings.js +0 -14
- package/build/android/Strings.js.map +1 -1
- package/build/android/Styles.js +7 -34
- package/build/android/Styles.js.map +1 -1
- package/build/android/Updates.d.ts +2 -0
- package/build/android/Updates.js +50 -47
- package/build/android/Updates.js.map +1 -1
- package/build/android/Version.js +3 -29
- package/build/android/Version.js.map +1 -1
- package/build/android/WindowSoftInputMode.js +0 -14
- package/build/android/WindowSoftInputMode.js.map +1 -1
- package/build/android/codeMod.js +6 -22
- package/build/android/codeMod.js.map +1 -1
- package/build/android/index.js +0 -94
- package/build/android/index.js.map +1 -1
- package/build/index.js +2 -65
- package/build/index.js.map +1 -1
- package/build/ios/Bitcode.d.ts +1 -1
- package/build/ios/Bitcode.js +8 -28
- package/build/ios/Bitcode.js.map +1 -1
- package/build/ios/BuildProperties.js +2 -14
- package/build/ios/BuildProperties.js.map +1 -1
- package/build/ios/BuildScheme.js +2 -34
- package/build/ios/BuildScheme.js.map +1 -1
- package/build/ios/BundleIdentifier.js +13 -72
- package/build/ios/BundleIdentifier.js.map +1 -1
- package/build/ios/DeviceFamily.js +6 -24
- package/build/ios/DeviceFamily.js.map +1 -1
- package/build/ios/Entitlements.js +4 -45
- package/build/ios/Entitlements.js.map +1 -1
- package/build/ios/Google.d.ts +2 -2
- package/build/ios/Google.js +11 -66
- package/build/ios/Google.js.map +1 -1
- package/build/ios/IosConfig.types.d.ts +6 -11
- package/build/ios/IosConfig.types.js.map +1 -1
- package/build/ios/Locales.d.ts +3 -3
- package/build/ios/Locales.js +12 -43
- package/build/ios/Locales.js.map +1 -1
- package/build/ios/Maps.js +15 -53
- package/build/ios/Maps.js.map +1 -1
- package/build/ios/Name.js +7 -31
- package/build/ios/Name.js.map +1 -1
- package/build/ios/Orientation.js +2 -10
- package/build/ios/Orientation.js.map +1 -1
- package/build/ios/Paths.d.ts +2 -2
- package/build/ios/Paths.js +8 -73
- package/build/ios/Paths.js.map +1 -1
- package/build/ios/Permissions.js +1 -16
- package/build/ios/Permissions.js.map +1 -1
- package/build/ios/ProvisioningProfile.d.ts +1 -1
- package/build/ios/ProvisioningProfile.js +0 -18
- package/build/ios/ProvisioningProfile.js.map +1 -1
- package/build/ios/RequiresFullScreen.js +19 -31
- package/build/ios/RequiresFullScreen.js.map +1 -1
- package/build/ios/Scheme.js +12 -34
- package/build/ios/Scheme.js.map +1 -1
- package/build/ios/Swift.js +16 -50
- package/build/ios/Swift.js.map +1 -1
- package/build/ios/Target.js +0 -30
- package/build/ios/Target.js.map +1 -1
- package/build/ios/Updates.js +10 -49
- package/build/ios/Updates.js.map +1 -1
- package/build/ios/UsesNonExemptEncryption.js +4 -10
- package/build/ios/UsesNonExemptEncryption.js.map +1 -1
- package/build/ios/Version.js +4 -11
- package/build/ios/Version.js.map +1 -1
- package/build/ios/XcodeProjectFile.js +5 -23
- package/build/ios/XcodeProjectFile.js.map +1 -1
- package/build/ios/codeMod.js +19 -60
- package/build/ios/codeMod.js.map +1 -1
- package/build/ios/index.js +0 -97
- package/build/ios/index.js.map +1 -1
- package/build/ios/utils/Xcodeproj.d.ts +6 -6
- package/build/ios/utils/Xcodeproj.js +15 -101
- package/build/ios/utils/Xcodeproj.js.map +1 -1
- package/build/ios/utils/getInfoPlistPath.js +2 -15
- package/build/ios/utils/getInfoPlistPath.js.map +1 -1
- package/build/ios/utils/string.js +0 -1
- package/build/ios/utils/string.js.map +1 -1
- package/build/plugins/android-plugins.d.ts +2 -2
- package/build/plugins/android-plugins.js +11 -42
- package/build/plugins/android-plugins.js.map +1 -1
- package/build/plugins/createBaseMod.d.ts +3 -3
- package/build/plugins/createBaseMod.js +8 -25
- package/build/plugins/createBaseMod.js.map +1 -1
- package/build/plugins/ios-plugins.d.ts +2 -2
- package/build/plugins/ios-plugins.js +8 -48
- package/build/plugins/ios-plugins.js.map +1 -1
- package/build/plugins/mod-compiler.js +21 -72
- package/build/plugins/mod-compiler.js.map +1 -1
- package/build/plugins/withAndroidBaseMods.d.ts +1 -1
- package/build/plugins/withAndroidBaseMods.js +4 -89
- package/build/plugins/withAndroidBaseMods.js.map +1 -1
- package/build/plugins/withDangerousMod.js +0 -5
- package/build/plugins/withDangerousMod.js.map +1 -1
- package/build/plugins/withIosBaseMods.d.ts +1 -1
- package/build/plugins/withIosBaseMods.js +26 -118
- package/build/plugins/withIosBaseMods.js.map +1 -1
- package/build/plugins/withMod.d.ts +1 -1
- package/build/plugins/withMod.js +24 -59
- package/build/plugins/withMod.js.map +1 -1
- package/build/plugins/withPlugins.js +0 -9
- package/build/plugins/withPlugins.js.map +1 -1
- package/build/plugins/withRunOnce.js +3 -9
- package/build/plugins/withRunOnce.js.map +1 -1
- package/build/plugins/withStaticPlugin.js +21 -43
- package/build/plugins/withStaticPlugin.js.map +1 -1
- package/build/utils/BuildProperties.types.d.ts +2 -2
- package/build/utils/BuildProperties.types.js.map +1 -1
- package/build/utils/Updates.d.ts +3 -1
- package/build/utils/Updates.js +18 -77
- package/build/utils/Updates.js.map +1 -1
- package/build/utils/XML.d.ts +1 -1
- package/build/utils/XML.js +7 -44
- package/build/utils/XML.js.map +1 -1
- package/build/utils/commonCodeMod.js +2 -10
- package/build/utils/commonCodeMod.js.map +1 -1
- package/build/utils/errors.d.ts +1 -1
- package/build/utils/errors.js +3 -11
- package/build/utils/errors.js.map +1 -1
- package/build/utils/fs.js +1 -12
- package/build/utils/fs.js.map +1 -1
- package/build/utils/generateCode.d.ts +1 -1
- package/build/utils/generateCode.js +8 -25
- package/build/utils/generateCode.js.map +1 -1
- package/build/utils/history.d.ts +1 -1
- package/build/utils/history.js +0 -6
- package/build/utils/history.js.map +1 -1
- package/build/utils/matchBrackets.d.ts +3 -3
- package/build/utils/matchBrackets.js +2 -17
- package/build/utils/matchBrackets.js.map +1 -1
- package/build/utils/modules.js +0 -10
- package/build/utils/modules.js.map +1 -1
- package/build/utils/obj.js +0 -4
- package/build/utils/obj.js.map +1 -1
- package/build/utils/plugin-resolver.js +25 -69
- package/build/utils/plugin-resolver.js.map +1 -1
- package/build/utils/sortObject.js +4 -10
- package/build/utils/sortObject.js.map +1 -1
- package/build/utils/versions.js +0 -10
- package/build/utils/versions.js.map +1 -1
- package/build/utils/warnings.js +1 -9
- package/build/utils/warnings.js.map +1 -1
- package/package.json +5 -5
package/build/Plugin.types.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ import * as AndroidPaths from './android/Paths';
|
|
|
7
7
|
import { ResourceXML } from './android/Resources';
|
|
8
8
|
import { ExpoPlist, InfoPlist } from './ios/IosConfig.types';
|
|
9
9
|
import { AppDelegateProjectFile } from './ios/Paths';
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
type OptionalPromise<T> = Promise<T> | T;
|
|
11
|
+
type Plist = JSONObject;
|
|
12
12
|
export interface ModProps<T = any> {
|
|
13
13
|
/**
|
|
14
14
|
* Project root directory for the universal app.
|
|
@@ -60,10 +60,10 @@ export interface ExportedConfigWithProps<Data = any> extends ExportedConfig {
|
|
|
60
60
|
/**
|
|
61
61
|
* A helper type to get the properties of a plugin.
|
|
62
62
|
*/
|
|
63
|
-
export
|
|
64
|
-
export
|
|
65
|
-
export
|
|
66
|
-
export
|
|
63
|
+
export type PluginParameters<T extends ConfigPlugin<any>> = T extends (config: any, props: infer P) => any ? P : never;
|
|
64
|
+
export type ConfigPlugin<Props = void> = (config: ExpoConfig, props: Props) => ExpoConfig;
|
|
65
|
+
export type StaticPlugin<T = any> = [string | ConfigPlugin<T>, T];
|
|
66
|
+
export type Mod<Props = any> = ((config: ExportedConfigWithProps<Props>) => OptionalPromise<ExportedConfigWithProps<Props>>) & {
|
|
67
67
|
/**
|
|
68
68
|
* Indicates that the mod provides data upstream to other mods.
|
|
69
69
|
* This mod should always be the last one added.
|
|
@@ -159,5 +159,5 @@ export interface ModConfig {
|
|
|
159
159
|
podfileProperties?: Mod<Record<string, string>>;
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
|
-
export
|
|
162
|
+
export type ModPlatform = keyof ModConfig;
|
|
163
163
|
export { XcodeProject, InfoPlist, ExpoPlist, AndroidManifest };
|
package/build/Plugin.types.js
CHANGED
|
@@ -27,34 +27,25 @@ Object.defineProperty(exports, "XcodeProject", {
|
|
|
27
27
|
return _xcode().XcodeProject;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
|
|
31
30
|
function _xcode() {
|
|
32
31
|
const data = require("xcode");
|
|
33
|
-
|
|
34
32
|
_xcode = function () {
|
|
35
33
|
return data;
|
|
36
34
|
};
|
|
37
|
-
|
|
38
35
|
return data;
|
|
39
36
|
}
|
|
40
|
-
|
|
41
37
|
function _Manifest() {
|
|
42
38
|
const data = require("./android/Manifest");
|
|
43
|
-
|
|
44
39
|
_Manifest = function () {
|
|
45
40
|
return data;
|
|
46
41
|
};
|
|
47
|
-
|
|
48
42
|
return data;
|
|
49
43
|
}
|
|
50
|
-
|
|
51
44
|
function _IosConfig() {
|
|
52
45
|
const data = require("./ios/IosConfig.types");
|
|
53
|
-
|
|
54
46
|
_IosConfig = function () {
|
|
55
47
|
return data;
|
|
56
48
|
};
|
|
57
|
-
|
|
58
49
|
return data;
|
|
59
50
|
}
|
|
60
51
|
//# sourceMappingURL=Plugin.types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Plugin.types.js","names":[],"sources":["../src/Plugin.types.ts"],"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 * A frozen representation of the original file contents,\n * this can be used as a reference into the user's original intent.\n *\n * For example, you could infer that the user defined a certain\n * value explicitly and disable any automatic changes.\n */\n readonly modRawConfig: ExpoConfig;\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"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Plugin.types.js","names":[],"sources":["../src/Plugin.types.ts"],"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 * A frozen representation of the original file contents,\n * this can be used as a reference into the user's original intent.\n *\n * For example, you could infer that the user defined a certain\n * value explicitly and disable any automatic changes.\n */\n readonly modRawConfig: ExpoConfig;\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA"}
|
|
@@ -7,56 +7,41 @@ exports.getAllowBackup = getAllowBackup;
|
|
|
7
7
|
exports.getAllowBackupFromManifest = getAllowBackupFromManifest;
|
|
8
8
|
exports.setAllowBackup = setAllowBackup;
|
|
9
9
|
exports.withAllowBackup = void 0;
|
|
10
|
-
|
|
11
10
|
function _androidPlugins() {
|
|
12
11
|
const data = require("../plugins/android-plugins");
|
|
13
|
-
|
|
14
12
|
_androidPlugins = function () {
|
|
15
13
|
return data;
|
|
16
14
|
};
|
|
17
|
-
|
|
18
15
|
return data;
|
|
19
16
|
}
|
|
20
|
-
|
|
21
17
|
function _Manifest() {
|
|
22
18
|
const data = require("./Manifest");
|
|
23
|
-
|
|
24
19
|
_Manifest = function () {
|
|
25
20
|
return data;
|
|
26
21
|
};
|
|
27
|
-
|
|
28
22
|
return data;
|
|
29
23
|
}
|
|
30
|
-
|
|
31
24
|
const withAllowBackup = (0, _androidPlugins().createAndroidManifestPlugin)(setAllowBackup, 'withAllowBackup');
|
|
32
25
|
exports.withAllowBackup = withAllowBackup;
|
|
33
|
-
|
|
34
26
|
function getAllowBackup(config) {
|
|
35
27
|
var _config$android$allow, _config$android;
|
|
36
|
-
|
|
37
28
|
// Defaults to true.
|
|
38
29
|
// https://docs.expo.dev/versions/latest/config/app/#allowbackup
|
|
39
30
|
return (_config$android$allow = (_config$android = config.android) === null || _config$android === void 0 ? void 0 : _config$android.allowBackup) !== null && _config$android$allow !== void 0 ? _config$android$allow : true;
|
|
40
31
|
}
|
|
41
|
-
|
|
42
32
|
function setAllowBackup(config, androidManifest) {
|
|
43
33
|
const allowBackup = getAllowBackup(config);
|
|
44
34
|
const mainApplication = (0, _Manifest().getMainApplication)(androidManifest);
|
|
45
|
-
|
|
46
35
|
if (mainApplication !== null && mainApplication !== void 0 && mainApplication.$) {
|
|
47
36
|
mainApplication.$['android:allowBackup'] = String(allowBackup);
|
|
48
37
|
}
|
|
49
|
-
|
|
50
38
|
return androidManifest;
|
|
51
39
|
}
|
|
52
|
-
|
|
53
40
|
function getAllowBackupFromManifest(androidManifest) {
|
|
54
41
|
const mainApplication = (0, _Manifest().getMainApplication)(androidManifest);
|
|
55
|
-
|
|
56
42
|
if (mainApplication !== null && mainApplication !== void 0 && mainApplication.$) {
|
|
57
43
|
return String(mainApplication.$['android:allowBackup']) === 'true';
|
|
58
44
|
}
|
|
59
|
-
|
|
60
45
|
return null;
|
|
61
46
|
}
|
|
62
47
|
//# sourceMappingURL=AllowBackup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AllowBackup.js","names":["withAllowBackup","createAndroidManifestPlugin","setAllowBackup","getAllowBackup","config","android","allowBackup","androidManifest","mainApplication","getMainApplication","$","String","getAllowBackupFromManifest"],"sources":["../../src/android/AllowBackup.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { createAndroidManifestPlugin } from '../plugins/android-plugins';\nimport { AndroidManifest, getMainApplication, StringBoolean } from './Manifest';\n\nexport const withAllowBackup = createAndroidManifestPlugin(setAllowBackup, 'withAllowBackup');\n\nexport function getAllowBackup(config: Pick<ExpoConfig, 'android'>) {\n // Defaults to true.\n // https://docs.expo.dev/versions/latest/config/app/#allowbackup\n return config.android?.allowBackup ?? true;\n}\n\nexport function setAllowBackup(\n config: Pick<ExpoConfig, 'android'>,\n androidManifest: AndroidManifest\n) {\n const allowBackup = getAllowBackup(config);\n\n const mainApplication = getMainApplication(androidManifest);\n if (mainApplication?.$) {\n mainApplication.$['android:allowBackup'] = String(allowBackup) as StringBoolean;\n }\n\n return androidManifest;\n}\n\nexport function getAllowBackupFromManifest(androidManifest: AndroidManifest): boolean | null {\n const mainApplication = getMainApplication(androidManifest);\n\n if (mainApplication?.$) {\n return String(mainApplication.$['android:allowBackup']) === 'true';\n }\n\n return null;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"AllowBackup.js","names":["withAllowBackup","createAndroidManifestPlugin","setAllowBackup","getAllowBackup","config","android","allowBackup","androidManifest","mainApplication","getMainApplication","$","String","getAllowBackupFromManifest"],"sources":["../../src/android/AllowBackup.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { createAndroidManifestPlugin } from '../plugins/android-plugins';\nimport { AndroidManifest, getMainApplication, StringBoolean } from './Manifest';\n\nexport const withAllowBackup = createAndroidManifestPlugin(setAllowBackup, 'withAllowBackup');\n\nexport function getAllowBackup(config: Pick<ExpoConfig, 'android'>) {\n // Defaults to true.\n // https://docs.expo.dev/versions/latest/config/app/#allowbackup\n return config.android?.allowBackup ?? true;\n}\n\nexport function setAllowBackup(\n config: Pick<ExpoConfig, 'android'>,\n androidManifest: AndroidManifest\n) {\n const allowBackup = getAllowBackup(config);\n\n const mainApplication = getMainApplication(androidManifest);\n if (mainApplication?.$) {\n mainApplication.$['android:allowBackup'] = String(allowBackup) as StringBoolean;\n }\n\n return androidManifest;\n}\n\nexport function getAllowBackupFromManifest(androidManifest: AndroidManifest): boolean | null {\n const mainApplication = getMainApplication(androidManifest);\n\n if (mainApplication?.$) {\n return String(mainApplication.$['android:allowBackup']) === 'true';\n }\n\n return null;\n}\n"],"mappings":";;;;;;;;;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,eAAe,GAAG,IAAAC,6CAA2B,EAACC,cAAc,EAAE,iBAAiB,CAAC;AAAC;AAEvF,SAASC,cAAc,CAACC,MAAmC,EAAE;EAAA;EAClE;EACA;EACA,mDAAOA,MAAM,CAACC,OAAO,oDAAd,gBAAgBC,WAAW,yEAAI,IAAI;AAC5C;AAEO,SAASJ,cAAc,CAC5BE,MAAmC,EACnCG,eAAgC,EAChC;EACA,MAAMD,WAAW,GAAGH,cAAc,CAACC,MAAM,CAAC;EAE1C,MAAMI,eAAe,GAAG,IAAAC,8BAAkB,EAACF,eAAe,CAAC;EAC3D,IAAIC,eAAe,aAAfA,eAAe,eAAfA,eAAe,CAAEE,CAAC,EAAE;IACtBF,eAAe,CAACE,CAAC,CAAC,qBAAqB,CAAC,GAAGC,MAAM,CAACL,WAAW,CAAkB;EACjF;EAEA,OAAOC,eAAe;AACxB;AAEO,SAASK,0BAA0B,CAACL,eAAgC,EAAkB;EAC3F,MAAMC,eAAe,GAAG,IAAAC,8BAAkB,EAACF,eAAe,CAAC;EAE3D,IAAIC,eAAe,aAAfA,eAAe,eAAfA,eAAe,CAAEE,CAAC,EAAE;IACtB,OAAOC,MAAM,CAACH,eAAe,CAACE,CAAC,CAAC,qBAAqB,CAAC,CAAC,KAAK,MAAM;EACpE;EAEA,OAAO,IAAI;AACb"}
|
|
@@ -7,17 +7,13 @@ exports.createBuildGradlePropsConfigPlugin = createBuildGradlePropsConfigPlugin;
|
|
|
7
7
|
exports.updateAndroidBuildPropertiesFromConfig = updateAndroidBuildPropertiesFromConfig;
|
|
8
8
|
exports.updateAndroidBuildProperty = updateAndroidBuildProperty;
|
|
9
9
|
exports.withJsEngineGradleProps = void 0;
|
|
10
|
-
|
|
11
10
|
function _androidPlugins() {
|
|
12
11
|
const data = require("../plugins/android-plugins");
|
|
13
|
-
|
|
14
12
|
_androidPlugins = function () {
|
|
15
13
|
return data;
|
|
16
14
|
};
|
|
17
|
-
|
|
18
15
|
return data;
|
|
19
16
|
}
|
|
20
|
-
|
|
21
17
|
/**
|
|
22
18
|
* Creates a `withGradleProperties` config-plugin based on given config to property mapping rules.
|
|
23
19
|
*
|
|
@@ -38,42 +34,34 @@ function createBuildGradlePropsConfigPlugin(configToPropertyRules, name) {
|
|
|
38
34
|
config.modResults = updateAndroidBuildPropertiesFromConfig(sourceConfig !== null && sourceConfig !== void 0 ? sourceConfig : config, config.modResults, configToPropertyRules);
|
|
39
35
|
return config;
|
|
40
36
|
});
|
|
41
|
-
|
|
42
37
|
if (name) {
|
|
43
38
|
Object.defineProperty(withUnknown, 'name', {
|
|
44
39
|
value: name
|
|
45
40
|
});
|
|
46
41
|
}
|
|
47
|
-
|
|
48
42
|
return withUnknown;
|
|
49
43
|
}
|
|
44
|
+
|
|
50
45
|
/**
|
|
51
46
|
* A config-plugin to update `android/gradle.properties` from the `jsEngine` in expo config
|
|
52
47
|
*/
|
|
53
|
-
|
|
54
|
-
|
|
55
48
|
const withJsEngineGradleProps = createBuildGradlePropsConfigPlugin([{
|
|
56
49
|
propName: 'expo.jsEngine',
|
|
57
50
|
propValueGetter: config => {
|
|
58
51
|
var _ref, _config$android$jsEng, _config$android;
|
|
59
|
-
|
|
60
|
-
return (_ref = (_config$android$jsEng = (_config$android = config.android) === null || _config$android === void 0 ? void 0 : _config$android.jsEngine) !== null && _config$android$jsEng !== void 0 ? _config$android$jsEng : config.jsEngine) !== null && _ref !== void 0 ? _ref : 'jsc';
|
|
52
|
+
return (_ref = (_config$android$jsEng = (_config$android = config.android) === null || _config$android === void 0 ? void 0 : _config$android.jsEngine) !== null && _config$android$jsEng !== void 0 ? _config$android$jsEng : config.jsEngine) !== null && _ref !== void 0 ? _ref : 'hermes';
|
|
61
53
|
}
|
|
62
54
|
}], 'withJsEngineGradleProps');
|
|
63
55
|
exports.withJsEngineGradleProps = withJsEngineGradleProps;
|
|
64
|
-
|
|
65
56
|
function updateAndroidBuildPropertiesFromConfig(config, gradleProperties, configToPropertyRules) {
|
|
66
57
|
for (const configToProperty of configToPropertyRules) {
|
|
67
58
|
const value = configToProperty.propValueGetter(config);
|
|
68
59
|
updateAndroidBuildProperty(gradleProperties, configToProperty.propName, value);
|
|
69
60
|
}
|
|
70
|
-
|
|
71
61
|
return gradleProperties;
|
|
72
62
|
}
|
|
73
|
-
|
|
74
63
|
function updateAndroidBuildProperty(gradleProperties, name, value, options) {
|
|
75
64
|
const oldPropIndex = gradleProperties.findIndex(prop => prop.type === 'property' && prop.key === name);
|
|
76
|
-
|
|
77
65
|
if (value) {
|
|
78
66
|
// found the matched value, add or merge new property
|
|
79
67
|
const newProp = {
|
|
@@ -81,7 +69,6 @@ function updateAndroidBuildProperty(gradleProperties, name, value, options) {
|
|
|
81
69
|
key: name,
|
|
82
70
|
value
|
|
83
71
|
};
|
|
84
|
-
|
|
85
72
|
if (oldPropIndex >= 0) {
|
|
86
73
|
gradleProperties[oldPropIndex] = newProp;
|
|
87
74
|
} else {
|
|
@@ -90,7 +77,6 @@ function updateAndroidBuildProperty(gradleProperties, name, value, options) {
|
|
|
90
77
|
} else if (options !== null && options !== void 0 && options.removePropWhenValueIsNull && oldPropIndex >= 0) {
|
|
91
78
|
gradleProperties.splice(oldPropIndex, 1);
|
|
92
79
|
}
|
|
93
|
-
|
|
94
80
|
return gradleProperties;
|
|
95
81
|
}
|
|
96
82
|
//# sourceMappingURL=BuildProperties.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuildProperties.js","names":["createBuildGradlePropsConfigPlugin","configToPropertyRules","name","withUnknown","config","sourceConfig","withGradleProperties","modResults","updateAndroidBuildPropertiesFromConfig","Object","defineProperty","value","withJsEngineGradleProps","propName","propValueGetter","android","jsEngine","gradleProperties","configToProperty","updateAndroidBuildProperty","options","oldPropIndex","findIndex","prop","type","key","newProp","push","removePropWhenValueIsNull","splice"],"sources":["../../src/android/BuildProperties.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { ConfigPlugin } from '../Plugin.types';\nimport { withGradleProperties } from '../plugins/android-plugins';\nimport { BuildPropertiesConfig, ConfigToPropertyRuleType } from '../utils/BuildProperties.types';\nimport type { PropertiesItem } from './Properties';\n\n/**\n * Creates a `withGradleProperties` config-plugin based on given config to property mapping rules.\n *\n * The factory supports two modes from generic type inference\n * ```ts\n * // config-plugin without `props`, it will implicitly use the expo config as source config.\n * createBuildGradlePropsConfigPlugin<ExpoConfig>(): ConfigPlugin<void>;\n *\n * // config-plugin with a parameter `props: CustomType`, it will use the `props` as source config.\n * createBuildGradlePropsConfigPlugin<CustomType>(): ConfigPlugin<CustomType>;\n * ```\n *\n * @param configToPropertyRules config to property mapping rules\n * @param name the config plugin name\n */\nexport function createBuildGradlePropsConfigPlugin<SourceConfigType extends BuildPropertiesConfig>(\n configToPropertyRules: ConfigToPropertyRuleType<SourceConfigType>[],\n name?: string\n) {\n const withUnknown: ConfigPlugin<SourceConfigType extends ExpoConfig ? void : SourceConfigType> = (\n config,\n sourceConfig\n ) =>\n withGradleProperties(config, (config) => {\n config.modResults = updateAndroidBuildPropertiesFromConfig(\n (sourceConfig ?? config) as SourceConfigType,\n config.modResults,\n configToPropertyRules\n );\n return config;\n });\n if (name) {\n Object.defineProperty(withUnknown, 'name', {\n value: name,\n });\n }\n return withUnknown;\n}\n\n/**\n * A config-plugin to update `android/gradle.properties` from the `jsEngine` in expo config\n */\nexport const withJsEngineGradleProps = createBuildGradlePropsConfigPlugin<ExpoConfig>(\n [\n {\n propName: 'expo.jsEngine',\n propValueGetter: (config) => config.android?.jsEngine ?? config.jsEngine ?? '
|
|
1
|
+
{"version":3,"file":"BuildProperties.js","names":["createBuildGradlePropsConfigPlugin","configToPropertyRules","name","withUnknown","config","sourceConfig","withGradleProperties","modResults","updateAndroidBuildPropertiesFromConfig","Object","defineProperty","value","withJsEngineGradleProps","propName","propValueGetter","android","jsEngine","gradleProperties","configToProperty","updateAndroidBuildProperty","options","oldPropIndex","findIndex","prop","type","key","newProp","push","removePropWhenValueIsNull","splice"],"sources":["../../src/android/BuildProperties.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { ConfigPlugin } from '../Plugin.types';\nimport { withGradleProperties } from '../plugins/android-plugins';\nimport { BuildPropertiesConfig, ConfigToPropertyRuleType } from '../utils/BuildProperties.types';\nimport type { PropertiesItem } from './Properties';\n\n/**\n * Creates a `withGradleProperties` config-plugin based on given config to property mapping rules.\n *\n * The factory supports two modes from generic type inference\n * ```ts\n * // config-plugin without `props`, it will implicitly use the expo config as source config.\n * createBuildGradlePropsConfigPlugin<ExpoConfig>(): ConfigPlugin<void>;\n *\n * // config-plugin with a parameter `props: CustomType`, it will use the `props` as source config.\n * createBuildGradlePropsConfigPlugin<CustomType>(): ConfigPlugin<CustomType>;\n * ```\n *\n * @param configToPropertyRules config to property mapping rules\n * @param name the config plugin name\n */\nexport function createBuildGradlePropsConfigPlugin<SourceConfigType extends BuildPropertiesConfig>(\n configToPropertyRules: ConfigToPropertyRuleType<SourceConfigType>[],\n name?: string\n) {\n const withUnknown: ConfigPlugin<SourceConfigType extends ExpoConfig ? void : SourceConfigType> = (\n config,\n sourceConfig\n ) =>\n withGradleProperties(config, (config) => {\n config.modResults = updateAndroidBuildPropertiesFromConfig(\n (sourceConfig ?? config) as SourceConfigType,\n config.modResults,\n configToPropertyRules\n );\n return config;\n });\n if (name) {\n Object.defineProperty(withUnknown, 'name', {\n value: name,\n });\n }\n return withUnknown;\n}\n\n/**\n * A config-plugin to update `android/gradle.properties` from the `jsEngine` in expo config\n */\nexport const withJsEngineGradleProps = createBuildGradlePropsConfigPlugin<ExpoConfig>(\n [\n {\n propName: 'expo.jsEngine',\n propValueGetter: (config) => config.android?.jsEngine ?? config.jsEngine ?? 'hermes',\n },\n ],\n 'withJsEngineGradleProps'\n);\n\nexport function updateAndroidBuildPropertiesFromConfig<\n SourceConfigType extends BuildPropertiesConfig\n>(\n config: SourceConfigType,\n gradleProperties: PropertiesItem[],\n configToPropertyRules: ConfigToPropertyRuleType<SourceConfigType>[]\n) {\n for (const configToProperty of configToPropertyRules) {\n const value = configToProperty.propValueGetter(config);\n updateAndroidBuildProperty(gradleProperties, configToProperty.propName, value);\n }\n\n return gradleProperties;\n}\n\nexport function updateAndroidBuildProperty(\n gradleProperties: PropertiesItem[],\n name: string,\n value: string | null | undefined,\n options?: { removePropWhenValueIsNull?: boolean }\n) {\n const oldPropIndex = gradleProperties.findIndex(\n (prop) => prop.type === 'property' && prop.key === name\n );\n\n if (value) {\n // found the matched value, add or merge new property\n const newProp: PropertiesItem = {\n type: 'property',\n key: name,\n value,\n };\n\n if (oldPropIndex >= 0) {\n gradleProperties[oldPropIndex] = newProp;\n } else {\n gradleProperties.push(newProp);\n }\n } else if (options?.removePropWhenValueIsNull && oldPropIndex >= 0) {\n gradleProperties.splice(oldPropIndex, 1);\n }\n\n return gradleProperties;\n}\n"],"mappings":";;;;;;;;;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,kCAAkC,CAChDC,qBAAmE,EACnEC,IAAa,EACb;EACA,MAAMC,WAAwF,GAAG,CAC/FC,MAAM,EACNC,YAAY,KAEZ,IAAAC,sCAAoB,EAACF,MAAM,EAAGA,MAAM,IAAK;IACvCA,MAAM,CAACG,UAAU,GAAGC,sCAAsC,CACvDH,YAAY,aAAZA,YAAY,cAAZA,YAAY,GAAID,MAAM,EACvBA,MAAM,CAACG,UAAU,EACjBN,qBAAqB,CACtB;IACD,OAAOG,MAAM;EACf,CAAC,CAAC;EACJ,IAAIF,IAAI,EAAE;IACRO,MAAM,CAACC,cAAc,CAACP,WAAW,EAAE,MAAM,EAAE;MACzCQ,KAAK,EAAET;IACT,CAAC,CAAC;EACJ;EACA,OAAOC,WAAW;AACpB;;AAEA;AACA;AACA;AACO,MAAMS,uBAAuB,GAAGZ,kCAAkC,CACvE,CACE;EACEa,QAAQ,EAAE,eAAe;EACzBC,eAAe,EAAGV,MAAM;IAAA;IAAA,2DAAKA,MAAM,CAACW,OAAO,oDAAd,gBAAgBC,QAAQ,yEAAIZ,MAAM,CAACY,QAAQ,uCAAI,QAAQ;EAAA;AACtF,CAAC,CACF,EACD,yBAAyB,CAC1B;AAAC;AAEK,SAASR,sCAAsC,CAGpDJ,MAAwB,EACxBa,gBAAkC,EAClChB,qBAAmE,EACnE;EACA,KAAK,MAAMiB,gBAAgB,IAAIjB,qBAAqB,EAAE;IACpD,MAAMU,KAAK,GAAGO,gBAAgB,CAACJ,eAAe,CAACV,MAAM,CAAC;IACtDe,0BAA0B,CAACF,gBAAgB,EAAEC,gBAAgB,CAACL,QAAQ,EAAEF,KAAK,CAAC;EAChF;EAEA,OAAOM,gBAAgB;AACzB;AAEO,SAASE,0BAA0B,CACxCF,gBAAkC,EAClCf,IAAY,EACZS,KAAgC,EAChCS,OAAiD,EACjD;EACA,MAAMC,YAAY,GAAGJ,gBAAgB,CAACK,SAAS,CAC5CC,IAAI,IAAKA,IAAI,CAACC,IAAI,KAAK,UAAU,IAAID,IAAI,CAACE,GAAG,KAAKvB,IAAI,CACxD;EAED,IAAIS,KAAK,EAAE;IACT;IACA,MAAMe,OAAuB,GAAG;MAC9BF,IAAI,EAAE,UAAU;MAChBC,GAAG,EAAEvB,IAAI;MACTS;IACF,CAAC;IAED,IAAIU,YAAY,IAAI,CAAC,EAAE;MACrBJ,gBAAgB,CAACI,YAAY,CAAC,GAAGK,OAAO;IAC1C,CAAC,MAAM;MACLT,gBAAgB,CAACU,IAAI,CAACD,OAAO,CAAC;IAChC;EACF,CAAC,MAAM,IAAIN,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEQ,yBAAyB,IAAIP,YAAY,IAAI,CAAC,EAAE;IAClEJ,gBAAgB,CAACY,MAAM,CAACR,YAAY,EAAE,CAAC,CAAC;EAC1C;EAEA,OAAOJ,gBAAgB;AACzB"}
|
package/build/android/Colors.js
CHANGED
|
@@ -9,27 +9,20 @@ exports.getObjectAsColorsXml = getObjectAsColorsXml;
|
|
|
9
9
|
exports.getProjectColorsXMLPathAsync = getProjectColorsXMLPathAsync;
|
|
10
10
|
exports.removeColorItem = removeColorItem;
|
|
11
11
|
exports.setColorItem = setColorItem;
|
|
12
|
-
|
|
13
12
|
function _Paths() {
|
|
14
13
|
const data = require("./Paths");
|
|
15
|
-
|
|
16
14
|
_Paths = function () {
|
|
17
15
|
return data;
|
|
18
16
|
};
|
|
19
|
-
|
|
20
17
|
return data;
|
|
21
18
|
}
|
|
22
|
-
|
|
23
19
|
function _Resources() {
|
|
24
20
|
const data = require("./Resources");
|
|
25
|
-
|
|
26
21
|
_Resources = function () {
|
|
27
22
|
return data;
|
|
28
23
|
};
|
|
29
|
-
|
|
30
24
|
return data;
|
|
31
25
|
}
|
|
32
|
-
|
|
33
26
|
function getProjectColorsXMLPathAsync(projectRoot, {
|
|
34
27
|
kind
|
|
35
28
|
} = {}) {
|
|
@@ -38,13 +31,10 @@ function getProjectColorsXMLPathAsync(projectRoot, {
|
|
|
38
31
|
name: 'colors'
|
|
39
32
|
});
|
|
40
33
|
}
|
|
41
|
-
|
|
42
34
|
function setColorItem(itemToAdd, colorFileContentsJSON) {
|
|
43
35
|
var _colorFileContentsJSO;
|
|
44
|
-
|
|
45
36
|
if ((_colorFileContentsJSO = colorFileContentsJSON.resources) !== null && _colorFileContentsJSO !== void 0 && _colorFileContentsJSO.color) {
|
|
46
37
|
const colorNameExists = colorFileContentsJSON.resources.color.filter(e => e.$.name === itemToAdd.$.name)[0];
|
|
47
|
-
|
|
48
38
|
if (colorNameExists) {
|
|
49
39
|
colorNameExists._ = itemToAdd._;
|
|
50
40
|
} else {
|
|
@@ -55,32 +45,25 @@ function setColorItem(itemToAdd, colorFileContentsJSON) {
|
|
|
55
45
|
//file was empty and JSON is `{resources : ''}`
|
|
56
46
|
colorFileContentsJSON.resources = {};
|
|
57
47
|
}
|
|
58
|
-
|
|
59
48
|
colorFileContentsJSON.resources.color = [itemToAdd];
|
|
60
49
|
}
|
|
61
|
-
|
|
62
50
|
return colorFileContentsJSON;
|
|
63
51
|
}
|
|
64
|
-
|
|
65
52
|
function removeColorItem(named, contents) {
|
|
66
53
|
var _contents$resources;
|
|
67
|
-
|
|
68
54
|
if ((_contents$resources = contents.resources) !== null && _contents$resources !== void 0 && _contents$resources.color) {
|
|
69
55
|
const index = contents.resources.color.findIndex(e => e.$.name === named);
|
|
70
|
-
|
|
71
56
|
if (index > -1) {
|
|
72
57
|
// replace the previous value
|
|
73
58
|
contents.resources.color.splice(index, 1);
|
|
74
59
|
}
|
|
75
60
|
}
|
|
76
|
-
|
|
77
61
|
return contents;
|
|
78
62
|
}
|
|
63
|
+
|
|
79
64
|
/**
|
|
80
65
|
* Set or remove value in XML based on nullish factor of the `value` property.
|
|
81
66
|
*/
|
|
82
|
-
|
|
83
|
-
|
|
84
67
|
function assignColorValue(xml, {
|
|
85
68
|
value,
|
|
86
69
|
name
|
|
@@ -91,9 +74,9 @@ function assignColorValue(xml, {
|
|
|
91
74
|
value
|
|
92
75
|
}), xml);
|
|
93
76
|
}
|
|
94
|
-
|
|
95
77
|
return removeColorItem(name, xml);
|
|
96
78
|
}
|
|
79
|
+
|
|
97
80
|
/**
|
|
98
81
|
* Helper to convert a basic XML object into a simple k/v pair.
|
|
99
82
|
* `colors.xml` is a very basic XML file so this is pretty safe to do.
|
|
@@ -102,25 +85,20 @@ function assignColorValue(xml, {
|
|
|
102
85
|
* @param xml
|
|
103
86
|
* @returns
|
|
104
87
|
*/
|
|
105
|
-
|
|
106
|
-
|
|
107
88
|
function getColorsAsObject(xml) {
|
|
108
89
|
var _xml$resources;
|
|
109
|
-
|
|
110
90
|
if (!(xml !== null && xml !== void 0 && (_xml$resources = xml.resources) !== null && _xml$resources !== void 0 && _xml$resources.color)) {
|
|
111
91
|
return null;
|
|
112
92
|
}
|
|
113
|
-
|
|
114
93
|
return (0, _Resources().getResourceItemsAsObject)(xml.resources.color);
|
|
115
94
|
}
|
|
95
|
+
|
|
116
96
|
/**
|
|
117
97
|
* Helper to convert a basic k/v object to a colors XML object.
|
|
118
98
|
*
|
|
119
99
|
* @param xml
|
|
120
100
|
* @returns
|
|
121
101
|
*/
|
|
122
|
-
|
|
123
|
-
|
|
124
102
|
function getObjectAsColorsXml(obj) {
|
|
125
103
|
return {
|
|
126
104
|
resources: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Colors.js","names":["getProjectColorsXMLPathAsync","projectRoot","kind","getResourceXMLPathAsync","name","setColorItem","itemToAdd","colorFileContentsJSON","resources","color","colorNameExists","filter","e","$","_","push","removeColorItem","named","contents","index","findIndex","splice","assignColorValue","xml","value","buildResourceItem","getColorsAsObject","getResourceItemsAsObject","getObjectAsColorsXml","obj","getObjectAsResourceItems"],"sources":["../../src/android/Colors.ts"],"sourcesContent":["import { getResourceXMLPathAsync } from './Paths';\nimport {\n buildResourceItem,\n getObjectAsResourceItems,\n getResourceItemsAsObject,\n ResourceItemXML,\n ResourceKind,\n ResourceXML,\n} from './Resources';\n\nexport function getProjectColorsXMLPathAsync(\n projectRoot: string,\n { kind }: { kind?: ResourceKind } = {}\n) {\n return getResourceXMLPathAsync(projectRoot, { kind, name: 'colors' });\n}\n\nexport function setColorItem(itemToAdd: ResourceItemXML, colorFileContentsJSON: ResourceXML) {\n if (colorFileContentsJSON.resources?.color) {\n const colorNameExists = colorFileContentsJSON.resources.color.filter(\n (e: ResourceItemXML) => e.$.name === itemToAdd.$.name\n )[0];\n if (colorNameExists) {\n colorNameExists._ = itemToAdd._;\n } else {\n colorFileContentsJSON.resources.color.push(itemToAdd);\n }\n } else {\n if (!colorFileContentsJSON.resources || typeof colorFileContentsJSON.resources === 'string') {\n //file was empty and JSON is `{resources : ''}`\n colorFileContentsJSON.resources = {};\n }\n colorFileContentsJSON.resources.color = [itemToAdd];\n }\n return colorFileContentsJSON;\n}\n\nexport function removeColorItem(named: string, contents: ResourceXML) {\n if (contents.resources?.color) {\n const index = contents.resources.color.findIndex((e: ResourceItemXML) => e.$.name === named);\n if (index > -1) {\n // replace the previous value\n contents.resources.color.splice(index, 1);\n }\n }\n return contents;\n}\n\n/**\n * Set or remove value in XML based on nullish factor of the `value` property.\n */\nexport function assignColorValue(\n xml: ResourceXML,\n {\n value,\n name,\n }: {\n value?: string | null;\n name: string;\n }\n) {\n if (value) {\n return setColorItem(\n buildResourceItem({\n name,\n value,\n }),\n xml\n );\n }\n\n return removeColorItem(name, xml);\n}\n\n/**\n * Helper to convert a basic XML object into a simple k/v pair.\n * `colors.xml` is a very basic XML file so this is pretty safe to do.\n * Added for testing purposes.\n *\n * @param xml\n * @returns\n */\nexport function getColorsAsObject(xml: ResourceXML): Record<string, string> | null {\n if (!xml?.resources?.color) {\n return null;\n }\n\n return getResourceItemsAsObject(xml.resources.color);\n}\n\n/**\n * Helper to convert a basic k/v object to a colors XML object.\n *\n * @param xml\n * @returns\n */\nexport function getObjectAsColorsXml(obj: Record<string, string>): ResourceXML {\n return {\n resources: {\n color: getObjectAsResourceItems(obj),\n },\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Colors.js","names":["getProjectColorsXMLPathAsync","projectRoot","kind","getResourceXMLPathAsync","name","setColorItem","itemToAdd","colorFileContentsJSON","resources","color","colorNameExists","filter","e","$","_","push","removeColorItem","named","contents","index","findIndex","splice","assignColorValue","xml","value","buildResourceItem","getColorsAsObject","getResourceItemsAsObject","getObjectAsColorsXml","obj","getObjectAsResourceItems"],"sources":["../../src/android/Colors.ts"],"sourcesContent":["import { getResourceXMLPathAsync } from './Paths';\nimport {\n buildResourceItem,\n getObjectAsResourceItems,\n getResourceItemsAsObject,\n ResourceItemXML,\n ResourceKind,\n ResourceXML,\n} from './Resources';\n\nexport function getProjectColorsXMLPathAsync(\n projectRoot: string,\n { kind }: { kind?: ResourceKind } = {}\n) {\n return getResourceXMLPathAsync(projectRoot, { kind, name: 'colors' });\n}\n\nexport function setColorItem(itemToAdd: ResourceItemXML, colorFileContentsJSON: ResourceXML) {\n if (colorFileContentsJSON.resources?.color) {\n const colorNameExists = colorFileContentsJSON.resources.color.filter(\n (e: ResourceItemXML) => e.$.name === itemToAdd.$.name\n )[0];\n if (colorNameExists) {\n colorNameExists._ = itemToAdd._;\n } else {\n colorFileContentsJSON.resources.color.push(itemToAdd);\n }\n } else {\n if (!colorFileContentsJSON.resources || typeof colorFileContentsJSON.resources === 'string') {\n //file was empty and JSON is `{resources : ''}`\n colorFileContentsJSON.resources = {};\n }\n colorFileContentsJSON.resources.color = [itemToAdd];\n }\n return colorFileContentsJSON;\n}\n\nexport function removeColorItem(named: string, contents: ResourceXML) {\n if (contents.resources?.color) {\n const index = contents.resources.color.findIndex((e: ResourceItemXML) => e.$.name === named);\n if (index > -1) {\n // replace the previous value\n contents.resources.color.splice(index, 1);\n }\n }\n return contents;\n}\n\n/**\n * Set or remove value in XML based on nullish factor of the `value` property.\n */\nexport function assignColorValue(\n xml: ResourceXML,\n {\n value,\n name,\n }: {\n value?: string | null;\n name: string;\n }\n) {\n if (value) {\n return setColorItem(\n buildResourceItem({\n name,\n value,\n }),\n xml\n );\n }\n\n return removeColorItem(name, xml);\n}\n\n/**\n * Helper to convert a basic XML object into a simple k/v pair.\n * `colors.xml` is a very basic XML file so this is pretty safe to do.\n * Added for testing purposes.\n *\n * @param xml\n * @returns\n */\nexport function getColorsAsObject(xml: ResourceXML): Record<string, string> | null {\n if (!xml?.resources?.color) {\n return null;\n }\n\n return getResourceItemsAsObject(xml.resources.color);\n}\n\n/**\n * Helper to convert a basic k/v object to a colors XML object.\n *\n * @param xml\n * @returns\n */\nexport function getObjectAsColorsXml(obj: Record<string, string>): ResourceXML {\n return {\n resources: {\n color: getObjectAsResourceItems(obj),\n },\n };\n}\n"],"mappings":";;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AASO,SAASA,4BAA4B,CAC1CC,WAAmB,EACnB;EAAEC;AAA8B,CAAC,GAAG,CAAC,CAAC,EACtC;EACA,OAAO,IAAAC,gCAAuB,EAACF,WAAW,EAAE;IAAEC,IAAI;IAAEE,IAAI,EAAE;EAAS,CAAC,CAAC;AACvE;AAEO,SAASC,YAAY,CAACC,SAA0B,EAAEC,qBAAkC,EAAE;EAAA;EAC3F,6BAAIA,qBAAqB,CAACC,SAAS,kDAA/B,sBAAiCC,KAAK,EAAE;IAC1C,MAAMC,eAAe,GAAGH,qBAAqB,CAACC,SAAS,CAACC,KAAK,CAACE,MAAM,CACjEC,CAAkB,IAAKA,CAAC,CAACC,CAAC,CAACT,IAAI,KAAKE,SAAS,CAACO,CAAC,CAACT,IAAI,CACtD,CAAC,CAAC,CAAC;IACJ,IAAIM,eAAe,EAAE;MACnBA,eAAe,CAACI,CAAC,GAAGR,SAAS,CAACQ,CAAC;IACjC,CAAC,MAAM;MACLP,qBAAqB,CAACC,SAAS,CAACC,KAAK,CAACM,IAAI,CAACT,SAAS,CAAC;IACvD;EACF,CAAC,MAAM;IACL,IAAI,CAACC,qBAAqB,CAACC,SAAS,IAAI,OAAOD,qBAAqB,CAACC,SAAS,KAAK,QAAQ,EAAE;MAC3F;MACAD,qBAAqB,CAACC,SAAS,GAAG,CAAC,CAAC;IACtC;IACAD,qBAAqB,CAACC,SAAS,CAACC,KAAK,GAAG,CAACH,SAAS,CAAC;EACrD;EACA,OAAOC,qBAAqB;AAC9B;AAEO,SAASS,eAAe,CAACC,KAAa,EAAEC,QAAqB,EAAE;EAAA;EACpE,2BAAIA,QAAQ,CAACV,SAAS,gDAAlB,oBAAoBC,KAAK,EAAE;IAC7B,MAAMU,KAAK,GAAGD,QAAQ,CAACV,SAAS,CAACC,KAAK,CAACW,SAAS,CAAER,CAAkB,IAAKA,CAAC,CAACC,CAAC,CAACT,IAAI,KAAKa,KAAK,CAAC;IAC5F,IAAIE,KAAK,GAAG,CAAC,CAAC,EAAE;MACd;MACAD,QAAQ,CAACV,SAAS,CAACC,KAAK,CAACY,MAAM,CAACF,KAAK,EAAE,CAAC,CAAC;IAC3C;EACF;EACA,OAAOD,QAAQ;AACjB;;AAEA;AACA;AACA;AACO,SAASI,gBAAgB,CAC9BC,GAAgB,EAChB;EACEC,KAAK;EACLpB;AAIF,CAAC,EACD;EACA,IAAIoB,KAAK,EAAE;IACT,OAAOnB,YAAY,CACjB,IAAAoB,8BAAiB,EAAC;MAChBrB,IAAI;MACJoB;IACF,CAAC,CAAC,EACFD,GAAG,CACJ;EACH;EAEA,OAAOP,eAAe,CAACZ,IAAI,EAAEmB,GAAG,CAAC;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,iBAAiB,CAACH,GAAgB,EAAiC;EAAA;EACjF,IAAI,EAACA,GAAG,aAAHA,GAAG,iCAAHA,GAAG,CAAEf,SAAS,2CAAd,eAAgBC,KAAK,GAAE;IAC1B,OAAO,IAAI;EACb;EAEA,OAAO,IAAAkB,qCAAwB,EAACJ,GAAG,CAACf,SAAS,CAACC,KAAK,CAAC;AACtD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASmB,oBAAoB,CAACC,GAA2B,EAAe;EAC7E,OAAO;IACLrB,SAAS,EAAE;MACTC,KAAK,EAAE,IAAAqB,qCAAwB,EAACD,GAAG;IACrC;EACF,CAAC;AACH"}
|
|
@@ -6,76 +6,56 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.configureEasBuildAsync = configureEasBuildAsync;
|
|
7
7
|
exports.getEasBuildGradlePath = getEasBuildGradlePath;
|
|
8
8
|
exports.isEasBuildGradleConfiguredAsync = isEasBuildGradleConfiguredAsync;
|
|
9
|
-
|
|
10
9
|
function _fs() {
|
|
11
10
|
const data = _interopRequireDefault(require("fs"));
|
|
12
|
-
|
|
13
11
|
_fs = function () {
|
|
14
12
|
return data;
|
|
15
13
|
};
|
|
16
|
-
|
|
17
14
|
return data;
|
|
18
15
|
}
|
|
19
|
-
|
|
20
16
|
function _path() {
|
|
21
17
|
const data = _interopRequireDefault(require("path"));
|
|
22
|
-
|
|
23
18
|
_path = function () {
|
|
24
19
|
return data;
|
|
25
20
|
};
|
|
26
|
-
|
|
27
21
|
return data;
|
|
28
22
|
}
|
|
29
|
-
|
|
30
23
|
function _EasBuildGradleScript() {
|
|
31
24
|
const data = _interopRequireDefault(require("./EasBuildGradleScript"));
|
|
32
|
-
|
|
33
25
|
_EasBuildGradleScript = function () {
|
|
34
26
|
return data;
|
|
35
27
|
};
|
|
36
|
-
|
|
37
28
|
return data;
|
|
38
29
|
}
|
|
39
|
-
|
|
40
30
|
function Paths() {
|
|
41
31
|
const data = _interopRequireWildcard(require("./Paths"));
|
|
42
|
-
|
|
43
32
|
Paths = function () {
|
|
44
33
|
return data;
|
|
45
34
|
};
|
|
46
|
-
|
|
47
35
|
return data;
|
|
48
36
|
}
|
|
49
|
-
|
|
50
37
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
51
|
-
|
|
52
38
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
53
|
-
|
|
54
39
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
55
|
-
|
|
56
40
|
const APPLY_EAS_GRADLE = 'apply from: "./eas-build.gradle"';
|
|
57
|
-
|
|
58
41
|
function hasApplyLine(content, applyLine) {
|
|
59
|
-
return content.replace(/\r\n/g, '\n').split('\n')
|
|
42
|
+
return content.replace(/\r\n/g, '\n').split('\n')
|
|
43
|
+
// Check for both single and double quotes
|
|
60
44
|
.some(line => line === applyLine || line === applyLine.replace(/"/g, "'"));
|
|
61
45
|
}
|
|
62
|
-
|
|
63
46
|
function getEasBuildGradlePath(projectRoot) {
|
|
64
47
|
return _path().default.join(projectRoot, 'android', 'app', 'eas-build.gradle');
|
|
65
48
|
}
|
|
66
|
-
|
|
67
49
|
async function configureEasBuildAsync(projectRoot) {
|
|
68
50
|
const buildGradlePath = Paths().getAppBuildGradleFilePath(projectRoot);
|
|
69
51
|
const easGradlePath = getEasBuildGradlePath(projectRoot);
|
|
70
52
|
await _fs().default.promises.writeFile(easGradlePath, _EasBuildGradleScript().default);
|
|
71
53
|
const buildGradleContent = await _fs().default.promises.readFile(_path().default.join(buildGradlePath), 'utf8');
|
|
72
54
|
const hasEasGradleApply = hasApplyLine(buildGradleContent, APPLY_EAS_GRADLE);
|
|
73
|
-
|
|
74
55
|
if (!hasEasGradleApply) {
|
|
75
56
|
await _fs().default.promises.writeFile(buildGradlePath, `${buildGradleContent.trim()}\n${APPLY_EAS_GRADLE}\n`);
|
|
76
57
|
}
|
|
77
58
|
}
|
|
78
|
-
|
|
79
59
|
async function isEasBuildGradleConfiguredAsync(projectRoot) {
|
|
80
60
|
const buildGradlePath = Paths().getAppBuildGradleFilePath(projectRoot);
|
|
81
61
|
const easGradlePath = getEasBuildGradlePath(projectRoot);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EasBuild.js","names":["APPLY_EAS_GRADLE","hasApplyLine","content","applyLine","replace","split","some","line","getEasBuildGradlePath","projectRoot","path","join","configureEasBuildAsync","buildGradlePath","Paths","getAppBuildGradleFilePath","easGradlePath","fs","promises","writeFile","gradleScript","buildGradleContent","readFile","hasEasGradleApply","trim","isEasBuildGradleConfiguredAsync","hasEasGradleFile","existsSync"],"sources":["../../src/android/EasBuild.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport gradleScript from './EasBuildGradleScript';\nimport * as Paths from './Paths';\n\nconst APPLY_EAS_GRADLE = 'apply from: \"./eas-build.gradle\"';\n\nfunction hasApplyLine(content: string, applyLine: string): boolean {\n return (\n content\n .replace(/\\r\\n/g, '\\n')\n .split('\\n')\n // Check for both single and double quotes\n .some((line) => line === applyLine || line === applyLine.replace(/\"/g, \"'\"))\n );\n}\n\nexport function getEasBuildGradlePath(projectRoot: string): string {\n return path.join(projectRoot, 'android', 'app', 'eas-build.gradle');\n}\n\nexport async function configureEasBuildAsync(projectRoot: string): Promise<void> {\n const buildGradlePath = Paths.getAppBuildGradleFilePath(projectRoot);\n const easGradlePath = getEasBuildGradlePath(projectRoot);\n\n await fs.promises.writeFile(easGradlePath, gradleScript);\n\n const buildGradleContent = await fs.promises.readFile(path.join(buildGradlePath), 'utf8');\n\n const hasEasGradleApply = hasApplyLine(buildGradleContent, APPLY_EAS_GRADLE);\n\n if (!hasEasGradleApply) {\n await fs.promises.writeFile(\n buildGradlePath,\n `${buildGradleContent.trim()}\\n${APPLY_EAS_GRADLE}\\n`\n );\n }\n}\n\nexport async function isEasBuildGradleConfiguredAsync(projectRoot: string): Promise<boolean> {\n const buildGradlePath = Paths.getAppBuildGradleFilePath(projectRoot);\n const easGradlePath = getEasBuildGradlePath(projectRoot);\n\n const hasEasGradleFile = await fs.existsSync(easGradlePath);\n\n const buildGradleContent = await fs.promises.readFile(path.join(buildGradlePath), 'utf8');\n const hasEasGradleApply = hasApplyLine(buildGradleContent, APPLY_EAS_GRADLE);\n\n return hasEasGradleApply && hasEasGradleFile;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EasBuild.js","names":["APPLY_EAS_GRADLE","hasApplyLine","content","applyLine","replace","split","some","line","getEasBuildGradlePath","projectRoot","path","join","configureEasBuildAsync","buildGradlePath","Paths","getAppBuildGradleFilePath","easGradlePath","fs","promises","writeFile","gradleScript","buildGradleContent","readFile","hasEasGradleApply","trim","isEasBuildGradleConfiguredAsync","hasEasGradleFile","existsSync"],"sources":["../../src/android/EasBuild.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport gradleScript from './EasBuildGradleScript';\nimport * as Paths from './Paths';\n\nconst APPLY_EAS_GRADLE = 'apply from: \"./eas-build.gradle\"';\n\nfunction hasApplyLine(content: string, applyLine: string): boolean {\n return (\n content\n .replace(/\\r\\n/g, '\\n')\n .split('\\n')\n // Check for both single and double quotes\n .some((line) => line === applyLine || line === applyLine.replace(/\"/g, \"'\"))\n );\n}\n\nexport function getEasBuildGradlePath(projectRoot: string): string {\n return path.join(projectRoot, 'android', 'app', 'eas-build.gradle');\n}\n\nexport async function configureEasBuildAsync(projectRoot: string): Promise<void> {\n const buildGradlePath = Paths.getAppBuildGradleFilePath(projectRoot);\n const easGradlePath = getEasBuildGradlePath(projectRoot);\n\n await fs.promises.writeFile(easGradlePath, gradleScript);\n\n const buildGradleContent = await fs.promises.readFile(path.join(buildGradlePath), 'utf8');\n\n const hasEasGradleApply = hasApplyLine(buildGradleContent, APPLY_EAS_GRADLE);\n\n if (!hasEasGradleApply) {\n await fs.promises.writeFile(\n buildGradlePath,\n `${buildGradleContent.trim()}\\n${APPLY_EAS_GRADLE}\\n`\n );\n }\n}\n\nexport async function isEasBuildGradleConfiguredAsync(projectRoot: string): Promise<boolean> {\n const buildGradlePath = Paths.getAppBuildGradleFilePath(projectRoot);\n const easGradlePath = getEasBuildGradlePath(projectRoot);\n\n const hasEasGradleFile = await fs.existsSync(easGradlePath);\n\n const buildGradleContent = await fs.promises.readFile(path.join(buildGradlePath), 'utf8');\n const hasEasGradleApply = hasApplyLine(buildGradleContent, APPLY_EAS_GRADLE);\n\n return hasEasGradleApply && hasEasGradleFile;\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAiC;AAAA;AAAA;AAEjC,MAAMA,gBAAgB,GAAG,kCAAkC;AAE3D,SAASC,YAAY,CAACC,OAAe,EAAEC,SAAiB,EAAW;EACjE,OACED,OAAO,CACJE,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CACtBC,KAAK,CAAC,IAAI;EACX;EAAA,CACCC,IAAI,CAAEC,IAAI,IAAKA,IAAI,KAAKJ,SAAS,IAAII,IAAI,KAAKJ,SAAS,CAACC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAElF;AAEO,SAASI,qBAAqB,CAACC,WAAmB,EAAU;EACjE,OAAOC,eAAI,CAACC,IAAI,CAACF,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,kBAAkB,CAAC;AACrE;AAEO,eAAeG,sBAAsB,CAACH,WAAmB,EAAiB;EAC/E,MAAMI,eAAe,GAAGC,KAAK,GAACC,yBAAyB,CAACN,WAAW,CAAC;EACpE,MAAMO,aAAa,GAAGR,qBAAqB,CAACC,WAAW,CAAC;EAExD,MAAMQ,aAAE,CAACC,QAAQ,CAACC,SAAS,CAACH,aAAa,EAAEI,+BAAY,CAAC;EAExD,MAAMC,kBAAkB,GAAG,MAAMJ,aAAE,CAACC,QAAQ,CAACI,QAAQ,CAACZ,eAAI,CAACC,IAAI,CAACE,eAAe,CAAC,EAAE,MAAM,CAAC;EAEzF,MAAMU,iBAAiB,GAAGtB,YAAY,CAACoB,kBAAkB,EAAErB,gBAAgB,CAAC;EAE5E,IAAI,CAACuB,iBAAiB,EAAE;IACtB,MAAMN,aAAE,CAACC,QAAQ,CAACC,SAAS,CACzBN,eAAe,EACd,GAAEQ,kBAAkB,CAACG,IAAI,EAAG,KAAIxB,gBAAiB,IAAG,CACtD;EACH;AACF;AAEO,eAAeyB,+BAA+B,CAAChB,WAAmB,EAAoB;EAC3F,MAAMI,eAAe,GAAGC,KAAK,GAACC,yBAAyB,CAACN,WAAW,CAAC;EACpE,MAAMO,aAAa,GAAGR,qBAAqB,CAACC,WAAW,CAAC;EAExD,MAAMiB,gBAAgB,GAAG,MAAMT,aAAE,CAACU,UAAU,CAACX,aAAa,CAAC;EAE3D,MAAMK,kBAAkB,GAAG,MAAMJ,aAAE,CAACC,QAAQ,CAACI,QAAQ,CAACZ,eAAI,CAACC,IAAI,CAACE,eAAe,CAAC,EAAE,MAAM,CAAC;EACzF,MAAMU,iBAAiB,GAAGtB,YAAY,CAACoB,kBAAkB,EAAErB,gBAAgB,CAAC;EAE5E,OAAOuB,iBAAiB,IAAIG,gBAAgB;AAC9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EasBuildGradleScript.js","names":[],"sources":["../../src/android/EasBuildGradleScript.ts"],"sourcesContent":["export default `// Build integration with EAS\n\nimport java.nio.file.Paths\n\nandroid {\n signingConfigs {\n release {\n // This is necessary to avoid needing the user to define a release signing config manually\n // If no release config is defined, and this is not present, build for assembleRelease will crash\n }\n }\n\n buildTypes {\n release {\n // This is necessary to avoid needing the user to define a release build type manually\n }\n }\n}\n\ndef isEasBuildConfigured = false\n\ntasks.whenTaskAdded {\n def debug = gradle.startParameter.taskNames.any { it.toLowerCase().contains('debug') }\n\n if (debug) {\n return\n }\n\n // We only need to configure EAS build once\n if (isEasBuildConfigured) {\n return\n }\n\n isEasBuildConfigured = true;\n\n android.signingConfigs.release {\n def credentialsJson = rootProject.file(\"../credentials.json\");\n\n if (credentialsJson.exists()) {\n if (storeFile && !System.getenv(\"EAS_BUILD\")) {\n println(\"Path to release keystore file is already set, ignoring 'credentials.json'\")\n } else {\n try {\n def credentials = new groovy.json.JsonSlurper().parse(credentialsJson)\n def keystorePath = Paths.get(credentials.android.keystore.keystorePath);\n def storeFilePath = keystorePath.isAbsolute()\n ? keystorePath\n : rootProject.file(\"..\").toPath().resolve(keystorePath);\n\n storeFile storeFilePath.toFile()\n storePassword credentials.android.keystore.keystorePassword\n keyAlias credentials.android.keystore.keyAlias\n if (credentials.android.keystore.containsKey(\"keyPassword\")) {\n keyPassword credentials.android.keystore.keyPassword\n } else {\n // key password is required by Gradle, but PKCS keystores don't have one\n // using the keystore password seems to satisfy the requirement\n keyPassword credentials.android.keystore.keystorePassword\n }\n } catch (Exception e) {\n println(\"An error occurred while parsing 'credentials.json': \" + e.message)\n }\n }\n } else {\n if (storeFile == null) {\n println(\"Couldn't find a 'credentials.json' file, skipping release keystore configuration\")\n }\n }\n }\n\n android.buildTypes.release {\n signingConfig android.signingConfigs.release\n }\n}\n`;\n"],"mappings":";;;;;;eAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,
|
|
1
|
+
{"version":3,"file":"EasBuildGradleScript.js","names":[],"sources":["../../src/android/EasBuildGradleScript.ts"],"sourcesContent":["export default `// Build integration with EAS\n\nimport java.nio.file.Paths\n\nandroid {\n signingConfigs {\n release {\n // This is necessary to avoid needing the user to define a release signing config manually\n // If no release config is defined, and this is not present, build for assembleRelease will crash\n }\n }\n\n buildTypes {\n release {\n // This is necessary to avoid needing the user to define a release build type manually\n }\n }\n}\n\ndef isEasBuildConfigured = false\n\ntasks.whenTaskAdded {\n def debug = gradle.startParameter.taskNames.any { it.toLowerCase().contains('debug') }\n\n if (debug) {\n return\n }\n\n // We only need to configure EAS build once\n if (isEasBuildConfigured) {\n return\n }\n\n isEasBuildConfigured = true;\n\n android.signingConfigs.release {\n def credentialsJson = rootProject.file(\"../credentials.json\");\n\n if (credentialsJson.exists()) {\n if (storeFile && !System.getenv(\"EAS_BUILD\")) {\n println(\"Path to release keystore file is already set, ignoring 'credentials.json'\")\n } else {\n try {\n def credentials = new groovy.json.JsonSlurper().parse(credentialsJson)\n def keystorePath = Paths.get(credentials.android.keystore.keystorePath);\n def storeFilePath = keystorePath.isAbsolute()\n ? keystorePath\n : rootProject.file(\"..\").toPath().resolve(keystorePath);\n\n storeFile storeFilePath.toFile()\n storePassword credentials.android.keystore.keystorePassword\n keyAlias credentials.android.keystore.keyAlias\n if (credentials.android.keystore.containsKey(\"keyPassword\")) {\n keyPassword credentials.android.keystore.keyPassword\n } else {\n // key password is required by Gradle, but PKCS keystores don't have one\n // using the keystore password seems to satisfy the requirement\n keyPassword credentials.android.keystore.keystorePassword\n }\n } catch (Exception e) {\n println(\"An error occurred while parsing 'credentials.json': \" + e.message)\n }\n }\n } else {\n if (storeFile == null) {\n println(\"Couldn't find a 'credentials.json' file, skipping release keystore configuration\")\n }\n }\n }\n\n android.buildTypes.release {\n signingConfig android.signingConfigs.release\n }\n}\n`;\n"],"mappings":";;;;;;eAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAAA"}
|
|
@@ -6,42 +6,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getGoogleMapsApiKey = getGoogleMapsApiKey;
|
|
7
7
|
exports.setGoogleMapsApiKey = setGoogleMapsApiKey;
|
|
8
8
|
exports.withGoogleMapsApiKey = void 0;
|
|
9
|
-
|
|
10
9
|
function _androidPlugins() {
|
|
11
10
|
const data = require("../plugins/android-plugins");
|
|
12
|
-
|
|
13
11
|
_androidPlugins = function () {
|
|
14
12
|
return data;
|
|
15
13
|
};
|
|
16
|
-
|
|
17
14
|
return data;
|
|
18
15
|
}
|
|
19
|
-
|
|
20
16
|
function _Manifest() {
|
|
21
17
|
const data = require("./Manifest");
|
|
22
|
-
|
|
23
18
|
_Manifest = function () {
|
|
24
19
|
return data;
|
|
25
20
|
};
|
|
26
|
-
|
|
27
21
|
return data;
|
|
28
22
|
}
|
|
29
|
-
|
|
30
23
|
const META_API_KEY = 'com.google.android.geo.API_KEY';
|
|
31
24
|
const LIB_HTTP = 'org.apache.http.legacy';
|
|
32
25
|
const withGoogleMapsApiKey = (0, _androidPlugins().createAndroidManifestPlugin)(setGoogleMapsApiKey, 'withGoogleMapsApiKey');
|
|
33
26
|
exports.withGoogleMapsApiKey = withGoogleMapsApiKey;
|
|
34
|
-
|
|
35
27
|
function getGoogleMapsApiKey(config) {
|
|
36
28
|
var _config$android$confi, _config$android, _config$android$confi2, _config$android$confi3;
|
|
37
|
-
|
|
38
29
|
return (_config$android$confi = (_config$android = config.android) === null || _config$android === void 0 ? void 0 : (_config$android$confi2 = _config$android.config) === null || _config$android$confi2 === void 0 ? void 0 : (_config$android$confi3 = _config$android$confi2.googleMaps) === null || _config$android$confi3 === void 0 ? void 0 : _config$android$confi3.apiKey) !== null && _config$android$confi !== void 0 ? _config$android$confi : null;
|
|
39
30
|
}
|
|
40
|
-
|
|
41
31
|
function setGoogleMapsApiKey(config, androidManifest) {
|
|
42
32
|
const apiKey = getGoogleMapsApiKey(config);
|
|
43
33
|
const mainApplication = (0, _Manifest().getMainApplicationOrThrow)(androidManifest);
|
|
44
|
-
|
|
45
34
|
if (apiKey) {
|
|
46
35
|
// If the item exists, add it back
|
|
47
36
|
(0, _Manifest().addMetaDataItemToMainApplication)(mainApplication, META_API_KEY, apiKey);
|
|
@@ -54,7 +43,6 @@ function setGoogleMapsApiKey(config, androidManifest) {
|
|
|
54
43
|
(0, _Manifest().removeMetaDataItemFromMainApplication)(mainApplication, META_API_KEY);
|
|
55
44
|
(0, _Manifest().removeUsesLibraryItemFromMainApplication)(mainApplication, LIB_HTTP);
|
|
56
45
|
}
|
|
57
|
-
|
|
58
46
|
return androidManifest;
|
|
59
47
|
}
|
|
60
48
|
//# sourceMappingURL=GoogleMapsApiKey.js.map
|