feat: estructura base OpenSpec + Skills + arquitectura limpia Capacitor+Dextie

This commit is contained in:
mono
2026-10-24 20:49:29 -05:00
parent 2e6262b5a5
commit 0c7cf651ce
1659 changed files with 265883 additions and 0 deletions

21
node_modules/@ionic/cli-framework-output/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2019 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.

1
node_modules/@ionic/cli-framework-output/README.md generated vendored Normal file
View File

@@ -0,0 +1 @@
# @ionic/cli-framework-output

View File

@@ -0,0 +1,33 @@
import { LoggerLevel } from './logger';
export declare type ColorFunction = (...text: string[]) => string;
export declare type LoggerColors = {
[L in LoggerLevel]: ColorFunction;
};
export interface Colors {
/**
* Used to mark text as important. Comparable to HTML's <strong>.
*/
strong: ColorFunction;
/**
* Used to mark text as less important.
*/
weak: ColorFunction;
/**
* Used to mark text as input such as commands, inputs, options, etc.
*/
input: ColorFunction;
/**
* Used to mark text as successful.
*/
success: ColorFunction;
/**
* Used to mark text as failed.
*/
failure: ColorFunction;
/**
* Used to mark text as ancillary or supportive.
*/
ancillary: ColorFunction;
log: LoggerColors;
}
export declare const NO_COLORS: Colors;

View File

@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NO_COLORS = void 0;
const utils_1 = require("./utils");
exports.NO_COLORS = Object.freeze({
strong: utils_1.identity,
weak: utils_1.identity,
input: utils_1.identity,
success: utils_1.identity,
failure: utils_1.identity,
ancillary: utils_1.identity,
log: Object.freeze({
DEBUG: utils_1.identity,
INFO: utils_1.identity,
WARN: utils_1.identity,
ERROR: utils_1.identity,
}),
});

View File

@@ -0,0 +1,24 @@
import { TTY_WIDTH, indent, sliceAnsi, stringWidth, stripAnsi, wordWrap } from '@ionic/utils-terminal';
import { Logger, CreateTaggedFormatterOptions } from './logger';
import { OutputStrategy } from './output';
export { TTY_WIDTH, indent, sliceAnsi, stringWidth, stripAnsi, wordWrap };
export * from './colors';
export * from './logger';
export * from './output';
export * from './tasks';
export interface CreateDefaultLoggerOptions {
/**
* Specify a custom output strategy to use for the logger.
*
* By default, the logger uses a output strategy with process.stdout and no colors.
*/
output?: OutputStrategy;
/**
* Specify custom logger formatter options.
*/
formatterOptions?: CreateTaggedFormatterOptions;
}
/**
* Creates a logger instance with good defaults.
*/
export declare function createDefaultLogger({ output, formatterOptions }?: CreateDefaultLoggerOptions): Logger;

29
node_modules/@ionic/cli-framework-output/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createDefaultLogger = exports.wordWrap = exports.stripAnsi = exports.stringWidth = exports.sliceAnsi = exports.indent = exports.TTY_WIDTH = void 0;
const tslib_1 = require("tslib");
const utils_terminal_1 = require("@ionic/utils-terminal");
Object.defineProperty(exports, "TTY_WIDTH", { enumerable: true, get: function () { return utils_terminal_1.TTY_WIDTH; } });
Object.defineProperty(exports, "indent", { enumerable: true, get: function () { return utils_terminal_1.indent; } });
Object.defineProperty(exports, "sliceAnsi", { enumerable: true, get: function () { return utils_terminal_1.sliceAnsi; } });
Object.defineProperty(exports, "stringWidth", { enumerable: true, get: function () { return utils_terminal_1.stringWidth; } });
Object.defineProperty(exports, "stripAnsi", { enumerable: true, get: function () { return utils_terminal_1.stripAnsi; } });
Object.defineProperty(exports, "wordWrap", { enumerable: true, get: function () { return utils_terminal_1.wordWrap; } });
const colors_1 = require("./colors");
const logger_1 = require("./logger");
const output_1 = require("./output");
tslib_1.__exportStar(require("./colors"), exports);
tslib_1.__exportStar(require("./logger"), exports);
tslib_1.__exportStar(require("./output"), exports);
tslib_1.__exportStar(require("./tasks"), exports);
/**
* Creates a logger instance with good defaults.
*/
function createDefaultLogger({ output = new output_1.StreamOutputStrategy({ colors: colors_1.NO_COLORS, stream: process.stdout }), formatterOptions } = {}) {
const { weak } = output.colors;
const prefix = process.argv.includes('--log-timestamps') ? () => `${weak('[' + new Date().toISOString() + ']')}` : '';
const formatter = (0, logger_1.createTaggedFormatter)({ colors: output.colors, prefix, titleize: true, wrap: true, ...formatterOptions });
const handlers = new Set([new logger_1.StreamHandler({ stream: output.stream, formatter })]);
return new logger_1.Logger({ handlers });
}
exports.createDefaultLogger = createDefaultLogger;

View File

@@ -0,0 +1,105 @@
/// <reference types="node" />
import { WordWrapOptions } from '@ionic/utils-terminal';
import { ColorFunction, Colors } from './colors';
export interface LogRecord {
msg: string;
logger: Logger;
level?: LoggerLevelWeight;
format?: boolean;
}
export declare type LoggerLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
export declare type LoggerLevelWeight = number;
export declare type LoggerFormatter = (record: LogRecord) => string;
export declare const LOGGER_LEVELS: {
readonly [L in LoggerLevel]: LoggerLevelWeight;
};
export declare const LOGGER_LEVEL_NAMES: ReadonlyMap<LoggerLevelWeight, LoggerLevel>;
export declare function getLoggerLevelName(level?: LoggerLevelWeight): LoggerLevel | undefined;
export declare function getLoggerLevelColor(colors: Colors, level?: LoggerLevelWeight): ColorFunction | undefined;
export interface LoggerHandler {
formatter?: LoggerFormatter;
clone(): LoggerHandler;
handle(record: LogRecord): void;
}
export interface StreamHandlerOptions {
readonly stream: NodeJS.WritableStream;
readonly filter?: (record: LogRecord) => boolean;
readonly formatter?: LoggerFormatter;
}
export declare class StreamHandler implements LoggerHandler {
readonly stream: NodeJS.WritableStream;
readonly filter?: (record: LogRecord) => boolean;
formatter?: LoggerFormatter;
constructor({ stream, filter, formatter }: StreamHandlerOptions);
clone(opts?: Partial<StreamHandlerOptions>): StreamHandler;
handle(record: LogRecord): void;
}
export declare const DEFAULT_LOGGER_HANDLERS: ReadonlySet<StreamHandler>;
export interface LoggerOptions {
readonly handlers?: Set<LoggerHandler>;
readonly level?: LoggerLevelWeight;
}
export declare class Logger {
handlers: Set<LoggerHandler>;
level: LoggerLevelWeight;
constructor({ level, handlers }?: LoggerOptions);
static cloneHandlers(handlers: ReadonlySet<LoggerHandler>): Set<LoggerHandler>;
/**
* Clone this logger, optionally overriding logger options.
*
* @param opts Logger options to override from this logger.
*/
clone(opts?: Partial<LoggerOptions>): Logger;
/**
* Log a message as-is.
*
* @param msg The string to log.
*/
msg(msg: string): void;
/**
* Log a message using the `debug` logger level.
*
* @param msg The string to log.
*/
debug(msg: string): void;
/**
* Log a message using the `info` logger level.
*
* @param msg The string to log.
*/
info(msg: string): void;
/**
* Log a message using the `warn` logger level.
*
* @param msg The string to log.
*/
warn(msg: string): void;
/**
* Log a message using the `error` logger level.
*
* @param msg The string to log.
*/
error(msg: string): void;
createRecord(msg: string, level?: LoggerLevelWeight, format?: boolean): LogRecord;
/**
* Log newlines using a logger output found via `level`.
*
* @param num The number of newlines to log.
* @param level The logger level. If omitted, the default output is used.
*/
nl(num?: number, level?: LoggerLevelWeight): void;
/**
* Log a record using a logger output found via `level`.
*/
log(record: LogRecord): void;
createWriteStream(level?: LoggerLevelWeight, format?: boolean): NodeJS.WritableStream;
}
export interface CreateTaggedFormatterOptions {
prefix?: string | (() => string);
titleize?: boolean;
wrap?: boolean | WordWrapOptions;
colors?: Colors;
tags?: ReadonlyMap<LoggerLevelWeight, string>;
}
export declare function createTaggedFormatter({ colors, prefix, tags, titleize, wrap }?: CreateTaggedFormatterOptions): LoggerFormatter;
export declare function createPrefixedFormatter(prefix: string | (() => string)): LoggerFormatter;

203
node_modules/@ionic/cli-framework-output/dist/logger.js generated vendored Normal file
View File

@@ -0,0 +1,203 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createPrefixedFormatter = exports.createTaggedFormatter = exports.Logger = exports.DEFAULT_LOGGER_HANDLERS = exports.StreamHandler = exports.getLoggerLevelColor = exports.getLoggerLevelName = exports.LOGGER_LEVEL_NAMES = exports.LOGGER_LEVELS = void 0;
const tslib_1 = require("tslib");
const utils_terminal_1 = require("@ionic/utils-terminal");
const stream_1 = require("stream");
const util = tslib_1.__importStar(require("util"));
const colors_1 = require("./colors");
const utils_1 = require("./utils");
exports.LOGGER_LEVELS = Object.freeze({
DEBUG: 10,
INFO: 20,
WARN: 30,
ERROR: 40,
});
exports.LOGGER_LEVEL_NAMES = new Map([
[exports.LOGGER_LEVELS.DEBUG, 'DEBUG'],
[exports.LOGGER_LEVELS.INFO, 'INFO'],
[exports.LOGGER_LEVELS.WARN, 'WARN'],
[exports.LOGGER_LEVELS.ERROR, 'ERROR'],
]);
function getLoggerLevelName(level) {
if (level) {
const levelName = exports.LOGGER_LEVEL_NAMES.get(level);
if (levelName) {
return levelName;
}
}
}
exports.getLoggerLevelName = getLoggerLevelName;
function getLoggerLevelColor(colors, level) {
const levelName = getLoggerLevelName(level);
if (levelName) {
return colors.log[levelName];
}
}
exports.getLoggerLevelColor = getLoggerLevelColor;
class StreamHandler {
constructor({ stream, filter, formatter }) {
this.stream = stream;
this.filter = filter;
this.formatter = formatter;
}
clone(opts) {
const { stream, filter, formatter } = this;
return new StreamHandler({ stream, filter, formatter, ...opts });
}
handle(record) {
if (this.filter && !this.filter(record)) {
return;
}
const msg = this.formatter && record.format !== false ? this.formatter(record) : record.msg;
this.stream.write((0, utils_1.enforceLF)(msg));
}
}
exports.StreamHandler = StreamHandler;
const stdoutLogRecordFilter = (record) => !record.level || record.level === exports.LOGGER_LEVELS.INFO;
const stderrLogRecordFilter = (record) => !!record.level && record.level !== exports.LOGGER_LEVELS.INFO;
exports.DEFAULT_LOGGER_HANDLERS = new Set([
new StreamHandler({ stream: process.stdout, filter: stdoutLogRecordFilter }),
new StreamHandler({ stream: process.stderr, filter: stderrLogRecordFilter }),
]);
class Logger {
constructor({ level = exports.LOGGER_LEVELS.INFO, handlers } = {}) {
this.level = level;
this.handlers = handlers ? handlers : Logger.cloneHandlers(exports.DEFAULT_LOGGER_HANDLERS);
}
static cloneHandlers(handlers) {
return new Set([...handlers].map(handler => handler.clone()));
}
/**
* Clone this logger, optionally overriding logger options.
*
* @param opts Logger options to override from this logger.
*/
clone(opts = {}) {
const { level, handlers } = this;
return new Logger({ level, handlers: Logger.cloneHandlers(handlers), ...opts });
}
/**
* Log a message as-is.
*
* @param msg The string to log.
*/
msg(msg) {
this.log(this.createRecord(msg));
}
/**
* Log a message using the `debug` logger level.
*
* @param msg The string to log.
*/
debug(msg) {
this.log(this.createRecord(msg, exports.LOGGER_LEVELS.DEBUG));
}
/**
* Log a message using the `info` logger level.
*
* @param msg The string to log.
*/
info(msg) {
this.log(this.createRecord(msg, exports.LOGGER_LEVELS.INFO));
}
/**
* Log a message using the `warn` logger level.
*
* @param msg The string to log.
*/
warn(msg) {
this.log(this.createRecord(msg, exports.LOGGER_LEVELS.WARN));
}
/**
* Log a message using the `error` logger level.
*
* @param msg The string to log.
*/
error(msg) {
this.log(this.createRecord(msg, exports.LOGGER_LEVELS.ERROR));
}
createRecord(msg, level, format) {
return {
// If the logger is used to quickly print something, let's pretty-print
// it into a string.
msg: util.format(msg),
level,
logger: this,
format,
};
}
/**
* Log newlines using a logger output found via `level`.
*
* @param num The number of newlines to log.
* @param level The logger level. If omitted, the default output is used.
*/
nl(num = 1, level) {
this.log({ ...this.createRecord('\n'.repeat(num), level), format: false });
}
/**
* Log a record using a logger output found via `level`.
*/
log(record) {
if (typeof record.level === 'number' && this.level > record.level) {
return;
}
for (const handler of this.handlers) {
handler.handle(record);
}
}
createWriteStream(level, format) {
const self = this;
return new class extends stream_1.Writable {
_write(chunk, encoding, callback) {
self.log(self.createRecord(chunk.toString(), level, format));
callback();
}
}();
}
}
exports.Logger = Logger;
function createTaggedFormatter({ colors = colors_1.NO_COLORS, prefix = '', tags, titleize, wrap } = {}) {
const { strong, weak } = colors;
const getLevelTag = (level) => {
if (!level) {
return '';
}
if (tags) {
const tag = tags.get(level);
return tag ? tag : '';
}
const levelName = getLoggerLevelName(level);
if (!levelName) {
return '';
}
const levelColor = getLoggerLevelColor(colors, level);
return `${weak('[')}\x1b[40m${strong(levelColor ? levelColor(levelName) : levelName)}\x1b[49m${weak(']')}`;
};
return ({ msg, level, format }) => {
if (format === false) {
return msg;
}
const [firstLine, ...lines] = msg.split('\n');
const levelColor = getLoggerLevelColor(colors, level);
const tag = (typeof prefix === 'function' ? prefix() : prefix) + getLevelTag(level);
const title = titleize && lines.length > 0 ? `${strong(levelColor ? levelColor(firstLine) : firstLine)}\n` : firstLine;
const indentation = tag ? (0, utils_terminal_1.stringWidth)(tag) + 1 : 0;
const pulledLines = titleize ? (0, utils_1.dropWhile)(lines, l => l === '') : lines;
return ((tag ? `${tag} ` : '') +
(wrap
? (0, utils_terminal_1.wordWrap)([title, ...pulledLines].join('\n'), { indentation, ...(typeof wrap === 'object' ? wrap : {}) })
: [title, ...pulledLines.map(l => l ? ' '.repeat(indentation) + l : '')].join('\n')));
};
}
exports.createTaggedFormatter = createTaggedFormatter;
function createPrefixedFormatter(prefix) {
return ({ msg, format }) => {
if (format === false) {
return msg;
}
return `${typeof prefix === 'function' ? prefix() : prefix} ${msg}`;
};
}
exports.createPrefixedFormatter = createPrefixedFormatter;

View File

@@ -0,0 +1,41 @@
/// <reference types="node" />
/// <reference types="node" />
import { Colors } from './colors';
import { TaskChain } from './tasks';
export interface OutputStrategy {
readonly stream: NodeJS.WritableStream;
readonly colors: Colors;
write(msg: string): boolean;
createTaskChain(): TaskChain;
}
export interface StreamOutputStrategyOptions {
readonly stream?: NodeJS.WritableStream;
readonly colors?: Colors;
}
export declare class StreamOutputStrategy implements OutputStrategy {
readonly stream: NodeJS.WritableStream;
readonly colors: Colors;
constructor({ stream, colors }: StreamOutputStrategyOptions);
write(msg: string): boolean;
createTaskChain(): TaskChain;
}
export interface TTYOutputStrategyOptions extends StreamOutputStrategyOptions {
readonly stream?: NodeJS.WriteStream;
}
export declare class TTYOutputStrategy extends StreamOutputStrategy implements OutputStrategy {
readonly stream: NodeJS.WriteStream;
protected readonly redrawer: TTYOutputRedrawer;
constructor({ stream, colors }?: TTYOutputStrategyOptions);
createTaskChain(): TaskChain;
}
export interface TTYOutputRedrawerOptions {
readonly stream?: NodeJS.WriteStream;
}
export declare class TTYOutputRedrawer {
readonly stream: NodeJS.WriteStream;
constructor({ stream }: TTYOutputRedrawerOptions);
get width(): number;
redraw(msg: string): void;
clear(): void;
end(): void;
}

View File

@@ -0,0 +1,86 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TTYOutputRedrawer = exports.TTYOutputStrategy = exports.StreamOutputStrategy = void 0;
const utils_terminal_1 = require("@ionic/utils-terminal");
const colors_1 = require("./colors");
const tasks_1 = require("./tasks");
const utils_1 = require("./utils");
class StreamOutputStrategy {
constructor({ stream = process.stdout, colors = colors_1.NO_COLORS }) {
this.stream = stream;
this.colors = colors;
}
write(msg) {
return this.stream.write(msg);
}
createTaskChain() {
const { failure, success, weak } = this.colors;
const chain = new tasks_1.TaskChain();
chain.on('next', task => {
task.on('end', result => {
if (result.success) {
this.write(`${success(tasks_1.ICON_SUCCESS)} ${task.msg} ${weak(`in ${(0, utils_1.formatHrTime)(result.elapsedTime)}`)}\n`);
}
else {
this.write(`${failure(tasks_1.ICON_FAILURE)} ${task.msg} ${failure(weak('- failed!'))}\n`);
}
});
});
return chain;
}
}
exports.StreamOutputStrategy = StreamOutputStrategy;
class TTYOutputStrategy extends StreamOutputStrategy {
constructor({ stream = process.stdout, colors = colors_1.NO_COLORS } = {}) {
super({ stream, colors });
this.stream = stream;
this.redrawer = new TTYOutputRedrawer({ stream });
}
createTaskChain() {
const { failure, strong, success, weak } = this.colors;
const chain = new tasks_1.TaskChain({ taskOptions: { tickInterval: 50 } });
chain.on('next', task => {
task.on('end', result => {
if (result.success) {
this.write(`${success(tasks_1.ICON_SUCCESS)} ${task.msg} ${weak(`in ${(0, utils_1.formatHrTime)(result.elapsedTime)}`)}\n`);
}
else {
this.write(`${failure(tasks_1.ICON_FAILURE)} ${task.msg} ${failure(weak('- failed!'))}\n`);
}
});
const spinner = new tasks_1.Spinner();
task.on('tick', () => {
const progress = task.progressRatio ? (task.progressRatio * 100).toFixed(2) : '';
const frame = spinner.frame();
this.redrawer.redraw(`${strong(frame)} ${task.msg}${progress ? ' (' + strong(String(progress) + '%') + ')' : ''} `);
});
task.on('clear', () => {
this.redrawer.clear();
});
});
chain.on('end', () => {
this.redrawer.end();
});
return chain;
}
}
exports.TTYOutputStrategy = TTYOutputStrategy;
class TTYOutputRedrawer {
constructor({ stream = process.stdout }) {
this.stream = stream;
}
get width() {
return this.stream.columns || 80;
}
redraw(msg) {
utils_terminal_1.Cursor.hide();
this.stream.write(utils_terminal_1.EscapeCode.eraseLines(1) + msg.replace(/[\r\n]+$/, ''));
}
clear() {
this.stream.write(utils_terminal_1.EscapeCode.eraseLines(1));
}
end() {
utils_terminal_1.Cursor.show();
}
}
exports.TTYOutputRedrawer = TTYOutputRedrawer;

View File

@@ -0,0 +1,79 @@
/// <reference types="node" />
/// <reference types="node" />
import { EventEmitter } from 'events';
export declare const ICON_SUCCESS: string;
export declare const ICON_FAILURE: string;
export declare class Spinner {
frames: string[];
i: number;
constructor(frames?: string[]);
frame(): string;
}
export interface TaskOptions {
readonly msg?: string;
readonly tickInterval?: number;
}
export interface TaskResult {
/**
* Elapsed time from process.hrtime()
*/
elapsedTime: [number, number];
/**
* Whether the task succeeded or not
*/
success: boolean;
}
export interface Task extends EventEmitter {
on(name: 'success', handler: () => void): this;
on(name: 'failure', handler: () => void): this;
on(name: 'clear', handler: () => void): this;
on(name: 'tick', handler: () => void): this;
on(name: 'end', handler: (result: TaskResult) => void): this;
emit(name: 'success'): boolean;
emit(name: 'failure'): boolean;
emit(name: 'clear'): boolean;
emit(name: 'tick'): boolean;
emit(name: 'end', result: TaskResult): boolean;
}
export declare class Task extends EventEmitter {
tickInterval?: number;
intervalId?: NodeJS.Timer;
running: boolean;
progressRatio?: number;
protected _msg: string;
protected _startTime?: [number, number];
protected _success: boolean;
constructor({ msg, tickInterval }?: TaskOptions);
get msg(): string;
set msg(msg: string);
start(): this;
tick(): this;
progress(prog: number, total: number): this;
clear(): this;
end(): this;
succeed(): this;
fail(): this;
}
export interface TaskChain extends EventEmitter {
on(name: 'end', handler: (lastTask?: Task) => void): this;
on(name: 'failure', handler: (failedTask?: Task) => void): this;
on(name: 'next', handler: (task: Task) => void): this;
emit(name: 'end', lastTask?: Task): boolean;
emit(name: 'failure', failedTask?: Task): boolean;
emit(name: 'next', task: Task): boolean;
}
export interface TaskChainOptions {
readonly taskOptions?: Partial<TaskOptions>;
}
export declare class TaskChain extends EventEmitter {
protected current?: Task;
protected readonly tasks: Task[];
protected readonly taskOptions: Partial<TaskOptions>;
constructor({ taskOptions }?: TaskChainOptions);
next(msg: string): Task;
createTask(options: TaskOptions): Task;
nextTask(task: Task): Task;
end(): this;
fail(): this;
cleanup(): this;
}

