Last commit july 5th

This commit is contained in:
2024-07-05 13:46:23 +02:00
parent dad0d86e8c
commit b0e4dfbb76
24982 changed files with 2621219 additions and 413 deletions

32
spa/node_modules/consola/dist/basic.cjs generated vendored Normal file
View File

@@ -0,0 +1,32 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
const core = require('./core.cjs');
const basic = require('./shared/consola.deac7d5a.cjs');
require('node:util');
require('node:path');
function createConsola(options = {}) {
let level = core.LogLevels.info;
if (process.env.CONSOLA_LEVEL) {
level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
}
const consola2 = core.createConsola({
level,
defaults: { level },
stdout: process.stdout,
stderr: process.stderr,
reporters: options.reporters || [new basic.BasicReporter()],
...options
});
return consola2;
}
const consola = createConsola();
exports.Consola = core.Consola;
exports.LogLevels = core.LogLevels;
exports.LogTypes = core.LogTypes;
exports.consola = consola;
exports.createConsola = createConsola;
exports.default = consola;

9
spa/node_modules/consola/dist/basic.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
import { ConsolaOptions, ConsolaInstance } from './core.js';
export { Consola, ConsolaReporter, FormatOptions, InputLogObject, LogLevel, LogLevels, LogObject, LogType, LogTypes } from './core.js';
declare function createConsola(options?: Partial<ConsolaOptions & {
fancy: boolean;
}>): ConsolaInstance;
declare const consola: ConsolaInstance;
export { ConsolaInstance, ConsolaOptions, consola, createConsola, consola as default };

24
spa/node_modules/consola/dist/basic.mjs generated vendored Normal file
View File

@@ -0,0 +1,24 @@
import { LogLevels, createConsola as createConsola$1 } from './core.mjs';
export { Consola, LogTypes } from './core.mjs';
import { B as BasicReporter } from './shared/consola.06ad8a64.mjs';
import 'node:util';
import 'node:path';
function createConsola(options = {}) {
let level = LogLevels.info;
if (process.env.CONSOLA_LEVEL) {
level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
}
const consola2 = createConsola$1({
level,
defaults: { level },
stdout: process.stdout,
stderr: process.stderr,
reporters: options.reporters || [new BasicReporter()],
...options
});
return consola2;
}
const consola = createConsola();
export { LogLevels, consola, createConsola, consola as default };

80
spa/node_modules/consola/dist/browser.cjs generated vendored Normal file
View File

@@ -0,0 +1,80 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
const core = require('./core.cjs');
class BrowserReporter {
constructor(options) {
this.options = { ...options };
this.defaultColor = "#7f8c8d";
this.levelColorMap = {
0: "#c0392b",
// Red
1: "#f39c12",
// Yellow
3: "#00BCD4"
// Cyan
};
this.typeColorMap = {
success: "#2ecc71"
// Green
};
}
_getLogFn(level) {
if (level < 1) {
return console.__error || console.error;
}
if (level === 1) {
return console.__warn || console.warn;
}
return console.__log || console.log;
}
log(logObj) {
const consoleLogFn = this._getLogFn(logObj.level);
const type = logObj.type === "log" ? "" : logObj.type;
const tag = logObj.tag || "";
const color = this.typeColorMap[logObj.type] || this.levelColorMap[logObj.level] || this.defaultColor;
const style = `
background: ${color};
border-radius: 0.5em;
color: white;
font-weight: bold;
padding: 2px 0.5em;
`;
const badge = `%c${[tag, type].filter(Boolean).join(":")}`;
if (typeof logObj.args[0] === "string") {
consoleLogFn(
`${badge}%c ${logObj.args[0]}`,
style,
// Empty string as style resets to default console style
"",
...logObj.args.slice(1)
);
} else {
consoleLogFn(badge, style, ...logObj.args);
}
}
}
function createConsola(options = {}) {
const consola2 = core.createConsola({
reporters: options.reporters || [new BrowserReporter({})],
prompt(message, options2 = {}) {
if (options2.type === "confirm") {
return Promise.resolve(confirm(message));
}
return Promise.resolve(prompt(message));
},
...options
});
return consola2;
}
const consola = createConsola();
exports.Consola = core.Consola;
exports.LogLevels = core.LogLevels;
exports.LogTypes = core.LogTypes;
exports.consola = consola;
exports.createConsola = createConsola;
exports.default = consola;

7
spa/node_modules/consola/dist/browser.d.ts generated vendored Normal file
View File

@@ -0,0 +1,7 @@
import { ConsolaOptions, ConsolaInstance } from './core.js';
export { Consola, ConsolaReporter, FormatOptions, InputLogObject, LogLevel, LogLevels, LogObject, LogType, LogTypes } from './core.js';
declare function createConsola(options?: Partial<ConsolaOptions>): ConsolaInstance;
declare const consola: ConsolaInstance;
export { ConsolaInstance, ConsolaOptions, consola, createConsola, consola as default };

72
spa/node_modules/consola/dist/browser.mjs generated vendored Normal file
View File

@@ -0,0 +1,72 @@
import { createConsola as createConsola$1 } from './core.mjs';
export { Consola, LogLevels, LogTypes } from './core.mjs';
class BrowserReporter {
constructor(options) {
this.options = { ...options };
this.defaultColor = "#7f8c8d";
this.levelColorMap = {
0: "#c0392b",
// Red
1: "#f39c12",
// Yellow
3: "#00BCD4"
// Cyan
};
this.typeColorMap = {
success: "#2ecc71"
// Green
};
}
_getLogFn(level) {
if (level < 1) {
return console.__error || console.error;
}
if (level === 1) {
return console.__warn || console.warn;
}
return console.__log || console.log;
}
log(logObj) {
const consoleLogFn = this._getLogFn(logObj.level);
const type = logObj.type === "log" ? "" : logObj.type;
const tag = logObj.tag || "";
const color = this.typeColorMap[logObj.type] || this.levelColorMap[logObj.level] || this.defaultColor;
const style = `
background: ${color};
border-radius: 0.5em;
color: white;
font-weight: bold;
padding: 2px 0.5em;
`;
const badge = `%c${[tag, type].filter(Boolean).join(":")}`;
if (typeof logObj.args[0] === "string") {
consoleLogFn(
`${badge}%c ${logObj.args[0]}`,
style,
// Empty string as style resets to default console style
"",
...logObj.args.slice(1)
);
} else {
consoleLogFn(badge, style, ...logObj.args);
}
}
}
function createConsola(options = {}) {
const consola2 = createConsola$1({
reporters: options.reporters || [new BrowserReporter({})],
prompt(message, options2 = {}) {
if (options2.type === "confirm") {
return Promise.resolve(confirm(message));
}
return Promise.resolve(prompt(message));
},
...options
});
return consola2;
}
const consola = createConsola();
export { consola, createConsola, consola as default };

