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

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2017 Drifty Co
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1 @@
# @ionic/utils-process

View file

@ -0,0 +1,98 @@
/// <reference types="node" />
import { ChildProcess, ForkOptions, SpawnOptions } from 'child_process';
export declare const ERROR_COMMAND_NOT_FOUND = "ERR_SUBPROCESS_COMMAND_NOT_FOUND";
export declare const ERROR_NON_ZERO_EXIT = "ERR_SUBPROCESS_NON_ZERO_EXIT";
export declare const ERROR_SIGNAL_EXIT = "ERR_SUBPROCESS_SIGNAL_EXIT";
export declare const TILDE_PATH_REGEX: RegExp;
export declare function expandTildePath(p: string): string;
/**
* Prepare the PATH environment variable for use with subprocesses.
*
* If a raw tilde is found in PATH, e.g. `~/.bin`, it is expanded. The raw
* tilde works in Bash, but not in Node's `child_process` outside of a shell.
*
* This is a utility method. You do not need to use it with `Subprocess`.
*
* @param path Defaults to `process.env.PATH`
*/
export declare function convertPATH(path?: string): string;
export declare class SubprocessError extends Error {
readonly name = "SubprocessError";
code?: typeof ERROR_COMMAND_NOT_FOUND | typeof ERROR_NON_ZERO_EXIT | typeof ERROR_SIGNAL_EXIT;
output?: string;
signal?: string;
exitCode?: number;
}
export interface SubprocessOptions extends SpawnOptions {
}
export interface SubprocessBashifyOptions {
/**
* Mask file path to first argument.
*
* The first argument to subprocesses is the program name or path, e.g.
* `/path/to/bin/my-program`. If `true`, `bashify()` will return the program
* name without a file path, e.g. `my-program`.
*
* The default is `true`.
*/
maskArgv0?: boolean;
/**
* Mask file path to second argument.
*
* In some subprocesses, the second argument is a script file to run, e.g.
* `node ./scripts/post-install`. If `true`, `bashify()` will return the
* script name without a file path, e.g. `node post-install`.
*
* The default is `false`.
*/
maskArgv1?: boolean;
/**
* Remove the first argument from output.
*
* Useful to make a command such as `node ./scripts/post-install` appear as
* simply `post-install`.
*
* The default is `false`.
*/
shiftArgv0?: boolean;
}
export declare class Subprocess {
name: string;
args: readonly string[];
protected readonly path?: string;
protected _options: SpawnOptions;
constructor(name: string, args: readonly string[], options?: SubprocessOptions);
get options(): Readonly<SpawnOptions>;
output(): Promise<string>;
combinedOutput(): Promise<string>;
run(): Promise<void> & {
p: ChildProcess;
};
spawn(): ChildProcess;
bashify({ maskArgv0, maskArgv1, shiftArgv0 }?: SubprocessBashifyOptions): string;
bashifyArg(arg: string): string;
maskArg(arg: string): string;
}
export declare function spawn(command: string, args?: readonly string[], options?: SpawnOptions): ChildProcess;
export declare function fork(modulePath: string, args?: readonly string[], options?: ForkOptions & Pick<SpawnOptions, 'stdio'>): ChildProcess;
export interface WhichOptions {
PATH?: string;
PATHEXT?: string;
}
/**
* Find the first instance of a program in PATH.
*
* If `program` contains a path separator, this function will merely return it.
*
* @param program A command name, such as `ionic`
*/
export declare function which(program: string, { PATH, PATHEXT }?: WhichOptions): Promise<string>;
/**
* Find all instances of a program in PATH.
*
* If `program` contains a path separator, this function will merely return it
* inside an array.
*
* @param program A command name, such as `ionic`
*/
export declare function findExecutables(program: string, { PATH, PATHEXT }?: WhichOptions): Promise<string[]>;

View file

