Update capacitor version

This commit is contained in:
Pieter Vander Vennet 2025-07-06 20:20:48 +02:00
parent 91155bce0a
commit f3b3a86b32
610 changed files with 28718 additions and 7101 deletions

View file

@ -1,9 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkExternalConfig = exports.writeConfig = exports.loadConfig = exports.CONFIG_FILE_NAME_JSON = exports.CONFIG_FILE_NAME_JS = exports.CONFIG_FILE_NAME_TS = void 0;
exports.writeConfig = exports.loadConfig = exports.CONFIG_FILE_NAME_JSON = exports.CONFIG_FILE_NAME_JS = exports.CONFIG_FILE_NAME_TS = void 0;
const tslib_1 = require("tslib");
const utils_fs_1 = require("@ionic/utils-fs");
const debug_1 = tslib_1.__importDefault(require("debug"));
const fs_extra_1 = require("fs-extra");
const path_1 = require("path");
const colors_1 = tslib_1.__importDefault(require("./colors"));
const common_1 = require("./common");
@ -28,7 +28,7 @@ async function loadConfig() {
var _a, _b;
if ((0, monorepotools_1.isNXMonorepo)(appRootDir)) {
const rootOfNXMonorepo = (0, monorepotools_1.findNXMonorepoRoot)(appRootDir);
const pkgJSONOfMonorepoRoot = await (0, fn_1.tryFn)(utils_fs_1.readJSON, (0, path_1.resolve)(rootOfNXMonorepo, 'package.json'));
const pkgJSONOfMonorepoRoot = await (0, fn_1.tryFn)(fs_extra_1.readJSON, (0, path_1.resolve)(rootOfNXMonorepo, 'package.json'));
const devDependencies = (_a = pkgJSONOfMonorepoRoot === null || pkgJSONOfMonorepoRoot === void 0 ? void 0 : pkgJSONOfMonorepoRoot.devDependencies) !== null && _a !== void 0 ? _a : {};
const dependencies = (_b = pkgJSONOfMonorepoRoot === null || pkgJSONOfMonorepoRoot === void 0 ? void 0 : pkgJSONOfMonorepoRoot.dependencies) !== null && _b !== void 0 ? _b : {};
return {
@ -53,7 +53,7 @@ async function loadConfig() {
appName,
webDir,
webDirAbs: (0, path_1.resolve)(appRootDir, webDir),
package: (_d = (await (0, fn_1.tryFn)(utils_fs_1.readJSON, (0, path_1.resolve)(appRootDir, 'package.json')))) !== null && _d !== void 0 ? _d : {
package: (_d = (await (0, fn_1.tryFn)(fs_extra_1.readJSON, (0, path_1.resolve)(appRootDir, 'package.json')))) !== null && _d !== void 0 ? _d : {
name: appName,
version: '1.0.0',
...depsForNx,
@ -68,11 +68,11 @@ exports.loadConfig = loadConfig;
async function writeConfig(extConfig, extConfigFilePath) {
switch ((0, path_1.extname)(extConfigFilePath)) {
case '.json': {
await (0, utils_fs_1.writeJSON)(extConfigFilePath, extConfig, { spaces: 2 });
await (0, fs_extra_1.writeJSON)(extConfigFilePath, extConfig, { spaces: 2 });
break;
}
case '.ts': {
await (0, utils_fs_1.writeFile)(extConfigFilePath, formatConfigTS(extConfig));
await (0, fs_extra_1.writeFile)(extConfigFilePath, formatConfigTS(extConfig));
break;
}
}
@ -88,9 +88,7 @@ async function loadExtConfigTS(rootDir, extConfigName, extConfigFilePath) {
}
const ts = require(tsPath); // eslint-disable-line @typescript-eslint/no-var-requires
const extConfigObject = (0, node_1.requireTS)(ts, extConfigFilePath);
const extConfig = extConfigObject.default
? await extConfigObject.default
: extConfigObject;
const extConfig = extConfigObject.default ? await extConfigObject.default : extConfigObject;
return {
extConfigType: 'ts',
extConfigName,
@ -122,11 +120,11 @@ async function loadExtConfigJS(rootDir, extConfigName, extConfigFilePath) {
async function loadExtConfig(rootDir) {
var _a;
const extConfigFilePathTS = (0, path_1.resolve)(rootDir, exports.CONFIG_FILE_NAME_TS);
if (await (0, utils_fs_1.pathExists)(extConfigFilePathTS)) {
if (await (0, fs_extra_1.pathExists)(extConfigFilePathTS)) {
return loadExtConfigTS(rootDir, exports.CONFIG_FILE_NAME_TS, extConfigFilePathTS);
}
const extConfigFilePathJS = (0, path_1.resolve)(rootDir, exports.CONFIG_FILE_NAME_JS);
if (await (0, utils_fs_1.pathExists)(extConfigFilePathJS)) {
if (await (0, fs_extra_1.pathExists)(extConfigFilePathJS)) {
return loadExtConfigJS(rootDir, exports.CONFIG_FILE_NAME_JS, extConfigFilePathJS);
}
const extConfigFilePath = (0, path_1.resolve)(rootDir, exports.CONFIG_FILE_NAME_JSON);
@ -134,7 +132,7 @@ async function loadExtConfig(rootDir) {
extConfigType: 'json',
extConfigName: exports.CONFIG_FILE_NAME_JSON,
extConfigFilePath: extConfigFilePath,
extConfig: (_a = (await (0, fn_1.tryFn)(utils_fs_1.readJSON, extConfigFilePath))) !== null && _a !== void 0 ? _a : {},
extConfig: (_a = (await (0, fn_1.tryFn)(fs_extra_1.readJSON, extConfigFilePath))) !== null && _a !== void 0 ? _a : {},
};
}
async function loadCLIConfig(rootDir) {
@ -162,7 +160,7 @@ async function loadCLIConfig(rootDir) {
cordovaPluginsTemplateArchiveAbs: (0, path_1.resolve)(assetsDirAbs, androidCordovaPluginsTemplateArchive),
},
},
package: await (0, utils_fs_1.readJSON)((0, path_1.resolve)(rootDir, 'package.json')),
package: await (0, fs_extra_1.readJSON)((0, path_1.resolve)(rootDir, 'package.json')),
os: determineOS(process.platform),
};
}
@ -196,7 +194,7 @@ async function loadAndroidConfig(rootDir, extConfig, cliConfig) {
};
return {
name,
minVersion: '22',
minVersion: '23',
studioPath,
platformDir,
platformDirAbs,
@ -222,7 +220,7 @@ async function loadAndroidConfig(rootDir, extConfig, cliConfig) {
};
}
async function loadIOSConfig(rootDir, extConfig) {
var _a, _b, _c, _d;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
const name = 'ios';
const platformDir = (_b = (_a = extConfig.ios) === null || _a === void 0 ? void 0 : _a.path) !== null && _b !== void 0 ? _b : 'ios';
const platformDirAbs = (0, path_1.resolve)(rootDir, platformDir);
@ -237,9 +235,15 @@ async function loadIOSConfig(rootDir, extConfig) {
const podPath = (0, promise_1.lazy)(() => determineGemfileOrCocoapodPath(rootDir, platformDirAbs, nativeProjectDirAbs));
const webDirAbs = (0, promise_1.lazy)(() => determineIOSWebDirAbs(nativeProjectDirAbs, nativeTargetDirAbs, nativeXcodeProjDirAbs));
const cordovaPluginsDir = 'capacitor-cordova-ios-plugins';
const buildOptions = {
exportMethod: (_f = (_e = extConfig.ios) === null || _e === void 0 ? void 0 : _e.buildOptions) === null || _f === void 0 ? void 0 : _f.exportMethod,
xcodeSigningStyle: (_h = (_g = extConfig.ios) === null || _g === void 0 ? void 0 : _g.buildOptions) === null || _h === void 0 ? void 0 : _h.signingStyle,
signingCertificate: (_k = (_j = extConfig.ios) === null || _j === void 0 ? void 0 : _j.buildOptions) === null || _k === void 0 ? void 0 : _k.signingCertificate,
provisioningProfile: (_m = (_l = extConfig.ios) === null || _l === void 0 ? void 0 : _l.buildOptions) === null || _m === void 0 ? void 0 : _m.provisioningProfile,
};
return {
name,
minVersion: '13.0',
minVersion: '14.0',
platformDir,
platformDirAbs,
scheme,
@ -256,6 +260,7 @@ async function loadIOSConfig(rootDir, extConfig) {
webDir: (0, promise_1.lazy)(async () => (0, path_1.relative)(platformDirAbs, await webDirAbs)),
webDirAbs,
podPath,
buildOptions,
};
}
async function loadWebConfig(rootDir, webDir) {
@ -285,7 +290,7 @@ async function determineIOSWebDirAbs(nativeProjectDirAbs, nativeTargetDirAbs, na
const re = /path\s=\spublic[\s\S]+?sourceTree\s=\s([^;]+)/;
const pbxprojPath = (0, path_1.resolve)(nativeXcodeProjDirAbs, 'project.pbxproj');
try {
const pbxproj = await (0, utils_fs_1.readFile)(pbxprojPath, { encoding: 'utf8' });
const pbxproj = await (0, fs_extra_1.readFile)(pbxprojPath, { encoding: 'utf8' });
const m = pbxproj.match(re);
if (m && m[1] === 'SOURCE_ROOT') {
log_1.logger.warn(`Using the iOS project root for the ${colors_1.default.strong('public')} directory is deprecated.\n` +
@ -309,7 +314,7 @@ async function determineAndroidStudioPath(os) {
const { runCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./util/subprocess')));
let p = 'C:\\Program Files\\Android\\Android Studio\\bin\\studio64.exe';
try {
if (!(await (0, utils_fs_1.pathExists)(p))) {
if (!(await (0, fs_extra_1.pathExists)(p))) {
let commandResult = await runCommand('REG', [
'QUERY',
'HKEY_LOCAL_MACHINE\\SOFTWARE\\Android Studio',
@ -339,13 +344,13 @@ async function determineGemfileOrCocoapodPath(rootDir, platformDir, nativeProjec
return process.env.CAPACITOR_COCOAPODS_PATH;
}
let gemfilePath = '';
if (await (0, utils_fs_1.pathExists)((0, path_1.resolve)(rootDir, 'Gemfile'))) {
if (await (0, fs_extra_1.pathExists)((0, path_1.resolve)(rootDir, 'Gemfile'))) {
gemfilePath = (0, path_1.resolve)(rootDir, 'Gemfile');
}
else if (await (0, utils_fs_1.pathExists)((0, path_1.resolve)(platformDir, 'Gemfile'))) {
else if (await (0, fs_extra_1.pathExists)((0, path_1.resolve)(platformDir, 'Gemfile'))) {
gemfilePath = (0, path_1.resolve)(platformDir, 'Gemfile');
}
else if (await (0, utils_fs_1.pathExists)((0, path_1.resolve)(nativeProjectDirAbs, 'Gemfile'))) {
else if (await (0, fs_extra_1.pathExists)((0, path_1.resolve)(nativeProjectDirAbs, 'Gemfile'))) {
gemfilePath = (0, path_1.resolve)(nativeProjectDirAbs, 'Gemfile');
}
const appSpecificGemfileExists = gemfilePath != '';
@ -362,7 +367,7 @@ async function determineGemfileOrCocoapodPath(rootDir, platformDir, nativeProjec
}
}
try {
const gemfileText = (await (0, utils_fs_1.readFile)(gemfilePath)).toString();
const gemfileText = (await (0, fs_extra_1.readFile)(gemfilePath)).toString();
if (!gemfileText) {
return 'pod';
}
@ -386,13 +391,3 @@ const config: CapacitorConfig = ${(0, js_1.formatJSObject)(extConfig)};
export default config;\n`;
}
function checkExternalConfig(config) {
if (typeof config.extConfig.bundledWebRuntime !== 'undefined') {
let actionMessage = `Can be safely deleted.`;
if (config.extConfig.bundledWebRuntime === true) {
actionMessage = `Please, use a bundler to bundle Capacitor and its plugins.`;
}
log_1.logger.warn(`The ${colors_1.default.strong('bundledWebRuntime')} configuration option has been deprecated. ${actionMessage}`);
}
}
exports.checkExternalConfig = checkExternalConfig;