436
spa/node_modules/consola/dist/chunks/prompt.cjs generated vendored Normal file

File diff suppressed because one or more lines are too long

429
spa/node_modules/consola/dist/chunks/prompt.mjs generated vendored Normal file

File diff suppressed because one or more lines are too long

415
spa/node_modules/consola/dist/core.cjs generated vendored Normal file
View File

@@ -0,0 +1,415 @@
'use strict';
const LogLevels = {
silent: Number.NEGATIVE_INFINITY,
fatal: 0,
error: 0,
warn: 1,
log: 2,
info: 3,
success: 3,
fail: 3,
ready: 3,
start: 3,
box: 3,
debug: 4,
trace: 5,
verbose: Number.POSITIVE_INFINITY
};
const LogTypes = {
// Silent
silent: {
level: -1
},
// Level 0
fatal: {
level: LogLevels.fatal
},
error: {
level: LogLevels.error
},
// Level 1
warn: {
level: LogLevels.warn
},
// Level 2
log: {
level: LogLevels.log
},
// Level 3
info: {
level: LogLevels.info
},
success: {
level: LogLevels.success
},
fail: {
level: LogLevels.fail
},
ready: {
level: LogLevels.info
},
start: {
level: LogLevels.info
},
box: {
level: LogLevels.info
},
// Level 4
debug: {
level: LogLevels.debug
},
// Level 5
trace: {
level: LogLevels.trace
},
// Verbose
verbose: {
level: LogLevels.verbose
}
};
function isObject(value) {
return value !== null && typeof value === "object";
}
function _defu(baseObject, defaults, namespace = ".", merger) {
if (!isObject(defaults)) {
return _defu(baseObject, {}, namespace, merger);
}
const object = Object.assign({}, defaults);
for (const key in baseObject) {
if (key === "__proto__" || key === "constructor") {
continue;
}
const value = baseObject[key];
if (value === null || value === void 0) {
continue;
}
if (merger && merger(object, key, value, namespace)) {
continue;
}
if (Array.isArray(value) && Array.isArray(object[key])) {
object[key] = [...value, ...object[key]];
} else if (isObject(value) && isObject(object[key])) {
object[key] = _defu(
value,
object[key],
(namespace ? `${namespace}.` : "") + key.toString(),
merger
);
} else {
object[key] = value;
}
}
return object;
}
function createDefu(merger) {
return (...arguments_) => (
// eslint-disable-next-line unicorn/no-array-reduce
arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
);
}
const defu = createDefu();
function isPlainObject(obj) {
return Object.prototype.toString.call(obj) === "[object Object]";
}
function isLogObj(arg) {
if (!isPlainObject(arg)) {
return false;
}
if (!arg.message && !arg.args) {
return false;
}
if (arg.stack) {
return false;
}
return true;
}
let paused = false;
const queue = [];
class Consola {
constructor(options = {}) {
const types = options.types || LogTypes;
this.options = defu(
{
...options,
defaults: { ...options.defaults },
level: _normalizeLogLevel(options.level, types),
reporters: [...options.reporters || []]
},
{
types: LogTypes,
throttle: 1e3,
throttleMin: 5,
formatOptions: {
date: true,
colors: false,
compact: true
}
}
);
for (const type in types) {
const defaults = {
type,
...this.options.defaults,
...types[type]
};
this[type] = this._wrapLogFn(defaults);
this[type].raw = this._wrapLogFn(
defaults,
true
);
}
if (this.options.mockFn) {
this.mockTypes();
}
this._lastLog = {};
}
get level() {
return this.options.level;
}
set level(level) {
this.options.level = _normalizeLogLevel(
level,
this.options.types,
this.options.level
);
}
prompt(message, opts) {
if (!this.options.prompt) {
throw new Error("prompt is not supported!");
}
return this.options.prompt(message, opts);
}
create(options) {
const instance = new Consola({
...this.options,
...options
});
if (this._mockFn) {
instance.mockTypes(this._mockFn);
}
return instance;
}
withDefaults(defaults) {
return this.create({
...this.options,
defaults: {
...this.options.defaults,
...defaults
}
});
}
withTag(tag) {
return this.withDefaults({
tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag
});
}
addReporter(reporter) {
this.options.reporters.push(reporter);
return this;
}
removeReporter(reporter) {
if (reporter) {
const i = this.options.reporters.indexOf(reporter);
if (i >= 0) {
return this.options.reporters.splice(i, 1);
}
} else {
this.options.reporters.splice(0);
}
return this;
}
setReporters(reporters) {
this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
return this;
}
wrapAll() {
this.wrapConsole();
this.wrapStd();
}
restoreAll() {
this.restoreConsole();
this.restoreStd();
}
wrapConsole() {
for (const type in this.options.types) {
if (!console["__" + type]) {
console["__" + type] = console[type];
}
console[type] = this[type].raw;
}
}
restoreConsole() {
for (const type in this.options.types) {
if (console["__" + type]) {
console[type] = console["__" + type];
delete console["__" + type];
}
}
}
wrapStd() {
this._wrapStream(this.options.stdout, "log");
this._wrapStream(this.options.stderr, "log");
}
_wrapStream(stream, type) {
if (!stream) {
return;
}
if (!stream.__write) {
stream.__write = stream.write;
}
stream.write = (data) => {
this[type].raw(String(data).trim());
};
}
restoreStd() {
this._restoreStream(this.options.stdout);
this._restoreStream(this.options.stderr);
}
_restoreStream(stream) {
if (!stream) {
return;
}
if (stream.__write) {
stream.write = stream.__write;
delete stream.__write;
}
}
pauseLogs() {
paused = true;
}
resumeLogs() {
paused = false;
const _queue = queue.splice(0);
for (const item of _queue) {
item[0]._logFn(item[1], item[2]);
}
}
mockTypes(mockFn) {
const _mockFn = mockFn || this.options.mockFn;
this._mockFn = _mockFn;
if (typeof _mockFn !== "function") {
return;
}
for (const type in this.options.types) {
this[type] = _mockFn(type, this.options.types[type]) || this[type];
this[type].raw = this[type];
}
}
_wrapLogFn(defaults, isRaw) {
return (...args) => {
if (paused) {
queue.push([this, defaults, args, isRaw]);
return;
}
return this._logFn(defaults, args, isRaw);
};
}
_logFn(defaults, args, isRaw) {
if ((defaults.level || 0) > this.level) {
return false;
}
const logObj = {
date: /* @__PURE__ */ new Date(),
args: [],
...defaults,
level: _normalizeLogLevel(defaults.level, this.options.types)
};
if (!isRaw && args.length === 1 && isLogObj(args[0])) {
Object.assign(logObj, args[0]);
} else {
logObj.args = [...args];
}
if (logObj.message) {
logObj.args.unshift(logObj.message);
delete logObj.message;
}
if (logObj.additional) {
if (!Array.isArray(logObj.additional)) {
logObj.additional = logObj.additional.split("\n");
}
logObj.args.push("\n" + logObj.additional.join("\n"));
delete logObj.additional;
}
logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
const resolveLog = (newLog = false) => {
const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
if (this._lastLog.object && repeated > 0) {
const args2 = [...this._lastLog.object.args];
if (repeated > 1) {
args2.push(`(repeated ${repeated} times)`);
}
this._log({ ...this._lastLog.object, args: args2 });
this._lastLog.count = 1;
}
if (newLog) {
this._lastLog.object = logObj;
this._log(logObj);
}
};
clearTimeout(this._lastLog.timeout);
const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
this._lastLog.time = logObj.date;
if (diffTime < this.options.throttle) {
try {
const serializedLog = JSON.stringify([
logObj.type,
logObj.tag,
logObj.args
]);
const isSameLog = this._lastLog.serialized === serializedLog;
this._lastLog.serialized = serializedLog;
if (isSameLog) {
this._lastLog.count = (this._lastLog.count || 0) + 1;
if (this._lastLog.count > this.options.throttleMin) {
this._lastLog.timeout = setTimeout(
resolveLog,
this.options.throttle
);
return;
}
}
} catch {
}
}
resolveLog(true);
}
_log(logObj) {
for (const reporter of this.options.reporters) {
reporter.log(logObj, {
options: this.options
});
}
}
}
function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
if (input === void 0) {
return defaultLevel;
}
if (typeof input === "number") {
return input;
}
if (types[input] && types[input].level !== void 0) {
return types[input].level;
}
return defaultLevel;
}
Consola.prototype.add = Consola.prototype.addReporter;
Consola.prototype.remove = Consola.prototype.removeReporter;
Consola.prototype.clear = Consola.prototype.removeReporter;
Consola.prototype.withScope = Consola.prototype.withTag;
Consola.prototype.mock = Consola.prototype.mockTypes;
Consola.prototype.pause = Consola.prototype.pauseLogs;
Consola.prototype.resume = Consola.prototype.resumeLogs;
function createConsola(options = {}) {
return new Consola(options);
}
exports.Consola = Consola;
exports.LogLevels = LogLevels;
exports.LogTypes = LogTypes;
exports.createConsola = createConsola;

