@expo/config-plugins 57.0.7 → 58.0.0-canary-20260812-27f94d4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/build/Plugin.types.d.ts +1 -1
  2. package/build/Plugin.types.js +15 -9
  3. package/build/Plugin.types.js.map +1 -1
  4. package/build/android/AllowBackup.js +47 -35
  5. package/build/android/AllowBackup.js.map +1 -1
  6. package/build/android/BuildProperties.d.ts +1 -1
  7. package/build/android/BuildProperties.js +86 -80
  8. package/build/android/BuildProperties.js.map +1 -1
  9. package/build/android/Colors.js +84 -89
  10. package/build/android/Colors.js.map +1 -1
  11. package/build/android/EasBuild.js +98 -46
  12. package/build/android/EasBuild.js.map +1 -1
  13. package/build/android/EasBuildGradleScript.js +12 -5
  14. package/build/android/EasBuildGradleScript.js.map +1 -1
  15. package/build/android/GoogleMapsApiKey.js +45 -36
  16. package/build/android/GoogleMapsApiKey.js.map +1 -1
  17. package/build/android/GoogleServices.js +115 -114
  18. package/build/android/GoogleServices.js.map +1 -1
  19. package/build/android/IntentFilters.js +82 -69
  20. package/build/android/IntentFilters.js.map +1 -1
  21. package/build/android/Locales.js +111 -71
  22. package/build/android/Locales.js.map +1 -1
  23. package/build/android/Manifest.js +268 -185
  24. package/build/android/Manifest.js.map +1 -1
  25. package/build/android/Name.js +67 -78
  26. package/build/android/Name.js.map +1 -1
  27. package/build/android/Orientation.js +42 -30
  28. package/build/android/Orientation.js.map +1 -1
  29. package/build/android/Package.js +276 -269
  30. package/build/android/Package.js.map +1 -1
  31. package/build/android/Paths.js +198 -112
  32. package/build/android/Paths.js.map +1 -1
  33. package/build/android/Permissions.d.ts +1 -1
  34. package/build/android/Permissions.js +206 -163
  35. package/build/android/Permissions.js.map +1 -1
  36. package/build/android/PredictiveBackGesture.d.ts +1 -1
  37. package/build/android/PredictiveBackGesture.js +38 -30
  38. package/build/android/PredictiveBackGesture.js.map +1 -1
  39. package/build/android/PrimaryColor.js +54 -49
  40. package/build/android/PrimaryColor.js.map +1 -1
  41. package/build/android/Properties.js +66 -48
  42. package/build/android/Properties.js.map +1 -1
  43. package/build/android/Resources.js +112 -131
  44. package/build/android/Resources.js.map +1 -1
  45. package/build/android/Scheme.js +203 -181
  46. package/build/android/Scheme.js.map +1 -1
  47. package/build/android/Strings.js +55 -42
  48. package/build/android/Strings.js.map +1 -1
  49. package/build/android/Styles.js +142 -158
  50. package/build/android/Styles.js.map +1 -1
  51. package/build/android/SystemBars.d.ts +1 -1
  52. package/build/android/SystemBars.js +89 -50
  53. package/build/android/SystemBars.js.map +1 -1
  54. package/build/android/Updates.d.ts +2 -2
  55. package/build/android/Updates.js +152 -166
  56. package/build/android/Updates.js.map +1 -1
  57. package/build/android/Version.js +86 -71
  58. package/build/android/Version.js.map +1 -1
  59. package/build/android/WindowSoftInputMode.d.ts +1 -1
  60. package/build/android/WindowSoftInputMode.js +44 -36
  61. package/build/android/WindowSoftInputMode.js.map +1 -1
  62. package/build/android/codeMod.js +98 -117
  63. package/build/android/codeMod.js.map +1 -1
  64. package/build/android/index.js +185 -342
  65. package/build/android/index.js.map +1 -1
  66. package/build/index.js +256 -286
  67. package/build/index.js.map +1 -1
  68. package/build/ios/Bitcode.js +79 -97
  69. package/build/ios/Bitcode.js.map +1 -1
  70. package/build/ios/BuildProperties.js +58 -57
  71. package/build/ios/BuildProperties.js.map +1 -1
  72. package/build/ios/BuildScheme.js +94 -97
  73. package/build/ios/BuildScheme.js.map +1 -1
  74. package/build/ios/BundleIdentifier.d.ts +1 -1
  75. package/build/ios/BundleIdentifier.js +163 -173
  76. package/build/ios/BundleIdentifier.js.map +1 -1
  77. package/build/ios/DeploymentTarget.js +58 -68
  78. package/build/ios/DeploymentTarget.js.map +1 -1
  79. package/build/ios/DevServer.d.ts +14 -0
  80. package/build/ios/DevServer.js +37 -0
  81. package/build/ios/DevServer.js.map +1 -0
  82. package/build/ios/DevelopmentTeam.js +80 -105
  83. package/build/ios/DevelopmentTeam.js.map +1 -1
  84. package/build/ios/DeviceFamily.js +85 -76
  85. package/build/ios/DeviceFamily.js.map +1 -1
  86. package/build/ios/Entitlements.js +97 -99
  87. package/build/ios/Entitlements.js.map +1 -1
  88. package/build/ios/Google.d.ts +1 -1
  89. package/build/ios/Google.js +116 -109
  90. package/build/ios/Google.js.map +1 -1
  91. package/build/ios/IosConfig.types.js +5 -1
  92. package/build/ios/IosConfig.types.js.map +1 -1
  93. package/build/ios/Locales.js +108 -115
  94. package/build/ios/Locales.js.map +1 -1
  95. package/build/ios/Maps.js +200 -175
  96. package/build/ios/Maps.js.map +1 -1
  97. package/build/ios/Name.d.ts +1 -1
  98. package/build/ios/Name.js +94 -96
  99. package/build/ios/Name.js.map +1 -1
  100. package/build/ios/Orientation.js +62 -31
  101. package/build/ios/Orientation.js.map +1 -1
  102. package/build/ios/Paths.js +333 -262
  103. package/build/ios/Paths.js.map +1 -1
  104. package/build/ios/Permissions.d.ts +1 -1
  105. package/build/ios/Permissions.js +55 -45
  106. package/build/ios/Permissions.js.map +1 -1
  107. package/build/ios/PrivacyInfo.js +117 -106
  108. package/build/ios/PrivacyInfo.js.map +1 -1
  109. package/build/ios/ProvisioningProfile.js +45 -58
  110. package/build/ios/ProvisioningProfile.js.map +1 -1
  111. package/build/ios/RequiresFullScreen.js +64 -56
  112. package/build/ios/RequiresFullScreen.js.map +1 -1
  113. package/build/ios/Scheme.js +126 -91
  114. package/build/ios/Scheme.js.map +1 -1
  115. package/build/ios/Target.js +132 -113
  116. package/build/ios/Target.js.map +1 -1
  117. package/build/ios/Updates.d.ts +1 -1
  118. package/build/ios/Updates.js +140 -145
  119. package/build/ios/Updates.js.map +1 -1
  120. package/build/ios/UsesNonExemptEncryption.js +41 -30
  121. package/build/ios/UsesNonExemptEncryption.js.map +1 -1
  122. package/build/ios/Version.js +56 -31
  123. package/build/ios/Version.js.map +1 -1
  124. package/build/ios/XcodeProjectFile.js +65 -86
  125. package/build/ios/XcodeProjectFile.js.map +1 -1
  126. package/build/ios/codeMod.js +192 -252
  127. package/build/ios/codeMod.js.map +1 -1
  128. package/build/ios/index.d.ts +1 -0
  129. package/build/ios/index.js +185 -329
  130. package/build/ios/index.js.map +1 -1
  131. package/build/ios/utils/Xcodeproj.js +427 -416
  132. package/build/ios/utils/Xcodeproj.js.map +1 -1
  133. package/build/ios/utils/getInfoPlistPath.js +28 -43
  134. package/build/ios/utils/getInfoPlistPath.js.map +1 -1
  135. package/build/ios/utils/string.js +12 -5
  136. package/build/ios/utils/string.js.map +1 -1
  137. package/build/plugins/android-plugins.js +153 -191
  138. package/build/plugins/android-plugins.js.map +1 -1
  139. package/build/plugins/createBaseMod.d.ts +1 -1
  140. package/build/plugins/createBaseMod.js +111 -112
  141. package/build/plugins/createBaseMod.js.map +1 -1
  142. package/build/plugins/ios-plugins.js +149 -187
  143. package/build/plugins/ios-plugins.js.map +1 -1
  144. package/build/plugins/mod-compiler.d.ts +1 -1
  145. package/build/plugins/mod-compiler.js +202 -195
  146. package/build/plugins/mod-compiler.js.map +1 -1
  147. package/build/plugins/withAndroidBaseMods.d.ts +1 -1
  148. package/build/plugins/withAndroidBaseMods.js +344 -448
  149. package/build/plugins/withAndroidBaseMods.js.map +1 -1
  150. package/build/plugins/withDangerousMod.js +18 -26
  151. package/build/plugins/withDangerousMod.js.map +1 -1
  152. package/build/plugins/withFinalizedMod.js +18 -26
  153. package/build/plugins/withFinalizedMod.js.map +1 -1
  154. package/build/plugins/withIosBaseMods.d.ts +1 -1
  155. package/build/plugins/withIosBaseMods.js +362 -403
  156. package/build/plugins/withIosBaseMods.js.map +1 -1
  157. package/build/plugins/withMod.js +158 -184
  158. package/build/plugins/withMod.js.map +1 -1
  159. package/build/plugins/withPlugins.js +25 -27
  160. package/build/plugins/withPlugins.js.map +1 -1
  161. package/build/plugins/withRunOnce.js +41 -48
  162. package/build/plugins/withRunOnce.js.map +1 -1
  163. package/build/plugins/withStaticPlugin.js +101 -116
  164. package/build/plugins/withStaticPlugin.js.map +1 -1
  165. package/build/ts-declarations/xcode.d.ts +492 -0
  166. package/build/utils/BuildProperties.types.js +5 -1
  167. package/build/utils/BuildProperties.types.js.map +1 -1
  168. package/build/utils/Updates.js +285 -181
  169. package/build/utils/Updates.js.map +1 -1
  170. package/build/utils/XML.js +157 -130
  171. package/build/utils/XML.js.map +1 -1
  172. package/build/utils/commonCodeMod.js +49 -54
  173. package/build/utils/commonCodeMod.js.map +1 -1
  174. package/build/utils/errors.js +34 -20
  175. package/build/utils/errors.js.map +1 -1
  176. package/build/utils/fs.js +50 -31
  177. package/build/utils/fs.js.map +1 -1
  178. package/build/utils/generateCode.js +108 -107
  179. package/build/utils/generateCode.js.map +1 -1
  180. package/build/utils/glob.js +13 -7
  181. package/build/utils/glob.js.map +1 -1
  182. package/build/utils/history.js +35 -17
  183. package/build/utils/history.js.map +1 -1
  184. package/build/utils/locales.js +96 -111
  185. package/build/utils/locales.js.map +1 -1
  186. package/build/utils/matchBrackets.js +61 -51
  187. package/build/utils/matchBrackets.js.map +1 -1
  188. package/build/utils/modules.js +68 -44
  189. package/build/utils/modules.js.map +1 -1
  190. package/build/utils/obj.js +21 -15
  191. package/build/utils/obj.js.map +1 -1
  192. package/build/utils/plugin-resolver.d.ts +2 -2
  193. package/build/utils/plugin-resolver.js +169 -164
  194. package/build/utils/plugin-resolver.js.map +1 -1
  195. package/build/utils/sortObject.d.ts +1 -1
  196. package/build/utils/sortObject.js +58 -33
  197. package/build/utils/sortObject.js.map +1 -1
  198. package/build/utils/validations.js +81 -11
  199. package/build/utils/validations.js.map +1 -1
  200. package/build/utils/warnings.js +40 -38
  201. package/build/utils/warnings.js.map +1 -1
  202. package/package.json +71 -39
  203. package/build/ts-declarations/xcode/index.d.js +0 -2
  204. package/build/ts-declarations/xcode/index.d.js.map +0 -1
