forked from olcxjas-softworks/LarpixClient
Add capacitorjs runtime
This commit is contained in:
parent
d0ece489ee
commit
f90c0e6c40
8362 changed files with 1502407 additions and 1 deletions
21
node_modules/@ionic/cli-framework-output/LICENSE
generated
vendored
Normal file
21
node_modules/@ionic/cli-framework-output/LICENSE
generated
vendored
Normal 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
1
node_modules/@ionic/cli-framework-output/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
# @ionic/cli-framework-output
|
||||
33
node_modules/@ionic/cli-framework-output/dist/colors.d.ts
generated
vendored
Normal file
33
node_modules/@ionic/cli-framework-output/dist/colors.d.ts
generated
vendored
Normal 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;
|
||||
18
node_modules/@ionic/cli-framework-output/dist/colors.js
generated
vendored
Normal file
18
node_modules/@ionic/cli-framework-output/dist/colors.js
generated
vendored
Normal 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,
|
||||
}),
|
||||
});
|
||||
24
node_modules/@ionic/cli-framework-output/dist/index.d.ts
generated
vendored
Normal file
24
node_modules/@ionic/cli-framework-output/dist/index.d.ts
generated
vendored
Normal 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
29
node_modules/@ionic/cli-framework-output/dist/index.js
generated
vendored
Normal 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;
|
||||
105
node_modules/@ionic/cli-framework-output/dist/logger.d.ts
generated
vendored
Normal file
105
node_modules/@ionic/cli-framework-output/dist/logger.d.ts
generated
vendored
Normal 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
203
node_modules/@ionic/cli-framework-output/dist/logger.js
generated
vendored
Normal 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;
|
||||
41
node_modules/@ionic/cli-framework-output/dist/output.d.ts
generated
vendored
Normal file
41
node_modules/@ionic/cli-framework-output/dist/output.d.ts
generated
vendored
Normal 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;
|
||||
}
|
||||
86
node_modules/@ionic/cli-framework-output/dist/output.js
generated
vendored
Normal file
86
node_modules/@ionic/cli-framework-output/dist/output.js
generated
vendored
Normal 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;
|
||||
79
node_modules/@ionic/cli-framework-output/dist/tasks.d.ts
generated
vendored
Normal file
79
node_modules/@ionic/cli-framework-output/dist/tasks.d.ts
generated
vendored
Normal 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
141
node_modules/@ionic/cli-framework-output/dist/tasks.js
generated
vendored
Normal 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;
|
||||
4
node_modules/@ionic/cli-framework-output/dist/utils.d.ts
generated
vendored
Normal file
4
node_modules/@ionic/cli-framework-output/dist/utils.d.ts
generated
vendored
Normal 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
39
node_modules/@ionic/cli-framework-output/dist/utils.js
generated
vendored
Normal 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
50
node_modules/@ionic/cli-framework-output/package.json
generated
vendored
Normal 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"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue