@capacitor/cli 9.0.0-alpha.7 → 9.0.0-alpha.8
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/common.js +1 -1
- package/dist/config.js +4 -3
- package/dist/ios/common.js +1 -1
- package/dist/ios/update.js +3 -1
- package/dist/plugin.js +1 -1
- package/dist/tasks/list.js +1 -1
- package/dist/tasks/migrate.js +1 -2
- package/dist/util/capacitor-package.js +28 -1
- package/dist/util/cordova-ios.js +7 -0
- package/dist/util/js.js +1 -1
- package/dist/util/monorepotools.js +2 -2
- package/dist/util/node.js +3 -3
- package/dist/util/subprocess.js +2 -2
- package/dist/util/xml.js +1 -1
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/common.js
CHANGED
package/dist/config.js
CHANGED
|
@@ -88,7 +88,7 @@ async function loadExtConfigTS(rootDir, extConfigName, extConfigFilePath) {
|
|
|
88
88
|
(0, errors_1.fatal)('Could not find installation of TypeScript.\n' +
|
|
89
89
|
`To use ${colors_1.default.strong(extConfigName)} files, you must install TypeScript in your project, e.g. w/ ${colors_1.default.input('npm install -D typescript')}`);
|
|
90
90
|
}
|
|
91
|
-
const ts = require(tsPath); // eslint-disable-line @typescript-eslint/no-
|
|
91
|
+
const ts = require(tsPath); // eslint-disable-line @typescript-eslint/no-require-imports
|
|
92
92
|
const extConfigObject = (await (0, node_1.requireTS)(ts, extConfigFilePath));
|
|
93
93
|
const extConfig = extConfigObject.default ? await extConfigObject.default : extConfigObject;
|
|
94
94
|
return {
|
|
@@ -112,6 +112,7 @@ async function loadExtConfigJS(rootDir, extConfigName, extConfigFilePath) {
|
|
|
112
112
|
extConfigType: 'js',
|
|
113
113
|
extConfigName,
|
|
114
114
|
extConfigFilePath: extConfigFilePath,
|
|
115
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
115
116
|
extConfig: await require(extConfigFilePath),
|
|
116
117
|
};
|
|
117
118
|
}
|
|
@@ -302,7 +303,7 @@ async function determineIOSWebDirAbs(nativeProjectDirAbs, nativeTargetDirAbs, na
|
|
|
302
303
|
return (0, path_1.resolve)(nativeProjectDirAbs, 'public');
|
|
303
304
|
}
|
|
304
305
|
}
|
|
305
|
-
catch
|
|
306
|
+
catch {
|
|
306
307
|
// ignore
|
|
307
308
|
}
|
|
308
309
|
return (0, path_1.resolve)(nativeTargetDirAbs, 'public');
|
|
@@ -386,7 +387,7 @@ async function determinePackageManager(rootDir, platformDir, nativeProjectDirAbs
|
|
|
386
387
|
gemfilePath = (0, path_1.resolve)(output, 'Gemfile');
|
|
387
388
|
}
|
|
388
389
|
}
|
|
389
|
-
catch
|
|
390
|
+
catch {
|
|
390
391
|
// Nothing
|
|
391
392
|
}
|
|
392
393
|
}
|
package/dist/ios/common.js
CHANGED
package/dist/ios/update.js
CHANGED
|
@@ -56,6 +56,7 @@ async function updatePluginFiles(config, plugins, deployment) {
|
|
|
56
56
|
const iosPlatformVersion = await (0, common_1.getCapacitorPackageVersion)(config, config.ios.name);
|
|
57
57
|
const majorCapVersion = (0, semver_1.major)(iosPlatformVersion);
|
|
58
58
|
const capacitorPackage = await (0, capacitor_package_1.resolveCapacitorPackage)(config, 'from');
|
|
59
|
+
const iosVersion = (0, common_2.getMajoriOSVersion)(config);
|
|
59
60
|
await Promise.all(validSPMPackages.map(async (plugin) => {
|
|
60
61
|
const packageSwiftPath = (0, path_1.join)(plugin.rootPath, 'Package.swift');
|
|
61
62
|
let content = await (0, fs_extra_1.readFile)(packageSwiftPath, { encoding: 'utf-8' });
|
|
@@ -66,7 +67,8 @@ async function updatePluginFiles(config, plugins, deployment) {
|
|
|
66
67
|
if (capacitorPackage.sourceBased) {
|
|
67
68
|
// The plugin has to resolve to the same package identity as the app, or SPM ends up with
|
|
68
69
|
// two packages that both vend a Capacitor product.
|
|
69
|
-
|
|
70
|
+
let rewritten = (0, capacitor_package_1.rewriteCapacitorDependency)(content, capacitorPackage, plugin.rootPath);
|
|
71
|
+
rewritten = (0, capacitor_package_1.patchPackageSwiftDeploymentTarget)(rewritten, iosVersion).content;
|
|
70
72
|
if (rewritten !== content) {
|
|
71
73
|
await (0, fs_extra_1.writeFile)(packageSwiftPath, rewritten);
|
|
72
74
|
}
|
package/dist/plugin.js
CHANGED
package/dist/tasks/list.js
CHANGED
|
@@ -26,7 +26,7 @@ async function listCommand(config, selectedPlatformName) {
|
|
|
26
26
|
exports.listCommand = listCommand;
|
|
27
27
|
async function list(config, platform) {
|
|
28
28
|
const allPlugins = await (0, plugin_1.getPlugins)(config, platform);
|
|
29
|
-
let plugins
|
|
29
|
+
let plugins;
|
|
30
30
|
if (platform === config.ios.name) {
|
|
31
31
|
plugins = await (0, common_3.getIOSPlugins)(allPlugins);
|
|
32
32
|
}
|
package/dist/tasks/migrate.js
CHANGED
|
@@ -16,7 +16,6 @@ const subprocess_1 = require("../util/subprocess");
|
|
|
16
16
|
const template_1 = require("../util/template");
|
|
17
17
|
const migrate_edge_to_edge_1 = require("./migrate-edge-to-edge");
|
|
18
18
|
const migrate_swiftui_1 = require("./migrate-swiftui");
|
|
19
|
-
// eslint-disable-next-line prefer-const
|
|
20
19
|
let allDependencies = {};
|
|
21
20
|
const libs = ['@capacitor/core', '@capacitor/cli', '@capacitor/ios', '@capacitor/android'];
|
|
22
21
|
const plugins = [
|
|
@@ -132,7 +131,7 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
132
131
|
return installLatestLibs(installerType, runNpmInstall, config);
|
|
133
132
|
});
|
|
134
133
|
}
|
|
135
|
-
catch
|
|
134
|
+
catch {
|
|
136
135
|
log_1.logger.error(`${installerType} install failed. Try deleting node_modules folder and running ${colors_1.default.input(`${installerType} install --force`)} manually.`);
|
|
137
136
|
installFailed = true;
|
|
138
137
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findCapacitorDependencyVersion = exports.rewriteCapacitorDependency = exports.renderCapacitorPackage = exports.resolveCapacitorPackage = void 0;
|
|
3
|
+
exports.patchPackageSwiftDeploymentTarget = exports.findCapacitorDependencyVersion = exports.rewriteCapacitorDependency = exports.renderCapacitorPackage = exports.resolveCapacitorPackage = void 0;
|
|
4
4
|
const fs_extra_1 = require("fs-extra");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const semver_1 = require("semver");
|
|
@@ -95,6 +95,33 @@ function findCapacitorDependencyVersion(content) {
|
|
|
95
95
|
return undefined;
|
|
96
96
|
}
|
|
97
97
|
exports.findCapacitorDependencyVersion = findCapacitorDependencyVersion;
|
|
98
|
+
const IOS_PLATFORM_VERSION_REGEX = /\.iOS\(\s*(?:\.v(\d+)|"([\d.]+)")\s*\)/;
|
|
99
|
+
/**
|
|
100
|
+
* Bumps a Package.swift's declared iOS deployment target (e.g. `.iOS(.v13)` or `.iOS("14.0")`) up to
|
|
101
|
+
* `requiredIosVersion` if it's lower.
|
|
102
|
+
*
|
|
103
|
+
* Only relevant for the source package: it declares `platforms: [.iOS(.v16)]` on its own manifest,
|
|
104
|
+
* and SwiftPM enforces that across the whole graph, so a plugin still declaring an older, lower
|
|
105
|
+
* target fails to resolve with "requires minimum platform version X ... but this target supports Y" —
|
|
106
|
+
* even though the very same plugin links fine against the prebuilt `capacitor-swift-pm`, which never
|
|
107
|
+
* declared a `platforms:` entry for SwiftPM to check against.
|
|
108
|
+
*/
|
|
109
|
+
function patchPackageSwiftDeploymentTarget(content, requiredIosVersion) {
|
|
110
|
+
const match = content.match(IOS_PLATFORM_VERSION_REGEX);
|
|
111
|
+
if (!match) {
|
|
112
|
+
return { content, changed: false, previousVersion: null };
|
|
113
|
+
}
|
|
114
|
+
const isSymbolic = match[1] !== undefined;
|
|
115
|
+
const previousVersion = isSymbolic ? match[1] : match[2];
|
|
116
|
+
const requiredMajor = Math.trunc(parseFloat(requiredIosVersion));
|
|
117
|
+
if (parseFloat(previousVersion) >= requiredMajor) {
|
|
118
|
+
return { content, changed: false, previousVersion };
|
|
119
|
+
}
|
|
120
|
+
const replacement = isSymbolic ? `.iOS(.v${requiredMajor})` : `.iOS("${requiredMajor}.0")`;
|
|
121
|
+
const patchedContent = content.replace(IOS_PLATFORM_VERSION_REGEX, replacement);
|
|
122
|
+
return { content: patchedContent, changed: true, previousVersion };
|
|
123
|
+
}
|
|
124
|
+
exports.patchPackageSwiftDeploymentTarget = patchPackageSwiftDeploymentTarget;
|
|
98
125
|
function referencesCapacitor(call) {
|
|
99
126
|
return call.includes(BINARY_PACKAGE_IDENTITY) || call.includes(`${SOURCE_PACKAGE_URL}`);
|
|
100
127
|
}
|
package/dist/util/cordova-ios.js
CHANGED
|
@@ -218,6 +218,10 @@ async function copyPluginsNativeFiles(config, cordovaPlugins) {
|
|
|
218
218
|
fileContent = fileContent.replace(/self.webView.superview/g, 'self.viewController.view');
|
|
219
219
|
await (0, fs_extra_1.writeFile)(fileDest, fileContent, { encoding: 'utf-8' });
|
|
220
220
|
}
|
|
221
|
+
if (isSPM && fileContent.includes(`#import "AppDelegate.h"`)) {
|
|
222
|
+
fileContent = fileContent.replace(`#import "AppDelegate.h"`, `#import <Cordova/AppDelegate.h>`);
|
|
223
|
+
await (0, fs_extra_1.writeFile)(fileDest, fileContent, { encoding: 'utf-8' });
|
|
224
|
+
}
|
|
221
225
|
}
|
|
222
226
|
}
|
|
223
227
|
}
|
|
@@ -449,6 +453,9 @@ async function generateCordovaPackageFile(p, config) {
|
|
|
449
453
|
let content = await (0, fs_extra_1.readFile)(packageSwiftPath, { encoding: 'utf-8' });
|
|
450
454
|
content = content.replace(`apache`, `ionic-team`).replaceAll(`cordova-ios`, capacitorPackage.identity);
|
|
451
455
|
content = (0, capacitor_package_1.rewriteCapacitorDependency)(content, capacitorPackage, p.rootPath);
|
|
456
|
+
if (capacitorPackage.sourceBased) {
|
|
457
|
+
content = (0, capacitor_package_1.patchPackageSwiftDeploymentTarget)(content, iosVersion).content;
|
|
458
|
+
}
|
|
452
459
|
await (0, fs_extra_1.writeFile)(packageSwiftPath, content);
|
|
453
460
|
}
|
|
454
461
|
else {
|
package/dist/util/js.js
CHANGED
|
@@ -8,7 +8,7 @@ function formatJSObject(o) {
|
|
|
8
8
|
o = JSON.parse(JSON.stringify(o));
|
|
9
9
|
}
|
|
10
10
|
catch (e) {
|
|
11
|
-
throw new Error(`Cannot parse object as JSON: ${e.stack ? e.stack : e}
|
|
11
|
+
throw new Error(`Cannot parse object as JSON: ${e.stack ? e.stack : e}`, { cause: e });
|
|
12
12
|
}
|
|
13
13
|
return util_1.default.inspect(o, {
|
|
14
14
|
compact: false,
|
|
@@ -87,7 +87,7 @@ function isMonorepo(currentPath) {
|
|
|
87
87
|
findMonorepoRoot(currentPath);
|
|
88
88
|
return true;
|
|
89
89
|
}
|
|
90
|
-
catch
|
|
90
|
+
catch {
|
|
91
91
|
return false;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
@@ -102,7 +102,7 @@ function isNXMonorepo(currentPath) {
|
|
|
102
102
|
findNXMonorepoRoot(currentPath);
|
|
103
103
|
return true;
|
|
104
104
|
}
|
|
105
|
-
catch
|
|
105
|
+
catch {
|
|
106
106
|
return false;
|
|
107
107
|
}
|
|
108
108
|
}
|
package/dist/util/node.js
CHANGED
|
@@ -38,7 +38,7 @@ const requireTS = async (ts, p) => {
|
|
|
38
38
|
if ((e === null || e === void 0 ? void 0 : e.code) === 'ERR_UNKNOWN_FILE_EXTENSION') {
|
|
39
39
|
throw new Error(`Your installed version of TypeScript (${ts.version}) no longer provides the compiler API Capacitor previously used to load .ts config files, ` +
|
|
40
40
|
`and your Node.js runtime (${process.version}) doesn't support loading them natively either.\n` +
|
|
41
|
-
'Upgrade to Node.js 22.6+ (running with --experimental-strip-types), or Node.js 23.6+, to continue using capacitor.config.ts.');
|
|
41
|
+
'Upgrade to Node.js 22.6+ (running with --experimental-strip-types), or Node.js 23.6+, to continue using capacitor.config.ts.', { cause: e });
|
|
42
42
|
}
|
|
43
43
|
throw e;
|
|
44
44
|
}
|
|
@@ -68,7 +68,7 @@ const requireTS = async (ts, p) => {
|
|
|
68
68
|
}
|
|
69
69
|
(_a = module._compile) === null || _a === void 0 ? void 0 : _a.call(module, sourceText, fileName);
|
|
70
70
|
};
|
|
71
|
-
const m = require(id); // eslint-disable-line @typescript-eslint/no-
|
|
71
|
+
const m = require(id); // eslint-disable-line @typescript-eslint/no-require-imports
|
|
72
72
|
delete require.extensions['.ts'];
|
|
73
73
|
return m;
|
|
74
74
|
};
|
|
@@ -77,7 +77,7 @@ function resolveNode(root, ...pathSegments) {
|
|
|
77
77
|
try {
|
|
78
78
|
return require.resolve(pathSegments.join('/'), { paths: [root] });
|
|
79
79
|
}
|
|
80
|
-
catch
|
|
80
|
+
catch {
|
|
81
81
|
const path = [root, 'node_modules', ...pathSegments].join('/');
|
|
82
82
|
if ((0, fs_1.existsSync)(path)) {
|
|
83
83
|
return path;
|
package/dist/util/subprocess.js
CHANGED
|
@@ -20,7 +20,7 @@ async function getCommandOutput(command, args, options = {}) {
|
|
|
20
20
|
try {
|
|
21
21
|
return (await runCommand(command, args, options)).trim();
|
|
22
22
|
}
|
|
23
|
-
catch
|
|
23
|
+
catch {
|
|
24
24
|
return null;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -29,7 +29,7 @@ async function isInstalled(command) {
|
|
|
29
29
|
try {
|
|
30
30
|
await (0, utils_subprocess_1.which)(command);
|
|
31
31
|
}
|
|
32
|
-
catch
|
|
32
|
+
catch {
|
|
33
33
|
return false;
|
|
34
34
|
}
|
|
35
35
|
return true;
|
package/dist/util/xml.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/cli",
|
|
3
|
-
"version": "9.0.0-alpha.
|
|
3
|
+
"version": "9.0.0-alpha.8",
|
|
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)",
|