@expo/config-plugins 5.0.4 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/build/Plugin.types.d.ts +7 -7
  2. package/build/Plugin.types.js +0 -9
  3. package/build/Plugin.types.js.map +1 -1
  4. package/build/android/AllowBackup.js +0 -15
  5. package/build/android/AllowBackup.js.map +1 -1
  6. package/build/android/BuildProperties.js +2 -16
  7. package/build/android/BuildProperties.js.map +1 -1
  8. package/build/android/Colors.js +3 -25
  9. package/build/android/Colors.js.map +1 -1
  10. package/build/android/EasBuild.js +2 -22
  11. package/build/android/EasBuild.js.map +1 -1
  12. package/build/android/EasBuildGradleScript.js.map +1 -1
  13. package/build/android/GoogleMapsApiKey.js +0 -12
  14. package/build/android/GoogleMapsApiKey.js.map +1 -1
  15. package/build/android/GoogleServices.js +10 -48
  16. package/build/android/GoogleServices.js.map +1 -1
  17. package/build/android/IntentFilters.d.ts +1 -1
  18. package/build/android/IntentFilters.js +8 -24
  19. package/build/android/IntentFilters.js.map +1 -1
  20. package/build/android/Manifest.d.ts +19 -19
  21. package/build/android/Manifest.js +7 -66
  22. package/build/android/Manifest.js.map +1 -1
  23. package/build/android/Name.js +6 -27
  24. package/build/android/Name.js.map +1 -1
  25. package/build/android/Orientation.js +2 -12
  26. package/build/android/Orientation.js.map +1 -1
  27. package/build/android/Package.js +26 -111
  28. package/build/android/Package.js.map +1 -1
  29. package/build/android/Paths.d.ts +2 -2
  30. package/build/android/Paths.js +0 -47
  31. package/build/android/Paths.js.map +1 -1
  32. package/build/android/Permissions.js +8 -52
  33. package/build/android/Permissions.js.map +1 -1
  34. package/build/android/PrimaryColor.js +0 -18
  35. package/build/android/PrimaryColor.js.map +1 -1
  36. package/build/android/Properties.d.ts +1 -1
  37. package/build/android/Properties.js +0 -9
  38. package/build/android/Properties.js.map +1 -1
  39. package/build/android/Resources.d.ts +4 -4
  40. package/build/android/Resources.js +9 -29
  41. package/build/android/Resources.js.map +1 -1
  42. package/build/android/Scheme.d.ts +1 -1
  43. package/build/android/Scheme.js +13 -66
  44. package/build/android/Scheme.js.map +1 -1
  45. package/build/android/StatusBar.js +5 -33
  46. package/build/android/StatusBar.js.map +1 -1
  47. package/build/android/Strings.js +0 -14
  48. package/build/android/Strings.js.map +1 -1
  49. package/build/android/Styles.js +7 -34
  50. package/build/android/Styles.js.map +1 -1
  51. package/build/android/Updates.d.ts +2 -0
  52. package/build/android/Updates.js +50 -47
  53. package/build/android/Updates.js.map +1 -1
  54. package/build/android/Version.js +3 -29
  55. package/build/android/Version.js.map +1 -1
  56. package/build/android/WindowSoftInputMode.js +0 -14
  57. package/build/android/WindowSoftInputMode.js.map +1 -1
  58. package/build/android/codeMod.js +6 -22
  59. package/build/android/codeMod.js.map +1 -1
  60. package/build/android/index.js +0 -94
  61. package/build/android/index.js.map +1 -1
  62. package/build/index.js +2 -65
  63. package/build/index.js.map +1 -1
  64. package/build/ios/Bitcode.d.ts +1 -1
  65. package/build/ios/Bitcode.js +8 -28
  66. package/build/ios/Bitcode.js.map +1 -1
  67. package/build/ios/BuildProperties.js +2 -14
  68. package/build/ios/BuildProperties.js.map +1 -1
  69. package/build/ios/BuildScheme.js +2 -34
  70. package/build/ios/BuildScheme.js.map +1 -1
  71. package/build/ios/BundleIdentifier.js +13 -72
  72. package/build/ios/BundleIdentifier.js.map +1 -1
  73. package/build/ios/DeviceFamily.js +6 -24
  74. package/build/ios/DeviceFamily.js.map +1 -1
  75. package/build/ios/Entitlements.js +4 -45
  76. package/build/ios/Entitlements.js.map +1 -1
  77. package/build/ios/Google.d.ts +2 -2
  78. package/build/ios/Google.js +11 -66
  79. package/build/ios/Google.js.map +1 -1
  80. package/build/ios/IosConfig.types.d.ts +6 -11
  81. package/build/ios/IosConfig.types.js.map +1 -1
  82. package/build/ios/Locales.d.ts +3 -3
  83. package/build/ios/Locales.js +12 -43
  84. package/build/ios/Locales.js.map +1 -1
  85. package/build/ios/Maps.js +15 -53
  86. package/build/ios/Maps.js.map +1 -1
  87. package/build/ios/Name.js +7 -31
  88. package/build/ios/Name.js.map +1 -1
  89. package/build/ios/Orientation.js +2 -10
  90. package/build/ios/Orientation.js.map +1 -1
  91. package/build/ios/Paths.d.ts +2 -2
  92. package/build/ios/Paths.js +8 -73
  93. package/build/ios/Paths.js.map +1 -1
  94. package/build/ios/Permissions.js +1 -16
  95. package/build/ios/Permissions.js.map +1 -1
  96. package/build/ios/ProvisioningProfile.d.ts +1 -1
  97. package/build/ios/ProvisioningProfile.js +0 -18
  98. package/build/ios/ProvisioningProfile.js.map +1 -1
  99. package/build/ios/RequiresFullScreen.js +19 -31
  100. package/build/ios/RequiresFullScreen.js.map +1 -1
  101. package/build/ios/Scheme.js +10 -32
  102. package/build/ios/Scheme.js.map +1 -1
  103. package/build/ios/Swift.js +16 -50
  104. package/build/ios/Swift.js.map +1 -1
  105. package/build/ios/Target.js +0 -30
  106. package/build/ios/Target.js.map +1 -1
  107. package/build/ios/Updates.js +10 -49
  108. package/build/ios/Updates.js.map +1 -1
  109. package/build/ios/UsesNonExemptEncryption.js +4 -10
  110. package/build/ios/UsesNonExemptEncryption.js.map +1 -1
  111. package/build/ios/Version.js +4 -11
  112. package/build/ios/Version.js.map +1 -1
  113. package/build/ios/XcodeProjectFile.js +5 -23
  114. package/build/ios/XcodeProjectFile.js.map +1 -1
  115. package/build/ios/codeMod.js +19 -60
  116. package/build/ios/codeMod.js.map +1 -1
  117. package/build/ios/index.js +0 -97
  118. package/build/ios/index.js.map +1 -1
  119. package/build/ios/utils/Xcodeproj.d.ts +6 -6
  120. package/build/ios/utils/Xcodeproj.js +15 -101
  121. package/build/ios/utils/Xcodeproj.js.map +1 -1
  122. package/build/ios/utils/getInfoPlistPath.js +2 -15
  123. package/build/ios/utils/getInfoPlistPath.js.map +1 -1
  124. package/build/ios/utils/string.js +0 -1
  125. package/build/ios/utils/string.js.map +1 -1
  126. package/build/plugins/android-plugins.d.ts +2 -2
  127. package/build/plugins/android-plugins.js +11 -42
  128. package/build/plugins/android-plugins.js.map +1 -1
  129. package/build/plugins/createBaseMod.d.ts +3 -3
  130. package/build/plugins/createBaseMod.js +8 -25
  131. package/build/plugins/createBaseMod.js.map +1 -1
  132. package/build/plugins/ios-plugins.d.ts +2 -2
  133. package/build/plugins/ios-plugins.js +8 -48
  134. package/build/plugins/ios-plugins.js.map +1 -1
  135. package/build/plugins/mod-compiler.js +21 -72
  136. package/build/plugins/mod-compiler.js.map +1 -1
  137. package/build/plugins/withAndroidBaseMods.d.ts +1 -1
  138. package/build/plugins/withAndroidBaseMods.js +4 -89
  139. package/build/plugins/withAndroidBaseMods.js.map +1 -1
  140. package/build/plugins/withDangerousMod.js +0 -5
  141. package/build/plugins/withDangerousMod.js.map +1 -1
  142. package/build/plugins/withIosBaseMods.d.ts +1 -1
  143. package/build/plugins/withIosBaseMods.js +26 -118
  144. package/build/plugins/withIosBaseMods.js.map +1 -1
  145. package/build/plugins/withMod.d.ts +1 -1
  146. package/build/plugins/withMod.js +24 -59
  147. package/build/plugins/withMod.js.map +1 -1
  148. package/build/plugins/withPlugins.js +0 -9
  149. package/build/plugins/withPlugins.js.map +1 -1
  150. package/build/plugins/withRunOnce.js +3 -9
  151. package/build/plugins/withRunOnce.js.map +1 -1
  152. package/build/plugins/withStaticPlugin.js +21 -43
  153. package/build/plugins/withStaticPlugin.js.map +1 -1
  154. package/build/utils/BuildProperties.types.d.ts +2 -2
  155. package/build/utils/BuildProperties.types.js.map +1 -1
  156. package/build/utils/Updates.d.ts +3 -1
  157. package/build/utils/Updates.js +18 -77
  158. package/build/utils/Updates.js.map +1 -1
  159. package/build/utils/XML.d.ts +1 -1
  160. package/build/utils/XML.js +7 -44
  161. package/build/utils/XML.js.map +1 -1
  162. package/build/utils/commonCodeMod.js +2 -10
  163. package/build/utils/commonCodeMod.js.map +1 -1
  164. package/build/utils/errors.d.ts +1 -1
  165. package/build/utils/errors.js +3 -11
  166. package/build/utils/errors.js.map +1 -1
  167. package/build/utils/fs.js +1 -12
  168. package/build/utils/fs.js.map +1 -1
  169. package/build/utils/generateCode.d.ts +1 -1
  170. package/build/utils/generateCode.js +8 -25
  171. package/build/utils/generateCode.js.map +1 -1
  172. package/build/utils/history.d.ts +1 -1
  173. package/build/utils/history.js +0 -6
  174. package/build/utils/history.js.map +1 -1
  175. package/build/utils/matchBrackets.d.ts +3 -3
  176. package/build/utils/matchBrackets.js +2 -17
  177. package/build/utils/matchBrackets.js.map +1 -1
  178. package/build/utils/modules.js +0 -10
  179. package/build/utils/modules.js.map +1 -1
  180. package/build/utils/obj.js +0 -4
  181. package/build/utils/obj.js.map +1 -1
  182. package/build/utils/plugin-resolver.js +25 -69
  183. package/build/utils/plugin-resolver.js.map +1 -1
  184. package/build/utils/sortObject.js +4 -10
  185. package/build/utils/sortObject.js.map +1 -1
  186. package/build/utils/versions.js +0 -10
  187. package/build/utils/versions.js.map +1 -1
  188. package/build/utils/warnings.js +1 -9
  189. package/build/utils/warnings.js.map +1 -1
  190. package/package.json +5 -5
