@expo/config-plugins 7.9.1 → 8.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.
Files changed (131) hide show
  1. package/build/android/AllowBackup.js +4 -6
  2. package/build/android/AllowBackup.js.map +1 -1
  3. package/build/android/BuildProperties.js +4 -8
  4. package/build/android/BuildProperties.js.map +1 -1
  5. package/build/android/Colors.js +3 -6
  6. package/build/android/Colors.js.map +1 -1
  7. package/build/android/EasBuild.js +2 -2
  8. package/build/android/EasBuild.js.map +1 -1
  9. package/build/android/EasBuildGradleScript.js +1 -2
  10. package/build/android/EasBuildGradleScript.js.map +1 -1
  11. package/build/android/GoogleMapsApiKey.js +2 -4
  12. package/build/android/GoogleMapsApiKey.js.map +1 -1
  13. package/build/android/GoogleServices.js +1 -2
  14. package/build/android/GoogleServices.js.map +1 -1
  15. package/build/android/IntentFilters.js +6 -12
  16. package/build/android/IntentFilters.js.map +1 -1
  17. package/build/android/Manifest.d.ts +1 -0
  18. package/build/android/Manifest.js +13 -22
  19. package/build/android/Manifest.js.map +1 -1
  20. package/build/android/Name.js +2 -4
  21. package/build/android/Name.js.map +1 -1
  22. package/build/android/Orientation.js +2 -4
  23. package/build/android/Orientation.js.map +1 -1
  24. package/build/android/Package.js +2 -4
  25. package/build/android/Package.js.map +1 -1
  26. package/build/android/Paths.js +2 -2
  27. package/build/android/Paths.js.map +1 -1
  28. package/build/android/Permissions.js +4 -8
  29. package/build/android/Permissions.js.map +1 -1
  30. package/build/android/PrimaryColor.js +1 -2
  31. package/build/android/PrimaryColor.js.map +1 -1
  32. package/build/android/Resources.js +8 -6
  33. package/build/android/Resources.js.map +1 -1
  34. package/build/android/Scheme.js +17 -40
  35. package/build/android/Scheme.js.map +1 -1
  36. package/build/android/StatusBar.js +3 -6
  37. package/build/android/StatusBar.js.map +1 -1
  38. package/build/android/Strings.js +2 -4
  39. package/build/android/Strings.js.map +1 -1
  40. package/build/android/Styles.js +3 -4
  41. package/build/android/Styles.js.map +1 -1
  42. package/build/android/Updates.d.ts +0 -8
  43. package/build/android/Updates.js +6 -91
  44. package/build/android/Updates.js.map +1 -1
  45. package/build/android/Version.js +3 -6
  46. package/build/android/Version.js.map +1 -1
  47. package/build/android/WindowSoftInputMode.js +2 -3
  48. package/build/android/WindowSoftInputMode.js.map +1 -1
  49. package/build/android/index.js +2 -2
  50. package/build/android/index.js.map +1 -1
  51. package/build/index.js +3 -4
  52. package/build/index.js.map +1 -1
  53. package/build/ios/Bitcode.js +1 -2
  54. package/build/ios/Bitcode.js.map +1 -1
  55. package/build/ios/BuildProperties.js +4 -8
  56. package/build/ios/BuildProperties.js.map +1 -1
  57. package/build/ios/BuildScheme.js +7 -12
  58. package/build/ios/BuildScheme.js.map +1 -1
  59. package/build/ios/BundleIdentifier.js +3 -5
  60. package/build/ios/BundleIdentifier.js.map +1 -1
  61. package/build/ios/DeviceFamily.js +5 -8
  62. package/build/ios/DeviceFamily.js.map +1 -1
  63. package/build/ios/Entitlements.js +3 -6
  64. package/build/ios/Entitlements.js.map +1 -1
  65. package/build/ios/Google.js +2 -4
  66. package/build/ios/Google.js.map +1 -1
  67. package/build/ios/IosConfig.types.d.ts +3 -1
  68. package/build/ios/IosConfig.types.js.map +1 -1
  69. package/build/ios/Locales.js +3 -4
  70. package/build/ios/Locales.js.map +1 -1
  71. package/build/ios/Maps.js +2 -4
  72. package/build/ios/Maps.js.map +1 -1
  73. package/build/ios/Name.js +3 -6
  74. package/build/ios/Name.js.map +1 -1
  75. package/build/ios/Orientation.js +4 -8
  76. package/build/ios/Orientation.js.map +1 -1
  77. package/build/ios/Paths.js +2 -2
  78. package/build/ios/Paths.js.map +1 -1
  79. package/build/ios/PrivacyInfo.js +7 -11
  80. package/build/ios/PrivacyInfo.js.map +1 -1
  81. package/build/ios/RequiresFullScreen.js +2 -4
  82. package/build/ios/RequiresFullScreen.js.map +1 -1
  83. package/build/ios/Scheme.js +6 -9
  84. package/build/ios/Scheme.js.map +1 -1
  85. package/build/ios/Swift.js +2 -2
  86. package/build/ios/Swift.js.map +1 -1
  87. package/build/ios/Target.js +4 -5
  88. package/build/ios/Target.js.map +1 -1
  89. package/build/ios/Updates.d.ts +0 -16
  90. package/build/ios/Updates.js +6 -95
  91. package/build/ios/Updates.js.map +1 -1
  92. package/build/ios/UsesNonExemptEncryption.js +2 -4
  93. package/build/ios/UsesNonExemptEncryption.js.map +1 -1
  94. package/build/ios/Version.js +3 -6
  95. package/build/ios/Version.js.map +1 -1
  96. package/build/ios/codeMod.js +1 -2
  97. package/build/ios/codeMod.js.map +1 -1
  98. package/build/ios/index.js +2 -2
  99. package/build/ios/index.js.map +1 -1
  100. package/build/ios/utils/Xcodeproj.js +15 -21
  101. package/build/ios/utils/Xcodeproj.js.map +1 -1
  102. package/build/ios/utils/getInfoPlistPath.js +1 -2
  103. package/build/ios/utils/getInfoPlistPath.js.map +1 -1
  104. package/build/plugins/createBaseMod.js +3 -4
  105. package/build/plugins/createBaseMod.js.map +1 -1
  106. package/build/plugins/ios-plugins.js +1 -2
  107. package/build/plugins/ios-plugins.js.map +1 -1
  108. package/build/plugins/mod-compiler.js +6 -10
  109. package/build/plugins/mod-compiler.js.map +1 -1
  110. package/build/plugins/withAndroidBaseMods.js +4 -6
  111. package/build/plugins/withAndroidBaseMods.js.map +1 -1
  112. package/build/plugins/withIosBaseMods.js +4 -5
  113. package/build/plugins/withIosBaseMods.js.map +1 -1
  114. package/build/plugins/withMod.js +2 -4
  115. package/build/plugins/withMod.js.map +1 -1
  116. package/build/plugins/withStaticPlugin.js +2 -4
  117. package/build/plugins/withStaticPlugin.js.map +1 -1
  118. package/build/utils/Updates.d.ts +5 -0
  119. package/build/utils/Updates.js +34 -37
  120. package/build/utils/Updates.js.map +1 -1
  121. package/build/utils/XML.js +4 -8
  122. package/build/utils/XML.js.map +1 -1
  123. package/build/utils/generateCode.js +2 -2
  124. package/build/utils/generateCode.js.map +1 -1
  125. package/build/utils/history.js +1 -2
  126. package/build/utils/history.js.map +1 -1
  127. package/build/utils/modules.js +2 -4
  128. package/build/utils/modules.js.map +1 -1
  129. package/build/utils/plugin-resolver.js +5 -7
  130. package/build/utils/plugin-resolver.js.map +1 -1
  131. package/package.json +4 -6
