@capacitor/cli 4.7.3 → 5.0.0-alpha.2

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 (55) hide show
  1. package/assets/android-template.tar.gz +0 -0
  2. package/assets/capacitor-cordova-android-plugins.tar.gz +0 -0
  3. package/assets/capacitor-cordova-ios-plugins.tar.gz +0 -0
  4. package/assets/ios-template.tar.gz +0 -0
  5. package/dist/android/add.js +6 -6
  6. package/dist/android/build.js +12 -9
  7. package/dist/android/common.js +27 -29
  8. package/dist/android/doctor.js +24 -24
  9. package/dist/android/open.js +3 -3
  10. package/dist/android/run.js +9 -6
  11. package/dist/android/update.js +53 -53
  12. package/dist/common.js +23 -23
  13. package/dist/config.js +67 -61
  14. package/dist/cordova.js +75 -75
  15. package/dist/declarations.d.ts +17 -1
  16. package/dist/index.js +32 -29
  17. package/dist/ios/add.js +2 -2
  18. package/dist/ios/build.js +9 -9
  19. package/dist/ios/common.js +12 -12
  20. package/dist/ios/doctor.js +6 -6
  21. package/dist/ios/open.js +2 -2
  22. package/dist/ios/run.js +7 -7
  23. package/dist/ios/update.js +58 -62
  24. package/dist/ipc.js +6 -6
  25. package/dist/log.js +2 -2
  26. package/dist/plugin.js +11 -11
  27. package/dist/sysconfig.js +6 -6
  28. package/dist/tasks/add.js +27 -27
  29. package/dist/tasks/build.js +7 -6
  30. package/dist/tasks/copy.js +42 -42
  31. package/dist/tasks/create.js +1 -1
  32. package/dist/tasks/doctor.js +10 -10
  33. package/dist/tasks/init.js +30 -27
  34. package/dist/tasks/list.js +12 -12
  35. package/dist/tasks/migrate.js +189 -407
  36. package/dist/tasks/new-plugin.js +1 -1
  37. package/dist/tasks/open.js +10 -10
  38. package/dist/tasks/run.js +13 -13
  39. package/dist/tasks/serve.js +1 -1
  40. package/dist/tasks/sourcemaps.js +9 -9
  41. package/dist/tasks/sync.js +15 -15
  42. package/dist/tasks/telemetry.js +4 -4
  43. package/dist/tasks/update.js +14 -14
  44. package/dist/telemetry.js +8 -8
  45. package/dist/util/cli.js +2 -2
  46. package/dist/util/fs.js +7 -7
  47. package/dist/util/native-run.js +3 -3
  48. package/dist/util/node.js +2 -2
  49. package/dist/util/subprocess.js +1 -1
  50. package/dist/util/template.js +1 -1
  51. package/dist/util/term.js +1 -1
  52. package/dist/util/xml.js +1 -1
  53. package/dist/web/copy.js +4 -4
  54. package/package.json +12 -11
  55. package/CHANGELOG.md +0 -805
