@capacitor/cli 3.5.0 → 4.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/CHANGELOG.md +5 -18
- 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-template.tar.gz +0 -0
- package/dist/android/update.js +3 -46
- package/dist/config.js +2 -2
- package/dist/declarations.d.ts +11 -14
- package/dist/tasks/copy.js +5 -47
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -3,34 +3,21 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
# [
|
|
6
|
+
# [4.0.0-alpha.2](https://github.com/ionic-team/capacitor/compare/3.4.1...4.0.0-alpha.2) (2022-05-12)
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
### Features
|
|
10
10
|
|
|
11
|
-
* **
|
|
11
|
+
* **android:** Use java 11 ([#5552](https://github.com/ionic-team/capacitor/issues/5552)) ([e47959f](https://github.com/ionic-team/capacitor/commit/e47959fcbd6a89b97b1275a5814fdb4e7ce30672))
|
|
12
|
+
* **ios:** Add preferredContentMode configuration option ([#5583](https://github.com/ionic-team/capacitor/issues/5583)) ([5b6dfa3](https://github.com/ionic-team/capacitor/commit/5b6dfa3fe29c85632546b299f03cc04a77cf7475))
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
# [4.0.0-alpha.1](https://github.com/ionic-team/capacitor/compare/3.4.1...4.0.0-alpha.1) (2022-03-25)
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
### Bug Fixes
|
|
21
|
-
|
|
22
|
-
* **cli:** avoid srcFiles is not iterable on kotlinNeededCheck ([#5481](https://github.com/ionic-team/capacitor/issues/5481)) ([3c2b579](https://github.com/ionic-team/capacitor/commit/3c2b579c6edb1fc69d85689b268eb92067b7821b))
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
## [3.4.2](https://github.com/ionic-team/capacitor/compare/3.4.1...3.4.2) (2022-03-03)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
### Bug Fixes
|
|
32
|
-
|
|
33
|
-
* **android:** compatibility with cordova kotlin plugins ([#5438](https://github.com/ionic-team/capacitor/issues/5438)) ([55bf004](https://github.com/ionic-team/capacitor/commit/55bf004897b3feb280ab6b6575d2a2c1a0a183e2))
|
|
20
|
+
**Note:** Version bump only for package @capacitor/cli
|
|
34
21
|
|
|
35
22
|
|
|
36
23
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/android/update.js
CHANGED
|
@@ -141,8 +141,8 @@ project(':${getGradlePackageName(p.id)}').projectDir = new File('${relativePlugi
|
|
|
141
141
|
|
|
142
142
|
android {
|
|
143
143
|
compileOptions {
|
|
144
|
-
sourceCompatibility JavaVersion.
|
|
145
|
-
targetCompatibility JavaVersion.
|
|
144
|
+
sourceCompatibility JavaVersion.VERSION_11
|
|
145
|
+
targetCompatibility JavaVersion.VERSION_11
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
|
|
@@ -166,11 +166,7 @@ if (hasProperty('postBuildExtras')) {
|
|
|
166
166
|
}
|
|
167
167
|
exports.installGradlePlugins = installGradlePlugins;
|
|
168
168
|
async function handleCordovaPluginsGradle(config, cordovaPlugins) {
|
|
169
|
-
var _a, _b, _c;
|
|
170
169
|
const pluginsGradlePath = path_1.join(config.android.cordovaPluginsDirAbs, 'build.gradle');
|
|
171
|
-
const kotlinNeeded = await kotlinNeededCheck(config, cordovaPlugins);
|
|
172
|
-
const isKotlinVersionInVariablesGradle = (await getVariablesGradleFile(config)).includes('kotlin_version');
|
|
173
|
-
const kotlinVersionString = (_c = (_b = (_a = config.app.extConfig.cordova) === null || _a === void 0 ? void 0 : _a.preferences) === null || _b === void 0 ? void 0 : _b.GradlePluginKotlinVersion) !== null && _c !== void 0 ? _c : '1.4.32';
|
|
174
170
|
const frameworksArray = [];
|
|
175
171
|
let prefsArray = [];
|
|
176
172
|
const applyArray = [];
|
|
@@ -197,24 +193,10 @@ async function handleCordovaPluginsGradle(config, cordovaPlugins) {
|
|
|
197
193
|
})
|
|
198
194
|
.join('\n');
|
|
199
195
|
frameworkString = await replaceFrameworkVariables(config, prefsArray, frameworkString);
|
|
200
|
-
if (kotlinNeeded) {
|
|
201
|
-
frameworkString += `\n implementation "androidx.core:core-ktx:$androidxCoreKTXVersion"`;
|
|
202
|
-
frameworkString += `\n implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"`;
|
|
203
|
-
}
|
|
204
196
|
const applyString = applyArray.join('\n');
|
|
205
197
|
let buildGradle = await utils_fs_1.readFile(pluginsGradlePath, { encoding: 'utf-8' });
|
|
206
198
|
buildGradle = buildGradle.replace(/(SUB-PROJECT DEPENDENCIES START)[\s\S]*(\/\/ SUB-PROJECT DEPENDENCIES END)/, '$1\n' + frameworkString.concat('\n') + ' $2');
|
|
207
199
|
buildGradle = buildGradle.replace(/(PLUGIN GRADLE EXTENSIONS START)[\s\S]*(\/\/ PLUGIN GRADLE EXTENSIONS END)/, '$1\n' + applyString.concat('\n') + '$2');
|
|
208
|
-
if (kotlinNeeded) {
|
|
209
|
-
buildGradle = buildGradle.replace(/(buildscript\s{\n(\t|\s{4})repositories\s{\n((\t{2}|\s{8}).+\n)+(\t|\s{4})}\n(\t|\s{4})dependencies\s{\n(\t{2}|\s{8}).+)\n((\t|\s{4})}\n}\n)/, `$1\n classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:` +
|
|
210
|
-
(isKotlinVersionInVariablesGradle
|
|
211
|
-
? '$kotlin_version'
|
|
212
|
-
: kotlinVersionString) +
|
|
213
|
-
`"\n$8`);
|
|
214
|
-
buildGradle = buildGradle.replace(/(ext\s{)/, `$1\n kotlin_version = project.hasProperty('kotlin_version') ? rootProject.ext.kotlin_version : '${kotlinVersionString}'\n androidxCoreKTXVersion = project.hasProperty('androidxCoreKTXVersion') ? rootProject.ext.androidxCoreKTXVersion : '1.6.0'`);
|
|
215
|
-
buildGradle = buildGradle.replace(/(apply\splugin:\s'com\.android\.library')/, `$1\napply plugin: 'kotlin-android'`);
|
|
216
|
-
buildGradle = buildGradle.replace(/(compileOptions\s{\n((\t{2}|\s{8}).+\n)+(\t|\s{4})})\n(})/, `$1\n sourceSets {\n main.java.srcDirs += 'src/main/kotlin'\n }\n$5`);
|
|
217
|
-
}
|
|
218
200
|
await utils_fs_1.writeFile(pluginsGradlePath, buildGradle);
|
|
219
201
|
const cordovaVariables = `// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
|
|
220
202
|
ext {
|
|
@@ -226,27 +208,6 @@ ext {
|
|
|
226
208
|
await utils_fs_1.writeFile(path_1.join(config.android.cordovaPluginsDirAbs, 'cordova.variables.gradle'), cordovaVariables);
|
|
227
209
|
}
|
|
228
210
|
exports.handleCordovaPluginsGradle = handleCordovaPluginsGradle;
|
|
229
|
-
async function kotlinNeededCheck(config, cordovaPlugins) {
|
|
230
|
-
var _a, _b;
|
|
231
|
-
if (((_b = (_a = config.app.extConfig.cordova) === null || _a === void 0 ? void 0 : _a.preferences) === null || _b === void 0 ? void 0 : _b.GradlePluginKotlinEnabled) !==
|
|
232
|
-
'true') {
|
|
233
|
-
for (const plugin of cordovaPlugins) {
|
|
234
|
-
const androidPlatform = plugin_1.getPluginPlatform(plugin, platform);
|
|
235
|
-
const sourceFiles = androidPlatform['source-file'];
|
|
236
|
-
if (sourceFiles) {
|
|
237
|
-
for (const srcFile of sourceFiles) {
|
|
238
|
-
if (/^.*\.kt$/.test(srcFile['$'].src)) {
|
|
239
|
-
return true;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
return false;
|
|
245
|
-
}
|
|
246
|
-
else {
|
|
247
|
-
return true;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
211
|
async function copyPluginsNativeFiles(config, cordovaPlugins) {
|
|
251
212
|
const pluginsPath = path_1.join(config.android.cordovaPluginsDirAbs, 'src', 'main');
|
|
252
213
|
for (const p of cordovaPlugins) {
|
|
@@ -296,16 +257,12 @@ async function getPluginsTask(config) {
|
|
|
296
257
|
return androidPlugins;
|
|
297
258
|
});
|
|
298
259
|
}
|
|
299
|
-
async function
|
|
260
|
+
async function replaceFrameworkVariables(config, prefsArray, frameworkString) {
|
|
300
261
|
const variablesFile = path_1.resolve(config.android.platformDirAbs, 'variables.gradle');
|
|
301
262
|
let variablesGradle = '';
|
|
302
263
|
if (await utils_fs_1.pathExists(variablesFile)) {
|
|
303
264
|
variablesGradle = await utils_fs_1.readFile(variablesFile, { encoding: 'utf-8' });
|
|
304
265
|
}
|
|
305
|
-
return variablesGradle;
|
|
306
|
-
}
|
|
307
|
-
async function replaceFrameworkVariables(config, prefsArray, frameworkString) {
|
|
308
|
-
const variablesGradle = await getVariablesGradleFile(config);
|
|
309
266
|
prefsArray.map((preference) => {
|
|
310
267
|
if (!variablesGradle.includes(preference.$.name)) {
|
|
311
268
|
frameworkString = frameworkString.replace(new RegExp(('$' + preference.$.name).replace('$', '\\$&'), 'g'), preference.$.default);
|
package/dist/config.js
CHANGED
|
@@ -171,7 +171,7 @@ async function loadAndroidConfig(rootDir, extConfig, cliConfig) {
|
|
|
171
171
|
const studioPath = promise_1.lazy(() => determineAndroidStudioPath(cliConfig.os));
|
|
172
172
|
return {
|
|
173
173
|
name,
|
|
174
|
-
minVersion: '
|
|
174
|
+
minVersion: '22',
|
|
175
175
|
studioPath,
|
|
176
176
|
platformDir,
|
|
177
177
|
platformDirAbs,
|
|
@@ -213,7 +213,7 @@ async function loadIOSConfig(rootDir, extConfig) {
|
|
|
213
213
|
const cordovaPluginsDir = 'capacitor-cordova-ios-plugins';
|
|
214
214
|
return {
|
|
215
215
|
name,
|
|
216
|
-
minVersion: '
|
|
216
|
+
minVersion: '13.0',
|
|
217
217
|
platformDir,
|
|
218
218
|
platformDirAbs,
|
|
219
219
|
scheme,
|
package/dist/declarations.d.ts
CHANGED
|
@@ -314,6 +314,17 @@ export interface CapacitorConfig {
|
|
|
314
314
|
* @default false
|
|
315
315
|
*/
|
|
316
316
|
limitsNavigationsToAppBoundDomains?: boolean;
|
|
317
|
+
/**
|
|
318
|
+
* The content mode for the web view to use when it loads and renders web content.
|
|
319
|
+
*
|
|
320
|
+
* - 'recommended': The content mode that is appropriate for the current device.
|
|
321
|
+
* - 'desktop': The content mode that represents a desktop experience.
|
|
322
|
+
* - 'mobile': The content mode that represents a mobile experience.
|
|
323
|
+
*
|
|
324
|
+
* @since 4.0.0
|
|
325
|
+
* @default recommended
|
|
326
|
+
*/
|
|
327
|
+
preferredContentMode?: 'recommended' | 'desktop' | 'mobile';
|
|
317
328
|
};
|
|
318
329
|
server?: {
|
|
319
330
|
/**
|
|
@@ -432,11 +443,6 @@ export interface CapacitorConfig {
|
|
|
432
443
|
*/
|
|
433
444
|
includePlugins?: string[];
|
|
434
445
|
}
|
|
435
|
-
export interface Portal {
|
|
436
|
-
name: string;
|
|
437
|
-
webDir: string;
|
|
438
|
-
appId?: string;
|
|
439
|
-
}
|
|
440
446
|
export interface PluginsConfig {
|
|
441
447
|
/**
|
|
442
448
|
* Plugin configuration by class name.
|
|
@@ -446,13 +452,4 @@ export interface PluginsConfig {
|
|
|
446
452
|
[key: string]: {
|
|
447
453
|
[key: string]: any;
|
|
448
454
|
} | undefined;
|
|
449
|
-
/**
|
|
450
|
-
* Capacitor Portals plugin configuration
|
|
451
|
-
*
|
|
452
|
-
* @since 3.5.0
|
|
453
|
-
*/
|
|
454
|
-
Portals?: {
|
|
455
|
-
shell: Portal;
|
|
456
|
-
apps: Portal[];
|
|
457
|
-
};
|
|
458
455
|
}
|
package/dist/tasks/copy.js
CHANGED
|
@@ -9,7 +9,6 @@ const common_1 = require("../common");
|
|
|
9
9
|
const cordova_1 = require("../cordova");
|
|
10
10
|
const errors_1 = require("../errors");
|
|
11
11
|
const log_1 = require("../log");
|
|
12
|
-
const plugin_1 = require("../plugin");
|
|
13
12
|
const promise_1 = require("../util/promise");
|
|
14
13
|
const copy_1 = require("../web/copy");
|
|
15
14
|
async function copyCommand(config, selectedPlatformName) {
|
|
@@ -44,41 +43,21 @@ async function copy(config, platformName) {
|
|
|
44
43
|
throw result;
|
|
45
44
|
}
|
|
46
45
|
await common_1.runPlatformHook(config, platformName, config.app.rootDir, 'capacitor:copy:before');
|
|
47
|
-
const allPlugins = await plugin_1.getPlugins(config, platformName);
|
|
48
|
-
let usesCapacitorPortals = false;
|
|
49
|
-
if (allPlugins.filter(plugin => plugin.id === '@ionic-enterprise/capacitor-portals').length > 0) {
|
|
50
|
-
usesCapacitorPortals = true;
|
|
51
|
-
}
|
|
52
46
|
if (platformName === config.ios.name) {
|
|
53
|
-
|
|
54
|
-
await copyFederatedWebDirs(config, await config.ios.webDirAbs);
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
await copyWebDir(config, await config.ios.webDirAbs, config.app.webDirAbs);
|
|
58
|
-
}
|
|
47
|
+
await copyWebDir(config, await config.ios.webDirAbs);
|
|
59
48
|
await copyCapacitorConfig(config, config.ios.nativeTargetDirAbs);
|
|
60
49
|
const cordovaPlugins = await cordova_1.getCordovaPlugins(config, platformName);
|
|
61
50
|
await cordova_1.handleCordovaPluginsJS(cordovaPlugins, config, platformName);
|
|
62
51
|
}
|
|
63
52
|
else if (platformName === config.android.name) {
|
|
64
|
-
|
|
65
|
-
await copyFederatedWebDirs(config, config.android.webDirAbs);
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
await copyWebDir(config, config.android.webDirAbs, config.app.webDirAbs);
|
|
69
|
-
}
|
|
53
|
+
await copyWebDir(config, config.android.webDirAbs);
|
|
70
54
|
await copyCapacitorConfig(config, config.android.assetsDirAbs);
|
|
71
55
|
const cordovaPlugins = await cordova_1.getCordovaPlugins(config, platformName);
|
|
72
56
|
await cordova_1.handleCordovaPluginsJS(cordovaPlugins, config, platformName);
|
|
73
57
|
await cordova_1.writeCordovaAndroidManifest(cordovaPlugins, config, platformName);
|
|
74
58
|
}
|
|
75
59
|
else if (platformName === config.web.name) {
|
|
76
|
-
|
|
77
|
-
log_1.logger.info('Capacitor Portals Plugin installed, skipping web bundling...');
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
await copy_1.copyWeb(config);
|
|
81
|
-
}
|
|
60
|
+
await copy_1.copyWeb(config);
|
|
82
61
|
}
|
|
83
62
|
else {
|
|
84
63
|
throw `Platform ${platformName} is not valid.`;
|
|
@@ -97,8 +76,9 @@ async function copyCapacitorConfig(config, nativeAbsDir) {
|
|
|
97
76
|
});
|
|
98
77
|
});
|
|
99
78
|
}
|
|
100
|
-
async function copyWebDir(config, nativeAbsDir
|
|
79
|
+
async function copyWebDir(config, nativeAbsDir) {
|
|
101
80
|
var _a;
|
|
81
|
+
const webAbsDir = config.app.webDirAbs;
|
|
102
82
|
const webRelDir = path_1.basename(webAbsDir);
|
|
103
83
|
const nativeRelDir = path_1.relative(config.app.rootDir, nativeAbsDir);
|
|
104
84
|
if (((_a = config.app.extConfig.server) === null || _a === void 0 ? void 0 : _a.url) && !(await utils_fs_1.pathExists(webAbsDir))) {
|
|
@@ -111,25 +91,3 @@ async function copyWebDir(config, nativeAbsDir, webAbsDir) {
|
|
|
111
91
|
return utils_fs_1.copy(webAbsDir, nativeAbsDir);
|
|
112
92
|
});
|
|
113
93
|
}
|
|
114
|
-
async function copyFederatedWebDirs(config, nativeAbsDir) {
|
|
115
|
-
var _a, _b;
|
|
116
|
-
log_1.logger.info('Capacitor Portals Plugin Loaded - Copying Web Assets');
|
|
117
|
-
if (!((_b = (_a = config.app.extConfig) === null || _a === void 0 ? void 0 : _a.plugins) === null || _b === void 0 ? void 0 : _b.Portals)) {
|
|
118
|
-
throw `Capacitor Portals plugin is present but no valid config is defined.`;
|
|
119
|
-
}
|
|
120
|
-
const portalsConfig = config.app.extConfig.plugins.Portals;
|
|
121
|
-
if (!isPortal(portalsConfig.shell)) {
|
|
122
|
-
throw `Capacitor Portals plugin is present but no valid Shell application is defined in the config.`;
|
|
123
|
-
}
|
|
124
|
-
if (!portalsConfig.apps.every(isPortal)) {
|
|
125
|
-
throw `Capacitor Portals plugin is present but there is a problem with the apps defined in the config.`;
|
|
126
|
-
}
|
|
127
|
-
await Promise.all([...portalsConfig.apps, portalsConfig.shell].map(app => {
|
|
128
|
-
const appDir = path_1.resolve(config.app.rootDir, app.webDir);
|
|
129
|
-
return copyWebDir(config, path_1.resolve(nativeAbsDir, app.name), appDir);
|
|
130
|
-
}));
|
|
131
|
-
}
|
|
132
|
-
function isPortal(config) {
|
|
133
|
-
return (config.webDir !== undefined &&
|
|
134
|
-
config.name !== undefined);
|
|
135
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.2",
|
|
4
4
|
"description": "Capacitor: Cross-platform apps with JavaScript and the web",
|
|
5
5
|
"homepage": "https://capacitorjs.com",
|
|
6
6
|
"author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
|
|
@@ -44,21 +44,21 @@
|
|
|
44
44
|
"watch": "npm run assets && tsc -w"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@ionic/cli-framework-output": "^2.2.
|
|
47
|
+
"@ionic/cli-framework-output": "^2.2.4",
|
|
48
48
|
"@ionic/utils-fs": "^3.1.5",
|
|
49
|
-
"@ionic/utils-subprocess": "^2.1.
|
|
50
|
-
"@ionic/utils-terminal": "^2.3.
|
|
49
|
+
"@ionic/utils-subprocess": "^2.1.10",
|
|
50
|
+
"@ionic/utils-terminal": "^2.3.2",
|
|
51
51
|
"commander": "^6.0.0",
|
|
52
|
-
"debug": "^4.
|
|
52
|
+
"debug": "^4.3.4",
|
|
53
53
|
"env-paths": "^2.2.0",
|
|
54
|
-
"kleur": "^4.1.
|
|
54
|
+
"kleur": "^4.1.4",
|
|
55
55
|
"native-run": "^1.5.0",
|
|
56
56
|
"open": "^7.4.2",
|
|
57
|
-
"plist": "^3.0.
|
|
58
|
-
"prompts": "^2.
|
|
59
|
-
"semver": "^7.3.
|
|
57
|
+
"plist": "^3.0.5",
|
|
58
|
+
"prompts": "^2.4.2",
|
|
59
|
+
"semver": "^7.3.7",
|
|
60
60
|
"tar": "^6.1.11",
|
|
61
|
-
"tslib": "^2.
|
|
61
|
+
"tslib": "^2.4.0",
|
|
62
62
|
"xml2js": "^0.4.23"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"publishConfig": {
|
|
86
86
|
"access": "public"
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "5c588d5bd15b2b939c6efc25b7db9d6af29afae0"
|
|
89
89
|
}
|