@@ -21,25 +21,23 @@ function _androidPlugins() {
21
21
  };
22
22
  return data;
23
23
  }
24
- const withAllowBackup = (0, _androidPlugins().createAndroidManifestPlugin)(setAllowBackup, 'withAllowBackup');
25
- exports.withAllowBackup = withAllowBackup;
24
+ const withAllowBackup = exports.withAllowBackup = (0, _androidPlugins().createAndroidManifestPlugin)(setAllowBackup, 'withAllowBackup');
26
25
  function getAllowBackup(config) {
27
- var _config$android$allow, _config$android;
28
26
  // Defaults to true.
29
27
  // https://docs.expo.dev/versions/latest/config/app/#allowbackup
30
- return (_config$android$allow = (_config$android = config.android) === null || _config$android === void 0 ? void 0 : _config$android.allowBackup) !== null && _config$android$allow !== void 0 ? _config$android$allow : true;
28
+ return config.android?.allowBackup ?? true;
31
29
  }
32
30
  function setAllowBackup(config, androidManifest) {
33
31
  const allowBackup = getAllowBackup(config);
34
32
  const mainApplication = (0, _Manifest().getMainApplication)(androidManifest);
35
- if (mainApplication !== null && mainApplication !== void 0 && mainApplication.$) {
33
+ if (mainApplication?.$) {
36
34
  mainApplication.$['android:allowBackup'] = String(allowBackup);
37
35
  }
38
36
  return androidManifest;
39
37
  }
40
38
  function getAllowBackupFromManifest(androidManifest) {
41
39
  const mainApplication = (0, _Manifest().getMainApplication)(androidManifest);
42
- if (mainApplication !== null && mainApplication !== void 0 && mainApplication.$) {
40
+ if (mainApplication?.$) {
43
41
  return String(mainApplication.$['android:allowBackup']) === 'true';
44
42
  }
45
43
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"AllowBackup.js","names":["_Manifest","data","require","_androidPlugins","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 { AndroidManifest, getMainApplication, StringBoolean } 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":";;;;;;;;;AAEA,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,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
+ {"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 { ExpoConfig } from '@expo/config-types';\n\nimport { AndroidManifest, getMainApplication, StringBoolean } 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":";;;;;;;;;AAEA,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"}
@@ -31,7 +31,7 @@ function _androidPlugins() {
31
31
  */
32
32
  function createBuildGradlePropsConfigPlugin(configToPropertyRules, name) {
33
33
  const withUnknown = (config, sourceConfig) => (0, _androidPlugins().withGradleProperties)(config, config => {
34
- config.modResults = updateAndroidBuildPropertiesFromConfig(sourceConfig !== null && sourceConfig !== void 0 ? sourceConfig : config, config.modResults, configToPropertyRules);
34
+ config.modResults = updateAndroidBuildPropertiesFromConfig(sourceConfig ?? config, config.modResults, configToPropertyRules);
35
35
  return config;
36
36
  });
37
37
  if (name) {
@@ -45,14 +45,10 @@ function createBuildGradlePropsConfigPlugin(configToPropertyRules, name) {
45
45
  /**
46
46
  * A config-plugin to update `android/gradle.properties` from the `jsEngine` in expo config
47
47
  */
48
- const withJsEngineGradleProps = createBuildGradlePropsConfigPlugin([{
48
+ const withJsEngineGradleProps = exports.withJsEngineGradleProps = createBuildGradlePropsConfigPlugin([{
49
49
  propName: 'hermesEnabled',
50
- propValueGetter: config => {
51
- var _ref, _config$android$jsEng, _config$android;
52
- return (((_ref = (_config$android$jsEng = (_config$android = config.android) === null || _config$android === void 0 ? void 0 : _config$android.jsEngine) !== null && _config$android$jsEng !== void 0 ? _config$android$jsEng : config.jsEngine) !== null && _ref !== void 0 ? _ref : 'hermes') === 'hermes').toString();
53
- }
50
+ propValueGetter: config => ((config.android?.jsEngine ?? config.jsEngine ?? 'hermes') === 'hermes').toString()
54
51
  }], 'withJsEngineGradleProps');
55
- exports.withJsEngineGradleProps = withJsEngineGradleProps;
56
52
  function updateAndroidBuildPropertiesFromConfig(config, gradleProperties, configToPropertyRules) {
57
53
  for (const configToProperty of configToPropertyRules) {
58
54
  const value = configToProperty.propValueGetter(config);
@@ -74,7 +70,7 @@ function updateAndroidBuildProperty(gradleProperties, name, value, options) {
74
70
  } else {
75
71
  gradleProperties.push(newProp);
76
72
  }
77
- } else if (options !== null && options !== void 0 && options.removePropWhenValueIsNull && oldPropIndex >= 0) {
73
+ } else if (options?.removePropWhenValueIsNull && oldPropIndex >= 0) {
78
74
  gradleProperties.splice(oldPropIndex, 1);
79
75
  }
80
76
  return gradleProperties;
@@ -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","propName","propValueGetter","_ref","_config$android$jsEng","_config$android","android","jsEngine","toString","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 { PropertiesItem } from './Properties';\nimport type { ConfigPlugin } from '../Plugin.types';\nimport { withGradleProperties } from '../plugins/android-plugins';\nimport { BuildPropertiesConfig, ConfigToPropertyRuleType } 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 ((config.android?.jsEngine ?? config.jsEngine ?? 'hermes') === 'hermes').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\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":";;;;;;;;;AAIA,SAAAA,gBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,eAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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EC,gBAAgB,CAACV,QAAQ,EAAEF,KAAK,CAAC;EAChF;EAEA,OAAOW,gBAAgB;AACzB;AAEO,SAASE,0BAA0BA,CACxCF,gBAAkC,EAClCpB,IAAY,EACZS,KAAgC,EAChCc,OAAiD,EACjD;EACA,MAAMC,YAAY,GAAGJ,gBAAgB,CAACK,SAAS,CAC5CC,IAAI,IAAKA,IAAI,CAACC,IAAI,KAAK,UAAU,IAAID,IAAI,CAACE,GAAG,KAAK5B,IACrD,CAAC;EAED,IAAIS,KAAK,EAAE;IACT;IACA,MAAMoB,OAAuB,GAAG;MAC9BF,IAAI,EAAE,UAAU;MAChBC,GAAG,EAAE5B,IAAI;MACTS;IACF,CAAC;IAED,IAAIe,YAAY,IAAI,CAAC,EAAE;MACrBJ,gBAAgB,CAACI,YAAY,CAAC,GAAGK,OAAO;IAC1C,CAAC,MAAM;MACLT,gBAAgB,CAACU,IAAI,CAACD,OAAO,CAAC;IAChC;EACF,CAAC,MAAM,IAAIN,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEQ,yBAAyB,IAAIP,YAAY,IAAI,CAAC,EAAE;IAClEJ,gBAAgB,CAACY,MAAM,CAACR,YAAY,EAAE,CAAC,CAAC;EAC1C;EAEA,OAAOJ,gBAAgB;AACzB"}
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","newProp","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 { BuildPropertiesConfig, ConfigToPropertyRuleType } 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 ((config.android?.jsEngine ?? config.jsEngine ?? 'hermes') === 'hermes').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\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":";;;;;;;;;AAIA,SAAAA,gBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,eAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA;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,CAAC,CAACA,MAAM,CAACY,OAAO,EAAEC,QAAQ,IAAIb,MAAM,CAACa,QAAQ,IAAI,QAAQ,MAAM,QAAQ,EAAEC,QAAQ,CAAC;AACtF,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,MAAM,CAAC;IACtDiB,0BAA0B,CAACF,gBAAgB,EAAEC,gBAAgB,CAACN,QAAQ,EAAEH,KAAK,CAAC;EAChF;EAEA,OAAOQ,gBAAgB;AACzB;AAEO,SAASE,0BAA0BA,CACxCF,gBAAkC,EAClCjB,IAAY,EACZS,KAAgC,EAChCW,OAAiD,EACjD;EACA,MAAMC,YAAY,GAAGJ,gBAAgB,CAACK,SAAS,CAC5CC,IAAI,IAAKA,IAAI,CAACC,IAAI,KAAK,UAAU,IAAID,IAAI,CAACE,GAAG,KAAKzB,IACrD,CAAC;EAED,IAAIS,KAAK,EAAE;IACT;IACA,MAAMiB,OAAuB,GAAG;MAC9BF,IAAI,EAAE,UAAU;MAChBC,GAAG,EAAEzB,IAAI;MACTS;IACF,CAAC;IAED,IAAIY,YAAY,IAAI,CAAC,EAAE;MACrBJ,gBAAgB,CAACI,YAAY,CAAC,GAAGK,OAAO;IAC1C,CAAC,MAAM;MACLT,gBAAgB,CAACU,IAAI,CAACD,OAAO,CAAC;IAChC;EACF,CAAC,MAAM,IAAIN,OAAO,EAAEQ,yBAAyB,IAAIP,YAAY,IAAI,CAAC,EAAE;IAClEJ,gBAAgB,CAACY,MAAM,CAACR,YAAY,EAAE,CAAC,CAAC;EAC1C;EAEA,OAAOJ,gBAAgB;AACzB"}
@@ -32,8 +32,7 @@ function getProjectColorsXMLPathAsync(projectRoot, {
32
32
  });
33
33
  }
34
34
  function setColorItem(itemToAdd, colorFileContentsJSON) {
35
- var _colorFileContentsJSO;
36
- if ((_colorFileContentsJSO = colorFileContentsJSON.resources) !== null && _colorFileContentsJSO !== void 0 && _colorFileContentsJSO.color) {
35
+ if (colorFileContentsJSON.resources?.color) {
37
36
  const colorNameExists = colorFileContentsJSON.resources.color.filter(e => e.$.name === itemToAdd.$.name)[0];
38
37
  if (colorNameExists) {
39
38
  colorNameExists._ = itemToAdd._;
@@ -50,8 +49,7 @@ function setColorItem(itemToAdd, colorFileContentsJSON) {
50
49
  return colorFileContentsJSON;
51
50
  }
52
51
  function removeColorItem(named, contents) {
53
- var _contents$resources;
54
- if ((_contents$resources = contents.resources) !== null && _contents$resources !== void 0 && _contents$resources.color) {
52
+ if (contents.resources?.color) {
55
53
  const index = contents.resources.color.findIndex(e => e.$.name === named);
56
54
  if (index > -1) {
57
55
  // replace the previous value
@@ -86,8 +84,7 @@ function assignColorValue(xml, {
86
84
  * @returns
87
85
  */
88
86
  function getColorsAsObject(xml) {
89
- var _xml$resources;
90
- if (!(xml !== null && xml !== void 0 && (_xml$resources = xml.resources) !== null && _xml$resources !== void 0 && _xml$resources.color)) {
87
+ if (!xml?.resources?.color) {
91
88
  return null;
92
89
  }
93
90
  return (0, _Resources().getResourceItemsAsObject)(xml.resources.color);
@@ -1 +1 @@
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 };\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ACTC,KAAK,EAAE,IAAAuB,qCAAwB,EAACD,GAAG;IACrC;EACF,CAAC;AACH"}
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 {\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,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,IACnD,CAA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ACjF,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"}
@@ -34,8 +34,8 @@ function Paths() {
34
34
  };
35
35
  return data;
36
36
  }
37
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
38
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
37
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
38
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
39
39
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
40
40
  const APPLY_EAS_GRADLE = 'apply from: "./eas-build.gradle"';
41
41
  function hasApplyLine(content, applyLine) {
@@ -1 +1 @@
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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gB,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
+ {"version":3,"file":"EasBuild.js","names":["_fs","data","_interopRequireDefault","require","_path","_EasBuildGradleScript","Paths","_interopRequireWildcard","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","obj","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,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAA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BAAkB,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"}
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = `// Build integration with EAS
7
+ var _default = exports.default = `// Build integration with EAS
8
8
 
9
9
  import java.nio.file.Paths
10
10
 
@@ -79,5 +79,4 @@ tasks.whenTaskAdded {
79
79
  }
80
80
  }
81
81
  `;
82
- exports.default = _default;
83
82
  //# sourceMappingURL=EasBuildGradleScript.js.map
@@ -1 +1 @@
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
+ {"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":";;;;;;iCAAgB;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"}
@@ -22,11 +22,9 @@ function _androidPlugins() {
22
22
  }
23
23
  const META_API_KEY = 'com.google.android.geo.API_KEY';
24
24
  const LIB_HTTP = 'org.apache.http.legacy';
25
- const withGoogleMapsApiKey = (0, _androidPlugins().createAndroidManifestPlugin)(setGoogleMapsApiKey, 'withGoogleMapsApiKey');
26
- exports.withGoogleMapsApiKey = withGoogleMapsApiKey;
25
+ const withGoogleMapsApiKey = exports.withGoogleMapsApiKey = (0, _androidPlugins().createAndroidManifestPlugin)(setGoogleMapsApiKey, 'withGoogleMapsApiKey');
27
26
  function getGoogleMapsApiKey(config) {
28
- var _config$android$confi, _config$android, _config$android$confi2, _config$android$confi3;
29
- return (_config$android$confi = (_config$android = config.android) === null || _config$android === void 0 ? void 0 : (_config$android$confi2 = _config$android.config) === null || _config$android$confi2 === void 0 ? void 0 : (_config$android$confi3 = _config$android$confi2.googleMaps) === null || _config$android$confi3 === void 0 ? void 0 : _config$android$confi3.apiKey) !== null && _config$android$confi !== void 0 ? _config$android$confi : null;
27
+ return config.android?.config?.googleMaps?.apiKey ?? null;
30
28
  }
31
29
  function setGoogleMapsApiKey(config, androidManifest) {
32
30
  const apiKey = getGoogleMapsApiKey(config);
@@ -1 +1 @@
1
- {"version":3,"file":"GoogleMapsApiKey.js","names":["_Manifest","data","require","_androidPlugins","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 {\n addMetaDataItemToMainApplication,\n addUsesLibraryItemToMainApplication,\n AndroidManifest,\n getMainApplicationOrThrow,\n removeMetaDataItemFromMainApplication,\n removeUsesLibraryItemFromMainApplication,\n} from './Manifest';\nimport { createAndroidManifestPlugin } from '../plugins/android-plugins';\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,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAQA,SAAAE,gBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,eAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,MAAMG,YAAY,GAAG,gCAAgC;AACrD,MAAMC,QAAQ,GAAG,wBAAwB;AAElC,MAAMC,oBAAoB,GAAG,IAAAC,6CAA2B,EAC7DC,mBAAmB,EACnB,sBACF,CAAC;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
+ {"version":3,"file":"GoogleMapsApiKey.js","names":["_Manifest","data","require","_androidPlugins","META_API_KEY","LIB_HTTP","withGoogleMapsApiKey","exports","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 {\n addMetaDataItemToMainApplication,\n addUsesLibraryItemToMainApplication,\n AndroidManifest,\n getMainApplicationOrThrow,\n removeMetaDataItemFromMainApplication,\n removeUsesLibraryItemFromMainApplication,\n} from './Manifest';\nimport { createAndroidManifestPlugin } from '../plugins/android-plugins';\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,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAQA,SAAAE,gBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,eAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,MAAMG,YAAY,GAAG,gCAAgC;AACrD,MAAMC,QAAQ,GAAG,wBAAwB;AAElC,MAAMC,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAG,IAAAE,6CAA2B,EAC7DC,mBAAmB,EACnB,sBACF,CAAC;AAEM,SAASC,mBAAmBA,CAACC,MAAmC,EAAE;EACvE,OAAOA,MAAM,CAACC,OAAO,EAAED,MAAM,EAAEE,UAAU,EAAEC,MAAM,IAAI,IAAI;AAC3D;AAEO,SAASL,mBAAmBA,CACjCE,MAAmC,EACnCI,eAAgC,EAChC;EACA,MAAMD,MAAM,GAAGJ,mBAAmB,CAACC,MAAM,CAAC;EAC1C,MAAMK,eAAe,GAAG,IAAAC,qCAAyB,EAACF,eAAe,CAAC;EAElE,IAAID,MAAM,EAAE;IACV;IACA,IAAAI,4CAAgC,EAACF,eAAe,EAAEZ,YAAY,EAAEU,MAAM,CAAC;IACvE,IAAAK,+CAAmC,EAACH,eAAe,EAAE;MACnDI,IAAI,EAAEf,QAAQ;MACdgB,QAAQ,EAAE;IACZ,CAAC,CAAC;EACJ,CAAC,MAAM;IACL;IACA,IAAAC,iDAAqC,EAACN,eAAe,EAAEZ,YAAY,CAAC;IACpE,IAAAmB,oDAAwC,EAACP,eAAe,EAAEX,QAAQ,CAAC;EACrE;EAEA,OAAOU,eAAe;AACxB"}
@@ -84,8 +84,7 @@ const withGoogleServicesFile = config => {
84
84
  };
85
85
  exports.withGoogleServicesFile = withGoogleServicesFile;
86
86
  function getGoogleServicesFilePath(config) {
87
- var _config$android$googl, _config$android;
88
- return (_config$android$googl = (_config$android = config.android) === null || _config$android === void 0 ? void 0 : _config$android.googleServicesFile) !== null && _config$android$googl !== void 0 ? _config$android$googl : null;
87
+ return config.android?.googleServicesFile ?? null;
89
88
  }
90
89
  async function setGoogleServicesFile(config, projectRoot, targetPath = DEFAULT_TARGET_PATH) {
91
90
  const partialSourcePath = getGoogleServicesFilePath(config);
@@ -1 +1 @@
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;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AMI,eAAe,GAAGF,eAAI,CAACC,OAAO,CAACV,WAAW,EAAEM,UAAU,CAAC;EAE7D,IAAI;IACF,MAAM,IAAAM,6BAAuB,EAACJ,kBAAkB,EAAEG,eAAe,CAAC;EACpE,CAAC,CAAC,OAAOE,CAAC,EAAE;IACVC,OAAO,CAACC,GAAG,CAACF,CAAC,CAAC;IACd,MAAM,IAAIG,KAAK,CACZ,yCAAwCR,kBAAmB,OAAMG,eAAgB,4DACpF,CAAC;EACH;EACA,OAAO,IAAI;AACb;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASrB,YAAYA,CAACL,MAAmC,EAAEgC,WAAmB,EAAE;EACrF,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,GACpE,CAAC;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
+ {"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","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,KAA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,CAACR,WAAW,EAAEI,UAAU,CAAC;EAE7D,IAAI;IACF,MAAM,IAAAM,6BAAuB,EAACJ,kBAAkB,EAAEG,eAAe,CAAC;EACpE,CAAC,CAAC,OAAOE,CAAC,EAAE;IACVC,OAAO,CAACC,GAAG,CAACF,CAAC,CAAC;IACd,MAAM,IAAIG,KAAK,CACZ,yCAAwCR,kBAAmB,OAAMG,eAAgB,4DACpF,CAAC;EACH;EACA,OAAO,IAAI;AACb;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASnB,YAAYA,CAACL,MAAmC,EAAE8B,WAAmB,EAAE;EACrF,MAAMZ,kBAAkB,GAAGF,yBAAyB,CAAChB,MAAM,CAAC;EAC5D,IAAI,CAACkB,kBAAkB,EAAE;IACvB,OAAOY,WAAW;EACpB;EAEA,IAAIA,WAAW,CAACC,QAAQ,CAACnC,uBAAuB,CAAC,EAAE;IACjD,OAAOkC,WAAW;EACpB;;EAEA;EACA,OAAOA,WAAW,CAACE,OAAO,CACxB,kBAAkB,EACjB;AACL,qBAAqBpC,uBAAwB,IAAGE,qBAAsB,GACpE,CAAC;AACH;AAEO,SAASY,WAAWA,CAACV,MAAmC,EAAEiC,cAAsB,EAAE;EACvF,MAAMf,kBAAkB,GAAGF,yBAAyB,CAAChB,MAAM,CAAC;EAC5D,IAAI,CAACkB,kBAAkB,EAAE;IACvB,OAAOe,cAAc;EACvB;;EAEA;EACA,MAAMC,OAAO,GAAG,IAAIC,MAAM,CAAE,2BAA0BtC,oBAAqB,MAAK,CAAC;EACjF,IAAIoC,cAAc,CAACG,KAAK,CAACF,OAAO,CAAC,EAAE;IACjC,OAAOD,cAAc;EACvB;;EAEA;EACA,OAAOA,cAAc,GAAI,oBAAmBpC,oBAAqB,GAAE;AACrE"}
@@ -22,28 +22,22 @@ function _androidPlugins() {
22
22
  return data;
23
23
  }
24
24
  const GENERATED_TAG = 'data-generated';
25
- const withAndroidIntentFilters = (0, _androidPlugins().createAndroidManifestPlugin)(setAndroidIntentFilters, 'withAndroidIntentFilters');
26
- exports.withAndroidIntentFilters = withAndroidIntentFilters;
25
+ const withAndroidIntentFilters = exports.withAndroidIntentFilters = (0, _androidPlugins().createAndroidManifestPlugin)(setAndroidIntentFilters, 'withAndroidIntentFilters');
27
26
  function getIntentFilters(config) {
28
- var _config$android$inten, _config$android;
29
- return (_config$android$inten = (_config$android = config.android) === null || _config$android === void 0 ? void 0 : _config$android.intentFilters) !== null && _config$android$inten !== void 0 ? _config$android$inten : [];
27
+ return config.android?.intentFilters ?? [];
30
28
  }
31
29
  function setAndroidIntentFilters(config, androidManifest) {
32
- var _mainActivity$intent, _mainActivity$intent2;
33
30
  // Always ensure old tags are removed.
34
31
  const mainActivity = (0, _Manifest().getMainActivityOrThrow)(androidManifest);
35
32
  // Remove all generated tags from previous runs...
36
- if ((_mainActivity$intent = mainActivity['intent-filter']) !== null && _mainActivity$intent !== void 0 && _mainActivity$intent.length) {
37
- mainActivity['intent-filter'] = mainActivity['intent-filter'].filter(value => {
38
- var _value$$;
39
- return ((_value$$ = value.$) === null || _value$$ === void 0 ? void 0 : _value$$[GENERATED_TAG]) !== 'true';
40
- });
33
+ if (mainActivity['intent-filter']?.length) {
34
+ mainActivity['intent-filter'] = mainActivity['intent-filter'].filter(value => value.$?.[GENERATED_TAG] !== 'true');
41
35
  }
42
36
  const intentFilters = getIntentFilters(config);
43
37
  if (!intentFilters.length) {
44
38
  return androidManifest;
45
39
  }
46
- mainActivity['intent-filter'] = (_mainActivity$intent2 = mainActivity['intent-filter']) === null || _mainActivity$intent2 === void 0 ? void 0 : _mainActivity$intent2.concat(renderIntentFilters(intentFilters));
40
+ mainActivity['intent-filter'] = mainActivity['intent-filter']?.concat(renderIntentFilters(intentFilters));
47
41
  return androidManifest;
48
42
  }
49
43
  function renderIntentFilters(intentFilters) {
@@ -71,7 +65,7 @@ function renderIntentFilters(intentFilters) {
71
65
  /** Like `<data android:scheme="exp"/>` */
72
66
  function renderIntentFilterData(data) {
73
67
  return (Array.isArray(data) ? data : [data]).filter(Boolean).map(datum => ({
74
- $: Object.entries(datum !== null && datum !== void 0 ? datum : {}).reduce((prev, [key, value]) => ({
68
+ $: Object.entries(datum ?? {}).reduce((prev, [key, value]) => ({
75
69
  ...prev,
76
70
  [`android:${key}`]: value
77
71
  }), {})
@@ -1 +1 @@
1
- {"version":3,"file":"IntentFilters.js","names":["_Manifest","data","require","_androidPlugins","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 { AndroidManifest, getMainActivityOrThrow, ManifestIntentFilter } from './Manifest';\nimport { createAndroidManifestPlugin } from '../plugins/android-plugins';\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,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;AAIA,MAAMG,aAAa,GAAG,gBAAgB;AAE/B,MAAMC,wBAAwB,GAAG,IAAAC,6CAA2B,EACjEC,uBAAuB,EACvB,0BACF,CAAC;AAACC,OA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ACC,UAAU,GAAG,MAAM,GAAGC,SAAS;QAClE;QACA,CAAC1B,aAAa,GAAG;MACnB,CAAC;MACD2B,MAAM,EAAE;MACN;MACA;QACEP,CAAC,EAAE;UACD,cAAc,EAAG,yBAAwBI,YAAY,CAACG,MAAO;QAC/D;MACF,CAAC,CACF;MACD9B,IAAI,EAAE+B,sBAAsB,CAACJ,YAAY,CAAC3B,IAAI,CAAC;MAC/CgC,QAAQ,EAAEC,0BAA0B,CAACN,YAAY,CAACK,QAAQ;IAC5D,CAAC;EACH,CAAC,CAAC;AACJ;;AAEA;AACA,SAASD,sBAAsBA,CAAC/B,IAA4D,EAAE;EAC5F,OAAO,CAACkC,KAAK,CAACC,OAAO,CAACnC,IAAI,CAAC,GAAGA,IAAI,GAAG,CAACA,IAAI,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,CACH;EACF,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
+ {"version":3,"file":"IntentFilters.js","names":["_Manifest","data","require","_androidPlugins","GENERATED_TAG","withAndroidIntentFilters","exports","createAndroidManifestPlugin","setAndroidIntentFilters","getIntentFilters","config","android","intentFilters","androidManifest","mainActivity","getMainActivityOrThrow","length","filter","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 { AndroidManifest, getMainActivityOrThrow, ManifestIntentFilter } from './Manifest';\nimport { createAndroidManifestPlugin } from '../plugins/android-plugins';\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,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;AAIA,MAAMG,aAAa,GAAG,gBAAgB;AAE/B,MAAMC,wBAAwB,GAAAC,OAAA,CAAAD,wBAAA,GAAG,IAAAE,6CAA2B,EACjEC,uBAAuB,EACvB,0BACF,CAAC;AAEM,SAASC,gBAAgBA,CAACC,MAAmC,EAAwB;EAC1F,OAAOA,MAAM,CAACC,OAAO,EAAEC,aAAa,IAAI,EAAE;AAC5C;AAEO,SAASJ,uBAAuBA,CACrCE,MAAmC,EACnCG,eAAgC,EACf;EACjB;EACA,MAAMC,YAAY,GAAG,IAAAC,kCAAsB,EAACF,eAAe,CAAC;EAC5D;EACA,IAAIC,YAAY,CAAC,eAAe,CAAC,EAAEE,MAAM,EAAE;IACzCF,YA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EAAE,CAACC,GAAG,EAAEpB,KAAK,CAAC,MAAM;MAAE,GAAGmB,IAAI;MAAE,CAAE,WAAUC,GAAI,EAAC,GAAGpB;IAAM,CAAC,CAAC,EAChE,CAAC,CACH;EACF,CAAC,CAAC,CAAC;AACL;;AAEA;AACA,SAASW,0BAA0BA,CAACD,QAA4B,EAAE;EAChE,OAAO,CAACE,KAAK,CAACC,OAAO,CAACH,QAAQ,CAAC,GAAGA,QAAQ,GAAG,CAACA,QAAQ,CAAC,EAAEX,MAAM,CAACe,OAAO,CAAC,CAACV,GAAG,CAAEiB,GAAG,KAAM;IACrFpB,CAAC,EAAE;MACD,cAAc,EAAG,2BAA0BoB,GAAI;IACjD;EACF,CAAC,CAAC,CAAC;AACL"}
@@ -57,6 +57,7 @@ type ManifestApplicationAttributes = {
57
57
  'android:allowBackup'?: StringBoolean;
58
58
  'android:largeHeap'?: StringBoolean;
59
59
  'android:requestLegacyExternalStorage'?: StringBoolean;
60
+ 'android:supportsPictureInPicture'?: StringBoolean;
60
61
  'android:usesCleartextTraffic'?: StringBoolean;
61
62
  [key: string]: string | undefined;
62
63
  };
@@ -47,8 +47,8 @@ function XML() {
47
47
  };
48
48
  return data;
49
49
  }
50
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
51
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
50
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
51
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
52
52
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
53
53
  async function writeAndroidManifestAsync(manifestPath, androidManifest) {
54
54
  const manifestXml = XML().format(androidManifest);
@@ -73,11 +73,7 @@ function isManifest(xml) {
73
73
 
74
74
  /** Returns the `manifest.application` tag ending in `.MainApplication` */
75
75
  function getMainApplication(androidManifest) {
76
- var _androidManifest$mani, _androidManifest$mani2, _androidManifest$mani3;
77
- return (_androidManifest$mani = androidManifest === null || androidManifest === void 0 ? void 0 : (_androidManifest$mani2 = androidManifest.manifest) === null || _androidManifest$mani2 === void 0 ? void 0 : (_androidManifest$mani3 = _androidManifest$mani2.application) === null || _androidManifest$mani3 === void 0 ? void 0 : _androidManifest$mani3.filter(e => {
78
- var _e$$;
79
- return e === null || e === void 0 ? void 0 : (_e$$ = e.$) === null || _e$$ === void 0 ? void 0 : _e$$['android:name'].endsWith('.MainApplication');
80
- })[0]) !== null && _androidManifest$mani !== void 0 ? _androidManifest$mani : null;
76
+ return androidManifest?.manifest?.application?.filter(e => e?.$?.['android:name'].endsWith('.MainApplication'))[0] ?? null;
81
77
  }
82
78
  function getMainApplicationOrThrow(androidManifest) {
83
79
  const mainApplication = getMainApplication(androidManifest);
@@ -90,9 +86,8 @@ function getMainActivityOrThrow(androidManifest) {
90
86
  return mainActivity;
91
87
  }
92
88
  function getRunnableActivity(androidManifest) {
93
- var _androidManifest$mani4, _androidManifest$mani5, _androidManifest$mani6, _androidManifest$mani7, _androidManifest$mani8;
94
89
  // Get enabled activities
95
- const enabledActivities = androidManifest === null || androidManifest === void 0 ? void 0 : (_androidManifest$mani4 = androidManifest.manifest) === null || _androidManifest$mani4 === void 0 ? void 0 : (_androidManifest$mani5 = _androidManifest$mani4.application) === null || _androidManifest$mani5 === void 0 ? void 0 : (_androidManifest$mani6 = _androidManifest$mani5[0]) === null || _androidManifest$mani6 === void 0 ? void 0 : (_androidManifest$mani7 = _androidManifest$mani6.activity) === null || _androidManifest$mani7 === void 0 ? void 0 : (_androidManifest$mani8 = _androidManifest$mani7.filter) === null || _androidManifest$mani8 === void 0 ? void 0 : _androidManifest$mani8.call(_androidManifest$mani7, e => e.$['android:enabled'] !== 'false' && e.$['android:enabled'] !== false);
90
+ const enabledActivities = androidManifest?.manifest?.application?.[0]?.activity?.filter?.(e => e.$['android:enabled'] !== 'false' && e.$['android:enabled'] !== false);
96
91
  if (!enabledActivities) {
97
92
  return null;
98
93
  }
@@ -101,8 +96,7 @@ function getRunnableActivity(androidManifest) {
101
96
  for (const activity of enabledActivities) {
102
97
  if (Array.isArray(activity['intent-filter'])) {
103
98
  for (const intentFilter of activity['intent-filter']) {
104
- var _intentFilter$action, _intentFilter$categor;
105
- if ((_intentFilter$action = intentFilter.action) !== null && _intentFilter$action !== void 0 && _intentFilter$action.find(action => action.$['android:name'] === 'android.intent.action.MAIN') && (_intentFilter$categor = intentFilter.category) !== null && _intentFilter$categor !== void 0 && _intentFilter$categor.find(category => category.$['android:name'] === 'android.intent.category.LAUNCHER')) {
99
+ if (intentFilter.action?.find(action => action.$['android:name'] === 'android.intent.action.MAIN') && intentFilter.category?.find(category => category.$['android:name'] === 'android.intent.category.LAUNCHER')) {
106
100
  return activity;
107
101
  }
108
102
  }
@@ -111,9 +105,8 @@ function getRunnableActivity(androidManifest) {
111
105
  return null;
112
106
  }
113
107
  function getMainActivity(androidManifest) {
114
- var _androidManifest$mani9, _androidManifest$mani10, _androidManifest$mani11, _androidManifest$mani12, _androidManifest$mani13, _mainActivity$;
115
- const mainActivity = androidManifest === null || androidManifest === void 0 ? void 0 : (_androidManifest$mani9 = androidManifest.manifest) === null || _androidManifest$mani9 === void 0 ? void 0 : (_androidManifest$mani10 = _androidManifest$mani9.application) === null || _androidManifest$mani10 === void 0 ? void 0 : (_androidManifest$mani11 = _androidManifest$mani10[0]) === null || _androidManifest$mani11 === void 0 ? void 0 : (_androidManifest$mani12 = _androidManifest$mani11.activity) === null || _androidManifest$mani12 === void 0 ? void 0 : (_androidManifest$mani13 = _androidManifest$mani12.filter) === null || _androidManifest$mani13 === void 0 ? void 0 : _androidManifest$mani13.call(_androidManifest$mani12, e => e.$['android:name'] === '.MainActivity');
116
- return (_mainActivity$ = mainActivity === null || mainActivity === void 0 ? void 0 : mainActivity[0]) !== null && _mainActivity$ !== void 0 ? _mainActivity$ : null;
108
+ const mainActivity = androidManifest?.manifest?.application?.[0]?.activity?.filter?.(e => e.$['android:name'] === '.MainActivity');
109
+ return mainActivity?.[0] ?? null;
117
110
  }
118
111
  function addMetaDataItemToMainApplication(mainApplication, itemName, itemValue, itemType = 'value') {
119
112
  let existingMetaDataItem;
@@ -137,7 +130,7 @@ function addMetaDataItemToMainApplication(mainApplication, itemName, itemValue,
137
130
  }
138
131
  function removeMetaDataItemFromMainApplication(mainApplication, itemName) {
139
132
  const index = findMetaDataItem(mainApplication, itemName);
140
- if (mainApplication !== null && mainApplication !== void 0 && mainApplication['meta-data'] && index > -1) {
133
+ if (mainApplication?.['meta-data'] && index > -1) {
141
134
  mainApplication['meta-data'].splice(index, 1);
142
135
  }
143
136
  return mainApplication;
@@ -158,10 +151,9 @@ function findUsesLibraryItem(mainApplication, itemName) {
158
151
  }
159
152
  function getMainApplicationMetaDataValue(androidManifest, name) {
160
153
  const mainApplication = getMainApplication(androidManifest);
161
- if (mainApplication !== null && mainApplication !== void 0 && mainApplication.hasOwnProperty('meta-data')) {
162
- var _mainApplication$meta, _item$$$androidValue;
163
- const item = mainApplication === null || mainApplication === void 0 ? void 0 : (_mainApplication$meta = mainApplication['meta-data']) === null || _mainApplication$meta === void 0 ? void 0 : _mainApplication$meta.find(e => e.$['android:name'] === name);
164
- return (_item$$$androidValue = item === null || item === void 0 ? void 0 : item.$['android:value']) !== null && _item$$$androidValue !== void 0 ? _item$$$androidValue : null;
154
+ if (mainApplication?.hasOwnProperty('meta-data')) {
155
+ const item = mainApplication?.['meta-data']?.find(e => e.$['android:name'] === name);
156
+ return item?.$['android:value'] ?? null;
165
157
  }
166
158
  return null;
167
159
  }
@@ -184,7 +176,7 @@ function addUsesLibraryItemToMainApplication(mainApplication, item) {
184
176
  }
185
177
  function removeUsesLibraryItemFromMainApplication(mainApplication, itemName) {
186
178
  const index = findUsesLibraryItem(mainApplication, itemName);
187
- if (mainApplication !== null && mainApplication !== void 0 && mainApplication['uses-library'] && index > -1) {
179
+ if (mainApplication?.['uses-library'] && index > -1) {
188
180
  mainApplication['uses-library'].splice(index, 1);
189
181
  }
190
182
  return mainApplication;
@@ -220,8 +212,7 @@ function ensureManifestHasNamespace(manifest, {
220
212
  namespace,
221
213
  url
222
214
  }) {
223
- var _manifest$manifest, _manifest$manifest$$;
224
- if (manifest !== null && manifest !== void 0 && (_manifest$manifest = manifest.manifest) !== null && _manifest$manifest !== void 0 && (_manifest$manifest$$ = _manifest$manifest.$) !== null && _manifest$manifest$$ !== void 0 && _manifest$manifest$$[namespace]) {
215
+ if (manifest?.manifest?.$?.[namespace]) {
225
216
  return manifest;
226
217
  }
227
218
  manifest.manifest.$[namespace] = url;