124
spa/node_modules/consola/dist/core.d.ts generated vendored Normal file
View File

@@ -0,0 +1,124 @@
type SelectOption = {
label: string;
value: string;
hint?: string;
};
type TextOptions = {
type?: "text";
default?: string;
placeholder?: string;
initial?: string;
};
type ConfirmOptions = {
type: "confirm";
initial?: boolean;
};
type SelectOptions = {
type: "select";
initial?: string;
options: (string | SelectOption)[];
};
type MultiSelectOptions = {
type: "multiselect";
initial?: string;
options: string[] | SelectOption[];
required?: boolean;
};
type PromptOptions = TextOptions | ConfirmOptions | SelectOptions | MultiSelectOptions;
type inferPromptReturnType<T extends PromptOptions> = T extends TextOptions ? string : T extends ConfirmOptions ? boolean : T extends SelectOptions ? T["options"][number] : T extends MultiSelectOptions ? T["options"] : unknown;
declare function prompt<_ = any, __ = any, T extends PromptOptions = TextOptions>(message: string, opts?: PromptOptions): Promise<inferPromptReturnType<T>>;
type LogLevel = 0 | 1 | 2 | 3 | 4 | 5 | (number & {});
declare const LogLevels: Record<LogType, number>;
type LogType = "silent" | "fatal" | "error" | "warn" | "log" | "info" | "success" | "fail" | "ready" | "start" | "box" | "debug" | "trace" | "verbose";
declare const LogTypes: Record<LogType, Partial<LogObject>>;
interface ConsolaOptions {
reporters: ConsolaReporter[];
types: Record<LogType, InputLogObject>;
level: LogLevel;
defaults: InputLogObject;
throttle: number;
throttleMin: number;
stdout?: NodeJS.WriteStream;
stderr?: NodeJS.WriteStream;
mockFn?: (type: LogType, defaults: InputLogObject) => (...args: any) => void;
prompt?: typeof prompt | undefined;
formatOptions: FormatOptions;
}
/**
* @see https://nodejs.org/api/util.html#util_util_inspect_object_showhidden_depth_colors
*/
interface FormatOptions {
columns?: number;
date?: boolean;
colors?: boolean;
compact?: boolean | number;
[key: string]: unknown;
}
interface InputLogObject {
level?: LogLevel;
tag?: string;
type?: LogType;
message?: string;
additional?: string | string[];
args?: any[];
date?: Date;
}
interface LogObject extends InputLogObject {
level: LogLevel;
type: LogType;
tag: string;
args: any[];
date: Date;
[key: string]: unknown;
}
interface ConsolaReporter {
log: (logObj: LogObject, ctx: {
options: ConsolaOptions;
}) => void;
}
declare class Consola {
options: ConsolaOptions;
_lastLog: {
serialized?: string;
object?: LogObject;
count?: number;
time?: Date;
timeout?: ReturnType<typeof setTimeout>;
};
_mockFn?: ConsolaOptions["mockFn"];
constructor(options?: Partial<ConsolaOptions>);
get level(): LogLevel;
set level(level: LogLevel);
prompt<T extends PromptOptions>(message: string, opts?: T): Promise<T extends TextOptions ? string : T extends ConfirmOptions ? boolean : T extends SelectOptions ? T["options"][number] : T extends MultiSelectOptions ? T["options"] : unknown>;
create(options: Partial<ConsolaOptions>): ConsolaInstance;
withDefaults(defaults: InputLogObject): ConsolaInstance;
withTag(tag: string): ConsolaInstance;
addReporter(reporter: ConsolaReporter): this;
removeReporter(reporter: ConsolaReporter): ConsolaReporter[] | this;
setReporters(reporters: ConsolaReporter[]): this;
wrapAll(): void;
restoreAll(): void;
wrapConsole(): void;
restoreConsole(): void;
wrapStd(): void;
_wrapStream(stream: NodeJS.WriteStream | undefined, type: LogType): void;
restoreStd(): void;
_restoreStream(stream?: NodeJS.WriteStream): void;
pauseLogs(): void;
resumeLogs(): void;
mockTypes(mockFn?: ConsolaOptions["mockFn"]): void;
_wrapLogFn(defaults: InputLogObject, isRaw?: boolean): (...args: any[]) => false | undefined;
_logFn(defaults: InputLogObject, args: any[], isRaw?: boolean): false | undefined;
_log(logObj: LogObject): void;
}
interface LogFn {
(message: InputLogObject | any, ...args: any[]): void;
raw: (...args: any[]) => void;
}
type ConsolaInstance = Consola & Record<LogType, LogFn>;
declare function createConsola(options?: Partial<ConsolaOptions>): ConsolaInstance;
export { Consola, ConsolaInstance, ConsolaOptions, ConsolaReporter, FormatOptions, InputLogObject, LogLevel, LogLevels, LogObject, LogType, LogTypes, createConsola };

