@capacitor/cli 7.0.0-alpha.2 → 7.0.0-beta.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.
package/dist/cordova.js CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.writeCordovaAndroidManifest = exports.getCordovaPreferences = exports.needsStaticPod = exports.getIncompatibleCordovaPlugins = exports.checkPluginDependencies = exports.logCordovaManualSteps = exports.getCordovaPlugins = exports.handleCordovaPluginsJS = exports.autoGenerateConfig = exports.removePluginFiles = exports.createEmptyCordovaJS = exports.copyCordovaJS = exports.copyPluginsJS = exports.generateCordovaPluginsJSFile = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const utils_fs_1 = require("@ionic/utils-fs");
5
+ const fs_extra_1 = require("fs-extra");
6
6
  const path_1 = require("path");
7
7
  const plist_1 = tslib_1.__importDefault(require("plist"));
8
8
  const prompts_1 = tslib_1.__importDefault(require("prompts"));
@@ -102,26 +102,26 @@ async function copyPluginsJS(config, cordovaPlugins, platform) {
102
102
  await Promise.all(cordovaPlugins.map(async (p) => {
103
103
  const pluginId = p.xml.$.id;
104
104
  const pluginDir = (0, path_1.join)(pluginsDir, pluginId, 'www');
105
- await (0, utils_fs_1.ensureDir)(pluginDir);
105
+ await (0, fs_extra_1.ensureDir)(pluginDir);
106
106
  const jsModules = (0, plugin_1.getJSModules)(p, platform);
107
107
  await Promise.all(jsModules.map(async (jsModule) => {
108
108
  const filePath = (0, path_1.join)(webDir, 'plugins', pluginId, jsModule.$.src);
109
- await (0, utils_fs_1.copy)((0, path_1.join)(p.rootPath, jsModule.$.src), filePath);
110
- let data = await (0, utils_fs_1.readFile)(filePath, { encoding: 'utf-8' });
109
+ await (0, fs_extra_1.copy)((0, path_1.join)(p.rootPath, jsModule.$.src), filePath);
110
+ let data = await (0, fs_extra_1.readFile)(filePath, { encoding: 'utf-8' });
111
111
  data = data.trim();
112
112
  // mimics Cordova's module name logic if the name attr is missing
113
113
  const name = pluginId + '.' + (jsModule.$.name || (0, path_1.basename)(jsModule.$.src, (0, path_1.extname)(jsModule.$.src)));
114
114
  data = `cordova.define("${name}", function(require, exports, module) { \n${data}\n});`;
115
115
  data = data.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script\s*>/gi, '');
116
- await (0, utils_fs_1.writeFile)(filePath, data, { encoding: 'utf-8' });
116
+ await (0, fs_extra_1.writeFile)(filePath, data, { encoding: 'utf-8' });
117
117
  }));
118
118
  const assets = (0, plugin_1.getAssets)(p, platform);
119
119
  await Promise.all(assets.map(async (asset) => {
120
120
  const filePath = (0, path_1.join)(webDir, asset.$.target);
121
- await (0, utils_fs_1.copy)((0, path_1.join)(p.rootPath, asset.$.src), filePath);
121
+ await (0, fs_extra_1.copy)((0, path_1.join)(p.rootPath, asset.$.src), filePath);
122
122
  }));
123
123
  }));
124
- await (0, utils_fs_1.writeFile)(cordovaPluginsJSFile, generateCordovaPluginsJSFile(config, cordovaPlugins, platform));
124
+ await (0, fs_extra_1.writeFile)(cordovaPluginsJSFile, generateCordovaPluginsJSFile(config, cordovaPlugins, platform));
125
125
  }
126
126
  exports.copyPluginsJS = copyPluginsJS;
127
127
  async function copyCordovaJS(config, platform) {
@@ -130,21 +130,21 @@ async function copyCordovaJS(config, platform) {
130
130
  (0, errors_1.fatal)(`Unable to find ${colors_1.default.strong('node_modules/@capacitor/core/cordova.js')}.\n` +
131
131
  `Are you sure ${colors_1.default.strong('@capacitor/core')} is installed?`);
132
132
  }
133
- return (0, utils_fs_1.copy)(cordovaPath, (0, path_1.join)(await getWebDir(config, platform), 'cordova.js'));
133
+ return (0, fs_extra_1.copy)(cordovaPath, (0, path_1.join)(await getWebDir(config, platform), 'cordova.js'));
134
134
  }
135
135
  exports.copyCordovaJS = copyCordovaJS;
136
136
  async function createEmptyCordovaJS(config, platform) {
137
137
  const webDir = await getWebDir(config, platform);
138
- await (0, utils_fs_1.writeFile)((0, path_1.join)(webDir, 'cordova.js'), '');
139
- await (0, utils_fs_1.writeFile)((0, path_1.join)(webDir, 'cordova_plugins.js'), '');
138
+ await (0, fs_extra_1.writeFile)((0, path_1.join)(webDir, 'cordova.js'), '');
139
+ await (0, fs_extra_1.writeFile)((0, path_1.join)(webDir, 'cordova_plugins.js'), '');
140
140
  }
