@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
@@ -13,57 +13,40 @@ exports.isShellScriptBuildPhaseConfigured = isShellScriptBuildPhaseConfigured;
13
13
  exports.setUpdatesConfig = setUpdatesConfig;
14
14
  exports.setVersionsConfig = setVersionsConfig;
15
15
  exports.withUpdates = void 0;
16
-
17
16
  function path() {
18
17
  const data = _interopRequireWildcard(require("path"));
19
-
20
18
  path = function () {
21
19
  return data;
22
20
  };
23
-
24
21
  return data;
25
22
  }
26
-
27
23
  function _resolveFrom() {
28
24
  const data = _interopRequireDefault(require("resolve-from"));
29
-
30
25
  _resolveFrom = function () {
31
26
  return data;
32
27
  };
33
-
34
28
  return data;
35
29
  }
36
-
37
30
  function _iosPlugins() {
38
31
  const data = require("../plugins/ios-plugins");
39
-
40
32
  _iosPlugins = function () {
41
33
  return data;
42
34
  };
43
-
44
35
  return data;
45
36
  }
46
-
47
37
  function _Updates() {
48
38
  const data = require("../utils/Updates");
49
-
50
39
  _Updates = function () {
51
40
  return data;
52
41
  };
53
-
54
42
  return data;
55
43
  }
56
-
57
44
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
58
-
59
45
  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); }
60
-
61
46
  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; }
62
-
63
47
  const CREATE_MANIFEST_IOS_PATH = 'expo-updates/scripts/create-manifest-ios.sh';
64
48
  let Config;
65
49
  exports.Config = Config;
66
-
67
50
  (function (Config) {
68
51
  Config["ENABLED"] = "EXUpdatesEnabled";
69
52
  Config["CHECK_ON_LAUNCH"] = "EXUpdatesCheckOnLaunch";
@@ -76,7 +59,6 @@ exports.Config = Config;
76
59
  Config["CODE_SIGNING_CERTIFICATE"] = "EXUpdatesCodeSigningCertificate";
77
60
  Config["CODE_SIGNING_METADATA"] = "EXUpdatesCodeSigningMetadata";
78
61
  })(Config || (exports.Config = Config = {}));
79
-
80
62
  const withUpdates = (config, {
81
63
  expoUsername
82
64
  }) => {
@@ -87,53 +69,49 @@ const withUpdates = (config, {
87
69
  return config;
88
70
  });
89
71
  };
90
-
91
72
  exports.withUpdates = withUpdates;
