@capacitor/cli 4.0.1 → 4.0.2-nightly-478d48c3.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/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 +12 -2
- package/dist/index.js +3 -2
- package/dist/tasks/add.js +1 -1
- package/dist/tasks/migrate.js +44 -19
- package/dist/tasks/run.js +1 -1
- package/dist/tasks/sourcemaps.js +40 -0
- package/dist/tasks/sync.js +7 -3
- package/package.json +2 -2
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/android/update.js
CHANGED
|
@@ -130,7 +130,12 @@ project(':${getGradlePackageName(p.id)}').projectDir = new File('${relativePlugi
|
|
|
130
130
|
applyArray.push(`apply from: "${relativePluginPath}/${framework.$.src}"`);
|
|
131
131
|
}
|
|
132
132
|
else if (!framework.$.type && !framework.$.custom) {
|
|
133
|
-
|
|
133
|
+
if (framework.$.src.startsWith('platform(')) {
|
|
134
|
+
frameworksArray.push(` implementation ${framework.$.src}`);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
frameworksArray.push(` implementation "${framework.$.src}"`);
|
|
138
|
+
}
|
|
134
139
|
}
|
|
135
140
|
});
|
|
136
141
|
prefsArray = prefsArray.concat(plugin_1.getAllElements(p, platform, 'preference'));
|
|
@@ -192,7 +197,12 @@ async function handleCordovaPluginsGradle(config, cordovaPlugins) {
|
|
|
192
197
|
});
|
|
193
198
|
let frameworkString = frameworksArray
|
|
194
199
|
.map(f => {
|
|
195
|
-
|
|
200
|
+
if (f.startsWith('platform(')) {
|
|
201
|
+
return ` implementation ${f}`;
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
return ` implementation "${f}"`;
|
|
205
|
+
}
|
|
196
206
|
})
|
|
197
207
|
.join('\n');
|
|
198
208
|
frameworkString = await replaceFrameworkVariables(config, prefsArray, frameworkString);
|
package/dist/index.js
CHANGED
|
@@ -62,10 +62,11 @@ function runProgram(config) {
|
|
|
62
62
|
.command('sync [platform]')
|
|
63
63
|
.description(`${colors_1.default.input('copy')} + ${colors_1.default.input('update')}`)
|
|
64
64
|
.option('--deployment', "Optional: if provided, Podfile.lock won't be deleted and 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 }) => {
|
|
66
67
|
config_1.checkExternalConfig(config.app);
|
|
67
68
|
const { syncCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/sync')));
|
|
68
|
-
await syncCommand(config, platform, deployment);
|
|
69
|
+
await syncCommand(config, platform, deployment, inline);
|
|
69
70
|
})));
|
|
70
71
|
commander_1.program
|
|
71
72
|
.command('update [platform]')
|
package/dist/tasks/add.js
CHANGED
|
@@ -55,7 +55,7 @@ async function addCommand(config, selectedPlatformName) {
|
|
|
55
55
|
await doAdd(config, platformName);
|
|
56
56
|
await editPlatforms(config, platformName);
|
|
57
57
|
if (await utils_fs_1.pathExists(config.app.webDirAbs)) {
|
|
58
|
-
await sync_1.sync(config, platformName, false);
|
|
58
|
+
await sync_1.sync(config, platformName, false, false);
|
|
59
59
|
if (platformName === config.android.name) {
|
|
60
60
|
await common_2.runTask('Syncing Gradle', async () => {
|
|
61
61
|
return add_1.createLocalProperties(config.android.platformDirAbs);
|
package/dist/tasks/migrate.js
CHANGED
|
@@ -37,6 +37,7 @@ const plugins = [
|
|
|
37
37
|
'@capacitor/local-notifications',
|
|
38
38
|
'@capacitor/motion',
|
|
39
39
|
'@capacitor/network',
|
|
40
|
+
'@capacitor/preferences',
|
|
40
41
|
'@capacitor/push-notifications',
|
|
41
42
|
'@capacitor/screen-reader',
|
|
42
43
|
'@capacitor/share',
|
|
@@ -143,23 +144,40 @@ async function migrateCommand(config) {
|
|
|
143
144
|
// Variables gradle
|
|
144
145
|
await common_1.runTask(`Migrating variables.gradle file.`, () => {
|
|
145
146
|
return (async () => {
|
|
147
|
+
const variablesPath = path_1.join(config.android.platformDirAbs, 'variables.gradle');
|
|
148
|
+
let txt = readFile(variablesPath);
|
|
149
|
+
if (!txt) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
txt = txt.replace(/= {2}'/g, `= '`);
|
|
153
|
+
utils_fs_1.writeFileSync(variablesPath, txt, { encoding: 'utf-8' });
|
|
146
154
|
for (const variable of Object.keys(variablesAndClasspaths.variables)) {
|
|
147
|
-
if (!(await updateFile(config,
|
|
148
|
-
const didWork = await updateFile(config,
|
|
155
|
+
if (!(await updateFile(config, variablesPath, `${variable} = '`, `'`, variablesAndClasspaths.variables[variable].toString(), true))) {
|
|
156
|
+
const didWork = await updateFile(config, variablesPath, `${variable} = `, `\n`, variablesAndClasspaths.variables[variable].toString(), true);
|
|
149
157
|
if (!didWork) {
|
|
150
|
-
let file = readFile(
|
|
158
|
+
let file = readFile(variablesPath);
|
|
151
159
|
if (file) {
|
|
152
160
|
file = file.replace('}', ` ${variable} = '${variablesAndClasspaths.variables[variable].toString()}'\n}`);
|
|
153
|
-
utils_fs_1.writeFileSync(
|
|
161
|
+
utils_fs_1.writeFileSync(variablesPath, file);
|
|
154
162
|
}
|
|
155
163
|
}
|
|
156
164
|
}
|
|
157
165
|
}
|
|
166
|
+
const pluginVariables = {
|
|
167
|
+
firebaseMessagingVersion: '23.0.5',
|
|
168
|
+
playServicesLocationVersion: '20.0.0',
|
|
169
|
+
androidxBrowserVersion: '1.4.0',
|
|
170
|
+
androidxMaterialVersion: '1.6.1',
|
|
171
|
+
androidxExifInterfaceVersion: '1.3.3',
|
|
172
|
+
};
|
|
173
|
+
for (const variable of Object.keys(pluginVariables)) {
|
|
174
|
+
await updateFile(config, variablesPath, `${variable} = '`, `'`, pluginVariables[variable], true);
|
|
175
|
+
}
|
|
158
176
|
})();
|
|
159
177
|
});
|
|
160
178
|
// remove init
|
|
161
|
-
await common_1.runTask('Migrating MainActivity
|
|
162
|
-
return
|
|
179
|
+
await common_1.runTask('Migrating MainActivity', () => {
|
|
180
|
+
return migrateMainActivity(config);
|
|
163
181
|
});
|
|
164
182
|
rimraf_1.default.sync(path_1.join(config.android.appDirAbs, 'build'));
|
|
165
183
|
// add new splashscreen
|
|
@@ -194,7 +212,7 @@ async function installLatestNPMLibs(runInstall, config) {
|
|
|
194
212
|
return;
|
|
195
213
|
}
|
|
196
214
|
const pkgJson = JSON.parse(pkgJsonFile);
|
|
197
|
-
for (const devDepKey of Object.keys(pkgJson['devDependencies'])) {
|
|
215
|
+
for (const devDepKey of Object.keys(pkgJson['devDependencies'] || {})) {
|
|
198
216
|
if (libs.includes(devDepKey)) {
|
|
199
217
|
pkgJson['devDependencies'][devDepKey] = coreVersion;
|
|
200
218
|
}
|
|
@@ -287,7 +305,7 @@ async function updateAndroidManifest(filename) {
|
|
|
287
305
|
async function updateBuildGradle(filename, leaveJCenter, variablesAndClasspaths) {
|
|
288
306
|
// In build.gradle add dependencies:
|
|
289
307
|
// classpath 'com.android.tools.build:gradle:7.2.1'
|
|
290
|
-
// classpath 'com.google.gms:google-services:4.3.
|
|
308
|
+
// classpath 'com.google.gms:google-services:4.3.13'
|
|
291
309
|
const txt = readFile(filename);
|
|
292
310
|
if (!txt) {
|
|
293
311
|
return;
|
|
@@ -298,11 +316,7 @@ async function updateBuildGradle(filename, leaveJCenter, variablesAndClasspaths)
|
|
|
298
316
|
};
|
|
299
317
|
let replaced = txt;
|
|
300
318
|
for (const dep of Object.keys(neededDeps)) {
|
|
301
|
-
if (
|
|
302
|
-
replaced = txt.replace('dependencies {', `dependencies {\n classpath '${dep}:${neededDeps[dep]}'`);
|
|
303
|
-
}
|
|
304
|
-
else {
|
|
305
|
-
// Update
|
|
319
|
+
if (replaced.includes(`classpath '${dep}`)) {
|
|
306
320
|
replaced = setAllStringIn(replaced, `classpath '${dep}:`, `'`, neededDeps[dep]);
|
|
307
321
|
log_1.logger.info(`Set ${dep} = ${neededDeps[dep]}.`);
|
|
308
322
|
}
|
|
@@ -409,7 +423,7 @@ async function updateGradleWrapper(filename) {
|
|
|
409
423
|
}
|
|
410
424
|
const replaced = setAllStringIn(txt, 'distributionUrl=', '\n',
|
|
411
425
|
// eslint-disable-next-line no-useless-escape
|
|
412
|
-
`https
|
|
426
|
+
`https\\://services.gradle.org/distributions/gradle-7.4.2-all.zip`);
|
|
413
427
|
utils_fs_1.writeFileSync(filename, replaced, 'utf-8');
|
|
414
428
|
}
|
|
415
429
|
async function updateFile(config, filename, textStart, textEnd, replacement, skipIfNotFound) {
|
|
@@ -565,7 +579,7 @@ async function podfileAssertDeploymentTarget(filename) {
|
|
|
565
579
|
}
|
|
566
580
|
utils_fs_1.writeFileSync(filename, replaced, 'utf-8');
|
|
567
581
|
}
|
|
568
|
-
async function
|
|
582
|
+
async function migrateMainActivity(config) {
|
|
569
583
|
const xmlData = await xml_1.readXML(path_1.join(config.android.srcMainDirAbs, 'AndroidManifest.xml'));
|
|
570
584
|
const manifestNode = xmlData.manifest;
|
|
571
585
|
const applicationChildNodes = manifestNode.application;
|
|
@@ -615,11 +629,22 @@ async function removeOldInitAndroid(config) {
|
|
|
615
629
|
let data = readFile(mainActivityClassFilePath);
|
|
616
630
|
if (data) {
|
|
617
631
|
const bindex = data.indexOf('this.init(savedInstanceState');
|
|
618
|
-
if (bindex
|
|
632
|
+
if (bindex !== -1) {
|
|
633
|
+
const eindex = data.indexOf('}});', bindex) + 4;
|
|
634
|
+
data = data.replace(data.substring(bindex, eindex), '');
|
|
635
|
+
data = data.replace('// Initializes the Bridge', '');
|
|
636
|
+
}
|
|
637
|
+
const rindex = data.indexOf('registerPlugin');
|
|
638
|
+
if (rindex !== -1) {
|
|
639
|
+
if (data.indexOf('super.onCreate(savedInstanceState);') < rindex) {
|
|
640
|
+
data = data.replace('super.onCreate(savedInstanceState);\n ', '');
|
|
641
|
+
const eindex = data.lastIndexOf('.class);') + 8;
|
|
642
|
+
data = data.replace(data.substring(bindex, eindex), `${data.substring(bindex, eindex)}\n super.onCreate(savedInstanceState);`);
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
if (bindex == -1 && rindex == -1) {
|
|
619
646
|
return;
|
|
620
|
-
|
|
621
|
-
data = data.replace(data.substring(bindex, eindex), '');
|
|
622
|
-
data = data.replace('// Initializes the Bridge', '');
|
|
647
|
+
}
|
|
623
648
|
utils_fs_1.writeFileSync(mainActivityClassFilePath, data);
|
|
624
649
|
}
|
|
625
650
|
}
|
package/dist/tasks/run.js
CHANGED
|
@@ -56,7 +56,7 @@ async function runCommand(config, selectedPlatformName, options) {
|
|
|
56
56
|
}
|
|
57
57
|
try {
|
|
58
58
|
if (options.sync) {
|
|
59
|
-
await sync_1.sync(config, platformName, false);
|
|
59
|
+
await sync_1.sync(config, platformName, false, true);
|
|
60
60
|
}
|
|
61
61
|
await run(config, platformName, options);
|
|
62
62
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.inlineSourceMaps = void 0;
|
|
4
|
+
const utils_fs_1 = require("@ionic/utils-fs");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const log_1 = require("../log");
|
|
7
|
+
function walkDirectory(dirPath) {
|
|
8
|
+
const files = utils_fs_1.readdirSync(dirPath);
|
|
9
|
+
files.forEach(file => {
|
|
10
|
+
const targetFile = path_1.join(dirPath, file);
|
|
11
|
+
if (utils_fs_1.existsSync(targetFile) && utils_fs_1.lstatSync(targetFile).isDirectory()) {
|
|
12
|
+
walkDirectory(targetFile);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
const mapFile = path_1.join(dirPath, `${file}.map`);
|
|
16
|
+
if (path_1.extname(file) === '.js' && utils_fs_1.existsSync(mapFile)) {
|
|
17
|
+
const bufMap = utils_fs_1.readFileSync(mapFile).toString('base64');
|
|
18
|
+
const bufFile = utils_fs_1.readFileSync(targetFile, 'utf8');
|
|
19
|
+
const result = bufFile.replace(`sourceMappingURL=${file}.map`, 'sourceMappingURL=data:application/json;charset=utf-8;base64,' +
|
|
20
|
+
bufMap);
|
|
21
|
+
utils_fs_1.writeFileSync(targetFile, result);
|
|
22
|
+
utils_fs_1.unlinkSync(mapFile);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
async function inlineSourceMaps(config, platformName) {
|
|
28
|
+
let buildDir = '';
|
|
29
|
+
if (platformName == config.ios.name) {
|
|
30
|
+
buildDir = await config.ios.webDirAbs;
|
|
31
|
+
}
|
|
32
|
+
if (platformName == config.android.name) {
|
|
33
|
+
buildDir = await config.android.webDirAbs;
|
|
34
|
+
}
|
|
35
|
+
if (buildDir) {
|
|
36
|
+
log_1.logger.info('Inlining sourcemaps');
|
|
37
|
+
walkDirectory(buildDir);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.inlineSourceMaps = inlineSourceMaps;
|
package/dist/tasks/sync.js
CHANGED
|
@@ -6,11 +6,12 @@ const errors_1 = require("../errors");
|
|
|
6
6
|
const log_1 = require("../log");
|
|
7
7
|
const promise_1 = require("../util/promise");
|
|
8
8
|
const copy_1 = require("./copy");
|
|
9
|
+
const sourcemaps_1 = require("./sourcemaps");
|
|
9
10
|
const update_1 = require("./update");
|
|
10
11
|
/**
|
|
11
12
|
* Sync is a copy and an update in one.
|
|
12
13
|
*/
|
|
13
|
-
async function syncCommand(config, selectedPlatformName, deployment) {
|
|
14
|
+
async function syncCommand(config, selectedPlatformName, deployment, inline) {
|
|
14
15
|
var _a, _b;
|
|
15
16
|
if (selectedPlatformName && !(await common_1.isValidPlatform(selectedPlatformName))) {
|
|
16
17
|
try {
|
|
@@ -30,7 +31,7 @@ async function syncCommand(config, selectedPlatformName, deployment) {
|
|
|
30
31
|
() => common_1.checkWebDir(config),
|
|
31
32
|
...update_1.updateChecks(config, platforms),
|
|
32
33
|
]);
|
|
33
|
-
await promise_1.allSerial(platforms.map(platformName => () => sync(config, platformName, deployment)));
|
|
34
|
+
await promise_1.allSerial(platforms.map(platformName => () => sync(config, platformName, deployment, inline)));
|
|
34
35
|
const now = +new Date();
|
|
35
36
|
const diff = (now - then) / 1000;
|
|
36
37
|
log_1.logger.info(`Sync finished in ${diff}s`);
|
|
@@ -44,11 +45,14 @@ async function syncCommand(config, selectedPlatformName, deployment) {
|
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
exports.syncCommand = syncCommand;
|
|
47
|
-
async function sync(config, platformName, deployment) {
|
|
48
|
+
async function sync(config, platformName, deployment, inline) {
|
|
48
49
|
var _a;
|
|
49
50
|
await common_1.runPlatformHook(config, platformName, config.app.rootDir, 'capacitor:sync:before');
|
|
50
51
|
try {
|
|
51
52
|
await copy_1.copy(config, platformName);
|
|
53
|
+
if (inline) {
|
|
54
|
+
await sourcemaps_1.inlineSourceMaps(config, platformName);
|
|
55
|
+
}
|
|
52
56
|
}
|
|
53
57
|
catch (e) {
|
|
54
58
|
log_1.logger.error((_a = e.stack) !== null && _a !== void 0 ? _a : e);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/cli",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2-nightly-478d48c3.0",
|
|
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)",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"publishConfig": {
|
|
84
84
|
"access": "public"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "478d48c3e322cffc6f0ff7ce590b635de4b41279"
|
|
87
87
|
}
|