@ -0,0 +1,228 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.findExecutables = exports.which = exports.fork = exports.spawn = exports.Subprocess = exports.SubprocessError = exports.convertPATH = exports.expandTildePath = exports.TILDE_PATH_REGEX = exports.ERROR_SIGNAL_EXIT = exports.ERROR_NON_ZERO_EXIT = exports.ERROR_COMMAND_NOT_FOUND = void 0;
const tslib_1 = require("tslib");
const utils_array_1 = require("@ionic/utils-array");
const utils_fs_1 = require("@ionic/utils-fs");
const utils_process_1 = require("@ionic/utils-process");
const utils_stream_1 = require("@ionic/utils-stream");
const utils_terminal_1 = require("@ionic/utils-terminal");
const child_process_1 = require("child_process");
const cross_spawn_1 = tslib_1.__importDefault(require("cross-spawn"));
const os = tslib_1.__importStar(require("os"));
const pathlib = tslib_1.__importStar(require("path"));
exports.ERROR_COMMAND_NOT_FOUND = 'ERR_SUBPROCESS_COMMAND_NOT_FOUND';
exports.ERROR_NON_ZERO_EXIT = 'ERR_SUBPROCESS_NON_ZERO_EXIT';
exports.ERROR_SIGNAL_EXIT = 'ERR_SUBPROCESS_SIGNAL_EXIT';
exports.TILDE_PATH_REGEX = /^~($|\/|\\)/;
function expandTildePath(p) {
const h = os.homedir();
return p.replace(exports.TILDE_PATH_REGEX, `${h}$1`);
}
exports.expandTildePath = expandTildePath;
/**
* Prepare the PATH environment variable for use with subprocesses.
*
* If a raw tilde is found in PATH, e.g. `~/.bin`, it is expanded. The raw
* tilde works in Bash, but not in Node's `child_process` outside of a shell.
*
* This is a utility method. You do not need to use it with `Subprocess`.
*
* @param path Defaults to `process.env.PATH`
*/
function convertPATH(path = process.env.PATH || '') {
return path.split(pathlib.delimiter).map(expandTildePath).join(pathlib.delimiter);
}
exports.convertPATH = convertPATH;
class SubprocessError extends Error {
constructor() {
super(...arguments);
this.name = 'SubprocessError';
}
}
exports.SubprocessError = SubprocessError;
class Subprocess {
constructor(name, args, options = {}) {
this.name = name;
this.args = args;
const masked = this.maskArg(name);
if (masked !== name) {
this.name = masked;
this.path = name;
}
this._options = options;
}
get options() {
const opts = this._options;
if (!opts.env) {
opts.env = process.env;
}
const env = (0, utils_process_1.createProcessEnv)(opts.env || {}, {
PATH: convertPATH(typeof opts.env.PATH === 'string' ? opts.env.PATH : process.env.PATH),
});
return { ...opts, env };
}
async output() {
this._options.stdio = 'pipe';
const promise = this.run();
const stdoutBuf = new utils_stream_1.WritableStreamBuffer();
const stderrBuf = new utils_stream_1.WritableStreamBuffer();
const combinedBuf = new utils_stream_1.WritableStreamBuffer();
promise.p.stdout?.pipe(stdoutBuf);
promise.p.stdout?.pipe(combinedBuf);
promise.p.stderr?.pipe(stderrBuf);
promise.p.stderr?.pipe(combinedBuf);
try {
await promise;
}
catch (e) {
stdoutBuf.end();
stderrBuf.end();
e.output = combinedBuf.consume().toString();
throw e;
}
stderrBuf.end();
combinedBuf.end();
return stdoutBuf.consume().toString();
}
async combinedOutput() {
this._options.stdio = 'pipe';
const promise = this.run();
const buf = new utils_stream_1.WritableStreamBuffer();
promise.p.stdout?.pipe(buf);
promise.p.stderr?.pipe(buf);
try {
await promise;
}
catch (e) {
e.output = buf.consume().toString();
throw e;
}
return buf.consume().toString();
}
run() {
const p = this.spawn();
const promise = new Promise((resolve, reject) => {
p.on('error', (error) => {
let err;
if (error.code === 'ENOENT') {
err = new SubprocessError('Command not found.', { cause: error });
err.code = exports.ERROR_COMMAND_NOT_FOUND;
}
else {
err = new SubprocessError('Command error.', { cause: error });
}
reject(err);
});
p.on('close', (code, signal) => {
let err;
if (code === 0) {
return resolve();
}
else if (signal) {
err = new SubprocessError('Signal exit from subprocess.');
err.code = exports.ERROR_SIGNAL_EXIT;
err.signal = signal;
}
else if (code) {
err = new SubprocessError('Non-zero exit from subprocess.');
err.code = exports.ERROR_NON_ZERO_EXIT;
err.exitCode = code;
}
else {
return resolve();
}
reject(err);
});
});
Object.defineProperties(promise, {
p: { value: p },
});
return promise;
}
spawn() {
return spawn(this.path ? this.path : this.name, this.args, this.options);
}
bashify({ maskArgv0 = true, maskArgv1 = false, shiftArgv0 = false } = {}) {
const args = [this.path ? this.path : this.name, ...this.args];
if (shiftArgv0) {
args.shift();
}
if (args[0] && maskArgv0) {
args[0] = this.maskArg(args[0]);
}
if (args[1] && maskArgv1) {
args[1] = this.maskArg(args[1]);
}
return args.length > 0
? args.map(arg => this.bashifyArg(arg)).join(' ')
: '';
}
bashifyArg(arg) {
return arg.includes(' ') ? `"${arg.replace(/\"/g, '\\"')}"` : arg;
}
maskArg(arg) {
const i = arg.lastIndexOf(pathlib.sep);
return i >= 0 ? arg.substring(i + 1) : arg;
}
}
exports.Subprocess = Subprocess;
function spawn(command, args = [], options) {
return (0, cross_spawn_1.default)(command, [...args], options);
}
exports.spawn = spawn;
function fork(modulePath, args = [], options = {}) {
return (0, child_process_1.fork)(modulePath, [...args], options);
}
exports.fork = fork;
const DEFAULT_PATHEXT = utils_terminal_1.TERMINAL_INFO.windows ? '.COM;.EXE;.BAT;.CMD' : undefined;
/**
* Find the first instance of a program in PATH.
*
* If `program` contains a path separator, this function will merely return it.
*
* @param program A command name, such as `ionic`
*/
async function which(program, { PATH = process.env.PATH, PATHEXT = process.env.PATHEXT || DEFAULT_PATHEXT } = {}) {
if (program.includes(pathlib.sep)) {
return program;
}
const results = await _findExecutables(program, { PATH });
if (!results.length) {
const err = new Error(`${program} cannot be found within PATH`);
err.code = 'ENOENT';
throw err;
}
return results[0];
}
exports.which = which;
/**
* Find all instances of a program in PATH.
*
* If `program` contains a path separator, this function will merely return it
* inside an array.
*
* @param program A command name, such as `ionic`
*/
async function findExecutables(program, { PATH = process.env.PATH, PATHEXT = process.env.PATHEXT || DEFAULT_PATHEXT } = {}) {
if (program.includes(pathlib.sep)) {
return [program];
}
return _findExecutables(program, { PATH });
}
exports.findExecutables = findExecutables;
async function _findExecutables(program, { PATH = process.env.PATH, PATHEXT = process.env.PATHEXT || DEFAULT_PATHEXT } = {}) {
const pathParts = (0, utils_process_1.getPathParts)(PATH);
let programNames;
// if windows, cycle through all possible executable extensions
// ex: node.exe, npm.cmd, etc.
if (utils_terminal_1.TERMINAL_INFO.windows) {
const exts = (0, utils_process_1.getPathParts)(PATHEXT).map(ext => ext.toLowerCase());
// don't append extensions if one has already been provided
programNames = exts.includes(pathlib.extname(program).toLowerCase()) ? [program] : exts.map(ext => program + ext);
}
else {
programNames = [program];
}
return [].concat(...await (0, utils_array_1.map)(programNames, async (programName) => (0, utils_array_1.concurrentFilter)(pathParts.map(p => pathlib.join(p, programName)), async (p) => (0, utils_fs_1.isExecutableFile)(p))));
}

