@capacitor/cli 6.1.3-nightly-20241011T150501.0 → 6.2.1
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 +3 -1
- package/dist/android/common.js +5 -2
- package/dist/android/doctor.js +11 -7
- package/dist/android/run.js +1 -1
- package/dist/android/update.js +18 -13
- package/dist/common.js +25 -25
- package/dist/config.js +16 -4
- package/dist/cordova.js +63 -31
- package/dist/declarations.d.ts +24 -0
- package/dist/framework-configs.js +14 -14
- package/dist/index.js +14 -14
- package/dist/ios/common.js +8 -3
- package/dist/ios/doctor.js +5 -1
- package/dist/ios/run.js +4 -2
- package/dist/ios/update.js +36 -23
- package/dist/ipc.js +2 -2
- package/dist/log.js +3 -1
- package/dist/plugin.js +8 -4
- package/dist/tasks/add.js +9 -2
- package/dist/tasks/build.js +9 -4
- package/dist/tasks/config.js +4 -1
- package/dist/tasks/copy.js +13 -6
- package/dist/tasks/create.js +2 -1
- package/dist/tasks/doctor.js +7 -2
- package/dist/tasks/init.js +11 -10
- package/dist/tasks/list.js +4 -4
- package/dist/tasks/migrate.js +37 -13
- package/dist/tasks/new-plugin.js +2 -1
- package/dist/tasks/open.js +1 -1
- package/dist/tasks/run.js +6 -5
- package/dist/tasks/sourcemaps.js +3 -2
- package/dist/tasks/sync.js +6 -2
- package/dist/tasks/update.js +1 -1
- package/dist/util/fs.js +1 -1
- package/dist/util/iosplugin.js +3 -2
- package/dist/util/livereload.js +6 -3
- package/dist/util/monorepotools.js +2 -1
- package/dist/util/promise.js +1 -1
- package/dist/util/spm.js +5 -3
- package/dist/util/subprocess.js +7 -1
- package/dist/util/term.js +1 -1
- package/dist/util/uuid.js +1 -1
- package/dist/util/xml.js +4 -2
- package/dist/web/copy.js +22 -0
- package/package.json +2 -2
package/dist/tasks/run.js
CHANGED
|
@@ -15,7 +15,8 @@ const native_run_1 = require("../util/native-run");
|
|
|
15
15
|
const sync_1 = require("./sync");
|
|
16
16
|
async function runCommand(config, selectedPlatformName, options) {
|
|
17
17
|
var _a, _b, _c, _d;
|
|
18
|
-
options.host =
|
|
18
|
+
options.host =
|
|
19
|
+
(_b = (_a = options.host) !== null && _a !== void 0 ? _a : livereload_1.CapLiveReloadHelper.getIpAddress()) !== null && _b !== void 0 ? _b : 'localhost';
|
|
19
20
|
options.port = (_c = options.port) !== null && _c !== void 0 ? _c : '3000';
|
|
20
21
|
if (selectedPlatformName && !(await (0, common_1.isValidPlatform)(selectedPlatformName))) {
|
|
21
22
|
const platformDir = (0, common_1.resolvePlatform)(config, selectedPlatformName);
|
|
@@ -37,7 +38,7 @@ async function runCommand(config, selectedPlatformName, options) {
|
|
|
37
38
|
}
|
|
38
39
|
if (options.list) {
|
|
39
40
|
const targets = await (0, native_run_1.getPlatformTargets)(platformName);
|
|
40
|
-
const outputTargets = targets.map(
|
|
41
|
+
const outputTargets = targets.map(t => {
|
|
41
42
|
var _a;
|
|
42
43
|
return ({
|
|
43
44
|
name: (0, common_1.getPlatformTargetName)(t),
|
|
@@ -50,7 +51,7 @@ async function runCommand(config, selectedPlatformName, options) {
|
|
|
50
51
|
process.stdout.write(`${JSON.stringify(outputTargets)}\n`);
|
|
51
52
|
}
|
|
52
53
|
else {
|
|
53
|
-
const rows = outputTargets.map(
|
|
54
|
+
const rows = outputTargets.map(t => [t.name, t.api, t.id]);
|
|
54
55
|
log_1.output.write(`${(0, utils_terminal_1.columnar)(rows, {
|
|
55
56
|
headers: ['Name', 'API', 'Target ID'],
|
|
56
57
|
vsep: ' ',
|
|
@@ -71,7 +72,7 @@ async function runCommand(config, selectedPlatformName, options) {
|
|
|
71
72
|
}
|
|
72
73
|
await run(config, platformName, options);
|
|
73
74
|
if (options.liveReload) {
|
|
74
|
-
new Promise(
|
|
75
|
+
new Promise(resolve => process.on('SIGINT', resolve))
|
|
75
76
|
.then(async () => {
|
|
76
77
|
await livereload_1.CapLiveReloadHelper.revertCapConfigForLiveReload();
|
|
77
78
|
if (platformName === config.android.name) {
|
|
@@ -108,7 +109,7 @@ async function run(config, platformName, options) {
|
|
|
108
109
|
}
|
|
109
110
|
exports.run = run;
|
|
110
111
|
function createRunnablePlatformFilter(config) {
|
|
111
|
-
return
|
|
112
|
+
return platform => platform === config.ios.name || platform === config.android.name;
|
|
112
113
|
}
|
|
113
114
|
async function sleepForever() {
|
|
114
115
|
return new Promise(() => {
|
package/dist/tasks/sourcemaps.js
CHANGED
|
@@ -6,7 +6,7 @@ const path_1 = require("path");
|
|
|
6
6
|
const log_1 = require("../log");
|
|
7
7
|
function walkDirectory(dirPath) {
|
|
8
8
|
const files = (0, utils_fs_1.readdirSync)(dirPath);
|
|
9
|
-
files.forEach(
|
|
9
|
+
files.forEach(file => {
|
|
10
10
|
const targetFile = (0, path_1.join)(dirPath, file);
|
|
11
11
|
if ((0, utils_fs_1.existsSync)(targetFile) && (0, utils_fs_1.lstatSync)(targetFile).isDirectory()) {
|
|
12
12
|
walkDirectory(targetFile);
|
|
@@ -16,7 +16,8 @@ function walkDirectory(dirPath) {
|
|
|
16
16
|
if ((0, path_1.extname)(file) === '.js' && (0, utils_fs_1.existsSync)(mapFile)) {
|
|
17
17
|
const bufMap = (0, utils_fs_1.readFileSync)(mapFile).toString('base64');
|
|
18
18
|
const bufFile = (0, utils_fs_1.readFileSync)(targetFile, 'utf8');
|
|
19
|
-
const result = bufFile.replace(`sourceMappingURL=${file}.map`, 'sourceMappingURL=data:application/json;charset=utf-8;base64,' +
|
|
19
|
+
const result = bufFile.replace(`sourceMappingURL=${file}.map`, 'sourceMappingURL=data:application/json;charset=utf-8;base64,' +
|
|
20
|
+
bufMap);
|
|
20
21
|
(0, utils_fs_1.writeFileSync)(targetFile, result);
|
|
21
22
|
(0, utils_fs_1.unlinkSync)(mapFile);
|
|
22
23
|
}
|
package/dist/tasks/sync.js
CHANGED
|
@@ -25,8 +25,12 @@ async function syncCommand(config, selectedPlatformName, deployment, inline = fa
|
|
|
25
25
|
const then = +new Date();
|
|
26
26
|
const platforms = await (0, common_1.selectPlatforms)(config, selectedPlatformName);
|
|
27
27
|
try {
|
|
28
|
-
await (0, common_1.check)([
|
|
29
|
-
|
|
28
|
+
await (0, common_1.check)([
|
|
29
|
+
() => (0, common_1.checkPackage)(),
|
|
30
|
+
() => (0, common_1.checkWebDir)(config),
|
|
31
|
+
...(0, update_1.updateChecks)(config, platforms),
|
|
32
|
+
]);
|
|
33
|
+
await (0, promise_1.allSerial)(platforms.map(platformName => () => sync(config, platformName, deployment, inline)));
|
|
30
34
|
const now = +new Date();
|
|
31
35
|
const diff = (now - then) / 1000;
|
|
32
36
|
log_1.logger.info(`Sync finished in ${diff}s`);
|
package/dist/tasks/update.js
CHANGED
|
@@ -26,7 +26,7 @@ async function updateCommand(config, selectedPlatformName, deployment) {
|
|
|
26
26
|
const platforms = await (0, common_1.selectPlatforms)(config, selectedPlatformName);
|
|
27
27
|
try {
|
|
28
28
|
await (0, common_1.check)([() => (0, common_1.checkPackage)(), ...updateChecks(config, platforms)]);
|
|
29
|
-
await (0, promise_1.allSerial)(platforms.map(
|
|
29
|
+
await (0, promise_1.allSerial)(platforms.map(platformName => async () => await update(config, platformName, deployment)));
|
|
30
30
|
const now = +new Date();
|
|
31
31
|
const diff = (now - then) / 1000;
|
|
32
32
|
log_1.logger.info(`Update finished in ${diff}s`);
|
package/dist/util/fs.js
CHANGED
|
@@ -9,7 +9,7 @@ const convertToUnixPath = (path) => {
|
|
|
9
9
|
exports.convertToUnixPath = convertToUnixPath;
|
|
10
10
|
const deleteFolderRecursive = (directoryPath) => {
|
|
11
11
|
if ((0, utils_fs_1.existsSync)(directoryPath)) {
|
|
12
|
-
(0, utils_fs_1.readdirSync)(directoryPath).forEach(
|
|
12
|
+
(0, utils_fs_1.readdirSync)(directoryPath).forEach(file => {
|
|
13
13
|
const curPath = (0, path_1.join)(directoryPath, file);
|
|
14
14
|
if ((0, utils_fs_1.lstatSync)(curPath).isDirectory()) {
|
|
15
15
|
(0, exports.deleteFolderRecursive)(curPath);
|
package/dist/util/iosplugin.js
CHANGED
|
@@ -9,8 +9,9 @@ async function getPluginFiles(plugins) {
|
|
|
9
9
|
var _a;
|
|
10
10
|
let filenameList = [];
|
|
11
11
|
const options = {
|
|
12
|
-
filter:
|
|
13
|
-
if (item.stats.isFile() &&
|
|
12
|
+
filter: item => {
|
|
13
|
+
if (item.stats.isFile() &&
|
|
14
|
+
(item.path.endsWith('.swift') || item.path.endsWith('.m'))) {
|
|
14
15
|
return true;
|
|
15
16
|
}
|
|
16
17
|
else {
|
package/dist/util/livereload.js
CHANGED
|
@@ -73,7 +73,7 @@ class CapLiveReload {
|
|
|
73
73
|
return res[0].address;
|
|
74
74
|
}
|
|
75
75
|
const all = Object.keys(interfaces)
|
|
76
|
-
.map(
|
|
76
|
+
.map(nic => {
|
|
77
77
|
//
|
|
78
78
|
// Note: name will only be `public` or `private`
|
|
79
79
|
// when this is called.
|
|
@@ -86,7 +86,9 @@ class CapLiveReload {
|
|
|
86
86
|
if (!name) {
|
|
87
87
|
return true;
|
|
88
88
|
}
|
|
89
|
-
return name === 'public'
|
|
89
|
+
return name === 'public'
|
|
90
|
+
? isPrivate(details.address)
|
|
91
|
+
: isPublic(details.address);
|
|
90
92
|
});
|
|
91
93
|
return addresses.length ? addresses[0].address : undefined;
|
|
92
94
|
})
|
|
@@ -136,7 +138,8 @@ class CapLiveReload {
|
|
|
136
138
|
(0, utils_fs_1.writeJSONSync)(capConfigPath, configJson, { spaces: '\t' });
|
|
137
139
|
}
|
|
138
140
|
async revertCapConfigForLiveReload() {
|
|
139
|
-
if (this.configJsonToRevertTo.json == null ||
|
|
141
|
+
if (this.configJsonToRevertTo.json == null ||
|
|
142
|
+
this.configJsonToRevertTo.platformPath == null)
|
|
140
143
|
return;
|
|
141
144
|
const capConfigPath = this.configJsonToRevertTo.platformPath;
|
|
142
145
|
const configJson = this.configJsonToRevertTo.json;
|
|
@@ -13,7 +13,8 @@ function findMonorepoRoot(currentPath) {
|
|
|
13
13
|
const packageJsonPath = (0, node_path_1.join)(currentPath, 'package.json');
|
|
14
14
|
const pnpmWorkspacePath = (0, node_path_1.join)(currentPath, 'pnpm-workspace.yaml');
|
|
15
15
|
if ((0, node_fs_1.existsSync)(pnpmWorkspacePath) ||
|
|
16
|
-
((0, node_fs_1.existsSync)(packageJsonPath) &&
|
|
16
|
+
((0, node_fs_1.existsSync)(packageJsonPath) &&
|
|
17
|
+
JSON.parse((0, node_fs_1.readFileSync)(packageJsonPath, 'utf-8')).workspaces)) {
|
|
17
18
|
return currentPath;
|
|
18
19
|
}
|
|
19
20
|
const parentPath = (0, node_path_1.dirname)(currentPath);
|
package/dist/util/promise.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.lazy = exports.LazyPromise = exports.allSerial = void 0;
|
|
4
4
|
function allSerial(funcs) {
|
|
5
|
-
return funcs.reduce((promise, func) => promise.then(
|
|
5
|
+
return funcs.reduce((promise, func) => promise.then(result => func().then(x => result.concat(x))), Promise.resolve([]));
|
|
6
6
|
}
|
|
7
7
|
exports.allSerial = allSerial;
|
|
8
8
|
class LazyPromise extends Promise {
|
package/dist/util/spm.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.generatePackageFile = exports.findPackageSwiftFile = exports.checkPackageManager = void 0;
|
|
4
4
|
const utils_fs_1 = require("@ionic/utils-fs");
|
|
5
5
|
const path_1 = require("path");
|
|
6
|
+
const common_1 = require("../common");
|
|
6
7
|
const log_1 = require("../log");
|
|
7
8
|
async function checkPackageManager(config) {
|
|
8
9
|
const iosDirectory = config.ios.nativeProjectDirAbs;
|
|
@@ -21,7 +22,7 @@ async function generatePackageFile(config, plugins) {
|
|
|
21
22
|
const packageSwiftFile = await findPackageSwiftFile(config);
|
|
22
23
|
try {
|
|
23
24
|
log_1.logger.warn('SPM Support is still experimental');
|
|
24
|
-
const textToWrite = generatePackageText(config, plugins);
|
|
25
|
+
const textToWrite = await generatePackageText(config, plugins);
|
|
25
26
|
(0, utils_fs_1.writeFileSync)(packageSwiftFile, textToWrite);
|
|
26
27
|
}
|
|
27
28
|
catch (err) {
|
|
@@ -29,8 +30,9 @@ async function generatePackageFile(config, plugins) {
|
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
exports.generatePackageFile = generatePackageFile;
|
|
32
|
-
function generatePackageText(config, plugins) {
|
|
33
|
+
async function generatePackageText(config, plugins) {
|
|
33
34
|
var _a, _b, _c;
|
|
35
|
+
const iosPlatformVersion = await (0, common_1.getCapacitorPackageVersion)(config, config.ios.name);
|
|
34
36
|
const pbx = (0, utils_fs_1.readFileSync)((0, path_1.join)(config.ios.nativeXcodeProjDirAbs, 'project.pbxproj'), 'utf-8');
|
|
35
37
|
const searchString = 'IPHONEOS_DEPLOYMENT_TARGET = ';
|
|
36
38
|
const iosVersion = pbx.substring(pbx.indexOf(searchString) + searchString.length, pbx.indexOf(searchString) + searchString.length + 2);
|
|
@@ -47,7 +49,7 @@ let package = Package(
|
|
|
47
49
|
targets: ["CapApp-SPM"])
|
|
48
50
|
],
|
|
49
51
|
dependencies: [
|
|
50
|
-
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git",
|
|
52
|
+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", exact: "${iosPlatformVersion}")`;
|
|
51
53
|
for (const plugin of plugins) {
|
|
52
54
|
const relPath = (0, path_1.relative)(config.ios.nativeXcodeProjDirAbs, plugin.rootPath);
|
|
53
55
|
packageSwiftText += `,\n .package(name: "${(_a = plugin.ios) === null || _a === void 0 ? void 0 : _a.name}", path: "${relPath}")`;
|
package/dist/util/subprocess.js
CHANGED
|
@@ -10,7 +10,13 @@ async function runCommand(command, args, options = {}) {
|
|
|
10
10
|
catch (e) {
|
|
11
11
|
if (e instanceof utils_subprocess_1.SubprocessError) {
|
|
12
12
|
// old behavior of just throwing the stdout/stderr strings
|
|
13
|
-
throw e.output
|
|
13
|
+
throw e.output
|
|
14
|
+
? e.output
|
|
15
|
+
: e.code
|
|
16
|
+
? e.code
|
|
17
|
+
: e.error
|
|
18
|
+
? e.error.message
|
|
19
|
+
: 'Unknown error';
|
|
14
20
|
}
|
|
15
21
|
throw e;
|
|
16
22
|
}
|
package/dist/util/term.js
CHANGED
|
@@ -18,7 +18,7 @@ const checkInteractive = (...args) => {
|
|
|
18
18
|
}
|
|
19
19
|
// Make sure none of the provided args are empty, otherwise print the interactive
|
|
20
20
|
// warning and return false
|
|
21
|
-
if (args.filter(
|
|
21
|
+
if (args.filter(arg => !arg).length) {
|
|
22
22
|
log_1.logger.error(`Non-interactive shell detected.\n` +
|
|
23
23
|
`Run the command with ${colors_1.default.input('--help')} to see a list of arguments that must be provided.`);
|
|
24
24
|
return false;
|
package/dist/util/uuid.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.uuidv4 = void 0;
|
|
4
4
|
function uuidv4() {
|
|
5
|
-
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,
|
|
5
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
|
|
6
6
|
const r = (Math.random() * 16) | 0;
|
|
7
7
|
const v = c == 'x' ? r : (r & 0x3) | 0x8;
|
|
8
8
|
return v.toString(16);
|
package/dist/util/xml.js
CHANGED
|
@@ -21,7 +21,9 @@ async function readXML(path) {
|
|
|
21
21
|
}
|
|
22
22
|
exports.readXML = readXML;
|
|
23
23
|
function parseXML(xmlStr, options) {
|
|
24
|
-
const parser = options !== undefined
|
|
24
|
+
const parser = options !== undefined
|
|
25
|
+
? new xml2js_1.default.Parser({ ...options })
|
|
26
|
+
: new xml2js_1.default.Parser();
|
|
25
27
|
let xmlObj;
|
|
26
28
|
parser.parseString(xmlStr, (err, result) => {
|
|
27
29
|
if (!err) {
|
|
@@ -32,7 +34,7 @@ function parseXML(xmlStr, options) {
|
|
|
32
34
|
}
|
|
33
35
|
exports.parseXML = parseXML;
|
|
34
36
|
async function writeXML(object) {
|
|
35
|
-
return new Promise(
|
|
37
|
+
return new Promise(resolve => {
|
|
36
38
|
const builder = new xml2js_1.default.Builder({
|
|
37
39
|
headless: true,
|
|
38
40
|
explicitRoot: false,
|
package/dist/web/copy.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.copyWeb = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const utils_fs_1 = require("@ionic/utils-fs");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const colors_1 = tslib_1.__importDefault(require("../colors"));
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
const errors_1 = require("../errors");
|
|
10
|
+
const node_1 = require("../util/node");
|
|
11
|
+
async function copyWeb(config) {
|
|
12
|
+
if (config.app.bundledWebRuntime) {
|
|
13
|
+
const runtimePath = (0, node_1.resolveNode)(config.app.rootDir, '@capacitor/core', 'dist', 'capacitor.js');
|
|
14
|
+
if (!runtimePath) {
|
|
15
|
+
(0, errors_1.fatal)(`Unable to find ${colors_1.default.strong('node_modules/@capacitor/core/dist/capacitor.js')}.\n` + `Are you sure ${colors_1.default.strong('@capacitor/core')} is installed?`);
|
|
16
|
+
}
|
|
17
|
+
return (0, common_1.runTask)(`Copying ${colors_1.default.strong('capacitor.js')} to web dir`, () => {
|
|
18
|
+
return (0, utils_fs_1.copy)(runtimePath, (0, path_1.join)(config.app.webDirAbs, 'capacitor.js'));
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.copyWeb = copyWeb;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/cli",
|
|
3
|
-
"version": "6.1
|
|
3
|
+
"version": "6.2.1",
|
|
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)",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"cross platform"
|
|
28
28
|
],
|
|
29
29
|
"engines": {
|
|
30
|
-
"node": ">=
|
|
30
|
+
"node": ">=18.0.0"
|
|
31
31
|
},
|
|
32
32
|
"main": "dist/index.js",
|
|
33
33
|
"types": "dist/declarations.d.ts",
|