410
spa/node_modules/consola/dist/core.mjs generated vendored Normal file
View File

@@ -0,0 +1,410 @@
const LogLevels = {
silent: Number.NEGATIVE_INFINITY,
fatal: 0,
error: 0,
warn: 1,
log: 2,
info: 3,
success: 3,
fail: 3,
ready: 3,
start: 3,
box: 3,
debug: 4,
trace: 5,
verbose: Number.POSITIVE_INFINITY
};
const LogTypes = {
// Silent
silent: {
level: -1
},
// Level 0
fatal: {
level: LogLevels.fatal
},
error: {
level: LogLevels.error
},
// Level 1
warn: {
level: LogLevels.warn
},
// Level 2
log: {
level: LogLevels.log
},
// Level 3
info: {
level: LogLevels.info
},
success: {
level: LogLevels.success
},
fail: {
level: LogLevels.fail
},
ready: {
level: LogLevels.info
},
start: {
level: LogLevels.info
},
box: {
level: LogLevels.info
},
// Level 4
debug: {
level: LogLevels.debug
},
// Level 5
trace: {
level: LogLevels.trace
},
// Verbose
verbose: {
level: LogLevels.verbose
}
};
function isObject(value) {
return value !== null && typeof value === "object";
}
function _defu(baseObject, defaults, namespace = ".", merger) {
if (!isObject(defaults)) {
return _defu(baseObject, {}, namespace, merger);
}
const object = Object.assign({}, defaults);
for (const key in baseObject) {
if (key === "__proto__" || key === "constructor") {
continue;
}
const value = baseObject[key];
if (value === null || value === void 0) {
continue;
}
if (merger && merger(object, key, value, namespace)) {
continue;
}
if (Array.isArray(value) && Array.isArray(object[key])) {
object[key] = [...value, ...object[key]];
} else if (isObject(value) && isObject(object[key])) {
object[key] = _defu(
value,
object[key],
(namespace ? `${namespace}.` : "") + key.toString(),
merger
);
} else {
object[key] = value;
}
}
return object;
}
function createDefu(merger) {
return (...arguments_) => (
// eslint-disable-next-line unicorn/no-array-reduce
arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
);
}
const defu = createDefu();
function isPlainObject(obj) {
return Object.prototype.toString.call(obj) === "[object Object]";
}
function isLogObj(arg) {
if (!isPlainObject(arg)) {
return false;
}
if (!arg.message && !arg.args) {
return false;
}
if (arg.stack) {
return false;
}
return true;
}
let paused = false;
const queue = [];
class Consola {
constructor(options = {}) {
const types = options.types || LogTypes;
this.options = defu(
{
...options,
defaults: { ...options.defaults },
level: _normalizeLogLevel(options.level, types),
reporters: [...options.reporters || []]
},
{
types: LogTypes,
throttle: 1e3,
throttleMin: 5,
formatOptions: {
date: true,
colors: false,
compact: true
}
}
);
for (const type in types) {
const defaults = {
type,
...this.options.defaults,
...types[type]
};
this[type] = this._wrapLogFn(defaults);
this[type].raw = this._wrapLogFn(
defaults,
true
);
}
if (this.options.mockFn) {
this.mockTypes();
}
this._lastLog = {};
}
get level() {
return this.options.level;
}
set level(level) {
this.options.level = _normalizeLogLevel(
level,
this.options.types,
this.options.level
);
}
prompt(message, opts) {
if (!this.options.prompt) {
throw new Error("prompt is not supported!");
}
return this.options.prompt(message, opts);
}
create(options) {
const instance = new Consola({
...this.options,
...options
});
if (this._mockFn) {
instance.mockTypes(this._mockFn);
}
return instance;
}
withDefaults(defaults) {
return this.create({
...this.options,
defaults: {
...this.options.defaults,
...defaults
}
});
}
withTag(tag) {
return this.withDefaults({
tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag
});
}
addReporter(reporter) {
this.options.reporters.push(reporter);
return this;
}
removeReporter(reporter) {
if (reporter) {
const i = this.options.reporters.indexOf(reporter);
if (i >= 0) {
return this.options.reporters.splice(i, 1);
}
} else {
this.options.reporters.splice(0);
}
return this;
}
setReporters(reporters) {
this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
return this;
}
wrapAll() {
this.wrapConsole();
this.wrapStd();
}
restoreAll() {
this.restoreConsole();
this.restoreStd();
}
wrapConsole() {
for (const type in this.options.types) {
if (!console["__" + type]) {
console["__" + type] = console[type];
}
console[type] = this[type].raw;
}
}
restoreConsole() {
for (const type in this.options.types) {
if (console["__" + type]) {
console[type] = console["__" + type];
delete console["__" + type];
}
}
}
wrapStd() {
this._wrapStream(this.options.stdout, "log");
this._wrapStream(this.options.stderr, "log");
}
_wrapStream(stream, type) {
if (!stream) {
return;
}
if (!stream.__write) {
stream.__write = stream.write;
}
stream.write = (data) => {
this[type].raw(String(data).trim());
};
}
restoreStd() {
this._restoreStream(this.options.stdout);
this._restoreStream(this.options.stderr);
}
_restoreStream(stream) {
if (!stream) {
return;
}
if (stream.__write) {
stream.write = stream.__write;
delete stream.__write;
}
}
pauseLogs() {
paused = true;
}
resumeLogs() {
paused = false;
const _queue = queue.splice(0);
for (const item of _queue) {
item[0]._logFn(item[1], item[2]);
}
}
mockTypes(mockFn) {
const _mockFn = mockFn || this.options.mockFn;
this._mockFn = _mockFn;
if (typeof _mockFn !== "function") {
return;
}
for (const type in this.options.types) {
this[type] = _mockFn(type, this.options.types[type]) || this[type];
this[type].raw = this[type];
}
}
_wrapLogFn(defaults, isRaw) {
return (...args) => {
if (paused) {
queue.push([this, defaults, args, isRaw]);
return;
}
return this._logFn(defaults, args, isRaw);
};
}
_logFn(defaults, args, isRaw) {
if ((defaults.level || 0) > this.level) {
return false;
}
const logObj = {
date: /* @__PURE__ */ new Date(),
args: [],
...defaults,
level: _normalizeLogLevel(defaults.level, this.options.types)
};
if (!isRaw && args.length === 1 && isLogObj(args[0])) {
Object.assign(logObj, args[0]);
} else {
logObj.args = [...args];
}
if (logObj.message) {
logObj.args.unshift(logObj.message);
delete logObj.message;
}
if (logObj.additional) {
if (!Array.isArray(logObj.additional)) {
logObj.additional = logObj.additional.split("\n");
}
logObj.args.push("\n" + logObj.additional.join("\n"));
delete logObj.additional;
}
logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
const resolveLog = (newLog = false) => {
const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
if (this._lastLog.object && repeated > 0) {
const args2 = [...this._lastLog.object.args];
if (repeated > 1) {
args2.push(`(repeated ${repeated} times)`);
}
this._log({ ...this._lastLog.object, args: args2 });
this._lastLog.count = 1;
}
if (newLog) {
this._lastLog.object = logObj;
this._log(logObj);
}
};
clearTimeout(this._lastLog.timeout);
const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
this._lastLog.time = logObj.date;
if (diffTime < this.options.throttle) {
try {
const serializedLog = JSON.stringify([
logObj.type,
logObj.tag,
logObj.args
]);
const isSameLog = this._lastLog.serialized === serializedLog;
this._lastLog.serialized = serializedLog;
if (isSameLog) {
this._lastLog.count = (this._lastLog.count || 0) + 1;
if (this._lastLog.count > this.options.throttleMin) {
this._lastLog.timeout = setTimeout(
resolveLog,
this.options.throttle
);
return;
}
}
} catch {
}
}
resolveLog(true);
}
_log(logObj) {
for (const reporter of this.options.reporters) {
reporter.log(logObj, {
options: this.options
});
}
}
}
function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
if (input === void 0) {
return defaultLevel;
}
if (typeof input === "number") {
return input;
}
if (types[input] && types[input].level !== void 0) {
return types[input].level;
}
return defaultLevel;
}
Consola.prototype.add = Consola.prototype.addReporter;
Consola.prototype.remove = Consola.prototype.removeReporter;
Consola.prototype.clear = Consola.prototype.removeReporter;
Consola.prototype.withScope = Consola.prototype.withTag;
Consola.prototype.mock = Consola.prototype.mockTypes;
Consola.prototype.pause = Consola.prototype.pauseLogs;
Consola.prototype.resume = Consola.prototype.resumeLogs;
function createConsola(options = {}) {
return new Consola(options);
}
export { Consola, LogLevels, LogTypes, createConsola };