View file

@ -0,0 +1,55 @@
{
"name": "@ionic/utils-subprocess",
"version": "3.0.1",
"description": "Subprocess utils for NodeJS",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"homepage": "https://ionicframework.com/",
"author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
"license": "MIT",
"engines": {
"node": ">=16.0.0"
},
"files": [
"dist/",
"LICENSE",
"README.md"
],
"repository": {
"type": "git",
"url": "https://github.com/ionic-team/ionic-cli.git"
},
"bugs": {
"url": "https://github.com/ionic-team/ionic-cli/issues"
},
"scripts": {
"clean": "rimraf dist",
"lint": "true",
"build": "npm run clean && tsc",
"watch": "tsc -w --preserveWatchOutput",
"test": "jest --maxWorkers=4",
"prepublishOnly": "npm run build"
},
"dependencies": {
"@ionic/utils-array": "2.1.6",
"@ionic/utils-fs": "3.1.7",
"@ionic/utils-process": "2.1.12",
"@ionic/utils-stream": "3.1.7",
"@ionic/utils-terminal": "2.3.5",
"cross-spawn": "^7.0.3",
"debug": "^4.0.0",
"tslib": "^2.0.1"
},
"devDependencies": {
"@types/cross-spawn": "^6.0.0",
"@types/debug": "^4.1.1",
"@types/jest": "^26.0.10",
"@types/node": "~16.0.0",
"jest": "^26.4.2",
"jest-cli": "^26.0.1",
"lint-staged": "^10.0.2",
"rimraf": "^3.0.0",
"ts-jest": "~26.3.0",
"typescript": "~4.8.0"
}
}