@@ -7,37 +7,27 @@ exports.createEntitlementsPlugin = createEntitlementsPlugin;
7
7
  exports.createInfoPlistPlugin = createInfoPlistPlugin;
8
8
  exports.createInfoPlistPluginWithPropertyGuard = createInfoPlistPluginWithPropertyGuard;
9
9
  exports.withXcodeProject = exports.withPodfileProperties = exports.withInfoPlist = exports.withExpoPlist = exports.withEntitlementsPlist = exports.withAppDelegate = void 0;
10
-
11
10
  function _obj() {
12
11
  const data = require("../utils/obj");
13
-
14
12
  _obj = function () {
15
13
  return data;
16
14
  };
17
-
18
15
  return data;
19
16
  }
20
-
21
17
  function _warnings() {
22
18
  const data = require("../utils/warnings");
23
-
24
19
  _warnings = function () {
25
20
  return data;
26
21
  };
27
-
28
22
  return data;
29
23
  }
30
-
31
24
  function _withMod() {
32
25
  const data = require("./withMod");
33
-
34
26
  _withMod = function () {
35
27
  return data;
36
28
  };
37
-
38
29
  return data;
39
30
  }
40
-
41
31
  /**
42
32
  * Helper method for creating mods from existing config functions.
43
33
  *
@@ -48,41 +38,33 @@ function createInfoPlistPlugin(action, name) {
48
38
  config.modResults = await action(config, config.modResults);
49
39
  return config;
50
40
  });
51
-
52
41
  if (name) {
53
42
  Object.defineProperty(withUnknown, 'name', {
54
43
  value: name
55
44
  });
56
45
  }
57
-
58
46
  return withUnknown;
59
47
  }
60
-
61
48
  function createInfoPlistPluginWithPropertyGuard(action, settings, name) {
62
49
  const withUnknown = config => withInfoPlist(config, async config => {
63
50
  var _config$modRawConfig$, _config$modRawConfig$2;
64
-
65
- const existingProperty = settings.expoPropertyGetter ? settings.expoPropertyGetter(config) : (0, _obj().get)(config, settings.expoConfigProperty); // If the user explicitly sets a value in the infoPlist, we should respect that.
66
-
51
+ const existingProperty = settings.expoPropertyGetter ? settings.expoPropertyGetter(config) : (0, _obj().get)(config, settings.expoConfigProperty);
52
+ // If the user explicitly sets a value in the infoPlist, we should respect that.
67
53
  if (((_config$modRawConfig$ = config.modRawConfig.ios) === null || _config$modRawConfig$ === void 0 ? void 0 : (_config$modRawConfig$2 = _config$modRawConfig$.infoPlist) === null || _config$modRawConfig$2 === void 0 ? void 0 : _config$modRawConfig$2[settings.infoPlistProperty]) === undefined) {
68
54
  config.modResults = await action(config, config.modResults);
69
55
  } else if (existingProperty !== undefined) {
70
56
  // Only warn if there is a conflict.
71
57
  (0, _warnings().addWarningIOS)(settings.expoConfigProperty, `"ios.infoPlist.${settings.infoPlistProperty}" is set in the config. Ignoring abstract property "${settings.expoConfigProperty}": ${existingProperty}`);
72
58
  }
73
-
74
59
  return config;
75
60
  });
76
-
77
61
  if (name) {
78
62
  Object.defineProperty(withUnknown, 'name', {
79
63
  value: name
80
64
  });
81
65
  }
82
-
83
66
  return withUnknown;
84
67
  }
85
-
86
68
  /**
87
69
  * Helper method for creating mods from existing config functions.
88
70
  *
@@ -93,23 +75,20 @@ function createEntitlementsPlugin(action, name) {
93
75
  config.modResults = await action(config, config.modResults);
94
76
  return config;
95
77
  });
96
-
97
78
  if (name) {
98
79
  Object.defineProperty(withUnknown, 'name', {
99
80
  value: name
100
81
  });
101
82
  }
102
-
103
83
  return withUnknown;
104
84
  }
85
+
105
86
  /**
106
87
  * Provides the AppDelegate file for modification.
107
88
  *
108
89
  * @param config
109
90
  * @param action
110
91
  */