@@ -42,7 +42,7 @@ export interface ModProps<T = any> {
42
42
  readonly projectName?: string;
43
43
  /**
44
44
  * Ignore any of the user's local native files and solely rely on the generated files.
45
- * This makes prebuild data, like entitlements, more aligned to what users expects.
45
+ * This makes prebuild data, like entitlements, more aligned to what users expect.
46
46
  * When enabling this, users must be informed and have a way to disable this exclusion.
47
47
  */
48
48
  readonly ignoreExistingNativeFiles?: boolean;
@@ -1,13 +1,19 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.XcodeProject = void 0;
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "XcodeProject", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return _xcode().XcodeProject;
9
+ }
10
+ });
5
11
  function _xcode() {
6
- const data = require("xcode");
7
- _xcode = function () {
12
+ const data = require("xcode");
13
+ _xcode = function() {
14
+ return data;
15
+ };
8
16
  return data;
9
- };
10
- return data;
11
17
  }
12
- exports.XcodeProject = _xcode().XcodeProject;
13
- //# sourceMappingURL=Plugin.types.js.map
18
+
19
+ //# sourceMappingURL=Plugin.types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Plugin.types.js","names":["_xcode","data","require","exports","XcodeProject"],"sources":["../src/Plugin.types.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\nimport type { JSONObject } from '@expo/json-file';\nimport { XcodeProject } from 'xcode';\n\nimport type { Properties } from './android';\nimport type { AndroidManifest } from './android/Manifest';\nimport type * as AndroidPaths from './android/Paths';\nimport type { ResourceXML } from './android/Resources';\nimport type { InfoPlist } from './ios/IosConfig.types';\nimport type { AppDelegateProjectFile } from './ios/Paths';\n\nexport { XcodeProject } from 'xcode';\nexport type { ExpoPlist, InfoPlist } from './ios/IosConfig.types';\nexport type { AndroidManifest } from './android/Manifest';\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 /**\n * Ignore any of the user's local native files and solely rely on the generated files.\n * This makes prebuild data, like entitlements, more aligned to what users expects.\n * When enabling this, users must be informed and have a way to disable this exclusion.\n */\n readonly ignoreExistingNativeFiles?: boolean;\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 platform mods have been run.\n */\n dangerous?: Mod<unknown>;\n /**\n * Dangerously make a modification after all the other platform mods have been run.\n */\n finalized?: 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 platform mods have been run.\n */\n dangerous?: Mod<unknown>;\n /**\n * Dangerously make a modification after all the other platform mods have been run.\n */\n finalized?: 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"],"mappings":";;;;AAWA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAqCE,OAAA,CAAAC,YAAA,GAAAJ,MAAA,GAAAI,YAAA","ignoreList":[]}
1
+ {"version":3,"sources":["Plugin.types.ts"],"sourcesContent":[null],"names":["XcodeProject"],"mappings":";;;;+BAWSA;;;eAAAA,qBAAY;;;;yBAAQ"}
@@ -1,43 +1,55 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.getAllowBackup = getAllowBackup;
5
- exports.getAllowBackupFromManifest = getAllowBackupFromManifest;
6
- exports.setAllowBackup = setAllowBackup;
7
- exports.withAllowBackup = void 0;
8
- function _Manifest() {
9
- const data = require("./Manifest");
10
- _Manifest = function () {
11
- return data;
12
- };
13
- return data;
14
- }
15
- function _androidPlugins() {
16
- const data = require("../plugins/android-plugins");
17
- _androidPlugins = function () {
18
- return data;
19
- };
20
- return data;
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ 0 && (module.exports = {
6
+ getAllowBackup: null,
7
+ getAllowBackupFromManifest: null,
8
+ setAllowBackup: null,
9
+ withAllowBackup: null
10
+ });
11
+ function _export(target, all) {
12
+ for(var name in all)Object.defineProperty(target, name, {
13
+ enumerable: true,
14
+ get: Object.getOwnPropertyDescriptor(all, name).get
15
+ });
21
16
  }
22
- const withAllowBackup = exports.withAllowBackup = (0, _androidPlugins().createAndroidManifestPlugin)(setAllowBackup, 'withAllowBackup');
17
+ _export(exports, {
18
+ get getAllowBackup () {
19
+ return getAllowBackup;
20
+ },
21
+ get getAllowBackupFromManifest () {
22
+ return getAllowBackupFromManifest;
23
+ },
24
+ get setAllowBackup () {
25
+ return setAllowBackup;
26
+ },
27
+ get withAllowBackup () {
28
+ return withAllowBackup;
29
+ }
30
+ });
31
+ const _androidplugins = require("../plugins/android-plugins");
32
+ const _Manifest = require("./Manifest");
33
+ const withAllowBackup = (0, _androidplugins.createAndroidManifestPlugin)(setAllowBackup, 'withAllowBackup');
23
34
  function getAllowBackup(config) {
24
- // Defaults to true.
25
- // https://docs.expo.dev/versions/latest/config/app/#allowbackup
26
- return config.android?.allowBackup ?? true;
35
+ // Defaults to true.
36
+ // https://docs.expo.dev/versions/latest/config/app/#allowbackup
37
+ return config.android?.allowBackup ?? true;
27
38
  }
28
39
  function setAllowBackup(config, androidManifest) {
29
- const allowBackup = getAllowBackup(config);
30
- const mainApplication = (0, _Manifest().getMainApplication)(androidManifest);
31
- if (mainApplication?.$) {
32
- mainApplication.$['android:allowBackup'] = String(allowBackup);
33
- }
34
- return androidManifest;
40
+ const allowBackup = getAllowBackup(config);
41
+ const mainApplication = (0, _Manifest.getMainApplication)(androidManifest);
42
+ if (mainApplication?.$) {
43
+ mainApplication.$['android:allowBackup'] = String(allowBackup);
44
+ }
45
+ return androidManifest;
35
46
  }
36
47
  function getAllowBackupFromManifest(androidManifest) {
37
- const mainApplication = (0, _Manifest().getMainApplication)(androidManifest);
38
- if (mainApplication?.$) {
39
- return String(mainApplication.$['android:allowBackup']) === 'true';
40
- }
41
- return null;
48
+ const mainApplication = (0, _Manifest.getMainApplication)(androidManifest);
49
+ if (mainApplication?.$) {
50
+ return String(mainApplication.$['android:allowBackup']) === 'true';
51
+ }
52
+ return null;
42
53
  }
43
- //# sourceMappingURL=AllowBackup.js.map
54
+
55
+ //# sourceMappingURL=AllowBackup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AllowBackup.js","names":["_Manifest","data","require","_androidPlugins","withAllowBackup","exports","createAndroidManifestPlugin","setAllowBackup","getAllowBackup","config","android","allowBackup","androidManifest","mainApplication","getMainApplication","$","String","getAllowBackupFromManifest"],"sources":["../../src/android/AllowBackup.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { AndroidManifest, StringBoolean } from './Manifest';\nimport { getMainApplication } from './Manifest';\nimport { createAndroidManifestPlugin } from '../plugins/android-plugins';\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":";;;;;;;AAGA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,gBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,eAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAMG,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,IAAAE,6CAA2B,EAACC,cAAc,EAAE,iBAAiB,CAAC;AAEtF,SAASC,cAAcA,CAACC,MAAmC,EAAE;EAClE;EACA;EACA,OAAOA,MAAM,CAACC,OAAO,EAAEC,WAAW,IAAI,IAAI;AAC5C;AAEO,SAASJ,cAAcA,CAC5BE,MAAmC,EACnCG,eAAgC,EAChC;EACA,MAAMD,WAAW,GAAGH,cAAc,CAACC,MAAM,CAAC;EAE1C,MAAMI,eAAe,GAAG,IAAAC,8BAAkB,EAACF,eAAe,CAAC;EAC3D,IAAIC,eAAe,EAAEE,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,EAAEE,CAAC,EAAE;IACtB,OAAOC,MAAM,CAACH,eAAe,CAACE,CAAC,CAAC,qBAAqB,CAAC,CAAC,KAAK,MAAM;EACpE;EAEA,OAAO,IAAI;AACb","ignoreList":[]}
1
+ {"version":3,"sources":["android/AllowBackup.ts"],"sourcesContent":[null],"names":["getAllowBackup","getAllowBackupFromManifest","setAllowBackup","withAllowBackup","createAndroidManifestPlugin","config","android","allowBackup","androidManifest","mainApplication","getMainApplication","$","String"],"mappings":";;;;;;;;;;;;;;;;;QAQgBA;eAAAA;;QAoBAC;eAAAA;;QAdAC;eAAAA;;QARHC;eAAAA;;;gCAJ+B;0BAET;AAE5B,MAAMA,kBAAkBC,IAAAA,2CAA2B,EAACF,gBAAgB;AAEpE,SAASF,eAAeK,MAAmC;IAChE,oBAAoB;IACpB,gEAAgE;IAChE,OAAOA,OAAOC,OAAO,EAAEC,eAAe;AACxC;AAEO,SAASL,eACdG,MAAmC,EACnCG,eAAgC;IAEhC,MAAMD,cAAcP,eAAeK;IAEnC,MAAMI,kBAAkBC,IAAAA,4BAAkB,EAACF;IAC3C,IAAIC,iBAAiBE,GAAG;QACtBF,gBAAgBE,CAAC,CAAC,sBAAsB,GAAGC,OAAOL;IACpD;IAEA,OAAOC;AACT;AAEO,SAASP,2BAA2BO,eAAgC;IACzE,MAAMC,kBAAkBC,IAAAA,4BAAkB,EAACF;IAE3C,IAAIC,iBAAiBE,GAAG;QACtB,OAAOC,OAAOH,gBAAgBE,CAAC,CAAC,sBAAsB,MAAM;IAC9D;IAEA,OAAO;AACT"}
@@ -1,7 +1,7 @@
1
1
  import type { ExpoConfig } from '@expo/config-types';
2
- import type { PropertiesItem } from './Properties';
3
2
  import type { ConfigPlugin } from '../Plugin.types';
4
3
  import type { BuildPropertiesConfig, ConfigToPropertyRuleType } from '../utils/BuildProperties.types';
4
+ import type { PropertiesItem } from './Properties';
5
5
  /**
6
6
  * Creates a `withGradleProperties` config-plugin based on given config to property mapping rules.
7
7
  *
@@ -1,91 +1,97 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.createBuildGradlePropsConfigPlugin = createBuildGradlePropsConfigPlugin;
5
- exports.updateAndroidBuildPropertiesFromConfig = updateAndroidBuildPropertiesFromConfig;
6
- exports.updateAndroidBuildProperty = updateAndroidBuildProperty;
7
- exports.withJsEngineGradleProps = void 0;
8
- function _androidPlugins() {
9
- const data = require("../plugins/android-plugins");
10
- _androidPlugins = function () {
11
- return data;
12
- };
13
- return data;
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ 0 && (module.exports = {
6
+ createBuildGradlePropsConfigPlugin: null,
7
+ updateAndroidBuildPropertiesFromConfig: null,
8
+ updateAndroidBuildProperty: null,
9
+ withJsEngineGradleProps: null
10
+ });
11
+ function _export(target, all) {
12
+ for(var name in all)Object.defineProperty(target, name, {
13
+ enumerable: true,
14
+ get: Object.getOwnPropertyDescriptor(all, name).get
15
+ });
14
16
  }
15
- /**
16
- * Creates a `withGradleProperties` config-plugin based on given config to property mapping rules.
17
- *
18
- * The factory supports two modes from generic type inference
19
- * ```ts
20
- * // config-plugin without `props`, it will implicitly use the expo config as source config.
21
- * createBuildGradlePropsConfigPlugin<ExpoConfig>(): ConfigPlugin<void>;
22
- *
23
- * // config-plugin with a parameter `props: CustomType`, it will use the `props` as source config.
24
- * createBuildGradlePropsConfigPlugin<CustomType>(): ConfigPlugin<CustomType>;
25
- * ```
26
- *
27
- * @param configToPropertyRules config to property mapping rules
28
- * @param name the config plugin name
29
- */
17
+ _export(exports, {
18
+ get createBuildGradlePropsConfigPlugin () {
19
+ return createBuildGradlePropsConfigPlugin;
20
+ },
21
+ get updateAndroidBuildPropertiesFromConfig () {
22
+ return updateAndroidBuildPropertiesFromConfig;
23
+ },
24
+ get updateAndroidBuildProperty () {
25
+ return updateAndroidBuildProperty;
26
+ },
27
+ get withJsEngineGradleProps () {
28
+ return withJsEngineGradleProps;
29
+ }
30
+ });
31
+ const _androidplugins = require("../plugins/android-plugins");
30
32
  function createBuildGradlePropsConfigPlugin(configToPropertyRules, name) {
31
- const withUnknown = (config, sourceConfig) => (0, _androidPlugins().withGradleProperties)(config, config => {
32
- config.modResults = updateAndroidBuildPropertiesFromConfig(sourceConfig ?? config, config.modResults, configToPropertyRules);
33
- return config;
34
- });
35
- if (name) {
36
- Object.defineProperty(withUnknown, 'name', {
37
- value: name
38
- });
39
- }
40
- return withUnknown;
33
+ const withUnknown = (config, sourceConfig)=>(0, _androidplugins.withGradleProperties)(config, (config)=>{
34
+ config.modResults = updateAndroidBuildPropertiesFromConfig(sourceConfig ?? config, config.modResults, configToPropertyRules);
35
+ return config;
36
+ });
37
+ if (name) {
38
+ Object.defineProperty(withUnknown, 'name', {
39
+ value: name
40
+ });
41
+ }
42
+ return withUnknown;
41
43
  }
42
-
43
- /**
44
- * A config-plugin to update `android/gradle.properties` from the `jsEngine` in expo config
45
- */
46
- const withJsEngineGradleProps = exports.withJsEngineGradleProps = createBuildGradlePropsConfigPlugin([{
47
- propName: 'hermesEnabled',
48
- propValueGetter: config => ((config.android?.jsEngine ?? config.jsEngine ?? 'hermes') === 'hermes').toString()
49
- }], 'withJsEngineGradleProps');
44
+ const withJsEngineGradleProps = createBuildGradlePropsConfigPlugin([
45
+ {
46
+ propName: 'hermesEnabled',
47
+ propValueGetter: (config)=>((config.android?.jsEngine ?? config.jsEngine ?? 'hermes') === 'hermes').toString()
48
+ }
49
+ ], 'withJsEngineGradleProps');
50
50
  function updateAndroidBuildPropertiesFromConfig(config, gradleProperties, configToPropertyRules) {
51
- for (const configToProperty of configToPropertyRules) {
52
- const value = configToProperty.propValueGetter(config);
53
- updateAndroidBuildProperty(gradleProperties, configToProperty.propName, value);
54
- }
55
- return gradleProperties;
51
+ for (const configToProperty of configToPropertyRules){
52
+ const value = configToProperty.propValueGetter(config);
53
+ updateAndroidBuildProperty(gradleProperties, configToProperty.propName, value);
54
+ }
55
+ return gradleProperties;
56
56
  }
57
57
  function updateAndroidBuildProperty(gradleProperties, name, value, options) {
58
- const oldPropIndex = gradleProperties.findIndex(prop => prop.type === 'property' && prop.key === name);
59
- const oldProp = oldPropIndex >= 0 ? gradleProperties[oldPropIndex] : null;
60
- if (value) {
61
- // found the matched value, add or merge new property
62
- const newProp = {
63
- type: 'property',
64
- key: name,
65
- value
66
- };
67
- if (oldProp && oldProp.type === 'property') {
68
- try {
69
- const prevValue = JSON.parse(oldProp.value);
70
- const newValue = JSON.parse(value);
71
- if (Array.isArray(prevValue) && Array.isArray(newValue)) {
72
- const prevArrayWithStringifiedValues = prevValue.map(v => JSON.stringify(v));
73
- const newArrayWithStringifiedValues = newValue.map(v => JSON.stringify(v));
74
- const mergedValues = [...new Set([...prevArrayWithStringifiedValues, ...newArrayWithStringifiedValues])].map(v => JSON.parse(v));
75
- oldProp.value = JSON.stringify(mergedValues);
76
- return gradleProperties;
58
+ const oldPropIndex = gradleProperties.findIndex((prop)=>prop.type === 'property' && prop.key === name);
59
+ const oldProp = oldPropIndex >= 0 ? gradleProperties[oldPropIndex] : null;
60
+ if (value) {
61
+ // found the matched value, add or merge new property
62
+ const newProp = {
63
+ type: 'property',
64
+ key: name,
65
+ value
66
+ };
67
+ if (oldProp && oldProp.type === 'property') {
68
+ try {
69
+ const prevValue = JSON.parse(oldProp.value);
70
+ const newValue = JSON.parse(value);
71
+ if (Array.isArray(prevValue) && Array.isArray(newValue)) {
72
+ const prevArrayWithStringifiedValues = prevValue.map((v)=>JSON.stringify(v));
73
+ const newArrayWithStringifiedValues = newValue.map((v)=>JSON.stringify(v));
74
+ const mergedValues = [
75
+ ...new Set([
76
+ ...prevArrayWithStringifiedValues,
77
+ ...newArrayWithStringifiedValues
78
+ ])
79
+ ].map((v)=>JSON.parse(v));
80
+ oldProp.value = JSON.stringify(mergedValues);
81
+ return gradleProperties;
82
+ }
83
+ } catch {}
84
+ oldProp.value = value;
85
+ return gradleProperties;
77
86
  }
78
- } catch {}
79
- oldProp.value = value;
80
- return gradleProperties;
87
+ gradleProperties.push(newProp);
88
+ return gradleProperties;
89
+ }
90
+ if (options?.removePropWhenValueIsNull && oldPropIndex >= 0) {
91
+ gradleProperties.splice(oldPropIndex, 1);
92
+ return gradleProperties;
81
93
  }
82
- gradleProperties.push(newProp);
83
- return gradleProperties;
84
- }
85
- if (options?.removePropWhenValueIsNull && oldPropIndex >= 0) {
86
- gradleProperties.splice(oldPropIndex, 1);
87
94
  return gradleProperties;
88
- }
89
- return gradleProperties;
90
95
  }
91
- //# sourceMappingURL=BuildProperties.js.map
96
+
97
+ //# sourceMappingURL=BuildProperties.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BuildProperties.js","names":["_androidPlugins","data","require","createBuildGradlePropsConfigPlugin","configToPropertyRules","name","withUnknown","config","sourceConfig","withGradleProperties","modResults","updateAndroidBuildPropertiesFromConfig","Object","defineProperty","value","withJsEngineGradleProps","exports","propName","propValueGetter","android","jsEngine","toString","gradleProperties","configToProperty","updateAndroidBuildProperty","options","oldPropIndex","findIndex","prop","type","key","oldProp","newProp","prevValue","JSON","parse","newValue","Array","isArray","prevArrayWithStringifiedValues","map","v","stringify","newArrayWithStringifiedValues","mergedValues","Set","push","removePropWhenValueIsNull","splice"],"sources":["../../src/android/BuildProperties.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { PropertiesItem } from './Properties';\nimport type { ConfigPlugin } from '../Plugin.types';\nimport { withGradleProperties } from '../plugins/android-plugins';\nimport type {\n BuildPropertiesConfig,\n ConfigToPropertyRuleType,\n} from '../utils/BuildProperties.types';\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: 'hermesEnabled',\n propValueGetter: (config) =>\n (\n ((config.android as any)?.jsEngine ?? (config as any).jsEngine ?? 'hermes') === 'hermes'\n ).toString(),\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 const oldProp = oldPropIndex >= 0 ? gradleProperties[oldPropIndex] : null;\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 (oldProp && oldProp.type === 'property') {\n try {\n const prevValue = JSON.parse(oldProp.value);\n const newValue = JSON.parse(value);\n if (Array.isArray(prevValue) && Array.isArray(newValue)) {\n const prevArrayWithStringifiedValues = prevValue.map((v) => JSON.stringify(v));\n const newArrayWithStringifiedValues = newValue.map((v) => JSON.stringify(v));\n const mergedValues = [\n ...new Set([...prevArrayWithStringifiedValues, ...newArrayWithStringifiedValues]),\n ].map((v) => JSON.parse(v));\n oldProp.value = JSON.stringify(mergedValues);\n return gradleProperties;\n }\n } catch {}\n oldProp.value = value;\n return gradleProperties;\n }\n\n gradleProperties.push(newProp);\n return gradleProperties;\n }\n if (options?.removePropWhenValueIsNull && oldPropIndex >= 0) {\n gradleProperties.splice(oldPropIndex, 1);\n return gradleProperties;\n }\n\n return gradleProperties;\n}\n"],"mappings":";;;;;;;AAIA,SAAAA,gBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,eAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAMA;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,IAAID,MAAM,EACvBA,MAAM,CAACG,UAAU,EACjBN,qBACF,CAAC;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,GAAAC,OAAA,CAAAD,uBAAA,GAAGZ,kCAAkC,CACvE,CACE;EACEc,QAAQ,EAAE,eAAe;EACzBC,eAAe,EAAGX,MAAM,IACtB,CACE,CAAEA,MAAM,CAACY,OAAO,EAAUC,QAAQ,IAAKb,MAAM,CAASa,QAAQ,IAAI,QAAQ,MAAM,QAAQ,EACxFC,QAAQ,CAAC;AACf,CAAC,CACF,EACD,yBACF,CAAC;AAEM,SAASV,sCAAsCA,CAGpDJ,MAAwB,EACxBe,gBAAkC,EAClClB,qBAAmE,EACnE;EACA,KAAK,MAAMmB,gBAAgB,IAAInB,qBAAqB,EAAE;IACpD,MAAMU,KAAK,GAAGS,gBAAgB,CAACL,eAAe,CAACX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AClF,CAACH,GAAG,CAAEC,CAAC,IAAKP,IAAI,CAACC,KAAK,CAACM,CAAC,CAAC,CAAC;UAC3BV,OAAO,CAACjB,KAAK,GAAGoB,IAAI,CAACQ,SAAS,CAACE,YAAY,CAAC;UAC5C,OAAOtB,gBAAgB;QACzB;MACF,CAAC,CAAC,MAAM,CAAC;MACTS,OAAO,CAACjB,KAAK,GAAGA,KAAK;MACrB,OAAOQ,gBAAgB;IACzB;IAEAA,gBAAgB,CAACwB,IAAI,CAACd,OAAO,CAAC;IAC9B,OAAOV,gBAAgB;EACzB;EACA,IAAIG,OAAO,EAAEsB,yBAAyB,IAAIrB,YAAY,IAAI,CAAC,EAAE;IAC3DJ,gBAAgB,CAAC0B,MAAM,CAACtB,YAAY,EAAE,CAAC,CAAC;IACxC,OAAOJ,gBAAgB;EACzB;EAEA,OAAOA,gBAAgB;AACzB","ignoreList":[]}
1
+ {"version":3,"sources":["android/BuildProperties.ts"],"sourcesContent":[null],"names":["createBuildGradlePropsConfigPlugin","updateAndroidBuildPropertiesFromConfig","updateAndroidBuildProperty","withJsEngineGradleProps","configToPropertyRules","name","withUnknown","config","sourceConfig","withGradleProperties","modResults","Object","defineProperty","value","propName","propValueGetter","android","jsEngine","toString","gradleProperties","configToProperty","options","oldPropIndex","findIndex","prop","type","key","oldProp","newProp","prevValue","JSON","parse","newValue","Array","isArray","prevArrayWithStringifiedValues","map","v","stringify","newArrayWithStringifiedValues","mergedValues","Set","push","removePropWhenValueIsNull","splice"],"mappings":";;;;;;;;;;;;;;;;;QAyBgBA;eAAAA;;QAwCAC;eAAAA;;QAeAC;eAAAA;;QA5BHC;eAAAA;;;gCAjDwB;AAsB9B,SAASH,mCACdI,qBAAmE,EACnEC,IAAa;IAEb,MAAMC,cAA2F,CAC/FC,QACAC,eAEAC,IAAAA,oCAAoB,EAACF,QAAQ,CAACA;YAC5BA,OAAOG,UAAU,GAAGT,uCACjBO,gBAAgBD,QACjBA,OAAOG,UAAU,EACjBN;YAEF,O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,SAAS,CAACD;oBACzE,MAAMG,eAAe;2BAChB,IAAIC,IAAI;+BAAIN;+BAAmCI;yBAA8B;qBACjF,CAACH,GAAG,CAAC,CAACC,IAAMP,KAAKC,KAAK,CAACM;oBACxBV,QAAQd,KAAK,GAAGiB,KAAKQ,SAAS,CAACE;oBAC/B,OAAOrB;gBACT;YACF,EAAE,OAAM,CAAC;YACTQ,QAAQd,KAAK,GAAGA;YAChB,OAAOM;QACT;QAEAA,iBAAiBuB,IAAI,CAACd;QACtB,OAAOT;IACT;IACA,IAAIE,SAASsB,6BAA6BrB,gBAAgB,GAAG;QAC3DH,iBAAiByB,MAAM,CAACtB,cAAc;QACtC,OAAOH;IACT;IAEA,OAAOA;AACT"}
@@ -1,104 +1,99 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.assignColorValue = assignColorValue;
5
- exports.getColorsAsObject = getColorsAsObject;
6
- exports.getObjectAsColorsXml = getObjectAsColorsXml;
7
- exports.getProjectColorsXMLPathAsync = getProjectColorsXMLPathAsync;
8
- exports.removeColorItem = removeColorItem;
9
- exports.setColorItem = setColorItem;
10
- function _Paths() {
11
- const data = require("./Paths");
12
- _Paths = function () {
13
- return data;
14
- };
15
- return data;
16
- }
17
- function _Resources() {
18
- const data = require("./Resources");
19
- _Resources = function () {
20
- return data;
21
- };
22
- return data;
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ 0 && (module.exports = {
6
+ assignColorValue: null,
7
+ getColorsAsObject: null,
8
+ getObjectAsColorsXml: null,
9
+ getProjectColorsXMLPathAsync: null,
10
+ removeColorItem: null,
11
+ setColorItem: null
12
+ });
13
+ function _export(target, all) {
14
+ for(var name in all)Object.defineProperty(target, name, {
15
+ enumerable: true,
16
+ get: Object.getOwnPropertyDescriptor(all, name).get
17
+ });
23
18
  }
24
- function getProjectColorsXMLPathAsync(projectRoot, {
25
- kind
26
- } = {}) {
27
- return (0, _Paths().getResourceXMLPathAsync)(projectRoot, {
28
- kind,
29
- name: 'colors'
30
- });
19
+ _export(exports, {
20
+ get assignColorValue () {
21
+ return assignColorValue;
22
+ },
23
+ get getColorsAsObject () {
24
+ return getColorsAsObject;
25
+ },
26
+ get getObjectAsColorsXml () {
27
+ return getObjectAsColorsXml;
28
+ },
29
+ get getProjectColorsXMLPathAsync () {
30
+ return getProjectColorsXMLPathAsync;
31
+ },
32
+ get removeColorItem () {
33
+ return removeColorItem;
34
+ },
35
+ get setColorItem () {
36
+ return setColorItem;
37
+ }
38
+ });
39
+ const _Paths = require("./Paths");
40
+ const _Resources = require("./Resources");
41
+ function getProjectColorsXMLPathAsync(projectRoot, { kind } = {}) {
42
+ return (0, _Paths.getResourceXMLPathAsync)(projectRoot, {
43
+ kind,
44
+ name: 'colors'
45
+ });
31
46
  }
32
47
  function setColorItem(itemToAdd, colorFileContentsJSON) {
33
- if (colorFileContentsJSON.resources?.color) {
34
- const colorNameExists = colorFileContentsJSON.resources.color.filter(e => e.$.name === itemToAdd.$.name)[0];
35
- if (colorNameExists) {
36
- colorNameExists._ = itemToAdd._;
48
+ if (colorFileContentsJSON.resources?.color) {
49
+ const colorNameExists = colorFileContentsJSON.resources.color.filter((e)=>e.$.name === itemToAdd.$.name)[0];
50
+ if (colorNameExists) {
51
+ colorNameExists._ = itemToAdd._;
52
+ } else {
53
+ colorFileContentsJSON.resources.color.push(itemToAdd);
54
+ }
37
55
  } else {
38
- colorFileContentsJSON.resources.color.push(itemToAdd);
56
+ if (!colorFileContentsJSON.resources || typeof colorFileContentsJSON.resources === 'string') {
57
+ //file was empty and JSON is `{resources : ''}`
58
+ colorFileContentsJSON.resources = {};
59
+ }
60
+ colorFileContentsJSON.resources.color = [
61
+ itemToAdd
62
+ ];
39
63
  }
40
- } else {
41
- if (!colorFileContentsJSON.resources || typeof colorFileContentsJSON.resources === 'string') {
42
- //file was empty and JSON is `{resources : ''}`
43
- colorFileContentsJSON.resources = {};
44
- }
45
- colorFileContentsJSON.resources.color = [itemToAdd];
46
- }
47
- return colorFileContentsJSON;
64
+ return colorFileContentsJSON;
48
65
  }
49
66
  function removeColorItem(named, contents) {
50
- if (contents.resources?.color) {
51
- const index = contents.resources.color.findIndex(e => e.$.name === named);
52
- if (index > -1) {
53
- // replace the previous value
54
- contents.resources.color.splice(index, 1);
67
+ if (contents.resources?.color) {
68
+ const index = contents.resources.color.findIndex((e)=>e.$.name === named);
69
+ if (index > -1) {
70
+ // replace the previous value
71
+ contents.resources.color.splice(index, 1);
72
+ }
55
73
  }
56
- }
57
- return contents;
74
+ return contents;
58
75
  }
59
-
60
- /**
61
- * Set or remove value in XML based on nullish factor of the `value` property.
62
- */
63
- function assignColorValue(xml, {
64
- value,
65
- name
66
- }) {
67
- if (value) {
68
- return setColorItem((0, _Resources().buildResourceItem)({
69
- name,
70
- value
71
- }), xml);
72
- }
73
- return removeColorItem(name, xml);
76
+ function assignColorValue(xml, { value, name }) {
77
+ if (value) {
78
+ return setColorItem((0, _Resources.buildResourceItem)({
79
+ name,
80
+ value
81
+ }), xml);
82
+ }
83
+ return removeColorItem(name, xml);
74
84
  }
75
-
76
- /**
77
- * Helper to convert a basic XML object into a simple k/v pair.
78
- * `colors.xml` is a very basic XML file so this is pretty safe to do.
79
- * Added for testing purposes.
80
- *
81
- * @param xml
82
- * @returns
83
- */
84
85
  function getColorsAsObject(xml) {
85
- if (!xml?.resources?.color) {
86
- return null;
87
- }
88
- return (0, _Resources().getResourceItemsAsObject)(xml.resources.color);
86
+ if (!xml?.resources?.color) {
87
+ return null;
88
+ }
89
+ return (0, _Resources.getResourceItemsAsObject)(xml.resources.color);
89
90
  }
90
-
91
- /**
92
- * Helper to convert a basic k/v object to a colors XML object.
93
- *
94
- * @param xml
95
- * @returns
96
- */
97
91
  function getObjectAsColorsXml(obj) {
98
- return {
99
- resources: {
100
- color: (0, _Resources().getObjectAsResourceItems)(obj)
101
- }
102
- };
92
+ return {
93
+ resources: {
94
+ color: (0, _Resources.getObjectAsResourceItems)(obj)
95
+ }
96
+ };
103
97
  }
104
- //# sourceMappingURL=Colors.js.map
98
+
99
+ //# sourceMappingURL=Colors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Colors.js","names":["_Paths","data","require","_Resources","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 type { ResourceItemXML, ResourceKind, ResourceXML } from './Resources';\nimport { buildResourceItem, getObjectAsResourceItems, getResourceItemsAsObject } 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;AAEA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,SAASG,4BAA4BA,CAC1CC,WAAmB,EACnB;EAAEC;AAA8B,CAAC,GAAG,CAAC,CAAC,EACtC;EACA,OAAO,IAAAC,gCAAuB,EAACF,WAAW,EAAE;IAAEC,IAAI;IAAEE,IAAI,EAAE;EAAS,CAAC,CAAC;AACvE;AAEO,SAASC,YAAYA,CAACC,SAA0B,EAAEC,qBAAkC,EAAE;EAC3F,IAAIA,qBAAqB,CAACC,SAAS,EAAEC,KAAK,EAAE;IAC1C,MAAMC,eAAe,GAAGH,qBAAqB,CAACC,SAAS,CAACC,KAAK,CAACE,MAAM,CACjEC,CAAkB,IAAKA,CAAC,CAACC,CAAC,CAACT,IAAI,KAAKE,SAAS,CAACO,CAAC,CAACT,IAC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AAiC;EACjF,IAAI,CAACA,GAAG,EAAEf,SAAS,EAAEC,KAAK,EAAE;IAC1B,OAAO,IAAI;EACb;EAEA,OAAO,IAAAkB,qCAAwB,EAACJ,GAAG,CAACf,SAAS,CAACC,KAAK,CAAC;AACtD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASmB,oBAAoBA,CAACC,GAA2B,EAAe;EAC7E,OAAO;IACLrB,SAAS,EAAE;MACTC,KAAK,EAAE,IAAAqB,qCAAwB,EAACD,GAAG;IACrC;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"sources":["android/Colors.ts"],"sourcesContent":[null],"names":["assignColorValue","getColorsAsObject","getObjectAsColorsXml","getProjectColorsXMLPathAsync","removeColorItem","setColorItem","projectRoot","kind","getResourceXMLPathAsync","name","itemToAdd","colorFileContentsJSON","resources","color","colorNameExists","filter","e","$","_","push","named","contents","index","findIndex","splice","xml","value","buildResourceItem","getResourceItemsAsObject","obj","getObjectAsResourceItems"],"mappings":";;;;;;;;;;;;;;;;;;;QA6CgBA;eAAAA;;QA+BAC;eAAAA;;QAcAC;eAAAA;;QAtFAC;eAAAA;;QA2BAC;eAAAA;;QApBAC;eAAAA;;;uBAXwB;2BAE8C;AAE/E,SAASF,6BACdG,WAAmB,EACnB,EAAEC,IAAI,EAA2B,GAAG,CAAC,CAAC;IAEtC,OAAOC,IAAAA,8BAAuB,EAACF,aAAa;QAAEC;QAAME,MAAM;IAAS;AACrE;AAEO,SAASJ,aAAaK,SAA0B,EAAEC,qBAAkC;IACzF,IAAIA,sBAAsBC,SAAS,EAAEC,OAAO;QAC1C,MAAMC,kBAAkBH,sBAAsBC,SAAS,CAACC,KAAK,CAACE,MAAM,CAClE,CAACC,IAAuBA,EAAEC,CAAC,CAACR,IAAI,KAAKC,UAAUO,CAAC,CAACR,IAAI,CACtD,CAAC,EAAE;QACJ,IAAIK,iBAAiB;YACnBA,gBAAgBI,CAAC,GAAGR,UAAUQ,CAAC;QACjC,OAAO;YACL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