141
node_modules/@ionic/cli-framework-output/dist/tasks.js generated vendored Normal file
View File

@@ -0,0 +1,141 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TaskChain = exports.Task = exports.Spinner = exports.ICON_FAILURE = exports.ICON_SUCCESS = void 0;
const events_1 = require("events");
const isWindows = process.platform === 'win32';
exports.ICON_SUCCESS = isWindows ? '√' : '✔';
exports.ICON_FAILURE = isWindows ? '×' : '✖';
const SPINNER_FRAMES = isWindows ?
['-', '\\', '|', '/'] :
['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
class Spinner {
constructor(frames = SPINNER_FRAMES) {
this.frames = frames;
this.i = 0;
}
frame() {
return this.frames[this.i = ++this.i % this.frames.length];
}
}
exports.Spinner = Spinner;
class Task extends events_1.EventEmitter {
constructor({ msg = '', tickInterval } = {}) {
super();
this.running = false;
this._msg = '';
this._success = false;
this.msg = msg;
this.tickInterval = tickInterval;
}
get msg() {
return this._msg;
}
set msg(msg) {
this._msg = msg;
this.tick();
}
start() {
if (!this.running && this.tickInterval) {
this.intervalId = setInterval(() => { this.tick(); }, this.tickInterval);
}
this.running = true;
this._startTime = process.hrtime();
return this;
}
tick() {
this.emit('tick');
return this;
}
progress(prog, total) {
this.progressRatio = prog / total;
this.tick();
return this;
}
clear() {
if (this.intervalId) {
clearInterval(this.intervalId);
this.intervalId = undefined;
}
this.emit('clear');
return this;
}
end() {
this.running = false;
this.tick();
this.clear();
this.emit('end', {
elapsedTime: process.hrtime(this._startTime),
success: this._success,
});
return this;
}
succeed() {
if (this.running) {
this._success = true;
this.end();
this.emit('success');
}
return this;
}
fail() {
if (this.running) {
this._success = false;
this.end();
this.emit('failure');
}
return this;
}
}
exports.Task = Task;
class TaskChain extends events_1.EventEmitter {
constructor({ taskOptions = {} } = {}) {
super();
this.tasks = [];
this.taskOptions = taskOptions;
}
next(msg) {
return this.nextTask(this.createTask({ msg, ...this.taskOptions }));
}
createTask(options) {
return new Task(options);
}
nextTask(task) {
if (this.current) {
this.current.succeed();
}
this.tasks.push(task);
this.current = task;
task.start();
this.emit('next', task);
return task;
}
end() {
const task = this.current;
if (task) {
task.succeed();
}
this.current = undefined;
this.emit('end', task);
return this;
}
fail() {
const task = this.current;
if (task) {
task.fail();
}
this.emit('failure', task);
return this;
}
cleanup() {
for (const task of this.tasks) {
if (task.running) {
task.fail();
}
else {
task.clear();
}
}
return this;
}
}
exports.TaskChain = TaskChain;

View File

@@ -0,0 +1,4 @@
export declare function identity<T>(v: T): T;
export declare function enforceLF(str: string): string;
export declare function dropWhile<T>(array: readonly T[], predicate?: (item: T) => boolean): T[];
export declare function formatHrTime(hrtime: [number, number]): string;

39
node_modules/@ionic/cli-framework-output/dist/utils.js generated vendored Normal file
View File

@@ -0,0 +1,39 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatHrTime = exports.dropWhile = exports.enforceLF = exports.identity = void 0;
function identity(v) {
return v;
}
exports.identity = identity;
function enforceLF(str) {
return str.match(/[\r\n]$/) ? str : str + '\n';
}
exports.enforceLF = enforceLF;
function dropWhile(array, predicate = v => !!v) {
let done = false;
return array.filter(item => {
if (done) {
return true;
}
if (predicate(item)) {
return false;
}
else {
done = true;
return true;
}
});
}
exports.dropWhile = dropWhile;
const TIME_UNITS = ['s', 'ms', 'μs'];
function formatHrTime(hrtime) {
let time = hrtime[0] + hrtime[1] / 1e9;
let index = 0;
for (; index < TIME_UNITS.length - 1; index++, time *= 1000) {
if (time >= 1) {
break;
}
}
return time.toFixed(2) + TIME_UNITS[index];
}
exports.formatHrTime = formatHrTime;

50
node_modules/@ionic/cli-framework-output/package.json generated vendored Normal file
View File

@@ -0,0 +1,50 @@
{
"name": "@ionic/cli-framework-output",
"version": "2.2.8",
"description": "The log/tasks/spinners portion of Ionic CLI Framework",
"homepage": "https://ionicframework.com/",
"author": "Ionic Team <hi@ionic.io> (https://ionicframework.com)",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"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"
},
"license": "MIT",
"dependencies": {
"@ionic/utils-terminal": "2.3.5",
"debug": "^4.0.0",
"tslib": "^2.0.1"
},
"devDependencies": {
"@ionic/utils-stream": "3.1.7",
"@types/debug": "^4.1.1",
"@types/inquirer": "0.0.43",
"@types/jest": "^26.0.10",
"@types/node": "~16.0.0",
"jest": "^26.4.2",
"jest-cli": "^26.0.1",
"lint-staged": "^10.0.2",
"ts-jest": "~26.3.0",
"typescript": "~4.8.0"
}
}