21
spa/node_modules/consola/dist/index.cjs generated vendored Normal file
View File

@@ -0,0 +1,21 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
const index = require('./shared/consola.4bbae468.cjs');
const core = require('./core.cjs');
require('./shared/consola.deac7d5a.cjs');
require('node:process');
require('./utils.cjs');
require('node:tty');
require('node:util');
require('node:path');
exports.consola = index.consola;
exports.createConsola = index.createConsola;
exports.default = index.consola;
exports.Consola = core.Consola;
exports.LogLevels = core.LogLevels;
exports.LogTypes = core.LogTypes;

9
spa/node_modules/consola/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
import { ConsolaOptions, ConsolaInstance } from './core.js';
export { Consola, ConsolaReporter, FormatOptions, InputLogObject, LogLevel, LogLevels, LogObject, LogType, LogTypes } from './core.js';
declare function createConsola(options?: Partial<ConsolaOptions & {
fancy: boolean;
}>): ConsolaInstance;
declare const consola: ConsolaInstance;
export { ConsolaInstance, ConsolaOptions, consola, createConsola, consola as default };

8
spa/node_modules/consola/dist/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,8 @@
export { a as consola, c as createConsola, a as default } from './shared/consola.36c0034f.mjs';
export { Consola, LogLevels, LogTypes } from './core.mjs';
import './shared/consola.06ad8a64.mjs';
import 'node:process';
import './utils.mjs';
import 'node:tty';
import 'node:util';
import 'node:path';

View File

@@ -0,0 +1,62 @@
import { formatWithOptions } from 'node:util';
import { sep } from 'node:path';
function parseStack(stack) {
const cwd = process.cwd() + sep;
const lines = stack.split("\n").splice(1).map((l) => l.trim().replace("file://", "").replace(cwd, ""));
return lines;
}
function writeStream(data, stream) {
const write = stream.__write || stream.write;
return write.call(stream, data);
}
const bracket = (x) => x ? `[${x}]` : "";
class BasicReporter {
formatStack(stack, opts) {
return " " + parseStack(stack).join("\n ");
}
formatArgs(args, opts) {
const _args = args.map((arg) => {
if (arg && typeof arg.stack === "string") {
return arg.message + "\n" + this.formatStack(arg.stack, opts);
}
return arg;
});
return formatWithOptions(opts, ..._args);
}
formatDate(date, opts) {
return opts.date ? date.toLocaleTimeString() : "";
}
filterAndJoin(arr) {
return arr.filter(Boolean).join(" ");
}
formatLogObj(logObj, opts) {
const message = this.formatArgs(logObj.args, opts);
if (logObj.type === "box") {
return "\n" + [
bracket(logObj.tag),
logObj.title && logObj.title,
...message.split("\n")
].filter(Boolean).map((l) => " > " + l).join("\n") + "\n";
}
return this.filterAndJoin([
bracket(logObj.type),
bracket(logObj.tag),
message
]);
}
log(logObj, ctx) {
const line = this.formatLogObj(logObj, {
columns: ctx.options.stdout.columns || 0,
...ctx.options.formatOptions
});
return writeStream(
line + "\n",
logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout
);
}
}
export { BasicReporter as B, parseStack as p };

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,65 @@
'use strict';
const node_util = require('node:util');
const node_path = require('node:path');
function parseStack(stack) {
const cwd = process.cwd() + node_path.sep;
const lines = stack.split("\n").splice(1).map((l) => l.trim().replace("file://", "").replace(cwd, ""));
return lines;
}
function writeStream(data, stream) {
const write = stream.__write || stream.write;
return write.call(stream, data);
}
const bracket = (x) => x ? `[${x}]` : "";
class BasicReporter {
formatStack(stack, opts) {
return " " + parseStack(stack).join("\n ");
}
formatArgs(args, opts) {
const _args = args.map((arg) => {
if (arg && typeof arg.stack === "string") {
return arg.message + "\n" + this.formatStack(arg.stack, opts);
}
return arg;
});
return node_util.formatWithOptions(opts, ..._args);
}
formatDate(date, opts) {
return opts.date ? date.toLocaleTimeString() : "";
}
filterAndJoin(arr) {
return arr.filter(Boolean).join(" ");
}
formatLogObj(logObj, opts) {
const message = this.formatArgs(logObj.args, opts);
if (logObj.type === "box") {
return "\n" + [
bracket(logObj.tag),
logObj.title && logObj.title,
...message.split("\n")
].filter(Boolean).map((l) => " > " + l).join("\n") + "\n";
}
return this.filterAndJoin([
bracket(logObj.type),
bracket(logObj.tag),
message
]);
}
log(logObj, ctx) {
const line = this.formatLogObj(logObj, {
columns: ctx.options.stdout.columns || 0,
...ctx.options.formatOptions
});
return writeStream(
line + "\n",
logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout
);
}
}
exports.BasicReporter = BasicReporter;
exports.parseStack = parseStack;

