@expo/config-plugins 6.0.1 → 7.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/README.md +2 -2
- package/build/Plugin.types.js.map +1 -1
- package/build/android/AllowBackup.js.map +1 -1
- package/build/android/BuildProperties.js.map +1 -1
- package/build/android/Colors.js.map +1 -1
- package/build/android/EasBuild.js.map +1 -1
- package/build/android/EasBuildGradleScript.js.map +1 -1
- package/build/android/GoogleMapsApiKey.js.map +1 -1
- package/build/android/GoogleServices.js.map +1 -1
- package/build/android/IntentFilters.js.map +1 -1
- package/build/android/Manifest.js.map +1 -1
- package/build/android/Name.js.map +1 -1
- package/build/android/Orientation.js.map +1 -1
- package/build/android/Package.js +1 -0
- package/build/android/Package.js.map +1 -1
- package/build/android/Paths.js.map +1 -1
- package/build/android/Permissions.js.map +1 -1
- package/build/android/PrimaryColor.js.map +1 -1
- package/build/android/Properties.js.map +1 -1
- package/build/android/Resources.js.map +1 -1
- package/build/android/Scheme.js +1 -1
- package/build/android/Scheme.js.map +1 -1
- package/build/android/StatusBar.js.map +1 -1
- package/build/android/Strings.js.map +1 -1
- package/build/android/Styles.js.map +1 -1
- package/build/android/Updates.js +2 -2
- package/build/android/Updates.js.map +1 -1
- package/build/android/Version.js.map +1 -1
- package/build/android/WindowSoftInputMode.js.map +1 -1
- package/build/android/codeMod.js.map +1 -1
- package/build/android/index.js.map +1 -1
- package/build/index.js.map +1 -1
- package/build/ios/Bitcode.js.map +1 -1
- package/build/ios/BuildProperties.js.map +1 -1
- package/build/ios/BuildScheme.js.map +1 -1
- package/build/ios/BundleIdentifier.js.map +1 -1
- package/build/ios/DeviceFamily.js.map +1 -1
- package/build/ios/Entitlements.js.map +1 -1
- package/build/ios/Google.js.map +1 -1
- package/build/ios/Locales.js.map +1 -1
- package/build/ios/Maps.js.map +1 -1
- package/build/ios/Name.js.map +1 -1
- package/build/ios/Orientation.js.map +1 -1
- package/build/ios/Paths.js.map +1 -1
- package/build/ios/Permissions.js.map +1 -1
- package/build/ios/ProvisioningProfile.js.map +1 -1
- package/build/ios/RequiresFullScreen.js +1 -1
- package/build/ios/RequiresFullScreen.js.map +1 -1
- package/build/ios/Scheme.js.map +1 -1
- package/build/ios/Swift.js +1 -1
- package/build/ios/Swift.js.map +1 -1
- package/build/ios/Target.js.map +1 -1
- package/build/ios/Updates.js +2 -2
- package/build/ios/Updates.js.map +1 -1
- package/build/ios/UsesNonExemptEncryption.js.map +1 -1
- package/build/ios/Version.js.map +1 -1
- package/build/ios/XcodeProjectFile.js.map +1 -1
- package/build/ios/codeMod.js.map +1 -1
- package/build/ios/index.js.map +1 -1
- package/build/ios/utils/Xcodeproj.js.map +1 -1
- package/build/ios/utils/getInfoPlistPath.js.map +1 -1
- package/build/ios/utils/string.js.map +1 -1
- package/build/plugins/android-plugins.js.map +1 -1
- package/build/plugins/createBaseMod.d.ts +2 -1
- package/build/plugins/createBaseMod.js.map +1 -1
- package/build/plugins/ios-plugins.js.map +1 -1
- package/build/plugins/mod-compiler.js +3 -3
- package/build/plugins/mod-compiler.js.map +1 -1
- package/build/plugins/withAndroidBaseMods.js.map +1 -1
- package/build/plugins/withDangerousMod.js.map +1 -1
- package/build/plugins/withIosBaseMods.js.map +1 -1
- package/build/plugins/withMod.d.ts +2 -1
- package/build/plugins/withMod.js.map +1 -1
- package/build/plugins/withPlugins.js.map +1 -1
- package/build/plugins/withRunOnce.js.map +1 -1
- package/build/plugins/withStaticPlugin.js.map +1 -1
- package/build/utils/Updates.d.ts +2 -2
- package/build/utils/Updates.js +35 -18
- package/build/utils/Updates.js.map +1 -1
- package/build/utils/XML.d.ts +1 -0
- package/build/utils/XML.js +5 -2
- package/build/utils/XML.js.map +1 -1
- package/build/utils/commonCodeMod.js.map +1 -1
- package/build/utils/errors.js.map +1 -1
- package/build/utils/fs.js.map +1 -1
- package/build/utils/generateCode.js.map +1 -1
- package/build/utils/history.js.map +1 -1
- package/build/utils/matchBrackets.js.map +1 -1
- package/build/utils/modules.js.map +1 -1
- package/build/utils/obj.js.map +1 -1
- package/build/utils/plugin-resolver.js.map +1 -1
- package/build/utils/sortObject.js.map +1 -1
- package/build/utils/versions.js.map +1 -1
- package/build/utils/warnings.d.ts +1 -1
- package/build/utils/warnings.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
|
|
16
16
|
<!-- Body -->
|
|
17
17
|
|
|
18
|
-
Most basic functionality can be controlled by using the
|
|
18
|
+
Most basic functionality can be controlled by using 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).
|
|
19
19
|
|
|
20
|
-
For more info, please refer to the official docs: [Config Plugins](https://docs.expo.dev/
|
|
20
|
+
For more info, please refer to the official Expo docs: [Config Plugins](https://docs.expo.dev/home/config-plugins/introduction/).
|
|
21
21
|
|
|
22
22
|
## Environment Variables
|
|
23
23
|
|
|
@@ -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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;EAAA;
|
|
1
|
+
{"version":3,"file":"Plugin.types.js","names":["_xcode","data","require","_Manifest","_IosConfig"],"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,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAE,UAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA"}
|
|
@@ -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":";;;;;;;;;AAEA;EAAA;
|
|
1
|
+
{"version":3,"file":"AllowBackup.js","names":["_androidPlugins","data","require","_Manifest","withAllowBackup","createAndroidManifestPlugin","setAllowBackup","exports","getAllowBackup","config","_config$android$allow","_config$android","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,SAAAA,gBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,eAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,UAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAMG,eAAe,GAAG,IAAAC,6CAA2B,EAACC,cAAc,EAAE,iBAAiB,CAAC;AAACC,OAAA,CAAAH,eAAA,GAAAA,eAAA;AAEvF,SAASI,cAAcA,CAACC,MAAmC,EAAE;EAAA,IAAAC,qBAAA,EAAAC,eAAA;EAClE;EACA;EACA,QAAAD,qBAAA,IAAAC,eAAA,GAAOF,MAAM,CAACG,OAAO,cAAAD,eAAA,uBAAdA,eAAA,CAAgBE,WAAW,cAAAH,qBAAA,cAAAA,qBAAA,GAAI,IAAI;AAC5C;AAEO,SAASJ,cAAcA,CAC5BG,MAAmC,EACnCK,eAAgC,EAChC;EACA,MAAMD,WAAW,GAAGL,cAAc,CAACC,MAAM,CAAC;EAE1C,MAAMM,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,0BAA0BA,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"}
|
|
@@ -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 ?? '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;
|
|
1
|
+
{"version":3,"file":"BuildProperties.js","names":["_androidPlugins","data","require","createBuildGradlePropsConfigPlugin","configToPropertyRules","name","withUnknown","config","sourceConfig","withGradleProperties","modResults","updateAndroidBuildPropertiesFromConfig","Object","defineProperty","value","withJsEngineGradleProps","propName","propValueGetter","_ref","_config$android$jsEng","_config$android","android","jsEngine","exports","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,SAAAA,gBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,eAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,kCAAkCA,CAChDC,qBAAmE,EACnEC,IAAa,EACb;EACA,MAAMC,WAAwF,GAAGA,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,IAAAW,IAAA,EAAAC,qBAAA,EAAAC,eAAA;IAAA,QAAAF,IAAA,IAAAC,qBAAA,IAAAC,eAAA,GAAKb,MAAM,CAACc,OAAO,cAAAD,eAAA,uBAAdA,eAAA,CAAgBE,QAAQ,cAAAH,q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,"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;
|
|
1
|
+
{"version":3,"file":"Colors.js","names":["_Paths","data","require","_Resources","getProjectColorsXMLPathAsync","projectRoot","kind","getResourceXMLPathAsync","name","setColorItem","itemToAdd","colorFileContentsJSON","_colorFileContentsJSO","resources","color","colorNameExists","filter","e","$","_","push","removeColorItem","named","contents","_contents$resources","index","findIndex","splice","assignColorValue","xml","value","buildResourceItem","getColorsAsObject","_xml$resources","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,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AASO,SAASG,4BAA4BA,CAC1CC,WAAmB,EACnB;EAAEC;AAA8B,CAAC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F,IAAIG,KAAK,GAAG,CAAC,CAAC,EAAE;MACd;MACAF,QAAQ,CAACV,SAAS,CAACC,KAAK,CAACa,MAAM,CAACF,KAAK,EAAE,CAAC,CAAC;IAC3C;EACF;EACA,OAAOF,QAAQ;AACjB;;AAEA;AACA;AACA;AACO,SAASK,gBAAgBA,CAC9BC,GAAgB,EAChB;EACEC,KAAK;EACLtB;AAIF,CAAC,EACD;EACA,IAAIsB,KAAK,EAAE;IACT,OAAOrB,YAAY,CACjB,IAAAsB,8BAAiB,EAAC;MAChBvB,IAAI;MACJsB;IACF,CAAC,CAAC,EACFD,GAAG,CACJ;EACH;EAEA,OAAOR,eAAe,CAACb,IAAI,EAAEqB,GAAG,CAAC;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,iBAAiBA,CAACH,GAAgB,EAAiC;EAAA,IAAAI,cAAA;EACjF,IAAI,EAACJ,GAAG,aAAHA,GAAG,gBAAAI,cAAA,GAAHJ,GAAG,CAAEhB,SAAS,cAAAoB,cAAA,eAAdA,cAAA,CAAgBnB,KAAK,GAAE;IAC1B,OAAO,IAAI;EACb;EAEA,OAAO,IAAAoB,qCAAwB,EAACL,GAAG,CAAChB,SAAS,CAACC,KAAK,CAAC;AACtD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASqB,oBAAoBA,CAACC,GAA2B,EAAe;EAC7E,OAAO;IACLvB,SAAS,EAAE;MACTC,KAAK,EAAE,IAAAuB,qCAAwB,EAACD,GAAG;IACrC;EACF,CAAC;AACH"}
|
|
@@ -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","
|
|
1
|
+
{"version":3,"file":"EasBuild.js","names":["_fs","data","_interopRequireDefault","require","_path","_EasBuildGradleScript","Paths","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","APPLY_EAS_GRADLE","hasApplyLine","content","applyLine","replace","split","some","line","getEasBuildGradlePath","projectRoot","path","join","configureEasBuildAsync","buildGradlePath","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,SAAAA,IAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,GAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,sBAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,qBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,MAAA;EAAA,MAAAL,IAAA,GAAAM,uBAAA,CAAAJ,OAAA;EAAAG,KAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAiC,SAAAO,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAF,wBAAAM,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAA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,eAAe,GAAGrC,KAAK,GAACsC,yBAAyB,CAACL,WAAW,CAAC;EACpE,MAAMM,aAAa,GAAGP,qBAAqB,CAACC,WAAW,CAAC;EAExD,MAAMO,aAAE,CAACC,QAAQ,CAACC,SAAS,CAACH,aAAa,EAAEI,+BAAY,CAAC;EAExD,MAAMC,kBAAkB,GAAG,MAAMJ,aAAE,CAACC,QAAQ,CAACI,QAAQ,CAACX,eAAI,CAACC,IAAI,CAACE,eAAe,CAAC,EAAE,MAAM,CAAC;EAEzF,MAAMS,iBAAiB,GAAGrB,YAAY,CAACmB,kBAAkB,EAAEpB,gBAAgB,CAAC;EAE5E,IAAI,CAACsB,iBAAiB,EAAE;IACtB,MAAMN,aAAE,CAACC,QAAQ,CAACC,SAAS,CACzBL,eAAe,EACd,GAAEO,kBAAkB,CAACG,IAAI,EAAG,KAAIvB,gBAAiB,IAAG,CACtD;EACH;AACF;AAEO,eAAewB,+BAA+BA,CAACf,WAAmB,EAAoB;EAC3F,MAAMI,eAAe,GAAGrC,KAAK,GAACsC,yBAAyB,CAACL,WAAW,CAAC;EACpE,MAAMM,aAAa,GAAGP,qBAAqB,CAACC,WAAW,CAAC;EAExD,MAAMgB,gBAAgB,GAAG,MAAMT,aAAE,CAACU,UAAU,CAACX,aAAa,CAAC;EAE3D,MAAMK,kBAAkB,GAAG,MAAMJ,aAAE,CAACC,QAAQ,CAACI,QAAQ,CAACX,eAAI,CAACC,IAAI,CAACE,eAAe,CAAC,EAAE,MAAM,CAAC;EACzF,MAAMS,iBAAiB,GAAGrB,YAAY,CAACmB,kBAAkB,EAAEpB,gBAAgB,CAAC;EAE5E,OAAOsB,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,CAAC;
|
|
1
|
+
{"version":3,"file":"EasBuildGradleScript.js","names":["exports","default","_default"],"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;AAAAA,OAAA,CAAAC,OAAA,GAAAC,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleMapsApiKey.js","names":["META_API_KEY","LIB_HTTP","withGoogleMapsApiKey","createAndroidManifestPlugin","setGoogleMapsApiKey","getGoogleMapsApiKey","config","android","googleMaps","apiKey","androidManifest","mainApplication","getMainApplicationOrThrow","addMetaDataItemToMainApplication","addUsesLibraryItemToMainApplication","name","required","removeMetaDataItemFromMainApplication","removeUsesLibraryItemFromMainApplication"],"sources":["../../src/android/GoogleMapsApiKey.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { createAndroidManifestPlugin } from '../plugins/android-plugins';\nimport {\n addMetaDataItemToMainApplication,\n addUsesLibraryItemToMainApplication,\n AndroidManifest,\n getMainApplicationOrThrow,\n removeMetaDataItemFromMainApplication,\n removeUsesLibraryItemFromMainApplication,\n} from './Manifest';\n\nconst META_API_KEY = 'com.google.android.geo.API_KEY';\nconst LIB_HTTP = 'org.apache.http.legacy';\n\nexport const withGoogleMapsApiKey = createAndroidManifestPlugin(\n setGoogleMapsApiKey,\n 'withGoogleMapsApiKey'\n);\n\nexport function getGoogleMapsApiKey(config: Pick<ExpoConfig, 'android'>) {\n return config.android?.config?.googleMaps?.apiKey ?? null;\n}\n\nexport function setGoogleMapsApiKey(\n config: Pick<ExpoConfig, 'android'>,\n androidManifest: AndroidManifest\n) {\n const apiKey = getGoogleMapsApiKey(config);\n const mainApplication = getMainApplicationOrThrow(androidManifest);\n\n if (apiKey) {\n // If the item exists, add it back\n addMetaDataItemToMainApplication(mainApplication, META_API_KEY, apiKey);\n addUsesLibraryItemToMainApplication(mainApplication, {\n name: LIB_HTTP,\n required: false,\n });\n } else {\n // Remove any existing item\n removeMetaDataItemFromMainApplication(mainApplication, META_API_KEY);\n removeUsesLibraryItemFromMainApplication(mainApplication, LIB_HTTP);\n }\n\n return androidManifest;\n}\n"],"mappings":";;;;;;;;AAEA;EAAA;
|
|
1
|
+
{"version":3,"file":"GoogleMapsApiKey.js","names":["_androidPlugins","data","require","_Manifest","META_API_KEY","LIB_HTTP","withGoogleMapsApiKey","createAndroidManifestPlugin","setGoogleMapsApiKey","exports","getGoogleMapsApiKey","config","_config$android$confi","_config$android","_config$android$confi2","_config$android$confi3","android","googleMaps","apiKey","androidManifest","mainApplication","getMainApplicationOrThrow","addMetaDataItemToMainApplication","addUsesLibraryItemToMainApplication","name","required","removeMetaDataItemFromMainApplication","removeUsesLibraryItemFromMainApplication"],"sources":["../../src/android/GoogleMapsApiKey.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { createAndroidManifestPlugin } from '../plugins/android-plugins';\nimport {\n addMetaDataItemToMainApplication,\n addUsesLibraryItemToMainApplication,\n AndroidManifest,\n getMainApplicationOrThrow,\n removeMetaDataItemFromMainApplication,\n removeUsesLibraryItemFromMainApplication,\n} from './Manifest';\n\nconst META_API_KEY = 'com.google.android.geo.API_KEY';\nconst LIB_HTTP = 'org.apache.http.legacy';\n\nexport const withGoogleMapsApiKey = createAndroidManifestPlugin(\n setGoogleMapsApiKey,\n 'withGoogleMapsApiKey'\n);\n\nexport function getGoogleMapsApiKey(config: Pick<ExpoConfig, 'android'>) {\n return config.android?.config?.googleMaps?.apiKey ?? null;\n}\n\nexport function setGoogleMapsApiKey(\n config: Pick<ExpoConfig, 'android'>,\n androidManifest: AndroidManifest\n) {\n const apiKey = getGoogleMapsApiKey(config);\n const mainApplication = getMainApplicationOrThrow(androidManifest);\n\n if (apiKey) {\n // If the item exists, add it back\n addMetaDataItemToMainApplication(mainApplication, META_API_KEY, apiKey);\n addUsesLibraryItemToMainApplication(mainApplication, {\n name: LIB_HTTP,\n required: false,\n });\n } else {\n // Remove any existing item\n removeMetaDataItemFromMainApplication(mainApplication, META_API_KEY);\n removeUsesLibraryItemFromMainApplication(mainApplication, LIB_HTTP);\n }\n\n return androidManifest;\n}\n"],"mappings":";;;;;;;;AAEA,SAAAA,gBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,eAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,UAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AASA,MAAMG,YAAY,GAAG,gCAAgC;AACrD,MAAMC,QAAQ,GAAG,wBAAwB;AAElC,MAAMC,oBAAoB,GAAG,IAAAC,6CAA2B,EAC7DC,mBAAmB,EACnB,sBAAsB,CACvB;AAACC,OAAA,CAAAH,oBAAA,GAAAA,oBAAA;AAEK,SAASI,mBAAmBA,CAACC,MAAmC,EAAE;EAAA,IAAAC,qBAAA,EAAAC,eAAA,EAAAC,sBAAA,EAAAC,sBAAA;EACvE,QAAAH,qBAAA,IAAAC,eAAA,GAAOF,MAAM,CAACK,OAAO,cAAAH,eAAA,wBAAAC,sBAAA,GAAdD,eAAA,CAAgBF,MAAM,cAAAG,sBAAA,wBAAAC,sBAAA,GAAtBD,sBAAA,CAAwBG,UAAU,cAAAF,sBAAA,uBAAlCA,sBAAA,CAAoCG,MAAM,cAAAN,qBAAA,cAAAA,qBAAA,GAAI,IAAI;AAC3D;AAEO,SAASJ,mBAAmBA,CACjCG,MAAmC,EACnCQ,eAAgC,EAChC;EACA,MAAMD,MAAM,GAAGR,mBAAmB,CAACC,MAAM,CAAC;EAC1C,MAAMS,eAAe,GAAG,IAAAC,qCAAyB,EAACF,eAAe,CAAC;EAElE,IAAID,MAAM,EAAE;IACV;IACA,IAAAI,4CAAgC,EAACF,eAAe,EAAEhB,YAAY,EAAEc,MAAM,CAAC;IACvE,IAAAK,+CAAmC,EAACH,eAAe,EAAE;MACnDI,IAAI,EAAEnB,QAAQ;MACdoB,QAAQ,EAAE;IACZ,CAAC,CAAC;EACJ,CAAC,MAAM;IACL;IACA,IAAAC,iDAAqC,EAACN,eAAe,EAAEhB,YAAY,CAAC;IACpE,IAAAuB,oDAAwC,EAACP,eAAe,EAAEf,QAAQ,CAAC;EACrE;EAEA,OAAOc,eAAe;AACxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleServices.js","names":["DEFAULT_TARGET_PATH","googleServicesClassPath","googleServicesPlugin","googleServicesVersion","withClassPath","config","withProjectBuildGradle","modResults","language","contents","setClassPath","addWarningAndroid","withApplyPlugin","withAppBuildGradle","applyPlugin","withGoogleServicesFile","withDangerousMod","setGoogleServicesFile","modRequest","projectRoot","getGoogleServicesFilePath","android","googleServicesFile","targetPath","partialSourcePath","completeSourcePath","path","resolve","destinationPath","copyFilePathToPathAsync","e","console","log","Error","buildGradle","includes","replace","appBuildGradle","pattern","RegExp","match"],"sources":["../../src/android/GoogleServices.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport path from 'path';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withAppBuildGradle, withProjectBuildGradle } from '../plugins/android-plugins';\nimport { withDangerousMod } from '../plugins/withDangerousMod';\nimport { copyFilePathToPathAsync } from '../utils/fs';\nimport { addWarningAndroid } from '../utils/warnings';\n\nconst DEFAULT_TARGET_PATH = './android/app/google-services.json';\n\nconst googleServicesClassPath = 'com.google.gms:google-services';\nconst googleServicesPlugin = 'com.google.gms.google-services';\n\n// NOTE(brentvatne): This may be annoying to keep up to date...\nconst googleServicesVersion = '4.3.3';\n\nexport const withClassPath: ConfigPlugin = (config) => {\n return withProjectBuildGradle(config, (config) => {\n if (config.modResults.language === 'groovy') {\n config.modResults.contents = setClassPath(config, config.modResults.contents);\n } else {\n addWarningAndroid(\n 'android.googleServicesFile',\n `Cannot automatically configure project build.gradle if it's not groovy`\n );\n }\n return config;\n });\n};\n\nexport const withApplyPlugin: ConfigPlugin = (config) => {\n return withAppBuildGradle(config, (config) => {\n if (config.modResults.language === 'groovy') {\n config.modResults.contents = applyPlugin(config, config.modResults.contents);\n } else {\n addWarningAndroid(\n 'android.googleServicesFile',\n `Cannot automatically configure app build.gradle if it's not groovy`\n );\n }\n return config;\n });\n};\n\n/**\n * Add `google-services.json` to project\n */\nexport const withGoogleServicesFile: ConfigPlugin = (config) => {\n return withDangerousMod(config, [\n 'android',\n async (config) => {\n await setGoogleServicesFile(config, config.modRequest.projectRoot);\n return config;\n },\n ]);\n};\n\nexport function getGoogleServicesFilePath(config: Pick<ExpoConfig, 'android'>) {\n return config.android?.googleServicesFile ?? null;\n}\n\nexport async function setGoogleServicesFile(\n config: Pick<ExpoConfig, 'android'>,\n projectRoot: string,\n targetPath: string = DEFAULT_TARGET_PATH\n) {\n const partialSourcePath = getGoogleServicesFilePath(config);\n if (!partialSourcePath) {\n return false;\n }\n\n const completeSourcePath = path.resolve(projectRoot, partialSourcePath);\n const destinationPath = path.resolve(projectRoot, targetPath);\n\n try {\n await copyFilePathToPathAsync(completeSourcePath, destinationPath);\n } catch (e) {\n console.log(e);\n throw new Error(\n `Cannot copy google-services.json from ${completeSourcePath} to ${destinationPath}. Please make sure the source and destination paths exist.`\n );\n }\n return true;\n}\n\n/**\n * Adding the Google Services plugin\n * NOTE(brentvatne): string replacement is a fragile approach! we need a\n * better solution than this.\n */\nexport function setClassPath(config: Pick<ExpoConfig, 'android'>, buildGradle: string) {\n const googleServicesFile = getGoogleServicesFilePath(config);\n if (!googleServicesFile) {\n return buildGradle;\n }\n\n if (buildGradle.includes(googleServicesClassPath)) {\n return buildGradle;\n }\n\n //\n return buildGradle.replace(\n /dependencies\\s?{/,\n `dependencies {\n classpath '${googleServicesClassPath}:${googleServicesVersion}'`\n );\n}\n\nexport function applyPlugin(config: Pick<ExpoConfig, 'android'>, appBuildGradle: string) {\n const googleServicesFile = getGoogleServicesFilePath(config);\n if (!googleServicesFile) {\n return appBuildGradle;\n }\n\n // Make sure the project does not have the plugin already\n const pattern = new RegExp(`apply\\\\s+plugin:\\\\s+['\"]${googleServicesPlugin}['\"]`);\n if (appBuildGradle.match(pattern)) {\n return appBuildGradle;\n }\n\n // Add it to the end of the file\n return appBuildGradle + `\\napply plugin: '${googleServicesPlugin}'`;\n}\n"],"mappings":";;;;;;;;;;AACA;EAAA;
|
|
1
|
+
{"version":3,"file":"GoogleServices.js","names":["_path","data","_interopRequireDefault","require","_androidPlugins","_withDangerousMod","_fs","_warnings","obj","__esModule","default","DEFAULT_TARGET_PATH","googleServicesClassPath","googleServicesPlugin","googleServicesVersion","withClassPath","config","withProjectBuildGradle","modResults","language","contents","setClassPath","addWarningAndroid","exports","withApplyPlugin","withAppBuildGradle","applyPlugin","withGoogleServicesFile","withDangerousMod","setGoogleServicesFile","modRequest","projectRoot","getGoogleServicesFilePath","_config$android$googl","_config$android","android","googleServicesFile","targetPath","partialSourcePath","completeSourcePath","path","resolve","destinationPath","copyFilePathToPathAsync","e","console","log","Error","buildGradle","includes","replace","appBuildGradle","pattern","RegExp","match"],"sources":["../../src/android/GoogleServices.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport path from 'path';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withAppBuildGradle, withProjectBuildGradle } from '../plugins/android-plugins';\nimport { withDangerousMod } from '../plugins/withDangerousMod';\nimport { copyFilePathToPathAsync } from '../utils/fs';\nimport { addWarningAndroid } from '../utils/warnings';\n\nconst DEFAULT_TARGET_PATH = './android/app/google-services.json';\n\nconst googleServicesClassPath = 'com.google.gms:google-services';\nconst googleServicesPlugin = 'com.google.gms.google-services';\n\n// NOTE(brentvatne): This may be annoying to keep up to date...\nconst googleServicesVersion = '4.3.3';\n\nexport const withClassPath: ConfigPlugin = (config) => {\n return withProjectBuildGradle(config, (config) => {\n if (config.modResults.language === 'groovy') {\n config.modResults.contents = setClassPath(config, config.modResults.contents);\n } else {\n addWarningAndroid(\n 'android.googleServicesFile',\n `Cannot automatically configure project build.gradle if it's not groovy`\n );\n }\n return config;\n });\n};\n\nexport const withApplyPlugin: ConfigPlugin = (config) => {\n return withAppBuildGradle(config, (config) => {\n if (config.modResults.language === 'groovy') {\n config.modResults.contents = applyPlugin(config, config.modResults.contents);\n } else {\n addWarningAndroid(\n 'android.googleServicesFile',\n `Cannot automatically configure app build.gradle if it's not groovy`\n );\n }\n return config;\n });\n};\n\n/**\n * Add `google-services.json` to project\n */\nexport const withGoogleServicesFile: ConfigPlugin = (config) => {\n return withDangerousMod(config, [\n 'android',\n async (config) => {\n await setGoogleServicesFile(config, config.modRequest.projectRoot);\n return config;\n },\n ]);\n};\n\nexport function getGoogleServicesFilePath(config: Pick<ExpoConfig, 'android'>) {\n return config.android?.googleServicesFile ?? null;\n}\n\nexport async function setGoogleServicesFile(\n config: Pick<ExpoConfig, 'android'>,\n projectRoot: string,\n targetPath: string = DEFAULT_TARGET_PATH\n) {\n const partialSourcePath = getGoogleServicesFilePath(config);\n if (!partialSourcePath) {\n return false;\n }\n\n const completeSourcePath = path.resolve(projectRoot, partialSourcePath);\n const destinationPath = path.resolve(projectRoot, targetPath);\n\n try {\n await copyFilePathToPathAsync(completeSourcePath, destinationPath);\n } catch (e) {\n console.log(e);\n throw new Error(\n `Cannot copy google-services.json from ${completeSourcePath} to ${destinationPath}. Please make sure the source and destination paths exist.`\n );\n }\n return true;\n}\n\n/**\n * Adding the Google Services plugin\n * NOTE(brentvatne): string replacement is a fragile approach! we need a\n * better solution than this.\n */\nexport function setClassPath(config: Pick<ExpoConfig, 'android'>, buildGradle: string) {\n const googleServicesFile = getGoogleServicesFilePath(config);\n if (!googleServicesFile) {\n return buildGradle;\n }\n\n if (buildGradle.includes(googleServicesClassPath)) {\n return buildGradle;\n }\n\n //\n return buildGradle.replace(\n /dependencies\\s?{/,\n `dependencies {\n classpath '${googleServicesClassPath}:${googleServicesVersion}'`\n );\n}\n\nexport function applyPlugin(config: Pick<ExpoConfig, 'android'>, appBuildGradle: string) {\n const googleServicesFile = getGoogleServicesFilePath(config);\n if (!googleServicesFile) {\n return appBuildGradle;\n }\n\n // Make sure the project does not have the plugin already\n const pattern = new RegExp(`apply\\\\s+plugin:\\\\s+['\"]${googleServicesPlugin}['\"]`);\n if (appBuildGradle.match(pattern)) {\n return appBuildGradle;\n }\n\n // Add it to the end of the file\n return appBuildGradle + `\\napply plugin: '${googleServicesPlugin}'`;\n}\n"],"mappings":";;;;;;;;;;AACA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAG,gBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,eAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,kBAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,iBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,IAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,GAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,UAAA;EAAA,MAAAN,IAAA,GAAAE,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rF,MAAMZ,kBAAkB,GAAGJ,yBAAyB,CAAChB,MAAM,CAAC;EAC5D,IAAI,CAACoB,kBAAkB,EAAE;IACvB,OAAOY,WAAW;EACpB;EAEA,IAAIA,WAAW,CAACC,QAAQ,CAACrC,uBAAuB,CAAC,EAAE;IACjD,OAAOoC,WAAW;EACpB;;EAEA;EACA,OAAOA,WAAW,CAACE,OAAO,CACxB,kBAAkB,EACjB;AACL,qBAAqBtC,uBAAwB,IAAGE,qBAAsB,GAAE,CACrE;AACH;AAEO,SAASY,WAAWA,CAACV,MAAmC,EAAEmC,cAAsB,EAAE;EACvF,MAAMf,kBAAkB,GAAGJ,yBAAyB,CAAChB,MAAM,CAAC;EAC5D,IAAI,CAACoB,kBAAkB,EAAE;IACvB,OAAOe,cAAc;EACvB;;EAEA;EACA,MAAMC,OAAO,GAAG,IAAIC,MAAM,CAAE,2BAA0BxC,oBAAqB,MAAK,CAAC;EACjF,IAAIsC,cAAc,CAACG,KAAK,CAACF,OAAO,CAAC,EAAE;IACjC,OAAOD,cAAc;EACvB;;EAEA;EACA,OAAOA,cAAc,GAAI,oBAAmBtC,oBAAqB,GAAE;AACrE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntentFilters.js","names":["GENERATED_TAG","withAndroidIntentFilters","createAndroidManifestPlugin","setAndroidIntentFilters","getIntentFilters","config","android","intentFilters","androidManifest","mainActivity","getMainActivityOrThrow","length","filter","value","$","concat","renderIntentFilters","map","intentFilter","autoVerify","undefined","action","
|
|
1
|
+
{"version":3,"file":"IntentFilters.js","names":["_androidPlugins","data","require","_Manifest","GENERATED_TAG","withAndroidIntentFilters","createAndroidManifestPlugin","setAndroidIntentFilters","exports","getIntentFilters","config","_config$android$inten","_config$android","android","intentFilters","androidManifest","_mainActivity$intent","_mainActivity$intent2","mainActivity","getMainActivityOrThrow","length","filter","value","_value$$","$","concat","renderIntentFilters","map","intentFilter","autoVerify","undefined","action","renderIntentFilterData","category","renderIntentFilterCategory","Array","isArray","Boolean","datum","Object","entries","reduce","prev","key","cat"],"sources":["../../src/android/IntentFilters.ts"],"sourcesContent":["import { Android, AndroidIntentFiltersData, ExpoConfig } from '@expo/config-types';\n\nimport { createAndroidManifestPlugin } from '../plugins/android-plugins';\nimport { AndroidManifest, getMainActivityOrThrow, ManifestIntentFilter } from './Manifest';\n\ntype AndroidIntentFilters = NonNullable<Android['intentFilters']>;\n\nconst GENERATED_TAG = 'data-generated';\n\nexport const withAndroidIntentFilters = createAndroidManifestPlugin(\n setAndroidIntentFilters,\n 'withAndroidIntentFilters'\n);\n\nexport function getIntentFilters(config: Pick<ExpoConfig, 'android'>): AndroidIntentFilters {\n return config.android?.intentFilters ?? [];\n}\n\nexport function setAndroidIntentFilters(\n config: Pick<ExpoConfig, 'android'>,\n androidManifest: AndroidManifest\n): AndroidManifest {\n // Always ensure old tags are removed.\n const mainActivity = getMainActivityOrThrow(androidManifest);\n // Remove all generated tags from previous runs...\n if (mainActivity['intent-filter']?.length) {\n mainActivity['intent-filter'] = mainActivity['intent-filter'].filter(\n (value) => value.$?.[GENERATED_TAG] !== 'true'\n );\n }\n\n const intentFilters = getIntentFilters(config);\n if (!intentFilters.length) {\n return androidManifest;\n }\n\n mainActivity['intent-filter'] = mainActivity['intent-filter']?.concat(\n renderIntentFilters(intentFilters)\n );\n\n return androidManifest;\n}\n\nexport default function renderIntentFilters(\n intentFilters: AndroidIntentFilters\n): ManifestIntentFilter[] {\n return intentFilters.map((intentFilter) => {\n // <intent-filter>\n return {\n $: {\n 'android:autoVerify': intentFilter.autoVerify ? 'true' : undefined,\n // Add a custom \"generated\" tag that we can query later to remove.\n [GENERATED_TAG]: 'true',\n },\n action: [\n // <action android:name=\"android.intent.action.VIEW\"/>\n {\n $: {\n 'android:name': `android.intent.action.${intentFilter.action}`,\n },\n },\n ],\n data: renderIntentFilterData(intentFilter.data),\n category: renderIntentFilterCategory(intentFilter.category),\n };\n });\n}\n\n/** Like `<data android:scheme=\"exp\"/>` */\nfunction renderIntentFilterData(data?: AndroidIntentFiltersData | AndroidIntentFiltersData[]) {\n return (Array.isArray(data) ? data : [data]).filter(Boolean).map((datum) => ({\n $: Object.entries(datum ?? {}).reduce(\n (prev, [key, value]) => ({ ...prev, [`android:${key}`]: value }),\n {}\n ),\n }));\n}\n\n/** Like `<category android:name=\"android.intent.category.DEFAULT\"/>` */\nfunction renderIntentFilterCategory(category?: string | string[]) {\n return (Array.isArray(category) ? category : [category]).filter(Boolean).map((cat) => ({\n $: {\n 'android:name': `android.intent.category.${cat}`,\n },\n }));\n}\n"],"mappings":";;;;;;;;;AAEA,SAAAA,gBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,eAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,UAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,MAAMG,aAAa,GAAG,gBAAgB;AAE/B,MAAMC,wBAAwB,GAAG,IAAAC,6CAA2B,EACjEC,uBAAuB,EACvB,0BAA0B,CAC3B;AAACC,OAAA,CAAAH,wBAAA,GAAAA,wBAAA;AAEK,SAASI,gBAAgBA,CAACC,MAAmC,EAAwB;EAAA,IAAAC,qBAAA,EAAAC,eAAA;EAC1F,QAAAD,qBAAA,IAAAC,eAAA,GAAOF,MAAM,CAACG,OAAO,cAAAD,eAAA,uBAAdA,eAAA,CAAgBE,aAAa,cAAAH,qBAAA,cAAAA,qBAAA,GAAI,EAAE;AAC5C;AAEO,SAASJ,uBAAuBA,CACrCG,MAAmC,EACnCK,eAAgC,EACf;EAAA,IAAAC,oBAAA,EAAAC,qBAAA;EACjB;EACA,MAAMC,YAAY,GAAG,IAAAC,kCAAsB,EAACJ,eAAe,CAAC;EAC5D;EACA,KAAAC,oBAAA,GAAIE,YAAY,CAAC,eAAe,CAAC,cAAAF,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AI,CAAC,EAAEoB,MAAM,CAACgB,OAAO,CAAC,CAACV,GAAG,CAAEW,KAAK,KAAM;IAC3Ed,CAAC,EAAEe,MAAM,CAACC,OAAO,CAACF,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,CAAC,CAAC,CAAC,CAACG,MAAM,CACnC,CAACC,IAAI,EAAE,CAACC,GAAG,EAAErB,KAAK,CAAC,MAAM;MAAE,GAAGoB,IAAI;MAAE,CAAE,WAAUC,GAAI,EAAC,GAAGrB;IAAM,CAAC,CAAC,EAChE,CAAC,CAAC;EAEN,CAAC,CAAC,CAAC;AACL;;AAEA;AACA,SAASY,0BAA0BA,CAACD,QAA4B,EAAE;EAChE,OAAO,CAACE,KAAK,CAACC,OAAO,CAACH,QAAQ,CAAC,GAAGA,QAAQ,GAAG,CAACA,QAAQ,CAAC,EAAEZ,MAAM,CAACgB,OAAO,CAAC,CAACV,GAAG,CAAEiB,GAAG,KAAM;IACrFpB,CAAC,EAAE;MACD,cAAc,EAAG,2BAA0BoB,GAAI;IACjD;EACF,CAAC,CAAC,CAAC;AACL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Manifest.js","names":["writeAndroidManifestAsync","manifestPath","androidManifest","manifestXml","XML","format","fs","promises","mkdir","path","dirname","recursive","writeFile","readAndroidManifestAsync","xml","readXMLAsync","isManifest","Error","manifest","getMainApplication","application","filter","e","$","endsWith","getMainApplicationOrThrow","mainApplication","assert","getMainActivityOrThrow","mainActivity","getMainActivity","getRunnableActivity","enabledActivities","activity","Array","isArray","intentFilter","action","find","category","addMetaDataItemToMainApplication","itemName","itemValue","itemType","existingMetaDataItem","newItem","prefixAndroidKeys","name","length","push","removeMetaDataItemFromMainApplication","index","findMetaDataItem","splice","findApplicationSubItem","parent","findIndex","findUsesLibraryItem","getMainApplicationMetaDataValue","hasOwnProperty","item","addUsesLibraryItemToMainApplication","removeUsesLibraryItemFromMainApplication","head","Object","entries","reduce","prev","key","curr","ensureToolsAvailable","ensureManifestHasNamespace","namespace","url"],"sources":["../../src/android/Manifest.ts"],"sourcesContent":["import assert from 'assert';\nimport fs from 'fs';\nimport path from 'path';\n\nimport * as XML from '../utils/XML';\n\nexport type StringBoolean = 'true' | 'false';\n\ntype ManifestMetaDataAttributes = AndroidManifestAttributes & {\n 'android:value'?: string;\n 'android:resource'?: string;\n};\n\ntype AndroidManifestAttributes = {\n 'android:name': string | 'android.intent.action.VIEW';\n 'tools:node'?: string | 'remove';\n};\n\ntype ManifestAction = {\n $: AndroidManifestAttributes;\n};\n\ntype ManifestCategory = {\n $: AndroidManifestAttributes;\n};\n\ntype ManifestData = {\n $: {\n [key: string]: string | undefined;\n 'android:host'?: string;\n 'android:pathPrefix'?: string;\n 'android:scheme'?: string;\n };\n};\n\ntype ManifestReceiver = {\n $: AndroidManifestAttributes & {\n 'android:exported'?: StringBoolean;\n 'android:enabled'?: StringBoolean;\n };\n 'intent-filter'?: ManifestIntentFilter[];\n};\n\nexport type ManifestIntentFilter = {\n $?: {\n 'android:autoVerify'?: StringBoolean;\n 'data-generated'?: StringBoolean;\n };\n action?: ManifestAction[];\n data?: ManifestData[];\n category?: ManifestCategory[];\n};\n\nexport type ManifestMetaData = {\n $: ManifestMetaDataAttributes;\n};\n\ntype ManifestServiceAttributes = AndroidManifestAttributes & {\n 'android:enabled'?: StringBoolean;\n 'android:exported'?: StringBoolean;\n 'android:permission'?: string;\n // ...\n};\n\ntype ManifestService = {\n $: ManifestServiceAttributes;\n 'intent-filter'?: ManifestIntentFilter[];\n};\n\ntype ManifestApplicationAttributes = {\n 'android:name': string | '.MainApplication';\n 'android:icon'?: string;\n 'android:roundIcon'?: string;\n 'android:label'?: string;\n 'android:allowBackup'?: StringBoolean;\n 'android:largeHeap'?: StringBoolean;\n 'android:requestLegacyExternalStorage'?: StringBoolean;\n 'android:usesCleartextTraffic'?: StringBoolean;\n [key: string]: string | undefined;\n};\n\nexport type ManifestActivity = {\n $: ManifestApplicationAttributes & {\n 'android:exported'?: StringBoolean;\n 'android:launchMode'?: string;\n 'android:theme'?: string;\n 'android:windowSoftInputMode'?:\n | string\n | 'stateUnspecified'\n | 'stateUnchanged'\n | 'stateHidden'\n | 'stateAlwaysHidden'\n | 'stateVisible'\n | 'stateAlwaysVisible'\n | 'adjustUnspecified'\n | 'adjustResize'\n | 'adjustPan';\n [key: string]: string | undefined;\n };\n 'intent-filter'?: ManifestIntentFilter[];\n // ...\n};\n\nexport type ManifestUsesLibrary = {\n $: AndroidManifestAttributes & {\n 'android:required'?: StringBoolean;\n };\n};\n\nexport type ManifestApplication = {\n $: ManifestApplicationAttributes;\n activity?: ManifestActivity[];\n service?: ManifestService[];\n receiver?: ManifestReceiver[];\n 'meta-data'?: ManifestMetaData[];\n 'uses-library'?: ManifestUsesLibrary[];\n // ...\n};\n\ntype ManifestPermission = {\n $: AndroidManifestAttributes & {\n 'android:protectionLevel'?: string | 'signature';\n };\n};\n\nexport type ManifestUsesPermission = {\n $: AndroidManifestAttributes;\n};\n\ntype ManifestUsesFeature = {\n $: AndroidManifestAttributes & {\n 'android:glEsVersion'?: string;\n 'android:required': StringBoolean;\n };\n};\n\nexport type AndroidManifest = {\n manifest: {\n // Probably more, but this is currently all we'd need for most cases in Expo.\n $: {\n 'xmlns:android': string;\n 'xmlns:tools'?: string;\n package?: string;\n [key: string]: string | undefined;\n };\n permission?: ManifestPermission[];\n 'uses-permission'?: ManifestUsesPermission[];\n 'uses-permission-sdk-23'?: ManifestUsesPermission[];\n 'uses-feature'?: ManifestUsesFeature[];\n application?: ManifestApplication[];\n };\n};\n\nexport async function writeAndroidManifestAsync(\n manifestPath: string,\n androidManifest: AndroidManifest\n): Promise<void> {\n const manifestXml = XML.format(androidManifest);\n await fs.promises.mkdir(path.dirname(manifestPath), { recursive: true });\n await fs.promises.writeFile(manifestPath, manifestXml);\n}\n\nexport async function readAndroidManifestAsync(manifestPath: string): Promise<AndroidManifest> {\n const xml = await XML.readXMLAsync({ path: manifestPath });\n if (!isManifest(xml)) {\n throw new Error('Invalid manifest found at: ' + manifestPath);\n }\n return xml;\n}\n\nfunction isManifest(xml: XML.XMLObject): xml is AndroidManifest {\n // TODO: Maybe more validation\n return !!xml.manifest;\n}\n\n/** Returns the `manifest.application` tag ending in `.MainApplication` */\nexport function getMainApplication(androidManifest: AndroidManifest): ManifestApplication | null {\n return (\n androidManifest?.manifest?.application?.filter((e) =>\n e?.$?.['android:name'].endsWith('.MainApplication')\n )[0] ?? null\n );\n}\n\nexport function getMainApplicationOrThrow(androidManifest: AndroidManifest): ManifestApplication {\n const mainApplication = getMainApplication(androidManifest);\n assert(mainApplication, 'AndroidManifest.xml is missing the required MainApplication element');\n return mainApplication;\n}\n\nexport function getMainActivityOrThrow(androidManifest: AndroidManifest): ManifestActivity {\n const mainActivity = getMainActivity(androidManifest);\n assert(mainActivity, 'AndroidManifest.xml is missing the required MainActivity element');\n return mainActivity;\n}\n\nexport function getRunnableActivity(androidManifest: AndroidManifest): ManifestActivity | null {\n // Get enabled activities\n const enabledActivities = androidManifest?.manifest?.application?.[0]?.activity?.filter?.(\n (e: any) => e.$['android:enabled'] !== 'false' && e.$['android:enabled'] !== false\n );\n\n if (!enabledActivities) {\n return null;\n }\n\n // Get the activity that has a runnable intent-filter\n for (const activity of enabledActivities) {\n if (Array.isArray(activity['intent-filter'])) {\n for (const intentFilter of activity['intent-filter']) {\n if (\n intentFilter.action?.find(\n (action) => action.$['android:name'] === 'android.intent.action.MAIN'\n ) &&\n intentFilter.category?.find(\n (category) => category.$['android:name'] === 'android.intent.category.LAUNCHER'\n )\n ) {\n return activity;\n }\n }\n }\n }\n\n return null;\n}\n\nexport function getMainActivity(androidManifest: AndroidManifest): ManifestActivity | null {\n const mainActivity = androidManifest?.manifest?.application?.[0]?.activity?.filter?.(\n (e: any) => e.$['android:name'] === '.MainActivity'\n );\n return mainActivity?.[0] ?? null;\n}\n\nexport function addMetaDataItemToMainApplication(\n mainApplication: ManifestApplication,\n itemName: string,\n itemValue: string,\n itemType: 'resource' | 'value' = 'value'\n): ManifestApplication {\n let existingMetaDataItem;\n const newItem = {\n $: prefixAndroidKeys({ name: itemName, [itemType]: itemValue }),\n } as ManifestMetaData;\n if (mainApplication['meta-data']) {\n existingMetaDataItem = mainApplication['meta-data'].filter(\n (e: any) => e.$['android:name'] === itemName\n );\n if (existingMetaDataItem.length) {\n existingMetaDataItem[0].$[`android:${itemType}` as keyof ManifestMetaDataAttributes] =\n itemValue;\n } else {\n mainApplication['meta-data'].push(newItem);\n }\n } else {\n mainApplication['meta-data'] = [newItem];\n }\n return mainApplication;\n}\n\nexport function removeMetaDataItemFromMainApplication(mainApplication: any, itemName: string) {\n const index = findMetaDataItem(mainApplication, itemName);\n if (mainApplication?.['meta-data'] && index > -1) {\n mainApplication['meta-data'].splice(index, 1);\n }\n return mainApplication;\n}\n\nfunction findApplicationSubItem(\n mainApplication: ManifestApplication,\n category: keyof ManifestApplication,\n itemName: string\n): number {\n const parent = mainApplication[category];\n if (Array.isArray(parent)) {\n const index = parent.findIndex((e: any) => e.$['android:name'] === itemName);\n\n return index;\n }\n return -1;\n}\n\nexport function findMetaDataItem(mainApplication: any, itemName: string): number {\n return findApplicationSubItem(mainApplication, 'meta-data', itemName);\n}\n\nexport function findUsesLibraryItem(mainApplication: any, itemName: string): number {\n return findApplicationSubItem(mainApplication, 'uses-library', itemName);\n}\n\nexport function getMainApplicationMetaDataValue(\n androidManifest: AndroidManifest,\n name: string\n): string | null {\n const mainApplication = getMainApplication(androidManifest);\n\n if (mainApplication?.hasOwnProperty('meta-data')) {\n const item = mainApplication?.['meta-data']?.find((e: any) => e.$['android:name'] === name);\n return item?.$['android:value'] ?? null;\n }\n\n return null;\n}\n\nexport function addUsesLibraryItemToMainApplication(\n mainApplication: ManifestApplication,\n item: { name: string; required?: boolean }\n): ManifestApplication {\n let existingMetaDataItem;\n const newItem = {\n $: prefixAndroidKeys(item),\n } as ManifestUsesLibrary;\n\n if (mainApplication['uses-library']) {\n existingMetaDataItem = mainApplication['uses-library'].filter(\n (e) => e.$['android:name'] === item.name\n );\n if (existingMetaDataItem.length) {\n existingMetaDataItem[0].$ = newItem.$;\n } else {\n mainApplication['uses-library'].push(newItem);\n }\n } else {\n mainApplication['uses-library'] = [newItem];\n }\n return mainApplication;\n}\n\nexport function removeUsesLibraryItemFromMainApplication(\n mainApplication: ManifestApplication,\n itemName: string\n) {\n const index = findUsesLibraryItem(mainApplication, itemName);\n if (mainApplication?.['uses-library'] && index > -1) {\n mainApplication['uses-library'].splice(index, 1);\n }\n return mainApplication;\n}\n\nexport function prefixAndroidKeys<T extends Record<string, any> = Record<string, string>>(\n head: T\n): Record<string, any> {\n // prefix all keys with `android:`\n return Object.entries(head).reduce(\n (prev, [key, curr]) => ({ ...prev, [`android:${key}`]: curr }),\n {} as T\n );\n}\n\n/**\n * Ensure the `tools:*` namespace is available in the manifest.\n *\n * @param manifest AndroidManifest.xml\n * @returns manifest with the `tools:*` namespace available\n */\nexport function ensureToolsAvailable(manifest: AndroidManifest) {\n return ensureManifestHasNamespace(manifest, {\n namespace: 'xmlns:tools',\n url: 'http://schemas.android.com/tools',\n });\n}\n\n/**\n * Ensure a particular namespace is available in the manifest.\n *\n * @param manifest `AndroidManifest.xml`\n * @returns manifest with the provided namespace available\n */\nfunction ensureManifestHasNamespace(\n manifest: AndroidManifest,\n { namespace, url }: { namespace: string; url: string }\n) {\n if (manifest?.manifest?.$?.[namespace]) {\n return manifest;\n }\n manifest.manifest.$[namespace] = url;\n return manifest;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAoC;AAAA;AAAA;AAqJ7B,eAAeA,yBAAyB,CAC7CC,YAAoB,EACpBC,eAAgC,EACjB;EACf,MAAMC,WAAW,GAAGC,GAAG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AAI,EAAC,GAAGC;EAAK,CAAC,CAAC,EAC9D,CAAC,CAAC,CACH;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,oBAAoB,CAACpD,QAAyB,EAAE;EAC9D,OAAOqD,0BAA0B,CAACrD,QAAQ,EAAE;IAC1CsD,SAAS,EAAE,aAAa;IACxBC,GAAG,EAAE;EACP,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASF,0BAA0B,CACjCrD,QAAyB,EACzB;EAAEsD,SAAS;EAAEC;AAAwC,CAAC,EACtD;EAAA;EACA,IAAIvD,QAAQ,aAARA,QAAQ,qCAARA,QAAQ,CAAEA,QAAQ,uEAAlB,mBAAoBK,CAAC,iDAArB,qBAAwBiD,SAAS,CAAC,EAAE;IACtC,OAAOtD,QAAQ;EACjB;EACAA,QAAQ,CAACA,QAAQ,CAACK,CAAC,CAACiD,SAAS,CAAC,GAAGC,GAAG;EACpC,OAAOvD,QAAQ;AACjB"}
|
|
1
|
+
{"version":3,"file":"Manifest.js","names":["_assert","data","_interopRequireDefault","require","_fs","_path","XML","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","writeAndroidManifestAsync","manifestPath","androidManifest","manifestXml","format","fs","promises","mkdir","path","dirname","recursive","writeFile","readAndroidManifestAsync","xml","readXMLAsync","isManifest","Error","manifest","getMainApplication","_androidManifest$mani","_androidManifest$mani2","_androidManifest$mani3","application","filter","e","_e$$","$","endsWith","getMainApplicationOrThrow","mainApplication","assert","getMainActivityOrThrow","mainActivity","getMainActivity","getRunnableActivity","_androidManifest$mani4","_androidManifest$mani5","_androidManifest$mani6","_androidManifest$mani7","_androidManifest$mani8","enabledActivities","activity","Array","isArray","intentFilter","_intentFilter$action","_intentFilter$categor","action","find","category","_androidManifest$mani9","_androidManifest$mani10","_androidManifest$mani11","_androidManifest$mani12","_androidManifest$mani13","_mainActivity$","addMetaDataItemToMainApplication","itemName","itemValue","itemType","existingMetaDataItem","newItem","prefixAndroidKeys","name","length","push","removeMetaDataItemFromMainApplication","index","findMetaDataItem","splice","findApplicationSubItem","parent","findIndex","findUsesLibraryItem","getMainApplicationMetaDataValue","_mainApplication$meta","_item$$$androidValue","item","addUsesLibraryItemToMainApplication","removeUsesLibraryItemFromMainApplication","head","entries","reduce","prev","curr","ensureToolsAvailable","ensureManifestHasNamespace","namespace","url","_manifest$manifest","_manifest$manifest$$"],"sources":["../../src/android/Manifest.ts"],"sourcesContent":["import assert from 'assert';\nimport fs from 'fs';\nimport path from 'path';\n\nimport * as XML from '../utils/XML';\n\nexport type StringBoolean = 'true' | 'false';\n\ntype ManifestMetaDataAttributes = AndroidManifestAttributes & {\n 'android:value'?: string;\n 'android:resource'?: string;\n};\n\ntype AndroidManifestAttributes = {\n 'android:name': string | 'android.intent.action.VIEW';\n 'tools:node'?: string | 'remove';\n};\n\ntype ManifestAction = {\n $: AndroidManifestAttributes;\n};\n\ntype ManifestCategory = {\n $: AndroidManifestAttributes;\n};\n\ntype ManifestData = {\n $: {\n [key: string]: string | undefined;\n 'android:host'?: string;\n 'android:pathPrefix'?: string;\n 'android:scheme'?: string;\n };\n};\n\ntype ManifestReceiver = {\n $: AndroidManifestAttributes & {\n 'android:exported'?: StringBoolean;\n 'android:enabled'?: StringBoolean;\n };\n 'intent-filter'?: ManifestIntentFilter[];\n};\n\nexport type ManifestIntentFilter = {\n $?: {\n 'android:autoVerify'?: StringBoolean;\n 'data-generated'?: StringBoolean;\n };\n action?: ManifestAction[];\n data?: ManifestData[];\n category?: ManifestCategory[];\n};\n\nexport type ManifestMetaData = {\n $: ManifestMetaDataAttributes;\n};\n\ntype ManifestServiceAttributes = AndroidManifestAttributes & {\n 'android:enabled'?: StringBoolean;\n 'android:exported'?: StringBoolean;\n 'android:permission'?: string;\n // ...\n};\n\ntype ManifestService = {\n $: ManifestServiceAttributes;\n 'intent-filter'?: ManifestIntentFilter[];\n};\n\ntype ManifestApplicationAttributes = {\n 'android:name': string | '.MainApplication';\n 'android:icon'?: string;\n 'android:roundIcon'?: string;\n 'android:label'?: string;\n 'android:allowBackup'?: StringBoolean;\n 'android:largeHeap'?: StringBoolean;\n 'android:requestLegacyExternalStorage'?: StringBoolean;\n 'android:usesCleartextTraffic'?: StringBoolean;\n [key: string]: string | undefined;\n};\n\nexport type ManifestActivity = {\n $: ManifestApplicationAttributes & {\n 'android:exported'?: StringBoolean;\n 'android:launchMode'?: string;\n 'android:theme'?: string;\n 'android:windowSoftInputMode'?:\n | string\n | 'stateUnspecified'\n | 'stateUnchanged'\n | 'stateHidden'\n | 'stateAlwaysHidden'\n | 'stateVisible'\n | 'stateAlwaysVisible'\n | 'adjustUnspecified'\n | 'adjustResize'\n | 'adjustPan';\n [key: string]: string | undefined;\n };\n 'intent-filter'?: ManifestIntentFilter[];\n // ...\n};\n\nexport type ManifestUsesLibrary = {\n $: AndroidManifestAttributes & {\n 'android:required'?: StringBoolean;\n };\n};\n\nexport type ManifestApplication = {\n $: ManifestApplicationAttributes;\n activity?: ManifestActivity[];\n service?: ManifestService[];\n receiver?: ManifestReceiver[];\n 'meta-data'?: ManifestMetaData[];\n 'uses-library'?: ManifestUsesLibrary[];\n // ...\n};\n\ntype ManifestPermission = {\n $: AndroidManifestAttributes & {\n 'android:protectionLevel'?: string | 'signature';\n };\n};\n\nexport type ManifestUsesPermission = {\n $: AndroidManifestAttributes;\n};\n\ntype ManifestUsesFeature = {\n $: AndroidManifestAttributes & {\n 'android:glEsVersion'?: string;\n 'android:required': StringBoolean;\n };\n};\n\nexport type AndroidManifest = {\n manifest: {\n // Probably more, but this is currently all we'd need for most cases in Expo.\n $: {\n 'xmlns:android': string;\n 'xmlns:tools'?: string;\n package?: string;\n [key: string]: string | undefined;\n };\n permission?: ManifestPermission[];\n 'uses-permission'?: ManifestUsesPermission[];\n 'uses-permission-sdk-23'?: ManifestUsesPermission[];\n 'uses-feature'?: ManifestUsesFeature[];\n application?: ManifestApplication[];\n };\n};\n\nexport async function writeAndroidManifestAsync(\n manifestPath: string,\n androidManifest: AndroidManifest\n): Promise<void> {\n const manifestXml = XML.format(androidManifest);\n await fs.promises.mkdir(path.dirname(manifestPath), { recursive: true });\n await fs.promises.writeFile(manifestPath, manifestXml);\n}\n\nexport async function readAndroidManifestAsync(manifestPath: string): Promise<AndroidManifest> {\n const xml = await XML.readXMLAsync({ path: manifestPath });\n if (!isManifest(xml)) {\n throw new Error('Invalid manifest found at: ' + manifestPath);\n }\n return xml;\n}\n\nfunction isManifest(xml: XML.XMLObject): xml is AndroidManifest {\n // TODO: Maybe more validation\n return !!xml.manifest;\n}\n\n/** Returns the `manifest.application` tag ending in `.MainApplication` */\nexport function getMainApplication(androidManifest: AndroidManifest): ManifestApplication | null {\n return (\n androidManifest?.manifest?.application?.filter((e) =>\n e?.$?.['android:name'].endsWith('.MainApplication')\n )[0] ?? null\n );\n}\n\nexport function getMainApplicationOrThrow(androidManifest: AndroidManifest): ManifestApplication {\n const mainApplication = getMainApplication(androidManifest);\n assert(mainApplication, 'AndroidManifest.xml is missing the required MainApplication element');\n return mainApplication;\n}\n\nexport function getMainActivityOrThrow(androidManifest: AndroidManifest): ManifestActivity {\n const mainActivity = getMainActivity(androidManifest);\n assert(mainActivity, 'AndroidManifest.xml is missing the required MainActivity element');\n return mainActivity;\n}\n\nexport function getRunnableActivity(androidManifest: AndroidManifest): ManifestActivity | null {\n // Get enabled activities\n const enabledActivities = androidManifest?.manifest?.application?.[0]?.activity?.filter?.(\n (e: any) => e.$['android:enabled'] !== 'false' && e.$['android:enabled'] !== false\n );\n\n if (!enabledActivities) {\n return null;\n }\n\n // Get the activity that has a runnable intent-filter\n for (const activity of enabledActivities) {\n if (Array.isArray(activity['intent-filter'])) {\n for (const intentFilter of activity['intent-filter']) {\n if (\n intentFilter.action?.find(\n (action) => action.$['android:name'] === 'android.intent.action.MAIN'\n ) &&\n intentFilter.category?.find(\n (category) => category.$['android:name'] === 'android.intent.category.LAUNCHER'\n )\n ) {\n return activity;\n }\n }\n }\n }\n\n return null;\n}\n\nexport function getMainActivity(androidManifest: AndroidManifest): ManifestActivity | null {\n const mainActivity = androidManifest?.manifest?.application?.[0]?.activity?.filter?.(\n (e: any) => e.$['android:name'] === '.MainActivity'\n );\n return mainActivity?.[0] ?? null;\n}\n\nexport function addMetaDataItemToMainApplication(\n mainApplication: ManifestApplication,\n itemName: string,\n itemValue: string,\n itemType: 'resource' | 'value' = 'value'\n): ManifestApplication {\n let existingMetaDataItem;\n const newItem = {\n $: prefixAndroidKeys({ name: itemName, [itemType]: itemValue }),\n } as ManifestMetaData;\n if (mainApplication['meta-data']) {\n existingMetaDataItem = mainApplication['meta-data'].filter(\n (e: any) => e.$['android:name'] === itemName\n );\n if (existingMetaDataItem.length) {\n existingMetaDataItem[0].$[`android:${itemType}` as keyof ManifestMetaDataAttributes] =\n itemValue;\n } else {\n mainApplication['meta-data'].push(newItem);\n }\n } else {\n mainApplication['meta-data'] = [newItem];\n }\n return mainApplication;\n}\n\nexport function removeMetaDataItemFromMainApplication(mainApplication: any, itemName: string) {\n const index = findMetaDataItem(mainApplication, itemName);\n if (mainApplication?.['meta-data'] && index > -1) {\n mainApplication['meta-data'].splice(index, 1);\n }\n return mainApplication;\n}\n\nfunction findApplicationSubItem(\n mainApplication: ManifestApplication,\n category: keyof ManifestApplication,\n itemName: string\n): number {\n const parent = mainApplication[category];\n if (Array.isArray(parent)) {\n const index = parent.findIndex((e: any) => e.$['android:name'] === itemName);\n\n return index;\n }\n return -1;\n}\n\nexport function findMetaDataItem(mainApplication: any, itemName: string): number {\n return findApplicationSubItem(mainApplication, 'meta-data', itemName);\n}\n\nexport function findUsesLibraryItem(mainApplication: any, itemName: string): number {\n return findApplicationSubItem(mainApplication, 'uses-library', itemName);\n}\n\nexport function getMainApplicationMetaDataValue(\n androidManifest: AndroidManifest,\n name: string\n): string | null {\n const mainApplication = getMainApplication(androidManifest);\n\n if (mainApplication?.hasOwnProperty('meta-data')) {\n const item = mainApplication?.['meta-data']?.find((e: any) => e.$['android:name'] === name);\n return item?.$['android:value'] ?? null;\n }\n\n return null;\n}\n\nexport function addUsesLibraryItemToMainApplication(\n mainApplication: ManifestApplication,\n item: { name: string; required?: boolean }\n): ManifestApplication {\n let existingMetaDataItem;\n const newItem = {\n $: prefixAndroidKeys(item),\n } as ManifestUsesLibrary;\n\n if (mainApplication['uses-library']) {\n existingMetaDataItem = mainApplication['uses-library'].filter(\n (e) => e.$['android:name'] === item.name\n );\n if (existingMetaDataItem.length) {\n existingMetaDataItem[0].$ = newItem.$;\n } else {\n mainApplication['uses-library'].push(newItem);\n }\n } else {\n mainApplication['uses-library'] = [newItem];\n }\n return mainApplication;\n}\n\nexport function removeUsesLibraryItemFromMainApplication(\n mainApplication: ManifestApplication,\n itemName: string\n) {\n const index = findUsesLibraryItem(mainApplication, itemName);\n if (mainApplication?.['uses-library'] && index > -1) {\n mainApplication['uses-library'].splice(index, 1);\n }\n return mainApplication;\n}\n\nexport function prefixAndroidKeys<T extends Record<string, any> = Record<string, string>>(\n head: T\n): Record<string, any> {\n // prefix all keys with `android:`\n return Object.entries(head).reduce(\n (prev, [key, curr]) => ({ ...prev, [`android:${key}`]: curr }),\n {} as T\n );\n}\n\n/**\n * Ensure the `tools:*` namespace is available in the manifest.\n *\n * @param manifest AndroidManifest.xml\n * @returns manifest with the `tools:*` namespace available\n */\nexport function ensureToolsAvailable(manifest: AndroidManifest) {\n return ensureManifestHasNamespace(manifest, {\n namespace: 'xmlns:tools',\n url: 'http://schemas.android.com/tools',\n });\n}\n\n/**\n * Ensure a particular namespace is available in the manifest.\n *\n * @param manifest `AndroidManifest.xml`\n * @returns manifest with the provided namespace available\n */\nfunction ensureManifestHasNamespace(\n manifest: AndroidManifest,\n { namespace, url }: { namespace: string; url: string }\n) {\n if (manifest?.manifest?.$?.[namespace]) {\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,CAAC,CAAC6D,SAAS,CAAC,GAAGC,GAAG;EACpC,OAAOvE,QAAQ;AACjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Name.js","names":["sanitizeNameForGradle","name","replace","withName","createStringsXmlPlugin","applyNameFromConfig","withNameSettingsGradle","config","withSettingsGradle","modResults","language","contents","applyNameSettingsGradle","addWarningAndroid","getName","stringsJSON","setStringItem","buildResourceItem","value","removeStringItem","settingsGradle"],"sources":["../../src/android/Name.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { createStringsXmlPlugin, withSettingsGradle } from '../plugins/android-plugins';\nimport { addWarningAndroid } from '../utils/warnings';\nimport { buildResourceItem, ResourceXML } from './Resources';\nimport { removeStringItem, setStringItem } from './Strings';\n\n/**\n * Sanitize a name, this should be used for files and gradle names.\n * - `[/, \\, :, <, >, \", ?, *, |]` are not allowed\n * https://docs.gradle.org/4.2/release-notes.html#path-separator-characters-in-names-are-deprecated\n *\n * @param name\n */\nexport function sanitizeNameForGradle(name: string): string {\n // Remove escape characters which are valid in XML names but not in gradle.\n name = name.replace(/[\\n\\r\\t]/g, '');\n\n // Gradle disallows these:\n // The project name 'My-Special 😃 Co/ol_Project' must not contain any of the following characters: [/, \\, :, <, >, \", ?, *, |]. Set the 'rootProject.name' or adjust the 'include' statement (see https://docs.gradle.org/6.2/dsl/org.gradle.api.initialization.Settings.html#org.gradle.api.initialization.Settings:include(java.lang.String[]) for more details).\n return name.replace(/(\\/|\\\\|:|<|>|\"|\\?|\\*|\\|)/g, '');\n}\n\nexport const withName = createStringsXmlPlugin(applyNameFromConfig, 'withName');\n\nexport const withNameSettingsGradle: ConfigPlugin = (config) => {\n return withSettingsGradle(config, (config) => {\n if (config.modResults.language === 'groovy') {\n config.modResults.contents = applyNameSettingsGradle(config, config.modResults.contents);\n } else {\n addWarningAndroid(\n 'name',\n `Cannot automatically configure settings.gradle if it's not groovy`\n );\n }\n return config;\n });\n};\n\nexport function getName(config: Pick<ExpoConfig, 'name'>) {\n return typeof config.name === 'string' ? config.name : null;\n}\n\nfunction applyNameFromConfig(\n config: Pick<ExpoConfig, 'name'>,\n stringsJSON: ResourceXML\n): ResourceXML {\n const name = getName(config);\n if (name) {\n return setStringItem([buildResourceItem({ name: 'app_name', value: name })], stringsJSON);\n }\n return removeStringItem('app_name', stringsJSON);\n}\n\n/**\n * Regex a name change -- fragile.\n *\n * @param config\n * @param settingsGradle\n */\nexport function applyNameSettingsGradle(config: Pick<ExpoConfig, 'name'>, settingsGradle: string) {\n const name = sanitizeNameForGradle(getName(config) ?? '');\n\n // Select rootProject.name = '***' and replace the contents between the quotes.\n return settingsGradle.replace(\n /rootProject.name\\s?=\\s?([\"'])(?:(?=(\\\\?))\\2.)*?\\1/g,\n `rootProject.name = '${name.replace(/'/g, \"\\\\'\")}'`\n );\n}\n"],"mappings":";;;;;;;;;AAGA;EAAA;
|
|
1
|
+
{"version":3,"file":"Name.js","names":["_androidPlugins","data","require","_warnings","_Resources","_Strings","sanitizeNameForGradle","name","replace","withName","createStringsXmlPlugin","applyNameFromConfig","exports","withNameSettingsGradle","config","withSettingsGradle","modResults","language","contents","applyNameSettingsGradle","addWarningAndroid","getName","stringsJSON","setStringItem","buildResourceItem","value","removeStringItem","settingsGradle","_getName"],"sources":["../../src/android/Name.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { createStringsXmlPlugin, withSettingsGradle } from '../plugins/android-plugins';\nimport { addWarningAndroid } from '../utils/warnings';\nimport { buildResourceItem, ResourceXML } from './Resources';\nimport { removeStringItem, setStringItem } from './Strings';\n\n/**\n * Sanitize a name, this should be used for files and gradle names.\n * - `[/, \\, :, <, >, \", ?, *, |]` are not allowed\n * https://docs.gradle.org/4.2/release-notes.html#path-separator-characters-in-names-are-deprecated\n *\n * @param name\n */\nexport function sanitizeNameForGradle(name: string): string {\n // Remove escape characters which are valid in XML names but not in gradle.\n name = name.replace(/[\\n\\r\\t]/g, '');\n\n // Gradle disallows these:\n // The project name 'My-Special 😃 Co/ol_Project' must not contain any of the following characters: [/, \\, :, <, >, \", ?, *, |]. Set the 'rootProject.name' or adjust the 'include' statement (see https://docs.gradle.org/6.2/dsl/org.gradle.api.initialization.Settings.html#org.gradle.api.initialization.Settings:include(java.lang.String[]) for more details).\n return name.replace(/(\\/|\\\\|:|<|>|\"|\\?|\\*|\\|)/g, '');\n}\n\nexport const withName = createStringsXmlPlugin(applyNameFromConfig, 'withName');\n\nexport const withNameSettingsGradle: ConfigPlugin = (config) => {\n return withSettingsGradle(config, (config) => {\n if (config.modResults.language === 'groovy') {\n config.modResults.contents = applyNameSettingsGradle(config, config.modResults.contents);\n } else {\n addWarningAndroid(\n 'name',\n `Cannot automatically configure settings.gradle if it's not groovy`\n );\n }\n return config;\n });\n};\n\nexport function getName(config: Pick<ExpoConfig, 'name'>) {\n return typeof config.name === 'string' ? config.name : null;\n}\n\nfunction applyNameFromConfig(\n config: Pick<ExpoConfig, 'name'>,\n stringsJSON: ResourceXML\n): ResourceXML {\n const name = getName(config);\n if (name) {\n return setStringItem([buildResourceItem({ name: 'app_name', value: name })], stringsJSON);\n }\n return removeStringItem('app_name', stringsJSON);\n}\n\n/**\n * Regex a name change -- fragile.\n *\n * @param config\n * @param settingsGradle\n */\nexport function applyNameSettingsGradle(config: Pick<ExpoConfig, 'name'>, settingsGradle: string) {\n const name = sanitizeNameForGradle(getName(config) ?? '');\n\n // Select rootProject.name = '***' and replace the contents between the quotes.\n return settingsGradle.replace(\n /rootProject.name\\s?=\\s?([\"'])(?:(?=(\\\\?))\\2.)*?\\1/g,\n `rootProject.name = '${name.replace(/'/g, \"\\\\'\")}'`\n );\n}\n"],"mappings":";;;;;;;;;AAGA,SAAAA,gBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,eAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAA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O,OAAOA,MAAM,CAACP,IAAI,KAAK,QAAQ,GAAGO,MAAM,CAACP,IAAI,GAAG,IAAI;AAC7D;AAEA,SAASI,mBAAmBA,CAC1BG,MAAgC,EAChCQ,WAAwB,EACX;EACb,MAAMf,IAAI,GAAGc,OAAO,CAACP,MAAM,CAAC;EAC5B,IAAIP,IAAI,EAAE;IACR,OAAO,IAAAgB,wBAAa,EAAC,CAAC,IAAAC,8BAAiB,EAAC;MAAEjB,IAAI,EAAE,UAAU;MAAEkB,KAAK,EAAElB;IAAK,CAAC,CAAC,CAAC,EAAEe,WAAW,CAAC;EAC3F;EACA,OAAO,IAAAI,2BAAgB,EAAC,UAAU,EAAEJ,WAAW,CAAC;AAClD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASH,uBAAuBA,CAACL,MAAgC,EAAEa,cAAsB,EAAE;EAAA,IAAAC,QAAA;EAChG,MAAMrB,IAAI,GAAGD,qBAAqB,EAAAsB,QAAA,GAACP,OAAO,CAACP,MAAM,CAAC,cAAAc,QAAA,cAAAA,QAAA,GAAI,EAAE,CAAC;;EAEzD;EACA,OAAOD,cAAc,CAACnB,OAAO,CAC3B,oDAAoD,EACnD,uBAAsBD,IAAI,CAACC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAE,GAAE,CACpD;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Orientation.js","names":["SCREEN_ORIENTATION_ATTRIBUTE","withOrientation","createAndroidManifestPlugin","setAndroidOrientation","getOrientation","config","orientation","androidManifest","mainActivity","getMainActivityOrThrow","$"],"sources":["../../src/android/Orientation.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { createAndroidManifestPlugin } from '../plugins/android-plugins';\nimport { AndroidManifest, getMainActivityOrThrow } from './Manifest';\n\nexport const SCREEN_ORIENTATION_ATTRIBUTE = 'android:screenOrientation';\n\nexport const withOrientation = createAndroidManifestPlugin(\n setAndroidOrientation,\n 'withOrientation'\n);\n\nexport function getOrientation(config: Pick<ExpoConfig, 'orientation'>) {\n return typeof config.orientation === 'string' ? config.orientation : null;\n}\n\nexport function setAndroidOrientation(\n config: Pick<ExpoConfig, 'orientation'>,\n androidManifest: AndroidManifest\n) {\n const orientation = getOrientation(config);\n // TODO: Remove this if we decide to remove any orientation configuration when not specified\n if (!orientation) {\n return androidManifest;\n }\n\n const mainActivity = getMainActivityOrThrow(androidManifest);\n\n mainActivity.$[SCREEN_ORIENTATION_ATTRIBUTE] =\n orientation !== 'default' ? orientation : 'unspecified';\n\n return androidManifest;\n}\n"],"mappings":";;;;;;;;;AAEA;EAAA;
|
|
1
|
+
{"version":3,"file":"Orientation.js","names":["_androidPlugins","data","require","_Manifest","SCREEN_ORIENTATION_ATTRIBUTE","exports","withOrientation","createAndroidManifestPlugin","setAndroidOrientation","getOrientation","config","orientation","androidManifest","mainActivity","getMainActivityOrThrow","$"],"sources":["../../src/android/Orientation.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { createAndroidManifestPlugin } from '../plugins/android-plugins';\nimport { AndroidManifest, getMainActivityOrThrow } from './Manifest';\n\nexport const SCREEN_ORIENTATION_ATTRIBUTE = 'android:screenOrientation';\n\nexport const withOrientation = createAndroidManifestPlugin(\n setAndroidOrientation,\n 'withOrientation'\n);\n\nexport function getOrientation(config: Pick<ExpoConfig, 'orientation'>) {\n return typeof config.orientation === 'string' ? config.orientation : null;\n}\n\nexport function setAndroidOrientation(\n config: Pick<ExpoConfig, 'orientation'>,\n androidManifest: AndroidManifest\n) {\n const orientation = getOrientation(config);\n // TODO: Remove this if we decide to remove any orientation configuration when not specified\n if (!orientation) {\n return androidManifest;\n }\n\n const mainActivity = getMainActivityOrThrow(androidManifest);\n\n mainActivity.$[SCREEN_ORIENTATION_ATTRIBUTE] =\n orientation !== 'default' ? orientation : 'unspecified';\n\n return androidManifest;\n}\n"],"mappings":";;;;;;;;;AAEA,SAAAA,gBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,eAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,UAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAMG,4BAA4B,GAAG,2BAA2B;AAACC,OAAA,CAAAD,4BAAA,GAAAA,4BAAA;AAEjE,MAAME,eAAe,GAAG,IAAAC,6CAA2B,EACxDC,qBAAqB,EACrB,iBAAiB,CAClB;AAACH,OAAA,CAAAC,eAAA,GAAAA,eAAA;AAEK,SAASG,cAAcA,CAACC,MAAuC,EAAE;EACtE,OAAO,OAAOA,MAAM,CAACC,WAAW,KAAK,QAAQ,GAAGD,MAAM,CAACC,WAAW,GAAG,IAAI;AAC3E;AAEO,SAASH,qBAAqBA,CACnCE,MAAuC,EACvCE,eAAgC,EAChC;EACA,MAAMD,WAAW,GAAGF,cAAc,CAACC,MAAM,CAAC;EAC1C;EACA,IAAI,CAACC,WAAW,EAAE;IAChB,OAAOC,eAAe;EACxB;EAEA,MAAMC,YAAY,GAAG,IAAAC,kCAAsB,EAACF,eAAe,CAAC;EAE5DC,YAAY,CAACE,CAAC,CAACX,4BAA4B,CAAC,GAC1CO,WAAW,KAAK,SAAS,GAAGA,WAAW,GAAG,aAAa;EAEzD,OAAOC,eAAe;AACxB"}
|
package/build/android/Package.js
CHANGED
|
@@ -240,6 +240,7 @@ async function renamePackageOnDiskForType({
|
|
|
240
240
|
})];
|
|
241
241
|
// Only update the BUCK file to match the main package name
|
|
242
242
|
if (type === 'main') {
|
|
243
|
+
// NOTE(EvanBacon): We dropped this file in SDK 48 but other templates may still use it.
|
|
243
244
|
filesToUpdate.push(_path().default.join(projectRoot, 'android', 'app', 'BUCK'));
|
|
244
245
|
}
|
|
245
246
|
// Replace all occurrences of the path in the project
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Package.js","names":["debug","Debug","withPackageManifest","createAndroidManifestPlugin","setPackageInAndroidManifest","withPackageGradle","config","withAppBuildGradle","modResults","language","contents","setPackageInBuildGradle","addWarningAndroid","withPackageRefactor","withDangerousMod","renamePackageOnDisk","modRequest","projectRoot","getPackage","android","package","getPackageRoot","type","path","join","getCurrentPackageName","packageRoot","mainApplication","getProjectFilePath","packagePath","dirname","packagePathParts","relative","split","sep","filter","Boolean","getCurrentPackageForProjectFile","fileName","filePath","globSync","getCurrentPackageNameForType","newPackageName","renameJniOnDiskForType","packageName","renamePackageOnDiskForType","currentPackageName","jniRoot","filesToUpdate","cwd","absolute","forEach","filepath","fs","lstatSync","isFile","includes","extname","readFileSync","toString","replace","RegExp","transformJavaClassDescriptor","writeFileSync","directoryExistsAsync","currentPackagePath","newPackagePath","mkdirSync","recursive","relativePath","moveFileSync","oldPathParts","length","pathToCheck","files","readdirSync","rmdirSync","pop","push","src","dest","renameSync","buildGradle","pattern","androidManifest","manifest","$","getApplicationIdAsync","buildGradlePath","getAppBuildGradleFilePath","existsSync","promises","readFile","matchResult","match"],"sources":["../../src/android/Package.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport Debug from 'debug';\nimport fs from 'fs';\nimport { sync as globSync } from 'glob';\nimport path from 'path';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { createAndroidManifestPlugin, withAppBuildGradle } from '../plugins/android-plugins';\nimport { withDangerousMod } from '../plugins/withDangerousMod';\nimport { directoryExistsAsync } from '../utils/modules';\nimport { addWarningAndroid } from '../utils/warnings';\nimport { AndroidManifest } from './Manifest';\nimport { getAppBuildGradleFilePath, getProjectFilePath } from './Paths';\n\nconst debug = Debug('expo:config-plugins:android:package');\n\nexport const withPackageManifest = createAndroidManifestPlugin(\n setPackageInAndroidManifest,\n 'withPackageManifest'\n);\n\nexport const withPackageGradle: ConfigPlugin = (config) => {\n return withAppBuildGradle(config, (config) => {\n if (config.modResults.language === 'groovy') {\n config.modResults.contents = setPackageInBuildGradle(config, config.modResults.contents);\n } else {\n addWarningAndroid(\n 'android.package',\n `Cannot automatically configure app build.gradle if it's not groovy`\n );\n }\n return config;\n });\n};\n\nexport const withPackageRefactor: ConfigPlugin = (config) => {\n return withDangerousMod(config, [\n 'android',\n async (config) => {\n await renamePackageOnDisk(config, config.modRequest.projectRoot);\n return config;\n },\n ]);\n};\n\nexport function getPackage(config: Pick<ExpoConfig, 'android'>) {\n return config.android?.package ?? null;\n}\n\nfunction getPackageRoot(projectRoot: string, type: 'main' | 'debug') {\n return path.join(projectRoot, 'android', 'app', 'src', type, 'java');\n}\n\nfunction getCurrentPackageName(projectRoot: string, packageRoot: string) {\n const mainApplication = getProjectFilePath(projectRoot, 'MainApplication');\n const packagePath = path.dirname(mainApplication);\n const packagePathParts = path.relative(packageRoot, packagePath).split(path.sep).filter(Boolean);\n\n return packagePathParts.join('.');\n}\n\nfunction getCurrentPackageForProjectFile(\n projectRoot: string,\n packageRoot: string,\n fileName: string,\n type: string\n) {\n const filePath = globSync(\n path.join(projectRoot, `android/app/src/${type}/java/**/${fileName}.@(java|kt)`)\n )[0];\n\n if (!filePath) {\n return null;\n }\n\n const packagePath = path.dirname(filePath);\n const packagePathParts = path.relative(packageRoot, packagePath).split(path.sep).filter(Boolean);\n\n return packagePathParts.join('.');\n}\n\nfunction getCurrentPackageNameForType(projectRoot: string, type: string): string | null {\n const packageRoot = getPackageRoot(projectRoot, type as any);\n\n if (type === 'main') {\n return getCurrentPackageName(projectRoot, packageRoot);\n }\n // debug, etc..\n return getCurrentPackageForProjectFile(projectRoot, packageRoot, '*', type);\n}\n\n// NOTE(brentvatne): this assumes that our MainApplication.java file is in the root of the package\n// this makes sense for standard react-native projects but may not apply in customized projects, so if\n// we want this to be runnable in any app we need to handle other possibilities\nexport async function renamePackageOnDisk(\n config: Pick<ExpoConfig, 'android'>,\n projectRoot: string\n) {\n const newPackageName = getPackage(config);\n if (newPackageName === null) {\n return;\n }\n\n for (const type of ['debug', 'main', 'release']) {\n await renameJniOnDiskForType({ projectRoot, type, packageName: newPackageName });\n await renamePackageOnDiskForType({ projectRoot, type, packageName: newPackageName });\n }\n}\n\nexport async function renameJniOnDiskForType({\n projectRoot,\n type,\n packageName,\n}: {\n projectRoot: string;\n type: string;\n packageName: string;\n}) {\n if (!packageName) {\n return;\n }\n\n const currentPackageName = getCurrentPackageNameForType(projectRoot, type);\n if (!currentPackageName || !packageName || currentPackageName === packageName) {\n return;\n }\n\n const jniRoot = path.join(projectRoot, 'android', 'app', 'src', type, 'jni');\n const filesToUpdate = [...globSync('**/*', { cwd: jniRoot, absolute: true })];\n // Replace all occurrences of the path in the project\n filesToUpdate.forEach((filepath: string) => {\n try {\n if (fs.lstatSync(filepath).isFile() && ['.h', '.cpp'].includes(path.extname(filepath))) {\n let contents = fs.readFileSync(filepath).toString();\n contents = contents.replace(\n new RegExp(transformJavaClassDescriptor(currentPackageName).replace(/\\//g, '\\\\/'), 'g'),\n transformJavaClassDescriptor(packageName)\n );\n fs.writeFileSync(filepath, contents);\n }\n } catch {\n debug(`Error updating \"${filepath}\" for type \"${type}\"`);\n }\n });\n}\n\nexport async function renamePackageOnDiskForType({\n projectRoot,\n type,\n packageName,\n}: {\n projectRoot: string;\n type: string;\n packageName: string;\n}) {\n if (!packageName) {\n return;\n }\n\n const currentPackageName = getCurrentPackageNameForType(projectRoot, type);\n debug(`Found package \"${currentPackageName}\" for type \"${type}\"`);\n if (!currentPackageName || currentPackageName === packageName) {\n return;\n }\n debug(`Refactor \"${currentPackageName}\" to \"${packageName}\" for type \"${type}\"`);\n const packageRoot = getPackageRoot(projectRoot, type as any);\n // Set up our paths\n if (!(await directoryExistsAsync(packageRoot))) {\n debug(`- skipping refactor of missing directory: ${packageRoot}`);\n return;\n }\n\n const currentPackagePath = path.join(packageRoot, ...currentPackageName.split('.'));\n const newPackagePath = path.join(packageRoot, ...packageName.split('.'));\n\n // Create the new directory\n fs.mkdirSync(newPackagePath, { recursive: true });\n\n // Move everything from the old directory over\n globSync('**/*', { cwd: currentPackagePath }).forEach((relativePath) => {\n const filepath = path.join(currentPackagePath, relativePath);\n if (fs.lstatSync(filepath).isFile()) {\n moveFileSync(filepath, path.join(newPackagePath, relativePath));\n } else {\n fs.mkdirSync(filepath, { recursive: true });\n }\n });\n\n // Remove the old directory recursively from com/old/package to com/old and com,\n // as long as the directories are empty\n const oldPathParts = currentPackageName.split('.');\n while (oldPathParts.length) {\n const pathToCheck = path.join(packageRoot, ...oldPathParts);\n try {\n const files = fs.readdirSync(pathToCheck);\n if (files.length === 0) {\n fs.rmdirSync(pathToCheck);\n }\n } finally {\n oldPathParts.pop();\n }\n }\n\n const filesToUpdate = [...globSync('**/*', { cwd: newPackagePath, absolute: true })];\n // Only update the BUCK file to match the main package name\n if (type === 'main') {\n filesToUpdate.push(path.join(projectRoot, 'android', 'app', 'BUCK'));\n }\n // Replace all occurrences of the path in the project\n filesToUpdate.forEach((filepath: string) => {\n try {\n if (fs.lstatSync(filepath).isFile()) {\n let contents = fs.readFileSync(filepath).toString();\n contents = contents.replace(new RegExp(currentPackageName!, 'g'), packageName);\n if (['.h', '.cpp'].includes(path.extname(filepath))) {\n contents = contents.replace(\n new RegExp(transformJavaClassDescriptor(currentPackageName).replace(/\\//g, '\\\\'), 'g'),\n transformJavaClassDescriptor(packageName)\n );\n }\n fs.writeFileSync(filepath, contents);\n }\n } catch {\n debug(`Error updating \"${filepath}\" for type \"${type}\"`);\n }\n });\n}\n\nfunction moveFileSync(src: string, dest: string) {\n fs.mkdirSync(path.dirname(dest), { recursive: true });\n fs.renameSync(src, dest);\n}\n\nexport function setPackageInBuildGradle(config: Pick<ExpoConfig, 'android'>, buildGradle: string) {\n const packageName = getPackage(config);\n if (packageName === null) {\n return buildGradle;\n }\n\n const pattern = new RegExp(`(applicationId|namespace) ['\"].*['\"]`, 'g');\n return buildGradle.replace(pattern, `$1 '${packageName}'`);\n}\n\nexport function setPackageInAndroidManifest(\n config: Pick<ExpoConfig, 'android'>,\n androidManifest: AndroidManifest\n) {\n const packageName = getPackage(config);\n\n if (packageName) {\n androidManifest.manifest.$.package = packageName;\n } else {\n delete androidManifest.manifest.$.package;\n }\n\n return androidManifest;\n}\n\nexport async function getApplicationIdAsync(projectRoot: string): Promise<string | null> {\n const buildGradlePath = getAppBuildGradleFilePath(projectRoot);\n if (!fs.existsSync(buildGradlePath)) {\n return null;\n }\n const buildGradle = await fs.promises.readFile(buildGradlePath, 'utf8');\n const matchResult = buildGradle.match(/applicationId ['\"](.*)['\"]/);\n // TODO add fallback for legacy cases to read from AndroidManifest.xml\n return matchResult?.[1] ?? null;\n}\n\n/**\n * Transform a java package name to java class descriptor,\n * e.g. `com.helloworld` -> `Lcom/helloworld`.\n */\nfunction transformJavaClassDescriptor(packageName: string) {\n return `L${packageName.replace(/\\./g, '/')}`;\n}\n"],"mappings":";;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAwE;AAExE,MAAMA,KAAK,GAAG,IAAAC,gBAAK,EAAC,qCAAqC,CAAC;AAEnD,MAAMC,mBAAmB,GAAG,IAAAC,6CAA2B,EAC5DC,2BAA2B,EAC3B,qBAAqB,CACtB;AAAC;AAEK,MAAMC,iBAA+B,GAAIC,MAAM,IAAK;EACzD,OAAO,IAAAC,oCAAkB,EAACD,MAAM,EAAGA,MAAM,IAAK;IAC5C,IAAIA,MAAM,CAACE,UAAU,CAACC,QAAQ,KAAK,QAAQ,EAAE;MA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CE,MAAmC,EACnC8E,eAAgC,EAChC;EACA,MAAMxC,WAAW,GAAG1B,UAAU,CAACZ,MAAM,CAAC;EAEtC,IAAIsC,WAAW,EAAE;IACfwC,eAAe,CAACC,QAAQ,CAACC,CAAC,CAAClE,OAAO,GAAGwB,WAAW;EAClD,CAAC,MAAM;IACL,OAAOwC,eAAe,CAACC,QAAQ,CAACC,CAAC,CAAClE,OAAO;EAC3C;EAEA,OAAOgE,eAAe;AACxB;AAEO,eAAeG,qBAAqB,CAACtE,WAAmB,EAA0B;EAAA;EACvF,MAAMuE,eAAe,GAAG,IAAAC,kCAAyB,EAACxE,WAAW,CAAC;EAC9D,IAAI,CAACoC,aAAE,CAACqC,UAAU,CAACF,eAAe,CAAC,EAAE;IACnC,OAAO,IAAI;EACb;EACA,MAAMN,WAAW,GAAG,MAAM7B,aAAE,CAACsC,QAAQ,CAACC,QAAQ,CAACJ,eAAe,EAAE,MAAM,CAAC;EACvE,MAAMK,WAAW,GAAGX,WAAW,CAACY,KAAK,CAAC,4BAA4B,CAAC;EACnE;EACA,wBAAOD,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAG,CAAC,CAAC,yDAAI,IAAI;AACjC;;AAEA;AACA;AACA;AACA;AACA,SAAS/B,4BAA4B,CAAClB,WAAmB,EAAE;EACzD,OAAQ,IAAGA,WAAW,CAACgB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAE,EAAC;AAC9C"}
|
|
1
|
+
{"version":3,"file":"Package.js","names":["_debug","data","_interopRequireDefault","require","_fs","_glob","_path","_androidPlugins","_withDangerousMod","_modules","_warnings","_Paths","obj","__esModule","default","debug","Debug","withPackageManifest","createAndroidManifestPlugin","setPackageInAndroidManifest","exports","withPackageGradle","config","withAppBuildGradle","modResults","language","contents","setPackageInBuildGradle","addWarningAndroid","withPackageRefactor","withDangerousMod","renamePackageOnDisk","modRequest","projectRoot","getPackage","_config$android$packa","_config$android","android","package","getPackageRoot","type","path","join","getCurrentPackageName","packageRoot","mainApplication","getProjectFilePath","packagePath","dirname","packagePathParts","relative","split","sep","filter","Boolean","getCurrentPackageForProjectFile","fileName","filePath","globSync","getCurrentPackageNameForType","newPackageName","renameJniOnDiskForType","packageName","renamePackageOnDiskForType","currentPackageName","jniRoot","filesToUpdate","cwd","absolute","forEach","filepath","fs","lstatSync","isFile","includes","extname","readFileSync","toString","replace","RegExp","transformJavaClassDescriptor","writeFileSync","directoryExistsAsync","currentPackagePath","newPackagePath","mkdirSync","recursive","relativePath","moveFileSync","oldPathParts","length","pathToCheck","files","readdirSync","rmdirSync","pop","push","src","dest","renameSync","buildGradle","pattern","androidManifest","manifest","$","getApplicationIdAsync","_matchResult$","buildGradlePath","getAppBuildGradleFilePath","existsSync","promises","readFile","matchResult","match"],"sources":["../../src/android/Package.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport Debug from 'debug';\nimport fs from 'fs';\nimport { sync as globSync } from 'glob';\nimport path from 'path';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { createAndroidManifestPlugin, withAppBuildGradle } from '../plugins/android-plugins';\nimport { withDangerousMod } from '../plugins/withDangerousMod';\nimport { directoryExistsAsync } from '../utils/modules';\nimport { addWarningAndroid } from '../utils/warnings';\nimport { AndroidManifest } from './Manifest';\nimport { getAppBuildGradleFilePath, getProjectFilePath } from './Paths';\n\nconst debug = Debug('expo:config-plugins:android:package');\n\nexport const withPackageManifest = createAndroidManifestPlugin(\n setPackageInAndroidManifest,\n 'withPackageManifest'\n);\n\nexport const withPackageGradle: ConfigPlugin = (config) => {\n return withAppBuildGradle(config, (config) => {\n if (config.modResults.language === 'groovy') {\n config.modResults.contents = setPackageInBuildGradle(config, config.modResults.contents);\n } else {\n addWarningAndroid(\n 'android.package',\n `Cannot automatically configure app build.gradle if it's not groovy`\n );\n }\n return config;\n });\n};\n\nexport const withPackageRefactor: ConfigPlugin = (config) => {\n return withDangerousMod(config, [\n 'android',\n async (config) => {\n await renamePackageOnDisk(config, config.modRequest.projectRoot);\n return config;\n },\n ]);\n};\n\nexport function getPackage(config: Pick<ExpoConfig, 'android'>) {\n return config.android?.package ?? null;\n}\n\nfunction getPackageRoot(projectRoot: string, type: 'main' | 'debug') {\n return path.join(projectRoot, 'android', 'app', 'src', type, 'java');\n}\n\nfunction getCurrentPackageName(projectRoot: string, packageRoot: string) {\n const mainApplication = getProjectFilePath(projectRoot, 'MainApplication');\n const packagePath = path.dirname(mainApplication);\n const packagePathParts = path.relative(packageRoot, packagePath).split(path.sep).filter(Boolean);\n\n return packagePathParts.join('.');\n}\n\nfunction getCurrentPackageForProjectFile(\n projectRoot: string,\n packageRoot: string,\n fileName: string,\n type: string\n) {\n const filePath = globSync(\n path.join(projectRoot, `android/app/src/${type}/java/**/${fileName}.@(java|kt)`)\n )[0];\n\n if (!filePath) {\n return null;\n }\n\n const packagePath = path.dirname(filePath);\n const packagePathParts = path.relative(packageRoot, packagePath).split(path.sep).filter(Boolean);\n\n return packagePathParts.join('.');\n}\n\nfunction getCurrentPackageNameForType(projectRoot: string, type: string): string | null {\n const packageRoot = getPackageRoot(projectRoot, type as any);\n\n if (type === 'main') {\n return getCurrentPackageName(projectRoot, packageRoot);\n }\n // debug, etc..\n return getCurrentPackageForProjectFile(projectRoot, packageRoot, '*', type);\n}\n\n// NOTE(brentvatne): this assumes that our MainApplication.java file is in the root of the package\n// this makes sense for standard react-native projects but may not apply in customized projects, so if\n// we want this to be runnable in any app we need to handle other possibilities\nexport async function renamePackageOnDisk(\n config: Pick<ExpoConfig, 'android'>,\n projectRoot: string\n) {\n const newPackageName = getPackage(config);\n if (newPackageName === null) {\n return;\n }\n\n for (const type of ['debug', 'main', 'release']) {\n await renameJniOnDiskForType({ projectRoot, type, packageName: newPackageName });\n await renamePackageOnDiskForType({ projectRoot, type, packageName: newPackageName });\n }\n}\n\nexport async function renameJniOnDiskForType({\n projectRoot,\n type,\n packageName,\n}: {\n projectRoot: string;\n type: string;\n packageName: string;\n}) {\n if (!packageName) {\n return;\n }\n\n const currentPackageName = getCurrentPackageNameForType(projectRoot, type);\n if (!currentPackageName || !packageName || currentPackageName === packageName) {\n return;\n }\n\n const jniRoot = path.join(projectRoot, 'android', 'app', 'src', type, 'jni');\n const filesToUpdate = [...globSync('**/*', { cwd: jniRoot, absolute: true })];\n // Replace all occurrences of the path in the project\n filesToUpdate.forEach((filepath: string) => {\n try {\n if (fs.lstatSync(filepath).isFile() && ['.h', '.cpp'].includes(path.extname(filepath))) {\n let contents = fs.readFileSync(filepath).toString();\n contents = contents.replace(\n new RegExp(transformJavaClassDescriptor(currentPackageName).replace(/\\//g, '\\\\/'), 'g'),\n transformJavaClassDescriptor(packageName)\n );\n fs.writeFileSync(filepath, contents);\n }\n } catch {\n debug(`Error updating \"${filepath}\" for type \"${type}\"`);\n }\n });\n}\n\nexport async function renamePackageOnDiskForType({\n projectRoot,\n type,\n packageName,\n}: {\n projectRoot: string;\n type: string;\n packageName: string;\n}) {\n if (!packageName) {\n return;\n }\n\n const currentPackageName = getCurrentPackageNameForType(projectRoot, type);\n debug(`Found package \"${currentPackageName}\" for type \"${type}\"`);\n if (!currentPackageName || currentPackageName === packageName) {\n return;\n }\n debug(`Refactor \"${currentPackageName}\" to \"${packageName}\" for type \"${type}\"`);\n const packageRoot = getPackageRoot(projectRoot, type as any);\n // Set up our paths\n if (!(await directoryExistsAsync(packageRoot))) {\n debug(`- skipping refactor of missing directory: ${packageRoot}`);\n return;\n }\n\n const currentPackagePath = path.join(packageRoot, ...currentPackageName.split('.'));\n const newPackagePath = path.join(packageRoot, ...packageName.split('.'));\n\n // Create the new directory\n fs.mkdirSync(newPackagePath, { recursive: true });\n\n // Move everything from the old directory over\n globSync('**/*', { cwd: currentPackagePath }).forEach((relativePath) => {\n const filepath = path.join(currentPackagePath, relativePath);\n if (fs.lstatSync(filepath).isFile()) {\n moveFileSync(filepath, path.join(newPackagePath, relativePath));\n } else {\n fs.mkdirSync(filepath, { recursive: true });\n }\n });\n\n // Remove the old directory recursively from com/old/package to com/old and com,\n // as long as the directories are empty\n const oldPathParts = currentPackageName.split('.');\n while (oldPathParts.length) {\n const pathToCheck = path.join(packageRoot, ...oldPathParts);\n try {\n const files = fs.readdirSync(pathToCheck);\n if (files.length === 0) {\n fs.rmdirSync(pathToCheck);\n }\n } finally {\n oldPathParts.pop();\n }\n }\n\n const filesToUpdate = [...globSync('**/*', { cwd: newPackagePath, absolute: true })];\n // Only update the BUCK file to match the main package name\n if (type === 'main') {\n // NOTE(EvanBacon): We dropped this file in SDK 48 but other templates may still use it.\n filesToUpdate.push(path.join(projectRoot, 'android', 'app', 'BUCK'));\n }\n // Replace all occurrences of the path in the project\n filesToUpdate.forEach((filepath: string) => {\n try {\n if (fs.lstatSync(filepath).isFile()) {\n let contents = fs.readFileSync(filepath).toString();\n contents = contents.replace(new RegExp(currentPackageName!, 'g'), packageName);\n if (['.h', '.cpp'].includes(path.extname(filepath))) {\n contents = contents.replace(\n new RegExp(transformJavaClassDescriptor(currentPackageName).replace(/\\//g, '\\\\'), 'g'),\n transformJavaClassDescriptor(packageName)\n );\n }\n fs.writeFileSync(filepath, contents);\n }\n } catch {\n debug(`Error updating \"${filepath}\" for type \"${type}\"`);\n }\n });\n}\n\nfunction moveFileSync(src: string, dest: string) {\n fs.mkdirSync(path.dirname(dest), { recursive: true });\n fs.renameSync(src, dest);\n}\n\nexport function setPackageInBuildGradle(config: Pick<ExpoConfig, 'android'>, buildGradle: string) {\n const packageName = getPackage(config);\n if (packageName === null) {\n return buildGradle;\n }\n\n const pattern = new RegExp(`(applicationId|namespace) ['\"].*['\"]`, 'g');\n return buildGradle.replace(pattern, `$1 '${packageName}'`);\n}\n\nexport function setPackageInAndroidManifest(\n config: Pick<ExpoConfig, 'android'>,\n androidManifest: AndroidManifest\n) {\n const packageName = getPackage(config);\n\n if (packageName) {\n androidManifest.manifest.$.package = packageName;\n } else {\n delete androidManifest.manifest.$.package;\n }\n\n return androidManifest;\n}\n\nexport async function getApplicationIdAsync(projectRoot: string): Promise<string | null> {\n const buildGradlePath = getAppBuildGradleFilePath(projectRoot);\n if (!fs.existsSync(buildGradlePath)) {\n return null;\n }\n const buildGradle = await fs.promises.readFile(buildGradlePath, 'utf8');\n const matchResult = buildGradle.match(/applicationId ['\"](.*)['\"]/);\n // TODO add fallback for legacy cases to read from AndroidManifest.xml\n return matchResult?.[1] ?? null;\n}\n\n/**\n * Transform a java package name to java class descriptor,\n * e.g. `com.helloworld` -> `Lcom/helloworld`.\n */\nfunction transformJavaClassDescriptor(packageName: string) {\n return `L${packageName.replace(/\\./g, '/')}`;\n}\n"],"mappings":";;;;;;;;;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,IAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,GAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,MAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,KAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,MAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,KAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAM,gBAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,eAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,kBAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,iBAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,SAAA;EAAA,MAAAR,IAAA,GAAAE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