177
node_modules/@ionic/utils-array/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,177 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.1.5](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@2.1.4...@ionic/utils-array@2.1.5) (2020-08-28)
**Note:** Version bump only for package @ionic/utils-array
## [2.1.4](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@2.1.3...@ionic/utils-array@2.1.4) (2020-08-25)
**Note:** Version bump only for package @ionic/utils-array
## [2.1.3](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@2.1.2...@ionic/utils-array@2.1.3) (2020-05-12)
### Bug Fixes
* pin tslib to avoid "Cannot set property pathExists" error ([689e1f0](https://github.com/ionic-team/ionic-cli/commit/689e1f038b907356ef855a067a76d4822e7072a8))
## [2.1.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@2.1.1...@ionic/utils-array@2.1.2) (2020-05-06)
**Note:** Version bump only for package @ionic/utils-array
## [2.1.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@2.1.0...@ionic/utils-array@2.1.1) (2020-03-03)
**Note:** Version bump only for package @ionic/utils-array
# 2.1.0 (2020-02-11)
### Features
* **start:** add new list starter option ([#4315](https://github.com/ionic-team/ionic-cli/issues/4315)) ([1df44c1](https://github.com/ionic-team/ionic-cli/commit/1df44c1591f37b89f2b672857740edd6cb2aea67))
## [2.0.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@2.0.1...@ionic/utils-array@2.0.2) (2020-02-10)
**Note:** Version bump only for package @ionic/utils-array
## [2.0.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@2.0.0...@ionic/utils-array@2.0.1) (2020-02-03)
**Note:** Version bump only for package @ionic/utils-array
# [2.0.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@1.2.2...@ionic/utils-array@2.0.0) (2020-01-25)
### chore
* require Node 10 ([5a47874](https://github.com/ionic-team/ionic-cli/commit/5a478746c074207b6dc96aa8771f04a606deb1ef))
### BREAKING CHANGES
* A minimum of Node.js 10.3.0 is required.
## [1.2.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@1.2.1...@ionic/utils-array@1.2.2) (2019-12-05)
**Note:** Version bump only for package @ionic/utils-array
## [1.2.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@1.2.0...@ionic/utils-array@1.2.1) (2019-09-18)
**Note:** Version bump only for package @ionic/utils-array
# [1.2.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@1.1.1...@ionic/utils-array@1.2.0) (2019-08-28)
### Features
* **replace:** add replace item in array by index function ([011ddf7](https://github.com/ionic-team/ionic-cli/commit/011ddf7))
* **splice:** add non-mutating splice function ([758d287](https://github.com/ionic-team/ionic-cli/commit/758d287))
## [1.1.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@1.1.0...@ionic/utils-array@1.1.1) (2019-08-23)
**Note:** Version bump only for package @ionic/utils-array
# [1.1.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@1.0.2...@ionic/utils-array@1.1.0) (2019-08-14)
### Features
* add new `move` function ([ba8da3b](https://github.com/ionic-team/ionic-cli/commit/ba8da3b))
## [1.0.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@1.0.1...@ionic/utils-array@1.0.2) (2019-08-07)
**Note:** Version bump only for package @ionic/utils-array
## [1.0.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@1.0.0...@ionic/utils-array@1.0.1) (2019-06-05)
**Note:** Version bump only for package @ionic/utils-array
# [1.0.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@0.0.1...@ionic/utils-array@1.0.0) (2019-05-29)
### chore
* require Node 8 ([5670e68](https://github.com/ionic-team/ionic-cli/commit/5670e68))
### BREAKING CHANGES
* A minimum of Node.js 8.9.4 is required.
<a name="0.0.1"></a>
## 0.0.1 (2019-02-27)
**Note:** Version bump only for package @ionic/utils-array

21
node_modules/@ionic/utils-array/LICENSE generated vendored Normal file
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.

1
node_modules/@ionic/utils-array/README.md generated vendored Normal file
View File

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

39
node_modules/@ionic/utils-array/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,39 @@
export declare function conform<T>(t?: T | T[]): T[];
export declare function concurrentFilter<T>(array: T[], callback: (currentValue: T) => Promise<boolean>): Promise<T[]>;
export declare function filter<T>(array: T[], callback: (currentValue: T, currentIndex: number, array: readonly T[]) => Promise<boolean>): Promise<T[]>;
export declare function filter<T>(array: readonly T[], callback: (currentValue: T, currentIndex: number, array: readonly T[]) => Promise<boolean>): Promise<readonly T[]>;
export declare function map<T, U>(array: T[], callback: (currentValue: T, currentIndex: number, array: readonly T[]) => Promise<U>): Promise<U[]>;
export declare function map<T, U>(array: T[], callback: (currentValue: T, currentIndex: number, array: readonly T[]) => Promise<U>): Promise<readonly U[]>;
export declare function map<T, U>(array: readonly T[], callback: (currentValue: T, currentIndex: number, array: readonly T[]) => Promise<U>): Promise<U[]>;
export declare function map<T, U>(array: readonly T[], callback: (currentValue: T, currentIndex: number, array: readonly T[]) => Promise<U>): Promise<readonly U[]>;
export declare function reduce<T>(array: T[], callback: (accumulator: T, currentValue: T, currentIndex: number, array: readonly T[]) => Promise<T>): Promise<T>;
export declare function reduce<T>(array: T[], callback: (accumulator: T, currentValue: T, currentIndex: number, array: readonly T[]) => Promise<T>, initialValue: T): Promise<T>;
export declare function reduce<T, R>(array: T[], callback: (accumulator: R, currentValue: T, currentIndex: number, array: readonly T[]) => Promise<R>): Promise<R>;
export declare function reduce<T, U>(array: T[], callback: (accumulator: U, currentValue: T, currentIndex: number, array: readonly T[]) => Promise<U>, initialValue: U): Promise<U>;
export declare function reduce<T>(array: readonly T[], callback: (accumulator: T, currentValue: T, currentIndex: number, array: readonly T[]) => Promise<T>): Promise<T>;
export declare function reduce<T>(array: readonly T[], callback: (accumulator: T, currentValue: T, currentIndex: number, array: readonly T[]) => Promise<T>, initialValue: T): Promise<T>;
export declare function reduce<T, R>(array: readonly T[], callback: (accumulator: R, currentValue: T, currentIndex: number, array: readonly T[]) => Promise<R>): Promise<R>;
export declare function reduce<T, U>(array: readonly T[], callback: (accumulator: U, currentValue: T, currentIndex: number, array: readonly T[]) => Promise<U>, initialValue: U): Promise<U>;
/**
* Splice an array.
*
* This function will return a new array with the standard splice behavior
* applied. Unlike the standard array splice, the array of removed items is not
* returned.
*/
export declare function splice<T>(array: readonly T[], start: number, deleteCount?: number, ...items: T[]): T[];
/**
* Move an item in an array by index.
*
* This function will return a new array with the item in the `fromIndex`
* position moved to the `toIndex` position. If `fromIndex` or `toIndex` are
* out of bounds, the array items remain unmoved.
*/
export declare function move<T>(array: readonly T[], fromIndex: number, toIndex: number): T[];
/**
* Replace an item in an array by index.
*
* This function will return a new array with the item in the `index` position
* replaced with `item`. If `index` is out of bounds, the item is not replaced.
*/
export declare function replace<T>(array: readonly T[], index: number, item: T): T[];

97
node_modules/@ionic/utils-array/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,97 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.replace = exports.move = exports.splice = exports.reduce = exports.map = exports.filter = exports.concurrentFilter = exports.conform = void 0;
function conform(t) {
if (typeof t === 'undefined') {
return [];
}
if (!Array.isArray(t)) {
return [t];
}
return t;
}
exports.conform = conform;
async function concurrentFilter(array, callback) {
const mapper = async (v) => [v, await callback(v)];
const mapped = await Promise.all(array.map(mapper));
return mapped
.filter(([, f]) => f)
.map(([v]) => v);
}
exports.concurrentFilter = concurrentFilter;
async function filter(array, callback) {
const initial = [];
return reduce(array, async (acc, v, i, arr) => {
if (await callback(v, i, arr)) {
acc.push(v);
}
return acc;
}, initial);
}
exports.filter = filter;
async function map(array, callback) {
const initial = [];
return reduce(array, async (acc, v, i, arr) => {
acc.push(await callback(v, i, arr));
return acc;
}, initial);
}
exports.map = map;
async function reduce(array, callback, initialValue) {
const hadInitialValue = typeof initialValue === 'undefined';
const startingIndex = hadInitialValue ? 1 : 0;
if (typeof initialValue === 'undefined') {
if (array.length === 0) {
throw new TypeError('Reduce of empty array with no initial value');
}
initialValue = array[0];
}
let value = initialValue;
for (let i = startingIndex; i < array.length; i++) {
const v = await callback(value, array[i], i, array);
value = v;
}
return value;
}
exports.reduce = reduce;
/**
* Splice an array.
*
* This function will return a new array with the standard splice behavior
* applied. Unlike the standard array splice, the array of removed items is not
* returned.
*/
function splice(array, start, deleteCount = array.length - start, ...items) {
const result = [...array];
result.splice(start, deleteCount, ...items);
return result;
}
exports.splice = splice;
/**
* Move an item in an array by index.
*
* This function will return a new array with the item in the `fromIndex`
* position moved to the `toIndex` position. If `fromIndex` or `toIndex` are
* out of bounds, the array items remain unmoved.
*/
function move(array, fromIndex, toIndex) {
const element = array[fromIndex];
if (fromIndex < 0 || toIndex < 0 || fromIndex >= array.length || toIndex >= array.length) {
return [...array];
}
return splice(splice(array, fromIndex, 1), toIndex, 0, element);
}
exports.move = move;
/**
* Replace an item in an array by index.
*
* This function will return a new array with the item in the `index` position
* replaced with `item`. If `index` is out of bounds, the item is not replaced.
*/
function replace(array, index, item) {
if (index < 0 || index > array.length) {
return [...array];
}
return splice(array, index, 1, item);
}
exports.replace = replace;

49
node_modules/@ionic/utils-array/package.json generated vendored Normal file
View File

@@ -0,0 +1,49 @@
{
"name": "@ionic/utils-array",
"version": "2.1.5",
"description": "Array utils",
"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": ">=10.3.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": {
"debug": "^4.0.0",
"tslib": "^2.0.1"
},
"devDependencies": {
"@types/debug": "^4.1.1",
"@types/jest": "^26.0.10",
"@types/node": "~10.17.13",
"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.0.2"
},
"gitHead": "f85e6db0eba47c8d97181b52d69c687c100f93fb"
}

318
node_modules/@ionic/utils-fs/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,318 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [3.1.7](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@3.1.6...@ionic/utils-fs@3.1.7) (2023-03-29)
**Note:** Version bump only for package @ionic/utils-fs
## [3.1.6](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@3.1.5...@ionic/utils-fs@3.1.6) (2022-06-16)
**Note:** Version bump only for package @ionic/utils-fs
## [3.1.5](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@3.1.4...@ionic/utils-fs@3.1.5) (2020-08-28)
**Note:** Version bump only for package @ionic/utils-fs
## [3.1.4](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@3.1.3...@ionic/utils-fs@3.1.4) (2020-08-25)
**Note:** Version bump only for package @ionic/utils-fs
## [3.1.3](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@3.1.2...@ionic/utils-fs@3.1.3) (2020-05-12)
### Bug Fixes
* pin tslib to avoid "Cannot set property pathExists" error ([689e1f0](https://github.com/ionic-team/ionic-cli/commit/689e1f038b907356ef855a067a76d4822e7072a8))
## [3.1.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@3.1.1...@ionic/utils-fs@3.1.2) (2020-05-06)
**Note:** Version bump only for package @ionic/utils-fs
## [3.1.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@3.1.0...@ionic/utils-fs@3.1.1) (2020-03-03)
**Note:** Version bump only for package @ionic/utils-fs
# 3.1.0 (2020-02-11)
### Features
* **start:** add new list starter option ([#4315](https://github.com/ionic-team/ionic-cli/issues/4315)) ([1df44c1](https://github.com/ionic-team/ionic-cli/commit/1df44c1591f37b89f2b672857740edd6cb2aea67))
## [3.0.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@3.0.1...@ionic/utils-fs@3.0.2) (2020-02-10)
**Note:** Version bump only for package @ionic/utils-fs
## [3.0.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@3.0.0...@ionic/utils-fs@3.0.1) (2020-02-03)
**Note:** Version bump only for package @ionic/utils-fs
# [3.0.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.9...@ionic/utils-fs@3.0.0) (2020-01-25)
### chore
* require Node 10 ([5a47874](https://github.com/ionic-team/ionic-cli/commit/5a478746c074207b6dc96aa8771f04a606deb1ef))
### BREAKING CHANGES
* A minimum of Node.js 10.3.0 is required.
## [2.0.9](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.8...@ionic/utils-fs@2.0.9) (2019-12-05)
**Note:** Version bump only for package @ionic/utils-fs
## [2.0.8](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.7...@ionic/utils-fs@2.0.8) (2019-10-14)
### Bug Fixes
* **fileToString:** handle ENOTDIR errors ([fab07d8](https://github.com/ionic-team/ionic-cli/commit/fab07d8c6e3d6756d633ada4c81165d11c70eb8f))
## [2.0.7](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.6...@ionic/utils-fs@2.0.7) (2019-09-18)
**Note:** Version bump only for package @ionic/utils-fs
## [2.0.6](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.5...@ionic/utils-fs@2.0.6) (2019-08-23)
**Note:** Version bump only for package @ionic/utils-fs
## [2.0.5](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.4...@ionic/utils-fs@2.0.5) (2019-08-14)
**Note:** Version bump only for package @ionic/utils-fs
## [2.0.4](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.3...@ionic/utils-fs@2.0.4) (2019-08-07)
**Note:** Version bump only for package @ionic/utils-fs
## [2.0.3](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.2...@ionic/utils-fs@2.0.3) (2019-06-28)
**Note:** Version bump only for package @ionic/utils-fs
## [2.0.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.1...@ionic/utils-fs@2.0.2) (2019-06-10)
**Note:** Version bump only for package @ionic/utils-fs
## [2.0.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.0...@ionic/utils-fs@2.0.1) (2019-06-05)
**Note:** Version bump only for package @ionic/utils-fs
# [2.0.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@1.2.0...@ionic/utils-fs@2.0.0) (2019-05-29)
### chore
* require Node 8 ([5670e68](https://github.com/ionic-team/ionic-cli/commit/5670e68))
### BREAKING CHANGES
* A minimum of Node.js 8.9.4 is required.
<a name="1.2.0"></a>
# [1.2.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@1.1.1...@ionic/utils-fs@1.2.0) (2019-03-06)
### Features
* **fs:** add `isExecutableFile` utility ([53d9626](https://github.com/ionic-team/ionic-cli/commit/53d9626))
* **fs:** add `pathReadable`, `pathWritable`, and `pathExecutable` ([5412791](https://github.com/ionic-team/ionic-cli/commit/5412791))
<a name="1.1.1"></a>
## [1.1.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@1.1.0...@ionic/utils-fs@1.1.1) (2019-02-27)
**Note:** Version bump only for package @ionic/utils-fs
<a name="1.1.0"></a>
# [1.1.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@1.0.0...@ionic/utils-fs@1.1.0) (2019-02-15)
### Bug Fixes
* **walk:** stat symlinks themselves while walking ([92f2cee](https://github.com/ionic-team/ionic-cli/commit/92f2cee))
### Features
* **fs:** `onError` option for `readdirp` and `getFileTree` ([90bcfcd](https://github.com/ionic-team/ionic-cli/commit/90bcfcd))
* **fs:** `onFileNode` and `onDirectoryNode` options for `getFileTree` ([1858e96](https://github.com/ionic-team/ionic-cli/commit/1858e96))
* **fs:** add `getFileTree` for creating file tree object structures ([c14b46b](https://github.com/ionic-team/ionic-cli/commit/c14b46b))
<a name="1.0.0"></a>
# [1.0.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@0.0.7...@ionic/utils-fs@1.0.0) (2019-01-08)
### Bug Fixes
* rimraf is a full dependency ([962ad94](https://github.com/ionic-team/ionic-cli/commit/962ad94))
### Features
* switch to fs-extra ([c17d8d8](https://github.com/ionic-team/ionic-cli/commit/c17d8d8))
### BREAKING CHANGES
* `readDir`, `readDirp`, `readDirSafe` were renamed to be
consistent with fs and fs-extra. `readJsonFile` and `writeJsonFile` have
been renamed to `readJson` and `writeJson` and use the fs-extra version
directly. `isDir` was removed (use stat). `copyFile` and `copyDirectory`
were removed (use `copy`). `removeDirectory` was removed (use `remove`).
<a name="0.0.7"></a>
## [0.0.7](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@0.0.6...@ionic/utils-fs@0.0.7) (2019-01-07)
**Note:** Version bump only for package @ionic/utils-fs
<a name="0.0.6"></a>
## [0.0.6](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@0.0.5...@ionic/utils-fs@0.0.6) (2018-12-19)
**Note:** Version bump only for package @ionic/utils-fs
<a name="0.0.5"></a>
## [0.0.5](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@0.0.4...@ionic/utils-fs@0.0.5) (2018-11-20)
**Note:** Version bump only for package @ionic/utils-fs
<a name="0.0.4"></a>
## [0.0.4](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@0.0.3...@ionic/utils-fs@0.0.4) (2018-10-31)
**Note:** Version bump only for package @ionic/utils-fs
<a name="0.0.3"></a>
## [0.0.3](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@0.0.2...@ionic/utils-fs@0.0.3) (2018-10-05)
**Note:** Version bump only for package @ionic/utils-fs
<a name="0.0.2"></a>
## [0.0.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@0.0.1...@ionic/utils-fs@0.0.2) (2018-10-03)
**Note:** Version bump only for package @ionic/utils-fs
<a name="0.0.1"></a>
## 0.0.1 (2018-09-05)
**Note:** Version bump only for package @ionic/utils-fs
# Change Log

21
node_modules/@ionic/utils-fs/LICENSE generated vendored Normal file
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.

1
node_modules/@ionic/utils-fs/README.md generated vendored Normal file
View File

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

148
node_modules/@ionic/utils-fs/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,148 @@
/// <reference types="node" />
/// <reference types="node" />
/// <reference types="node" />
import * as fs from 'fs-extra';
import * as stream from 'stream';
export * from 'fs-extra';
export { stat as statSafe, readdir as readdirSafe } from './safe';
export interface ReaddirPOptions {
/**
* Filter out items from the walk process from the final result.
*
* @return `true` to keep, otherwise the item is filtered out
*/
readonly filter?: (item: WalkerItem) => boolean;
/**
* Called whenever an error occurs during the walk process.
*
* If excluded, the function will throw an error when first encountered.
*/
readonly onError?: (err: Error) => void;
readonly walkerOptions?: WalkerOptions;
}
export declare function readdirp(dir: string, { filter, onError, walkerOptions }?: ReaddirPOptions): Promise<string[]>;
export declare const enum FileType {
FILE = "file",
DIRECTORY = "directory"
}
export interface RegularFileNode {
path: string;
type: FileType.FILE;
parent: FileNode;
}
export interface DirectoryNode {
path: string;
type: FileType.DIRECTORY;
parent?: FileNode;
children: FileNode[];
}
export declare type FileNode = RegularFileNode | DirectoryNode;
export interface GetFileTreeOptions<RE = {}, DE = {}> {
/**
* Called whenever an error occurs during the walk process.
*
* If excluded, the function will throw an error when first encountered.
*/
readonly onError?: (err: Error) => void;
/**
* Called whenever a file node is added to the tree.
*
* File nodes can be supplemented by returning a new object from this
* function.
*/
readonly onFileNode?: (node: RegularFileNode) => RegularFileNode & RE;
/**
* Called whenever a directory node is added to the tree.
*
* Directory nodes can be supplemented by returning a new object from this
* function.
*/
readonly onDirectoryNode?: (node: DirectoryNode) => DirectoryNode & DE;
readonly walkerOptions?: WalkerOptions;
}
/**
* Compile and return a file tree structure.
*
* This function walks a directory structure recursively, building a nested
* object structure in memory that represents it. When finished, the root
* directory node is returned.
*
* @param dir The root directory from which to compile the file tree
*/
export declare function getFileTree<RE = {}, DE = {}>(dir: string, { onError, onFileNode, onDirectoryNode, walkerOptions }?: GetFileTreeOptions<RE, DE>): Promise<RegularFileNode & RE | DirectoryNode & DE>;
export declare function fileToString(filePath: string): Promise<string>;
export declare function getFileChecksum(filePath: string): Promise<string>;
/**
* Return true and cached checksums for a file by its path.
*
* Cached checksums are stored as `.md5` files next to the original file. If
* the cache file is missing, the cached checksum is undefined.
*
* @param p The file path
* @return Promise<[true checksum, cached checksum or undefined if cache file missing]>
*/
export declare function getFileChecksums(p: string): Promise<[string, string | undefined]>;
/**
* Store a cache file containing the source file's md5 checksum hash.
*
* @param p The file path
* @param checksum The checksum. If excluded, the checksum is computed
*/
export declare function cacheFileChecksum(p: string, checksum?: string): Promise<void>;
export declare function writeStreamToFile(stream: NodeJS.ReadableStream, destination: string): Promise<any>;
export declare function pathAccessible(filePath: string, mode: number): Promise<boolean>;
export declare function pathExists(filePath: string): Promise<boolean>;
export declare function pathReadable(filePath: string): Promise<boolean>;
export declare function pathWritable(filePath: string): Promise<boolean>;
export declare function pathExecutable(filePath: string): Promise<boolean>;
export declare function isExecutableFile(filePath: string): Promise<boolean>;
/**
* Find the base directory based on the path given and a marker file to look for.
*/
export declare function findBaseDirectory(dir: string, file: string): Promise<string | undefined>;
/**
* Generate a random file path within the computer's temporary directory.
*
* @param prefix Optionally provide a filename prefix.
*/
export declare function tmpfilepath(prefix?: string): string;
/**
* Given an absolute system path, compile an array of paths working backwards
* one directory at a time, always ending in the root directory.
*
* For example, `'/some/dir'` => `['/some/dir', '/some', '/']`
*
* @param filePath Absolute system base path.
*/
export declare function compilePaths(filePath: string): string[];
export interface WalkerItem {
path: string;
stats: fs.Stats;
}
export interface WalkerOptions {
/**
* Filter out file paths during walk.
*
* As the file tree is walked, this function can be used to exclude files and
* directories from the final result.
*
* It can also be used to tune performance. If a subdirectory is excluded, it
* is not walked.
*
* @param p The file path.
* @return `true` to include file path, otherwise it is excluded
*/
readonly pathFilter?: (p: string) => boolean;
}
export interface Walker extends stream.Readable {
on(event: 'data', callback: (item: WalkerItem) => void): this;
on(event: string, callback: (...args: any[]) => any): this;
}
export declare class Walker extends stream.Readable {
readonly p: string;
readonly options: WalkerOptions;
readonly paths: string[];
constructor(p: string, options?: WalkerOptions);
_read(): void;
}
export declare function walk(p: string, options?: WalkerOptions): Walker;

286
node_modules/@ionic/utils-fs/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,286 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.walk = exports.Walker = exports.compilePaths = exports.tmpfilepath = exports.findBaseDirectory = exports.isExecutableFile = exports.pathExecutable = exports.pathWritable = exports.pathReadable = exports.pathExists = exports.pathAccessible = exports.writeStreamToFile = exports.cacheFileChecksum = exports.getFileChecksums = exports.getFileChecksum = exports.fileToString = exports.getFileTree = exports.readdirp = exports.readdirSafe = exports.statSafe = void 0;
const tslib_1 = require("tslib");
const fs = require("fs-extra");
const os = require("os");
const path = require("path");
const stream = require("stream");
const safe = require("./safe");
tslib_1.__exportStar(require("fs-extra"), exports);
var safe_1 = require("./safe");
Object.defineProperty(exports, "statSafe", { enumerable: true, get: function () { return safe_1.stat; } });
Object.defineProperty(exports, "readdirSafe", { enumerable: true, get: function () { return safe_1.readdir; } });
async function readdirp(dir, { filter, onError, walkerOptions } = {}) {
return new Promise((resolve, reject) => {
const items = [];
let rs = walk(dir, walkerOptions);
if (filter) {
rs = rs.pipe(new stream.Transform({
objectMode: true,
transform(obj, enc, cb) {
if (!filter || filter(obj)) {
this.push(obj);
}
cb();
},
}));
}
rs
.on('error', (err) => onError ? onError(err) : reject(err))
.on('data', (item) => items.push(item.path))
.on('end', () => resolve(items));
});
}
exports.readdirp = readdirp;
/**
* Compile and return a file tree structure.
*
* This function walks a directory structure recursively, building a nested
* object structure in memory that represents it. When finished, the root
* directory node is returned.
*
* @param dir The root directory from which to compile the file tree
*/
async function getFileTree(dir, { onError, onFileNode = n => n, onDirectoryNode = n => n, walkerOptions } = {}) {
const fileMap = new Map([]);
const getOrCreateParent = (item) => {
const parentPath = path.dirname(item.path);
const parent = fileMap.get(parentPath);
if (parent && parent.type === "directory" /* FileType.DIRECTORY */) {
return parent;
}
return onDirectoryNode({ path: parentPath, type: "directory" /* FileType.DIRECTORY */, children: [] });
};
const createFileNode = (item, parent) => {
const node = { path: item.path, parent };
return item.stats.isDirectory() ?
onDirectoryNode({ ...node, type: "directory" /* FileType.DIRECTORY */, children: [] }) :
onFileNode({ ...node, type: "file" /* FileType.FILE */ });
};
return new Promise((resolve, reject) => {
dir = path.resolve(dir);
const rs = walk(dir, walkerOptions);
rs
.on('error', err => onError ? onError(err) : reject(err))
.on('data', item => {
const parent = getOrCreateParent(item);
const node = createFileNode(item, parent);
parent.children.push(node);
fileMap.set(item.path, node);
fileMap.set(parent.path, parent);
})
.on('end', () => {
const root = fileMap.get(dir);
if (!root) {
return reject(new Error('No root node found after walking directory structure.'));
}
delete root.parent;
resolve(root);
});
});
}
exports.getFileTree = getFileTree;
async function fileToString(filePath) {
try {
return await fs.readFile(filePath, { encoding: 'utf8' });
}
catch (e) {
if (e.code === 'ENOENT' || e.code === 'ENOTDIR') {
return '';
}
throw e;
}
}
exports.fileToString = fileToString;
async function getFileChecksum(filePath) {
const crypto = await Promise.resolve().then(() => require('crypto'));
return new Promise((resolve, reject) => {
const hash = crypto.createHash('md5');
const input = fs.createReadStream(filePath);
input.on('error', (err) => {
reject(err);
});
hash.once('readable', () => {
const fullChecksum = hash.read().toString('hex');
resolve(fullChecksum);
});
input.pipe(hash);
});
}
exports.getFileChecksum = getFileChecksum;
/**
* Return true and cached checksums for a file by its path.
*
* Cached checksums are stored as `.md5` files next to the original file. If
* the cache file is missing, the cached checksum is undefined.
*
* @param p The file path
* @return Promise<[true checksum, cached checksum or undefined if cache file missing]>
*/
async function getFileChecksums(p) {
return Promise.all([
getFileChecksum(p),
(async () => {
try {
const md5 = await fs.readFile(`${p}.md5`, { encoding: 'utf8' });
return md5.trim();
}
catch (e) {
if (e.code !== 'ENOENT') {
throw e;
}
}
})(),
]);
}
exports.getFileChecksums = getFileChecksums;
/**
* Store a cache file containing the source file's md5 checksum hash.
*
* @param p The file path
* @param checksum The checksum. If excluded, the checksum is computed
*/
async function cacheFileChecksum(p, checksum) {
const md5 = await getFileChecksum(p);
await fs.writeFile(`${p}.md5`, md5, { encoding: 'utf8' });
}
exports.cacheFileChecksum = cacheFileChecksum;
function writeStreamToFile(stream, destination) {
return new Promise((resolve, reject) => {
const dest = fs.createWriteStream(destination);
stream.pipe(dest);
dest.on('error', reject);
dest.on('finish', resolve);
});
}
exports.writeStreamToFile = writeStreamToFile;
async function pathAccessible(filePath, mode) {
try {
await fs.access(filePath, mode);
}
catch (e) {
return false;
}
return true;
}
exports.pathAccessible = pathAccessible;
async function pathExists(filePath) {
return pathAccessible(filePath, fs.constants.F_OK);
}
exports.pathExists = pathExists;
async function pathReadable(filePath) {
return pathAccessible(filePath, fs.constants.R_OK);
}
exports.pathReadable = pathReadable;
async function pathWritable(filePath) {
return pathAccessible(filePath, fs.constants.W_OK);
}
exports.pathWritable = pathWritable;
async function pathExecutable(filePath) {
return pathAccessible(filePath, fs.constants.X_OK);
}
exports.pathExecutable = pathExecutable;
async function isExecutableFile(filePath) {
const [stats, executable] = await (Promise.all([
safe.stat(filePath),
pathExecutable(filePath),
]));
return !!stats && (stats.isFile() || stats.isSymbolicLink()) && executable;
}
exports.isExecutableFile = isExecutableFile;
/**
* Find the base directory based on the path given and a marker file to look for.
*/
async function findBaseDirectory(dir, file) {
if (!dir || !file) {
return;
}
for (const d of compilePaths(dir)) {
const results = await safe.readdir(d);
if (results.includes(file)) {
return d;
}
}
}
exports.findBaseDirectory = findBaseDirectory;
/**
* Generate a random file path within the computer's temporary directory.
*
* @param prefix Optionally provide a filename prefix.
*/
function tmpfilepath(prefix) {
const rn = Math.random().toString(16).substring(2, 8);
const p = path.resolve(os.tmpdir(), prefix ? `${prefix}-${rn}` : rn);
return p;
}
exports.tmpfilepath = tmpfilepath;
/**
* Given an absolute system path, compile an array of paths working backwards
* one directory at a time, always ending in the root directory.
*
* For example, `'/some/dir'` => `['/some/dir', '/some', '/']`
*
* @param filePath Absolute system base path.
*/
function compilePaths(filePath) {
filePath = path.normalize(filePath);
if (!path.isAbsolute(filePath)) {
throw new Error(`${filePath} is not an absolute path`);
}
const parsed = path.parse(filePath);
if (filePath === parsed.root) {
return [filePath];
}
return filePath
.slice(parsed.root.length)
.split(path.sep)
.map((segment, i, array) => parsed.root + path.join(...array.slice(0, array.length - i)))
.concat(parsed.root);
}
exports.compilePaths = compilePaths;
class Walker extends stream.Readable {
constructor(p, options = {}) {
super({ objectMode: true });
this.p = p;
this.options = options;
this.paths = [this.p];
}
_read() {
const p = this.paths.shift();
const { pathFilter } = this.options;
if (!p) {
this.push(null);
return;
}
fs.lstat(p, (err, stats) => {
if (err) {
this.emit('error', err);
return;
}
const item = { path: p, stats };
if (stats.isDirectory()) {
fs.readdir(p, (err, contents) => {
if (err) {
this.emit('error', err);
return;
}
let paths = contents.map(file => path.join(p, file));
if (pathFilter) {
paths = paths.filter(p => pathFilter(p.substring(this.p.length + 1)));
}
this.paths.push(...paths);
this.push(item);
});
}
else {
this.push(item);
}
});
}
}
exports.Walker = Walker;
function walk(p, options = {}) {
return new Walker(p, options);
}
exports.walk = walk;

4
node_modules/@ionic/utils-fs/dist/safe.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
/// <reference types="node" />
import * as fs from 'fs-extra';
export declare function stat(p: string): Promise<fs.Stats | undefined>;
export declare function readdir(dir: string): Promise<string[]>;

22
node_modules/@ionic/utils-fs/dist/safe.js generated vendored Normal file
View File

@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.readdir = exports.stat = void 0;
const fs = require("fs-extra");
async function stat(p) {
try {
return await fs.stat(p);
}
catch (e) {
// ignore
}
}
exports.stat = stat;
async function readdir(dir) {
try {
return await fs.readdir(dir);
}
catch (e) {
return [];
}
}
exports.readdir = readdir;

51
node_modules/@ionic/utils-fs/package.json generated vendored Normal file
View File

@@ -0,0 +1,51 @@
{
"name": "@ionic/utils-fs",
"version": "3.1.7",
"description": "Filesystem utils for Node",
"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": {
"@types/fs-extra": "^8.0.0",
"debug": "^4.0.0",
"fs-extra": "^9.0.0",
"tslib": "^2.0.1"
},
"devDependencies": {
"@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"
},
"gitHead": "15ef6e7da4eace4fd55d16fd9508d156a4bc8203"
}

162
node_modules/@ionic/utils-object/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,162 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.1.5](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-object@2.1.4...@ionic/utils-object@2.1.5) (2020-08-28)
**Note:** Version bump only for package @ionic/utils-object
## [2.1.4](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-object@2.1.3...@ionic/utils-object@2.1.4) (2020-08-25)
**Note:** Version bump only for package @ionic/utils-object
## [2.1.3](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-object@2.1.2...@ionic/utils-object@2.1.3) (2020-05-12)
### Bug Fixes
* pin tslib to avoid "Cannot set property pathExists" error ([689e1f0](https://github.com/ionic-team/ionic-cli/commit/689e1f038b907356ef855a067a76d4822e7072a8))
## [2.1.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-object@2.1.1...@ionic/utils-object@2.1.2) (2020-05-06)
**Note:** Version bump only for package @ionic/utils-object
## [2.1.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-object@2.1.0...@ionic/utils-object@2.1.1) (2020-03-03)
**Note:** Version bump only for package @ionic/utils-object
# 2.1.0 (2020-02-11)
### Features
* **start:** add new list starter option ([#4315](https://github.com/ionic-team/ionic-cli/issues/4315)) ([1df44c1](https://github.com/ionic-team/ionic-cli/commit/1df44c1591f37b89f2b672857740edd6cb2aea67))
## [2.0.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-object@2.0.1...@ionic/utils-object@2.0.2) (2020-02-10)
**Note:** Version bump only for package @ionic/utils-object
## [2.0.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-object@2.0.0...@ionic/utils-object@2.0.1) (2020-02-03)
**Note:** Version bump only for package @ionic/utils-object
# [2.0.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-object@1.0.6...@ionic/utils-object@2.0.0) (2020-01-25)
### chore
* require Node 10 ([5a47874](https://github.com/ionic-team/ionic-cli/commit/5a478746c074207b6dc96aa8771f04a606deb1ef))
### BREAKING CHANGES
* A minimum of Node.js 10.3.0 is required.
## [1.0.6](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-object@1.0.5...@ionic/utils-object@1.0.6) (2019-12-05)
**Note:** Version bump only for package @ionic/utils-object
## [1.0.5](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-object@1.0.4...@ionic/utils-object@1.0.5) (2019-09-18)
**Note:** Version bump only for package @ionic/utils-object
## [1.0.4](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-object@1.0.3...@ionic/utils-object@1.0.4) (2019-08-23)
**Note:** Version bump only for package @ionic/utils-object
## [1.0.3](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-object@1.0.2...@ionic/utils-object@1.0.3) (2019-08-14)
**Note:** Version bump only for package @ionic/utils-object
## [1.0.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-object@1.0.1...@ionic/utils-object@1.0.2) (2019-08-07)
**Note:** Version bump only for package @ionic/utils-object
## [1.0.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-object@1.0.0...@ionic/utils-object@1.0.1) (2019-06-05)
**Note:** Version bump only for package @ionic/utils-object
# [1.0.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-object@0.0.1...@ionic/utils-object@1.0.0) (2019-05-29)
### chore
* require Node 8 ([5670e68](https://github.com/ionic-team/ionic-cli/commit/5670e68))
### BREAKING CHANGES
* A minimum of Node.js 8.9.4 is required.
<a name="0.0.1"></a>
## 0.0.1 (2019-02-27)
**Note:** Version bump only for package @ionic/utils-object

21
node_modules/@ionic/utils-object/LICENSE generated vendored Normal file
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.

1
node_modules/@ionic/utils-object/README.md generated vendored Normal file
View File

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

10
node_modules/@ionic/utils-object/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
export declare function createCaseInsensitiveObject<T>(): {
[key: string]: T;
};
export declare const CaseInsensitiveProxyHandler: ProxyHandler<any>;
export declare type AliasedMapKey = string | symbol;
export declare class AliasedMap<K, V> extends Map<AliasedMapKey | K, AliasedMapKey | V> {
getAliases(): Map<AliasedMapKey, AliasedMapKey[]>;
resolveAlias(key: AliasedMapKey | K): V | undefined;
keysWithoutAliases(): K[];
}

49
node_modules/@ionic/utils-object/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,49 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AliasedMap = exports.CaseInsensitiveProxyHandler = exports.createCaseInsensitiveObject = void 0;
function createCaseInsensitiveObject() {
return new Proxy({}, exports.CaseInsensitiveProxyHandler);
}
exports.createCaseInsensitiveObject = createCaseInsensitiveObject;
exports.CaseInsensitiveProxyHandler = {
has: (obj, prop) => {
return conformPropertyKey(prop) in obj;
},
get: (obj, prop) => {
return obj[conformPropertyKey(prop)];
},
set: (obj, prop, value) => {
obj[conformPropertyKey(prop)] = value;
return true;
},
deleteProperty: (obj, prop) => {
return delete obj[conformPropertyKey(prop)];
},
};
const conformPropertyKey = (prop) => typeof prop === 'string' ? prop.toLowerCase() : prop;
class AliasedMap extends Map {
getAliases() {
const aliasmap = new Map();
// TODO: waiting for https://github.com/Microsoft/TypeScript/issues/18562
const aliases = [...this.entries()].filter(([, v]) => typeof v === 'string' || typeof v === 'symbol');
aliases.forEach(([alias, cmd]) => {
const cmdaliases = aliasmap.get(cmd) || [];
cmdaliases.push(alias);
aliasmap.set(cmd, cmdaliases);
});
return aliasmap;
}
resolveAlias(key) {
const r = this.get(key);
if (typeof r !== 'string' && typeof r !== 'symbol') {
return r;
}
return this.resolveAlias(r);
}
keysWithoutAliases() {
return [...this.entries()]
.filter((entry) => typeof entry[1] !== 'string' && typeof entry[1] !== 'symbol')
.map(([k, v]) => k);
}
}
exports.AliasedMap = AliasedMap;

49
node_modules/@ionic/utils-object/package.json generated vendored Normal file
View File

@@ -0,0 +1,49 @@
{
"name": "@ionic/utils-object",
"version": "2.1.5",
"description": "Object utils",
"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": ">=10.3.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": {
"debug": "^4.0.0",
"tslib": "^2.0.1"
},
"devDependencies": {
"@types/debug": "^4.1.1",
"@types/jest": "^26.0.10",
"@types/node": "~10.17.13",
"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.0.2"
},
"gitHead": "f85e6db0eba47c8d97181b52d69c687c100f93fb"
}

245
node_modules/@ionic/utils-process/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,245 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.1.10](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-process@2.1.9...@ionic/utils-process@2.1.10) (2022-06-16)
**Note:** Version bump only for package @ionic/utils-process
## [2.1.9](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-process@2.1.8...@ionic/utils-process@2.1.9) (2022-05-09)
**Note:** Version bump only for package @ionic/utils-process
## [2.1.8](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-process@2.1.7...@ionic/utils-process@2.1.8) (2020-09-29)
**Note:** Version bump only for package @ionic/utils-process
## [2.1.7](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-process@2.1.6...@ionic/utils-process@2.1.7) (2020-09-24)
**Note:** Version bump only for package @ionic/utils-process
## [2.1.6](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-process@2.1.5...@ionic/utils-process@2.1.6) (2020-08-28)
**Note:** Version bump only for package @ionic/utils-process
## [2.1.5](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-process@2.1.4...@ionic/utils-process@2.1.5) (2020-08-27)
### Bug Fixes
* **onExit:** switch to signal-exit implementation ([95521e2](https://github.com/ionic-team/ionic-cli/commit/95521e2d4d47795020dc20b53bd4ce99e87e4f73))
## [2.1.4](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-process@2.1.3...@ionic/utils-process@2.1.4) (2020-08-25)
**Note:** Version bump only for package @ionic/utils-process
## [2.1.3](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-process@2.1.2...@ionic/utils-process@2.1.3) (2020-05-12)
### Bug Fixes
* pin tslib to avoid "Cannot set property pathExists" error ([689e1f0](https://github.com/ionic-team/ionic-cli/commit/689e1f038b907356ef855a067a76d4822e7072a8))
## [2.1.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-process@2.1.1...@ionic/utils-process@2.1.2) (2020-05-06)
**Note:** Version bump only for package @ionic/utils-process
## [2.1.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-process@2.1.0...@ionic/utils-process@2.1.1) (2020-03-03)
**Note:** Version bump only for package @ionic/utils-process
# 2.1.0 (2020-02-11)
### Features
* **start:** add new list starter option ([#4315](https://github.com/ionic-team/ionic-cli/issues/4315)) ([1df44c1](https://github.com/ionic-team/ionic-cli/commit/1df44c1591f37b89f2b672857740edd6cb2aea67))
## [2.0.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-process@2.0.1...@ionic/utils-process@2.0.2) (2020-02-10)
**Note:** Version bump only for package @ionic/utils-process
## [2.0.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-process@2.0.0...@ionic/utils-process@2.0.1) (2020-02-03)
**Note:** Version bump only for package @ionic/utils-process
# [2.0.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-process@1.0.9...@ionic/utils-process@2.0.0) (2020-01-25)
### chore
* require Node 10 ([5a47874](https://github.com/ionic-team/ionic-cli/commit/5a478746c074207b6dc96aa8771f04a606deb1ef))
### BREAKING CHANGES
* A minimum of Node.js 10.3.0 is required.
## [1.0.9](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-process@1.0.8...@ionic/utils-process@1.0.9) (2020-01-13)
**Note:** Version bump only for package @ionic/utils-process
## [1.0.8](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-process@1.0.7...@ionic/utils-process@1.0.8) (2019-12-10)
**Note:** Version bump only for package @ionic/utils-process
## [1.0.7](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-process@1.0.6...@ionic/utils-process@1.0.7) (2019-12-05)
**Note:** Version bump only for package @ionic/utils-process
## [1.0.6](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-process@1.0.5...@ionic/utils-process@1.0.6) (2019-11-21)
**Note:** Version bump only for package @ionic/utils-process
## [1.0.5](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-process@1.0.4...@ionic/utils-process@1.0.5) (2019-09-18)
**Note:** Version bump only for package @ionic/utils-process
## [1.0.4](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-process@1.0.3...@ionic/utils-process@1.0.4) (2019-08-23)
**Note:** Version bump only for package @ionic/utils-process
## [1.0.3](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-process@1.0.2...@ionic/utils-process@1.0.3) (2019-08-14)
**Note:** Version bump only for package @ionic/utils-process
## [1.0.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-process@1.0.1...@ionic/utils-process@1.0.2) (2019-08-07)
**Note:** Version bump only for package @ionic/utils-process
## [1.0.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-process@1.0.0...@ionic/utils-process@1.0.1) (2019-06-05)
**Note:** Version bump only for package @ionic/utils-process
# [1.0.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-process@0.1.0...@ionic/utils-process@1.0.0) (2019-05-29)
### Bug Fixes
* **process:** re-raise captured signals ([d82bfde](https://github.com/ionic-team/ionic-cli/commit/d82bfde))
### chore
* require Node 8 ([5670e68](https://github.com/ionic-team/ionic-cli/commit/5670e68))
### BREAKING CHANGES
* A minimum of Node.js 8.9.4 is required.
<a name="0.1.0"></a>
# [0.1.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-process@0.0.1...@ionic/utils-process@0.1.0) (2019-03-06)
### Features
* **process:** add `getPathParts` to split path into parts ([7dfbbc2](https://github.com/ionic-team/ionic-cli/commit/7dfbbc2))
<a name="0.0.1"></a>
## 0.0.1 (2019-02-27)
**Note:** Version bump only for package @ionic/utils-process

21
node_modules/@ionic/utils-process/LICENSE generated vendored Normal file
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.

1
node_modules/@ionic/utils-process/README.md generated vendored Normal file
View File

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

63
node_modules/@ionic/utils-process/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,63 @@
/// <reference types="node" />
export declare const ERROR_TIMEOUT_REACHED: Error;
export declare function killProcessTree(pid: number, signal?: string | number): Promise<void>;
/**
* Creates an alternative implementation of `process.env` object.
*
* On a Windows shell, `process.env` is a magic object that offers
* case-insensitive environment variable access. On other platforms, case
* sensitivity matters. This method creates an empty "`process.env`" object
* type that works for all platforms.
*/
export declare function createProcessEnv(...sources: {
[key: string]: string | undefined;
}[]): NodeJS.ProcessEnv;
/**
* Split a PATH string into path parts.
*/
export declare function getPathParts(envpath?: string): string[];
/**
* Resolves when the given amount of milliseconds has passed.
*/
export declare function sleep(ms: number): Promise<void>;
/**
* Resolves when a given predicate is true or a timeout is reached.
*
* Configure `interval` to set how often the `predicate` is called.
*
* By default, `timeout` is Infinity. If given a value (in ms), and that
* timeout value is reached, this function will reject with
* the `ERROR_TIMEOUT_REACHED` error.
*/
export declare function sleepUntil(predicate: () => boolean, { interval, timeout }: {
interval?: number;
timeout?: number;
}): Promise<void>;
/**
* Never resolves and keeps Node running.
*/
export declare function sleepForever(): Promise<never>;
/**
* Register a synchronous function to be called once the process exits.
*/
export declare function onExit(fn: () => void): void;
export declare type ExitFn = () => Promise<void>;
/**
* Register an asynchronous function to be called when the process wants to
* exit.
*
* A handler will be registered for the 'SIGINT', 'SIGTERM', 'SIGHUP',
* 'SIGBREAK' signals. If any of the signal events is emitted, `fn` will be
* called exactly once, awaited upon, and then the process will exit once all
* registered functions are resolved.
*/
export declare function onBeforeExit(fn: ExitFn): void;
/**
* Remove a function that was registered with `onBeforeExit`.
*/
export declare function offBeforeExit(fn: ExitFn): void;
/**
* Asynchronous `process.exit()`, for running functions registered with
* `onBeforeExit`.
*/
export declare function processExit(exitCode?: number): Promise<void>;

158
node_modules/@ionic/utils-process/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,158 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.processExit = exports.offBeforeExit = exports.onBeforeExit = exports.onExit = exports.sleepForever = exports.sleepUntil = exports.sleep = exports.getPathParts = exports.createProcessEnv = exports.killProcessTree = exports.ERROR_TIMEOUT_REACHED = void 0;
const utils_object_1 = require("@ionic/utils-object");
const utils_terminal_1 = require("@ionic/utils-terminal");
const Debug = require("debug");
const pathlib = require("path");
const onSignalExit = require("signal-exit");
const kill = require("tree-kill");
const debug = Debug('ionic:utils-process');
exports.ERROR_TIMEOUT_REACHED = new Error('TIMEOUT_REACHED');
function killProcessTree(pid, signal = 'SIGTERM') {
return new Promise((resolve, reject) => {
kill(pid, signal, err => {
if (err) {
debug('error while killing process tree for %d: %O', pid, err);
return reject(err);
}
resolve();
});
});
}
exports.killProcessTree = killProcessTree;
/**
* Creates an alternative implementation of `process.env` object.
*
* On a Windows shell, `process.env` is a magic object that offers
* case-insensitive environment variable access. On other platforms, case
* sensitivity matters. This method creates an empty "`process.env`" object
* type that works for all platforms.
*/
function createProcessEnv(...sources) {
return Object.assign(utils_terminal_1.TERMINAL_INFO.windows ? utils_object_1.createCaseInsensitiveObject() : {}, ...sources);
}
exports.createProcessEnv = createProcessEnv;
/**
* Split a PATH string into path parts.
*/
function getPathParts(envpath = process.env.PATH || '') {
return envpath.split(pathlib.delimiter);
}
exports.getPathParts = getPathParts;
/**
* Resolves when the given amount of milliseconds has passed.
*/
async function sleep(ms) {
return new Promise(resolve => {
setTimeout(resolve, ms);
});
}
exports.sleep = sleep;
/**
* Resolves when a given predicate is true or a timeout is reached.
*
* Configure `interval` to set how often the `predicate` is called.
*
* By default, `timeout` is Infinity. If given a value (in ms), and that
* timeout value is reached, this function will reject with
* the `ERROR_TIMEOUT_REACHED` error.
*/
async function sleepUntil(predicate, { interval = 30, timeout = Infinity }) {
let ms = 0;
while (!predicate()) {
await sleep(interval);
ms += interval;
if (ms > timeout) {
throw exports.ERROR_TIMEOUT_REACHED;
}
}
}
exports.sleepUntil = sleepUntil;
/**
* Never resolves and keeps Node running.
*/
async function sleepForever() {
return new Promise(() => {
setInterval(() => { }, 1000);
});
}
exports.sleepForever = sleepForever;
/**
* Register a synchronous function to be called once the process exits.
*/
function onExit(fn) {
onSignalExit(() => {
debug('onExit: process.exit/normal shutdown');
fn();
});
}
exports.onExit = onExit;
const exitFns = new Set();
/**
* Register an asynchronous function to be called when the process wants to
* exit.
*
* A handler will be registered for the 'SIGINT', 'SIGTERM', 'SIGHUP',
* 'SIGBREAK' signals. If any of the signal events is emitted, `fn` will be
* called exactly once, awaited upon, and then the process will exit once all
* registered functions are resolved.
*/
function onBeforeExit(fn) {
exitFns.add(fn);
}
exports.onBeforeExit = onBeforeExit;
/**
* Remove a function that was registered with `onBeforeExit`.
*/
function offBeforeExit(fn) {
exitFns.delete(fn);
}
exports.offBeforeExit = offBeforeExit;
const once = (fn) => {
let called = false;
return async () => {
if (!called) {
await fn();
called = true;
}
};
};
const beforeExitHandlerWrapper = (signal) => once(async () => {
debug('onBeforeExit handler: %O received', signal);
debug('onBeforeExit handler: running %O functions', exitFns.size);
await Promise.all([...exitFns.values()].map(async (fn) => {
try {
await fn();
}
catch (e) {
debug('onBeforeExit handler: error from function: %O', e);
}
}));
if (signal !== 'process.exit') {
debug('onBeforeExit handler: killing self (exit code %O, signal %O)', process.exitCode ? process.exitCode : 0, signal);
process.removeListener(signal, BEFORE_EXIT_SIGNAL_LISTENERS[signal]);
process.kill(process.pid, signal);
}
});
const BEFORE_EXIT_SIGNAL_LISTENERS = {
SIGINT: beforeExitHandlerWrapper('SIGINT'),
SIGTERM: beforeExitHandlerWrapper('SIGTERM'),
SIGHUP: beforeExitHandlerWrapper('SIGHUP'),
SIGBREAK: beforeExitHandlerWrapper('SIGBREAK'),
};
for (const [signal, fn] of Object.entries(BEFORE_EXIT_SIGNAL_LISTENERS)) {
process.on(signal, fn);
}
const processExitHandler = beforeExitHandlerWrapper('process.exit');
/**
* Asynchronous `process.exit()`, for running functions registered with
* `onBeforeExit`.
*/
async function processExit(exitCode = 0) {
process.exitCode = exitCode;
await processExitHandler();
debug('processExit: exiting (exit code: %O)', process.exitCode);
process.exit();
}
exports.processExit = processExit;

View File

@@ -0,0 +1,244 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.3.3](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@2.3.2...@ionic/utils-terminal@2.3.3) (2022-06-16)
**Note:** Version bump only for package @ionic/utils-terminal
## [2.3.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@2.3.1...@ionic/utils-terminal@2.3.2) (2022-05-09)
**Note:** Version bump only for package @ionic/utils-terminal
## [2.3.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@2.3.0...@ionic/utils-terminal@2.3.1) (2020-09-29)
### Bug Fixes
* add signal-exit dependency in correct place ([178e5e5](https://github.com/ionic-team/ionic-cli/commit/178e5e51cdc3593e3d096a5197e1dc0e17292bbd))
# [2.3.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@2.2.1...@ionic/utils-terminal@2.3.0) (2020-09-24)
### Features
* **format:** add more formatting utilities ([d30f099](https://github.com/ionic-team/ionic-cli/commit/d30f099f50df18816fb1d3064c434f1b318518a2))
* **format:** terminal prose formatting utils ([8912348](https://github.com/ionic-team/ionic-cli/commit/8912348ca348ae6192ddfff1af88f9c9443d205d))
## [2.2.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@2.2.0...@ionic/utils-terminal@2.2.1) (2020-08-28)
**Note:** Version bump only for package @ionic/utils-terminal
# [2.2.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@2.1.4...@ionic/utils-terminal@2.2.0) (2020-08-27)
### Features
* add some ansi escape codes + cursor wrapper ([edbdb57](https://github.com/ionic-team/ionic-cli/commit/edbdb572bfe2fb5710eff7e49a483c86601ba425))
## [2.1.4](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@2.1.3...@ionic/utils-terminal@2.1.4) (2020-08-25)
**Note:** Version bump only for package @ionic/utils-terminal
## [2.1.3](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@2.1.2...@ionic/utils-terminal@2.1.3) (2020-05-12)
### Bug Fixes
* pin tslib to avoid "Cannot set property pathExists" error ([689e1f0](https://github.com/ionic-team/ionic-cli/commit/689e1f038b907356ef855a067a76d4822e7072a8))
## [2.1.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@2.1.1...@ionic/utils-terminal@2.1.2) (2020-05-06)
**Note:** Version bump only for package @ionic/utils-terminal
## [2.1.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@2.1.0...@ionic/utils-terminal@2.1.1) (2020-03-03)
**Note:** Version bump only for package @ionic/utils-terminal
# 2.1.0 (2020-02-11)
### Features
* **start:** add new list starter option ([#4315](https://github.com/ionic-team/ionic-cli/issues/4315)) ([1df44c1](https://github.com/ionic-team/ionic-cli/commit/1df44c1591f37b89f2b672857740edd6cb2aea67))
## [2.0.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@2.0.1...@ionic/utils-terminal@2.0.2) (2020-02-10)
**Note:** Version bump only for package @ionic/utils-terminal
## [2.0.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@2.0.0...@ionic/utils-terminal@2.0.1) (2020-02-03)
**Note:** Version bump only for package @ionic/utils-terminal
# [2.0.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@1.1.2...@ionic/utils-terminal@2.0.0) (2020-01-25)
### chore
* require Node 10 ([5a47874](https://github.com/ionic-team/ionic-cli/commit/5a478746c074207b6dc96aa8771f04a606deb1ef))
### BREAKING CHANGES
* A minimum of Node.js 10.3.0 is required.
## [1.1.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@1.1.1...@ionic/utils-terminal@1.1.2) (2019-12-10)
### Bug Fixes
* **windows:** do not check TERM for windows detection ([ac4b417](https://github.com/ionic-team/ionic-cli/commit/ac4b417385c0c7859674e2ba59e495e9abc5bce4))
## [1.1.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@1.1.0...@ionic/utils-terminal@1.1.1) (2019-12-05)
**Note:** Version bump only for package @ionic/utils-terminal
# [1.1.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@1.0.5...@ionic/utils-terminal@1.1.0) (2019-11-21)
### Bug Fixes
* **shell:** use shell from NodeJS if available ([53d0afa](https://github.com/ionic-team/ionic-cli/commit/53d0afaea8966f7742220896a98da570c706fb63))
### Features
* **ci:** support GitHub Actions detection ([5646c8e](https://github.com/ionic-team/ionic-cli/commit/5646c8e083862dbf976cd6cdecabe209c0ad8cfd))
## [1.0.5](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@1.0.4...@ionic/utils-terminal@1.0.5) (2019-09-18)
**Note:** Version bump only for package @ionic/utils-terminal
## [1.0.4](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@1.0.3...@ionic/utils-terminal@1.0.4) (2019-08-23)
**Note:** Version bump only for package @ionic/utils-terminal
## [1.0.3](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@1.0.2...@ionic/utils-terminal@1.0.3) (2019-08-14)
**Note:** Version bump only for package @ionic/utils-terminal
## [1.0.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@1.0.1...@ionic/utils-terminal@1.0.2) (2019-08-07)
**Note:** Version bump only for package @ionic/utils-terminal
## [1.0.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@1.0.0...@ionic/utils-terminal@1.0.1) (2019-06-05)
**Note:** Version bump only for package @ionic/utils-terminal
# [1.0.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@0.0.1...@ionic/utils-terminal@1.0.0) (2019-05-29)
### chore
* require Node 8 ([5670e68](https://github.com/ionic-team/ionic-cli/commit/5670e68))
### Features
* include path to shell in terminal info ([79480b9](https://github.com/ionic-team/ionic-cli/commit/79480b9))
### BREAKING CHANGES
* A minimum of Node.js 8.9.4 is required.
<a name="0.0.1"></a>
## 0.0.1 (2019-02-27)
**Note:** Version bump only for package @ionic/utils-terminal

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-terminal

View File

@@ -0,0 +1,19 @@
/**
* ANSI escape codes (WIP)
*
* @see https://en.wikipedia.org/wiki/ANSI_escape_code
*/
export declare class EscapeCode {
static readonly cursorLeft: () => string;
static readonly cursorUp: (count?: number) => string;
static readonly cursorDown: (count?: number) => string;
static readonly cursorForward: (count?: number) => string;
static readonly cursorBackward: (count?: number) => string;
static readonly cursorHide: () => string;
static readonly cursorShow: () => string;
static readonly eraseLine: () => string;
static readonly eraseLines: (count: number) => string;
static readonly eraseUp: () => string;
static readonly eraseDown: () => string;
static readonly eraseScreen: () => string;
}

View File

@@ -0,0 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EscapeCode = void 0;
const ESC = '\u001B[';
/**
* ANSI escape codes (WIP)
*
* @see https://en.wikipedia.org/wiki/ANSI_escape_code
*/
class EscapeCode {
}
exports.EscapeCode = EscapeCode;
EscapeCode.cursorLeft = () => `${ESC}G`;
EscapeCode.cursorUp = (count = 1) => `${ESC}${count}A`;
EscapeCode.cursorDown = (count = 1) => `${ESC}${count}B`;
EscapeCode.cursorForward = (count = 1) => `${ESC}${count}C`;
EscapeCode.cursorBackward = (count = 1) => `${ESC}${count}D`;
EscapeCode.cursorHide = () => `${ESC}?25l`;
EscapeCode.cursorShow = () => `${ESC}?25h`;
EscapeCode.eraseLine = () => `${ESC}2K`;
EscapeCode.eraseLines = (count) => {
let seq = '';
for (let i = 0; i < count; i++) {
seq += EscapeCode.eraseLine();
if (i < count - 1) {
seq += EscapeCode.cursorUp();
}
}
return `${seq}${EscapeCode.cursorLeft()}`;
};
EscapeCode.eraseUp = () => `${ESC}1J`;
EscapeCode.eraseDown = () => `${ESC}J`;
EscapeCode.eraseScreen = () => `${ESC}2J`;

View File

@@ -0,0 +1,9 @@
/// <reference types="node" />
export declare class Cursor {
static stream: NodeJS.WriteStream;
private static _isVisible;
private static _listenerAttached;
static show(): void;
static hide(): void;
static toggle(): void;
}

View File

@@ -0,0 +1,37 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Cursor = void 0;
const onExit = require("signal-exit");
const ansi_1 = require("./ansi");
class Cursor {
static show() {
if (Cursor.stream.isTTY) {
Cursor._isVisible = true;
Cursor.stream.write(ansi_1.EscapeCode.cursorShow());
}
}
static hide() {
if (Cursor.stream.isTTY) {
if (!Cursor._listenerAttached) {
onExit(() => {
Cursor.show();
});
Cursor._listenerAttached = true;
}
Cursor._isVisible = false;
Cursor.stream.write(ansi_1.EscapeCode.cursorHide());
}
}
static toggle() {
if (Cursor._isVisible) {
Cursor.hide();
}
else {
Cursor.show();
}
}
}
exports.Cursor = Cursor;
Cursor.stream = process.stderr;
Cursor._isVisible = true;
Cursor._listenerAttached = false;

View File

@@ -0,0 +1,35 @@
import sliceAnsi = require('slice-ansi');
import stringWidth = require('string-width');
import stripAnsi = require('strip-ansi');
export { sliceAnsi, stringWidth, stripAnsi };
export declare const TTY_WIDTH: number;
export declare function indent(n?: number): string;
export interface WordWrapOptions {
width?: number;
indentation?: number;
append?: string;
}
export declare function wordWrap(msg: string, { width, indentation, append }: WordWrapOptions): string;
export declare function prettyPath(p: string): string;
export declare function expandPath(p: string): string;
export declare function generateFillSpaceStringList(list: string[], optimalLength?: number, fillCharacter?: string): string[];
export interface ColumnarOptions {
hsep?: string;
vsep?: string;
headers?: string[];
}
/**
* Basic CLI table generator with support for ANSI colors.
*
* @param rows 2-dimensional matrix containing cells. An array of columns,
* which are arrays of cells.
* @param options.vsep The vertical separator character, default is
* `chalk.dim('|')`. Supply an empty string to hide
* the separator altogether.
* @param options.hsep The horizontal separator character, default is
* `chalk.dim('-')`. This is used under the headers,
* if supplied. Supply an empty string to hide the
* separator altogether.
* @param options.headers An array of header cells.
*/
export declare function columnar(rows: string[][], { hsep, vsep, headers }: ColumnarOptions): string;

View File

@@ -0,0 +1,122 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.columnar = exports.generateFillSpaceStringList = exports.expandPath = exports.prettyPath = exports.wordWrap = exports.indent = exports.TTY_WIDTH = exports.stripAnsi = exports.stringWidth = exports.sliceAnsi = void 0;
const os = require("os");
const path = require("path");
const sliceAnsi = require("slice-ansi");
exports.sliceAnsi = sliceAnsi;
const stringWidth = require("string-width");
exports.stringWidth = stringWidth;
const stripAnsi = require("strip-ansi");
exports.stripAnsi = stripAnsi;
const wrapAnsi = require("wrap-ansi");
const untildify = require("untildify");
const MIN_TTY_WIDTH = 80;
const MAX_TTY_WIDTH = 120;
exports.TTY_WIDTH = process.stdout.columns ? Math.max(MIN_TTY_WIDTH, Math.min(process.stdout.columns, MAX_TTY_WIDTH)) : Infinity;
function indent(n = 4) {
return ' '.repeat(n);
}
exports.indent = indent;
function wordWrap(msg, { width = exports.TTY_WIDTH, indentation = 0, append = '' }) {
return wrapAnsi(msg, width - indentation - append.length, { trim: true }).split('\n').join(`${append}\n${indent(indentation)}`);
}
exports.wordWrap = wordWrap;
function prettyPath(p) {
p = expandPath(p);
const cwd = process.cwd();
const d = path.dirname(p);
const h = os.homedir();
const distanceFromCwd = Math.abs(d.split(path.sep).length - cwd.split(path.sep).length);
if (cwd === d) {
return '.' + path.sep + path.basename(p);
}
else if (d.startsWith(cwd)) {
return '.' + path.sep + p.substring(cwd.length + 1);
}
else if (distanceFromCwd <= 2) {
const rel = path.relative(cwd, p);
return rel ? rel : '.';
}
else if (p === h) {
return '~';
}
else if (p.indexOf(h) === 0) {
return '~' + path.sep + p.substring(h.length + 1);
}
return p;
}
exports.prettyPath = prettyPath;
function expandPath(p) {
return path.resolve(untildify(p));
}
exports.expandPath = expandPath;
function generateFillSpaceStringList(list, optimalLength = 1, fillCharacter = ' ') {
if (optimalLength < 2) {
optimalLength = 2;
}
const longestItem = Math.max(...list.map(item => stringWidth(item)));
const fullLength = longestItem > optimalLength ? longestItem + 1 : optimalLength;
const fullLengthString = fillCharacter.repeat(fullLength);
return list.map(item => sliceAnsi(fullLengthString, 0, fullLength - stringWidth(item)));
}
exports.generateFillSpaceStringList = generateFillSpaceStringList;
/**
* Basic CLI table generator with support for ANSI colors.
*
* @param rows 2-dimensional matrix containing cells. An array of columns,
* which are arrays of cells.
* @param options.vsep The vertical separator character, default is
* `chalk.dim('|')`. Supply an empty string to hide
* the separator altogether.
* @param options.hsep The horizontal separator character, default is
* `chalk.dim('-')`. This is used under the headers,
* if supplied. Supply an empty string to hide the
* separator altogether.
* @param options.headers An array of header cells.
*/
function columnar(rows, { hsep = '-', vsep = '|', headers }) {
const includeHeaders = headers ? true : false;
if (!rows[0]) {
return '';
}
const columnCount = headers ? headers.length : rows[0].length;
const columns = headers ?
headers.map(header => [header]) :
rows[0].map(() => []);
for (const row of rows) {
let highestLineCount = 0;
const splitRows = row.map(cell => {
const lines = cell.split('\n');
highestLineCount = Math.max(highestLineCount, lines.length);
return lines;
});
for (const rowIndex in row) {
if (columns[rowIndex]) {
columns[rowIndex].push(...splitRows[rowIndex], ...Array(highestLineCount - splitRows[rowIndex].length).fill(''));
}
}
}
const paddedColumns = columns.map((col, columnIndex) => {
if (columnIndex < columnCount - 1) {
const spaceCol = generateFillSpaceStringList(col);
return col.map((cell, cellIndex) => `${cell}${spaceCol[cellIndex]}${vsep === '' ? '' : `${vsep} `}`);
}
else {
return col;
}
});
let longestRowLength = 0;
const singleColumn = paddedColumns.reduce((a, b) => {
return a.map((_, i) => {
const r = a[i] + b[i];
longestRowLength = Math.max(longestRowLength, stringWidth(r));
return r;
});
});
if (includeHeaders && hsep !== '') {
singleColumn.splice(1, 0, hsep.repeat(longestRowLength));
}
return singleColumn.join('\n');
}
exports.columnar = columnar;

View File

@@ -0,0 +1,4 @@
export * from './ansi';
export * from './cursor';
export * from './format';
export * from './info';

View File

@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./ansi"), exports);
tslib_1.__exportStar(require("./cursor"), exports);
tslib_1.__exportStar(require("./format"), exports);
tslib_1.__exportStar(require("./info"), exports);

View File

@@ -0,0 +1,26 @@
/**
* These environment variables work for: GitHub Actions, Travis CI, CircleCI,
* Gitlab CI, AppVeyor, CodeShip, Jenkins, TeamCity, Bitbucket Pipelines, AWS
* CodeBuild
*/
export declare const CI_ENVIRONMENT_VARIABLES: readonly string[];
export declare const CI_ENVIRONMENT_VARIABLES_DETECTED: string[];
export interface TerminalInfo {
/**
* Whether this is in CI or not.
*/
readonly ci: boolean;
/**
* Path to the user's shell program.
*/
readonly shell: string;
/**
* Whether the terminal is an interactive TTY or not.
*/
readonly tty: boolean;
/**
* Whether this is a Windows shell or not.
*/
readonly windows: boolean;
}
export declare const TERMINAL_INFO: TerminalInfo;

View File

@@ -0,0 +1,39 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TERMINAL_INFO = exports.CI_ENVIRONMENT_VARIABLES_DETECTED = exports.CI_ENVIRONMENT_VARIABLES = void 0;
const Debug = require("debug");
const os = require("os");
const debug = Debug('ionic:utils-terminal:info');
/**
* These environment variables work for: GitHub Actions, Travis CI, CircleCI,
* Gitlab CI, AppVeyor, CodeShip, Jenkins, TeamCity, Bitbucket Pipelines, AWS
* CodeBuild
*/
exports.CI_ENVIRONMENT_VARIABLES = ['CI', 'BUILD_ID', 'BUILD_NUMBER', 'BITBUCKET_COMMIT', 'CODEBUILD_BUILD_ARN', 'GITHUB_ACTIONS'];
exports.CI_ENVIRONMENT_VARIABLES_DETECTED = exports.CI_ENVIRONMENT_VARIABLES.filter(v => !!process.env[v]);
function getShell() {
const { shell } = os.userInfo();
if (shell) {
return shell;
}
if (process.env.SHELL) {
return process.env.SHELL;
}
if (process.platform === 'darwin') {
return '/bin/bash';
}
if (process.platform === 'win32') {
return process.env.COMSPEC ? process.env.COMSPEC : 'cmd.exe';
}
return '/bin/sh';
}
if (exports.CI_ENVIRONMENT_VARIABLES_DETECTED.length > 0) {
debug(`Environment variables for CI detected: ${exports.CI_ENVIRONMENT_VARIABLES_DETECTED.join(', ')}`);
}
exports.TERMINAL_INFO = Object.freeze({
ci: exports.CI_ENVIRONMENT_VARIABLES_DETECTED.length > 0,
shell: getShell(),
tty: Boolean(process.stdin.isTTY && process.stdout.isTTY && process.stderr.isTTY),
windows: process.platform === 'win32' || !!(process.env.OSTYPE && /^(msys|cygwin)$/.test(process.env.OSTYPE) ||
process.env.MSYSTEM && /^MINGW(32|64)$/.test(process.env.MSYSTEM)),
});

View File

@@ -0,0 +1,58 @@
{
"name": "@ionic/utils-terminal",
"version": "2.3.3",
"description": "Terminal 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": ">=10.3.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": {
"@types/slice-ansi": "^4.0.0",
"debug": "^4.0.0",
"signal-exit": "^3.0.3",
"slice-ansi": "^4.0.0",
"string-width": "^4.1.0",
"strip-ansi": "^6.0.0",
"tslib": "^2.0.1",
"untildify": "^4.0.0",
"wrap-ansi": "^7.0.0"
},
"devDependencies": {
"@types/debug": "^4.1.1",
"@types/jest": "^26.0.10",
"@types/node": "~10.17.13",
"@types/signal-exit": "^3.0.0",
"@types/wrap-ansi": "^3.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.0.2"
},
"gitHead": "f090194e755912d7b8e659f4323c5c2804115c81"
}

54
node_modules/@ionic/utils-process/package.json generated vendored Normal file
View File

@@ -0,0 +1,54 @@
{
"name": "@ionic/utils-process",
"version": "2.1.10",
"description": "Process 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": ">=10.3.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-object": "2.1.5",
"@ionic/utils-terminal": "2.3.3",
"debug": "^4.0.0",
"signal-exit": "^3.0.3",
"tree-kill": "^1.2.2",
"tslib": "^2.0.1"
},
"devDependencies": {
"@types/debug": "^4.1.1",
"@types/jest": "^26.0.10",
"@types/node": "~10.17.13",
"@types/signal-exit": "^3.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.0.2"
},
"gitHead": "f090194e755912d7b8e659f4323c5c2804115c81"
}

179
node_modules/@ionic/utils-stream/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,179 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [3.1.5](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-stream@3.1.4...@ionic/utils-stream@3.1.5) (2020-08-28)
**Note:** Version bump only for package @ionic/utils-stream
## [3.1.4](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-stream@3.1.3...@ionic/utils-stream@3.1.4) (2020-08-25)
**Note:** Version bump only for package @ionic/utils-stream
## [3.1.3](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-stream@3.1.2...@ionic/utils-stream@3.1.3) (2020-05-12)
### Bug Fixes
* pin tslib to avoid "Cannot set property pathExists" error ([689e1f0](https://github.com/ionic-team/ionic-cli/commit/689e1f038b907356ef855a067a76d4822e7072a8))
## [3.1.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-stream@3.1.1...@ionic/utils-stream@3.1.2) (2020-05-06)
**Note:** Version bump only for package @ionic/utils-stream
## [3.1.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-stream@3.1.0...@ionic/utils-stream@3.1.1) (2020-03-03)
**Note:** Version bump only for package @ionic/utils-stream
# 3.1.0 (2020-02-11)
### Features
* **start:** add new list starter option ([#4315](https://github.com/ionic-team/ionic-cli/issues/4315)) ([1df44c1](https://github.com/ionic-team/ionic-cli/commit/1df44c1591f37b89f2b672857740edd6cb2aea67))
## [3.0.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-stream@3.0.1...@ionic/utils-stream@3.0.2) (2020-02-10)
**Note:** Version bump only for package @ionic/utils-stream
## [3.0.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-stream@3.0.0...@ionic/utils-stream@3.0.1) (2020-02-03)
**Note:** Version bump only for package @ionic/utils-stream
# [3.0.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-stream@2.0.5...@ionic/utils-stream@3.0.0) (2020-01-25)
### chore
* require Node 10 ([5a47874](https://github.com/ionic-team/ionic-cli/commit/5a478746c074207b6dc96aa8771f04a606deb1ef))
### BREAKING CHANGES
* A minimum of Node.js 10.3.0 is required.
## [2.0.5](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-stream@2.0.4...@ionic/utils-stream@2.0.5) (2019-12-05)
**Note:** Version bump only for package @ionic/utils-stream
## [2.0.4](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-stream@2.0.3...@ionic/utils-stream@2.0.4) (2019-09-18)
**Note:** Version bump only for package @ionic/utils-stream
## [2.0.3](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-stream@2.0.2...@ionic/utils-stream@2.0.3) (2019-08-23)
**Note:** Version bump only for package @ionic/utils-stream
## [2.0.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-stream@2.0.1...@ionic/utils-stream@2.0.2) (2019-08-14)
**Note:** Version bump only for package @ionic/utils-stream
## [2.0.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-stream@2.0.0...@ionic/utils-stream@2.0.1) (2019-08-07)
**Note:** Version bump only for package @ionic/utils-stream
# [2.0.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-stream@1.0.1...@ionic/utils-stream@2.0.0) (2019-06-10)
### Code Refactoring
* remove combineStreams ([93f4ff2](https://github.com/ionic-team/ionic-cli/commit/93f4ff2))
### BREAKING CHANGES
* `combineStreams` has been removed. Use
`stream-combiner2` directly.
## [1.0.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-stream@1.0.0...@ionic/utils-stream@1.0.1) (2019-06-05)
**Note:** Version bump only for package @ionic/utils-stream
# [1.0.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-stream@0.0.1...@ionic/utils-stream@1.0.0) (2019-05-29)
### chore
* require Node 8 ([5670e68](https://github.com/ionic-team/ionic-cli/commit/5670e68))
### BREAKING CHANGES
* A minimum of Node.js 8.9.4 is required.
<a name="0.0.1"></a>
## 0.0.1 (2019-02-27)
**Note:** Version bump only for package @ionic/utils-stream

21
node_modules/@ionic/utils-stream/LICENSE generated vendored Normal file
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.

1
node_modules/@ionic/utils-stream/README.md generated vendored Normal file
View File

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

38
node_modules/@ionic/utils-stream/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,38 @@
/// <reference types="node" />
import { Readable, ReadableOptions, Writable, WritableOptions } from 'stream';
export declare class NullStream extends Writable {
_write(chunk: any, encoding: string, callback: () => void): void;
}
export interface ReadableStreamBufferOptions extends ReadableOptions {
chunkSize?: number;
allocSize?: number;
growSize?: number;
}
export declare class ReadableStreamBuffer extends Readable {
protected buffer: Buffer;
protected _size: number;
protected _stopped: boolean;
protected chunkSize: number;
protected growSize: number;
constructor(opts?: ReadableStreamBufferOptions);
get size(): number;
get stopped(): boolean;
_read(): void;
feed(data: Buffer | string, encoding?: string): void;
stop(): void;
protected _send(): void;
}
export interface WritableStreamBufferOptions extends WritableOptions {
allocSize?: number;
growSize?: number;
}
export declare class WritableStreamBuffer extends Writable {
protected buffer: Buffer;
protected _size: number;
protected growSize: number;
constructor(opts?: WritableStreamBufferOptions);
get size(): number;
_write(chunk: any, encoding: string, callback: () => void): void;
consume(bytes?: number): Buffer;
}
export declare function growBufferForAppendedData(buf: Buffer, actualsize: number, appendsize: number): Buffer;

108
node_modules/@ionic/utils-stream/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,108 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.growBufferForAppendedData = exports.WritableStreamBuffer = exports.ReadableStreamBuffer = exports.NullStream = void 0;
const stream_1 = require("stream");
const DEFAULT_CHUNK_SIZE = 4;
const DEFAULT_ALLOC_SIZE = 32;
const DEFAULT_GROW_SIZE = 16;
class NullStream extends stream_1.Writable {
_write(chunk, encoding, callback) {
callback();
}
}
exports.NullStream = NullStream;
class ReadableStreamBuffer extends stream_1.Readable {
constructor(opts) {
super(opts);
this._size = 0;
this._stopped = false;
this.buffer = Buffer.alloc(opts && opts.allocSize ? opts.allocSize : DEFAULT_ALLOC_SIZE);
this.chunkSize = opts && opts.chunkSize ? opts.chunkSize : DEFAULT_CHUNK_SIZE;
this.growSize = opts && opts.growSize ? opts.growSize : DEFAULT_GROW_SIZE;
}
get size() {
return this._size;
}
get stopped() {
return this._stopped;
}
_read() {
this._send();
}
feed(data, encoding = 'utf8') {
if (this._stopped) {
throw new Error('ReadableStreamBuffer is stopped. Can no longer feed.');
}
const datasize = typeof data === 'string' ? Buffer.byteLength(data) : data.length;
this.buffer = growBufferForAppendedData(this.buffer, this._size, Math.ceil(datasize / this.growSize) * this.growSize);
if (typeof data === 'string') {
this.buffer.write(data, this._size, datasize, encoding);
}
else {
this.buffer.copy(data, this._size, 0);
}
this._size += datasize;
}
stop() {
if (this._stopped) {
return;
}
this._stopped = true;
if (this._size === 0) {
this.push(null);
}
}
_send() {
const chunkSize = Math.min(this.chunkSize, this._size);
let done = false;
if (chunkSize > 0) {
const chunk = Buffer.alloc(chunkSize);
this.buffer.copy(chunk, 0, 0, chunkSize);
done = !this.push(chunk);
this.buffer.copy(this.buffer, 0, chunkSize, this._size);
this._size -= chunkSize;
}
if (this._size === 0 && this._stopped) {
this.push(null);
}
if (!done) {
setTimeout(() => this._send(), 1);
}
}
}
exports.ReadableStreamBuffer = ReadableStreamBuffer;
class WritableStreamBuffer extends stream_1.Writable {
constructor(opts) {
super(opts);
this._size = 0;
this.buffer = Buffer.alloc(opts && opts.allocSize ? opts.allocSize : DEFAULT_ALLOC_SIZE);
this.growSize = opts && opts.growSize ? opts.growSize : DEFAULT_GROW_SIZE;
}
get size() {
return this._size;
}
_write(chunk, encoding, callback) {
this.buffer = growBufferForAppendedData(this.buffer, this._size, Math.ceil(chunk.length / this.growSize) * this.growSize);
chunk.copy(this.buffer, this._size, 0);
this._size += chunk.length;
callback();
}
consume(bytes) {
bytes = typeof bytes === 'number' ? bytes : this._size;
const data = Buffer.alloc(bytes);
this.buffer.copy(data, 0, 0, data.length);
this.buffer.copy(this.buffer, 0, data.length);
this._size -= data.length;
return data;
}
}
exports.WritableStreamBuffer = WritableStreamBuffer;
function growBufferForAppendedData(buf, actualsize, appendsize) {
if ((buf.length - actualsize) >= appendsize) {
return buf;
}
const newbuffer = Buffer.alloc(buf.length + appendsize);
buf.copy(newbuffer, 0, 0, actualsize);
return newbuffer;
}
exports.growBufferForAppendedData = growBufferForAppendedData;

50
node_modules/@ionic/utils-stream/package.json generated vendored Normal file
View File

@@ -0,0 +1,50 @@
{
"name": "@ionic/utils-stream",
"version": "3.1.5",
"description": "Stream 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": ">=10.3.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": {
"debug": "^4.0.0",
"tslib": "^2.0.1"
},
"devDependencies": {
"@types/debug": "^4.1.1",
"@types/jest": "^26.0.10",
"@types/node": "~10.17.13",
"jest": "^26.4.2",
"jest-cli": "^26.0.1",
"lint-staged": "^10.0.2",
"rimraf": "^3.0.0",
"stream-combiner2": "^1.1.1",
"ts-jest": "~26.3.0",
"typescript": "~4.0.2"
},
"gitHead": "f85e6db0eba47c8d97181b52d69c687c100f93fb"
}

293
node_modules/@ionic/utils-subprocess/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,293 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.1.11](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@2.1.10...@ionic/utils-subprocess@2.1.11) (2022-06-16)
**Note:** Version bump only for package @ionic/utils-subprocess
## [2.1.10](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@2.1.9...@ionic/utils-subprocess@2.1.10) (2022-05-09)
**Note:** Version bump only for package @ionic/utils-subprocess
## [2.1.9](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@2.1.8...@ionic/utils-subprocess@2.1.9) (2022-03-04)
### Bug Fixes
* bump cross-spawn version to avoid windows problem ([#4784](https://github.com/ionic-team/ionic-cli/issues/4784)) ([2c88a71](https://github.com/ionic-team/ionic-cli/commit/2c88a7180e87497a27a97ca979c612d6663cbb2a))
## [2.1.8](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@2.1.7...@ionic/utils-subprocess@2.1.8) (2020-09-29)
**Note:** Version bump only for package @ionic/utils-subprocess
## [2.1.7](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@2.1.6...@ionic/utils-subprocess@2.1.7) (2020-09-24)
**Note:** Version bump only for package @ionic/utils-subprocess
## [2.1.6](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@2.1.5...@ionic/utils-subprocess@2.1.6) (2020-08-28)
**Note:** Version bump only for package @ionic/utils-subprocess
## [2.1.5](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@2.1.4...@ionic/utils-subprocess@2.1.5) (2020-08-27)
**Note:** Version bump only for package @ionic/utils-subprocess
## [2.1.4](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@2.1.3...@ionic/utils-subprocess@2.1.4) (2020-08-25)
**Note:** Version bump only for package @ionic/utils-subprocess
## [2.1.3](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@2.1.2...@ionic/utils-subprocess@2.1.3) (2020-05-12)
### Bug Fixes
* pin tslib to avoid "Cannot set property pathExists" error ([689e1f0](https://github.com/ionic-team/ionic-cli/commit/689e1f038b907356ef855a067a76d4822e7072a8))
## [2.1.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@2.1.1...@ionic/utils-subprocess@2.1.2) (2020-05-06)
**Note:** Version bump only for package @ionic/utils-subprocess
## [2.1.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@2.1.0...@ionic/utils-subprocess@2.1.1) (2020-03-03)
**Note:** Version bump only for package @ionic/utils-subprocess
# 2.1.0 (2020-02-11)
### Features
* **start:** add new list starter option ([#4315](https://github.com/ionic-team/ionic-cli/issues/4315)) ([1df44c1](https://github.com/ionic-team/ionic-cli/commit/1df44c1591f37b89f2b672857740edd6cb2aea67))
## [2.0.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@2.0.1...@ionic/utils-subprocess@2.0.2) (2020-02-10)
**Note:** Version bump only for package @ionic/utils-subprocess
## [2.0.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@2.0.0...@ionic/utils-subprocess@2.0.1) (2020-02-03)
**Note:** Version bump only for package @ionic/utils-subprocess
# [2.0.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@1.0.13...@ionic/utils-subprocess@2.0.0) (2020-01-25)
### chore
* require Node 10 ([5a47874](https://github.com/ionic-team/ionic-cli/commit/5a478746c074207b6dc96aa8771f04a606deb1ef))
### BREAKING CHANGES
* A minimum of Node.js 10.3.0 is required.
## [1.0.13](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@1.0.12...@ionic/utils-subprocess@1.0.13) (2020-01-13)
**Note:** Version bump only for package @ionic/utils-subprocess
## [1.0.12](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@1.0.11...@ionic/utils-subprocess@1.0.12) (2019-12-10)
**Note:** Version bump only for package @ionic/utils-subprocess
## [1.0.11](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@1.0.10...@ionic/utils-subprocess@1.0.11) (2019-12-05)
**Note:** Version bump only for package @ionic/utils-subprocess
## [1.0.10](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@1.0.9...@ionic/utils-subprocess@1.0.10) (2019-11-21)
**Note:** Version bump only for package @ionic/utils-subprocess
## [1.0.9](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@1.0.8...@ionic/utils-subprocess@1.0.9) (2019-10-14)
**Note:** Version bump only for package @ionic/utils-subprocess
## [1.0.8](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@1.0.7...@ionic/utils-subprocess@1.0.8) (2019-09-18)
**Note:** Version bump only for package @ionic/utils-subprocess
## [1.0.7](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@1.0.6...@ionic/utils-subprocess@1.0.7) (2019-08-28)
**Note:** Version bump only for package @ionic/utils-subprocess
## [1.0.6](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@1.0.5...@ionic/utils-subprocess@1.0.6) (2019-08-23)
**Note:** Version bump only for package @ionic/utils-subprocess
## [1.0.5](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@1.0.4...@ionic/utils-subprocess@1.0.5) (2019-08-14)
**Note:** Version bump only for package @ionic/utils-subprocess
## [1.0.4](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@1.0.3...@ionic/utils-subprocess@1.0.4) (2019-08-07)
**Note:** Version bump only for package @ionic/utils-subprocess
## [1.0.3](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@1.0.2...@ionic/utils-subprocess@1.0.3) (2019-06-28)
**Note:** Version bump only for package @ionic/utils-subprocess
## [1.0.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@1.0.1...@ionic/utils-subprocess@1.0.2) (2019-06-10)
**Note:** Version bump only for package @ionic/utils-subprocess
## [1.0.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@1.0.0...@ionic/utils-subprocess@1.0.1) (2019-06-05)
**Note:** Version bump only for package @ionic/utils-subprocess
# [1.0.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@0.1.0...@ionic/utils-subprocess@1.0.0) (2019-05-29)
### Bug Fixes
* **subprocess:** check all executable extensions on windows ([#3949](https://github.com/ionic-team/ionic-cli/issues/3949)) ([e1cf74e](https://github.com/ionic-team/ionic-cli/commit/e1cf74e))
### chore
* require Node 8 ([5670e68](https://github.com/ionic-team/ionic-cli/commit/5670e68))
### BREAKING CHANGES
* A minimum of Node.js 8.9.4 is required.
<a name="0.1.0"></a>
# [0.1.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-subprocess@0.0.1...@ionic/utils-subprocess@0.1.0) (2019-03-06)
### Bug Fixes
* **subprocess:** allow symlinks for commands found by `which` ([ce5bf80](https://github.com/ionic-team/ionic-cli/commit/ce5bf80))
* **subprocess:** check if command found by `which` is executable ([638cf61](https://github.com/ionic-team/ionic-cli/commit/638cf61))
### Features
* **subprocess:** add `convertPATH` utility ([eb14e8d](https://github.com/ionic-team/ionic-cli/commit/eb14e8d))
* **subprocess:** add `findExecutables` (like `which`, but for all) ([95acb53](https://github.com/ionic-team/ionic-cli/commit/95acb53))
* **subprocess:** options for `bashify()` ([465fafc](https://github.com/ionic-team/ionic-cli/commit/465fafc))
<a name="0.0.1"></a>
## 0.0.1 (2019-02-27)
**Note:** Version bump only for package @ionic/utils-subprocess

21
node_modules/@ionic/utils-subprocess/LICENSE generated vendored Normal file
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.

1
node_modules/@ionic/utils-subprocess/README.md generated vendored Normal file
View File

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

102
node_modules/@ionic/utils-subprocess/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,102 @@
/// <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";
message: string;
stack: string;
code?: typeof ERROR_COMMAND_NOT_FOUND | typeof ERROR_NON_ZERO_EXIT | typeof ERROR_SIGNAL_EXIT;
error?: Error;
output?: string;
signal?: string;
exitCode?: number;
constructor(message: string);
}
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[]>;

227
node_modules/@ionic/utils-subprocess/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,227 @@
"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 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 crossSpawn = require("cross-spawn");
const os = require("os");
const pathlib = 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(message) {
super(message);
this.name = 'SubprocessError';
this.message = message;
this.stack = (new Error()).stack || '';
}
}
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 = 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.');
err.code = exports.ERROR_COMMAND_NOT_FOUND;
}
else {
err = new SubprocessError('Command error.');
}
err.error = error;
reject(err);
});
p.on('close', (code, signal) => {
let err;
if (code === 0) {
return resolve();
}
if (signal) {
err = new SubprocessError('Signal exit from subprocess.');
err.code = exports.ERROR_SIGNAL_EXIT;
err.signal = signal;
}
else {
err = new SubprocessError('Non-zero exit from subprocess.');
err.code = exports.ERROR_NON_ZERO_EXIT;
err.exitCode = code;
}
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 crossSpawn(command, [...args], options);
}
exports.spawn = spawn;
function fork(modulePath, args = [], options = {}) {
return 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 = 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 = 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 utils_array_1.map(programNames, async (programName) => utils_array_1.concurrentFilter(pathParts.map(p => pathlib.join(p, programName)), async (p) => utils_fs_1.isExecutableFile(p))));
}

View File

@@ -0,0 +1,310 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [3.1.6](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@3.1.5...@ionic/utils-fs@3.1.6) (2022-06-16)
**Note:** Version bump only for package @ionic/utils-fs
## [3.1.5](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@3.1.4...@ionic/utils-fs@3.1.5) (2020-08-28)
**Note:** Version bump only for package @ionic/utils-fs
## [3.1.4](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@3.1.3...@ionic/utils-fs@3.1.4) (2020-08-25)
**Note:** Version bump only for package @ionic/utils-fs
## [3.1.3](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@3.1.2...@ionic/utils-fs@3.1.3) (2020-05-12)
### Bug Fixes
* pin tslib to avoid "Cannot set property pathExists" error ([689e1f0](https://github.com/ionic-team/ionic-cli/commit/689e1f038b907356ef855a067a76d4822e7072a8))
## [3.1.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@3.1.1...@ionic/utils-fs@3.1.2) (2020-05-06)
**Note:** Version bump only for package @ionic/utils-fs
## [3.1.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@3.1.0...@ionic/utils-fs@3.1.1) (2020-03-03)
**Note:** Version bump only for package @ionic/utils-fs
# 3.1.0 (2020-02-11)
### Features
* **start:** add new list starter option ([#4315](https://github.com/ionic-team/ionic-cli/issues/4315)) ([1df44c1](https://github.com/ionic-team/ionic-cli/commit/1df44c1591f37b89f2b672857740edd6cb2aea67))
## [3.0.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@3.0.1...@ionic/utils-fs@3.0.2) (2020-02-10)
**Note:** Version bump only for package @ionic/utils-fs
## [3.0.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@3.0.0...@ionic/utils-fs@3.0.1) (2020-02-03)
**Note:** Version bump only for package @ionic/utils-fs
# [3.0.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.9...@ionic/utils-fs@3.0.0) (2020-01-25)
### chore
* require Node 10 ([5a47874](https://github.com/ionic-team/ionic-cli/commit/5a478746c074207b6dc96aa8771f04a606deb1ef))
### BREAKING CHANGES
* A minimum of Node.js 10.3.0 is required.
## [2.0.9](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.8...@ionic/utils-fs@2.0.9) (2019-12-05)
**Note:** Version bump only for package @ionic/utils-fs
## [2.0.8](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.7...@ionic/utils-fs@2.0.8) (2019-10-14)
### Bug Fixes
* **fileToString:** handle ENOTDIR errors ([fab07d8](https://github.com/ionic-team/ionic-cli/commit/fab07d8c6e3d6756d633ada4c81165d11c70eb8f))
## [2.0.7](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.6...@ionic/utils-fs@2.0.7) (2019-09-18)
**Note:** Version bump only for package @ionic/utils-fs
## [2.0.6](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.5...@ionic/utils-fs@2.0.6) (2019-08-23)
**Note:** Version bump only for package @ionic/utils-fs
## [2.0.5](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.4...@ionic/utils-fs@2.0.5) (2019-08-14)
**Note:** Version bump only for package @ionic/utils-fs
## [2.0.4](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.3...@ionic/utils-fs@2.0.4) (2019-08-07)
**Note:** Version bump only for package @ionic/utils-fs
## [2.0.3](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.2...@ionic/utils-fs@2.0.3) (2019-06-28)
**Note:** Version bump only for package @ionic/utils-fs
## [2.0.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.1...@ionic/utils-fs@2.0.2) (2019-06-10)
**Note:** Version bump only for package @ionic/utils-fs
## [2.0.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.0...@ionic/utils-fs@2.0.1) (2019-06-05)
**Note:** Version bump only for package @ionic/utils-fs
# [2.0.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@1.2.0...@ionic/utils-fs@2.0.0) (2019-05-29)
### chore
* require Node 8 ([5670e68](https://github.com/ionic-team/ionic-cli/commit/5670e68))
### BREAKING CHANGES
* A minimum of Node.js 8.9.4 is required.
<a name="1.2.0"></a>
# [1.2.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@1.1.1...@ionic/utils-fs@1.2.0) (2019-03-06)
### Features
* **fs:** add `isExecutableFile` utility ([53d9626](https://github.com/ionic-team/ionic-cli/commit/53d9626))
* **fs:** add `pathReadable`, `pathWritable`, and `pathExecutable` ([5412791](https://github.com/ionic-team/ionic-cli/commit/5412791))
<a name="1.1.1"></a>
## [1.1.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@1.1.0...@ionic/utils-fs@1.1.1) (2019-02-27)
**Note:** Version bump only for package @ionic/utils-fs
<a name="1.1.0"></a>
# [1.1.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@1.0.0...@ionic/utils-fs@1.1.0) (2019-02-15)
### Bug Fixes
* **walk:** stat symlinks themselves while walking ([92f2cee](https://github.com/ionic-team/ionic-cli/commit/92f2cee))
### Features
* **fs:** `onError` option for `readdirp` and `getFileTree` ([90bcfcd](https://github.com/ionic-team/ionic-cli/commit/90bcfcd))
* **fs:** `onFileNode` and `onDirectoryNode` options for `getFileTree` ([1858e96](https://github.com/ionic-team/ionic-cli/commit/1858e96))
* **fs:** add `getFileTree` for creating file tree object structures ([c14b46b](https://github.com/ionic-team/ionic-cli/commit/c14b46b))
<a name="1.0.0"></a>
# [1.0.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@0.0.7...@ionic/utils-fs@1.0.0) (2019-01-08)
### Bug Fixes
* rimraf is a full dependency ([962ad94](https://github.com/ionic-team/ionic-cli/commit/962ad94))
### Features
* switch to fs-extra ([c17d8d8](https://github.com/ionic-team/ionic-cli/commit/c17d8d8))
### BREAKING CHANGES
* `readDir`, `readDirp`, `readDirSafe` were renamed to be
consistent with fs and fs-extra. `readJsonFile` and `writeJsonFile` have
been renamed to `readJson` and `writeJson` and use the fs-extra version
directly. `isDir` was removed (use stat). `copyFile` and `copyDirectory`
were removed (use `copy`). `removeDirectory` was removed (use `remove`).
<a name="0.0.7"></a>
## [0.0.7](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@0.0.6...@ionic/utils-fs@0.0.7) (2019-01-07)
**Note:** Version bump only for package @ionic/utils-fs
<a name="0.0.6"></a>
## [0.0.6](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@0.0.5...@ionic/utils-fs@0.0.6) (2018-12-19)
**Note:** Version bump only for package @ionic/utils-fs
<a name="0.0.5"></a>
## [0.0.5](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@0.0.4...@ionic/utils-fs@0.0.5) (2018-11-20)
**Note:** Version bump only for package @ionic/utils-fs
<a name="0.0.4"></a>
## [0.0.4](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@0.0.3...@ionic/utils-fs@0.0.4) (2018-10-31)
**Note:** Version bump only for package @ionic/utils-fs
<a name="0.0.3"></a>
## [0.0.3](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@0.0.2...@ionic/utils-fs@0.0.3) (2018-10-05)
**Note:** Version bump only for package @ionic/utils-fs
<a name="0.0.2"></a>
## [0.0.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@0.0.1...@ionic/utils-fs@0.0.2) (2018-10-03)
**Note:** Version bump only for package @ionic/utils-fs
<a name="0.0.1"></a>
## 0.0.1 (2018-09-05)
**Note:** Version bump only for package @ionic/utils-fs
# Change Log

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-fs

View File

@@ -0,0 +1,146 @@
/// <reference types="node" />
import * as fs from 'fs-extra';
import * as stream from 'stream';
export * from 'fs-extra';
export { stat as statSafe, readdir as readdirSafe } from './safe';
export interface ReaddirPOptions {
/**
* Filter out items from the walk process from the final result.
*
* @return `true` to keep, otherwise the item is filtered out
*/
readonly filter?: (item: WalkerItem) => boolean;
/**
* Called whenever an error occurs during the walk process.
*
* If excluded, the function will throw an error when first encountered.
*/
readonly onError?: (err: Error) => void;
readonly walkerOptions?: WalkerOptions;
}
export declare function readdirp(dir: string, { filter, onError, walkerOptions }?: ReaddirPOptions): Promise<string[]>;
export declare const enum FileType {
FILE = "file",
DIRECTORY = "directory"
}
export interface RegularFileNode {
path: string;
type: FileType.FILE;
parent: FileNode;
}
export interface DirectoryNode {
path: string;
type: FileType.DIRECTORY;
parent?: FileNode;
children: FileNode[];
}
export declare type FileNode = RegularFileNode | DirectoryNode;
export interface GetFileTreeOptions<RE = {}, DE = {}> {
/**
* Called whenever an error occurs during the walk process.
*
* If excluded, the function will throw an error when first encountered.
*/
readonly onError?: (err: Error) => void;
/**
* Called whenever a file node is added to the tree.
*
* File nodes can be supplemented by returning a new object from this
* function.
*/
readonly onFileNode?: (node: RegularFileNode) => RegularFileNode & RE;
/**
* Called whenever a directory node is added to the tree.
*
* Directory nodes can be supplemented by returning a new object from this
* function.
*/
readonly onDirectoryNode?: (node: DirectoryNode) => DirectoryNode & DE;
readonly walkerOptions?: WalkerOptions;
}
/**
* Compile and return a file tree structure.
*
* This function walks a directory structure recursively, building a nested
* object structure in memory that represents it. When finished, the root
* directory node is returned.
*
* @param dir The root directory from which to compile the file tree
*/
export declare function getFileTree<RE = {}, DE = {}>(dir: string, { onError, onFileNode, onDirectoryNode, walkerOptions }?: GetFileTreeOptions<RE, DE>): Promise<RegularFileNode & RE | DirectoryNode & DE>;
export declare function fileToString(filePath: string): Promise<string>;
export declare function getFileChecksum(filePath: string): Promise<string>;
/**
* Return true and cached checksums for a file by its path.
*
* Cached checksums are stored as `.md5` files next to the original file. If
* the cache file is missing, the cached checksum is undefined.
*
* @param p The file path
* @return Promise<[true checksum, cached checksum or undefined if cache file missing]>
*/
export declare function getFileChecksums(p: string): Promise<[string, string | undefined]>;
/**
* Store a cache file containing the source file's md5 checksum hash.
*
* @param p The file path
* @param checksum The checksum. If excluded, the checksum is computed
*/
export declare function cacheFileChecksum(p: string, checksum?: string): Promise<void>;
export declare function writeStreamToFile(stream: NodeJS.ReadableStream, destination: string): Promise<any>;
export declare function pathAccessible(filePath: string, mode: number): Promise<boolean>;
export declare function pathExists(filePath: string): Promise<boolean>;
export declare function pathReadable(filePath: string): Promise<boolean>;
export declare function pathWritable(filePath: string): Promise<boolean>;
export declare function pathExecutable(filePath: string): Promise<boolean>;
export declare function isExecutableFile(filePath: string): Promise<boolean>;
/**
* Find the base directory based on the path given and a marker file to look for.
*/
export declare function findBaseDirectory(dir: string, file: string): Promise<string | undefined>;
/**
* Generate a random file path within the computer's temporary directory.
*
* @param prefix Optionally provide a filename prefix.
*/
export declare function tmpfilepath(prefix?: string): string;
/**
* Given an absolute system path, compile an array of paths working backwards
* one directory at a time, always ending in the root directory.
*
* For example, `'/some/dir'` => `['/some/dir', '/some', '/']`
*
* @param filePath Absolute system base path.
*/
export declare function compilePaths(filePath: string): string[];
export interface WalkerItem {
path: string;
stats: fs.Stats;
}
export interface WalkerOptions {
/**
* Filter out file paths during walk.
*
* As the file tree is walked, this function can be used to exclude files and
* directories from the final result.
*
* It can also be used to tune performance. If a subdirectory is excluded, it
* is not walked.
*
* @param p The file path.
* @return `true` to include file path, otherwise it is excluded
*/
readonly pathFilter?: (p: string) => boolean;
}
export interface Walker extends stream.Readable {
on(event: 'data', callback: (item: WalkerItem) => void): this;
on(event: string, callback: (...args: any[]) => any): this;
}
export declare class Walker extends stream.Readable {
readonly p: string;
readonly options: WalkerOptions;
readonly paths: string[];
constructor(p: string, options?: WalkerOptions);
_read(): void;
}
export declare function walk(p: string, options?: WalkerOptions): Walker;

View File

@@ -0,0 +1,286 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.walk = exports.Walker = exports.compilePaths = exports.tmpfilepath = exports.findBaseDirectory = exports.isExecutableFile = exports.pathExecutable = exports.pathWritable = exports.pathReadable = exports.pathExists = exports.pathAccessible = exports.writeStreamToFile = exports.cacheFileChecksum = exports.getFileChecksums = exports.getFileChecksum = exports.fileToString = exports.getFileTree = exports.readdirp = exports.readdirSafe = exports.statSafe = void 0;
const tslib_1 = require("tslib");
const fs = require("fs-extra");
const os = require("os");
const path = require("path");
const stream = require("stream");
const safe = require("./safe");
tslib_1.__exportStar(require("fs-extra"), exports);
var safe_1 = require("./safe");
Object.defineProperty(exports, "statSafe", { enumerable: true, get: function () { return safe_1.stat; } });
Object.defineProperty(exports, "readdirSafe", { enumerable: true, get: function () { return safe_1.readdir; } });
async function readdirp(dir, { filter, onError, walkerOptions } = {}) {
return new Promise((resolve, reject) => {
const items = [];
let rs = walk(dir, walkerOptions);
if (filter) {
rs = rs.pipe(new stream.Transform({
objectMode: true,
transform(obj, enc, cb) {
if (!filter || filter(obj)) {
this.push(obj);
}
cb();
},
}));
}
rs
.on('error', (err) => onError ? onError(err) : reject(err))
.on('data', (item) => items.push(item.path))
.on('end', () => resolve(items));
});
}
exports.readdirp = readdirp;
/**
* Compile and return a file tree structure.
*
* This function walks a directory structure recursively, building a nested
* object structure in memory that represents it. When finished, the root
* directory node is returned.
*
* @param dir The root directory from which to compile the file tree
*/
async function getFileTree(dir, { onError, onFileNode = n => n, onDirectoryNode = n => n, walkerOptions } = {}) {
const fileMap = new Map([]);
const getOrCreateParent = (item) => {
const parentPath = path.dirname(item.path);
const parent = fileMap.get(parentPath);
if (parent && parent.type === "directory" /* DIRECTORY */) {
return parent;
}
return onDirectoryNode({ path: parentPath, type: "directory" /* DIRECTORY */, children: [] });
};
const createFileNode = (item, parent) => {
const node = { path: item.path, parent };
return item.stats.isDirectory() ?
onDirectoryNode({ ...node, type: "directory" /* DIRECTORY */, children: [] }) :
onFileNode({ ...node, type: "file" /* FILE */ });
};
return new Promise((resolve, reject) => {
dir = path.resolve(dir);
const rs = walk(dir, walkerOptions);
rs
.on('error', err => onError ? onError(err) : reject(err))
.on('data', item => {
const parent = getOrCreateParent(item);
const node = createFileNode(item, parent);
parent.children.push(node);
fileMap.set(item.path, node);
fileMap.set(parent.path, parent);
})
.on('end', () => {
const root = fileMap.get(dir);
if (!root) {
return reject(new Error('No root node found after walking directory structure.'));
}
delete root.parent;
resolve(root);
});
});
}
exports.getFileTree = getFileTree;
async function fileToString(filePath) {
try {
return await fs.readFile(filePath, { encoding: 'utf8' });
}
catch (e) {
if (e.code === 'ENOENT' || e.code === 'ENOTDIR') {
return '';
}
throw e;
}
}
exports.fileToString = fileToString;
async function getFileChecksum(filePath) {
const crypto = await Promise.resolve().then(() => require('crypto'));
return new Promise((resolve, reject) => {
const hash = crypto.createHash('md5');
const input = fs.createReadStream(filePath);
input.on('error', (err) => {
reject(err);
});
hash.once('readable', () => {
const fullChecksum = hash.read().toString('hex');
resolve(fullChecksum);
});
input.pipe(hash);
});
}
exports.getFileChecksum = getFileChecksum;
/**
* Return true and cached checksums for a file by its path.
*
* Cached checksums are stored as `.md5` files next to the original file. If
* the cache file is missing, the cached checksum is undefined.
*
* @param p The file path
* @return Promise<[true checksum, cached checksum or undefined if cache file missing]>
*/
async function getFileChecksums(p) {
return Promise.all([
getFileChecksum(p),
(async () => {
try {
const md5 = await fs.readFile(`${p}.md5`, { encoding: 'utf8' });
return md5.trim();
}
catch (e) {
if (e.code !== 'ENOENT') {
throw e;
}
}
})(),
]);
}
exports.getFileChecksums = getFileChecksums;
/**
* Store a cache file containing the source file's md5 checksum hash.
*
* @param p The file path
* @param checksum The checksum. If excluded, the checksum is computed
*/
async function cacheFileChecksum(p, checksum) {
const md5 = await getFileChecksum(p);
await fs.writeFile(`${p}.md5`, md5, { encoding: 'utf8' });
}
exports.cacheFileChecksum = cacheFileChecksum;
function writeStreamToFile(stream, destination) {
return new Promise((resolve, reject) => {
const dest = fs.createWriteStream(destination);
stream.pipe(dest);
dest.on('error', reject);
dest.on('finish', resolve);
});
}
exports.writeStreamToFile = writeStreamToFile;
async function pathAccessible(filePath, mode) {
try {
await fs.access(filePath, mode);
}
catch (e) {
return false;
}
return true;
}
exports.pathAccessible = pathAccessible;
async function pathExists(filePath) {
return pathAccessible(filePath, fs.constants.F_OK);
}
exports.pathExists = pathExists;
async function pathReadable(filePath) {
return pathAccessible(filePath, fs.constants.R_OK);
}
exports.pathReadable = pathReadable;
async function pathWritable(filePath) {
return pathAccessible(filePath, fs.constants.W_OK);
}
exports.pathWritable = pathWritable;
async function pathExecutable(filePath) {
return pathAccessible(filePath, fs.constants.X_OK);
}
exports.pathExecutable = pathExecutable;
async function isExecutableFile(filePath) {
const [stats, executable] = await (Promise.all([
safe.stat(filePath),
pathExecutable(filePath),
]));
return !!stats && (stats.isFile() || stats.isSymbolicLink()) && executable;
}
exports.isExecutableFile = isExecutableFile;
/**
* Find the base directory based on the path given and a marker file to look for.
*/
async function findBaseDirectory(dir, file) {
if (!dir || !file) {
return;
}
for (const d of compilePaths(dir)) {
const results = await safe.readdir(d);
if (results.includes(file)) {
return d;
}
}
}
exports.findBaseDirectory = findBaseDirectory;
/**
* Generate a random file path within the computer's temporary directory.
*
* @param prefix Optionally provide a filename prefix.
*/
function tmpfilepath(prefix) {
const rn = Math.random().toString(16).substring(2, 8);
const p = path.resolve(os.tmpdir(), prefix ? `${prefix}-${rn}` : rn);
return p;
}
exports.tmpfilepath = tmpfilepath;
/**
* Given an absolute system path, compile an array of paths working backwards
* one directory at a time, always ending in the root directory.
*
* For example, `'/some/dir'` => `['/some/dir', '/some', '/']`
*
* @param filePath Absolute system base path.
*/
function compilePaths(filePath) {
filePath = path.normalize(filePath);
if (!path.isAbsolute(filePath)) {
throw new Error(`${filePath} is not an absolute path`);
}
const parsed = path.parse(filePath);
if (filePath === parsed.root) {
return [filePath];
}
return filePath
.slice(parsed.root.length)
.split(path.sep)
.map((segment, i, array) => parsed.root + path.join(...array.slice(0, array.length - i)))
.concat(parsed.root);
}
exports.compilePaths = compilePaths;
class Walker extends stream.Readable {
constructor(p, options = {}) {
super({ objectMode: true });
this.p = p;
this.options = options;
this.paths = [this.p];
}
_read() {
const p = this.paths.shift();
const { pathFilter } = this.options;
if (!p) {
this.push(null);
return;
}
fs.lstat(p, (err, stats) => {
if (err) {
this.emit('error', err);
return;
}
const item = { path: p, stats };
if (stats.isDirectory()) {
fs.readdir(p, (err, contents) => {
if (err) {
this.emit('error', err);
return;
}
let paths = contents.map(file => path.join(p, file));
if (pathFilter) {
paths = paths.filter(p => pathFilter(p.substring(this.p.length + 1)));
}
this.paths.push(...paths);
this.push(item);
});
}
else {
this.push(item);
}
});
}
}
exports.Walker = Walker;
function walk(p, options = {}) {
return new Walker(p, options);
}
exports.walk = walk;

View File

@@ -0,0 +1,4 @@
/// <reference types="node" />
import * as fs from 'fs-extra';
export declare function stat(p: string): Promise<fs.Stats | undefined>;
export declare function readdir(dir: string): Promise<string[]>;

View File

@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.readdir = exports.stat = void 0;
const fs = require("fs-extra");
async function stat(p) {
try {
return await fs.stat(p);
}
catch (e) {
// ignore
}
}
exports.stat = stat;
async function readdir(dir) {
try {
return await fs.readdir(dir);
}
catch (e) {
return [];
}
}
exports.readdir = readdir;

View File

@@ -0,0 +1,51 @@
{
"name": "@ionic/utils-fs",
"version": "3.1.6",
"description": "Filesystem utils for Node",
"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": ">=10.3.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": {
"@types/fs-extra": "^8.0.0",
"debug": "^4.0.0",
"fs-extra": "^9.0.0",
"tslib": "^2.0.1"
},
"devDependencies": {
"@types/debug": "^4.1.1",
"@types/jest": "^26.0.10",
"@types/node": "~10.17.13",
"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.0.2"
},
"gitHead": "f090194e755912d7b8e659f4323c5c2804115c81"
}

View File

@@ -0,0 +1,244 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.3.3](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@2.3.2...@ionic/utils-terminal@2.3.3) (2022-06-16)
**Note:** Version bump only for package @ionic/utils-terminal
## [2.3.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@2.3.1...@ionic/utils-terminal@2.3.2) (2022-05-09)
**Note:** Version bump only for package @ionic/utils-terminal
## [2.3.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@2.3.0...@ionic/utils-terminal@2.3.1) (2020-09-29)
### Bug Fixes
* add signal-exit dependency in correct place ([178e5e5](https://github.com/ionic-team/ionic-cli/commit/178e5e51cdc3593e3d096a5197e1dc0e17292bbd))
# [2.3.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@2.2.1...@ionic/utils-terminal@2.3.0) (2020-09-24)
### Features
* **format:** add more formatting utilities ([d30f099](https://github.com/ionic-team/ionic-cli/commit/d30f099f50df18816fb1d3064c434f1b318518a2))
* **format:** terminal prose formatting utils ([8912348](https://github.com/ionic-team/ionic-cli/commit/8912348ca348ae6192ddfff1af88f9c9443d205d))
## [2.2.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@2.2.0...@ionic/utils-terminal@2.2.1) (2020-08-28)
**Note:** Version bump only for package @ionic/utils-terminal
# [2.2.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@2.1.4...@ionic/utils-terminal@2.2.0) (2020-08-27)
### Features
* add some ansi escape codes + cursor wrapper ([edbdb57](https://github.com/ionic-team/ionic-cli/commit/edbdb572bfe2fb5710eff7e49a483c86601ba425))
## [2.1.4](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@2.1.3...@ionic/utils-terminal@2.1.4) (2020-08-25)
**Note:** Version bump only for package @ionic/utils-terminal
## [2.1.3](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@2.1.2...@ionic/utils-terminal@2.1.3) (2020-05-12)
### Bug Fixes
* pin tslib to avoid "Cannot set property pathExists" error ([689e1f0](https://github.com/ionic-team/ionic-cli/commit/689e1f038b907356ef855a067a76d4822e7072a8))
## [2.1.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@2.1.1...@ionic/utils-terminal@2.1.2) (2020-05-06)
**Note:** Version bump only for package @ionic/utils-terminal
## [2.1.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@2.1.0...@ionic/utils-terminal@2.1.1) (2020-03-03)
**Note:** Version bump only for package @ionic/utils-terminal
# 2.1.0 (2020-02-11)
### Features
* **start:** add new list starter option ([#4315](https://github.com/ionic-team/ionic-cli/issues/4315)) ([1df44c1](https://github.com/ionic-team/ionic-cli/commit/1df44c1591f37b89f2b672857740edd6cb2aea67))
## [2.0.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@2.0.1...@ionic/utils-terminal@2.0.2) (2020-02-10)
**Note:** Version bump only for package @ionic/utils-terminal
## [2.0.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@2.0.0...@ionic/utils-terminal@2.0.1) (2020-02-03)
**Note:** Version bump only for package @ionic/utils-terminal
# [2.0.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@1.1.2...@ionic/utils-terminal@2.0.0) (2020-01-25)
### chore
* require Node 10 ([5a47874](https://github.com/ionic-team/ionic-cli/commit/5a478746c074207b6dc96aa8771f04a606deb1ef))
### BREAKING CHANGES
* A minimum of Node.js 10.3.0 is required.
## [1.1.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@1.1.1...@ionic/utils-terminal@1.1.2) (2019-12-10)
### Bug Fixes
* **windows:** do not check TERM for windows detection ([ac4b417](https://github.com/ionic-team/ionic-cli/commit/ac4b417385c0c7859674e2ba59e495e9abc5bce4))
## [1.1.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@1.1.0...@ionic/utils-terminal@1.1.1) (2019-12-05)
**Note:** Version bump only for package @ionic/utils-terminal
# [1.1.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@1.0.5...@ionic/utils-terminal@1.1.0) (2019-11-21)
### Bug Fixes
* **shell:** use shell from NodeJS if available ([53d0afa](https://github.com/ionic-team/ionic-cli/commit/53d0afaea8966f7742220896a98da570c706fb63))
### Features
* **ci:** support GitHub Actions detection ([5646c8e](https://github.com/ionic-team/ionic-cli/commit/5646c8e083862dbf976cd6cdecabe209c0ad8cfd))
## [1.0.5](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@1.0.4...@ionic/utils-terminal@1.0.5) (2019-09-18)
**Note:** Version bump only for package @ionic/utils-terminal
## [1.0.4](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@1.0.3...@ionic/utils-terminal@1.0.4) (2019-08-23)
**Note:** Version bump only for package @ionic/utils-terminal
## [1.0.3](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@1.0.2...@ionic/utils-terminal@1.0.3) (2019-08-14)
**Note:** Version bump only for package @ionic/utils-terminal
## [1.0.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@1.0.1...@ionic/utils-terminal@1.0.2) (2019-08-07)
**Note:** Version bump only for package @ionic/utils-terminal
## [1.0.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@1.0.0...@ionic/utils-terminal@1.0.1) (2019-06-05)
**Note:** Version bump only for package @ionic/utils-terminal
# [1.0.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-terminal@0.0.1...@ionic/utils-terminal@1.0.0) (2019-05-29)
### chore
* require Node 8 ([5670e68](https://github.com/ionic-team/ionic-cli/commit/5670e68))
### Features
* include path to shell in terminal info ([79480b9](https://github.com/ionic-team/ionic-cli/commit/79480b9))
### BREAKING CHANGES
* A minimum of Node.js 8.9.4 is required.
<a name="0.0.1"></a>
## 0.0.1 (2019-02-27)
**Note:** Version bump only for package @ionic/utils-terminal

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-terminal

View File

@@ -0,0 +1,19 @@
/**
* ANSI escape codes (WIP)
*
* @see https://en.wikipedia.org/wiki/ANSI_escape_code
*/
export declare class EscapeCode {
static readonly cursorLeft: () => string;
static readonly cursorUp: (count?: number) => string;
static readonly cursorDown: (count?: number) => string;
static readonly cursorForward: (count?: number) => string;
static readonly cursorBackward: (count?: number) => string;
static readonly cursorHide: () => string;
static readonly cursorShow: () => string;
static readonly eraseLine: () => string;
static readonly eraseLines: (count: number) => string;
static readonly eraseUp: () => string;
static readonly eraseDown: () => string;
static readonly eraseScreen: () => string;
}

View File

@@ -0,0 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EscapeCode = void 0;
const ESC = '\u001B[';
/**
* ANSI escape codes (WIP)
*
* @see https://en.wikipedia.org/wiki/ANSI_escape_code
*/
class EscapeCode {
}
exports.EscapeCode = EscapeCode;
EscapeCode.cursorLeft = () => `${ESC}G`;
EscapeCode.cursorUp = (count = 1) => `${ESC}${count}A`;
EscapeCode.cursorDown = (count = 1) => `${ESC}${count}B`;
EscapeCode.cursorForward = (count = 1) => `${ESC}${count}C`;
EscapeCode.cursorBackward = (count = 1) => `${ESC}${count}D`;
EscapeCode.cursorHide = () => `${ESC}?25l`;
EscapeCode.cursorShow = () => `${ESC}?25h`;
EscapeCode.eraseLine = () => `${ESC}2K`;
EscapeCode.eraseLines = (count) => {
let seq = '';
for (let i = 0; i < count; i++) {
seq += EscapeCode.eraseLine();
if (i < count - 1) {
seq += EscapeCode.cursorUp();
}
}
return `${seq}${EscapeCode.cursorLeft()}`;
};
EscapeCode.eraseUp = () => `${ESC}1J`;
EscapeCode.eraseDown = () => `${ESC}J`;
EscapeCode.eraseScreen = () => `${ESC}2J`;

View File

@@ -0,0 +1,9 @@
/// <reference types="node" />
export declare class Cursor {
static stream: NodeJS.WriteStream;
private static _isVisible;
private static _listenerAttached;
static show(): void;
static hide(): void;
static toggle(): void;
}

View File

@@ -0,0 +1,37 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Cursor = void 0;
const onExit = require("signal-exit");
const ansi_1 = require("./ansi");
class Cursor {
static show() {
if (Cursor.stream.isTTY) {
Cursor._isVisible = true;
Cursor.stream.write(ansi_1.EscapeCode.cursorShow());
}
}
static hide() {
if (Cursor.stream.isTTY) {
if (!Cursor._listenerAttached) {
onExit(() => {
Cursor.show();
});
Cursor._listenerAttached = true;
}
Cursor._isVisible = false;
Cursor.stream.write(ansi_1.EscapeCode.cursorHide());
}
}
static toggle() {
if (Cursor._isVisible) {
Cursor.hide();
}
else {
Cursor.show();
}
}
}
exports.Cursor = Cursor;
Cursor.stream = process.stderr;
Cursor._isVisible = true;
Cursor._listenerAttached = false;

View File

@@ -0,0 +1,35 @@
import sliceAnsi = require('slice-ansi');
import stringWidth = require('string-width');
import stripAnsi = require('strip-ansi');
export { sliceAnsi, stringWidth, stripAnsi };
export declare const TTY_WIDTH: number;
export declare function indent(n?: number): string;
export interface WordWrapOptions {
width?: number;
indentation?: number;
append?: string;
}
export declare function wordWrap(msg: string, { width, indentation, append }: WordWrapOptions): string;
export declare function prettyPath(p: string): string;
export declare function expandPath(p: string): string;
export declare function generateFillSpaceStringList(list: string[], optimalLength?: number, fillCharacter?: string): string[];
export interface ColumnarOptions {
hsep?: string;
vsep?: string;
headers?: string[];
}
/**
* Basic CLI table generator with support for ANSI colors.
*
* @param rows 2-dimensional matrix containing cells. An array of columns,
* which are arrays of cells.
* @param options.vsep The vertical separator character, default is
* `chalk.dim('|')`. Supply an empty string to hide
* the separator altogether.
* @param options.hsep The horizontal separator character, default is
* `chalk.dim('-')`. This is used under the headers,
* if supplied. Supply an empty string to hide the
* separator altogether.
* @param options.headers An array of header cells.
*/
export declare function columnar(rows: string[][], { hsep, vsep, headers }: ColumnarOptions): string;

View File

@@ -0,0 +1,122 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.columnar = exports.generateFillSpaceStringList = exports.expandPath = exports.prettyPath = exports.wordWrap = exports.indent = exports.TTY_WIDTH = exports.stripAnsi = exports.stringWidth = exports.sliceAnsi = void 0;
const os = require("os");
const path = require("path");
const sliceAnsi = require("slice-ansi");
exports.sliceAnsi = sliceAnsi;
const stringWidth = require("string-width");
exports.stringWidth = stringWidth;
const stripAnsi = require("strip-ansi");
exports.stripAnsi = stripAnsi;
const wrapAnsi = require("wrap-ansi");
const untildify = require("untildify");
const MIN_TTY_WIDTH = 80;
const MAX_TTY_WIDTH = 120;
exports.TTY_WIDTH = process.stdout.columns ? Math.max(MIN_TTY_WIDTH, Math.min(process.stdout.columns, MAX_TTY_WIDTH)) : Infinity;
function indent(n = 4) {
return ' '.repeat(n);
}
exports.indent = indent;
function wordWrap(msg, { width = exports.TTY_WIDTH, indentation = 0, append = '' }) {
return wrapAnsi(msg, width - indentation - append.length, { trim: true }).split('\n').join(`${append}\n${indent(indentation)}`);
}
exports.wordWrap = wordWrap;
function prettyPath(p) {
p = expandPath(p);
const cwd = process.cwd();
const d = path.dirname(p);
const h = os.homedir();
const distanceFromCwd = Math.abs(d.split(path.sep).length - cwd.split(path.sep).length);
if (cwd === d) {
return '.' + path.sep + path.basename(p);
}
else if (d.startsWith(cwd)) {
return '.' + path.sep + p.substring(cwd.length + 1);
}
else if (distanceFromCwd <= 2) {
const rel = path.relative(cwd, p);
return rel ? rel : '.';
}
else if (p === h) {
return '~';
}
else if (p.indexOf(h) === 0) {
return '~' + path.sep + p.substring(h.length + 1);
}
return p;
}
exports.prettyPath = prettyPath;
function expandPath(p) {
return path.resolve(untildify(p));
}
exports.expandPath = expandPath;
function generateFillSpaceStringList(list, optimalLength = 1, fillCharacter = ' ') {
if (optimalLength < 2) {
optimalLength = 2;
}
const longestItem = Math.max(...list.map(item => stringWidth(item)));
const fullLength = longestItem > optimalLength ? longestItem + 1 : optimalLength;
const fullLengthString = fillCharacter.repeat(fullLength);
return list.map(item => sliceAnsi(fullLengthString, 0, fullLength - stringWidth(item)));
}
exports.generateFillSpaceStringList = generateFillSpaceStringList;
/**
* Basic CLI table generator with support for ANSI colors.
*
* @param rows 2-dimensional matrix containing cells. An array of columns,
* which are arrays of cells.
* @param options.vsep The vertical separator character, default is
* `chalk.dim('|')`. Supply an empty string to hide
* the separator altogether.
* @param options.hsep The horizontal separator character, default is
* `chalk.dim('-')`. This is used under the headers,
* if supplied. Supply an empty string to hide the
* separator altogether.
* @param options.headers An array of header cells.
*/
function columnar(rows, { hsep = '-', vsep = '|', headers }) {
const includeHeaders = headers ? true : false;
if (!rows[0]) {
return '';
}
const columnCount = headers ? headers.length : rows[0].length;
const columns = headers ?
headers.map(header => [header]) :
rows[0].map(() => []);
for (const row of rows) {
let highestLineCount = 0;
const splitRows = row.map(cell => {
const lines = cell.split('\n');
highestLineCount = Math.max(highestLineCount, lines.length);
return lines;
});
for (const rowIndex in row) {
if (columns[rowIndex]) {
columns[rowIndex].push(...splitRows[rowIndex], ...Array(highestLineCount - splitRows[rowIndex].length).fill(''));
}
}
}
const paddedColumns = columns.map((col, columnIndex) => {
if (columnIndex < columnCount - 1) {
const spaceCol = generateFillSpaceStringList(col);
return col.map((cell, cellIndex) => `${cell}${spaceCol[cellIndex]}${vsep === '' ? '' : `${vsep} `}`);
}
else {
return col;
}
});
let longestRowLength = 0;
const singleColumn = paddedColumns.reduce((a, b) => {
return a.map((_, i) => {
const r = a[i] + b[i];
longestRowLength = Math.max(longestRowLength, stringWidth(r));
return r;
});
});
if (includeHeaders && hsep !== '') {
singleColumn.splice(1, 0, hsep.repeat(longestRowLength));
}
return singleColumn.join('\n');
}
exports.columnar = columnar;

View File

@@ -0,0 +1,4 @@
export * from './ansi';
export * from './cursor';
export * from './format';
export * from './info';

View File

@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./ansi"), exports);
tslib_1.__exportStar(require("./cursor"), exports);
tslib_1.__exportStar(require("./format"), exports);
tslib_1.__exportStar(require("./info"), exports);

View File

@@ -0,0 +1,26 @@
/**
* These environment variables work for: GitHub Actions, Travis CI, CircleCI,
* Gitlab CI, AppVeyor, CodeShip, Jenkins, TeamCity, Bitbucket Pipelines, AWS
* CodeBuild
*/
export declare const CI_ENVIRONMENT_VARIABLES: readonly string[];
export declare const CI_ENVIRONMENT_VARIABLES_DETECTED: string[];
export interface TerminalInfo {
/**
* Whether this is in CI or not.
*/
readonly ci: boolean;
/**
* Path to the user's shell program.
*/
readonly shell: string;
/**
* Whether the terminal is an interactive TTY or not.
*/
readonly tty: boolean;
/**
* Whether this is a Windows shell or not.
*/
readonly windows: boolean;
}
export declare const TERMINAL_INFO: TerminalInfo;

View File

@@ -0,0 +1,39 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TERMINAL_INFO = exports.CI_ENVIRONMENT_VARIABLES_DETECTED = exports.CI_ENVIRONMENT_VARIABLES = void 0;
const Debug = require("debug");
const os = require("os");
const debug = Debug('ionic:utils-terminal:info');
/**
* These environment variables work for: GitHub Actions, Travis CI, CircleCI,
* Gitlab CI, AppVeyor, CodeShip, Jenkins, TeamCity, Bitbucket Pipelines, AWS
* CodeBuild
*/
exports.CI_ENVIRONMENT_VARIABLES = ['CI', 'BUILD_ID', 'BUILD_NUMBER', 'BITBUCKET_COMMIT', 'CODEBUILD_BUILD_ARN', 'GITHUB_ACTIONS'];
exports.CI_ENVIRONMENT_VARIABLES_DETECTED = exports.CI_ENVIRONMENT_VARIABLES.filter(v => !!process.env[v]);
function getShell() {
const { shell } = os.userInfo();
if (shell) {
return shell;
}
if (process.env.SHELL) {
return process.env.SHELL;
}
if (process.platform === 'darwin') {
return '/bin/bash';
}
if (process.platform === 'win32') {
return process.env.COMSPEC ? process.env.COMSPEC : 'cmd.exe';
}
return '/bin/sh';
}
if (exports.CI_ENVIRONMENT_VARIABLES_DETECTED.length > 0) {
debug(`Environment variables for CI detected: ${exports.CI_ENVIRONMENT_VARIABLES_DETECTED.join(', ')}`);
}
exports.TERMINAL_INFO = Object.freeze({
ci: exports.CI_ENVIRONMENT_VARIABLES_DETECTED.length > 0,
shell: getShell(),
tty: Boolean(process.stdin.isTTY && process.stdout.isTTY && process.stderr.isTTY),
windows: process.platform === 'win32' || !!(process.env.OSTYPE && /^(msys|cygwin)$/.test(process.env.OSTYPE) ||
process.env.MSYSTEM && /^MINGW(32|64)$/.test(process.env.MSYSTEM)),
});

View File

@@ -0,0 +1,58 @@
{
"name": "@ionic/utils-terminal",
"version": "2.3.3",
"description": "Terminal 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": ">=10.3.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": {
"@types/slice-ansi": "^4.0.0",
"debug": "^4.0.0",
"signal-exit": "^3.0.3",
"slice-ansi": "^4.0.0",
"string-width": "^4.1.0",
"strip-ansi": "^6.0.0",
"tslib": "^2.0.1",
"untildify": "^4.0.0",
"wrap-ansi": "^7.0.0"
},
"devDependencies": {
"@types/debug": "^4.1.1",
"@types/jest": "^26.0.10",
"@types/node": "~10.17.13",
"@types/signal-exit": "^3.0.0",
"@types/wrap-ansi": "^3.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.0.2"
},
"gitHead": "f090194e755912d7b8e659f4323c5c2804115c81"
}

56
node_modules/@ionic/utils-subprocess/package.json generated vendored Normal file
View File

@@ -0,0 +1,56 @@
{
"name": "@ionic/utils-subprocess",
"version": "2.1.11",
"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": ">=10.3.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.5",
"@ionic/utils-fs": "3.1.6",
"@ionic/utils-process": "2.1.10",
"@ionic/utils-stream": "3.1.5",
"@ionic/utils-terminal": "2.3.3",
"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": "~10.17.13",
"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.0.2"
},
"gitHead": "f090194e755912d7b8e659f4323c5c2804115c81"
}

21
node_modules/@ionic/utils-terminal/LICENSE generated vendored Normal file
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.

1
node_modules/@ionic/utils-terminal/README.md generated vendored Normal file
View File

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

19
node_modules/@ionic/utils-terminal/dist/ansi.d.ts generated vendored Normal file
View File

@@ -0,0 +1,19 @@
/**
* ANSI escape codes (WIP)
*
* @see https://en.wikipedia.org/wiki/ANSI_escape_code
*/
export declare class EscapeCode {
static readonly cursorLeft: () => string;
static readonly cursorUp: (count?: number) => string;
static readonly cursorDown: (count?: number) => string;
static readonly cursorForward: (count?: number) => string;
static readonly cursorBackward: (count?: number) => string;
static readonly cursorHide: () => string;
static readonly cursorShow: () => string;
static readonly eraseLine: () => string;
static readonly eraseLines: (count: number) => string;
static readonly eraseUp: () => string;
static readonly eraseDown: () => string;
static readonly eraseScreen: () => string;
}

33
node_modules/@ionic/utils-terminal/dist/ansi.js generated vendored Normal file
View File

@@ -0,0 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EscapeCode = void 0;
const ESC = '\u001B[';
/**
* ANSI escape codes (WIP)
*
* @see https://en.wikipedia.org/wiki/ANSI_escape_code
*/
class EscapeCode {
}
exports.EscapeCode = EscapeCode;
EscapeCode.cursorLeft = () => `${ESC}G`;
EscapeCode.cursorUp = (count = 1) => `${ESC}${count}A`;
EscapeCode.cursorDown = (count = 1) => `${ESC}${count}B`;
EscapeCode.cursorForward = (count = 1) => `${ESC}${count}C`;
EscapeCode.cursorBackward = (count = 1) => `${ESC}${count}D`;
EscapeCode.cursorHide = () => `${ESC}?25l`;
EscapeCode.cursorShow = () => `${ESC}?25h`;
EscapeCode.eraseLine = () => `${ESC}2K`;
EscapeCode.eraseLines = (count) => {
let seq = '';
for (let i = 0; i < count; i++) {
seq += EscapeCode.eraseLine();
if (i < count - 1) {
seq += EscapeCode.cursorUp();
}
}
return `${seq}${EscapeCode.cursorLeft()}`;
};
EscapeCode.eraseUp = () => `${ESC}1J`;
EscapeCode.eraseDown = () => `${ESC}J`;
EscapeCode.eraseScreen = () => `${ESC}2J`;

9
node_modules/@ionic/utils-terminal/dist/cursor.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
/// <reference types="node" />
export declare class Cursor {
static stream: NodeJS.WriteStream;
private static _isVisible;
private static _listenerAttached;
static show(): void;
static hide(): void;
static toggle(): void;
}

38
node_modules/@ionic/utils-terminal/dist/cursor.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Cursor = void 0;
const tslib_1 = require("tslib");
const signal_exit_1 = tslib_1.__importDefault(require("signal-exit"));
const ansi_1 = require("./ansi");
class Cursor {
static show() {
if (Cursor.stream.isTTY) {
Cursor._isVisible = true;
Cursor.stream.write(ansi_1.EscapeCode.cursorShow());
}
}
static hide() {
if (Cursor.stream.isTTY) {
if (!Cursor._listenerAttached) {
(0, signal_exit_1.default)(() => {
Cursor.show();
});
Cursor._listenerAttached = true;
}
Cursor._isVisible = false;
Cursor.stream.write(ansi_1.EscapeCode.cursorHide());
}
}
static toggle() {
if (Cursor._isVisible) {
Cursor.hide();
}
else {
Cursor.show();
}
}
}
exports.Cursor = Cursor;
Cursor.stream = process.stderr;
Cursor._isVisible = true;
Cursor._listenerAttached = false;

35
node_modules/@ionic/utils-terminal/dist/format.d.ts generated vendored Normal file
View File

@@ -0,0 +1,35 @@
import sliceAnsi = require('slice-ansi');
import stringWidth = require('string-width');
import stripAnsi = require('strip-ansi');
export { sliceAnsi, stringWidth, stripAnsi };
export declare const TTY_WIDTH: number;
export declare function indent(n?: number): string;
export interface WordWrapOptions {
width?: number;
indentation?: number;
append?: string;
}
export declare function wordWrap(msg: string, { width, indentation, append }: WordWrapOptions): string;
export declare function prettyPath(p: string): string;
export declare function expandPath(p: string): string;
export declare function generateFillSpaceStringList(list: string[], optimalLength?: number, fillCharacter?: string): string[];
export interface ColumnarOptions {
hsep?: string;
vsep?: string;
headers?: string[];
}
/**
* Basic CLI table generator with support for ANSI colors.
*
* @param rows 2-dimensional matrix containing cells. An array of columns,
* which are arrays of cells.
* @param options.vsep The vertical separator character, default is
* `chalk.dim('|')`. Supply an empty string to hide
* the separator altogether.
* @param options.hsep The horizontal separator character, default is
* `chalk.dim('-')`. This is used under the headers,
* if supplied. Supply an empty string to hide the
* separator altogether.
* @param options.headers An array of header cells.
*/
export declare function columnar(rows: string[][], { hsep, vsep, headers }: ColumnarOptions): string;

123
node_modules/@ionic/utils-terminal/dist/format.js generated vendored Normal file
View File

@@ -0,0 +1,123 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.columnar = exports.generateFillSpaceStringList = exports.expandPath = exports.prettyPath = exports.wordWrap = exports.indent = exports.TTY_WIDTH = exports.stripAnsi = exports.stringWidth = exports.sliceAnsi = void 0;
const tslib_1 = require("tslib");
const os = tslib_1.__importStar(require("os"));
const path = tslib_1.__importStar(require("path"));
const sliceAnsi = require("slice-ansi");
exports.sliceAnsi = sliceAnsi;
const stringWidth = require("string-width");
exports.stringWidth = stringWidth;
const stripAnsi = require("strip-ansi");
exports.stripAnsi = stripAnsi;
const wrapAnsi = require("wrap-ansi");
const untildify = require("untildify");
const MIN_TTY_WIDTH = 80;
const MAX_TTY_WIDTH = 120;
exports.TTY_WIDTH = process.stdout.columns ? Math.max(MIN_TTY_WIDTH, Math.min(process.stdout.columns, MAX_TTY_WIDTH)) : Infinity;
function indent(n = 4) {
return ' '.repeat(n);
}
exports.indent = indent;
function wordWrap(msg, { width = exports.TTY_WIDTH, indentation = 0, append = '' }) {
return wrapAnsi(msg, width - indentation - append.length, { trim: true }).split('\n').join(`${append}\n${indent(indentation)}`);
}
exports.wordWrap = wordWrap;
function prettyPath(p) {
p = expandPath(p);
const cwd = process.cwd();
const d = path.dirname(p);
const h = os.homedir();
const distanceFromCwd = Math.abs(d.split(path.sep).length - cwd.split(path.sep).length);
if (cwd === d) {
return '.' + path.sep + path.basename(p);
}
else if (d.startsWith(cwd)) {
return '.' + path.sep + p.substring(cwd.length + 1);
}
else if (distanceFromCwd <= 2) {
const rel = path.relative(cwd, p);
return rel ? rel : '.';
}
else if (p === h) {
return '~';
}
else if (p.indexOf(h) === 0) {
return '~' + path.sep + p.substring(h.length + 1);
}
return p;
}
exports.prettyPath = prettyPath;
function expandPath(p) {
return path.resolve(untildify(p));
}
exports.expandPath = expandPath;
function generateFillSpaceStringList(list, optimalLength = 1, fillCharacter = ' ') {
if (optimalLength < 2) {
optimalLength = 2;
}
const longestItem = Math.max(...list.map(item => stringWidth(item)));
const fullLength = longestItem > optimalLength ? longestItem + 1 : optimalLength;
const fullLengthString = fillCharacter.repeat(fullLength);
return list.map(item => sliceAnsi(fullLengthString, 0, fullLength - stringWidth(item)));
}
exports.generateFillSpaceStringList = generateFillSpaceStringList;
/**
* Basic CLI table generator with support for ANSI colors.
*
* @param rows 2-dimensional matrix containing cells. An array of columns,
* which are arrays of cells.
* @param options.vsep The vertical separator character, default is
* `chalk.dim('|')`. Supply an empty string to hide
* the separator altogether.
* @param options.hsep The horizontal separator character, default is
* `chalk.dim('-')`. This is used under the headers,
* if supplied. Supply an empty string to hide the
* separator altogether.
* @param options.headers An array of header cells.
*/
function columnar(rows, { hsep = '-', vsep = '|', headers }) {
const includeHeaders = headers ? true : false;
if (!rows[0]) {
return '';
}
const columnCount = headers ? headers.length : rows[0].length;
const columns = headers ?
headers.map(header => [header]) :
rows[0].map(() => []);
for (const row of rows) {
let highestLineCount = 0;
const splitRows = row.map(cell => {
const lines = cell.split('\n');
highestLineCount = Math.max(highestLineCount, lines.length);
return lines;
});
for (const rowIndex in row) {
if (columns[rowIndex]) {
columns[rowIndex].push(...splitRows[rowIndex], ...Array(highestLineCount - splitRows[rowIndex].length).fill(''));
}
}
}
const paddedColumns = columns.map((col, columnIndex) => {
if (columnIndex < columnCount - 1) {
const spaceCol = generateFillSpaceStringList(col);
return col.map((cell, cellIndex) => `${cell}${spaceCol[cellIndex]}${vsep === '' ? '' : `${vsep} `}`);
}
else {
return col;
}
});
let longestRowLength = 0;
const singleColumn = paddedColumns.reduce((a, b) => {
return a.map((_, i) => {
const r = a[i] + b[i];
longestRowLength = Math.max(longestRowLength, stringWidth(r));
return r;
});
});
if (includeHeaders && hsep !== '') {
singleColumn.splice(1, 0, hsep.repeat(longestRowLength));
}
return singleColumn.join('\n');
}
exports.columnar = columnar;

4
node_modules/@ionic/utils-terminal/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
export * from './ansi';
export * from './cursor';
export * from './format';
export * from './info';

7
node_modules/@ionic/utils-terminal/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./ansi"), exports);
tslib_1.__exportStar(require("./cursor"), exports);
tslib_1.__exportStar(require("./format"), exports);
tslib_1.__exportStar(require("./info"), exports);

26
node_modules/@ionic/utils-terminal/dist/info.d.ts generated vendored Normal file
View File

@@ -0,0 +1,26 @@
/**
* These environment variables work for: GitHub Actions, Travis CI, CircleCI,
* Gitlab CI, AppVeyor, CodeShip, Jenkins, TeamCity, Bitbucket Pipelines, AWS
* CodeBuild
*/
export declare const CI_ENVIRONMENT_VARIABLES: readonly string[];
export declare const CI_ENVIRONMENT_VARIABLES_DETECTED: string[];
export interface TerminalInfo {
/**
* Whether this is in CI or not.
*/
readonly ci: boolean;
/**
* Path to the user's shell program.
*/
readonly shell: string;
/**
* Whether the terminal is an interactive TTY or not.
*/
readonly tty: boolean;
/**
* Whether this is a Windows shell or not.
*/
readonly windows: boolean;
}
export declare const TERMINAL_INFO: TerminalInfo;

Some files were not shown because too many files have changed in this diff Show More