308
spa/node_modules/consola/dist/utils.cjs generated vendored Normal file
View File

@@ -0,0 +1,308 @@
'use strict';
const tty = require('node:tty');
function _interopNamespaceCompat(e) {
if (e && typeof e === 'object' && 'default' in e) return e;
const n = Object.create(null);
if (e) {
for (const k in e) {
n[k] = e[k];
}
}
n.default = e;
return n;
}
const tty__namespace = /*#__PURE__*/_interopNamespaceCompat(tty);
const {
env = {},
argv = [],
platform = ""
} = typeof process === "undefined" ? {} : process;
const isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
const isForced = "FORCE_COLOR" in env || argv.includes("--color");
const isWindows = platform === "win32";
const isDumbTerminal = env.TERM === "dumb";
const isCompatibleTerminal = tty__namespace && tty__namespace.isatty && tty__namespace.isatty(1) && env.TERM && !isDumbTerminal;
const isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
function replaceClose(index, string, close, replace, head = string.slice(0, Math.max(0, index)) + replace, tail = string.slice(Math.max(0, index + close.length)), next = tail.indexOf(close)) {
return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
}
function clearBleed(index, string, open, close, replace) {
return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
}
function filterEmpty(open, close, replace = open, at = open.length + 1) {
return (string) => string || !(string === "" || string === void 0) ? clearBleed(
("" + string).indexOf(close, at),
string,
open,
close,
replace
) : "";
}
function init(open, close, replace) {
return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
}
const colorDefs = {
reset: init(0, 0),
bold: init(1, 22, "\x1B[22m\x1B[1m"),
dim: init(2, 22, "\x1B[22m\x1B[2m"),
italic: init(3, 23),
underline: init(4, 24),
inverse: init(7, 27),
hidden: init(8, 28),
strikethrough: init(9, 29),
black: init(30, 39),
red: init(31, 39),
green: init(32, 39),
yellow: init(33, 39),
blue: init(34, 39),
magenta: init(35, 39),
cyan: init(36, 39),
white: init(37, 39),
gray: init(90, 39),
bgBlack: init(40, 49),
bgRed: init(41, 49),
bgGreen: init(42, 49),
bgYellow: init(43, 49),
bgBlue: init(44, 49),
bgMagenta: init(45, 49),
bgCyan: init(46, 49),
bgWhite: init(47, 49),
blackBright: init(90, 39),
redBright: init(91, 39),
greenBright: init(92, 39),
yellowBright: init(93, 39),
blueBright: init(94, 39),
magentaBright: init(95, 39),
cyanBright: init(96, 39),
whiteBright: init(97, 39),
bgBlackBright: init(100, 49),
bgRedBright: init(101, 49),
bgGreenBright: init(102, 49),
bgYellowBright: init(103, 49),
bgBlueBright: init(104, 49),
bgMagentaBright: init(105, 49),
bgCyanBright: init(106, 49),
bgWhiteBright: init(107, 49)
};
function createColors(useColor = isColorSupported) {
return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
}
const colors = createColors();
function getColor(color, fallback = "reset") {
return colors[color] || colors[fallback];
}
function colorize(color, text) {
return getColor(color)(text);
}
const ansiRegex = [
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"
].join("|");
function stripAnsi(text) {
return text.replace(new RegExp(ansiRegex, "g"), "");
}
function centerAlign(str, len, space = " ") {
const free = len - str.length;
if (free <= 0) {
return str;
}
const freeLeft = Math.floor(free / 2);
let _str = "";
for (let i = 0; i < len; i++) {
_str += i < freeLeft || i >= freeLeft + str.length ? space : str[i - freeLeft];
}
return _str;
}
function rightAlign(str, len, space = " ") {
const free = len - str.length;
if (free <= 0) {
return str;
}
let _str = "";
for (let i = 0; i < len; i++) {
_str += i < free ? space : str[i - free];
}
return _str;
}
function leftAlign(str, len, space = " ") {
let _str = "";
for (let i = 0; i < len; i++) {
_str += i < str.length ? str[i] : space;
}
return _str;
}
function align(alignment, str, len, space = " ") {
switch (alignment) {
case "left": {
return leftAlign(str, len, space);
}
case "right": {
return rightAlign(str, len, space);
}
case "center": {
return centerAlign(str, len, space);
}
default: {
return str;
}
}
}
const boxStylePresets = {
solid: {
tl: "\u250C",
tr: "\u2510",
bl: "\u2514",
br: "\u2518",
h: "\u2500",
v: "\u2502"
},
double: {
tl: "\u2554",
tr: "\u2557",
bl: "\u255A",
br: "\u255D",
h: "\u2550",
v: "\u2551"
},
doubleSingle: {
tl: "\u2553",
tr: "\u2556",
bl: "\u2559",
br: "\u255C",
h: "\u2500",
v: "\u2551"
},
doubleSingleRounded: {
tl: "\u256D",
tr: "\u256E",
bl: "\u2570",
br: "\u256F",
h: "\u2500",
v: "\u2551"
},
singleThick: {
tl: "\u250F",
tr: "\u2513",
bl: "\u2517",
br: "\u251B",
h: "\u2501",
v: "\u2503"
},
singleDouble: {
tl: "\u2552",
tr: "\u2555",
bl: "\u2558",
br: "\u255B",
h: "\u2550",
v: "\u2502"
},
singleDoubleRounded: {
tl: "\u256D",
tr: "\u256E",
bl: "\u2570",
br: "\u256F",
h: "\u2550",
v: "\u2502"
},
rounded: {
tl: "\u256D",
tr: "\u256E",
bl: "\u2570",
br: "\u256F",
h: "\u2500",
v: "\u2502"
}
};
const defaultStyle = {
borderColor: "white",
borderStyle: "rounded",
valign: "center",
padding: 2,
marginLeft: 1,
marginTop: 1,
marginBottom: 1
};
function box(text, _opts = {}) {
const opts = {
..._opts,
style: {
...defaultStyle,
..._opts.style
}
};
const textLines = text.split("\n");
const boxLines = [];
const _color = getColor(opts.style.borderColor);
const borderStyle = {
...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle
};
if (_color) {
for (const key in borderStyle) {
borderStyle[key] = _color(
borderStyle[key]
);
}
}
const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
const height = textLines.length + paddingOffset;
const width = Math.max(...textLines.map((line) => line.length)) + paddingOffset;
const widthOffset = width + paddingOffset;
const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
if (opts.style.marginTop > 0) {
boxLines.push("".repeat(opts.style.marginTop));
}
if (opts.title) {
const left = borderStyle.h.repeat(
Math.floor((width - stripAnsi(opts.title).length) / 2)
);
const right = borderStyle.h.repeat(
width - stripAnsi(opts.title).length - stripAnsi(left).length + paddingOffset
);
boxLines.push(
`${leftSpace}${borderStyle.tl}${left}${opts.title}${right}${borderStyle.tr}`
);
} else {
boxLines.push(
`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`
);
}
const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
for (let i = 0; i < height; i++) {
if (i < valignOffset || i >= valignOffset + textLines.length) {
boxLines.push(
`${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`
);
} else {
const line = textLines[i - valignOffset];
const left = " ".repeat(paddingOffset);
const right = " ".repeat(width - stripAnsi(line).length);
boxLines.push(
`${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`
);
}
}
boxLines.push(
`${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`
);
if (opts.style.marginBottom > 0) {
boxLines.push("".repeat(opts.style.marginBottom));
}
return boxLines.join("\n");
}
exports.align = align;
exports.box = box;
exports.centerAlign = centerAlign;
exports.colorize = colorize;
exports.colors = colors;
exports.getColor = getColor;
exports.leftAlign = leftAlign;
exports.rightAlign = rightAlign;
exports.stripAnsi = stripAnsi;