141
141
  exports.createEmptyCordovaJS = createEmptyCordovaJS;
142
142
  async function removePluginFiles(config, platform) {
143
143
  const webDir = await getWebDir(config, platform);
144
144
  const pluginsDir = (0, path_1.join)(webDir, 'plugins');
145
145
  const cordovaPluginsJSFile = (0, path_1.join)(webDir, 'cordova_plugins.js');
146
- await (0, utils_fs_1.remove)(pluginsDir);
147
- await (0, utils_fs_1.remove)(cordovaPluginsJSFile);
146
+ await (0, fs_extra_1.remove)(pluginsDir);
147
+ await (0, fs_extra_1.remove)(cordovaPluginsJSFile);
148
148
  }
149
149
  exports.removePluginFiles = removePluginFiles;
150
150
  async function autoGenerateConfig(config, cordovaPlugins, platform) {
@@ -154,9 +154,9 @@ async function autoGenerateConfig(config, cordovaPlugins, platform) {
154
154
  if (platform === 'ios') {
155
155
  xmlDir = config.ios.nativeTargetDirAbs;
156
156
  }
157
- await (0, utils_fs_1.ensureDir)(xmlDir);
157
+ await (0, fs_extra_1.ensureDir)(xmlDir);
158
158
  const cordovaConfigXMLFile = (0, path_1.join)(xmlDir, fileName);
159
- await (0, utils_fs_1.remove)(cordovaConfigXMLFile);
159
+ await (0, fs_extra_1.remove)(cordovaConfigXMLFile);
160
160
  const pluginEntries = [];
161
161
  cordovaPlugins.map((p) => {
162
162
  const currentPlatform = (0, plugin_1.getPluginPlatform)(p, platform);
@@ -203,7 +203,7 @@ async function autoGenerateConfig(config, cordovaPlugins, platform) {
203
203
  ${pluginEntriesString.join('')}
204
204
  ${pluginPreferencesString.join('')}
205
205
  </widget>`;
206
- await (0, utils_fs_1.writeFile)(cordovaConfigXMLFile, content);
206
+ await (0, fs_extra_1.writeFile)(cordovaConfigXMLFile, content);
207
207
  }
208
208
  exports.autoGenerateConfig = autoGenerateConfig;
209
209
  async function getWebDir(config, platform) {
@@ -217,7 +217,7 @@ async function getWebDir(config, platform) {
217
217
  }
218
218
  async function handleCordovaPluginsJS(cordovaPlugins, config, platform) {
219
219
  const webDir = await getWebDir(config, platform);
220
- await (0, utils_fs_1.mkdirp)(webDir);
220
+ await (0, fs_extra_1.mkdirp)(webDir);
221
221
  if (cordovaPlugins.length > 0) {
222
222
  (0, plugin_1.printPlugins)(cordovaPlugins, platform, 'cordova');
223
223
  await copyCordovaJS(config, platform);
@@ -264,12 +264,12 @@ async function logiOSPlist(configElement, config, plugin) {
264
264
  if ((_a = config.app.extConfig.ios) === null || _a === void 0 ? void 0 : _a.scheme) {
265
265
  plistPath = (0, path_1.resolve)(config.ios.nativeProjectDirAbs, `${(_b = config.app.extConfig.ios) === null || _b === void 0 ? void 0 : _b.scheme}-Info.plist`);
266
266
  }
267
- if (!(await (0, utils_fs_1.pathExists)(plistPath))) {
267
+ if (!(await (0, fs_extra_1.pathExists)(plistPath))) {
268
268
  plistPath = (0, path_1.resolve)(config.ios.nativeTargetDirAbs, 'Base.lproj', 'Info.plist');
269
269
  }
270
- if (await (0, utils_fs_1.pathExists)(plistPath)) {
270
+ if (await (0, fs_extra_1.pathExists)(plistPath)) {
271
271
  const xmlMeta = await (0, xml_1.readXML)(plistPath);
272
- const data = await (0, utils_fs_1.readFile)(plistPath, { encoding: 'utf-8' });
272
+ const data = await (0, fs_extra_1.readFile)(plistPath, { encoding: 'utf-8' });
273
273
  const trimmedPlistData = data.replace(/(\t|\r|\n)/g, '');
274
274
  const plistData = plist_1.default.parse(data);
275
275
  const dict = xmlMeta.plist.dict.pop();
@@ -490,7 +490,7 @@ async function getCordovaPreferences(config) {
490
490
  var _a, _b, _c, _d, _e;
491
491
  const configXml = (0, path_1.join)(config.app.rootDir, 'config.xml');
492
492
  let cordova = {};
493
- if (await (0, utils_fs_1.pathExists)(configXml)) {
493
+ if (await (0, fs_extra_1.pathExists)(configXml)) {
494
494
  cordova.preferences = {};
495
495
  const xmlMeta = await (0, xml_1.readXML)(configXml);
496
496
  if (xmlMeta.widget.preference) {
@@ -569,7 +569,7 @@ async function writeCordovaAndroidManifest(cordovaPlugins, config, platform, cle
569
569
  }
570
570
  else {
571
571
  const manifestPathOfCapApp = (0, path_1.join)(config.android.appDirAbs, 'src', 'main', 'AndroidManifest.xml');
572
- const manifestContentTrimmed = (await (0, utils_fs_1.readFile)(manifestPathOfCapApp))
572
+ const manifestContentTrimmed = (await (0, fs_extra_1.readFile)(manifestPathOfCapApp))
573
573
  .toString()
574
574
  .trim()
575
575
  .replace(/\n|\t|\r/g, '')
@@ -766,8 +766,8 @@ ${rootXMLEntries.join('\n')}
766
766
  for (const preference of prefsArray) {
767
767
  content = content.replace(new RegExp(('$' + preference.$.name).replace('$', '\\$&'), 'g'), preference.$.default);
768
768
  }
769
- if (await (0, utils_fs_1.pathExists)(manifestPath)) {
770
- await (0, utils_fs_1.writeFile)(manifestPath, content);
769
+ if (await (0, fs_extra_1.pathExists)(manifestPath)) {
770
+ await (0, fs_extra_1.writeFile)(manifestPath, content);
771
771
  }
772
772
  }
773
773
  exports.writeCordovaAndroidManifest = writeCordovaAndroidManifest;
@@ -69,6 +69,13 @@ export interface CapacitorConfig {
69
69
  * @since 6.0.0
70
70
  */
71
71
  zoomEnabled?: boolean;
72
+ /**
73
+ * Whether to give the webview initial focus.
74
+ *
75
+ * @since 7.0.0
76
+ * @default true
77
+ */
78
+ initialFocus?: boolean;
72
79
  android?: {
73
80
  /**
74
81
  * Specify a custom path to the native Android project.
@@ -172,6 +179,8 @@ export interface CapacitorConfig {
172
179
  /**
173
180
  * Whether to give the webview initial focus.
174
181
  *
182
+ * Overrides global `initialFocus` option.
183
+ *
175
184
  * @since 3.5.1
176
185
  * @default true
177
186
  */
@@ -250,6 +259,14 @@ export interface CapacitorConfig {
250
259
  * @default false
251
260
  */
252
261
  useLegacyBridge?: boolean;
262
+ /**
263
+ * Make service worker requests go through Capacitor bridge.
264
+ * Set it to false to use your own handling.
265
+ *
266
+ * @since 7.0.0
267
+ * @default true
268
+ */
269
+ resolveServiceWorkerRequests?: boolean;
253
270
  };
254
271
  ios?: {
255
272
  /**
@@ -405,6 +422,15 @@ export interface CapacitorConfig {
405
422
  * @default false
406
423
  */
407
424
  webContentsDebuggingEnabled?: boolean;
425
+ /**
426
+ * Whether to give the webview initial focus.
427
+ *
428
+ * Overrides global `initialFocus` option.
429
+ *
430
+ * @since 7.0.0
431
+ * @default true
432
+ */
433
+ initialFocus?: boolean;
408
434
  };
409
435
  server?: {
410
436
  /**
package/dist/index.js CHANGED
@@ -123,8 +123,7 @@ function runProgram(config) {
123
123
  .option('--scheme <schemeName>', 'set the scheme of the iOS project')
124
124
  .option('--flavor <flavorName>', 'set the flavor of the Android project (flavor dimensions not yet supported)')
125
125
  .option('--list', 'list targets, then quit')
126
- // TODO: remove once --json is a hidden option (https://github.com/tj/commander.js/issues/1106)
127
- .allowUnknownOption(true)
126
+ .addOption(new commander_1.Option('--json').hideHelp())
128
127
  .option('--target <id>', 'use a specific target')
129
128
  .option('--no-sync', `do not run ${colors_1.default.input('sync')}`)
130
129
  .option('--forwardPorts <port:port>', 'Automatically run "adb reverse" for better live-reloading support')
@@ -132,12 +131,13 @@ function runProgram(config) {
132
131
  .option('--host <host>', 'Host used for live reload')
133
132
  .option('--port <port>', 'Port used for live reload')
134
133
  .option('--configuration <name>', 'Configuration name of the iOS Scheme')
135
- .action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { scheme, flavor, list, target, sync, forwardPorts, liveReload, host, port, configuration }) => {
134
+ .action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { scheme, flavor, list, json, target, sync, forwardPorts, liveReload, host, port, configuration }) => {
136
135
  const { runCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/run')));
137
136
  await runCommand(config, platform, {
138
137
  scheme,
139
138
  flavor,
140
139
  list,
140
+ json,
141
141
  target,
142
142
  sync,
143
143
  forwardPorts,
package/dist/ios/build.js CHANGED
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildiOS = void 0;
4
- const tslib_1 = require("tslib");
5
- const utils_fs_1 = require("@ionic/utils-fs");
4
+ const fs_extra_1 = require("fs-extra");
6
5
  const path_1 = require("path");
7
- const rimraf_1 = tslib_1.__importDefault(require("rimraf"));
6
+ const rimraf_1 = require("rimraf");
8
7
  const common_1 = require("../common");
9
8
  const log_1 = require("../log");
10
9
  const spm_1 = require("../util/spm");
@@ -45,7 +44,7 @@ async function buildiOS(config, buildOptions) {
45
44
  </dict>
46
45
  </plist>`;
47
46
  const archivePlistPath = (0, path_1.join)(`${config.ios.nativeProjectDirAbs}`, 'archive.plist');
48
- (0, utils_fs_1.writeFileSync)(archivePlistPath, archivePlistContents);
47
+ (0, fs_extra_1.writeFileSync)(archivePlistPath, archivePlistContents);
49
48
  await (0, common_1.runTask)('Building IPA', async () => (0, subprocess_1.runCommand)('xcodebuild', [
50
49
  'archive',
51
50
  '-archivePath',
@@ -62,8 +61,8 @@ async function buildiOS(config, buildOptions) {
62
61
  cwd: config.ios.nativeProjectDirAbs,
63
62
  }));
64
63
  await (0, common_1.runTask)('Cleaning up', async () => {
65
- (0, utils_fs_1.unlinkSync)(archivePlistPath);
66
- rimraf_1.default.sync((0, path_1.join)(config.ios.nativeProjectDirAbs, `${theScheme}.xcarchive`));
64
+ (0, fs_extra_1.unlinkSync)(archivePlistPath);
65
+ rimraf_1.rimraf.sync((0, path_1.join)(config.ios.nativeProjectDirAbs, `${theScheme}.xcarchive`));
67
66
  });
68
67
  (0, log_1.logSuccess)(`Successfully generated an IPA at: ${(0, path_1.join)(config.ios.nativeProjectDirAbs, 'output')}`);
69
68
  }
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.editProjectSettingsIOS = exports.resolvePlugin = exports.getIOSPlugins = exports.checkCocoaPods = exports.checkBundler = exports.checkIOSPackage = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const utils_fs_1 = require("@ionic/utils-fs");
6
5
  const child_process_1 = require("child_process");
6
+ const fs_extra_1 = require("fs-extra");
7
7
  const path_1 = require("path");
8
8
  const colors_1 = tslib_1.__importDefault(require("../colors"));
9
9
  const common_1 = require("../common");
@@ -88,11 +88,11 @@ async function editProjectSettingsIOS(config) {
88
88
  const appName = config.app.appName.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
89
89
  const pbxPath = `${config.ios.nativeXcodeProjDirAbs}/project.pbxproj`;
90
90
  const plistPath = (0, path_1.resolve)(config.ios.nativeTargetDirAbs, 'Info.plist');
91
- let plistContent = await (0, utils_fs_1.readFile)(plistPath, { encoding: 'utf-8' });
91
+ let plistContent = await (0, fs_extra_1.readFile)(plistPath, { encoding: 'utf-8' });
92
92
  plistContent = plistContent.replace(/<key>CFBundleDisplayName<\/key>[\s\S]?\s+<string>([^<]*)<\/string>/, `<key>CFBundleDisplayName</key>\n <string>${appName}</string>`);
93
- let pbxContent = await (0, utils_fs_1.readFile)(pbxPath, { encoding: 'utf-8' });
93
+ let pbxContent = await (0, fs_extra_1.readFile)(pbxPath, { encoding: 'utf-8' });
94
94
  pbxContent = pbxContent.replace(/PRODUCT_BUNDLE_IDENTIFIER = ([^;]+)/g, `PRODUCT_BUNDLE_IDENTIFIER = ${appId}`);
95
- await (0, utils_fs_1.writeFile)(plistPath, plistContent, { encoding: 'utf-8' });
96
- await (0, utils_fs_1.writeFile)(pbxPath, pbxContent, { encoding: 'utf-8' });
95
+ await (0, fs_extra_1.writeFile)(plistPath, plistContent, { encoding: 'utf-8' });
96
+ await (0, fs_extra_1.writeFile)(pbxPath, pbxContent, { encoding: 'utf-8' });
97
97
  }
98
98
  exports.editProjectSettingsIOS = editProjectSettingsIOS;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.installCocoaPodsPlugins = exports.updateIOS = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const utils_fs_1 = require("@ionic/utils-fs");
5
+ const fs_extra_1 = require("fs-extra");
6
6
  const path_1 = require("path");
7
7
  const colors_1 = tslib_1.__importDefault(require("../colors"));
8
8
  const common_1 = require("../common");
@@ -38,7 +38,7 @@ async function updateIOSCocoaPods(config, plugins, deployment) {
38
38
  if (cordovaPlugins.length > 0) {
39
39
  await copyPluginsNativeFiles(config, cordovaPlugins);
40
40
  }
41
- if (!(await (0, utils_fs_1.pathExists)(await config.ios.webDirAbs))) {
41
+ if (!(await (0, fs_extra_1.pathExists)(await config.ios.webDirAbs))) {
42
42
  await (0, copy_1.copy)(config, platform);
43
43
  }
44
44
  await (0, cordova_1.handleCordovaPluginsJS)(cordovaPlugins, config, platform);
@@ -60,10 +60,10 @@ async function updatePodfile(config, plugins, deployment) {
60
60
  const dependenciesContent = await generatePodFile(config, plugins);
61
61
  const relativeCapacitoriOSPath = await getRelativeCapacitoriOSPath(config);
62
62
  const podfilePath = (0, path_1.join)(config.ios.nativeProjectDirAbs, 'Podfile');
63
- let podfileContent = await (0, utils_fs_1.readFile)(podfilePath, { encoding: 'utf-8' });
63
+ let podfileContent = await (0, fs_extra_1.readFile)(podfilePath, { encoding: 'utf-8' });
64
64
  podfileContent = podfileContent.replace(/(def capacitor_pods)[\s\S]+?(\nend)/, `$1${dependenciesContent}$2`);
65
65
  podfileContent = podfileContent.replace(/(require_relative)[\s\S]+?(@capacitor\/ios\/scripts\/pods_helpers')/, `require_relative '${relativeCapacitoriOSPath}/scripts/pods_helpers'`);
66
- await (0, utils_fs_1.writeFile)(podfilePath, podfileContent, { encoding: 'utf-8' });
66
+ await (0, fs_extra_1.writeFile)(podfilePath, podfileContent, { encoding: 'utf-8' });
67
67
  const podPath = await config.ios.podPath;
68
68
  const useBundler = podPath.startsWith('bundle');
69
69
  const podCommandExists = await (0, subprocess_1.isInstalled)('pod');
@@ -98,7 +98,7 @@ async function getRelativeCapacitoriOSPath(config) {
98
98
  (0, errors_1.fatal)(`Unable to find ${colors_1.default.strong('node_modules/@capacitor/ios')}.\n` +
99
99
  `Are you sure ${colors_1.default.strong('@capacitor/ios')} is installed?`);
100
100
  }
101
- return (0, fs_1.convertToUnixPath)((0, path_1.relative)(config.ios.nativeProjectDirAbs, await (0, utils_fs_1.realpath)((0, path_1.dirname)(capacitoriOSPath))));
101
+ return (0, fs_1.convertToUnixPath)((0, path_1.relative)(config.ios.nativeProjectDirAbs, await (0, fs_extra_1.realpath)((0, path_1.dirname)(capacitoriOSPath))));
102
102
  }
103
103
  async function generatePodFile(config, plugins) {
104
104
  const relativeCapacitoriOSPath = await getRelativeCapacitoriOSPath(config);
@@ -107,7 +107,7 @@ async function generatePodFile(config, plugins) {
107
107
  if (!p.ios) {
108
108
  return '';
109
109
  }
110
- return ` pod '${p.ios.name}', :path => '${(0, fs_1.convertToUnixPath)((0, path_1.relative)(config.ios.nativeProjectDirAbs, await (0, utils_fs_1.realpath)(p.rootPath)))}'\n`;
110
+ return ` pod '${p.ios.name}', :path => '${(0, fs_1.convertToUnixPath)((0, path_1.relative)(config.ios.nativeProjectDirAbs, await (0, fs_extra_1.realpath)(p.rootPath)))}'\n`;
111
111
  }));
112
112
  const cordovaPlugins = plugins.filter((p) => (0, plugin_1.getPluginType)(p, platform) === 1 /* PluginType.Cordova */);
113
113
  cordovaPlugins.map(async (p) => {
@@ -302,7 +302,7 @@ async function generateCordovaPodspec(cordovaPlugins, config, isStatic) {
302
302
  s.swift_version = '5.1'
303
303
  ${frameworksString}
304
304
  end`;
305
- await (0, utils_fs_1.writeFile)((0, path_1.join)(config.ios.cordovaPluginsDirAbs, `${name}.podspec`), content);
305
+ await (0, fs_extra_1.writeFile)((0, path_1.join)(config.ios.cordovaPluginsDirAbs, `${name}.podspec`), content);
306
306
  }
307
307
  function getLinkerFlags(config) {
308
308
  var _a;
@@ -334,28 +334,28 @@ async function copyPluginsNativeFiles(config, cordovaPlugins) {
334
334
  }
335
335
  const filePath = (0, plugin_1.getFilePath)(config, p, codeFile.$.src);
336
336
  const fileDest = (0, path_1.join)(config.ios.cordovaPluginsDirAbs, destFolder, p.name, fileName);
337
- await (0, utils_fs_1.copy)(filePath, fileDest);
337
+ await (0, fs_extra_1.copy)(filePath, fileDest);
338
338
  if (!codeFile.$.framework) {
339
- let fileContent = await (0, utils_fs_1.readFile)(fileDest, { encoding: 'utf-8' });
339
+ let fileContent = await (0, fs_extra_1.readFile)(fileDest, { encoding: 'utf-8' });
340
340
  if (fileExt === 'swift') {
341
341
  fileContent = 'import Cordova\n' + fileContent;
342
- await (0, utils_fs_1.writeFile)(fileDest, fileContent, { encoding: 'utf-8' });
342
+ await (0, fs_extra_1.writeFile)(fileDest, fileContent, { encoding: 'utf-8' });
343
343
  }
344
344
  else {
345
345
  if (fileContent.includes('@import Firebase;')) {
346
346
  fileContent = fileContent.replace('@import Firebase;', '#import <Firebase/Firebase.h>');
347
- await (0, utils_fs_1.writeFile)(fileDest, fileContent, { encoding: 'utf-8' });
347
+ await (0, fs_extra_1.writeFile)(fileDest, fileContent, { encoding: 'utf-8' });
348
348
  }
349
349
  if (fileContent.includes('[NSBundle bundleForClass:[self class]]') ||
350
350
  fileContent.includes('[NSBundle bundleForClass:[CDVCapture class]]')) {
351
351
  fileContent = fileContent.replace('[NSBundle bundleForClass:[self class]]', '[NSBundle mainBundle]');
352
352
  fileContent = fileContent.replace('[NSBundle bundleForClass:[CDVCapture class]]', '[NSBundle mainBundle]');
353
- await (0, utils_fs_1.writeFile)(fileDest, fileContent, { encoding: 'utf-8' });
353
+ await (0, fs_extra_1.writeFile)(fileDest, fileContent, { encoding: 'utf-8' });
354
354
  }
355
355
  if (fileContent.includes('[self.webView superview]') || fileContent.includes('self.webView.superview')) {
356
356
  fileContent = fileContent.replace(/\[self.webView superview\]/g, 'self.viewController.view');
357
357
  fileContent = fileContent.replace(/self.webView.superview/g, 'self.viewController.view');
358
- await (0, utils_fs_1.writeFile)(fileDest, fileContent, { encoding: 'utf-8' });
358
+ await (0, fs_extra_1.writeFile)(fileDest, fileContent, { encoding: 'utf-8' });
359
359
  }
360
360
  }
361
361
  }
@@ -363,17 +363,17 @@ async function copyPluginsNativeFiles(config, cordovaPlugins) {
363
363
  const resourceFiles = (0, plugin_1.getPlatformElement)(p, platform, 'resource-file');
364
364
  for (const resourceFile of resourceFiles) {
365
365
  const fileName = resourceFile.$.src.split('/').pop();
366
- await (0, utils_fs_1.copy)((0, plugin_1.getFilePath)(config, p, resourceFile.$.src), (0, path_1.join)(config.ios.cordovaPluginsDirAbs, 'resources', fileName));
366
+ await (0, fs_extra_1.copy)((0, plugin_1.getFilePath)(config, p, resourceFile.$.src), (0, path_1.join)(config.ios.cordovaPluginsDirAbs, 'resources', fileName));
367
367
  }
368
368
  for (const framework of frameworks) {
369
369
  if (framework.$.custom && framework.$.custom === 'true') {
370
- await (0, utils_fs_1.copy)((0, plugin_1.getFilePath)(config, p, framework.$.src), (0, path_1.join)(sourcesFolder, framework.$.src));
370
+ await (0, fs_extra_1.copy)((0, plugin_1.getFilePath)(config, p, framework.$.src), (0, path_1.join)(sourcesFolder, framework.$.src));
371
371
  }
372
372
  }
373
373
  }
374
374
  }
375
375
  async function removePluginsNativeFiles(config) {
376
- await (0, utils_fs_1.remove)(config.ios.cordovaPluginsDirAbs);
376
+ await (0, fs_extra_1.remove)(config.ios.cordovaPluginsDirAbs);
377
377
  await (0, template_1.extractTemplate)(config.cli.assets.ios.cordovaPluginsTemplateArchiveAbs, config.ios.cordovaPluginsDirAbs);
378
378
  }
379
379
  function filterResources(plugin) {
package/dist/ipc.js CHANGED
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.receive = exports.send = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const utils_fs_1 = require("@ionic/utils-fs");
6
5
  const utils_subprocess_1 = require("@ionic/utils-subprocess");
7
6
  const debug_1 = tslib_1.__importDefault(require("debug"));
7
+ const fs_extra_1 = require("fs-extra");
8
8
  const https_1 = require("https");
9
9
  const path_1 = require("path");
10
10
  const cli_1 = require("./util/cli");
@@ -14,10 +14,10 @@ const debug = (0, debug_1.default)('capacitor:ipc');
14
14
  */
15
15
  async function send(msg) {
16
16
  const dir = cli_1.ENV_PATHS.log;
17
- await (0, utils_fs_1.mkdirp)(dir);
17
+ await (0, fs_extra_1.mkdirp)(dir);
18
18
  const logPath = (0, path_1.resolve)(dir, 'ipc.log');
19
19
  debug('Sending %O IPC message to forked process (logs: %O)', msg.type, logPath);
20
- const fd = await (0, utils_fs_1.open)(logPath, 'a');
20
+ const fd = await (0, fs_extra_1.open)(logPath, 'a');
21
21
  const p = (0, utils_subprocess_1.fork)(process.argv[1], ['📡'], { stdio: ['ignore', fd, fd, 'ipc'] });
22
22
  p.send(msg);
23
23
  p.disconnect();
package/dist/plugin.js CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAllElements = exports.getFilePath = exports.getAssets = exports.getJSModules = exports.getPluginType = exports.getPlatformElement = exports.getPluginPlatform = exports.printPlugins = exports.fixName = exports.getDependencies = exports.resolvePlugin = exports.getPlugins = exports.getIncludedPluginPackages = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const utils_fs_1 = require("@ionic/utils-fs");
5
+ const fs_extra_1 = require("fs-extra");
6
6
  const path_1 = require("path");
7
7
  const colors_1 = tslib_1.__importDefault(require("./colors"));
8
8
  const errors_1 = require("./errors");
@@ -34,7 +34,7 @@ async function resolvePlugin(config, name) {
34
34
  (0, errors_1.fatal)(`Unable to find ${colors_1.default.strong(`node_modules/${name}`)}.\n` + `Are you sure ${colors_1.default.strong(name)} is installed?`);
35
35
  }
36
36
  const rootPath = (0, path_1.dirname)(packagePath);
37
- const meta = await (0, utils_fs_1.readJSON)(packagePath);
37
+ const meta = await (0, fs_extra_1.readJSON)(packagePath);
38
38
  if (!meta) {
39
39
  return null;
40
40
  }
package/dist/sysconfig.js CHANGED
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.writeConfig = exports.readConfig = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const utils_fs_1 = require("@ionic/utils-fs");
6
5
  const debug_1 = tslib_1.__importDefault(require("debug"));
6
+ const fs_extra_1 = require("fs-extra");
7
7
  const path_1 = require("path");
8
8
  const cli_1 = require("./util/cli");
9
9
  const uuid_1 = require("./util/uuid");
@@ -13,7 +13,7 @@ const SYSCONFIG_PATH = (0, path_1.resolve)(cli_1.ENV_PATHS.config, SYSCONFIG_FIL
13
13
  async function readConfig() {
14
14
  debug('Reading from %O', SYSCONFIG_PATH);
15
15
  try {
16
- return await (0, utils_fs_1.readJSON)(SYSCONFIG_PATH);
16
+ return await (0, fs_extra_1.readJSON)(SYSCONFIG_PATH);
17
17
  }
18
18
  catch (e) {
19
19
  if (e.code !== 'ENOENT') {
@@ -29,7 +29,7 @@ async function readConfig() {
29
29
  exports.readConfig = readConfig;
30
30
  async function writeConfig(sysconfig) {
31
31
  debug('Writing to %O', SYSCONFIG_PATH);
32
- await (0, utils_fs_1.mkdirp)((0, path_1.dirname)(SYSCONFIG_PATH));
33
- await (0, utils_fs_1.writeJSON)(SYSCONFIG_PATH, sysconfig, { spaces: '\t' });
32
+ await (0, fs_extra_1.mkdirp)((0, path_1.dirname)(SYSCONFIG_PATH));
33
+ await (0, fs_extra_1.writeJSON)(SYSCONFIG_PATH, sysconfig, { spaces: '\t' });
34
34
  }
35
35
  exports.writeConfig = writeConfig;
package/dist/tasks/add.js CHANGED
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addCommand = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const utils_fs_1 = require("@ionic/utils-fs");
6
5
  const utils_terminal_1 = require("@ionic/utils-terminal");
6
+ const fs_extra_1 = require("fs-extra");
7
7
  const add_1 = require("../android/add");
8
8
  const common_1 = require("../android/common");
9
9
  const colors_1 = tslib_1.__importDefault(require("../colors"));
@@ -50,7 +50,7 @@ async function addCommand(config, selectedPlatformName) {
50
50
  await (0, common_2.check)([() => (0, common_2.checkPackage)(), () => (0, common_2.checkAppConfig)(config), ...addChecks(config, platformName)]);
51
51
  await doAdd(config, platformName);
52
52
  await editPlatforms(config, platformName);
53
- if (await (0, utils_fs_1.pathExists)(config.app.webDirAbs)) {
53
+ if (await (0, fs_extra_1.pathExists)(config.app.webDirAbs)) {
54
54
  await (0, sync_1.sync)(config, platformName, false, false);
55
55
  if (platformName === config.android.name) {
56
56
  await (0, common_2.runTask)('Syncing Gradle', async () => {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.copy = exports.copyCommand = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const utils_fs_1 = require("@ionic/utils-fs");
5
+ const fs_extra_1 = require("fs-extra");
6
6
  const path_1 = require("path");
7
7
  const colors_1 = tslib_1.__importDefault(require("../colors"));
8
8
  const common_1 = require("../common");
@@ -125,7 +125,7 @@ async function copyCapacitorConfig(config, nativeAbsDir) {
125
125
  await (0, common_1.runTask)(`Creating ${colors_1.default.strong(nativeConfigFile)} in ${nativeRelDir}`, async () => {
126
126
  var _a;
127
127
  (_a = config.app.extConfig.android) === null || _a === void 0 ? true : delete _a.buildOptions;
128
- await (0, utils_fs_1.writeJSON)(nativeConfigFilePath, config.app.extConfig, {
128
+ await (0, fs_extra_1.writeJSON)(nativeConfigFilePath, config.app.extConfig, {
129
129
  spaces: '\t',
130
130
  });
131
131
  });
@@ -134,14 +134,14 @@ async function copyWebDir(config, nativeAbsDir, webAbsDir) {
134
134
  var _a;
135
135
  const webRelDir = (0, path_1.basename)(webAbsDir);
136
136
  const nativeRelDir = (0, path_1.relative)(config.app.rootDir, nativeAbsDir);
137
- if (((_a = config.app.extConfig.server) === null || _a === void 0 ? void 0 : _a.url) && !(await (0, utils_fs_1.pathExists)(webAbsDir))) {
137
+ if (((_a = config.app.extConfig.server) === null || _a === void 0 ? void 0 : _a.url) && !(await (0, fs_extra_1.pathExists)(webAbsDir))) {
138
138
  log_1.logger.warn(`Cannot copy web assets from ${colors_1.default.strong(webRelDir)} to ${nativeRelDir}\n` +
139
139
  `Web asset directory specified by ${colors_1.default.input('webDir')} does not exist. This is not an error because ${colors_1.default.input('server.url')} is set in config.`);
140
140
  return;
141
141
  }
142
142
  await (0, common_1.runTask)(`Copying web assets from ${colors_1.default.strong(webRelDir)} to ${nativeRelDir}`, async () => {
143
- await (0, utils_fs_1.remove)(nativeAbsDir);
144
- return (0, utils_fs_1.copy)(webAbsDir, nativeAbsDir);
143
+ await (0, fs_extra_1.remove)(nativeAbsDir);
144
+ return (0, fs_extra_1.copy)(webAbsDir, nativeAbsDir);
145
145
  });
146
146
  }
147
147
  async function copyFederatedWebDirs(config, nativeAbsDir) {
@@ -177,20 +177,20 @@ async function copySecureLiveUpdatesKey(secureLiveUpdatesKeyFile, rootDir, nativ
177
177
  const keyAbsFromPath = (0, path_1.join)(rootDir, secureLiveUpdatesKeyFile);
178
178
  const keyAbsToPath = (0, path_1.join)(nativeAbsDir, (0, path_1.basename)(keyAbsFromPath));
179
179
  const keyRelToDir = (0, path_1.relative)(rootDir, nativeAbsDir);
180
- if (!(await (0, utils_fs_1.pathExists)(keyAbsFromPath))) {
180
+ if (!(await (0, fs_extra_1.pathExists)(keyAbsFromPath))) {
181
181
  log_1.logger.warn(`Cannot copy Secure Live Updates signature file from ${colors_1.default.strong(keyAbsFromPath)} to ${keyRelToDir}\n` +
182
182
  `Signature file does not exist at specified key path.`);
183
183
  return;
184
184
  }
185
185
  await (0, common_1.runTask)(`Copying Secure Live Updates key from ${colors_1.default.strong(secureLiveUpdatesKeyFile)} to ${keyRelToDir}`, async () => {
186
- return (0, utils_fs_1.copy)(keyAbsFromPath, keyAbsToPath);
186
+ return (0, fs_extra_1.copy)(keyAbsFromPath, keyAbsToPath);
187
187
  });
188
188
  }
189
189
  async function copySSLCert(sslCertPaths, rootDir, targetDir) {
190
190
  const validCertPaths = [];
191
191
  for (const sslCertPath of sslCertPaths) {
192
192
  const certAbsFromPath = (0, path_1.join)(rootDir, sslCertPath);
193
- if (!(await (0, utils_fs_1.pathExists)(certAbsFromPath))) {
193
+ if (!(await (0, fs_extra_1.pathExists)(certAbsFromPath))) {
194
194
  log_1.logger.warn(`Cannot copy SSL Certificate file from ${colors_1.default.strong(certAbsFromPath)}\n` +
195
195
  `SSL Certificate does not exist at specified path.`);
196
196
  return;
@@ -202,7 +202,7 @@ async function copySSLCert(sslCertPaths, rootDir, targetDir) {
202
202
  await (0, common_1.runTask)(`Copying SSL Certificates from to ${certsDirRelToDir}`, async () => {
203
203
  const promises = [];
204
204
  for (const certPath of validCertPaths) {
205
- promises.push((0, utils_fs_1.copy)(certPath, (0, path_1.join)(certsDirAbsToPath, (0, path_1.basename)(certPath))));
205
+ promises.push((0, fs_extra_1.copy)(certPath, (0, path_1.join)(certsDirAbsToPath, (0, path_1.basename)(certPath))));
206
206
  }
207
207
  return Promise.all(promises);
208
208
  });
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.doctor = exports.doctorCore = exports.doctorCommand = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const utils_fs_1 = require("@ionic/utils-fs");
5
+ const fs_extra_1 = require("fs-extra");
6
6
  const doctor_1 = require("../android/doctor");
7
7
  const colors_1 = tslib_1.__importDefault(require("../colors"));
8
8
  const common_1 = require("../common");
@@ -47,7 +47,7 @@ async function printInstalledPackages(config) {
47
47
  async function printPackageVersion(packageName, packagePath) {
48
48
  let version;
49
49
  if (packagePath) {
50
- version = (await (0, utils_fs_1.readJSON)(packagePath)).version;
50
+ version = (await (0, fs_extra_1.readJSON)(packagePath)).version;
51
51
  }
52
52
  log_1.output.write(` ${packageName}: ${colors_1.default.weak(version || 'not installed')}\n`);
53
53
  }