92
-
93
73
  function setUpdatesConfig(projectRoot, config, expoPlist, username, expoUpdatesPackageVersion) {
94
- const newExpoPlist = { ...expoPlist,
74
+ const newExpoPlist = {
75
+ ...expoPlist,
95
76
  [Config.ENABLED]: (0, _Updates().getUpdatesEnabled)(config),
96
77
  [Config.CHECK_ON_LAUNCH]: (0, _Updates().getUpdatesCheckOnLaunch)(config, expoUpdatesPackageVersion),
97
78
  [Config.LAUNCH_WAIT_MS]: (0, _Updates().getUpdatesTimeout)(config)
98
79
  };
99
80
  const updateUrl = (0, _Updates().getUpdateUrl)(config, username);
100
-
101
81
  if (updateUrl) {
102
82
  newExpoPlist[Config.UPDATE_URL] = updateUrl;
103
83
  } else {
104
84
  delete newExpoPlist[Config.UPDATE_URL];
105
85
  }
106
-
107
86
  const codeSigningCertificate = (0, _Updates().getUpdatesCodeSigningCertificate)(projectRoot, config);
108
-
109
87
  if (codeSigningCertificate) {
110
88
  newExpoPlist[Config.CODE_SIGNING_CERTIFICATE] = codeSigningCertificate;
111
89
  } else {
112
90
  delete newExpoPlist[Config.CODE_SIGNING_CERTIFICATE];
113
91
  }
114
-
115
92
  const codeSigningMetadata = (0, _Updates().getUpdatesCodeSigningMetadata)(config);
116
-
117
93
  if (codeSigningMetadata) {
118
94
  newExpoPlist[Config.CODE_SIGNING_METADATA] = codeSigningMetadata;
119
95
  } else {
120
96
  delete newExpoPlist[Config.CODE_SIGNING_METADATA];
121
97
  }
122
-
98
+ const requestHeaders = (0, _Updates().getUpdatesRequestHeaders)(config);
99
+ if (requestHeaders) {
100
+ newExpoPlist[Config.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY] = requestHeaders;
101
+ } else {
102
+ delete newExpoPlist[Config.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY];
103
+ }
123
104
  return setVersionsConfig(config, newExpoPlist);
124
105
  }
125
-
126
106
  function setVersionsConfig(config, expoPlist) {
127
- const newExpoPlist = { ...expoPlist
107
+ const newExpoPlist = {
108
+ ...expoPlist
128
109
  };
129
110
  const runtimeVersion = (0, _Updates().getRuntimeVersionNullable)(config, 'ios');
130
-
131
111
  if (!runtimeVersion && expoPlist[Config.RUNTIME_VERSION]) {
132
112
  throw new Error('A runtime version is set in your Expo.plist, but is missing from your app.json/app.config.js. Please either set runtimeVersion in your app.json/app.config.js or remove EXUpdatesRuntimeVersion from your Expo.plist.');
133
113
  }
134
-
135
114
  const sdkVersion = (0, _Updates().getSDKVersion)(config);
136
-
137
115
  if (runtimeVersion) {
138
116
  delete newExpoPlist[Config.SDK_VERSION];
139
117
  newExpoPlist[Config.RUNTIME_VERSION] = runtimeVersion;
@@ -148,71 +126,54 @@ function setVersionsConfig(config, expoPlist) {
148
126
  delete newExpoPlist[Config.SDK_VERSION];
149
127
  delete newExpoPlist[Config.RUNTIME_VERSION];
150
128
  }
151
-
152
129
  return newExpoPlist;
153
130
  }
154
-
155
131
  function formatConfigurationScriptPath(projectRoot) {
156
132
  const buildScriptPath = _resolveFrom().default.silent(projectRoot, CREATE_MANIFEST_IOS_PATH);
157
-
158
133
  if (!buildScriptPath) {
159
134
  throw new Error("Could not find the build script for iOS. This could happen in case of outdated 'node_modules'. Run 'npm install' to make sure that it's up-to-date.");
160
135
  }
161
-
162
136
  const relativePath = path().relative(path().join(projectRoot, 'ios'), buildScriptPath);
163
137
  return process.platform === 'win32' ? relativePath.replace(/\\/g, '/') : relativePath;
164
138
  }
165
-
166
139
  function getBundleReactNativePhase(project) {
167
140
  const shellScriptBuildPhase = project.hash.project.objects.PBXShellScriptBuildPhase;
168
141
  const bundleReactNative = Object.values(shellScriptBuildPhase).find(buildPhase => buildPhase.name === '"Bundle React Native code and images"');
169
-
170
142
  if (!bundleReactNative) {
171
143
  throw new Error(`Couldn't find a build phase "Bundle React Native code and images"`);
172
144
  }
173
-
174
145
  return bundleReactNative;
175
146
  }
176
-
177
147
  function ensureBundleReactNativePhaseContainsConfigurationScript(projectRoot, project) {
178
148
  const bundleReactNative = getBundleReactNativePhase(project);
179
149
  const buildPhaseShellScriptPath = formatConfigurationScriptPath(projectRoot);
180
-
181
150
  if (!isShellScriptBuildPhaseConfigured(projectRoot, project)) {
182
151
  // check if there's already another path to create-manifest-ios.sh
183
152
  // this might be the case for monorepos
184
153
  if (bundleReactNative.shellScript.includes(CREATE_MANIFEST_IOS_PATH)) {
185
154
  bundleReactNative.shellScript = bundleReactNative.shellScript.replace(new RegExp(`(\\\\n)(\\.\\.)+/node_modules/${CREATE_MANIFEST_IOS_PATH}`), '');
186
155
  }
187
-
188
156
  bundleReactNative.shellScript = `${bundleReactNative.shellScript.replace(/"$/, '')}${buildPhaseShellScriptPath}\\n"`;
189
157
  }
190
-
191
158
  return project;
192
159
  }
193
-
194
160
  function isShellScriptBuildPhaseConfigured(projectRoot, project) {
195
161
  const bundleReactNative = getBundleReactNativePhase(project);
196
162
  const buildPhaseShellScriptPath = formatConfigurationScriptPath(projectRoot);
197
163
  return bundleReactNative.shellScript.includes(buildPhaseShellScriptPath);
198
164
  }
199
-
200
165
  function isPlistConfigurationSet(expoPlist) {
201
166
  return Boolean(expoPlist.EXUpdatesURL && (expoPlist.EXUpdatesSDKVersion || expoPlist.EXUpdatesRuntimeVersion));
202
167
  }
203
-
204
168
  function isPlistConfigurationSynced(projectRoot, config, expoPlist, username) {
205
169
  return (0, _Updates().getUpdateUrl)(config, username) === expoPlist.EXUpdatesURL && (0, _Updates().getUpdatesEnabled)(config) === expoPlist.EXUpdatesEnabled && (0, _Updates().getUpdatesTimeout)(config) === expoPlist.EXUpdatesLaunchWaitMs && (0, _Updates().getUpdatesCheckOnLaunch)(config) === expoPlist.EXUpdatesCheckOnLaunch && (0, _Updates().getUpdatesCodeSigningCertificate)(projectRoot, config) === expoPlist.EXUpdatesCodeSigningCertificate && (0, _Updates().getUpdatesCodeSigningMetadata)(config) === expoPlist.EXUpdatesCodeSigningMetadata && isPlistVersionConfigurationSynced(config, expoPlist);
206
170
  }
207
-
208
171
  function isPlistVersionConfigurationSynced(config, expoPlist) {
209
172
  var _expoPlist$EXUpdatesR, _expoPlist$EXUpdatesS;
210
-
211
173
  const expectedRuntimeVersion = (0, _Updates().getRuntimeVersionNullable)(config, 'ios');
212
174
  const expectedSdkVersion = (0, _Updates().getSDKVersion)(config);
213
175
  const currentRuntimeVersion = (_expoPlist$EXUpdatesR = expoPlist.EXUpdatesRuntimeVersion) !== null && _expoPlist$EXUpdatesR !== void 0 ? _expoPlist$EXUpdatesR : null;
214
176
  const currentSdkVersion = (_expoPlist$EXUpdatesS = expoPlist.EXUpdatesSDKVersion) !== null && _expoPlist$EXUpdatesS !== void 0 ? _expoPlist$EXUpdatesS : null;
215
-
216
177
  if (expectedRuntimeVersion !== null) {
217
178
  return currentRuntimeVersion === expectedRuntimeVersion && currentSdkVersion === null;
218
179
  } else if (expectedSdkVersion !== null) {
@@ -1 +1 @@
1
- {"version":3,"file":"Updates.js","names":["CREATE_MANIFEST_IOS_PATH","Config","withUpdates","config","expoUsername","withExpoPlist","projectRoot","modRequest","expoUpdatesPackageVersion","getExpoUpdatesPackageVersion","modResults","setUpdatesConfig","expoPlist","username","newExpoPlist","ENABLED","getUpdatesEnabled","CHECK_ON_LAUNCH","getUpdatesCheckOnLaunch","LAUNCH_WAIT_MS","getUpdatesTimeout","updateUrl","getUpdateUrl","UPDATE_URL","codeSigningCertificate","getUpdatesCodeSigningCertificate","CODE_SIGNING_CERTIFICATE","codeSigningMetadata","getUpdatesCodeSigningMetadata","CODE_SIGNING_METADATA","setVersionsConfig","runtimeVersion","getRuntimeVersionNullable","RUNTIME_VERSION","Error","sdkVersion","getSDKVersion","SDK_VERSION","formatConfigurationScriptPath","buildScriptPath","resolveFrom","silent","relativePath","path","relative","join","process","platform","replace","getBundleReactNativePhase","project","shellScriptBuildPhase","hash","objects","PBXShellScriptBuildPhase","bundleReactNative","Object","values","find","buildPhase","name","ensureBundleReactNativePhaseContainsConfigurationScript","buildPhaseShellScriptPath","isShellScriptBuildPhaseConfigured","shellScript","includes","RegExp","isPlistConfigurationSet","Boolean","EXUpdatesURL","EXUpdatesSDKVersion","EXUpdatesRuntimeVersion","isPlistConfigurationSynced","EXUpdatesEnabled","EXUpdatesLaunchWaitMs","EXUpdatesCheckOnLaunch","EXUpdatesCodeSigningCertificate","EXUpdatesCodeSigningMetadata","isPlistVersionConfigurationSynced","expectedRuntimeVersion","expectedSdkVersion","currentRuntimeVersion","currentSdkVersion"],"sources":["../../src/ios/Updates.ts"],"sourcesContent":["import * as path from 'path';\nimport resolveFrom from 'resolve-from';\nimport xcode from 'xcode';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withExpoPlist } from '../plugins/ios-plugins';\nimport {\n ExpoConfigUpdates,\n getExpoUpdatesPackageVersion,\n getRuntimeVersionNullable,\n getSDKVersion,\n getUpdatesCheckOnLaunch,\n getUpdatesCodeSigningCertificate,\n getUpdatesCodeSigningMetadata,\n getUpdatesEnabled,\n getUpdatesTimeout,\n getUpdateUrl,\n} from '../utils/Updates';\nimport { ExpoPlist } from './IosConfig.types';\n\nconst CREATE_MANIFEST_IOS_PATH = 'expo-updates/scripts/create-manifest-ios.sh';\n\nexport enum Config {\n ENABLED = 'EXUpdatesEnabled',\n CHECK_ON_LAUNCH = 'EXUpdatesCheckOnLaunch',\n LAUNCH_WAIT_MS = 'EXUpdatesLaunchWaitMs',\n RUNTIME_VERSION = 'EXUpdatesRuntimeVersion',\n SDK_VERSION = 'EXUpdatesSDKVersion',\n UPDATE_URL = 'EXUpdatesURL',\n RELEASE_CHANNEL = 'EXUpdatesReleaseChannel',\n UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY = 'EXUpdatesRequestHeaders',\n CODE_SIGNING_CERTIFICATE = 'EXUpdatesCodeSigningCertificate',\n CODE_SIGNING_METADATA = 'EXUpdatesCodeSigningMetadata',\n}\n\nexport const withUpdates: ConfigPlugin<{ expoUsername: string | null }> = (\n config,\n { expoUsername }\n) => {\n return withExpoPlist(config, (config) => {\n const projectRoot = config.modRequest.projectRoot;\n const expoUpdatesPackageVersion = getExpoUpdatesPackageVersion(projectRoot);\n config.modResults = setUpdatesConfig(\n projectRoot,\n config,\n config.modResults,\n expoUsername,\n expoUpdatesPackageVersion\n );\n return config;\n });\n};\n\nexport function setUpdatesConfig(\n projectRoot: string,\n config: ExpoConfigUpdates,\n expoPlist: ExpoPlist,\n username: string | null,\n expoUpdatesPackageVersion?: string | null\n): ExpoPlist {\n const newExpoPlist = {\n ...expoPlist,\n [Config.ENABLED]: getUpdatesEnabled(config),\n [Config.CHECK_ON_LAUNCH]: getUpdatesCheckOnLaunch(config, expoUpdatesPackageVersion),\n [Config.LAUNCH_WAIT_MS]: getUpdatesTimeout(config),\n };\n\n const updateUrl = getUpdateUrl(config, username);\n if (updateUrl) {\n newExpoPlist[Config.UPDATE_URL] = updateUrl;\n } else {\n delete newExpoPlist[Config.UPDATE_URL];\n }\n\n const codeSigningCertificate = getUpdatesCodeSigningCertificate(projectRoot, config);\n if (codeSigningCertificate) {\n newExpoPlist[Config.CODE_SIGNING_CERTIFICATE] = codeSigningCertificate;\n } else {\n delete newExpoPlist[Config.CODE_SIGNING_CERTIFICATE];\n }\n\n const codeSigningMetadata = getUpdatesCodeSigningMetadata(config);\n if (codeSigningMetadata) {\n newExpoPlist[Config.CODE_SIGNING_METADATA] = codeSigningMetadata;\n } else {\n delete newExpoPlist[Config.CODE_SIGNING_METADATA];\n }\n\n return setVersionsConfig(config, newExpoPlist);\n}\n\nexport function setVersionsConfig(config: ExpoConfigUpdates, expoPlist: ExpoPlist): ExpoPlist {\n const newExpoPlist = { ...expoPlist };\n\n const runtimeVersion = getRuntimeVersionNullable(config, 'ios');\n if (!runtimeVersion && expoPlist[Config.RUNTIME_VERSION]) {\n throw new Error(\n 'A runtime version is set in your Expo.plist, but is missing from your app.json/app.config.js. Please either set runtimeVersion in your app.json/app.config.js or remove EXUpdatesRuntimeVersion from your Expo.plist.'\n );\n }\n const sdkVersion = getSDKVersion(config);\n if (runtimeVersion) {\n delete newExpoPlist[Config.SDK_VERSION];\n newExpoPlist[Config.RUNTIME_VERSION] = runtimeVersion;\n } else if (sdkVersion) {\n /**\n * runtime version maybe null in projects using classic updates. In that\n * case we use SDK version\n */\n delete newExpoPlist[Config.RUNTIME_VERSION];\n newExpoPlist[Config.SDK_VERSION] = sdkVersion;\n } else {\n delete newExpoPlist[Config.SDK_VERSION];\n delete newExpoPlist[Config.RUNTIME_VERSION];\n }\n\n return newExpoPlist;\n}\n\nfunction formatConfigurationScriptPath(projectRoot: string): string {\n const buildScriptPath = resolveFrom.silent(projectRoot, CREATE_MANIFEST_IOS_PATH);\n\n if (!buildScriptPath) {\n throw new Error(\n \"Could not find the build script for iOS. This could happen in case of outdated 'node_modules'. Run 'npm install' to make sure that it's up-to-date.\"\n );\n }\n\n const relativePath = path.relative(path.join(projectRoot, 'ios'), buildScriptPath);\n return process.platform === 'win32' ? relativePath.replace(/\\\\/g, '/') : relativePath;\n}\n\ninterface ShellScriptBuildPhase {\n isa: 'PBXShellScriptBuildPhase';\n name: string;\n shellScript: string;\n [key: string]: any;\n}\n\nexport function getBundleReactNativePhase(project: xcode.XcodeProject): ShellScriptBuildPhase {\n const shellScriptBuildPhase = project.hash.project.objects.PBXShellScriptBuildPhase as Record<\n string,\n ShellScriptBuildPhase\n >;\n const bundleReactNative = Object.values(shellScriptBuildPhase).find(\n (buildPhase) => buildPhase.name === '\"Bundle React Native code and images\"'\n );\n\n if (!bundleReactNative) {\n throw new Error(`Couldn't find a build phase \"Bundle React Native code and images\"`);\n }\n\n return bundleReactNative;\n}\n\nexport function ensureBundleReactNativePhaseContainsConfigurationScript(\n projectRoot: string,\n project: xcode.XcodeProject\n): xcode.XcodeProject {\n const bundleReactNative = getBundleReactNativePhase(project);\n const buildPhaseShellScriptPath = formatConfigurationScriptPath(projectRoot);\n\n if (!isShellScriptBuildPhaseConfigured(projectRoot, project)) {\n // check if there's already another path to create-manifest-ios.sh\n // this might be the case for monorepos\n if (bundleReactNative.shellScript.includes(CREATE_MANIFEST_IOS_PATH)) {\n bundleReactNative.shellScript = bundleReactNative.shellScript.replace(\n new RegExp(`(\\\\\\\\n)(\\\\.\\\\.)+/node_modules/${CREATE_MANIFEST_IOS_PATH}`),\n ''\n );\n }\n bundleReactNative.shellScript = `${bundleReactNative.shellScript.replace(\n /\"$/,\n ''\n )}${buildPhaseShellScriptPath}\\\\n\"`;\n }\n return project;\n}\n\nexport function isShellScriptBuildPhaseConfigured(\n projectRoot: string,\n project: xcode.XcodeProject\n): boolean {\n const bundleReactNative = getBundleReactNativePhase(project);\n const buildPhaseShellScriptPath = formatConfigurationScriptPath(projectRoot);\n return bundleReactNative.shellScript.includes(buildPhaseShellScriptPath);\n}\n\nexport function isPlistConfigurationSet(expoPlist: ExpoPlist): boolean {\n return Boolean(\n expoPlist.EXUpdatesURL && (expoPlist.EXUpdatesSDKVersion || expoPlist.EXUpdatesRuntimeVersion)\n );\n}\n\nexport function isPlistConfigurationSynced(\n projectRoot: string,\n config: ExpoConfigUpdates,\n expoPlist: ExpoPlist,\n username: string | null\n): boolean {\n return (\n getUpdateUrl(config, username) === expoPlist.EXUpdatesURL &&\n getUpdatesEnabled(config) === expoPlist.EXUpdatesEnabled &&\n getUpdatesTimeout(config) === expoPlist.EXUpdatesLaunchWaitMs &&\n getUpdatesCheckOnLaunch(config) === expoPlist.EXUpdatesCheckOnLaunch &&\n getUpdatesCodeSigningCertificate(projectRoot, config) ===\n expoPlist.EXUpdatesCodeSigningCertificate &&\n getUpdatesCodeSigningMetadata(config) === expoPlist.EXUpdatesCodeSigningMetadata &&\n isPlistVersionConfigurationSynced(config, expoPlist)\n );\n}\n\nexport function isPlistVersionConfigurationSynced(\n config: Pick<ExpoConfigUpdates, 'sdkVersion' | 'runtimeVersion'>,\n expoPlist: ExpoPlist\n): boolean {\n const expectedRuntimeVersion = getRuntimeVersionNullable(config, 'ios');\n const expectedSdkVersion = getSDKVersion(config);\n\n const currentRuntimeVersion = expoPlist.EXUpdatesRuntimeVersion ?? null;\n const currentSdkVersion = expoPlist.EXUpdatesSDKVersion ?? null;\n\n if (expectedRuntimeVersion !== null) {\n return currentRuntimeVersion === expectedRuntimeVersion && currentSdkVersion === null;\n } else if (expectedSdkVersion !== null) {\n return currentSdkVersion === expectedSdkVersion && currentRuntimeVersion === null;\n } else {\n return true;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAIA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;;;;;;;AAcA,MAAMA,wBAAwB,GAAG,6CAAjC;IAEYC,M;;;WAAAA,M;EAAAA,M;EAAAA,M;EAAAA,M;EAAAA,M;EAAAA,M;EAAAA,M;EAAAA,M;EAAAA,M;EAAAA,M;EAAAA,M;GAAAA,M,sBAAAA,M;;AAaL,MAAMC,WAA0D,GAAG,CACxEC,MADwE,EAExE;EAAEC;AAAF,CAFwE,KAGrE;EACH,OAAO,IAAAC,2BAAA,EAAcF,MAAd,EAAuBA,MAAD,IAAY;IACvC,MAAMG,WAAW,GAAGH,MAAM,CAACI,UAAP,CAAkBD,WAAtC;IACA,MAAME,yBAAyB,GAAG,IAAAC,uCAAA,EAA6BH,WAA7B,CAAlC;IACAH,MAAM,CAACO,UAAP,GAAoBC,gBAAgB,CAClCL,WADkC,EAElCH,MAFkC,EAGlCA,MAAM,CAACO,UAH2B,EAIlCN,YAJkC,EAKlCI,yBALkC,CAApC;IAOA,OAAOL,MAAP;EACD,CAXM,CAAP;AAYD,CAhBM;;;;AAkBA,SAASQ,gBAAT,CACLL,WADK,EAELH,MAFK,EAGLS,SAHK,EAILC,QAJK,EAKLL,yBALK,EAMM;EACX,MAAMM,YAAY,GAAG,EACnB,GAAGF,SADgB;IAEnB,CAACX,MAAM,CAACc,OAAR,GAAkB,IAAAC,4BAAA,EAAkBb,MAAlB,CAFC;IAG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3,"file":"Updates.js","names":["CREATE_MANIFEST_IOS_PATH","Config","withUpdates","config","expoUsername","withExpoPlist","projectRoot","modRequest","expoUpdatesPackageVersion","getExpoUpdatesPackageVersion","modResults","setUpdatesConfig","expoPlist","username","newExpoPlist","ENABLED","getUpdatesEnabled","CHECK_ON_LAUNCH","getUpdatesCheckOnLaunch","LAUNCH_WAIT_MS","getUpdatesTimeout","updateUrl","getUpdateUrl","UPDATE_URL","codeSigningCertificate","getUpdatesCodeSigningCertificate","CODE_SIGNING_CERTIFICATE","codeSigningMetadata","getUpdatesCodeSigningMetadata","CODE_SIGNING_METADATA","requestHeaders","getUpdatesRequestHeaders","UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY","setVersionsConfig","runtimeVersion","getRuntimeVersionNullable","RUNTIME_VERSION","Error","sdkVersion","getSDKVersion","SDK_VERSION","formatConfigurationScriptPath","buildScriptPath","resolveFrom","silent","relativePath","path","relative","join","process","platform","replace","getBundleReactNativePhase","project","shellScriptBuildPhase","hash","objects","PBXShellScriptBuildPhase","bundleReactNative","Object","values","find","buildPhase","name","ensureBundleReactNativePhaseContainsConfigurationScript","buildPhaseShellScriptPath","isShellScriptBuildPhaseConfigured","shellScript","includes","RegExp","isPlistConfigurationSet","Boolean","EXUpdatesURL","EXUpdatesSDKVersion","EXUpdatesRuntimeVersion","isPlistConfigurationSynced","EXUpdatesEnabled","EXUpdatesLaunchWaitMs","EXUpdatesCheckOnLaunch","EXUpdatesCodeSigningCertificate","EXUpdatesCodeSigningMetadata","isPlistVersionConfigurationSynced","expectedRuntimeVersion","expectedSdkVersion","currentRuntimeVersion","currentSdkVersion"],"sources":["../../src/ios/Updates.ts"],"sourcesContent":["import * as path from 'path';\nimport resolveFrom from 'resolve-from';\nimport xcode from 'xcode';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withExpoPlist } from '../plugins/ios-plugins';\nimport {\n ExpoConfigUpdates,\n getExpoUpdatesPackageVersion,\n getRuntimeVersionNullable,\n getSDKVersion,\n getUpdatesCheckOnLaunch,\n getUpdatesCodeSigningCertificate,\n getUpdatesCodeSigningMetadata,\n getUpdatesRequestHeaders,\n getUpdatesEnabled,\n getUpdatesTimeout,\n getUpdateUrl,\n} from '../utils/Updates';\nimport { ExpoPlist } from './IosConfig.types';\n\nconst CREATE_MANIFEST_IOS_PATH = 'expo-updates/scripts/create-manifest-ios.sh';\n\nexport enum Config {\n ENABLED = 'EXUpdatesEnabled',\n CHECK_ON_LAUNCH = 'EXUpdatesCheckOnLaunch',\n LAUNCH_WAIT_MS = 'EXUpdatesLaunchWaitMs',\n RUNTIME_VERSION = 'EXUpdatesRuntimeVersion',\n SDK_VERSION = 'EXUpdatesSDKVersion',\n UPDATE_URL = 'EXUpdatesURL',\n RELEASE_CHANNEL = 'EXUpdatesReleaseChannel',\n UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY = 'EXUpdatesRequestHeaders',\n CODE_SIGNING_CERTIFICATE = 'EXUpdatesCodeSigningCertificate',\n CODE_SIGNING_METADATA = 'EXUpdatesCodeSigningMetadata',\n}\n\nexport const withUpdates: ConfigPlugin<{ expoUsername: string | null }> = (\n config,\n { expoUsername }\n) => {\n return withExpoPlist(config, (config) => {\n const projectRoot = config.modRequest.projectRoot;\n const expoUpdatesPackageVersion = getExpoUpdatesPackageVersion(projectRoot);\n config.modResults = setUpdatesConfig(\n projectRoot,\n config,\n config.modResults,\n expoUsername,\n expoUpdatesPackageVersion\n );\n return config;\n });\n};\n\nexport function setUpdatesConfig(\n projectRoot: string,\n config: ExpoConfigUpdates,\n expoPlist: ExpoPlist,\n username: string | null,\n expoUpdatesPackageVersion?: string | null\n): ExpoPlist {\n const newExpoPlist = {\n ...expoPlist,\n [Config.ENABLED]: getUpdatesEnabled(config),\n [Config.CHECK_ON_LAUNCH]: getUpdatesCheckOnLaunch(config, expoUpdatesPackageVersion),\n [Config.LAUNCH_WAIT_MS]: getUpdatesTimeout(config),\n };\n\n const updateUrl = getUpdateUrl(config, username);\n if (updateUrl) {\n newExpoPlist[Config.UPDATE_URL] = updateUrl;\n } else {\n delete newExpoPlist[Config.UPDATE_URL];\n }\n\n const codeSigningCertificate = getUpdatesCodeSigningCertificate(projectRoot, config);\n if (codeSigningCertificate) {\n newExpoPlist[Config.CODE_SIGNING_CERTIFICATE] = codeSigningCertificate;\n } else {\n delete newExpoPlist[Config.CODE_SIGNING_CERTIFICATE];\n }\n\n const codeSigningMetadata = getUpdatesCodeSigningMetadata(config);\n if (codeSigningMetadata) {\n newExpoPlist[Config.CODE_SIGNING_METADATA] = codeSigningMetadata;\n } else {\n delete newExpoPlist[Config.CODE_SIGNING_METADATA];\n }\n\n const requestHeaders = getUpdatesRequestHeaders(config);\n if (requestHeaders) {\n newExpoPlist[Config.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY] = requestHeaders;\n } else {\n delete newExpoPlist[Config.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY];\n }\n\n return setVersionsConfig(config, newExpoPlist);\n}\n\nexport function setVersionsConfig(config: ExpoConfigUpdates, expoPlist: ExpoPlist): ExpoPlist {\n const newExpoPlist = { ...expoPlist };\n\n const runtimeVersion = getRuntimeVersionNullable(config, 'ios');\n if (!runtimeVersion && expoPlist[Config.RUNTIME_VERSION]) {\n throw new Error(\n 'A runtime version is set in your Expo.plist, but is missing from your app.json/app.config.js. Please either set runtimeVersion in your app.json/app.config.js or remove EXUpdatesRuntimeVersion from your Expo.plist.'\n );\n }\n const sdkVersion = getSDKVersion(config);\n if (runtimeVersion) {\n delete newExpoPlist[Config.SDK_VERSION];\n newExpoPlist[Config.RUNTIME_VERSION] = runtimeVersion;\n } else if (sdkVersion) {\n /**\n * runtime version maybe null in projects using classic updates. In that\n * case we use SDK version\n */\n delete newExpoPlist[Config.RUNTIME_VERSION];\n newExpoPlist[Config.SDK_VERSION] = sdkVersion;\n } else {\n delete newExpoPlist[Config.SDK_VERSION];\n delete newExpoPlist[Config.RUNTIME_VERSION];\n }\n\n return newExpoPlist;\n}\n\nfunction formatConfigurationScriptPath(projectRoot: string): string {\n const buildScriptPath = resolveFrom.silent(projectRoot, CREATE_MANIFEST_IOS_PATH);\n\n if (!buildScriptPath) {\n throw new Error(\n \"Could not find the build script for iOS. This could happen in case of outdated 'node_modules'. Run 'npm install' to make sure that it's up-to-date.\"\n );\n }\n\n const relativePath = path.relative(path.join(projectRoot, 'ios'), buildScriptPath);\n return process.platform === 'win32' ? relativePath.replace(/\\\\/g, '/') : relativePath;\n}\n\ninterface ShellScriptBuildPhase {\n isa: 'PBXShellScriptBuildPhase';\n name: string;\n shellScript: string;\n [key: string]: any;\n}\n\nexport function getBundleReactNativePhase(project: xcode.XcodeProject): ShellScriptBuildPhase {\n const shellScriptBuildPhase = project.hash.project.objects.PBXShellScriptBuildPhase as Record<\n string,\n ShellScriptBuildPhase\n >;\n const bundleReactNative = Object.values(shellScriptBuildPhase).find(\n (buildPhase) => buildPhase.name === '\"Bundle React Native code and images\"'\n );\n\n if (!bundleReactNative) {\n throw new Error(`Couldn't find a build phase \"Bundle React Native code and images\"`);\n }\n\n return bundleReactNative;\n}\n\nexport function ensureBundleReactNativePhaseContainsConfigurationScript(\n projectRoot: string,\n project: xcode.XcodeProject\n): xcode.XcodeProject {\n const bundleReactNative = getBundleReactNativePhase(project);\n const buildPhaseShellScriptPath = formatConfigurationScriptPath(projectRoot);\n\n if (!isShellScriptBuildPhaseConfigured(projectRoot, project)) {\n // check if there's already another path to create-manifest-ios.sh\n // this might be the case for monorepos\n if (bundleReactNative.shellScript.includes(CREATE_MANIFEST_IOS_PATH)) {\n bundleReactNative.shellScript = bundleReactNative.shellScript.replace(\n new RegExp(`(\\\\\\\\n)(\\\\.\\\\.)+/node_modules/${CREATE_MANIFEST_IOS_PATH}`),\n ''\n );\n }\n bundleReactNative.shellScript = `${bundleReactNative.shellScript.replace(\n /\"$/,\n ''\n )}${buildPhaseShellScriptPath}\\\\n\"`;\n }\n return project;\n}\n\nexport function isShellScriptBuildPhaseConfigured(\n projectRoot: string,\n project: xcode.XcodeProject\n): boolean {\n const bundleReactNative = getBundleReactNativePhase(project);\n const buildPhaseShellScriptPath = formatConfigurationScriptPath(projectRoot);\n return bundleReactNative.shellScript.includes(buildPhaseShellScriptPath);\n}\n\nexport function isPlistConfigurationSet(expoPlist: ExpoPlist): boolean {\n return Boolean(\n expoPlist.EXUpdatesURL && (expoPlist.EXUpdatesSDKVersion || expoPlist.EXUpdatesRuntimeVersion)\n );\n}\n\nexport function isPlistConfigurationSynced(\n projectRoot: string,\n config: ExpoConfigUpdates,\n expoPlist: ExpoPlist,\n username: string | null\n): boolean {\n return (\n getUpdateUrl(config, username) === expoPlist.EXUpdatesURL &&\n getUpdatesEnabled(config) === expoPlist.EXUpdatesEnabled &&\n getUpdatesTimeout(config) === expoPlist.EXUpdatesLaunchWaitMs &&\n getUpdatesCheckOnLaunch(config) === expoPlist.EXUpdatesCheckOnLaunch &&\n getUpdatesCodeSigningCertificate(projectRoot, config) ===\n expoPlist.EXUpdatesCodeSigningCertificate &&\n getUpdatesCodeSigningMetadata(config) === expoPlist.EXUpdatesCodeSigningMetadata &&\n isPlistVersionConfigurationSynced(config, expoPlist)\n );\n}\n\nexport function isPlistVersionConfigurationSynced(\n config: Pick<ExpoConfigUpdates, 'sdkVersion' | 'runtimeVersion'>,\n expoPlist: ExpoPlist\n): boolean {\n const expectedRuntimeVersion = getRuntimeVersionNullable(config, 'ios');\n const expectedSdkVersion = getSDKVersion(config);\n\n const currentRuntimeVersion = expoPlist.EXUpdatesRuntimeVersion ?? null;\n const currentSdkVersion = expoPlist.EXUpdatesSDKVersion ?? null;\n\n if (expectedRuntimeVersion !== null) {\n return currentRuntimeVersion === expectedRuntimeVersion && currentSdkVersion === null;\n } else if (expectedSdkVersion !== null) {\n return currentSdkVersion === expectedSdkVersion && currentRuntimeVersion === null;\n } else {\n return true;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAA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;
7
7
  exports.setUsesNonExemptEncryption = setUsesNonExemptEncryption;
8
8
  exports.withUsesNonExemptEncryption = void 0;
9
-
10
9
  function _iosPlugins() {
11
10
  const data = require("../plugins/ios-plugins");
12
-
13
11
  _iosPlugins = function () {
14
12
  return data;
15
13
  };
16
-
17
14
  return data;
18
15
  }
19
-
20
16
  const withUsesNonExemptEncryption = (0, _iosPlugins().createInfoPlistPluginWithPropertyGuard)(setUsesNonExemptEncryption, {
21
17
  infoPlistProperty: 'ITSAppUsesNonExemptEncryption',
22
18
  expoConfigProperty: 'ios.config.usesNonExemptEncryption'
23
19
  }, 'withUsesNonExemptEncryption');
24
20
  exports.withUsesNonExemptEncryption = withUsesNonExemptEncryption;
25
-
26
21
  function getUsesNonExemptEncryption(config) {
27
22
  var _config$ios$config$us, _config$ios, _config$ios$config;
28
-
29
23
  return (_config$ios$config$us = config === null || config === void 0 ? void 0 : (_config$ios = config.ios) === null || _config$ios === void 0 ? void 0 : (_config$ios$config = _config$ios.config) === null || _config$ios$config === void 0 ? void 0 : _config$ios$config.usesNonExemptEncryption) !== null && _config$ios$config$us !== void 0 ? _config$ios$config$us : null;
30
24
  }
31
-
32
25
  function setUsesNonExemptEncryption(config, {
33
26
  ITSAppUsesNonExemptEncryption,
34
27
  ...infoPlist
35
28
  }) {
36
- const usesNonExemptEncryption = getUsesNonExemptEncryption(config); // Make no changes if the key is left blank
29
+ const usesNonExemptEncryption = getUsesNonExemptEncryption(config);
37
30
 
31
+ // Make no changes if the key is left blank
38
32
  if (usesNonExemptEncryption === null) {
39
33
  return infoPlist;
40
34
  }
41
-
42
- return { ...infoPlist,
35
+ return {
36
+ ...infoPlist,
43
37
  ITSAppUsesNonExemptEncryption: usesNonExemptEncryption
44
38
  };
45
39
  }
@@ -1 +1 @@
1
- {"version":3,"file":"UsesNonExemptEncryption.js","names":["withUsesNonExemptEncryption","createInfoPlistPluginWithPropertyGuard","setUsesNonExemptEncryption","infoPlistProperty","expoConfigProperty","getUsesNonExemptEncryption","config","ios","usesNonExemptEncryption","ITSAppUsesNonExemptEncryption","infoPlist"],"sources":["../../src/ios/UsesNonExemptEncryption.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { createInfoPlistPluginWithPropertyGuard } from '../plugins/ios-plugins';\nimport { InfoPlist } from './IosConfig.types';\n\nexport const withUsesNonExemptEncryption = createInfoPlistPluginWithPropertyGuard(\n setUsesNonExemptEncryption,\n {\n infoPlistProperty: 'ITSAppUsesNonExemptEncryption',\n expoConfigProperty: 'ios.config.usesNonExemptEncryption',\n },\n 'withUsesNonExemptEncryption'\n);\n\nexport function getUsesNonExemptEncryption(config: Pick<ExpoConfig, 'ios'>) {\n return config?.ios?.config?.usesNonExemptEncryption ?? null;\n}\n\nexport function setUsesNonExemptEncryption(\n config: Pick<ExpoConfig, 'ios'>,\n { ITSAppUsesNonExemptEncryption, ...infoPlist }: InfoPlist\n): InfoPlist {\n const usesNonExemptEncryption = getUsesNonExemptEncryption(config);\n\n // Make no changes if the key is left blank\n if (usesNonExemptEncryption === null) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n ITSAppUsesNonExemptEncryption: usesNonExemptEncryption,\n };\n}\n"],"mappings":";;;;;;;;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGO,MAAMA,2BAA2B,GAAG,IAAAC,oDAAA,EACzCC,0BADyC,EAEzC;EACEC,iBAAiB,EAAE,+BADrB;EAEEC,kBAAkB,EAAE;AAFtB,CAFyC,EAMzC,6BANyC,CAApC;;;AASA,SAASC,0BAAT,CAAoCC,MAApC,EAAqE;EAAA;;EAC1E,gCAAOA,MAAP,aAAOA,MAAP,sCAAOA,MAAM,CAAEC,GAAf,sEAAO,YAAaD,MAApB,uDAAO,mBAAqBE,uBAA5B,yEAAuD,IAAvD;AACD;;AAEM,SAASN,0BAAT,CACLI,MADK,EAEL;EAAEG,6BAAF;EAAiC,GAAGC;AAApC,CAFK,EAGM;EACX,MAAMF,uBAAuB,GAAGH,0BAA0B,CAACC,MAAD,CAA1D,CADW,CAGX;;EACA,IAAIE,uBAAuB,KAAK,IAAhC,EAAsC;IACpC,OAAOE,SAAP;EACD;;EAED,OAAO,EACL,GAAGA,SADE;IAELD,6BAA6B,EAAED;EAF1B,CAAP;AAID"}
1
+ {"version":3,"file":"UsesNonExemptEncryption.js","names":["withUsesNonExemptEncryption","createInfoPlistPluginWithPropertyGuard","setUsesNonExemptEncryption","infoPlistProperty","expoConfigProperty","getUsesNonExemptEncryption","config","ios","usesNonExemptEncryption","ITSAppUsesNonExemptEncryption","infoPlist"],"sources":["../../src/ios/UsesNonExemptEncryption.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { createInfoPlistPluginWithPropertyGuard } from '../plugins/ios-plugins';\nimport { InfoPlist } from './IosConfig.types';\n\nexport const withUsesNonExemptEncryption = createInfoPlistPluginWithPropertyGuard(\n setUsesNonExemptEncryption,\n {\n infoPlistProperty: 'ITSAppUsesNonExemptEncryption',\n expoConfigProperty: 'ios.config.usesNonExemptEncryption',\n },\n 'withUsesNonExemptEncryption'\n);\n\nexport function getUsesNonExemptEncryption(config: Pick<ExpoConfig, 'ios'>) {\n return config?.ios?.config?.usesNonExemptEncryption ?? null;\n}\n\nexport function setUsesNonExemptEncryption(\n config: Pick<ExpoConfig, 'ios'>,\n { ITSAppUsesNonExemptEncryption, ...infoPlist }: InfoPlist\n): InfoPlist {\n const usesNonExemptEncryption = getUsesNonExemptEncryption(config);\n\n // Make no changes if the key is left blank\n if (usesNonExemptEncryption === null) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n ITSAppUsesNonExemptEncryption: usesNonExemptEncryption,\n };\n}\n"],"mappings":";;;;;;;;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGO,MAAMA,2BAA2B,GAAG,IAAAC,oDAAsC,EAC/EC,0BAA0B,EAC1B;EACEC,iBAAiB,EAAE,+BAA+B;EAClDC,kBAAkB,EAAE;AACtB,CAAC,EACD,6BAA6B,CAC9B;AAAC;AAEK,SAASC,0BAA0B,CAACC,MAA+B,EAAE;EAAA;EAC1E,gCAAOA,MAAM,aAANA,MAAM,sCAANA,MAAM,CAAEC,GAAG,sEAAX,YAAaD,MAAM,uDAAnB,mBAAqBE,uBAAuB,yEAAI,IAAI;AAC7D;AAEO,SAASN,0BAA0B,CACxCI,MAA+B,EAC/B;EAAEG,6BAA6B;EAAE,GAAGC;AAAqB,CAAC,EAC/C;EACX,MAAMF,uBAAuB,GAAGH,0BAA0B,CAACC,MAAM,CAAC;;EAElE;EACA,IAAIE,uBAAuB,KAAK,IAAI,EAAE;IACpC,OAAOE,SAAS;EAClB;EAEA,OAAO;IACL,GAAGA,SAAS;IACZD,6BAA6B,EAAED;EACjC,CAAC;AACH"}
@@ -8,17 +8,13 @@ exports.getVersion = getVersion;
8
8
  exports.setBuildNumber = setBuildNumber;
9
9
  exports.setVersion = setVersion;
10
10
  exports.withVersion = exports.withBuildNumber = void 0;
11
-
12
11
  function _iosPlugins() {
13
12
  const data = require("../plugins/ios-plugins");
14
-
15
13
  _iosPlugins = function () {
16
14
  return data;
17
15
  };
18
-
19
16
  return data;
20
17
  }
21
-
22
18
  const withVersion = (0, _iosPlugins().createInfoPlistPluginWithPropertyGuard)(setVersion, {
23
19
  infoPlistProperty: 'CFBundleShortVersionString',
24
20
  expoConfigProperty: 'version'
@@ -29,25 +25,22 @@ const withBuildNumber = (0, _iosPlugins().createInfoPlistPluginWithPropertyGuard
29
25
  expoConfigProperty: 'ios.buildNumber'
30
26
  }, 'withBuildNumber');
31
27
  exports.withBuildNumber = withBuildNumber;
32
-
33
28
  function getVersion(config) {
34
29
  return config.version || '1.0.0';
35
30
  }
36
-
37
31
  function setVersion(config, infoPlist) {
38
- return { ...infoPlist,
32
+ return {
33
+ ...infoPlist,
39
34
  CFBundleShortVersionString: getVersion(config)
40
35
  };
41
36
  }
42
-
43
37
  function getBuildNumber(config) {
44
38
  var _config$ios;
45
-
46
39
  return (_config$ios = config.ios) !== null && _config$ios !== void 0 && _config$ios.buildNumber ? config.ios.buildNumber : '1';
47
40
  }
48
-
49
41
  function setBuildNumber(config, infoPlist) {
50
- return { ...infoPlist,
42
+ return {
43
+ ...infoPlist,
51
44
  CFBundleVersion: getBuildNumber(config)
52
45
  };
53
46
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Version.js","names":["withVersion","createInfoPlistPluginWithPropertyGuard","setVersion","infoPlistProperty","expoConfigProperty","withBuildNumber","setBuildNumber","getVersion","config","version","infoPlist","CFBundleShortVersionString","getBuildNumber","ios","buildNumber","CFBundleVersion"],"sources":["../../src/ios/Version.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { createInfoPlistPluginWithPropertyGuard } from '../plugins/ios-plugins';\nimport { InfoPlist } from './IosConfig.types';\n\nexport const withVersion = createInfoPlistPluginWithPropertyGuard(\n setVersion,\n {\n infoPlistProperty: 'CFBundleShortVersionString',\n expoConfigProperty: 'version',\n },\n 'withVersion'\n);\n\nexport const withBuildNumber = createInfoPlistPluginWithPropertyGuard(\n setBuildNumber,\n {\n infoPlistProperty: 'CFBundleVersion',\n expoConfigProperty: 'ios.buildNumber',\n },\n 'withBuildNumber'\n);\n\nexport function getVersion(config: Pick<ExpoConfig, 'version'>) {\n return config.version || '1.0.0';\n}\n\nexport function setVersion(config: Pick<ExpoConfig, 'version'>, infoPlist: InfoPlist): InfoPlist {\n return {\n ...infoPlist,\n CFBundleShortVersionString: getVersion(config),\n };\n}\n\nexport function getBuildNumber(config: Pick<ExpoConfig, 'ios'>) {\n return config.ios?.buildNumber ? config.ios.buildNumber : '1';\n}\n\nexport function setBuildNumber(config: Pick<ExpoConfig, 'ios'>, infoPlist: InfoPlist): InfoPlist {\n return {\n ...infoPlist,\n CFBundleVersion: getBuildNumber(config),\n };\n}\n"],"mappings":";;;;;;;;;;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGO,MAAMA,WAAW,GAAG,IAAAC,oDAAA,EACzBC,UADyB,EAEzB;EACEC,iBAAiB,EAAE,4BADrB;EAEEC,kBAAkB,EAAE;AAFtB,CAFyB,EAMzB,aANyB,CAApB;;AASA,MAAMC,eAAe,GAAG,IAAAJ,oDAAA,EAC7BK,cAD6B,EAE7B;EACEH,iBAAiB,EAAE,iBADrB;EAEEC,kBAAkB,EAAE;AAFtB,CAF6B,EAM7B,iBAN6B,CAAxB;;;AASA,SAASG,UAAT,CAAoBC,MAApB,EAAyD;EAC9D,OAAOA,MAAM,CAACC,OAAP,IAAkB,OAAzB;AACD;;AAEM,SAASP,UAAT,CAAoBM,MAApB,EAAyDE,SAAzD,EAA0F;EAC/F,OAAO,EACL,GAAGA,SADE;IAELC,0BAA0B,EAAEJ,UAAU,CAACC,MAAD;EAFjC,CAAP;AAID;;AAEM,SAASI,cAAT,CAAwBJ,MAAxB,EAAyD;EAAA;;EAC9D,OAAO,eAAAA,MAAM,CAACK,GAAP,oDAAYC,WAAZ,GAA0BN,MAAM,CAACK,GAAP,CAAWC,WAArC,GAAmD,GAA1D;AACD;;AAEM,SAASR,cAAT,CAAwBE,MAAxB,EAAyDE,SAAzD,EAA0F;EAC/F,OAAO,EACL,GAAGA,SADE;IAELK,eAAe,EAAEH,cAAc,CAACJ,MAAD;EAF1B,CAAP;AAID"}
1
+ {"version":3,"file":"Version.js","names":["withVersion","createInfoPlistPluginWithPropertyGuard","setVersion","infoPlistProperty","expoConfigProperty","withBuildNumber","setBuildNumber","getVersion","config","version","infoPlist","CFBundleShortVersionString","getBuildNumber","ios","buildNumber","CFBundleVersion"],"sources":["../../src/ios/Version.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { createInfoPlistPluginWithPropertyGuard } from '../plugins/ios-plugins';\nimport { InfoPlist } from './IosConfig.types';\n\nexport const withVersion = createInfoPlistPluginWithPropertyGuard(\n setVersion,\n {\n infoPlistProperty: 'CFBundleShortVersionString',\n expoConfigProperty: 'version',\n },\n 'withVersion'\n);\n\nexport const withBuildNumber = createInfoPlistPluginWithPropertyGuard(\n setBuildNumber,\n {\n infoPlistProperty: 'CFBundleVersion',\n expoConfigProperty: 'ios.buildNumber',\n },\n 'withBuildNumber'\n);\n\nexport function getVersion(config: Pick<ExpoConfig, 'version'>) {\n return config.version || '1.0.0';\n}\n\nexport function setVersion(config: Pick<ExpoConfig, 'version'>, infoPlist: InfoPlist): InfoPlist {\n return {\n ...infoPlist,\n CFBundleShortVersionString: getVersion(config),\n };\n}\n\nexport function getBuildNumber(config: Pick<ExpoConfig, 'ios'>) {\n return config.ios?.buildNumber ? config.ios.buildNumber : '1';\n}\n\nexport function setBuildNumber(config: Pick<ExpoConfig, 'ios'>, infoPlist: InfoPlist): InfoPlist {\n return {\n ...infoPlist,\n CFBundleVersion: getBuildNumber(config),\n };\n}\n"],"mappings":";;;;;;;;;;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGO,MAAMA,WAAW,GAAG,IAAAC,oDAAsC,EAC/DC,UAAU,EACV;EACEC,iBAAiB,EAAE,4BAA4B;EAC/CC,kBAAkB,EAAE;AACtB,CAAC,EACD,aAAa,CACd;AAAC;AAEK,MAAMC,eAAe,GAAG,IAAAJ,oDAAsC,EACnEK,cAAc,EACd;EACEH,iBAAiB,EAAE,iBAAiB;EACpCC,kBAAkB,EAAE;AACtB,CAAC,EACD,iBAAiB,CAClB;AAAC;AAEK,SAASG,UAAU,CAACC,MAAmC,EAAE;EAC9D,OAAOA,MAAM,CAACC,OAAO,IAAI,OAAO;AAClC;AAEO,SAASP,UAAU,CAACM,MAAmC,EAAEE,SAAoB,EAAa;EAC/F,OAAO;IACL,GAAGA,SAAS;IACZC,0BAA0B,EAAEJ,UAAU,CAACC,MAAM;EAC/C,CAAC;AACH;AAEO,SAASI,cAAc,CAACJ,MAA+B,EAAE;EAAA;EAC9D,OAAO,eAAAA,MAAM,CAACK,GAAG,wCAAV,YAAYC,WAAW,GAAGN,MAAM,CAACK,GAAG,CAACC,WAAW,GAAG,GAAG;AAC/D;AAEO,SAASR,cAAc,CAACE,MAA+B,EAAEE,SAAoB,EAAa;EAC/F,OAAO;IACL,GAAGA,SAAS;IACZK,eAAe,EAAEH,cAAc,CAACJ,MAAM;EACxC,CAAC;AACH"}
@@ -5,49 +5,35 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.createBuildSourceFile = createBuildSourceFile;
7
7
  exports.withBuildSourceFile = void 0;
8
-
9
8
  function _fs() {
10
9
  const data = _interopRequireDefault(require("fs"));
11
-
12
10
  _fs = function () {
13
11
  return data;
14
12
  };
15
-
16
13
  return data;
17
14
  }
18
-
19
15
  function _path() {
20
16
  const data = _interopRequireDefault(require("path"));
21
-
22
17
  _path = function () {
23
18
  return data;
24
19
  };
25
-
26
20
  return data;
27
21
  }
28
-
29
22
  function _iosPlugins() {
30
23
  const data = require("../plugins/ios-plugins");
31
-
32
24
  _iosPlugins = function () {
33
25
  return data;
34
26
  };
35
-
36
27
  return data;
37
28
  }
38
-
39
29
  function _Xcodeproj() {
40
30
  const data = require("./utils/Xcodeproj");
41
-
42
31
  _Xcodeproj = function () {
43
32
  return data;
44
33
  };
45
-
46
34
  return data;
47
35
  }
48
-
49
36
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
50
-
51
37
  /**
52
38
  * Create a build source file and link it to Xcode.
53
39
  *
@@ -74,6 +60,7 @@ const withBuildSourceFile = (config, {
74
60
  return config;
75
61
  });
76
62
  };
63
+
77
64
  /**
78
65
  * Add a source file to the Xcode project and write it to the file system.
79
66
  *
@@ -82,10 +69,7 @@ const withBuildSourceFile = (config, {
82
69
  * @param fileContents string file contents to write to the `filePath`
83
70
  * @param overwrite should write file even if one already exists
84
71
  */
85
-
86
-
87
72
  exports.withBuildSourceFile = withBuildSourceFile;
88
-
89
73
  function createBuildSourceFile({
90
74
  project,
91
75
  nativeProjectRoot,
@@ -94,16 +78,15 @@ function createBuildSourceFile({
94
78
  overwrite
95
79
  }) {
96
80
  const absoluteFilePath = _path().default.join(nativeProjectRoot, filePath);
97
-
98
81
  if (overwrite || !_fs().default.existsSync(absoluteFilePath)) {
99
82
  // Create the file
100
83
  _fs().default.writeFileSync(absoluteFilePath, fileContents, 'utf8');
101
- } // `myapp`
102
-
103
-
104
- const groupName = _path().default.dirname(filePath); // Ensure the file is linked with Xcode resource files
84
+ }
105
85
 
86
+ // `myapp`
87
+ const groupName = _path().default.dirname(filePath);
106
88
 
89
+ // Ensure the file is linked with Xcode resource files
107
90
  if (!project.hasFile(filePath)) {
108
91
  project = (0, _Xcodeproj().addBuildSourceFileToGroup)({
109
92
  filepath: filePath,
@@ -111,7 +94,6 @@ function createBuildSourceFile({
111
94
  project
112
95
  });
113
96
  }
114
-
115
97
  return project;
116
98
  }
117
99
  //# sourceMappingURL=XcodeProjectFile.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"XcodeProjectFile.js","names":["withBuildSourceFile","config","filePath","contents","overwrite","withXcodeProject","projectName","getProjectName","modRequest","projectRoot","modResults","createBuildSourceFile","project","nativeProjectRoot","platformProjectRoot","fileContents","path","join","absoluteFilePath","fs","existsSync","writeFileSync","groupName","dirname","hasFile","addBuildSourceFileToGroup","filepath"],"sources":["../../src/ios/XcodeProjectFile.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport { ConfigPlugin, XcodeProject } from '../Plugin.types';\nimport { withXcodeProject } from '../plugins/ios-plugins';\nimport { addBuildSourceFileToGroup, getProjectName } from './utils/Xcodeproj';\n\n/**\n * Create a build source file and link it to Xcode.\n *\n * @param config\n * @param props.filePath relative to the build source folder. ex: `ViewController.swift` would be created in `ios/myapp/ViewController.swift`.\n * @param props.contents file contents to write.\n * @param props.overwrite should the contents overwrite any existing file in the same location on disk.\n * @returns\n */\nexport const withBuildSourceFile: ConfigPlugin<{\n filePath: string;\n contents: string;\n overwrite?: boolean;\n}> = (config, { filePath, contents, overwrite }) => {\n return withXcodeProject(config, (config) => {\n const projectName = getProjectName(config.modRequest.projectRoot);\n\n config.modResults = createBuildSourceFile({\n project: config.modResults,\n nativeProjectRoot: config.modRequest.platformProjectRoot,\n fileContents: contents,\n filePath: path.join(projectName, filePath),\n overwrite,\n });\n return config;\n });\n};\n\n/**\n * Add a source file to the Xcode project and write it to the file system.\n *\n * @param nativeProjectRoot absolute path to the native app root `user/app/ios`\n * @param filePath path relative to the `nativeProjectRoot` for the file to create `user/app/ios/myapp/foobar.swift`\n * @param fileContents string file contents to write to the `filePath`\n * @param overwrite should write file even if one already exists\n */\nexport function createBuildSourceFile({\n project,\n nativeProjectRoot,\n filePath,\n fileContents,\n overwrite,\n}: {\n project: XcodeProject;\n nativeProjectRoot: string;\n filePath: string;\n fileContents: string;\n overwrite?: boolean;\n}): XcodeProject {\n const absoluteFilePath = path.join(nativeProjectRoot, filePath);\n if (overwrite || !fs.existsSync(absoluteFilePath)) {\n // Create the file\n fs.writeFileSync(absoluteFilePath, fileContents, 'utf8');\n }\n\n // `myapp`\n const groupName = path.dirname(filePath);\n\n // Ensure the file is linked with Xcode resource files\n if (!project.hasFile(filePath)) {\n project = addBuildSourceFileToGroup({\n filepath: filePath,\n groupName,\n project,\n });\n }\n return project;\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;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,mBAIX,GAAG,CAACC,MAAD,EAAS;EAAEC,QAAF;EAAYC,QAAZ;EAAsBC;AAAtB,CAAT,KAA+C;EAClD,OAAO,IAAAC,8BAAA,EAAiBJ,MAAjB,EAA0BA,MAAD,IAAY;IAC1C,MAAMK,WAAW,GAAG,IAAAC,2BAAA,EAAeN,MAAM,CAACO,UAAP,CAAkBC,WAAjC,CAApB;IAEAR,MAAM,CAACS,UAAP,GAAoBC,qBAAqB,CAAC;MACxCC,OAAO,EAAEX,MAAM,CAACS,UADwB;MAExCG,iBAAiB,EAAEZ,MAAM,CAACO,UAAP,CAAkBM,mBAFG;MAGxCC,YAAY,EAAEZ,QAH0B;MAIxCD,QAAQ,EAAEc,eAAA,CAAKC,IAAL,CAAUX,WAAV,EAAuBJ,QAAvB,CAJ8B;MAKxCE;IALwC,CAAD,CAAzC;IAOA,OAAOH,MAAP;EACD,CAXM,CAAP;AAYD,CAjBM;AAmBP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,SAASU,qBAAT,CAA+B;EACpCC,OADoC;EAEpCC,iBAFoC;EAGpCX,QAHoC;EAIpCa,YAJoC;EAKpCX;AALoC,CAA/B,EAYU;EACf,MAAMc,gBAAgB,GAAGF,eAAA,CAAKC,IAAL,CAAUJ,iBAAV,EAA6BX,QAA7B,CAAzB;;EACA,IAAIE,SAAS,IAAI,CAACe,aAAA,CAAGC,UAAH,CAAcF,gBAAd,CAAlB,EAAmD;IACjD;IACAC,aAAA,CAAGE,aAAH,CAAiBH,gBAAjB,EAAmCH,YAAnC,EAAiD,MAAjD;EACD,CALc,CAOf;;;EACA,MAAMO,SAAS,GAAGN,eAAA,CAAKO,OAAL,CAAarB,QAAb,CAAlB,CARe,CAUf;;;EACA,IAAI,CAACU,OAAO,CAACY,OAAR,CAAgBtB,QAAhB,CAAL,EAAgC;IAC9BU,OAAO,GAAG,IAAAa,sCAAA,EAA0B;MAClCC,QAAQ,EAAExB,QADwB;MAElCoB,SAFkC;MAGlCV;IAHkC,CAA1B,CAAV;EAKD;;EACD,OAAOA,OAAP;AACD"}
1
+ {"version":3,"file":"XcodeProjectFile.js","names":["withBuildSourceFile","config","filePath","contents","overwrite","withXcodeProject","projectName","getProjectName","modRequest","projectRoot","modResults","createBuildSourceFile","project","nativeProjectRoot","platformProjectRoot","fileContents","path","join","absoluteFilePath","fs","existsSync","writeFileSync","groupName","dirname","hasFile","addBuildSourceFileToGroup","filepath"],"sources":["../../src/ios/XcodeProjectFile.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport { ConfigPlugin, XcodeProject } from '../Plugin.types';\nimport { withXcodeProject } from '../plugins/ios-plugins';\nimport { addBuildSourceFileToGroup, getProjectName } from './utils/Xcodeproj';\n\n/**\n * Create a build source file and link it to Xcode.\n *\n * @param config\n * @param props.filePath relative to the build source folder. ex: `ViewController.swift` would be created in `ios/myapp/ViewController.swift`.\n * @param props.contents file contents to write.\n * @param props.overwrite should the contents overwrite any existing file in the same location on disk.\n * @returns\n */\nexport const withBuildSourceFile: ConfigPlugin<{\n filePath: string;\n contents: string;\n overwrite?: boolean;\n}> = (config, { filePath, contents, overwrite }) => {\n return withXcodeProject(config, (config) => {\n const projectName = getProjectName(config.modRequest.projectRoot);\n\n config.modResults = createBuildSourceFile({\n project: config.modResults,\n nativeProjectRoot: config.modRequest.platformProjectRoot,\n fileContents: contents,\n filePath: path.join(projectName, filePath),\n overwrite,\n });\n return config;\n });\n};\n\n/**\n * Add a source file to the Xcode project and write it to the file system.\n *\n * @param nativeProjectRoot absolute path to the native app root `user/app/ios`\n * @param filePath path relative to the `nativeProjectRoot` for the file to create `user/app/ios/myapp/foobar.swift`\n * @param fileContents string file contents to write to the `filePath`\n * @param overwrite should write file even if one already exists\n */\nexport function createBuildSourceFile({\n project,\n nativeProjectRoot,\n filePath,\n fileContents,\n overwrite,\n}: {\n project: XcodeProject;\n nativeProjectRoot: string;\n filePath: string;\n fileContents: string;\n overwrite?: boolean;\n}): XcodeProject {\n const absoluteFilePath = path.join(nativeProjectRoot, filePath);\n if (overwrite || !fs.existsSync(absoluteFilePath)) {\n // Create the file\n fs.writeFileSync(absoluteFilePath, fileContents, 'utf8');\n }\n\n // `myapp`\n const groupName = path.dirname(filePath);\n\n // Ensure the file is linked with Xcode resource files\n if (!project.hasFile(filePath)) {\n project = addBuildSourceFileToGroup({\n filepath: filePath,\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