@capacitor/cli 6.2.0 → 7.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.
- package/assets/android-template.tar.gz +0 -0
- package/assets/capacitor-cordova-android-plugins.tar.gz +0 -0
- package/assets/capacitor-cordova-ios-plugins.tar.gz +0 -0
- package/assets/ios-pods-template.tar.gz +0 -0
- package/assets/ios-spm-template.tar.gz +0 -0
- package/dist/android/build.js +1 -3
- package/dist/android/common.js +2 -5
- package/dist/android/doctor.js +7 -11
- package/dist/android/run.js +1 -1
- package/dist/android/update.js +12 -17
- package/dist/common.js +25 -25
- package/dist/config.js +4 -16
- package/dist/cordova.js +31 -63
- package/dist/declarations.d.ts +0 -24
- package/dist/framework-configs.js +14 -14
- package/dist/index.js +14 -14
- package/dist/ios/common.js +3 -8
- package/dist/ios/doctor.js +1 -5
- package/dist/ios/run.js +2 -4
- package/dist/ios/update.js +22 -35
- package/dist/ipc.js +2 -2
- package/dist/log.js +1 -3
- package/dist/plugin.js +4 -8
- package/dist/tasks/add.js +2 -9
- package/dist/tasks/build.js +4 -9
- package/dist/tasks/config.js +1 -4
- package/dist/tasks/copy.js +6 -13
- package/dist/tasks/create.js +1 -2
- package/dist/tasks/doctor.js +2 -7
- package/dist/tasks/init.js +10 -11
- package/dist/tasks/list.js +4 -4
- package/dist/tasks/migrate.js +13 -37
- package/dist/tasks/new-plugin.js +1 -2
- package/dist/tasks/open.js +1 -1
- package/dist/tasks/run.js +5 -6
- package/dist/tasks/sourcemaps.js +2 -3
- package/dist/tasks/sync.js +2 -6
- package/dist/tasks/telemetry.js +3 -2
- package/dist/tasks/update.js +1 -1
- package/dist/telemetry.js +7 -18
- package/dist/util/fs.js +1 -1
- package/dist/util/iosplugin.js +2 -3
- package/dist/util/livereload.js +3 -6
- package/dist/util/monorepotools.js +1 -2
- package/dist/util/promise.js +1 -1
- package/dist/util/spm.js +3 -5
- package/dist/util/subprocess.js +1 -7
- package/dist/util/term.js +1 -1
- package/dist/util/uuid.js +1 -1
- package/dist/util/xml.js +2 -4
- package/package.json +2 -2
- package/dist/web/copy.js +0 -22
package/dist/cordova.js
CHANGED
|
@@ -21,7 +21,7 @@ const xml_1 = require("./util/xml");
|
|
|
21
21
|
function generateCordovaPluginsJSFile(config, plugins, platform) {
|
|
22
22
|
const pluginModules = [];
|
|
23
23
|
const pluginExports = [];
|
|
24
|
-
plugins.map(p => {
|
|
24
|
+
plugins.map((p) => {
|
|
25
25
|
const pluginId = p.xml.$.id;
|
|
26
26
|
const jsModules = (0, plugin_1.getJSModules)(p, platform);
|
|
27
27
|
jsModules.map((jsModule) => {
|
|
@@ -60,9 +60,7 @@ function generateCordovaPluginsJSFile(config, plugins, platform) {
|
|
|
60
60
|
merge: mergeKey,
|
|
61
61
|
// mimics Cordova's module name logic if the name attr is missing
|
|
62
62
|
pluginContent: `{
|
|
63
|
-
"id": "${pluginId +
|
|
64
|
-
'.' +
|
|
65
|
-
(jsModule.$.name || jsModule.$.src.match(/([^/]+)\.js/)[1])}",
|
|
63
|
+
"id": "${pluginId + '.' + (jsModule.$.name || jsModule.$.src.match(/([^/]+)\.js/)[1])}",
|
|
66
64
|
"file": "plugins/${pluginId}/${jsModule.$.src}",
|
|
67
65
|
"pluginId": "${pluginId}"${clobbersModule}${mergesModule}${runsModule}
|
|
68
66
|
}`,
|
|
@@ -80,7 +78,7 @@ function generateCordovaPluginsJSFile(config, plugins, platform) {
|
|
|
80
78
|
: a.clobber || b.clobber // Clobbers before anything else
|
|
81
79
|
? b.clobber.localeCompare(a.clobber)
|
|
82
80
|
: a.merge.localeCompare(b.merge))
|
|
83
|
-
.map(e => e.pluginContent)
|
|
81
|
+
.map((e) => e.pluginContent)
|
|
84
82
|
.join(',\n ')}
|
|
85
83
|
];
|
|
86
84
|
module.exports.metadata =
|
|
@@ -112,10 +110,7 @@ async function copyPluginsJS(config, cordovaPlugins, platform) {
|
|
|
112
110
|
let data = await (0, utils_fs_1.readFile)(filePath, { encoding: 'utf-8' });
|
|
113
111
|
data = data.trim();
|
|
114
112
|
// mimics Cordova's module name logic if the name attr is missing
|
|
115
|
-
const name = pluginId +
|
|
116
|
-
'.' +
|
|
117
|
-
(jsModule.$.name ||
|
|
118
|
-
(0, path_1.basename)(jsModule.$.src, (0, path_1.extname)(jsModule.$.src)));
|
|
113
|
+
const name = pluginId + '.' + (jsModule.$.name || (0, path_1.basename)(jsModule.$.src, (0, path_1.extname)(jsModule.$.src)));
|
|
119
114
|
data = `cordova.define("${name}", function(require, exports, module) { \n${data}\n});`;
|
|
120
115
|
data = data.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script\s*>/gi, '');
|
|
121
116
|
await (0, utils_fs_1.writeFile)(filePath, data, { encoding: 'utf-8' });
|
|
@@ -132,7 +127,8 @@ exports.copyPluginsJS = copyPluginsJS;
|
|
|
132
127
|
async function copyCordovaJS(config, platform) {
|
|
133
128
|
const cordovaPath = (0, node_1.resolveNode)(config.app.rootDir, '@capacitor/core', 'cordova.js');
|
|
134
129
|
if (!cordovaPath) {
|
|
135
|
-
(0, errors_1.fatal)(`Unable to find ${colors_1.default.strong('node_modules/@capacitor/core/cordova.js')}.\n` +
|
|
130
|
+
(0, errors_1.fatal)(`Unable to find ${colors_1.default.strong('node_modules/@capacitor/core/cordova.js')}.\n` +
|
|
131
|
+
`Are you sure ${colors_1.default.strong('@capacitor/core')} is installed?`);
|
|
136
132
|
}
|
|
137
133
|
return (0, utils_fs_1.copy)(cordovaPath, (0, path_1.join)(await getWebDir(config, platform), 'cordova.js'));
|
|
138
134
|
}
|
|
@@ -162,7 +158,7 @@ async function autoGenerateConfig(config, cordovaPlugins, platform) {
|
|
|
162
158
|
const cordovaConfigXMLFile = (0, path_1.join)(xmlDir, fileName);
|
|
163
159
|
await (0, utils_fs_1.remove)(cordovaConfigXMLFile);
|
|
164
160
|
const pluginEntries = [];
|
|
165
|
-
cordovaPlugins.map(p => {
|
|
161
|
+
cordovaPlugins.map((p) => {
|
|
166
162
|
const currentPlatform = (0, plugin_1.getPluginPlatform)(p, platform);
|
|
167
163
|
if (currentPlatform) {
|
|
168
164
|
const configFiles = currentPlatform['config-file'];
|
|
@@ -243,11 +239,11 @@ async function getCordovaPlugins(config, platform) {
|
|
|
243
239
|
else if (platform === config.android.name) {
|
|
244
240
|
plugins = await (0, common_1.getAndroidPlugins)(allPlugins);
|
|
245
241
|
}
|
|
246
|
-
return plugins.filter(p => (0, plugin_1.getPluginType)(p, platform) === 1 /* PluginType.Cordova */);
|
|
242
|
+
return plugins.filter((p) => (0, plugin_1.getPluginType)(p, platform) === 1 /* PluginType.Cordova */);
|
|
247
243
|
}
|
|
248
244
|
exports.getCordovaPlugins = getCordovaPlugins;
|
|
249
245
|
async function logCordovaManualSteps(cordovaPlugins, config, platform) {
|
|
250
|
-
cordovaPlugins.map(p => {
|
|
246
|
+
cordovaPlugins.map((p) => {
|
|
251
247
|
const editConfig = (0, plugin_1.getPlatformElement)(p, platform, 'edit-config');
|
|
252
248
|
const configFile = (0, plugin_1.getPlatformElement)(p, platform, 'config-file');
|
|
253
249
|
editConfig.concat(configFile).map(async (configElement) => {
|
|
@@ -280,14 +276,10 @@ async function logiOSPlist(configElement, config, plugin) {
|
|
|
280
276
|
if (!dict.key.includes(configElement.$.parent)) {
|
|
281
277
|
let xml = buildConfigFileXml(configElement);
|
|
282
278
|
xml = `<key>${configElement.$.parent}</key>${getConfigFileTagContent(xml)}`;
|
|
283
|
-
log_1.logger.warn(`Configuration required for ${colors_1.default.strong(plugin.id)}.\n` +
|
|
284
|
-
`Add the following to Info.plist:\n` +
|
|
285
|
-
xml);
|
|
279
|
+
log_1.logger.warn(`Configuration required for ${colors_1.default.strong(plugin.id)}.\n` + `Add the following to Info.plist:\n` + xml);
|
|
286
280
|
}
|
|
287
281
|
else if (configElement.array || configElement.dict) {
|
|
288
|
-
if (configElement.array &&
|
|
289
|
-
configElement.array.length > 0 &&
|
|
290
|
-
configElement.array[0].string) {
|
|
282
|
+
if (configElement.array && configElement.array.length > 0 && configElement.array[0].string) {
|
|
291
283
|
let xml = '';
|
|
292
284
|
configElement.array[0].string.map((element) => {
|
|
293
285
|
const d = plistData[configElement.$.parent];
|
|
@@ -356,8 +348,7 @@ async function logiOSPlist(configElement, config, plugin) {
|
|
|
356
348
|
parsedRequiredElements.push(rootOfRequiredElementsToAdd);
|
|
357
349
|
const doesContainElements = (requiredElementsArray, existingElementsArray) => {
|
|
358
350
|
for (const requiredElement of requiredElementsArray) {
|
|
359
|
-
if (requiredElement.name === 'key' ||
|
|
360
|
-
requiredElement.name === 'string') {
|
|
351
|
+
if (requiredElement.name === 'key' || requiredElement.name === 'string') {
|
|
361
352
|
let foundMatch = false;
|
|
362
353
|
for (const existingElement of existingElementsArray) {
|
|
363
354
|
if (existingElement.name === requiredElement.name &&
|
|
@@ -375,8 +366,7 @@ async function logiOSPlist(configElement, config, plugin) {
|
|
|
375
366
|
let foundMatch = false;
|
|
376
367
|
for (const existingElement of existingElementsArray) {
|
|
377
368
|
if (existingElement.name === requiredElement.name) {
|
|
378
|
-
if ((requiredElement.children !== undefined) ===
|
|
379
|
-
(existingElement.children !== undefined)) {
|
|
369
|
+
if ((requiredElement.children !== undefined) === (existingElement.children !== undefined)) {
|
|
380
370
|
if (doesContainElements(requiredElement.children, existingElement.children)) {
|
|
381
371
|
foundMatch = true;
|
|
382
372
|
break;
|
|
@@ -422,8 +412,8 @@ function removeOuterTags(str) {
|
|
|
422
412
|
}
|
|
423
413
|
async function checkPluginDependencies(plugins, platform) {
|
|
424
414
|
const pluginDeps = new Map();
|
|
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 */);
|
|
415
|
+
const cordovaPlugins = plugins.filter((p) => (0, plugin_1.getPluginType)(p, platform) === 1 /* PluginType.Cordova */);
|
|
416
|
+
const incompatible = plugins.filter((p) => (0, plugin_1.getPluginType)(p, platform) === 2 /* PluginType.Incompatible */);
|
|
427
417
|
await Promise.all(cordovaPlugins.map(async (p) => {
|
|
428
418
|
let allDependencies = [];
|
|
429
419
|
allDependencies = allDependencies.concat((0, plugin_1.getPlatformElement)(p, platform, 'dependency'));
|
|
@@ -431,8 +421,7 @@ async function checkPluginDependencies(plugins, platform) {
|
|
|
431
421
|
allDependencies = allDependencies.concat(p.xml['dependency']);
|
|
432
422
|
}
|
|
433
423
|
allDependencies = allDependencies.filter((dep) => !getIncompatibleCordovaPlugins(platform).includes(dep.$.id) &&
|
|
434
|
-
incompatible.filter(p => p.id === dep.$.id || p.xml.$.id === dep.$.id)
|
|
435
|
-
.length === 0);
|
|
424
|
+
incompatible.filter((p) => p.id === dep.$.id || p.xml.$.id === dep.$.id).length === 0);
|
|
436
425
|
if (allDependencies) {
|
|
437
426
|
await Promise.all(allDependencies.map(async (dep) => {
|
|
438
427
|
var _a;
|
|
@@ -441,7 +430,7 @@ async function checkPluginDependencies(plugins, platform) {
|
|
|
441
430
|
if (plugin.includes('@') && plugin.indexOf('@') !== 0) {
|
|
442
431
|
[plugin, version] = plugin.split('@');
|
|
443
432
|
}
|
|
444
|
-
if (cordovaPlugins.filter(p => p.id === plugin || p.xml.$.id === plugin).length === 0) {
|
|
433
|
+
if (cordovaPlugins.filter((p) => p.id === plugin || p.xml.$.id === plugin).length === 0) {
|
|
445
434
|
if ((_a = dep.$.url) === null || _a === void 0 ? void 0 : _a.startsWith('http')) {
|
|
446
435
|
plugin = dep.$.url;
|
|
447
436
|
version = dep.$.commit;
|
|
@@ -457,9 +446,7 @@ async function checkPluginDependencies(plugins, platform) {
|
|
|
457
446
|
let msg = `${colors_1.default.failure(colors_1.default.strong('Plugins are missing dependencies.'))}\n` +
|
|
458
447
|
`Cordova plugin dependencies must be installed in your project (e.g. w/ ${colors_1.default.input('npm install')}).\n`;
|
|
459
448
|
for (const [plugin, deps] of pluginDeps.entries()) {
|
|
460
|
-
msg +=
|
|
461
|
-
`\n ${colors_1.default.strong(plugin)} is missing dependencies:\n` +
|
|
462
|
-
deps.map(d => ` - ${d}`).join('\n');
|
|
449
|
+
msg += `\n ${colors_1.default.strong(plugin)} is missing dependencies:\n` + deps.map((d) => ` - ${d}`).join('\n');
|
|
463
450
|
}
|
|
464
451
|
log_1.logger.warn(`${msg}\n`);
|
|
465
452
|
}
|
|
@@ -490,18 +477,8 @@ function getIncompatibleCordovaPlugins(platform) {
|
|
|
490
477
|
return pluginList;
|
|
491
478
|
}
|
|
492
479
|
exports.getIncompatibleCordovaPlugins = getIncompatibleCordovaPlugins;
|
|
493
|
-
function needsStaticPod(plugin
|
|
494
|
-
|
|
495
|
-
let pluginList = [
|
|
496
|
-
'phonegap-plugin-push',
|
|
497
|
-
'@batch.com/cordova-plugin',
|
|
498
|
-
'onesignal-cordova-plugin',
|
|
499
|
-
];
|
|
500
|
-
if ((_b = (_a = config.app.extConfig) === null || _a === void 0 ? void 0 : _a.cordova) === null || _b === void 0 ? void 0 : _b.staticPlugins) {
|
|
501
|
-
log_1.logger.warn('cordova.staticPlugins is deprecated, make sure you are using latest version of the plugin');
|
|
502
|
-
pluginList = pluginList.concat((_d = (_c = config.app.extConfig) === null || _c === void 0 ? void 0 : _c.cordova) === null || _d === void 0 ? void 0 : _d.staticPlugins);
|
|
503
|
-
}
|
|
504
|
-
return pluginList.includes(plugin.id) || useFrameworks(plugin);
|
|
480
|
+
function needsStaticPod(plugin) {
|
|
481
|
+
return useFrameworks(plugin);
|
|
505
482
|
}
|
|
506
483
|
exports.needsStaticPod = needsStaticPod;
|
|
507
484
|
function useFrameworks(plugin) {
|
|
@@ -573,16 +550,14 @@ async function writeCordovaAndroidManifest(cordovaPlugins, config, platform, cle
|
|
|
573
550
|
if (configElement.$ &&
|
|
574
551
|
(((_a = configElement.$.target) === null || _a === void 0 ? void 0 : _a.includes('AndroidManifest.xml')) ||
|
|
575
552
|
((_b = configElement.$.file) === null || _b === void 0 ? void 0 : _b.includes('AndroidManifest.xml')))) {
|
|
576
|
-
const keys = Object.keys(configElement).filter(k => k !== '$');
|
|
577
|
-
keys.map(k => {
|
|
553
|
+
const keys = Object.keys(configElement).filter((k) => k !== '$');
|
|
554
|
+
keys.map((k) => {
|
|
578
555
|
configElement[k].map(async (e) => {
|
|
579
556
|
const xmlElement = (0, xml_1.buildXmlElement)(e, k);
|
|
580
557
|
const pathParts = getPathParts(configElement.$.parent || configElement.$.target);
|
|
581
558
|
if (pathParts.length > 1) {
|
|
582
559
|
if (pathParts.pop() === 'application') {
|
|
583
|
-
if (configElement.$.mode &&
|
|
584
|
-
configElement.$.mode === 'merge' &&
|
|
585
|
-
xmlElement.startsWith('<application')) {
|
|
560
|
+
if (configElement.$.mode && configElement.$.mode === 'merge' && xmlElement.startsWith('<application')) {
|
|
586
561
|
Object.keys(e.$).map((ek) => {
|
|
587
562
|
applicationXMLAttributes.push(`${ek}="${e.$[ek]}"`);
|
|
588
563
|
});
|
|
@@ -657,8 +632,7 @@ async function writeCordovaAndroidManifest(cordovaPlugins, config, platform, cle
|
|
|
657
632
|
if (requiredElement.name !== existingElement.name) {
|
|
658
633
|
return false;
|
|
659
634
|
}
|
|
660
|
-
if ((requiredElement.attrs !== undefined) !==
|
|
661
|
-
(existingElement.attrs !== undefined)) {
|
|
635
|
+
if ((requiredElement.attrs !== undefined) !== (existingElement.attrs !== undefined)) {
|
|
662
636
|
return false;
|
|
663
637
|
}
|
|
664
638
|
else {
|
|
@@ -666,16 +640,14 @@ async function writeCordovaAndroidManifest(cordovaPlugins, config, platform, cle
|
|
|
666
640
|
const requiredELementAttrKeys = Object.keys(requiredElement.attrs);
|
|
667
641
|
for (const key of requiredELementAttrKeys) {
|
|
668
642
|
if (!/^[$].{1,}$/.test(requiredElement.attrs[key].trim())) {
|
|
669
|
-
if (requiredElement.attrs[key] !==
|
|
670
|
-
existingElement.attrs[key]) {
|
|
643
|
+
if (requiredElement.attrs[key] !== existingElement.attrs[key]) {
|
|
671
644
|
return false;
|
|
672
645
|
}
|
|
673
646
|
}
|
|
674
647
|
}
|
|
675
648
|
}
|
|
676
649
|
}
|
|
677
|
-
if ((requiredElement.children !== undefined) !==
|
|
678
|
-
(existingElement.children !== undefined) &&
|
|
650
|
+
if ((requiredElement.children !== undefined) !== (existingElement.children !== undefined) &&
|
|
679
651
|
((_a = requiredElement.children) === null || _a === void 0 ? void 0 : _a.length) !== 0) {
|
|
680
652
|
return false;
|
|
681
653
|
}
|
|
@@ -697,8 +669,7 @@ async function writeCordovaAndroidManifest(cordovaPlugins, config, platform, cle
|
|
|
697
669
|
}
|
|
698
670
|
}
|
|
699
671
|
else {
|
|
700
|
-
if (requiredElement.children === undefined &&
|
|
701
|
-
existingElement.children === undefined) {
|
|
672
|
+
if (requiredElement.children === undefined && existingElement.children === undefined) {
|
|
702
673
|
return true;
|
|
703
674
|
}
|
|
704
675
|
else {
|
|
@@ -736,8 +707,7 @@ async function writeCordovaAndroidManifest(cordovaPlugins, config, platform, cle
|
|
|
736
707
|
...requiredElements[rootKeyOfRequiredElements]['$'],
|
|
737
708
|
};
|
|
738
709
|
}
|
|
739
|
-
if (requiredElements[rootKeyOfRequiredElements]['$$'] !==
|
|
740
|
-
undefined) {
|
|
710
|
+
if (requiredElements[rootKeyOfRequiredElements]['$$'] !== undefined) {
|
|
741
711
|
parseXmlToSearchable(requiredElements[rootKeyOfRequiredElements]['$$'], rootOfRequiredElementsToAdd['children']);
|
|
742
712
|
}
|
|
743
713
|
parsedRequiredElements.push(rootOfRequiredElementsToAdd);
|
|
@@ -771,8 +741,7 @@ async function writeCordovaAndroidManifest(cordovaPlugins, config, platform, cle
|
|
|
771
741
|
}
|
|
772
742
|
}
|
|
773
743
|
else {
|
|
774
|
-
if (!rootXMLEntries.includes(xmlElement) &&
|
|
775
|
-
!contains(rootXMLEntries, xmlElement, k)) {
|
|
744
|
+
if (!rootXMLEntries.includes(xmlElement) && !contains(rootXMLEntries, xmlElement, k)) {
|
|
776
745
|
rootXMLEntries.push(xmlElement);
|
|
777
746
|
}
|
|
778
747
|
}
|
|
@@ -782,8 +751,7 @@ async function writeCordovaAndroidManifest(cordovaPlugins, config, platform, cle
|
|
|
782
751
|
});
|
|
783
752
|
});
|
|
784
753
|
const cleartextString = 'android:usesCleartextTraffic="true"';
|
|
785
|
-
const cleartextValue = (cleartext || ((_a = config.app.extConfig.server) === null || _a === void 0 ? void 0 : _a.cleartext)) &&
|
|
786
|
-
!applicationXMLAttributes.includes(cleartextString)
|
|
754
|
+
const cleartextValue = (cleartext || ((_a = config.app.extConfig.server) === null || _a === void 0 ? void 0 : _a.cleartext)) && !applicationXMLAttributes.includes(cleartextString)
|
|
787
755
|
? cleartextString
|
|
788
756
|
: '';
|
|
789
757
|
let content = `<?xml version='1.0' encoding='utf-8'?>
|
|
@@ -806,7 +774,7 @@ exports.writeCordovaAndroidManifest = writeCordovaAndroidManifest;
|
|
|
806
774
|
function getPathParts(path) {
|
|
807
775
|
const rootPath = 'manifest';
|
|
808
776
|
path = path.replace('/*', rootPath);
|
|
809
|
-
const parts = path.split('/').filter(part => part !== '');
|
|
777
|
+
const parts = path.split('/').filter((part) => part !== '');
|
|
810
778
|
if (parts.length > 1 || parts.includes(rootPath)) {
|
|
811
779
|
return parts;
|
|
812
780
|
}
|
package/dist/declarations.d.ts
CHANGED
|
@@ -26,20 +26,6 @@ export interface CapacitorConfig {
|
|
|
26
26
|
* @since 1.0.0
|
|
27
27
|
*/
|
|
28
28
|
webDir?: string;
|
|
29
|
-
/**
|
|
30
|
-
* Whether to copy the Capacitor runtime bundle or not.
|
|
31
|
-
*
|
|
32
|
-
* If your app is not using a bundler, set this to `true`, then Capacitor
|
|
33
|
-
* will create a `capacitor.js` file that you'll need to add as a script in
|
|
34
|
-
* your `index.html` file.
|
|
35
|
-
*
|
|
36
|
-
* It's deprecated and will be removed in Capacitor 6
|
|
37
|
-
*
|
|
38
|
-
* @since 1.0.0
|
|
39
|
-
* @deprecated 5.0.0
|
|
40
|
-
* @default false
|
|
41
|
-
*/
|
|
42
|
-
bundledWebRuntime?: boolean;
|
|
43
29
|
/**
|
|
44
30
|
* The build configuration (as defined by the native app) under which Capacitor
|
|
45
31
|
* will send statements to the log system. This applies to log statements in
|
|
@@ -523,16 +509,6 @@ export interface CapacitorConfig {
|
|
|
523
509
|
preferences?: {
|
|
524
510
|
[key: string]: string | undefined;
|
|
525
511
|
};
|
|
526
|
-
/**
|
|
527
|
-
* List of Cordova plugins that need to be static but are not
|
|
528
|
-
* already in the static plugin list.
|
|
529
|
-
*
|
|
530
|
-
* It's deprecated and will be removed in Capacitor 7
|
|
531
|
-
*
|
|
532
|
-
* @since 3.3.0
|
|
533
|
-
* @deprecated 6.1.1
|
|
534
|
-
*/
|
|
535
|
-
staticPlugins?: string[];
|
|
536
512
|
};
|
|
537
513
|
/**
|
|
538
514
|
* Configure plugins.
|
|
@@ -4,85 +4,85 @@ exports.detectFramework = void 0;
|
|
|
4
4
|
const FRAMEWORK_CONFIGS = [
|
|
5
5
|
{
|
|
6
6
|
name: 'Angular',
|
|
7
|
-
isMatch: config => hasDependency(config, '@angular/cli'),
|
|
7
|
+
isMatch: (config) => hasDependency(config, '@angular/cli'),
|
|
8
8
|
webDir: 'dist',
|
|
9
9
|
priority: 3,
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
12
|
name: 'Create React App',
|
|
13
|
-
isMatch: config => hasDependency(config, 'react-scripts'),
|
|
13
|
+
isMatch: (config) => hasDependency(config, 'react-scripts'),
|
|
14
14
|
webDir: 'build',
|
|
15
15
|
priority: 3,
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
name: 'Ember',
|
|
19
|
-
isMatch: config => hasDependency(config, 'ember-cli'),
|
|
19
|
+
isMatch: (config) => hasDependency(config, 'ember-cli'),
|
|
20
20
|
webDir: 'dist',
|
|
21
21
|
priority: 3,
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
24
|
name: 'Gatsby',
|
|
25
|
-
isMatch: config => hasDependency(config, 'gatsby'),
|
|
25
|
+
isMatch: (config) => hasDependency(config, 'gatsby'),
|
|
26
26
|
webDir: 'public',
|
|
27
27
|
priority: 2,
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
name: 'Ionic Angular',
|
|
31
|
-
isMatch: config => hasDependency(config, '@ionic/angular'),
|
|
31
|
+
isMatch: (config) => hasDependency(config, '@ionic/angular'),
|
|
32
32
|
webDir: 'www',
|
|
33
33
|
priority: 1,
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
name: 'Ionic React',
|
|
37
|
-
isMatch: config => hasDependency(config, '@ionic/react'),
|
|
37
|
+
isMatch: (config) => hasDependency(config, '@ionic/react'),
|
|
38
38
|
webDir: 'build',
|
|
39
39
|
priority: 1,
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
name: 'Ionic Vue',
|
|
43
|
-
isMatch: config => hasDependency(config, '@ionic/vue'),
|
|
43
|
+
isMatch: (config) => hasDependency(config, '@ionic/vue'),
|
|
44
44
|
webDir: 'public',
|
|
45
45
|
priority: 1,
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
48
|
name: 'Next',
|
|
49
|
-
isMatch: config => hasDependency(config, 'next'),
|
|
49
|
+
isMatch: (config) => hasDependency(config, 'next'),
|
|
50
50
|
webDir: 'public',
|
|
51
51
|
priority: 2,
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
name: 'Preact',
|
|
55
|
-
isMatch: config => hasDependency(config, 'preact-cli'),
|
|
55
|
+
isMatch: (config) => hasDependency(config, 'preact-cli'),
|
|
56
56
|
webDir: 'build',
|
|
57
57
|
priority: 3,
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
name: 'Stencil',
|
|
61
|
-
isMatch: config => hasDependency(config, '@stencil/core'),
|
|
61
|
+
isMatch: (config) => hasDependency(config, '@stencil/core'),
|
|
62
62
|
webDir: 'www',
|
|
63
63
|
priority: 3,
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
66
|
name: 'Svelte',
|
|
67
|
-
isMatch: config => hasDependency(config, 'svelte') && hasDependency(config, 'sirv-cli'),
|
|
67
|
+
isMatch: (config) => hasDependency(config, 'svelte') && hasDependency(config, 'sirv-cli'),
|
|
68
68
|
webDir: 'public',
|
|
69
69
|
priority: 3,
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
72
|
name: 'Vite',
|
|
73
|
-
isMatch: config => hasDependency(config, 'vite'),
|
|
73
|
+
isMatch: (config) => hasDependency(config, 'vite'),
|
|
74
74
|
webDir: 'dist',
|
|
75
75
|
priority: 2,
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
78
|
name: 'Vue',
|
|
79
|
-
isMatch: config => hasDependency(config, '@vue/cli-service'),
|
|
79
|
+
isMatch: (config) => hasDependency(config, '@vue/cli-service'),
|
|
80
80
|
webDir: 'dist',
|
|
81
81
|
priority: 3,
|
|
82
82
|
},
|
|
83
83
|
];
|
|
84
84
|
function detectFramework(config) {
|
|
85
|
-
const frameworks = FRAMEWORK_CONFIGS.filter(f => f.isMatch(config)).sort((a, b) => {
|
|
85
|
+
const frameworks = FRAMEWORK_CONFIGS.filter((f) => f.isMatch(config)).sort((a, b) => {
|
|
86
86
|
if (a.priority < b.priority)
|
|
87
87
|
return -1;
|
|
88
88
|
if (a.priority > b.priority)
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ const log_1 = require("./log");
|
|
|
12
12
|
const telemetry_1 = require("./telemetry");
|
|
13
13
|
const cli_1 = require("./util/cli");
|
|
14
14
|
const emoji_1 = require("./util/emoji");
|
|
15
|
-
process.on('unhandledRejection', error => {
|
|
15
|
+
process.on('unhandledRejection', (error) => {
|
|
16
16
|
console.error(colors_1.default.failure('[fatal]'), error);
|
|
17
17
|
});
|
|
18
18
|
process.on('message', ipc_1.receive);
|
|
@@ -48,9 +48,10 @@ function runProgram(config) {
|
|
|
48
48
|
.command('init [appName] [appId]')
|
|
49
49
|
.description(`Initialize Capacitor configuration`)
|
|
50
50
|
.option('--web-dir <value>', 'Optional: Directory of your projects built web assets')
|
|
51
|
-
.
|
|
51
|
+
.option('--skip-appid-validation', 'Optional: Skip validating the app ID for iOS and Android compatibility')
|
|
52
|
+
.action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (appName, appId, { webDir, skipAppidValidation }) => {
|
|
52
53
|
const { initCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/init')));
|
|
53
|
-
await initCommand(config, appName, appId, webDir);
|
|
54
|
+
await initCommand(config, appName, appId, webDir, skipAppidValidation);
|
|
54
55
|
})));
|
|
55
56
|
commander_1.program
|
|
56
57
|
.command('serve', { hidden: true })
|
|
@@ -65,7 +66,6 @@ function runProgram(config) {
|
|
|
65
66
|
.option('--deployment', 'Optional: if provided, pod install will use --deployment option')
|
|
66
67
|
.option('--inline', 'Optional: if true, all source maps will be inlined for easier debugging on mobile devices', false)
|
|
67
68
|
.action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { deployment, inline }) => {
|
|
68
|
-
(0, config_1.checkExternalConfig)(config.app);
|
|
69
69
|
const { syncCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/sync')));
|
|
70
70
|
await syncCommand(config, platform, deployment, inline);
|
|
71
71
|
})));
|
|
@@ -74,7 +74,6 @@ function runProgram(config) {
|
|
|
74
74
|
.description(`updates the native plugins and dependencies based on ${colors_1.default.strong('package.json')}`)
|
|
75
75
|
.option('--deployment', 'Optional: if provided, pod install will use --deployment option')
|
|
76
76
|
.action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { deployment }) => {
|
|
77
|
-
(0, config_1.checkExternalConfig)(config.app);
|
|
78
77
|
const { updateCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/update')));
|
|
79
78
|
await updateCommand(config, platform, deployment);
|
|
80
79
|
})));
|
|
@@ -83,7 +82,6 @@ function runProgram(config) {
|
|
|
83
82
|
.description('copies the web app build into the native app')
|
|
84
83
|
.option('--inline', 'Optional: if true, all source maps will be inlined for easier debugging on mobile devices', false)
|
|
85
84
|
.action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { inline }) => {
|
|
86
|
-
(0, config_1.checkExternalConfig)(config.app);
|
|
87
85
|
const { copyCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/copy')));
|
|
88
86
|
await copyCommand(config, platform, inline);
|
|
89
87
|
})));
|
|
@@ -97,8 +95,14 @@ function runProgram(config) {
|
|
|
97
95
|
.option('--keystorealias <keystoreAlias>', 'Key Alias in the keystore')
|
|
98
96
|
.option('--configuration <name>', 'Configuration name of the iOS Scheme')
|
|
99
97
|
.option('--keystorealiaspass <keystoreAliasPass>', 'Password for the Key Alias')
|
|
100
|
-
.addOption(new commander_1.Option('--androidreleasetype <androidreleasetype>', 'Android release type; APK or AAB').choices([
|
|
101
|
-
|
|
98
|
+
.addOption(new commander_1.Option('--androidreleasetype <androidreleasetype>', 'Android release type; APK or AAB').choices([
|
|
99
|
+
'AAB',
|
|
100
|
+
'APK',
|
|
101
|
+
]))
|
|
102
|
+
.addOption(new commander_1.Option('--signing-type <signingtype>', 'Program used to sign apps (default: jarsigner)').choices([
|
|
103
|
+
'apksigner',
|
|
104
|
+
'jarsigner',
|
|
105
|
+
]))
|
|
102
106
|
.action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { scheme, flavor, keystorepath, keystorepass, keystorealias, keystorealiaspass, androidreleasetype, signingType, configuration, }) => {
|
|
103
107
|
const { buildCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/build')));
|
|
104
108
|
await buildCommand(config, platform, {
|
|
@@ -128,7 +132,7 @@ function runProgram(config) {
|
|
|
128
132
|
.option('--host <host>', 'Host used for live reload')
|
|
129
133
|
.option('--port <port>', 'Port used for live reload')
|
|
130
134
|
.option('--configuration <name>', 'Configuration name of the iOS Scheme')
|
|
131
|
-
.action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { scheme, flavor, list, target, sync, forwardPorts, liveReload, host, port, configuration
|
|
135
|
+
.action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { scheme, flavor, list, target, sync, forwardPorts, liveReload, host, port, configuration }) => {
|
|
132
136
|
const { runCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/run')));
|
|
133
137
|
await runCommand(config, platform, {
|
|
134
138
|
scheme,
|
|
@@ -155,12 +159,10 @@ function runProgram(config) {
|
|
|
155
159
|
.description('add a native platform project')
|
|
156
160
|
.option('--packagemanager <packageManager>', 'The package manager to use for dependency installs (Cocoapods, SPM **experimental**)')
|
|
157
161
|
.action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { packagemanager }) => {
|
|
158
|
-
(0, config_1.checkExternalConfig)(config.app);
|
|
159
162
|
const { addCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/add')));
|
|
160
163
|
const configWritable = config;
|
|
161
164
|
if (packagemanager === 'SPM') {
|
|
162
|
-
configWritable.cli.assets.ios.platformTemplateArchive =
|
|
163
|
-
'ios-spm-template.tar.gz';
|
|
165
|
+
configWritable.cli.assets.ios.platformTemplateArchive = 'ios-spm-template.tar.gz';
|
|
164
166
|
configWritable.cli.assets.ios.platformTemplateArchiveAbs = (0, path_1.resolve)(configWritable.cli.assetsDirAbs, configWritable.cli.assets.ios.platformTemplateArchive);
|
|
165
167
|
}
|
|
166
168
|
await addCommand(configWritable, platform);
|
|
@@ -169,7 +171,6 @@ function runProgram(config) {
|
|
|
169
171
|
.command('ls [platform]')
|
|
170
172
|
.description('list installed Cordova and Capacitor plugins')
|
|
171
173
|
.action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform) => {
|
|
172
|
-
(0, config_1.checkExternalConfig)(config.app);
|
|
173
174
|
const { listCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/list')));
|
|
174
175
|
await listCommand(config, platform);
|
|
175
176
|
})));
|
|
@@ -177,7 +178,6 @@ function runProgram(config) {
|
|
|
177
178
|
.command('doctor [platform]')
|
|
178
179
|
.description('checks the current setup for common errors')
|
|
179
180
|
.action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform) => {
|
|
180
|
-
(0, config_1.checkExternalConfig)(config.app);
|
|
181
181
|
const { doctorCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/doctor')));
|
|
182
182
|
await doctorCommand(config, platform);
|
|
183
183
|
})));
|
package/dist/ios/common.js
CHANGED
|
@@ -42,8 +42,7 @@ async function checkBundler(config) {
|
|
|
42
42
|
}
|
|
43
43
|
exports.checkBundler = checkBundler;
|
|
44
44
|
async function checkCocoaPods(config) {
|
|
45
|
-
if (!(await (0, subprocess_1.isInstalled)(await config.ios.podPath)) &&
|
|
46
|
-
config.cli.os === "mac" /* OS.Mac */) {
|
|
45
|
+
if (!(await (0, subprocess_1.isInstalled)(await config.ios.podPath)) && config.cli.os === "mac" /* OS.Mac */) {
|
|
47
46
|
return (`CocoaPods is not installed.\n` +
|
|
48
47
|
`See this install guide: ${colors_1.default.strong('https://capacitorjs.com/docs/getting-started/environment-setup#homebrew')}`);
|
|
49
48
|
}
|
|
@@ -71,8 +70,7 @@ async function resolvePlugin(plugin) {
|
|
|
71
70
|
type: 1 /* PluginType.Cordova */,
|
|
72
71
|
path: 'src/' + platform,
|
|
73
72
|
};
|
|
74
|
-
if ((0, cordova_1.getIncompatibleCordovaPlugins)(platform).includes(plugin.id) ||
|
|
75
|
-
!(0, plugin_1.getPluginPlatform)(plugin, platform)) {
|
|
73
|
+
if ((0, cordova_1.getIncompatibleCordovaPlugins)(platform).includes(plugin.id) || !(0, plugin_1.getPluginPlatform)(plugin, platform)) {
|
|
76
74
|
plugin.ios.type = 2 /* PluginType.Incompatible */;
|
|
77
75
|
}
|
|
78
76
|
}
|
|
@@ -87,10 +85,7 @@ exports.resolvePlugin = resolvePlugin;
|
|
|
87
85
|
*/
|
|
88
86
|
async function editProjectSettingsIOS(config) {
|
|
89
87
|
const appId = config.app.appId;
|
|
90
|
-
const appName = config.app.appName
|
|
91
|
-
.replace(/&/g, '&')
|
|
92
|
-
.replace(/</g, '<')
|
|
93
|
-
.replace(/>/g, '>');
|
|
88
|
+
const appName = config.app.appName.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
94
89
|
const pbxPath = `${config.ios.nativeXcodeProjDirAbs}/project.pbxproj`;
|
|
95
90
|
const plistPath = (0, path_1.resolve)(config.ios.nativeTargetDirAbs, 'Info.plist');
|
|
96
91
|
let plistContent = await (0, utils_fs_1.readFile)(plistPath, { encoding: 'utf-8' });
|
package/dist/ios/doctor.js
CHANGED
|
@@ -20,11 +20,7 @@ async function doctorIOS(config) {
|
|
|
20
20
|
// check online datebase of common errors
|
|
21
21
|
// check if www folder is empty (index.html does not exist)
|
|
22
22
|
try {
|
|
23
|
-
await (0, common_1.check)([
|
|
24
|
-
() => (0, common_2.checkBundler)(config) || (0, common_2.checkCocoaPods)(config),
|
|
25
|
-
() => (0, common_1.checkWebDir)(config),
|
|
26
|
-
checkXcode,
|
|
27
|
-
]);
|
|
23
|
+
await (0, common_1.check)([() => (0, common_2.checkBundler)(config) || (0, common_2.checkCocoaPods)(config), () => (0, common_1.checkWebDir)(config), checkXcode]);
|
|
28
24
|
(0, log_1.logSuccess)('iOS looking great! 👌');
|
|
29
25
|
}
|
|
30
26
|
catch (e) {
|
package/dist/ios/run.js
CHANGED
|
@@ -10,7 +10,7 @@ const native_run_1 = require("../util/native-run");
|
|
|
10
10
|
const spm_1 = require("../util/spm");
|
|
11
11
|
const subprocess_1 = require("../util/subprocess");
|
|
12
12
|
const debug = (0, debug_1.default)('capacitor:ios:run');
|
|
13
|
-
async function runIOS(config, { target: selectedTarget, scheme: selectedScheme, configuration: selectedConfiguration
|
|
13
|
+
async function runIOS(config, { target: selectedTarget, scheme: selectedScheme, configuration: selectedConfiguration }) {
|
|
14
14
|
const target = await (0, common_1.promptForPlatformTarget)(await (0, native_run_1.getPlatformTargets)('ios'), selectedTarget);
|
|
15
15
|
const runScheme = selectedScheme || config.ios.scheme;
|
|
16
16
|
const configuration = selectedConfiguration || 'Debug';
|
|
@@ -43,9 +43,7 @@ async function runIOS(config, { target: selectedTarget, scheme: selectedScheme,
|
|
|
43
43
|
cwd: config.ios.nativeProjectDirAbs,
|
|
44
44
|
}));
|
|
45
45
|
const appName = `${runScheme}.app`;
|
|
46
|
-
const appPath = (0, path_1.resolve)(derivedDataPath, 'Build/Products', target.virtual
|
|
47
|
-
? `${configuration}-iphonesimulator`
|
|
48
|
-
: `${configuration}-iphoneos`, appName);
|
|
46
|
+
const appPath = (0, path_1.resolve)(derivedDataPath, 'Build/Products', target.virtual ? `${configuration}-iphonesimulator` : `${configuration}-iphoneos`, appName);
|
|
49
47
|
const nativeRunArgs = ['ios', '--app', appPath, '--target', target.id];
|
|
50
48
|
debug('Invoking native-run with args: %O', nativeRunArgs);
|
|
51
49
|
await (0, common_1.runTask)(`Deploying ${colors_1.default.strong(appName)} to ${colors_1.default.input(target.id)}`, async () => (0, native_run_1.runNativeRun)(nativeRunArgs));
|