169
spa/node_modules/consola/dist/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,169 @@
type BoxBorderStyle = {
/**
* Top left corner
* @example `┌`
* @example `╔`
* @example `╓`
*/
tl: string;
/**
* Top right corner
* @example `┐`
* @example `╗`
* @example `╖`
*/
tr: string;
/**
* Bottom left corner
* @example `└`
* @example `╚`
* @example `╙`
*/
bl: string;
/**
* Bottom right corner
* @example `┘`
* @example `╝`
* @example `╜`
*/
br: string;
/**
* Horizontal line
* @example `─`
* @example `═`
* @example `─`
*/
h: string;
/**
* Vertical line
* @example `│`
* @example `║`
* @example `║`
*/
v: string;
};
declare const boxStylePresets: Record<string, BoxBorderStyle>;
type BoxStyle = {
/**
* The border color
* @default 'white'
*/
borderColor: "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright";
/**
* The border style
* @default 'solid'
* @example 'single-double-rounded'
* @example
* ```ts
* {
* tl: '┌',
* tr: '┐',
* bl: '└',
* br: '┘',
* h: '─',
* v: '│',
* }
* ```
*/
borderStyle: BoxBorderStyle | keyof typeof boxStylePresets;
/**
* The vertical alignment of the text
* @default 'center'
*/
valign: "top" | "center" | "bottom";
/**
* The padding of the box
* @default 2
*/
padding: number;
/**
* The left margin of the box
* @default 1
*/
marginLeft: number;
/**
* The top margin of the box
* @default 1
*/
marginTop: number;
/**
* The top margin of the box
* @default 1
*/
marginBottom: number;
};
/**
* The border options of the box
*/
type BoxOpts = {
/**
* Title that will be displayed on top of the box
* @example 'Hello World'
* @example 'Hello {name}'
*/
title?: string;
style?: Partial<BoxStyle>;
};
declare function box(text: string, _opts?: BoxOpts): string;
/**
* Based on https://github.com/jorgebucaran/colorette
* Read LICENSE file for more information
* https://github.com/jorgebucaran/colorette/blob/20fc196d07d0f87c61e0256eadd7831c79b24108/index.js
*/
declare const colorDefs: {
reset: (string: string) => string;
bold: (string: string) => string;
dim: (string: string) => string;
italic: (string: string) => string;
underline: (string: string) => string;
inverse: (string: string) => string;
hidden: (string: string) => string;
strikethrough: (string: string) => string;
black: (string: string) => string;
red: (string: string) => string;
green: (string: string) => string;
yellow: (string: string) => string;
blue: (string: string) => string;
magenta: (string: string) => string;
cyan: (string: string) => string;
white: (string: string) => string;
gray: (string: string) => string;
bgBlack: (string: string) => string;
bgRed: (string: string) => string;
bgGreen: (string: string) => string;
bgYellow: (string: string) => string;
bgBlue: (string: string) => string;
bgMagenta: (string: string) => string;
bgCyan: (string: string) => string;
bgWhite: (string: string) => string;
blackBright: (string: string) => string;
redBright: (string: string) => string;
greenBright: (string: string) => string;
yellowBright: (string: string) => string;
blueBright: (string: string) => string;
magentaBright: (string: string) => string;
cyanBright: (string: string) => string;
whiteBright: (string: string) => string;
bgBlackBright: (string: string) => string;
bgRedBright: (string: string) => string;
bgGreenBright: (string: string) => string;
bgYellowBright: (string: string) => string;
bgBlueBright: (string: string) => string;
bgMagentaBright: (string: string) => string;
bgCyanBright: (string: string) => string;
bgWhiteBright: (string: string) => string;
};
type ColorName = keyof typeof colorDefs;
type ColorFunction = (text: string | number) => string;
declare const colors: Record<"reset" | "bold" | "dim" | "italic" | "underline" | "inverse" | "hidden" | "strikethrough" | "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "bgBlack" | "bgRed" | "bgGreen" | "bgYellow" | "bgBlue" | "bgMagenta" | "bgCyan" | "bgWhite" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright" | "bgBlackBright" | "bgRedBright" | "bgGreenBright" | "bgYellowBright" | "bgBlueBright" | "bgMagentaBright" | "bgCyanBright" | "bgWhiteBright", ColorFunction>;
declare function getColor(color: ColorName, fallback?: ColorName): ColorFunction;
declare function colorize(color: ColorName, text: string | number): string;
declare function stripAnsi(text: string): string;
declare function centerAlign(str: string, len: number, space?: string): string;
declare function rightAlign(str: string, len: number, space?: string): string;
declare function leftAlign(str: string, len: number, space?: string): string;
declare function align(alignment: "left" | "right" | "center", str: string, len: number, space?: string): string;
export { BoxBorderStyle, BoxOpts, BoxStyle, ColorFunction, ColorName, align, box, centerAlign, colorize, colors, getColor, leftAlign, rightAlign, stripAnsi };

284
spa/node_modules/consola/dist/utils.mjs generated vendored Normal file
View File