111
-
112
-
113
92
  const withAppDelegate = (config, action) => {
114
93
  return (0, _withMod().withMod)(config, {
115
94
  platform: 'ios',
@@ -117,6 +96,7 @@ const withAppDelegate = (config, action) => {
117
96
  action
118
97
  });
119
98
  };
99
+
120
100
  /**
121
101
  * Provides the Info.plist file for modification.
122
102
  * Keeps the config's expo.ios.infoPlist object in sync with the data.
@@ -124,28 +104,22 @@ const withAppDelegate = (config, action) => {
124
104
  * @param config
125
105
  * @param action
126
106
  */
127
-
128
-
129
107
  exports.withAppDelegate = withAppDelegate;
130
-
131
108
  const withInfoPlist = (config, action) => {
132
109
  return (0, _withMod().withMod)(config, {
133
110
  platform: 'ios',
134
111
  mod: 'infoPlist',
135
-
136
112
  async action(config) {
137
113
  config = await action(config);
138
-
139
114
  if (!config.ios) {
140
115
  config.ios = {};
141
116
  }
142
-
143
117
  config.ios.infoPlist = config.modResults;
144
118
  return config;
145
119
  }
146
-
147
120
  });
148
121
  };
122
+
149
123
  /**
150
124
  * Provides the main .entitlements file for modification.
151
125
  * Keeps the config's expo.ios.entitlements object in sync with the data.
@@ -153,38 +127,29 @@ const withInfoPlist = (config, action) => {
153
127
  * @param config
154
128
  * @param action
155
129
  */
156
-
157
-
158
130
  exports.withInfoPlist = withInfoPlist;
159
-
160
131
  const withEntitlementsPlist = (config, action) => {
161
132
  return (0, _withMod().withMod)(config, {
162
133
  platform: 'ios',
163
134
  mod: 'entitlements',
164
-
165
135
  async action(config) {
166
136
  config = await action(config);
167
-
168
137
  if (!config.ios) {
169
138
  config.ios = {};
170
139
  }
171
-
172
140
  config.ios.entitlements = config.modResults;
173
141
  return config;
174
142
  }
175
-
176
143
  });
177
144
  };
145
+
178
146
  /**
179
147
  * Provides the Expo.plist for modification.
180
148
  *
181
149
  * @param config
182
150
  * @param action
183
151
  */
184
-
185
-
186
152
  exports.withEntitlementsPlist = withEntitlementsPlist;
187
-
188
153
  const withExpoPlist = (config, action) => {
189
154
  return (0, _withMod().withMod)(config, {
190
155
  platform: 'ios',
@@ -192,16 +157,14 @@ const withExpoPlist = (config, action) => {
192
157
  action
193
158
  });
194
159
  };
160
+
195
161
  /**
196
162
  * Provides the main .xcodeproj for modification.
197
163
  *
198
164
  * @param config
199
165
  * @param action
200
166
  */
201
-
202
-
203
167
  exports.withExpoPlist = withExpoPlist;
204
-
205
168
  const withXcodeProject = (config, action) => {
206
169
  return (0, _withMod().withMod)(config, {
207
170
  platform: 'ios',
@@ -209,16 +172,14 @@ const withXcodeProject = (config, action) => {
209
172
  action
210
173
  });
211
174
  };
175
+
212
176
  /**
213
177
  * Provides the Podfile.properties.json for modification.
214
178
  *
215
179
  * @param config
216
180
  * @param action
217
181
  */
218
-
219
-
220
182
  exports.withXcodeProject = withXcodeProject;
221
-
222
183
  const withPodfileProperties = (config, action) => {
223
184
  return (0, _withMod().withMod)(config, {
224
185
  platform: 'ios',
@@ -226,6 +187,5 @@ const withPodfileProperties = (config, action) => {
226
187
  action
227
188
  });
228
189
  };
229
-
230
190
  exports.withPodfileProperties = withPodfileProperties;
231
191
  //# sourceMappingURL=ios-plugins.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ios-plugins.js","names":["createInfoPlistPlugin","action","name","withUnknown","config","withInfoPlist","modResults","Object","defineProperty","value","createInfoPlistPluginWithPropertyGuard","settings","existingProperty","expoPropertyGetter","get","expoConfigProperty","modRawConfig","ios","infoPlist","infoPlistProperty","undefined","addWarningIOS","createEntitlementsPlugin","withEntitlementsPlist","withAppDelegate","withMod","platform","mod","entitlements","withExpoPlist","withXcodeProject","withPodfileProperties"],"sources":["../../src/plugins/ios-plugins.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\nimport type { JSONObject } from '@expo/json-file';\nimport type { XcodeProject } from 'xcode';\n\nimport type { ConfigPlugin, Mod } from '../Plugin.types';\nimport type { ExpoPlist, InfoPlist } from '../ios/IosConfig.types';\nimport type { AppDelegateProjectFile } from '../ios/Paths';\nimport { get } from '../utils/obj';\nimport { addWarningIOS } from '../utils/warnings';\nimport { withMod } from './withMod';\n\ntype MutateInfoPlistAction = (\n expo: ExpoConfig,\n infoPlist: InfoPlist\n) => Promise<InfoPlist> | InfoPlist;\n\n/**\n * Helper method for creating mods from existing config functions.\n *\n * @param action\n */\nexport function createInfoPlistPlugin(action: MutateInfoPlistAction, name?: string): ConfigPlugin {\n const withUnknown: ConfigPlugin = (config) =>\n withInfoPlist(config, async (config) => {\n config.modResults = await action(config, config.modResults);\n return config;\n });\n if (name) {\n Object.defineProperty(withUnknown, 'name', {\n value: name,\n });\n }\n return withUnknown;\n}\n\nexport function createInfoPlistPluginWithPropertyGuard(\n action: MutateInfoPlistAction,\n settings: {\n infoPlistProperty: string;\n expoConfigProperty: string;\n expoPropertyGetter?: (config: ExpoConfig) => string;\n },\n name?: string\n): ConfigPlugin {\n const withUnknown: ConfigPlugin = (config) =>\n withInfoPlist(config, async (config) => {\n const existingProperty = settings.expoPropertyGetter\n ? settings.expoPropertyGetter(config)\n : get(config, settings.expoConfigProperty);\n // If the user explicitly sets a value in the infoPlist, we should respect that.\n if (config.modRawConfig.ios?.infoPlist?.[settings.infoPlistProperty] === undefined) {\n config.modResults = await action(config, config.modResults);\n } else if (existingProperty !== undefined) {\n // Only warn if there is a conflict.\n addWarningIOS(\n settings.expoConfigProperty,\n `\"ios.infoPlist.${settings.infoPlistProperty}\" is set in the config. Ignoring abstract property \"${settings.expoConfigProperty}\": ${existingProperty}`\n );\n }\n\n return config;\n });\n if (name) {\n Object.defineProperty(withUnknown, 'name', {\n value: name,\n });\n }\n return withUnknown;\n}\n\ntype MutateEntitlementsPlistAction = (expo: ExpoConfig, entitlements: JSONObject) => JSONObject;\n\n/**\n * Helper method for creating mods from existing config functions.\n *\n * @param action\n */\nexport function createEntitlementsPlugin(\n action: MutateEntitlementsPlistAction,\n name: string\n): ConfigPlugin {\n const withUnknown: ConfigPlugin = (config) =>\n withEntitlementsPlist(config, async (config) => {\n config.modResults = await action(config, config.modResults);\n return config;\n });\n if (name) {\n Object.defineProperty(withUnknown, 'name', {\n value: name,\n });\n }\n return withUnknown;\n}\n\n/**\n * Provides the AppDelegate file for modification.\n *\n * @param config\n * @param action\n */\nexport const withAppDelegate: ConfigPlugin<Mod<AppDelegateProjectFile>> = (config, action) => {\n return withMod(config, {\n platform: 'ios',\n mod: 'appDelegate',\n action,\n });\n};\n\n/**\n * Provides the Info.plist file for modification.\n * Keeps the config's expo.ios.infoPlist object in sync with the data.\n *\n * @param config\n * @param action\n */\nexport const withInfoPlist: ConfigPlugin<Mod<InfoPlist>> = (config, action) => {\n return withMod<InfoPlist>(config, {\n platform: 'ios',\n mod: 'infoPlist',\n async action(config) {\n config = await action(config);\n if (!config.ios) {\n config.ios = {};\n }\n config.ios.infoPlist = config.modResults;\n return config;\n },\n });\n};\n\n/**\n * Provides the main .entitlements file for modification.\n * Keeps the config's expo.ios.entitlements object in sync with the data.\n *\n * @param config\n * @param action\n */\nexport const withEntitlementsPlist: ConfigPlugin<Mod<JSONObject>> = (config, action) => {\n return withMod<JSONObject>(config, {\n platform: 'ios',\n mod: 'entitlements',\n async action(config) {\n config = await action(config);\n if (!config.ios) {\n config.ios = {};\n }\n config.ios.entitlements = config.modResults;\n return config;\n },\n });\n};\n\n/**\n * Provides the Expo.plist for modification.\n *\n * @param config\n * @param action\n */\nexport const withExpoPlist: ConfigPlugin<Mod<ExpoPlist>> = (config, action) => {\n return withMod(config, {\n platform: 'ios',\n mod: 'expoPlist',\n action,\n });\n};\n\n/**\n * Provides the main .xcodeproj for modification.\n *\n * @param config\n * @param action\n */\nexport const withXcodeProject: ConfigPlugin<Mod<XcodeProject>> = (config, action) => {\n return withMod(config, {\n platform: 'ios',\n mod: 'xcodeproj',\n action,\n });\n};\n\n/**\n * Provides the Podfile.properties.json for modification.\n *\n * @param config\n * @param action\n */\nexport const withPodfileProperties: ConfigPlugin<Mod<Record<string, string>>> = (\n config,\n action\n) => {\n return withMod(config, {\n platform: 'ios',\n mod: 'podfileProperties',\n action,\n });\n};\n"],"mappings":";;;;;;;;;;AAOA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAOA;AACA;AACA;AACA;AACA;AACO,SAASA,qBAAT,CAA+BC,MAA/B,EAA8DC,IAA9D,EAA2F;EAChG,MAAMC,WAAyB,GAAIC,MAAD,IAChCC,aAAa,CAACD,MAAD,EAAS,MAAOA,MAAP,IAAkB;IACtCA,MAAM,CAACE,UAAP,GAAoB,MAAML,MAAM,CAACG,MAAD,EAASA,MAAM,CAACE,UAAhB,CAAhC;IACA,OAAOF,MAAP;EACD,CAHY,CADf;;EAKA,IAAIF,IAAJ,EAAU;IACRK,MAAM,CAACC,cAAP,CAAsBL,WAAtB,EAAmC,MAAnC,EAA2C;MACzCM,KAAK,EAAEP;IADkC,CAA3C;EAGD;;EACD,OAAOC,WAAP;AACD;;AAEM,SAASO,sCAAT,CACLT,MADK,EAELU,QAFK,EAOLT,IAPK,EAQS;EACd,MAAMC,WAAyB,GAAIC,MAAD,IAChCC,aAAa,CAACD,MAAD,EAAS,MAAOA,MAAP,IAAkB;IAAA;;IACtC,MAAMQ,gBAAgB,GAAGD,QAAQ,CAACE,kBAAT,GACrBF,QAAQ,CAACE,kBAAT,CAA4BT,MAA5B,CADqB,GAErB,IAAAU,UAAA,EAAIV,MAAJ,EAAYO,QAAQ,CAACI,kBAArB,CAFJ,CADsC,CAItC;;IACA,IAAI,0BAAAX,MAAM,CAACY,YAAP,CAAoBC,GAApB,0GAAyBC,SAAzB,kFAAqCP,QAAQ,CAACQ,iBAA9C,OAAqEC,SAA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ACO,MAAM6B,gBAAiD,GAAG,CAAC1B,MAAD,EAASH,MAAT,KAAoB;EACnF,OAAO,IAAAwB,kBAAA,EAAQrB,MAAR,EAAgB;IACrBsB,QAAQ,EAAE,KADW;IAErBC,GAAG,EAAE,WAFgB;IAGrB1B;EAHqB,CAAhB,CAAP;AAKD,CANM;AAQP;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAM8B,qBAAgE,GAAG,CAC9E3B,MAD8E,EAE9EH,MAF8E,KAG3E;EACH,OAAO,IAAAwB,kBAAA,EAAQrB,MAAR,EAAgB;IACrBsB,QAAQ,EAAE,KADW;IAErBC,GAAG,EAAE,mBAFgB;IAGrB1B;EAHqB,CAAhB,CAAP;AAKD,CATM"}
1
+ {"version":3,"file":"ios-plugins.js","names":["createInfoPlistPlugin","action","name","withUnknown","config","withInfoPlist","modResults","Object","defineProperty","value","createInfoPlistPluginWithPropertyGuard","settings","existingProperty","expoPropertyGetter","get","expoConfigProperty","modRawConfig","ios","infoPlist","infoPlistProperty","undefined","addWarningIOS","createEntitlementsPlugin","withEntitlementsPlist","withAppDelegate","withMod","platform","mod","entitlements","withExpoPlist","withXcodeProject","withPodfileProperties"],"sources":["../../src/plugins/ios-plugins.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\nimport type { JSONObject } from '@expo/json-file';\nimport type { XcodeProject } from 'xcode';\n\nimport type { ConfigPlugin, Mod } from '../Plugin.types';\nimport type { ExpoPlist, InfoPlist } from '../ios/IosConfig.types';\nimport type { AppDelegateProjectFile } from '../ios/Paths';\nimport { get } from '../utils/obj';\nimport { addWarningIOS } from '../utils/warnings';\nimport { withMod } from './withMod';\n\ntype MutateInfoPlistAction = (\n expo: ExpoConfig,\n infoPlist: InfoPlist\n) => Promise<InfoPlist> | InfoPlist;\n\n/**\n * Helper method for creating mods from existing config functions.\n *\n * @param action\n */\nexport function createInfoPlistPlugin(action: MutateInfoPlistAction, name?: string): ConfigPlugin {\n const withUnknown: ConfigPlugin = (config) =>\n withInfoPlist(config, async (config) => {\n config.modResults = await action(config, config.modResults);\n return config;\n });\n if (name) {\n Object.defineProperty(withUnknown, 'name', {\n value: name,\n });\n }\n return withUnknown;\n}\n\nexport function createInfoPlistPluginWithPropertyGuard(\n action: MutateInfoPlistAction,\n settings: {\n infoPlistProperty: string;\n expoConfigProperty: string;\n expoPropertyGetter?: (config: ExpoConfig) => string;\n },\n name?: string\n): ConfigPlugin {\n const withUnknown: ConfigPlugin = (config) =>\n withInfoPlist(config, async (config) => {\n const existingProperty = settings.expoPropertyGetter\n ? settings.expoPropertyGetter(config)\n : get(config, settings.expoConfigProperty);\n // If the user explicitly sets a value in the infoPlist, we should respect that.\n if (config.modRawConfig.ios?.infoPlist?.[settings.infoPlistProperty] === undefined) {\n config.modResults = await action(config, config.modResults);\n } else if (existingProperty !== undefined) {\n // Only warn if there is a conflict.\n addWarningIOS(\n settings.expoConfigProperty,\n `\"ios.infoPlist.${settings.infoPlistProperty}\" is set in the config. Ignoring abstract property \"${settings.expoConfigProperty}\": ${existingProperty}`\n );\n }\n\n return config;\n });\n if (name) {\n Object.defineProperty(withUnknown, 'name', {\n value: name,\n });\n }\n return withUnknown;\n}\n\ntype MutateEntitlementsPlistAction = (expo: ExpoConfig, entitlements: JSONObject) => JSONObject;\n\n/**\n * Helper method for creating mods from existing config functions.\n *\n * @param action\n */\nexport function createEntitlementsPlugin(\n action: MutateEntitlementsPlistAction,\n name: string\n): ConfigPlugin {\n const withUnknown: ConfigPlugin = (config) =>\n withEntitlementsPlist(config, async (config) => {\n config.modResults = await action(config, config.modResults);\n return config;\n });\n if (name) {\n Object.defineProperty(withUnknown, 'name', {\n value: name,\n });\n }\n return withUnknown;\n}\n\n/**\n * Provides the AppDelegate file for modification.\n *\n * @param config\n * @param action\n */\nexport const withAppDelegate: ConfigPlugin<Mod<AppDelegateProjectFile>> = (config, action) => {\n return withMod(config, {\n platform: 'ios',\n mod: 'appDelegate',\n action,\n });\n};\n\n/**\n * Provides the Info.plist file for modification.\n * Keeps the config's expo.ios.infoPlist object in sync with the data.\n *\n * @param config\n * @param action\n */\nexport const withInfoPlist: ConfigPlugin<Mod<InfoPlist>> = (config, action) => {\n return withMod<InfoPlist>(config, {\n platform: 'ios',\n mod: 'infoPlist',\n async action(config) {\n config = await action(config);\n if (!config.ios) {\n config.ios = {};\n }\n config.ios.infoPlist = config.modResults;\n return config;\n },\n });\n};\n\n/**\n * Provides the main .entitlements file for modification.\n * Keeps the config's expo.ios.entitlements object in sync with the data.\n *\n * @param config\n * @param action\n */\nexport const withEntitlementsPlist: ConfigPlugin<Mod<JSONObject>> = (config, action) => {\n return withMod<JSONObject>(config, {\n platform: 'ios',\n mod: 'entitlements',\n async action(config) {\n config = await action(config);\n if (!config.ios) {\n config.ios = {};\n }\n config.ios.entitlements = config.modResults;\n return config;\n },\n });\n};\n\n/**\n * Provides the Expo.plist for modification.\n *\n * @param config\n * @param action\n */\nexport const withExpoPlist: ConfigPlugin<Mod<ExpoPlist>> = (config, action) => {\n return withMod(config, {\n platform: 'ios',\n mod: 'expoPlist',\n action,\n });\n};\n\n/**\n * Provides the main .xcodeproj for modification.\n *\n * @param config\n * @param action\n */\nexport const withXcodeProject: ConfigPlugin<Mod<XcodeProject>> = (config, action) => {\n return withMod(config, {\n platform: 'ios',\n mod: 'xcodeproj',\n action,\n });\n};\n\n/**\n * Provides the Podfile.properties.json for modification.\n *\n * @param config\n * @param action\n */\nexport const withPodfileProperties: ConfigPlugin<Mod<Record<string, string>>> = (\n config,\n action\n) => {\n return withMod(config, {\n platform: 'ios',\n mod: 'podfileProperties',\n action,\n });\n};\n"],"mappings":";;;;;;;;;AAOA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAOA;AACA;AACA;AACA;AACA;AACO,SAASA,qBAAqB,CAACC,MAA6B,EAAEC,IAAa,EAAgB;EAChG,MAAMC,W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ync;
7
7
  exports.evalModsAsync = evalModsAsync;
8
8
  exports.withDefaultBaseMods = withDefaultBaseMods;
9
9
  exports.withIntrospectionBaseMods = withIntrospectionBaseMods;
10
-
11
10
  function _debug() {
12
11
  const data = _interopRequireDefault(require("debug"));
13
-
14
12
  _debug = function () {
15
13
  return data;
16
14
  };
17
-
18
15
  return data;
19
16
  }
20
-
21
17
  function _path() {
22
18
  const data = _interopRequireDefault(require("path"));
23
-
24
19
  _path = function () {
25
20
  return data;
26
21
  };
27
-
28
22
  return data;
29
23
  }
30
-
31
24
  function _Xcodeproj() {
32
25
  const data = require("../ios/utils/Xcodeproj");
33
-
34
26
  _Xcodeproj = function () {
35
27
  return data;
36
28
  };
37
-
38
29
  return data;
39
30
  }
40
-
41
31
  function _errors() {
42
32
  const data = require("../utils/errors");
43
-
44
33
  _errors = function () {
45
34
  return data;
46
35
  };
47
-
48
36
  return data;
49
37
  }
50
-
51
38
  function Warnings() {
52
39
  const data = _interopRequireWildcard(require("../utils/warnings"));
53
-
54
40
  Warnings = function () {
55
41
  return data;
56
42
  };
57
-
58
43
  return data;
59
44
  }
60
-
61
45
  function _createBaseMod() {
62
46
  const data = require("./createBaseMod");
63
-
64
47
  _createBaseMod = function () {
65
48
  return data;
66
49
  };
67
-
68
50
  return data;
69
51
  }
70
-
71
52
  function _withAndroidBaseMods() {
72
53
  const data = require("./withAndroidBaseMods");
73
-
74
54
  _withAndroidBaseMods = function () {
75
55
  return data;
76
56
  };
77
-
78
57
  return data;
79
58
  }
80
-
81
59
  function _withIosBaseMods() {
82
60
  const data = require("./withIosBaseMods");
83
-
84
61
  _withIosBaseMods = function () {
85
62
  return data;
86
63
  };
87
-
88
64
  return data;
89
65
  }
90
-
91
66
  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); }
92
-
93
67
  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; }
94
-
95
68
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
96
-
97
69
  const debug = (0, _debug().default)('expo:config-plugins:mod-compiler');
98
-
99
70
  function withDefaultBaseMods(config, props = {}) {
100
71
  config = (0, _withIosBaseMods().withIosBaseMods)(config, props);
101
72
  config = (0, _withAndroidBaseMods().withAndroidBaseMods)(config, props);
102
73
  return config;
103
74
  }
75
+
104
76
  /**
105
77
  * Get a prebuild config that safely evaluates mods without persisting any changes to the file system.
106
78
  * Currently this only supports infoPlist, entitlements, androidManifest, strings, gradleProperties, and expoPlist mods.
107
79
  * This plugin should be evaluated directly:
108
80
  */
109
-
110
-
111
81
  function withIntrospectionBaseMods(config, props = {}) {
112
82
  config = (0, _withIosBaseMods().withIosBaseMods)(config, {
113
83
  saveToInternal: true,
@@ -121,62 +91,51 @@ function withIntrospectionBaseMods(config, props = {}) {
121
91
  skipEmptyMod: false,
122
92
  ...props
123
93
  });
124
-
125
94
  if (config.mods) {
126
95
  // Remove all mods that don't have an introspection base mod, for instance `dangerous` mods.
127
96
  for (const platform of Object.keys(config.mods)) {
128
97
  // const platformPreserve = preserve[platform];
129
98
  for (const key of Object.keys(config.mods[platform] || {})) {
130
99
  var _config$mods$platform, _config$mods$platform2;
131
-
132
100
  // @ts-ignore
133
101
  if (!((_config$mods$platform = config.mods[platform]) !== null && _config$mods$platform !== void 0 && (_config$mods$platform2 = _config$mods$platform[key]) !== null && _config$mods$platform2 !== void 0 && _config$mods$platform2.isIntrospective)) {
134
102
  var _config$mods$platform3;
135
-
136
- debug(`removing non-idempotent mod: ${platform}.${key}`); // @ts-ignore
137
-
103
+ debug(`removing non-idempotent mod: ${platform}.${key}`);
104
+ // @ts-ignore
138
105
  (_config$mods$platform3 = config.mods[platform]) === null || _config$mods$platform3 === void 0 ? true : delete _config$mods$platform3[key];
139
106
  }
140
107
  }
141
108
  }
142
109
  }
143
-
144
110
  return config;
145
111
  }
112
+
146
113
  /**
147
114
  *
148
115
  * @param projectRoot
149
116
  * @param config
150
117
  */
151
-
152
-
153
118
  async function compileModsAsync(config, props) {
154
119
  if (props.introspect === true) {
155
120
  config = withIntrospectionBaseMods(config);
156
121
  } else {
157
122
  config = withDefaultBaseMods(config);
158
123
  }
159
-
160
124
  return await evalModsAsync(config, props);
161
125
  }
162
-
163
126
  function sortMods(commands, order) {
164
127
  const allKeys = commands.map(([key]) => key);
165
128
  const completeOrder = [...new Set([...order, ...allKeys])];
166
129
  const sorted = [];
167
-
168
130
  while (completeOrder.length) {
169
131
  const group = completeOrder.shift();
170
132
  const commandSet = commands.find(([key]) => key === group);
171
-
172
133
  if (commandSet) {
173
134
  sorted.push(commandSet);
174
135
  }
175
136
  }
176
-
177
137
  return sorted;
178
138
  }
179
-
180
139
  function getRawClone({
181
140
  mods,
182
141
  ...config
@@ -185,10 +144,11 @@ function getRawClone({
185
144
  // the mods.
186
145
  return Object.freeze(JSON.parse(JSON.stringify(config)));
187
146
  }
188
-
189
147
  const orders = {
190
- ios: [// dangerous runs first
191
- 'dangerous', // run the XcodeProject mod second because many plugins attempt to read from it.
148
+ ios: [
149
+ // dangerous runs first
150
+ 'dangerous',
151
+ // run the XcodeProject mod second because many plugins attempt to read from it.
192
152
  'xcodeproj'],
193
153
  android: ['dangerous']
194
154
  };
@@ -197,12 +157,10 @@ const orders = {
197
157
  *
198
158
  * @param config
199
159
  */
200
-
201
160
  async function evalModsAsync(config, {
202
161
  projectRoot,
203
162
  introspect,
204
163
  platforms,
205
-
206
164
  /**
207
165
  * Throw errors when mods are missing providers.
208
166
  * @default true
@@ -210,26 +168,19 @@ async function evalModsAsync(config, {
210
168
  assertMissingModProviders
211
169
  }) {
212
170
  const modRawConfig = getRawClone(config);
213
-
214
171
  for (const [platformName, platform] of Object.entries((_config$mods = config.mods) !== null && _config$mods !== void 0 ? _config$mods : {})) {
215
172
  var _config$mods;
216
-
217
173
  if (platforms && !platforms.includes(platformName)) {
218
174
  debug(`skip platform: ${platformName}`);
219
175
  continue;
220
176
  }
221
-
222
177
  let entries = Object.entries(platform);
223
-
224
178
  if (entries.length) {
225
179
  // Move dangerous item to the first position if it exists, this ensures that all dangerous code runs first.
226
180
  entries = sortMods(entries, orders[platformName]);
227
181
  debug(`run in order: ${entries.map(([name]) => name).join(', ')}`);
228
-
229
182
  const platformProjectRoot = _path().default.join(projectRoot, platformName);
230
-
231
183
  const projectName = platformName === 'ios' ? (0, _Xcodeproj().getHackyProjectName)(projectRoot, config) : undefined;
232
-
233
184
  for (const [modName, mod] of entries) {
234
185
  const modRequest = {
235
186
  projectRoot,
@@ -239,37 +190,35 @@ async function evalModsAsync(config, {
239
190
  modName,
240
191
  introspect: !!introspect
241
192
  };
242
-
243
193
  if (!mod.isProvider) {
244
194
  // In strict mode, throw an error.
245
195
  const errorMessage = `Initial base modifier for "${platformName}.${modName}" is not a provider and therefore will not provide modResults to child mods`;
246
-
247
196
  if (assertMissingModProviders !== false) {
248
197
  throw new (_errors().PluginError)(errorMessage, 'MISSING_PROVIDER');
249
198
  } else {
250
- Warnings().addWarningForPlatform(platformName, `${platformName}.${modName}`, `Skipping: Initial base modifier for "${platformName}.${modName}" is not a provider and therefore will not provide modResults to child mods. This may be due to an outdated version of Expo CLI.`); // In loose mode, just skip the mod entirely.
251
-
199
+ Warnings().addWarningForPlatform(platformName, `${platformName}.${modName}`, `Skipping: Initial base modifier for "${platformName}.${modName}" is not a provider and therefore will not provide modResults to child mods. This may be due to an outdated version of Expo CLI.`);
200
+ // In loose mode, just skip the mod entirely.
252
201
  continue;
253
202
  }
254
203
  }
255
-
256
- const results = await mod({ ...config,
204
+ const results = await mod({
205
+ ...config,
257
206
  modResults: null,
258
207
  modRequest,
259
208
  modRawConfig
260
- }); // Sanity check to help locate non compliant mods.
261
-
262
- config = (0, _createBaseMod().assertModResults)(results, platformName, modName); // @ts-ignore: `modResults` is added for modifications
263
-
264
- delete config.modResults; // @ts-ignore: `modRequest` is added for modifications
265
-
266
- delete config.modRequest; // @ts-ignore: `modRawConfig` is added for modifications
267
-
209
+ });
210
+
211
+ // Sanity check to help locate non compliant mods.
212
+ config = (0, _createBaseMod().assertModResults)(results, platformName, modName);
213
+ // @ts-ignore: `modResults` is added for modifications
214
+ delete config.modResults;
215
+ // @ts-ignore: `modRequest` is added for modifications
216
+ delete config.modRequest;
217
+ // @ts-ignore: `modRawConfig` is added for modifications
268
218
  delete config.modRawConfig;
269
219
  }
270
220
  }
271
221
  }
272
-
273
222
  return config;
274
223
  }
275
224
  //# sourceMappingURL=mod-compiler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mod-compiler.js","names":["debug","Debug","withDefaultBaseMods","config","props","withIosBaseMods","withAndroidBaseMods","withIntrospectionBaseMods","saveToInternal","skipEmptyMod","mods","platform","Object","keys","key","isIntrospective","compileModsAsync","introspect","evalModsAsync","sortMods","commands","order","allKeys","map","completeOrder","Set","sorted","length","group","shift","commandSet","find","push","getRawClone","freeze","JSON","parse","stringify","orders","ios","android","projectRoot","platforms","assertMissingModProviders","modRawConfig","platformName","entries","includes","name","join","platformProjectRoot","path","projectName","getHackyProjectName","undefined","modName","mod","modRequest","isProvider","errorMessage","PluginError","Warnings","addWarningForPlatform","results","modResults","assertModResults"],"sources":["../../src/plugins/mod-compiler.ts"],"sourcesContent":["import Debug from 'debug';\nimport path from 'path';\n\nimport { ExportedConfig, Mod, ModConfig, ModPlatform } from '../Plugin.types';\nimport { getHackyProjectName } from '../ios/utils/Xcodeproj';\nimport { PluginError } from '../utils/errors';\nimport * as Warnings from '../utils/warnings';\nimport { assertModResults, ForwardedBaseModOptions } from './createBaseMod';\nimport { withAndroidBaseMods } from './withAndroidBaseMods';\nimport { withIosBaseMods } from './withIosBaseMods';\n\nconst debug = Debug('expo:config-plugins:mod-compiler');\n\nexport function withDefaultBaseMods(\n config: ExportedConfig,\n props: ForwardedBaseModOptions = {}\n): ExportedConfig {\n config = withIosBaseMods(config, props);\n config = withAndroidBaseMods(config, props);\n return config;\n}\n\n/**\n * Get a prebuild config that safely evaluates mods without persisting any changes to the file system.\n * Currently this only supports infoPlist, entitlements, androidManifest, strings, gradleProperties, and expoPlist mods.\n * This plugin should be evaluated directly:\n */\nexport function withIntrospectionBaseMods(\n config: ExportedConfig,\n props: ForwardedBaseModOptions = {}\n): ExportedConfig {\n config = withIosBaseMods(config, {\n saveToInternal: true,\n // This writing optimization can be skipped since we never write in introspection mode.\n // Including empty mods will ensure that all mods get introspected.\n skipEmptyMod: false,\n ...props,\n });\n config = withAndroidBaseMods(config, {\n saveToInternal: true,\n skipEmptyMod: false,\n ...props,\n });\n\n if (config.mods) {\n // Remove all mods that don't have an introspection base mod, for instance `dangerous` mods.\n for (const platform of Object.keys(config.mods) as ModPlatform[]) {\n // const platformPreserve = preserve[platform];\n for (const key of Object.keys(config.mods[platform] || {})) {\n // @ts-ignore\n if (!config.mods[platform]?.[key]?.isIntrospective) {\n debug(`removing non-idempotent mod: ${platform}.${key}`);\n // @ts-ignore\n delete config.mods[platform]?.[key];\n }\n }\n }\n }\n\n return config;\n}\n\n/**\n *\n * @param projectRoot\n * @param config\n */\nexport async function compileModsAsync(\n config: ExportedConfig,\n props: {\n projectRoot: string;\n platforms?: ModPlatform[];\n introspect?: boolean;\n assertMissingModProviders?: boolean;\n }\n): Promise<ExportedConfig> {\n if (props.introspect === true) {\n config = withIntrospectionBaseMods(config);\n } else {\n config = withDefaultBaseMods(config);\n }\n return await evalModsAsync(config, props);\n}\n\nfunction sortMods(commands: [string, any][], order: string[]): [string, any][] {\n const allKeys = commands.map(([key]) => key);\n const completeOrder = [...new Set([...order, ...allKeys])];\n const sorted: [string, any][] = [];\n while (completeOrder.length) {\n const group = completeOrder.shift()!;\n const commandSet = commands.find(([key]) => key === group);\n if (commandSet) {\n sorted.push(commandSet);\n }\n }\n return sorted;\n}\n\nfunction getRawClone({ mods, ...config }: ExportedConfig) {\n // Configs should be fully serializable, so we can clone them without worrying about\n // the mods.\n return Object.freeze(JSON.parse(JSON.stringify(config)));\n}\n\nconst orders: Record<string, string[]> = {\n ios: [\n // dangerous runs first\n 'dangerous',\n // run the XcodeProject mod second because many plugins attempt to read from it.\n 'xcodeproj',\n ],\n android: ['dangerous'],\n};\n/**\n * A generic plugin compiler.\n *\n * @param config\n */\nexport async function evalModsAsync(\n config: ExportedConfig,\n {\n projectRoot,\n introspect,\n platforms,\n /**\n * Throw errors when mods are missing providers.\n * @default true\n */\n assertMissingModProviders,\n }: {\n projectRoot: string;\n introspect?: boolean;\n assertMissingModProviders?: boolean;\n platforms?: ModPlatform[];\n }\n): Promise<ExportedConfig> {\n const modRawConfig = getRawClone(config);\n for (const [platformName, platform] of Object.entries(config.mods ?? ({} as ModConfig))) {\n if (platforms && !platforms.includes(platformName as any)) {\n debug(`skip platform: ${platformName}`);\n continue;\n }\n\n let entries = Object.entries(platform);\n if (entries.length) {\n // Move dangerous item to the first position if it exists, this ensures that all dangerous code runs first.\n entries = sortMods(entries, orders[platformName]!);\n debug(`run in order: ${entries.map(([name]) => name).join(', ')}`);\n const platformProjectRoot = path.join(projectRoot, platformName);\n const projectName =\n platformName === 'ios' ? getHackyProjectName(projectRoot, config) : undefined;\n\n for (const [modName, mod] of entries) {\n const modRequest = {\n projectRoot,\n projectName,\n platformProjectRoot,\n platform: platformName as ModPlatform,\n modName,\n introspect: !!introspect,\n };\n\n if (!(mod as Mod).isProvider) {\n // In strict mode, throw an error.\n const errorMessage = `Initial base modifier for \"${platformName}.${modName}\" is not a provider and therefore will not provide modResults to child mods`;\n if (assertMissingModProviders !== false) {\n throw new PluginError(errorMessage, 'MISSING_PROVIDER');\n } else {\n Warnings.addWarningForPlatform(\n platformName as ModPlatform,\n `${platformName}.${modName}`,\n `Skipping: Initial base modifier for \"${platformName}.${modName}\" is not a provider and therefore will not provide modResults to child mods. This may be due to an outdated version of Expo CLI.`\n );\n // In loose mode, just skip the mod entirely.\n continue;\n }\n }\n\n const results = await (mod as Mod)({\n ...config,\n modResults: null,\n modRequest,\n modRawConfig,\n });\n\n // Sanity check to help locate non compliant mods.\n config = assertModResults(results, platformName, modName);\n // @ts-ignore: `modResults` is added for modifications\n delete config.modResults;\n // @ts-ignore: `modRequest` is added for modifications\n delete config.modRequest;\n // @ts-ignore: `modRawConfig` is added for modifications\n delete config.modRawConfig;\n }\n }\n }\n\n return config;\n}\n"],"mappings":";;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;;;;;;;AAEA,MAAMA,KAAK,GAAG,IAAAC,gBAAA,EAAM,kCAAN,CAAd;;AAEO,SAASC,mBAAT,CACLC,MADK,EAELC,KAA8B,GAAG,EAF5B,EAGW;EAChBD,MAAM,GAAG,IAAAE,kCAAA,EAAgBF,MAAhB,EAAwBC,KAAxB,CAAT;EACAD,MAAM,GAAG,IAAAG,0CAAA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3E;;UACA,IAAIZ,yBAAyB,KAAK,KAAlC,EAAyC;YACvC,MAAM,KAAIiB,qBAAJ,EAAgBD,YAAhB,EAA8B,kBAA9B,CAAN;UACD,CAFD,MAEO;YACLE,QAAQ,GAACC,qBAAT,CACEjB,YADF,EAEG,GAAEA,YAAa,IAAGU,OAAQ,EAF7B,EAGG,wCAAuCV,YAAa,IAAGU,OAAQ,kIAHlE,EADK,CAML;;YACA;UACD;QACF;;QAED,MAAMQ,OAAO,GAAG,MAAOP,GAAD,CAAa,EACjC,GAAGrD,MAD8B;UAEjC6D,UAAU,EAAE,IAFqB;UAGjCP,UAHiC;UAIjCb;QAJiC,CAAb,CAAtB,CA1BoC,CAiCpC;;QACAzC,MAAM,GAAG,IAAA8D,iCAAA,EAAiBF,OAAjB,EAA0BlB,YAA1B,EAAwCU,OAAxC,CAAT,CAlCoC,CAmCpC;;QACA,OAAOpD,MAAM,CAAC6D,UAAd,CApCoC,CAqCpC;;QACA,OAAO7D,MAAM,CAACsD,UAAd,CAtCoC,CAuCpC;;QACA,OAAOtD,MAAM,CAACyC,YAAd;MACD;IACF;EACF;;EAED,OAAOzC,MAAP;AACD"}
1
+ {"version":3,"file":"mod-compiler.js","names":["debug","Debug","withDefaultBaseMods","config","props","withIosBaseMods","withAndroidBaseMods","withIntrospectionBaseMods","saveToInternal","skipEmptyMod","mods","platform","Object","keys","key","isIntrospective","compileModsAsync","introspect","evalModsAsync","sortMods","commands","order","allKeys","map","completeOrder","Set","sorted","length","group","shift","commandSet","find","push","getRawClone","freeze","JSON","parse","stringify","orders","ios","android","projectRoot","platforms","assertMissingModProviders","modRawConfig","platformName","entries","includes","name","join","platformProjectRoot","path","projectName","getHackyProjectName","undefined","modName","mod","modRequest","isProvider","errorMessage","PluginError","Warnings","addWarningForPlatform","results","modResults","assertModResults"],"sources":["../../src/plugins/mod-compiler.ts"],"sourcesContent":["import Debug from 'debug';\nimport path from 'path';\n\nimport { ExportedConfig, Mod, ModConfig, ModPlatform } from '../Plugin.types';\nimport { getHackyProjectName } from '../ios/utils/Xcodeproj';\nimport { PluginError } from '../utils/errors';\nimport * as Warnings from '../utils/warnings';\nimport { assertModResults, ForwardedBaseModOptions } from './createBaseMod';\nimport { withAndroidBaseMods } from './withAndroidBaseMods';\nimport { withIosBaseMods } from './withIosBaseMods';\n\nconst debug = Debug('expo:config-plugins:mod-compiler');\n\nexport function withDefaultBaseMods(\n config: ExportedConfig,\n props: ForwardedBaseModOptions = {}\n): ExportedConfig {\n config = withIosBaseMods(config, props);\n config = withAndroidBaseMods(config, props);\n return config;\n}\n\n/**\n * Get a prebuild config that safely evaluates mods without persisting any changes to the file system.\n * Currently this only supports infoPlist, entitlements, androidManifest, strings, gradleProperties, and expoPlist mods.\n * This plugin should be evaluated directly:\n */\nexport function withIntrospectionBaseMods(\n config: ExportedConfig,\n props: ForwardedBaseModOptions = {}\n): ExportedConfig {\n config = withIosBaseMods(config, {\n saveToInternal: true,\n // This writing optimization can be skipped since we never write in introspection mode.\n // Including empty mods will ensure that all mods get introspected.\n skipEmptyMod: false,\n ...props,\n });\n config = withAndroidBaseMods(config, {\n saveToInternal: true,\n skipEmptyMod: false,\n ...props,\n });\n\n if (config.mods) {\n // Remove all mods that don't have an introspection base mod, for instance `dangerous` mods.\n for (const platform of Object.keys(config.mods) as ModPlatform[]) {\n // const platformPreserve = preserve[platform];\n for (const key of Object.keys(config.mods[platform] || {})) {\n // @ts-ignore\n if (!config.mods[platform]?.[key]?.isIntrospective) {\n debug(`removing non-idempotent mod: ${platform}.${key}`);\n // @ts-ignore\n delete config.mods[platform]?.[key];\n }\n }\n }\n }\n\n return config;\n}\n\n/**\n *\n * @param projectRoot\n * @param config\n */\nexport async function compileModsAsync(\n config: ExportedConfig,\n props: {\n projectRoot: string;\n platforms?: ModPlatform[];\n introspect?: boolean;\n assertMissingModProviders?: boolean;\n }\n): Promise<ExportedConfig> {\n if (props.introspect === true) {\n config = withIntrospectionBaseMods(config);\n } else {\n config = withDefaultBaseMods(config);\n }\n return await evalModsAsync(config, props);\n}\n\nfunction sortMods(commands: [string, any][], order: string[]): [string, any][] {\n const allKeys = commands.map(([key]) => key);\n const completeOrder = [...new Set([...order, ...allKeys])];\n const sorted: [string, any][] = [];\n while (completeOrder.length) {\n const group = completeOrder.shift()!;\n const commandSet = commands.find(([key]) => key === group);\n if (commandSet) {\n sorted.push(commandSet);\n }\n }\n return sorted;\n}\n\nfunction getRawClone({ mods, ...config }: ExportedConfig) {\n // Configs should be fully serializable, so we can clone them without worrying about\n // the mods.\n return Object.freeze(JSON.parse(JSON.stringify(config)));\n}\n\nconst orders: Record<string, string[]> = {\n ios: [\n // dangerous runs first\n 'dangerous',\n // run the XcodeProject mod second because many plugins attempt to read from it.\n 'xcodeproj',\n ],\n android: ['dangerous'],\n};\n/**\n * A generic plugin compiler.\n *\n * @param config\n */\nexport async function evalModsAsync(\n config: ExportedConfig,\n {\n projectRoot,\n introspect,\n platforms,\n /**\n * Throw errors when mods are missing providers.\n * @default true\n */\n assertMissingModProviders,\n }: {\n projectRoot: string;\n introspect?: boolean;\n assertMissingModProviders?: boolean;\n platforms?: ModPlatform[];\n }\n): Promise<ExportedConfig> {\n const modRawConfig = getRawClone(config);\n for (const [platformName, platform] of Object.entries(config.mods ?? ({} as ModConfig))) {\n if (platforms && !platforms.includes(platformName as any)) {\n debug(`skip platform: ${platformName}`);\n continue;\n }\n\n let entries = Object.entries(platform);\n if (entries.length) {\n // Move dangerous item to the first position if it exists, this ensures that all dangerous code runs first.\n entries = sortMods(entries, orders[platformName]!);\n debug(`run in order: ${entries.map(([name]) => name).join(', ')}`);\n const platformProjectRoot = path.join(projectRoot, platformName);\n const projectName =\n platformName === 'ios' ? getHackyProjectName(projectRoot, config) : undefined;\n\n for (const [modName, mod] of entries) {\n const modRequest = {\n projectRoot,\n projectName,\n platformProjectRoot,\n platform: platformName as ModPlatform,\n modName,\n introspect: !!introspect,\n };\n\n if (!(mod as Mod).isProvider) {\n // In strict mode, throw an error.\n const errorMessage = `Initial base modifier for \"${platformName}.${modName}\" is not a provider and therefore will not provide modResults to child mods`;\n if (assertMissingModProviders !== false) {\n throw new PluginError(errorMessage, 'MISSING_PROVIDER');\n } else {\n Warnings.addWarningForPlatform(\n platformName as ModPlatform,\n `${platformName}.${modName}`,\n `Skipping: Initial base modifier for \"${platformName}.${modName}\" is not a provider and therefore will not provide modResults to child mods. This may be due to an outdated version of Expo CLI.`\n );\n // In loose mode, just skip the mod entirely.\n continue;\n }\n }\n\n const results = await (mod as Mod)({\n ...config,\n modResults: null,\n modRequest,\n modRawConfig,\n });\n\n // Sanity check to help locate non compliant mods.\n config = assertModResults(results, platformName, modName);\n // @ts-ignore: `modResults` is added for modifications\n delete config.modResults;\n // @ts-ignore: `modRequest` is added for modifications\n delete config.modRequest;\n // @ts-ignore: `modRawConfig` is added for modifications\n delete config.modRawConfig;\n }\n }\n }\n\n return config;\n}\n"],"mappings":";;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAoD;AAAA;AAAA;AAEpD,MAAMA,KAAK,GAAG,IAAAC,gBAAK,EAAC,kCAAkC,CAAC;AAEhD,SAASC,mBAAmB,CACjCC,MAAsB,EACtBC,KAA8B,GAAG,CAAC,CAAC,EACnB;EAChBD,MAAM,GAAG,IAAAE,kCAAe,EAACF,MAAM,EAAEC,KAAK,CAAC;EACvCD,MAAM,GAAG,IAAAG,0CAAmB,EAACH,MAAM,EAAEC,KAAK,CAAC;EAC3C,OAAOD,MAAM;AACf;;AAEA;AACA;A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YAAY,EACX,GAAEA,YAAa,IAAGU,OAAQ,EAAC,EAC3B,wCAAuCV,YAAa,IAAGU,OAAQ,kIAAiI,CAClM;YACD;YACA;UACF;QACF;QAEA,MAAMQ,OAAO,GAAG,MAAOP,GAAG,CAAS;UACjC,GAAGrD,MAAM;UACT6D,UAAU,EAAE,IAAI;UAChBP,UAAU;UACVb;QACF,CAAC,CAAC;;QAEF;QACAzC,MAAM,GAAG,IAAA8D,iCAAgB,EAACF,OAAO,EAAElB,YAAY,EAAEU,OAAO,CAAC;QACzD;QACA,OAAOpD,MAAM,CAAC6D,UAAU;QACxB;QACA,OAAO7D,MAAM,CAACsD,UAAU;QACxB;QACA,OAAOtD,MAAM,CAACyC,YAAY;MAC5B;IACF;EACF;EAEA,OAAOzC,MAAM;AACf"}
@@ -17,7 +17,7 @@ declare const defaultProviders: {
17
17
  mainActivity: import("./createBaseMod").BaseModProviderMethods<Paths.ApplicationProjectFile, Partial<Pick<import("./withMod").BaseModOptions, "skipEmptyMod" | "saveToInternal">>>;
18
18
  mainApplication: import("./createBaseMod").BaseModProviderMethods<Paths.ApplicationProjectFile, Partial<Pick<import("./withMod").BaseModOptions, "skipEmptyMod" | "saveToInternal">>>;
19
19
  };
20
- declare type AndroidDefaultProviders = typeof defaultProviders;
20
+ type AndroidDefaultProviders = typeof defaultProviders;
21
21
  export declare function withAndroidBaseMods(config: ExportedConfig, { providers, ...props }?: ForwardedBaseModOptions & {
22
22
  providers?: Partial<AndroidDefaultProviders>;
23
23
  }): ExportedConfig;