package/dist/cordova.js CHANGED
@@ -23,7 +23,7 @@ function generateCordovaPluginsJSFile(config, plugins, platform) {
23
23
  const pluginExports = [];
24
24
  plugins.map(p => {
25
25
  const pluginId = p.xml.$.id;
26
- const jsModules = plugin_1.getJSModules(p, platform);
26
+ const jsModules = (0, plugin_1.getJSModules)(p, platform);
27
27
  jsModules.map((jsModule) => {
28
28
  const clobbers = [];
29
29
  const merges = [];
@@ -98,72 +98,72 @@ exports.generateCordovaPluginsJSFile = generateCordovaPluginsJSFile;
98
98
  */
99
99
  async function copyPluginsJS(config, cordovaPlugins, platform) {
100
100
  const webDir = await getWebDir(config, platform);
101
- const pluginsDir = path_1.join(webDir, 'plugins');
102
- const cordovaPluginsJSFile = path_1.join(webDir, 'cordova_plugins.js');
101
+ const pluginsDir = (0, path_1.join)(webDir, 'plugins');
102
+ const cordovaPluginsJSFile = (0, path_1.join)(webDir, 'cordova_plugins.js');
103
103
  await removePluginFiles(config, platform);
104
104
  await Promise.all(cordovaPlugins.map(async (p) => {
105
105
  const pluginId = p.xml.$.id;
106
- const pluginDir = path_1.join(pluginsDir, pluginId, 'www');
107
- await utils_fs_1.ensureDir(pluginDir);
108
- const jsModules = plugin_1.getJSModules(p, platform);
106
+ const pluginDir = (0, path_1.join)(pluginsDir, pluginId, 'www');
107
+ await (0, utils_fs_1.ensureDir)(pluginDir);
108
+ const jsModules = (0, plugin_1.getJSModules)(p, platform);
109
109
  await Promise.all(jsModules.map(async (jsModule) => {
110
- const filePath = path_1.join(webDir, 'plugins', pluginId, jsModule.$.src);
111
- await utils_fs_1.copy(path_1.join(p.rootPath, jsModule.$.src), filePath);
112
- let data = await utils_fs_1.readFile(filePath, { encoding: 'utf-8' });
110
+ const filePath = (0, path_1.join)(webDir, 'plugins', pluginId, jsModule.$.src);
111
+ await (0, utils_fs_1.copy)((0, path_1.join)(p.rootPath, jsModule.$.src), filePath);
112
+ let data = await (0, utils_fs_1.readFile)(filePath, { encoding: 'utf-8' });
113
113
  data = data.trim();
114
114
  // mimics Cordova's module name logic if the name attr is missing
115
115
  const name = pluginId +
116
116
  '.' +
117
117
  (jsModule.$.name ||
118
- path_1.basename(jsModule.$.src, path_1.extname(jsModule.$.src)));
118
+ (0, path_1.basename)(jsModule.$.src, (0, path_1.extname)(jsModule.$.src)));
119
119
  data = `cordova.define("${name}", function(require, exports, module) { \n${data}\n});`;
120
120
  data = data.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script\s*>/gi, '');
121
- await utils_fs_1.writeFile(filePath, data, { encoding: 'utf-8' });
121
+ await (0, utils_fs_1.writeFile)(filePath, data, { encoding: 'utf-8' });
122
122
  }));
123
- const assets = plugin_1.getAssets(p, platform);
123
+ const assets = (0, plugin_1.getAssets)(p, platform);
124
124
  await Promise.all(assets.map(async (asset) => {
125
- const filePath = path_1.join(webDir, asset.$.target);
126
- await utils_fs_1.copy(path_1.join(p.rootPath, asset.$.src), filePath);
125
+ const filePath = (0, path_1.join)(webDir, asset.$.target);
126
+ await (0, utils_fs_1.copy)((0, path_1.join)(p.rootPath, asset.$.src), filePath);
127
127
  }));
128
128
  }));
129
- await utils_fs_1.writeFile(cordovaPluginsJSFile, generateCordovaPluginsJSFile(config, cordovaPlugins, platform));
129
+ await (0, utils_fs_1.writeFile)(cordovaPluginsJSFile, generateCordovaPluginsJSFile(config, cordovaPlugins, platform));
130
130
  }
131
131
  exports.copyPluginsJS = copyPluginsJS;
132
132
  async function copyCordovaJS(config, platform) {
133
- const cordovaPath = node_1.resolveNode(config.app.rootDir, '@capacitor/core', 'cordova.js');
133
+ const cordovaPath = (0, node_1.resolveNode)(config.app.rootDir, '@capacitor/core', 'cordova.js');
134
134
  if (!cordovaPath) {
135
- errors_1.fatal(`Unable to find ${colors_1.default.strong('node_modules/@capacitor/core/cordova.js')}.\n` + `Are you sure ${colors_1.default.strong('@capacitor/core')} is installed?`);
135
+ (0, errors_1.fatal)(`Unable to find ${colors_1.default.strong('node_modules/@capacitor/core/cordova.js')}.\n` + `Are you sure ${colors_1.default.strong('@capacitor/core')} is installed?`);
136
136
  }
137
- return utils_fs_1.copy(cordovaPath, path_1.join(await getWebDir(config, platform), 'cordova.js'));
137
+ return (0, utils_fs_1.copy)(cordovaPath, (0, path_1.join)(await getWebDir(config, platform), 'cordova.js'));
138
138
  }
139
139
  exports.copyCordovaJS = copyCordovaJS;
140
140
  async function createEmptyCordovaJS(config, platform) {
141
141
  const webDir = await getWebDir(config, platform);
142
- await utils_fs_1.writeFile(path_1.join(webDir, 'cordova.js'), '');
143
- await utils_fs_1.writeFile(path_1.join(webDir, 'cordova_plugins.js'), '');
142
+ await (0, utils_fs_1.writeFile)((0, path_1.join)(webDir, 'cordova.js'), '');
143
+ await (0, utils_fs_1.writeFile)((0, path_1.join)(webDir, 'cordova_plugins.js'), '');
144
144
  }
145
145
  exports.createEmptyCordovaJS = createEmptyCordovaJS;
146
146
  async function removePluginFiles(config, platform) {
147
147
  const webDir = await getWebDir(config, platform);
148
- const pluginsDir = path_1.join(webDir, 'plugins');
149
- const cordovaPluginsJSFile = path_1.join(webDir, 'cordova_plugins.js');
150
- await utils_fs_1.remove(pluginsDir);
151
- await utils_fs_1.remove(cordovaPluginsJSFile);
148
+ const pluginsDir = (0, path_1.join)(webDir, 'plugins');
149
+ const cordovaPluginsJSFile = (0, path_1.join)(webDir, 'cordova_plugins.js');
150
+ await (0, utils_fs_1.remove)(pluginsDir);
151
+ await (0, utils_fs_1.remove)(cordovaPluginsJSFile);
152
152
  }
153
153
  exports.removePluginFiles = removePluginFiles;
154
154
  async function autoGenerateConfig(config, cordovaPlugins, platform) {
155
155
  var _a, _b, _c, _d;
156
- let xmlDir = path_1.join(config.android.resDirAbs, 'xml');
156
+ let xmlDir = (0, path_1.join)(config.android.resDirAbs, 'xml');
157
157
  const fileName = 'config.xml';
158
158
  if (platform === 'ios') {
159
159
  xmlDir = config.ios.nativeTargetDirAbs;
160
160
  }
161
- await utils_fs_1.ensureDir(xmlDir);
162
- const cordovaConfigXMLFile = path_1.join(xmlDir, fileName);
163
- await utils_fs_1.remove(cordovaConfigXMLFile);
161
+ await (0, utils_fs_1.ensureDir)(xmlDir);
162
+ const cordovaConfigXMLFile = (0, path_1.join)(xmlDir, fileName);
163
+ await (0, utils_fs_1.remove)(cordovaConfigXMLFile);
164
164
  const pluginEntries = [];
165
165
  cordovaPlugins.map(p => {
166
- const currentPlatform = plugin_1.getPluginPlatform(p, platform);
166
+ const currentPlatform = (0, plugin_1.getPluginPlatform)(p, platform);
167
167
  if (currentPlatform) {
168
168
  const configFiles = currentPlatform['config-file'];
169
169
  if (configFiles) {
@@ -191,7 +191,7 @@ async function autoGenerateConfig(config, cordovaPlugins, platform) {
191
191
  accessOriginString.push(`<access origin="*" />`);
192
192
  }
193
193
  const pluginEntriesString = await Promise.all(pluginEntries.map(async (item) => {
194
- const xmlString = await xml_1.writeXML(item);
194
+ const xmlString = await (0, xml_1.writeXML)(item);
195
195
  return xmlString;
196
196
  }));
197
197
  let pluginPreferencesString = [];
@@ -207,7 +207,7 @@ async function autoGenerateConfig(config, cordovaPlugins, platform) {
207
207
  ${pluginEntriesString.join('')}
208
208
  ${pluginPreferencesString.join('')}
209
209
  </widget>`;
210
- await utils_fs_1.writeFile(cordovaConfigXMLFile, content);
210
+ await (0, utils_fs_1.writeFile)(cordovaConfigXMLFile, content);
211
211
  }
212
212
  exports.autoGenerateConfig = autoGenerateConfig;
213
213
  async function getWebDir(config, platform) {
@@ -221,9 +221,9 @@ async function getWebDir(config, platform) {
221
221
  }
222
222
  async function handleCordovaPluginsJS(cordovaPlugins, config, platform) {
223
223
  const webDir = await getWebDir(config, platform);
224
- await utils_fs_1.mkdirp(webDir);
224
+ await (0, utils_fs_1.mkdirp)(webDir);
225
225
  if (cordovaPlugins.length > 0) {
226
- plugin_1.printPlugins(cordovaPlugins, platform, 'cordova');
226
+ (0, plugin_1.printPlugins)(cordovaPlugins, platform, 'cordova');
227
227
  await copyCordovaJS(config, platform);
228
228
  await copyPluginsJS(config, cordovaPlugins, platform);
229
229
  }
@@ -235,21 +235,21 @@ async function handleCordovaPluginsJS(cordovaPlugins, config, platform) {
235
235
  }
236
236
  exports.handleCordovaPluginsJS = handleCordovaPluginsJS;
237
237
  async function getCordovaPlugins(config, platform) {
238
- const allPlugins = await plugin_1.getPlugins(config, platform);
238
+ const allPlugins = await (0, plugin_1.getPlugins)(config, platform);
239
239
  let plugins = [];
240
240
  if (platform === config.ios.name) {
241
- plugins = await common_2.getIOSPlugins(allPlugins);
241
+ plugins = await (0, common_2.getIOSPlugins)(allPlugins);
242
242
  }
243
243
  else if (platform === config.android.name) {
244
- plugins = await common_1.getAndroidPlugins(allPlugins);
244
+ plugins = await (0, common_1.getAndroidPlugins)(allPlugins);
245
245
  }
246
- return plugins.filter(p => plugin_1.getPluginType(p, platform) === 1 /* Cordova */);
246
+ return plugins.filter(p => (0, plugin_1.getPluginType)(p, platform) === 1 /* PluginType.Cordova */);
247
247
  }
248
248
  exports.getCordovaPlugins = getCordovaPlugins;
249
249
  async function logCordovaManualSteps(cordovaPlugins, config, platform) {
250
250
  cordovaPlugins.map(p => {
251
- const editConfig = plugin_1.getPlatformElement(p, platform, 'edit-config');
252
- const configFile = plugin_1.getPlatformElement(p, platform, 'config-file');
251
+ const editConfig = (0, plugin_1.getPlatformElement)(p, platform, 'edit-config');
252
+ const configFile = (0, plugin_1.getPlatformElement)(p, platform, 'config-file');
253
253
  editConfig.concat(configFile).map(async (configElement) => {
254
254
  if (configElement.$ && !configElement.$.target.includes('config.xml')) {
255
255
  if (platform === config.ios.name) {
@@ -264,16 +264,16 @@ async function logCordovaManualSteps(cordovaPlugins, config, platform) {
264
264
  exports.logCordovaManualSteps = logCordovaManualSteps;
265
265
  async function logiOSPlist(configElement, config, plugin) {
266
266
  var _a, _b;
267
- let plistPath = path_1.resolve(config.ios.nativeTargetDirAbs, 'Info.plist');
267
+ let plistPath = (0, path_1.resolve)(config.ios.nativeTargetDirAbs, 'Info.plist');
268
268
  if ((_a = config.app.extConfig.ios) === null || _a === void 0 ? void 0 : _a.scheme) {
269
- plistPath = path_1.resolve(config.ios.nativeProjectDirAbs, `${(_b = config.app.extConfig.ios) === null || _b === void 0 ? void 0 : _b.scheme}-Info.plist`);
269
+ plistPath = (0, path_1.resolve)(config.ios.nativeProjectDirAbs, `${(_b = config.app.extConfig.ios) === null || _b === void 0 ? void 0 : _b.scheme}-Info.plist`);
270
270
  }
271
- if (!(await utils_fs_1.pathExists(plistPath))) {
272
- plistPath = path_1.resolve(config.ios.nativeTargetDirAbs, 'Base.lproj', 'Info.plist');
271
+ if (!(await (0, utils_fs_1.pathExists)(plistPath))) {
272
+ plistPath = (0, path_1.resolve)(config.ios.nativeTargetDirAbs, 'Base.lproj', 'Info.plist');
273
273
  }
274
- if (await utils_fs_1.pathExists(plistPath)) {
275
- const xmlMeta = await xml_1.readXML(plistPath);
276
- const data = await utils_fs_1.readFile(plistPath, { encoding: 'utf-8' });
274
+ if (await (0, utils_fs_1.pathExists)(plistPath)) {
275
+ const xmlMeta = await (0, xml_1.readXML)(plistPath);
276
+ const data = await (0, utils_fs_1.readFile)(plistPath, { encoding: 'utf-8' });
277
277
  const trimmedPlistData = data.replace(/(\t|\r|\n)/g, '');
278
278
  const plistData = plist_1.default.parse(data);
279
279
  const dict = xmlMeta.plist.dict.pop();
@@ -324,7 +324,7 @@ async function logiOSPlist(configElement, config, plugin) {
324
324
  arrayToAddTo.push(toAdd);
325
325
  }
326
326
  };
327
- const existingElements = xml_1.parseXML(trimmedPlistData, {
327
+ const existingElements = (0, xml_1.parseXML)(trimmedPlistData, {
328
328
  explicitChildren: true,
329
329
  trim: true,
330
330
  preserveChildrenOrder: true,
@@ -339,7 +339,7 @@ async function logiOSPlist(configElement, config, plugin) {
339
339
  }
340
340
  parseXmlToSearchable(existingElements[rootKeyOfExistingElements]['$$'], rootOfExistingElementsToAdd['children']);
341
341
  parsedExistingElements.push(rootOfExistingElementsToAdd);
342
- const requiredElements = xml_1.parseXML(xml, {
342
+ const requiredElements = (0, xml_1.parseXML)(xml, {
343
343
  explicitChildren: true,
344
344
  trim: true,
345
345
  preserveChildrenOrder: true,
@@ -410,7 +410,7 @@ function logPossibleMissingItem(configElement, plugin) {
410
410
  xml);
411
411
  }
412
412
  function buildConfigFileXml(configElement) {
413
- return xml_1.buildXmlElement(configElement, 'config-file');
413
+ return (0, xml_1.buildXmlElement)(configElement, 'config-file');
414
414
  }
415
415
  function getConfigFileTagContent(str) {
416
416
  return str.replace(/<config-file.+">|<\/config-file>/g, '');
@@ -422,11 +422,11 @@ function removeOuterTags(str) {
422
422
  }
423
423
  async function checkPluginDependencies(plugins, platform) {
424
424
  const pluginDeps = new Map();
425
- const cordovaPlugins = plugins.filter(p => plugin_1.getPluginType(p, platform) === 1 /* Cordova */);
426
- const incompatible = plugins.filter(p => plugin_1.getPluginType(p, platform) === 2 /* Incompatible */);
425
+ const cordovaPlugins = plugins.filter(p => (0, plugin_1.getPluginType)(p, platform) === 1 /* PluginType.Cordova */);
426
+ const incompatible = plugins.filter(p => (0, plugin_1.getPluginType)(p, platform) === 2 /* PluginType.Incompatible */);
427
427
  await Promise.all(cordovaPlugins.map(async (p) => {
428
428
  let allDependencies = [];
429
- allDependencies = allDependencies.concat(plugin_1.getPlatformElement(p, platform, 'dependency'));
429
+ allDependencies = allDependencies.concat((0, plugin_1.getPlatformElement)(p, platform, 'dependency'));
430
430
  if (p.xml['dependency']) {
431
431
  allDependencies = allDependencies.concat(p.xml['dependency']);
432
432
  }
@@ -504,17 +504,17 @@ function needsStaticPod(plugin, config) {
504
504
  }
505
505
  exports.needsStaticPod = needsStaticPod;
506
506
  function useFrameworks(plugin) {
507
- const podspecs = plugin_1.getPlatformElement(plugin, 'ios', 'podspec');
507
+ const podspecs = (0, plugin_1.getPlatformElement)(plugin, 'ios', 'podspec');
508
508
  const frameworkPods = podspecs.filter((podspec) => podspec.pods.filter((pods) => pods.$ && pods.$['use-frameworks'] === 'true').length > 0);
509
509
  return frameworkPods.length > 0;
510
510
  }
511
511
  async function getCordovaPreferences(config) {
512
512
  var _a, _b, _c, _d, _e;
513
- const configXml = path_1.join(config.app.rootDir, 'config.xml');
513
+ const configXml = (0, path_1.join)(config.app.rootDir, 'config.xml');
514
514
  let cordova = {};
515
- if (await utils_fs_1.pathExists(configXml)) {
515
+ if (await (0, utils_fs_1.pathExists)(configXml)) {
516
516
  cordova.preferences = {};
517
- const xmlMeta = await xml_1.readXML(configXml);
517
+ const xmlMeta = await (0, xml_1.readXML)(configXml);
518
518
  if (xmlMeta.widget.preference) {
519
519
  xmlMeta.widget.preference.map((pref) => {
520
520
  cordova.preferences[pref.$.name] = pref.$.value;
@@ -522,8 +522,8 @@ async function getCordovaPreferences(config) {
522
522
  }
523
523
  }
524
524
  if (cordova.preferences && Object.keys(cordova.preferences).length > 0) {
525
- if (term_1.isInteractive()) {
526
- const answers = await log_1.logPrompt(`${colors_1.default.strong(`Cordova preferences can be automatically ported to ${colors_1.default.strong(config.app.extConfigName)}.`)}\n` +
525
+ if ((0, term_1.isInteractive)()) {
526
+ const answers = await (0, log_1.logPrompt)(`${colors_1.default.strong(`Cordova preferences can be automatically ported to ${colors_1.default.strong(config.app.extConfigName)}.`)}\n` +
527
527
  `Keep in mind: Not all values can be automatically migrated from ${colors_1.default.strong('config.xml')}. There may be more work to do.\n` +
528
528
  `More info: ${colors_1.default.strong('https://capacitorjs.com/docs/cordova/migrating-from-cordova-to-capacitor')}`, {
529
529
  type: 'confirm',
@@ -533,7 +533,7 @@ async function getCordovaPreferences(config) {
533
533
  });
534
534
  if (answers.confirm) {
535
535
  if ((_b = (_a = config.app.extConfig) === null || _a === void 0 ? void 0 : _a.cordova) === null || _b === void 0 ? void 0 : _b.preferences) {
536
- const answers = await prompts_1.default([
536
+ const answers = await (0, prompts_1.default)([
537
537
  {
538
538
  type: 'confirm',
539
539
  name: 'confirm',
@@ -558,23 +558,24 @@ async function getCordovaPreferences(config) {
558
558
  exports.getCordovaPreferences = getCordovaPreferences;
559
559
  async function writeCordovaAndroidManifest(cordovaPlugins, config, platform) {
560
560
  var _a;
561
- const manifestPath = path_1.join(config.android.cordovaPluginsDirAbs, 'src', 'main', 'AndroidManifest.xml');
561
+ const manifestPath = (0, path_1.join)(config.android.cordovaPluginsDirAbs, 'src', 'main', 'AndroidManifest.xml');
562
562
  const rootXMLEntries = [];
563
563
  const applicationXMLEntries = [];
564
564
  const applicationXMLAttributes = [];
565
565
  let prefsArray = [];
566
566
  cordovaPlugins.map(async (p) => {
567
- const editConfig = plugin_1.getPlatformElement(p, platform, 'edit-config');
568
- const configFile = plugin_1.getPlatformElement(p, platform, 'config-file');
569
- prefsArray = prefsArray.concat(plugin_1.getAllElements(p, platform, 'preference'));
567
+ const editConfig = (0, plugin_1.getPlatformElement)(p, platform, 'edit-config');
568
+ const configFile = (0, plugin_1.getPlatformElement)(p, platform, 'config-file');
569
+ prefsArray = prefsArray.concat((0, plugin_1.getAllElements)(p, platform, 'preference'));
570
570
  editConfig.concat(configFile).map(async (configElement) => {
571
571
  var _a, _b;
572
572
  if (configElement.$ &&
573
- (((_a = configElement.$.target) === null || _a === void 0 ? void 0 : _a.includes('AndroidManifest.xml')) || ((_b = configElement.$.file) === null || _b === void 0 ? void 0 : _b.includes('AndroidManifest.xml')))) {
573
+ (((_a = configElement.$.target) === null || _a === void 0 ? void 0 : _a.includes('AndroidManifest.xml')) ||
574
+ ((_b = configElement.$.file) === null || _b === void 0 ? void 0 : _b.includes('AndroidManifest.xml')))) {
574
575
  const keys = Object.keys(configElement).filter(k => k !== '$');
575
576
  keys.map(k => {
576
577
  configElement[k].map(async (e) => {
577
- const xmlElement = xml_1.buildXmlElement(e, k);
578
+ const xmlElement = (0, xml_1.buildXmlElement)(e, k);
578
579
  const pathParts = getPathParts(configElement.$.parent || configElement.$.target);
579
580
  if (pathParts.length > 1) {
580
581
  if (pathParts.pop() === 'application') {
@@ -591,8 +592,8 @@ async function writeCordovaAndroidManifest(cordovaPlugins, config, platform) {
591
592
  }
592
593
  }
593
594
  else {
594
- const manifestPathOfCapApp = path_1.join(config.android.appDirAbs, 'src', 'main', 'AndroidManifest.xml');
595
- const manifestContentTrimmed = (await utils_fs_1.readFile(manifestPathOfCapApp))
595
+ const manifestPathOfCapApp = (0, path_1.join)(config.android.appDirAbs, 'src', 'main', 'AndroidManifest.xml');
596
+ const manifestContentTrimmed = (await (0, utils_fs_1.readFile)(manifestPathOfCapApp))
596
597
  .toString()
597
598
  .trim()
598
599
  .replace(/\n|\t|\r/g, '')
@@ -755,10 +756,10 @@ async function writeCordovaAndroidManifest(cordovaPlugins, config, platform) {
755
756
  }
756
757
  return true;
757
758
  };
758
- if (!doesXmlManifestContainRequiredInfo(xml_1.parseXML(requiredManifestContentTrimmed, {
759
+ if (!doesXmlManifestContainRequiredInfo((0, xml_1.parseXML)(requiredManifestContentTrimmed, {
759
760
  explicitChildren: true,
760
761
  trim: true,
761
- }), xml_1.parseXML(manifestContentTrimmed, {
762
+ }), (0, xml_1.parseXML)(manifestContentTrimmed, {
762
763
  explicitChildren: true,
763
764
  trim: true,
764
765
  }), pathPartList)) {
@@ -785,8 +786,7 @@ async function writeCordovaAndroidManifest(cordovaPlugins, config, platform) {
785
786
  ? cleartextString
786
787
  : '';
787
788
  let content = `<?xml version='1.0' encoding='utf-8'?>
788
- <manifest package="capacitor.android.plugins"
789
- xmlns:android="http://schemas.android.com/apk/res/android"
789
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
790
790
  xmlns:amazon="http://schemas.amazon.com/apk/res/android">
791
791
  <application ${applicationXMLAttributes.join('\n')} ${cleartext}>
792
792
  ${applicationXMLEntries.join('\n')}
@@ -797,8 +797,8 @@ ${rootXMLEntries.join('\n')}
797
797
  for (const preference of prefsArray) {
798
798
  content = content.replace(new RegExp(('$' + preference.$.name).replace('$', '\\$&'), 'g'), preference.$.default);
799
799
  }
800
- if (await utils_fs_1.pathExists(manifestPath)) {
801
- await utils_fs_1.writeFile(manifestPath, content);
800
+ if (await (0, utils_fs_1.pathExists)(manifestPath)) {
801
+ await (0, utils_fs_1.writeFile)(manifestPath, content);
802
802
  }
803
803
  }
804
804
  exports.writeCordovaAndroidManifest = writeCordovaAndroidManifest;
@@ -812,9 +812,9 @@ function getPathParts(path) {
812
812
  return [rootPath, path];
813
813
  }
814
814
  function contains(entries, obj, k) {
815
- const element = xml_1.parseXML(obj);
815
+ const element = (0, xml_1.parseXML)(obj);
816
816
  for (const entry of entries) {
817
- const current = xml_1.parseXML(entry);
817
+ const current = (0, xml_1.parseXML)(entry);
818
818
  if (element &&
819
819
  current &&
820
820
  current[k] &&
@@ -33,7 +33,10 @@ export interface CapacitorConfig {
33
33
  * will create a `capacitor.js` file that you'll need to add as a script in
34
34
  * your `index.html` file.
35
35
  *
36
+ * It's deprecated and will be removed in Capacitor 6
37
+ *
36
38
  * @since 1.0.0
39
+ * @deprecated 5.0.0
37
40
  * @default false
38
41
  */
39
42
  bundledWebRuntime?: boolean;
@@ -204,6 +207,19 @@ export interface CapacitorConfig {
204
207
  * @default 60
205
208
  */
206
209
  minWebViewVersion?: number;
210
+ /**
211
+ * The minimum supported Huawei webview version on Android supported by your app.
212
+ *
213
+ * The minimum supported cannot be lower than version `10`, which is required for Capacitor.
214
+ *
215
+ * If the device uses a lower WebView version, an error message will be shown on Logcat.
216
+ * If `server.errorPath` is configured, the WebView will redirect to that file, so can be
217
+ * used to show a custom error.
218
+ *
219
+ * @since 4.6.4
220
+ * @default 10
221
+ */
222
+ minHuaweiWebViewVersion?: number;
207
223
  buildOptions?: {
208
224
  /**
209
225
  * Path to your keystore
@@ -533,7 +549,7 @@ export interface LiveUpdateConfig {
533
549
  maxVersions?: number;
534
550
  key?: string;
535
551
  }
536
- export declare type AutoUpdateMethod = 'none' | 'background';
552
+ export type AutoUpdateMethod = 'none' | 'background';
537
553
  export interface PluginsConfig {
538
554
  /**
539
555
  * Plugin configuration by class name.
package/dist/index.js CHANGED
@@ -17,11 +17,11 @@ process.on('unhandledRejection', error => {
17
17
  process.on('message', ipc_1.receive);
18
18
  async function run() {
19
19
  try {
20
- const config = await config_1.loadConfig();
20
+ const config = await (0, config_1.loadConfig)();
21
21
  runProgram(config);
22
22
  }
23
23
  catch (e) {
24
- process.exitCode = errors_1.isFatal(e) ? e.exitCode : 1;
24
+ process.exitCode = (0, errors_1.isFatal)(e) ? e.exitCode : 1;
25
25
  log_1.logger.error(e.message ? e.message : String(e));
26
26
  }
27
27
  }
@@ -32,14 +32,14 @@ function runProgram(config) {
32
32
  .command('config', { hidden: true })
33
33
  .description(`print evaluated Capacitor config`)
34
34
  .option('--json', 'Print in JSON format')
35
- .action(cli_1.wrapAction(async ({ json }) => {
35
+ .action((0, cli_1.wrapAction)(async ({ json }) => {
36
36
  const { configCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/config')));
37
37
  await configCommand(config, json);
38
38
  }));
39
39
  commander_1.program
40
40
  .command('create [directory] [name] [id]', { hidden: true })
41
41
  .description('Creates a new Capacitor project')
42
- .action(cli_1.wrapAction(async () => {
42
+ .action((0, cli_1.wrapAction)(async () => {
43
43
  const { createCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/create')));
44
44
  await createCommand();
45
45
  }));
@@ -47,33 +47,33 @@ function runProgram(config) {
47
47
  .command('init [appName] [appId]')
48
48
  .description(`Initialize Capacitor configuration`)
49
49
  .option('--web-dir <value>', 'Optional: Directory of your projects built web assets')
50
- .action(cli_1.wrapAction(telemetry_1.telemetryAction(config, async (appName, appId, { webDir }) => {
50
+ .action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (appName, appId, { webDir }) => {
51
51
  const { initCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/init')));
52
52
  await initCommand(config, appName, appId, webDir);
53
53
  })));
54
54
  commander_1.program
55
55
  .command('serve', { hidden: true })
56
56
  .description('Serves a Capacitor Progressive Web App in the browser')
57
- .action(cli_1.wrapAction(async () => {
57
+ .action((0, cli_1.wrapAction)(async () => {
58
58
  const { serveCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/serve')));
59
59
  await serveCommand();
60
60
  }));
61
61
  commander_1.program
62
62
  .command('sync [platform]')
63
63
  .description(`${colors_1.default.input('copy')} + ${colors_1.default.input('update')}`)
64
- .option('--deployment', "Optional: if provided, Podfile.lock won't be deleted and pod install will use --deployment option")
64
+ .option('--deployment', 'Optional: if provided, pod install will use --deployment option')
65
65
  .option('--inline', 'Optional: if true, all source maps will be inlined for easier debugging on mobile devices', false)
66
- .action(cli_1.wrapAction(telemetry_1.telemetryAction(config, async (platform, { deployment, inline }) => {
67
- config_1.checkExternalConfig(config.app);
66
+ .action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { deployment, inline }) => {
67
+ (0, config_1.checkExternalConfig)(config.app);
68
68
  const { syncCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/sync')));
69
69
  await syncCommand(config, platform, deployment, inline);
70
70
  })));
71
71
  commander_1.program
72
72
  .command('update [platform]')
73
73
  .description(`updates the native plugins and dependencies based on ${colors_1.default.strong('package.json')}`)
74
- .option('--deployment', "Optional: if provided, Podfile.lock won't be deleted and pod install will use --deployment option")
75
- .action(cli_1.wrapAction(telemetry_1.telemetryAction(config, async (platform, { deployment }) => {
76
- config_1.checkExternalConfig(config.app);
74
+ .option('--deployment', 'Optional: if provided, pod install will use --deployment option')
75
+ .action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { deployment }) => {
76
+ (0, config_1.checkExternalConfig)(config.app);
77
77
  const { updateCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/update')));
78
78
  await updateCommand(config, platform, deployment);
79
79
  })));
@@ -81,8 +81,8 @@ function runProgram(config) {
81
81
  .command('copy [platform]')
82
82
  .description('copies the web app build into the native app')
83
83
  .option('--inline', 'Optional: if true, all source maps will be inlined for easier debugging on mobile devices', false)
84
- .action(cli_1.wrapAction(telemetry_1.telemetryAction(config, async (platform, { inline }) => {
85
- config_1.checkExternalConfig(config.app);
84
+ .action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { inline }) => {
85
+ (0, config_1.checkExternalConfig)(config.app);
86
86
  const { copyCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/copy')));
87
87
  await copyCommand(config, platform, inline);
88
88
  })));
@@ -90,12 +90,13 @@ function runProgram(config) {
90
90
  .command('build <platform>')
91
91
  .description('builds the release version of the selected platform')
92
92
  .option('--scheme <schemeToBuild>', 'iOS Scheme to build')
93
+ .option('--flavor <flavorToBuild>', 'Android Flavor to build')
93
94
  .option('--keystorepath <keystorePath>', 'Path to the keystore')
94
95
  .option('--keystorepass <keystorePass>', 'Password to the keystore')
95
96
  .option('--keystorealias <keystoreAlias>', 'Key Alias in the keystore')
96
97
  .option('--keystorealiaspass <keystoreAliasPass>', 'Password for the Key Alias')
97
98
  .addOption(new commander_1.Option('--androidreleasetype <androidreleasetype>', 'Android release type; APK or AAB').choices(['AAB', 'APK']))
98
- .action(cli_1.wrapAction(telemetry_1.telemetryAction(config, async (platform, { scheme, keystorepath, keystorepass, keystorealias, keystorealiaspass, androidreleasetype, }) => {
99
+ .action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { scheme, keystorepath, keystorepass, keystorealias, keystorealiaspass, androidreleasetype, }) => {
99
100
  const { buildCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/build')));
100
101
  await buildCommand(config, platform, {
101
102
  scheme,
@@ -116,7 +117,8 @@ function runProgram(config) {
116
117
  .allowUnknownOption(true)
117
118
  .option('--target <id>', 'use a specific target')
118
119
  .option('--no-sync', `do not run ${colors_1.default.input('sync')}`)
119
- .action(cli_1.wrapAction(telemetry_1.telemetryAction(config, async (platform, { scheme, flavor, list, target, sync }) => {
120
+ .option('--forwardPorts <port:port>', 'Automatically run "adb reverse" for better live-reloading support')
121
+ .action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { scheme, flavor, list, target, sync, forwardPorts }) => {
120
122
  const { runCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/run')));
121
123
  await runCommand(config, platform, {
122
124
  scheme,
@@ -124,43 +126,44 @@ function runProgram(config) {
124
126
  list,
125
127
  target,
126
128
  sync,
129
+ forwardPorts,
127
130
  });
128
131
  })));
129
132
  commander_1.program
130
133
  .command('open [platform]')
131
134
  .description('opens the native project workspace (Xcode for iOS)')
132
- .action(cli_1.wrapAction(telemetry_1.telemetryAction(config, async (platform) => {
135
+ .action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform) => {
133
136
  const { openCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/open')));
134
137
  await openCommand(config, platform);
135
138
  })));
136
139
  commander_1.program
137
140
  .command('add [platform]')
138
141
  .description('add a native platform project')
139
- .action(cli_1.wrapAction(telemetry_1.telemetryAction(config, async (platform) => {
140
- config_1.checkExternalConfig(config.app);
142
+ .action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform) => {
143
+ (0, config_1.checkExternalConfig)(config.app);
141
144
  const { addCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/add')));
142
145
  await addCommand(config, platform);
143
146
  })));
144
147
  commander_1.program
145
148
  .command('ls [platform]')
146
149
  .description('list installed Cordova and Capacitor plugins')
147
- .action(cli_1.wrapAction(telemetry_1.telemetryAction(config, async (platform) => {
148
- config_1.checkExternalConfig(config.app);
150
+ .action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform) => {
151
+ (0, config_1.checkExternalConfig)(config.app);
149
152
  const { listCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/list')));
150
153
  await listCommand(config, platform);
151
154
  })));
152
155
  commander_1.program
153
156
  .command('doctor [platform]')
154
157
  .description('checks the current setup for common errors')
155
- .action(cli_1.wrapAction(telemetry_1.telemetryAction(config, async (platform) => {
156
- config_1.checkExternalConfig(config.app);
158
+ .action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform) => {
159
+ (0, config_1.checkExternalConfig)(config.app);
157
160
  const { doctorCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/doctor')));
158
161
  await doctorCommand(config, platform);
159
162
  })));
160
163
  commander_1.program
161
164
  .command('telemetry [on|off]', { hidden: true })
162
165
  .description('enable or disable telemetry')
163
- .action(cli_1.wrapAction(async (onOrOff) => {
166
+ .action((0, cli_1.wrapAction)(async (onOrOff) => {
164
167
  const { telemetryCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/telemetry')));
165
168
  await telemetryCommand(onOrOff);
166
169
  }));
@@ -173,24 +176,24 @@ function runProgram(config) {
173
176
  commander_1.program
174
177
  .command('plugin:generate', { hidden: true })
175
178
  .description('start a new Capacitor plugin')
176
- .action(cli_1.wrapAction(async () => {
179
+ .action((0, cli_1.wrapAction)(async () => {
177
180
  const { newPluginCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/new-plugin')));
178
181
  await newPluginCommand();
179
182
  }));
180
183
  commander_1.program
181
184
  .command('migrate')
182
185
  .description('Migrate your current Capacitor app to the latest major version of Capacitor.')
183
- .action(cli_1.wrapAction(async () => {
186
+ .action((0, cli_1.wrapAction)(async () => {
184
187
  const { migrateCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/migrate')));
185
188
  await migrateCommand(config);
186
189
  }));
187
- commander_1.program.arguments('[command]').action(cli_1.wrapAction(async (cmd) => {
190
+ commander_1.program.arguments('[command]').action((0, cli_1.wrapAction)(async (cmd) => {
188
191
  if (typeof cmd === 'undefined') {
189
- log_1.output.write(`\n ${emoji_1.emoji('⚡️', '--')} ${colors_1.default.strong('Capacitor - Cross-Platform apps with JavaScript and the Web')} ${emoji_1.emoji('⚡️', '--')}\n\n`);
192
+ log_1.output.write(`\n ${(0, emoji_1.emoji)('⚡️', '--')} ${colors_1.default.strong('Capacitor - Cross-Platform apps with JavaScript and the Web')} ${(0, emoji_1.emoji)('⚡️', '--')}\n\n`);
190
193
  commander_1.program.outputHelp();
191
194
  }
192
195
  else {
193
- errors_1.fatal(`Unknown command: ${colors_1.default.input(cmd)}`);
196
+ (0, errors_1.fatal)(`Unknown command: ${colors_1.default.input(cmd)}`);
194
197
  }
195
198
  }));
196
199
  commander_1.program.parse(process.argv);
package/dist/ios/add.js CHANGED
@@ -6,8 +6,8 @@ const colors_1 = tslib_1.__importDefault(require("../colors"));
6
6
  const common_1 = require("../common");
7
7
  const template_1 = require("../util/template");
8
8
  async function addIOS(config) {
9
- await common_1.runTask(`Adding native Xcode project in ${colors_1.default.strong(config.ios.platformDir)}`, () => {
10
- return template_1.extractTemplate(config.cli.assets.ios.platformTemplateArchiveAbs, config.ios.platformDirAbs);
9
+ await (0, common_1.runTask)(`Adding native Xcode project in ${colors_1.default.strong(config.ios.platformDir)}`, () => {
10
+ return (0, template_1.extractTemplate)(config.cli.assets.ios.platformTemplateArchiveAbs, config.ios.platformDirAbs);
11
11
  });
12
12
  }
13
13
  exports.addIOS = addIOS;