@@ -0,0 +1,284 @@
import * as tty from 'node:tty';
const {
env = {},
argv = [],
platform = ""
} = typeof process === "undefined" ? {} : process;
const isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
const isForced = "FORCE_COLOR" in env || argv.includes("--color");
const isWindows = platform === "win32";
const isDumbTerminal = env.TERM === "dumb";
const isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
const isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
function replaceClose(index, string, close, replace, head = string.slice(0, Math.max(0, index)) + replace, tail = string.slice(Math.max(0, index + close.length)), next = tail.indexOf(close)) {
return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
}
function clearBleed(index, string, open, close, replace) {
return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
}
function filterEmpty(open, close, replace = open, at = open.length + 1) {
return (string) => string || !(string === "" || string === void 0) ? clearBleed(
("" + string).indexOf(close, at),
string,
open,
close,
replace
) : "";
}
function init(open, close, replace) {
return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
}
const colorDefs = {
reset: init(0, 0),
bold: init(1, 22, "\x1B[22m\x1B[1m"),
dim: init(2, 22, "\x1B[22m\x1B[2m"),
italic: init(3, 23),
underline: init(4, 24),
inverse: init(7, 27),
hidden: init(8, 28),
strikethrough: init(9, 29),
black: init(30, 39),
red: init(31, 39),
green: init(32, 39),
yellow: init(33, 39),
blue: init(34, 39),
magenta: init(35, 39),
cyan: init(36, 39),
white: init(37, 39),
gray: init(90, 39),
bgBlack: init(40, 49),
bgRed: init(41, 49),
bgGreen: init(42, 49),
bgYellow: init(43, 49),
bgBlue: init(44, 49),
bgMagenta: init(45, 49),
bgCyan: init(46, 49),
bgWhite: init(47, 49),
blackBright: init(90, 39),
redBright: init(91, 39),
greenBright: init(92, 39),
yellowBright: init(93, 39),
blueBright: init(94, 39),
magentaBright: init(95, 39),
cyanBright: init(96, 39),
whiteBright: init(97, 39),
bgBlackBright: init(100, 49),
bgRedBright: init(101, 49),
bgGreenBright: init(102, 49),
bgYellowBright: init(103, 49),
bgBlueBright: init(104, 49),
bgMagentaBright: init(105, 49),
bgCyanBright: init(106, 49),
bgWhiteBright: init(107, 49)
};
function createColors(useColor = isColorSupported) {
return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
}
const colors = createColors();
function getColor(color, fallback = "reset") {
return colors[color] || colors[fallback];
}
function colorize(color, text) {
return getColor(color)(text);
}
const ansiRegex = [
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"
].join("|");
function stripAnsi(text) {
return text.replace(new RegExp(ansiRegex, "g"), "");
}
function centerAlign(str, len, space = " ") {
const free = len - str.length;
if (free <= 0) {
return str;
}
const freeLeft = Math.floor(free / 2);
let _str = "";
for (let i = 0; i < len; i++) {
_str += i < freeLeft || i >= freeLeft + str.length ? space : str[i - freeLeft];
}
return _str;
}
function rightAlign(str, len, space = " ") {
const free = len - str.length;
if (free <= 0) {
return str;
}
let _str = "";
for (let i = 0; i < len; i++) {
_str += i < free ? space : str[i - free];
}
return _str;
}
function leftAlign(str, len, space = " ") {
let _str = "";
for (let i = 0; i < len; i++) {
_str += i < str.length ? str[i] : space;
}
return _str;
}
function align(alignment, str, len, space = " ") {
switch (alignment) {
case "left": {
return leftAlign(str, len, space);
}
case "right": {
return rightAlign(str, len, space);
}
case "center": {
return centerAlign(str, len, space);
}
default: {
return str;
}
}
}
const boxStylePresets = {
solid: {
tl: "\u250C",
tr: "\u2510",
bl: "\u2514",
br: "\u2518",
h: "\u2500",
v: "\u2502"
},
double: {
tl: "\u2554",
tr: "\u2557",
bl: "\u255A",
br: "\u255D",
h: "\u2550",
v: "\u2551"
},
doubleSingle: {
tl: "\u2553",
tr: "\u2556",
bl: "\u2559",
br: "\u255C",
h: "\u2500",
v: "\u2551"
},
doubleSingleRounded: {
tl: "\u256D",
tr: "\u256E",
bl: "\u2570",
br: "\u256F",
h: "\u2500",
v: "\u2551"
},
singleThick: {
tl: "\u250F",
tr: "\u2513",
bl: "\u2517",
br: "\u251B",
h: "\u2501",
v: "\u2503"
},
singleDouble: {
tl: "\u2552",
tr: "\u2555",
bl: "\u2558",
br: "\u255B",
h: "\u2550",
v: "\u2502"
},
singleDoubleRounded: {
tl: "\u256D",
tr: "\u256E",
bl: "\u2570",
br: "\u256F",
h: "\u2550",
v: "\u2502"
},
rounded: {
tl: "\u256D",
tr: "\u256E",
bl: "\u2570",
br: "\u256F",
h: "\u2500",
v: "\u2502"
}
};
const defaultStyle = {
borderColor: "white",
borderStyle: "rounded",
valign: "center",
padding: 2,
marginLeft: 1,
marginTop: 1,
marginBottom: 1
};
function box(text, _opts = {}) {
const opts = {
..._opts,
style: {
...defaultStyle,
..._opts.style
}
};
const textLines = text.split("\n");
const boxLines = [];
const _color = getColor(opts.style.borderColor);
const borderStyle = {
...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle
};
if (_color) {
for (const key in borderStyle) {
borderStyle[key] = _color(
borderStyle[key]
);
}
}
const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
const height = textLines.length + paddingOffset;
const width = Math.max(...textLines.map((line) => line.length)) + paddingOffset;
const widthOffset = width + paddingOffset;
const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
if (opts.style.marginTop > 0) {
boxLines.push("".repeat(opts.style.marginTop));
}
if (opts.title) {
const left = borderStyle.h.repeat(
Math.floor((width - stripAnsi(opts.title).length) / 2)
);
const right = borderStyle.h.repeat(
width - stripAnsi(opts.title).length - stripAnsi(left).length + paddingOffset
);
boxLines.push(
`${leftSpace}${borderStyle.tl}${left}${opts.title}${right}${borderStyle.tr}`
);
} else {
boxLines.push(
`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`
);
}
const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
for (let i = 0; i < height; i++) {
if (i < valignOffset || i >= valignOffset + textLines.length) {
boxLines.push(
`${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`
);
} else {
const line = textLines[i - valignOffset];
const left = " ".repeat(paddingOffset);
const right = " ".repeat(width - stripAnsi(line).length);
boxLines.push(
`${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`
);
}
}
boxLines.push(
`${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`
);
if (opts.style.marginBottom > 0) {
boxLines.push("".repeat(opts.style.marginBottom));
}
return boxLines.join("\n");
}
export { align, box, centerAlign, colorize, colors, getColor, leftAlign, rightAlign, stripAnsi };