@idlebox/logger 0.0.21 → 0.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/common/ansi.d.ts +17 -13
- package/lib/common/ansi.d.ts.map +1 -1
- package/lib/common/ansi.js +5 -1
- package/lib/common/ansi.js.map +1 -1
- package/lib/common/create.compability.d.ts +5 -0
- package/lib/common/create.compability.d.ts.map +1 -0
- package/lib/common/create.compability.js +4 -0
- package/lib/common/create.compability.js.map +1 -0
- package/lib/common/create.function.d.ts +9 -5
- package/lib/common/create.function.d.ts.map +1 -1
- package/lib/common/create.function.js +52 -21
- package/lib/common/create.function.js.map +1 -1
- package/lib/common/create.logger.d.ts +3 -3
- package/lib/common/create.logger.d.ts.map +1 -1
- package/lib/common/create.logger.js +21 -20
- package/lib/common/create.logger.js.map +1 -1
- package/lib/common/helpers.d.ts +2 -6
- package/lib/common/helpers.d.ts.map +1 -1
- package/lib/common/helpers.js +4 -37
- package/lib/common/helpers.js.map +1 -1
- package/lib/common/logger.create.d.ts +8 -4
- package/lib/common/logger.create.d.ts.map +1 -1
- package/lib/common/logger.create.js +7 -14
- package/lib/common/logger.create.js.map +1 -1
- package/lib/common/logger.global.d.ts +4 -3
- package/lib/common/logger.global.d.ts.map +1 -1
- package/lib/common/logger.global.js +11 -17
- package/lib/common/logger.global.js.map +1 -1
- package/lib/common/registry.d.ts +8 -0
- package/lib/common/registry.d.ts.map +1 -0
- package/lib/common/registry.js +36 -0
- package/lib/common/registry.js.map +1 -0
- package/lib/common/types.d.ts +78 -22
- package/lib/common/types.d.ts.map +1 -1
- package/lib/common/types.js +2 -11
- package/lib/common/types.js.map +1 -1
- package/lib/{common/debug.commands.d.ts → functions/builtin-commands.d.ts} +2 -2
- package/lib/functions/builtin-commands.d.ts.map +1 -0
- package/lib/{common/debug.commands.js → functions/builtin-commands.js} +3 -10
- package/lib/functions/builtin-commands.js.map +1 -0
- package/lib/loglevels/control.browser.d.ts +2 -0
- package/lib/loglevels/control.browser.d.ts.map +1 -0
- package/lib/loglevels/control.browser.js +2 -0
- package/lib/loglevels/control.browser.js.map +1 -0
- package/lib/loglevels/control.nodejs.d.ts +2 -0
- package/lib/loglevels/control.nodejs.d.ts.map +1 -0
- package/lib/loglevels/control.nodejs.js +2 -0
- package/lib/loglevels/control.nodejs.js.map +1 -0
- package/lib/loglevels/loglevel.d.ts +12 -0
- package/lib/loglevels/loglevel.d.ts.map +1 -0
- package/lib/loglevels/loglevel.js +13 -0
- package/lib/loglevels/loglevel.js.map +1 -0
- package/lib/outputs/browser.d.ts +2 -0
- package/lib/outputs/browser.d.ts.map +1 -0
- package/lib/outputs/browser.js +23 -0
- package/lib/outputs/browser.js.map +1 -0
- package/lib/outputs/node-controllers/github-actions.d.ts +3 -0
- package/lib/outputs/node-controllers/github-actions.d.ts.map +1 -0
- package/lib/outputs/node-controllers/github-actions.js +15 -0
- package/lib/outputs/node-controllers/github-actions.js.map +1 -0
- package/lib/outputs/node-controllers/index.d.ts +3 -0
- package/lib/outputs/node-controllers/index.d.ts.map +1 -0
- package/lib/outputs/node-controllers/index.js +9 -0
- package/lib/outputs/node-controllers/index.js.map +1 -0
- package/lib/outputs/nodejs.d.ts +26 -0
- package/lib/outputs/nodejs.d.ts.map +1 -0
- package/lib/outputs/nodejs.js +82 -0
- package/lib/outputs/nodejs.js.map +1 -0
- package/lib/printers/file.d.ts +2 -1
- package/lib/printers/file.d.ts.map +1 -1
- package/lib/printers/file.js +2 -1
- package/lib/printers/file.js.map +1 -1
- package/package.json +16 -7
- package/src/common/ansi.ts +6 -1
- package/src/common/create.compability.ts +7 -0
- package/src/common/create.function.ts +60 -27
- package/src/common/create.logger.ts +22 -20
- package/src/common/helpers.ts +5 -46
- package/src/common/logger.create.ts +13 -15
- package/src/common/logger.global.ts +13 -18
- package/src/common/registry.ts +42 -0
- package/src/common/types.ts +100 -23
- package/src/{common/debug.commands.ts → functions/builtin-commands.ts} +3 -13
- package/src/loglevels/control.browser.ts +0 -0
- package/src/loglevels/control.nodejs.ts +0 -0
- package/src/loglevels/loglevel.ts +12 -0
- package/src/outputs/browser.ts +27 -0
- package/src/outputs/node-controllers/github-actions.ts +18 -0
- package/src/outputs/node-controllers/index.ts +10 -0
- package/src/outputs/nodejs.ts +102 -0
- package/src/printers/file.ts +3 -2
- package/lib/common/debug.commands.d.ts.map +0 -1
- package/lib/common/debug.commands.js.map +0 -1
- package/lib/index.d.ts +0 -10
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -10
- package/lib/index.js.map +0 -1
- package/src/index.ts +0 -27
|
@@ -1,33 +1,27 @@
|
|
|
1
1
|
import { globalObject } from '@idlebox/common';
|
|
2
|
-
import process from 'node:process';
|
|
3
|
-
import { PassThrough } from 'node:stream';
|
|
4
2
|
import { create } from './create.logger.js';
|
|
5
|
-
import { EnableLogLevel } from './types.js';
|
|
6
|
-
const stream = new PassThrough();
|
|
7
|
-
stream.pipe(process.stderr);
|
|
8
|
-
Object.assign(stream, { isTTY: process.stderr.isTTY });
|
|
9
3
|
const symbol = Symbol.for('@idlebox/logger/global/terminal');
|
|
10
4
|
/**
|
|
11
5
|
* 作为logger导出,必须在程序入口调用过 createGlobalLogger() 才能使用
|
|
12
6
|
*/
|
|
13
|
-
export let
|
|
7
|
+
export let globalLogger;
|
|
14
8
|
/**
|
|
15
9
|
* 创建root-logger,随后logger变量可用
|
|
16
10
|
*/
|
|
17
|
-
export function createGlobalLogger(tag, defaultLevel
|
|
18
|
-
|
|
19
|
-
if (
|
|
20
|
-
|
|
11
|
+
export function createGlobalLogger(console, tag, defaultLevel) {
|
|
12
|
+
globalLogger = globalObject[symbol];
|
|
13
|
+
if (globalLogger) {
|
|
14
|
+
globalLogger.error `global logger already created`;
|
|
21
15
|
return;
|
|
22
16
|
}
|
|
23
|
-
|
|
24
|
-
globalObject[symbol] =
|
|
25
|
-
|
|
26
|
-
if (
|
|
27
|
-
|
|
17
|
+
globalLogger = create(console, tag);
|
|
18
|
+
globalObject[symbol] = globalLogger;
|
|
19
|
+
globalLogger.enable(defaultLevel);
|
|
20
|
+
if (globalLogger.verbose.isEnabled) {
|
|
21
|
+
globalLogger.verbose `verbose is enabled`;
|
|
28
22
|
}
|
|
29
23
|
else {
|
|
30
|
-
|
|
24
|
+
globalLogger.debug `debug is enabled`;
|
|
31
25
|
}
|
|
32
26
|
return;
|
|
33
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.global.js","sourceRoot":"","sources":["../../src/common/logger.global.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"logger.global.js","sourceRoot":"","sources":["../../src/common/logger.global.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAG5C,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;AAE7D;;GAEG;AACH,MAAM,CAAC,IAAI,YAAuB,CAAC;AAEnC;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAA2B,EAAE,GAAW,EAAE,YAA4B;IACxG,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,YAAY,EAAE,CAAC;QAClB,YAAY,CAAC,KAAK,CAAA,+BAA+B,CAAC;QAClD,OAAO;IACR,CAAC;IAED,YAAY,GAAG,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IACpC,YAAY,CAAC,MAAM,CAAC,GAAG,YAAY,CAAC;IAEpC,YAAY,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAElC,IAAI,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;QACpC,YAAY,CAAC,OAAO,CAAA,oBAAoB,CAAC;IAC1C,CAAC;SAAM,CAAC;QACP,YAAY,CAAC,KAAK,CAAA,kBAAkB,CAAC;IACtC,CAAC;IACD,OAAO;AACR,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IMyLogger } from './types.js';
|
|
2
|
+
export declare let loggersRegistry: Map<string, IMyLogger> | undefined;
|
|
3
|
+
export declare function loggersRegistrySet(logger: IMyLogger): void;
|
|
4
|
+
export declare function getAllLoggers(): readonly IMyLogger[];
|
|
5
|
+
export declare function enableLoggerRegistry(): void;
|
|
6
|
+
export declare function deleteLoggerInstance(tag: string): void;
|
|
7
|
+
export declare function getAllLoggerNames(): readonly string[];
|
|
8
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/common/registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,eAAO,IAAI,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,SAAS,CAAC;AAG/D,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,QAMnD;AAED,wBAAgB,aAAa,IAAI,SAAS,SAAS,EAAE,CAEpD;AAED,wBAAgB,oBAAoB,SAQnC;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,QAE/C;AAED,wBAAgB,iBAAiB,IAAI,SAAS,MAAM,EAAE,CAErD"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { isProductionMode, SoftwareDefectError } from '@idlebox/common';
|
|
2
|
+
export let loggersRegistry;
|
|
3
|
+
let somethingCreated = false;
|
|
4
|
+
export function loggersRegistrySet(logger) {
|
|
5
|
+
if (!loggersRegistry) {
|
|
6
|
+
if (!isProductionMode)
|
|
7
|
+
somethingCreated = true;
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
loggersRegistry.set(logger.tag, logger);
|
|
11
|
+
}
|
|
12
|
+
export function getAllLoggers() {
|
|
13
|
+
return Array.from(requiresEnabled().values());
|
|
14
|
+
}
|
|
15
|
+
export function enableLoggerRegistry() {
|
|
16
|
+
if (loggersRegistry !== undefined)
|
|
17
|
+
return;
|
|
18
|
+
loggersRegistry = new Map();
|
|
19
|
+
if (!isProductionMode) {
|
|
20
|
+
if (somethingCreated)
|
|
21
|
+
console.warn('检测到在启用日志注册表之前已经创建了logger实例,之前创建的实例无法通过注册表访问');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export function deleteLoggerInstance(tag) {
|
|
25
|
+
requiresEnabled().delete(tag);
|
|
26
|
+
}
|
|
27
|
+
export function getAllLoggerNames() {
|
|
28
|
+
return Array.from(requiresEnabled().keys());
|
|
29
|
+
}
|
|
30
|
+
function requiresEnabled() {
|
|
31
|
+
if (!loggersRegistry) {
|
|
32
|
+
throw new SoftwareDefectError('logger registry is not enabled');
|
|
33
|
+
}
|
|
34
|
+
return loggersRegistry;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/common/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGxE,MAAM,CAAC,IAAI,eAAmD,CAAC;AAC/D,IAAI,gBAAgB,GAAG,KAAK,CAAC;AAE7B,MAAM,UAAU,kBAAkB,CAAC,MAAiB;IACnD,IAAI,CAAC,eAAe,EAAE,CAAC;QACtB,IAAI,CAAC,gBAAgB;YAAE,gBAAgB,GAAG,IAAI,CAAC;QAC/C,OAAO;IACR,CAAC;IACD,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,aAAa;IAC5B,OAAO,KAAK,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,oBAAoB;IACnC,IAAI,eAAe,KAAK,SAAS;QAAE,OAAO;IAE1C,eAAe,GAAG,IAAI,GAAG,EAAE,CAAC;IAE5B,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACvB,IAAI,gBAAgB;YAAE,OAAO,CAAC,IAAI,CAAC,6CAA6C,CAAC,CAAC;IACnF,CAAC;AACF,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC/C,eAAe,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,iBAAiB;IAChC,OAAO,KAAK,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;AAC7C,CAAC;AAED,SAAS,eAAe;IACvB,IAAI,CAAC,eAAe,EAAE,CAAC;QACtB,MAAM,IAAI,mBAAmB,CAAC,gCAAgC,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,eAAe,CAAC;AACxB,CAAC"}
|
package/lib/common/types.d.ts
CHANGED
|
@@ -1,33 +1,89 @@
|
|
|
1
|
+
import type { EnableLogLevel } from '../loglevels/loglevel.js';
|
|
2
|
+
/** @ts-ignore */
|
|
3
|
+
export type NodeJSReadableStream = NodeJS.ReadableStream;
|
|
4
|
+
/** @ts-ignore */
|
|
5
|
+
export type InspectOptions = import('node:util').InspectOptions;
|
|
1
6
|
export type IMyDebug<T = void> = (message: TemplateStringsArray | string, ...args: readonly any[]) => T;
|
|
2
7
|
export interface IMyDebugWithControl extends IMyDebug {
|
|
3
8
|
enable(): void;
|
|
4
9
|
disable(): void;
|
|
5
10
|
readonly isEnabled: boolean;
|
|
11
|
+
readonly writeLine: ILineWriter;
|
|
6
12
|
}
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
warn
|
|
12
|
-
info
|
|
13
|
-
log
|
|
14
|
-
debug
|
|
15
|
-
verbose
|
|
13
|
+
export interface IMyLoggerMethods {
|
|
14
|
+
readonly fatal: IMyDebug<never>;
|
|
15
|
+
readonly error: IMyDebug;
|
|
16
|
+
readonly success: IMyDebug;
|
|
17
|
+
readonly warn: IMyDebug;
|
|
18
|
+
readonly info: IMyDebug;
|
|
19
|
+
readonly log: IMyDebug;
|
|
20
|
+
readonly debug: IMyDebug;
|
|
21
|
+
readonly verbose: IMyDebug;
|
|
16
22
|
}
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
error: IMyDebug;
|
|
20
|
-
success: IMyDebugWithControl;
|
|
21
|
-
warn: IMyDebugWithControl;
|
|
22
|
-
info: IMyDebugWithControl;
|
|
23
|
-
log: IMyDebugWithControl;
|
|
24
|
-
debug: IMyDebugWithControl;
|
|
25
|
-
verbose: IMyDebugWithControl;
|
|
26
|
-
extend: (tag: string) => IMyLogger;
|
|
27
|
-
stream: NodeJS.ReadableStream;
|
|
28
|
-
enable(newMaxLevel: EnableLogLevel): void;
|
|
23
|
+
export interface IMyLogger extends IMyLoggerMethods {
|
|
24
|
+
readonly console: IInstrestedConsole;
|
|
29
25
|
readonly tag: string;
|
|
30
26
|
readonly colorEnabled: boolean;
|
|
31
|
-
|
|
27
|
+
readonly fatal: IMyDebug<never>;
|
|
28
|
+
readonly error: IMyDebug;
|
|
29
|
+
readonly success: IMyDebugWithControl;
|
|
30
|
+
readonly warn: IMyDebugWithControl;
|
|
31
|
+
readonly info: IMyDebugWithControl;
|
|
32
|
+
readonly log: IMyDebugWithControl;
|
|
33
|
+
readonly debug: IMyDebugWithControl;
|
|
34
|
+
readonly verbose: IMyDebugWithControl;
|
|
35
|
+
extend(tag: string): IMyLogger;
|
|
36
|
+
enable(newMaxLevel: EnableLogLevel): void;
|
|
37
|
+
}
|
|
32
38
|
export type IDebugCommand = (object: unknown, color: boolean) => string;
|
|
39
|
+
export type ILineWriter = (message: string) => any;
|
|
40
|
+
interface UnsupportedMethods {
|
|
41
|
+
/** @deprecated 模拟console对象不支持此方法 */
|
|
42
|
+
dir(item?: any, options?: InspectOptions): void;
|
|
43
|
+
/** @deprecated 模拟console对象不支持此方法 */
|
|
44
|
+
/** @deprecated 模拟console对象不支持此方法 */
|
|
45
|
+
table(tabularData?: any, properties?: string[]): void;
|
|
46
|
+
/** @deprecated 模拟console对象不支持此方法 */
|
|
47
|
+
profile(label?: string): void;
|
|
48
|
+
/** @deprecated 模拟console对象不支持此方法 */
|
|
49
|
+
profileEnd(label?: string): void;
|
|
50
|
+
/** @deprecated 模拟console对象不支持此方法 */
|
|
51
|
+
timeStamp(label?: string): void;
|
|
52
|
+
}
|
|
53
|
+
export interface IInstrestedConsole {
|
|
54
|
+
readonly colorEnabled: boolean;
|
|
55
|
+
clear(): void;
|
|
56
|
+
group(message: string): void;
|
|
57
|
+
groupCollapsed(message: string): void;
|
|
58
|
+
groupEnd(): void;
|
|
59
|
+
error(message: string): void;
|
|
60
|
+
warn(message: string): void;
|
|
61
|
+
info(message: string): void;
|
|
62
|
+
log(message: string): void;
|
|
63
|
+
debug(message: string): void;
|
|
64
|
+
trace(message: string): void;
|
|
65
|
+
}
|
|
66
|
+
export interface IAbstractConsole {
|
|
67
|
+
readonly colorEnabled: boolean;
|
|
68
|
+
assert(condition?: unknown, ...data: any[]): void;
|
|
69
|
+
clear(): void;
|
|
70
|
+
count(label?: string): void;
|
|
71
|
+
countReset(label?: string): void;
|
|
72
|
+
dirxml(...data: any[]): void;
|
|
73
|
+
error(...data: any[]): void;
|
|
74
|
+
group(...data: any[]): void;
|
|
75
|
+
groupCollapsed(...data: any[]): void;
|
|
76
|
+
groupEnd(): void;
|
|
77
|
+
info(...data: any[]): void;
|
|
78
|
+
log(...data: any[]): void;
|
|
79
|
+
time(label?: string): void;
|
|
80
|
+
timeEnd(label?: string): void;
|
|
81
|
+
timeLog(label?: string, ...data: any[]): void;
|
|
82
|
+
trace(...data: any[]): void;
|
|
83
|
+
warn(...data: any[]): void;
|
|
84
|
+
debug(...data: any[]): void;
|
|
85
|
+
}
|
|
86
|
+
export interface IConsole extends UnsupportedMethods, IAbstractConsole {
|
|
87
|
+
}
|
|
88
|
+
export {};
|
|
33
89
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/common/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/common/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,iBAAiB;AACjB,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,cAAc,CAAC;AAEzD,iBAAiB;AACjB,MAAM,MAAM,cAAc,GAAG,OAAO,WAAW,EAAE,cAAc,CAAC;AAEhE,MAAM,MAAM,QAAQ,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,EAAE,GAAG,IAAI,EAAE,SAAS,GAAG,EAAE,KAAK,CAAC,CAAC;AAExG,MAAM,WAAW,mBAAoB,SAAQ,QAAQ;IACpD,MAAM,IAAI,IAAI,CAAC;IACf,OAAO,IAAI,IAAI,CAAC;IAChB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;CAChC;AAED,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAE3B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;CAC3B;AAED,MAAM,WAA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AI,CAAC;IACrC,QAAQ,IAAI,IAAI,CAAC;IACjB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC3B,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC1B,IAAI,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC9C,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC5B,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,QAAS,SAAQ,kBAAkB,EAAE,gBAAgB;CAAG"}
|
package/lib/common/types.js
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
EnableLogLevel[EnableLogLevel["auto"] = 0] = "auto";
|
|
4
|
-
EnableLogLevel[EnableLogLevel["fatal"] = 1] = "fatal";
|
|
5
|
-
EnableLogLevel[EnableLogLevel["error"] = 2] = "error";
|
|
6
|
-
EnableLogLevel[EnableLogLevel["warn"] = 3] = "warn";
|
|
7
|
-
EnableLogLevel[EnableLogLevel["info"] = 4] = "info";
|
|
8
|
-
EnableLogLevel[EnableLogLevel["log"] = 5] = "log";
|
|
9
|
-
EnableLogLevel[EnableLogLevel["debug"] = 6] = "debug";
|
|
10
|
-
EnableLogLevel[EnableLogLevel["verbose"] = 7] = "verbose";
|
|
11
|
-
})(EnableLogLevel || (EnableLogLevel = {}));
|
|
1
|
+
// biome-ignore-all lint/suspicious/noTsIgnore: 兼容浏览器环境
|
|
2
|
+
export {};
|
|
12
3
|
//# sourceMappingURL=types.js.map
|
package/lib/common/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/common/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/common/types.ts"],"names":[],"mappings":"AAAA,uDAAuD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { IDebugCommand } from '
|
|
1
|
+
import type { IDebugCommand } from '../common/types.js';
|
|
2
2
|
export declare function nodeFormat(message: string, object: readonly unknown[], color: boolean): string;
|
|
3
3
|
export declare function nodeInspect(object: unknown, color: boolean): string;
|
|
4
4
|
export declare const debug_commands: Record<string, IDebugCommand>;
|
|
5
5
|
export declare function call_debug_command(command: keyof typeof debug_commands | string, arg: unknown, color: boolean): string;
|
|
6
|
-
//# sourceMappingURL=
|
|
6
|
+
//# sourceMappingURL=builtin-commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin-commands.d.ts","sourceRoot":"","sources":["../../src/functions/builtin-commands.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAsBxD,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,OAAO,EAAE,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAE9F;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAEnE;AAMD,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAwGxD,CAAC;AAGF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,OAAO,cAAc,GAAG,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAMtH"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { combinedSequence } from '@idlebox/terminal-control/constants';
|
|
1
2
|
import { relative } from 'node:path';
|
|
2
3
|
import { formatWithOptions, inspect } from 'node:util';
|
|
3
|
-
import { Cdim, Cdimita, CFgreen, CFred, Cita, Crst, NCF, NCita } from '
|
|
4
|
+
import { Cdim, Cdimita, CFgreen, CFred, Cita, Crst, NCF, NCita } from '../common/ansi.js';
|
|
4
5
|
const STRING_MAX_LENGTH = 128;
|
|
5
6
|
function color_error(message, color) {
|
|
6
7
|
if (color) {
|
|
@@ -143,14 +144,6 @@ export const debug_commands = {
|
|
|
143
144
|
return data.replace(combinedSequence, '');
|
|
144
145
|
},
|
|
145
146
|
};
|
|
146
|
-
const controlCharacters = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g; // 除了 \t \n \r 之外的控制字符
|
|
147
|
-
const csiSequence = /\x1B\[[\x30–\x3F]*[\x20-\x2F]*[\x40-\x7E]/g; // ANSI CSI序列
|
|
148
|
-
const oscSequence = /\x1B\][^\x1B\x07]*(\x1B\\|\x07)/g; // ANSI OSC序列
|
|
149
|
-
const pmApcSequence = /\x1B[_^][^\x1B\x07]*\x1B\\/g; // ANSI PM/APC序列
|
|
150
|
-
const dcsSequence = /\x1B[\x20-\x7E\x08-\x0D]*\x1B\\/g; // ANSI DCS序列
|
|
151
|
-
const sosSequence = /\x1B[\s\S]+?\x1B\\/g; // ANSI SOS序列
|
|
152
|
-
const otherC1 = /\x1B[\x80-\x9F]/g; // 其他C1控制字符
|
|
153
|
-
const combinedSequence = new RegExp([csiSequence.source, oscSequence.source, pmApcSequence.source, dcsSequence.source, sosSequence.source, otherC1.source, controlCharacters.source].join('|'), 'g');
|
|
154
147
|
export function call_debug_command(command, arg, color) {
|
|
155
148
|
const fn = debug_commands[command];
|
|
156
149
|
if (!fn) {
|
|
@@ -158,4 +151,4 @@ export function call_debug_command(command, arg, color) {
|
|
|
158
151
|
}
|
|
159
152
|
return fn(arg, color);
|
|
160
153
|
}
|
|
161
|
-
//# sourceMappingURL=
|
|
154
|
+
//# sourceMappingURL=builtin-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin-commands.js","sourceRoot":"","sources":["../../src/functions/builtin-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG1F,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,SAAS,WAAW,CAAC,OAAe,EAAE,KAAc;IACnD,IAAI,KAAK,EAAE,CAAC;QACX,OAAO,GAAG,KAAK,aAAa,OAAO,MAAM,GAAG,EAAE,CAAC;IAChD,CAAC;SAAM,CAAC;QACP,OAAO,aAAa,OAAO,KAAK,CAAC;IAClC,CAAC;AACF,CAAC;AAED,SAAS,OAAO,CAAC,KAAc;IAC9B,OAAO;QACN,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,KAAK;QACb,cAAc,EAAE,CAAC;QACjB,eAAe,EAAE,iBAAiB;KAClC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,OAAe,EAAE,MAA0B,EAAE,KAAc;IACrF,OAAO,iBAAiB,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,MAAe,EAAE,KAAc;IAC1D,OAAO,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;AACxC,CAAC;AAED,SAAS,cA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,IAAI,GAAG,EAAE,KAAK,CAAC,CAAC;YACpH,CAAC;QACF,CAAC;QACD,OAAQ,IAAe,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;IACvD,CAAC;CACD,CAAC;AAGF,MAAM,UAAU,kBAAkB,CAAC,OAA6C,EAAE,GAAY,EAAE,KAAc;IAC7G,MAAM,EAAE,GAAI,cAAgC,CAAC,OAAO,CAAC,CAAC;IACtD,IAAI,CAAC,EAAE,EAAE,CAAC;QACT,OAAO,WAAW,CAAC,mBAAmB,OAAO,EAAE,EAAE,KAAK,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control.browser.d.ts","sourceRoot":"","sources":["../../src/loglevels/control.browser.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control.browser.js","sourceRoot":"","sources":["../../src/loglevels/control.browser.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control.nodejs.d.ts","sourceRoot":"","sources":["../../src/loglevels/control.nodejs.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control.nodejs.js","sourceRoot":"","sources":["../../src/loglevels/control.nodejs.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare enum EnableLogLevel {
|
|
2
|
+
auto = 0,
|
|
3
|
+
fatal = 1,
|
|
4
|
+
error = 2,
|
|
5
|
+
warn = 3,
|
|
6
|
+
info = 4,
|
|
7
|
+
log = 5,
|
|
8
|
+
debug = 6,
|
|
9
|
+
verbose = 7
|
|
10
|
+
}
|
|
11
|
+
export declare const availableLevels: readonly ["fatal", "error", "warn", "info", "log", "debug", "verbose", "success"];
|
|
12
|
+
//# sourceMappingURL=loglevel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loglevel.d.ts","sourceRoot":"","sources":["../../src/loglevels/loglevel.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACzB,IAAI,IAAA;IACJ,KAAK,IAAA;IACL,KAAK,IAAA;IACL,IAAI,IAAA;IACJ,IAAI,IAAA;IACJ,GAAG,IAAA;IACH,KAAK,IAAA;IACL,OAAO,IAAA;CACP;AAED,eAAO,MAAM,eAAe,mFAAoF,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export var EnableLogLevel;
|
|
2
|
+
(function (EnableLogLevel) {
|
|
3
|
+
EnableLogLevel[EnableLogLevel["auto"] = 0] = "auto";
|
|
4
|
+
EnableLogLevel[EnableLogLevel["fatal"] = 1] = "fatal";
|
|
5
|
+
EnableLogLevel[EnableLogLevel["error"] = 2] = "error";
|
|
6
|
+
EnableLogLevel[EnableLogLevel["warn"] = 3] = "warn";
|
|
7
|
+
EnableLogLevel[EnableLogLevel["info"] = 4] = "info";
|
|
8
|
+
EnableLogLevel[EnableLogLevel["log"] = 5] = "log";
|
|
9
|
+
EnableLogLevel[EnableLogLevel["debug"] = 6] = "debug";
|
|
10
|
+
EnableLogLevel[EnableLogLevel["verbose"] = 7] = "verbose";
|
|
11
|
+
})(EnableLogLevel || (EnableLogLevel = {}));
|
|
12
|
+
export const availableLevels = ['fatal', 'error', 'warn', 'info', 'log', 'debug', 'verbose', 'success'];
|
|
13
|
+
//# sourceMappingURL=loglevel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loglevel.js","sourceRoot":"","sources":["../../src/loglevels/loglevel.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,cASX;AATD,WAAY,cAAc;IACzB,mDAAI,CAAA;IACJ,qDAAK,CAAA;IACL,qDAAK,CAAA;IACL,mDAAI,CAAA;IACJ,mDAAI,CAAA;IACJ,iDAAG,CAAA;IACH,qDAAK,CAAA;IACL,yDAAO,CAAA;AACR,CAAC,EATW,cAAc,KAAd,cAAc,QASzB;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,CAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/outputs/browser.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// export class BrowserOutput implements IAbstractConsole {
|
|
2
|
+
// public colorEnabled = true;
|
|
3
|
+
export {};
|
|
4
|
+
// private _incompleteLine = '';
|
|
5
|
+
// write(message: string): void {
|
|
6
|
+
// // message不含完整行
|
|
7
|
+
// if (!message.includes('\n')) {
|
|
8
|
+
// this._incompleteLine += message;
|
|
9
|
+
// return;
|
|
10
|
+
// }
|
|
11
|
+
// const lines = message.split('\n');
|
|
12
|
+
// if (this._incompleteLine) {
|
|
13
|
+
// lines[0] = this._incompleteLine + lines[0];
|
|
14
|
+
// }
|
|
15
|
+
// // 输出完整行,跳过最后一个不完整的行,如果message以换行结尾,则最后一个元素是空字符串
|
|
16
|
+
// for (let i = 0; i < lines.length - 1; i++) {
|
|
17
|
+
// writeLine(lines[i]);
|
|
18
|
+
// }
|
|
19
|
+
// // biome-ignore lint/style/noNonNullAssertion: lines必定还有且仅有一个元素
|
|
20
|
+
// this._incompleteLine = lines.at(-1)!;
|
|
21
|
+
// }
|
|
22
|
+
// }
|
|
23
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/outputs/browser.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,8BAA8B;;AAE9B,gCAAgC;AAEhC,iCAAiC;AACjC,mBAAmB;AACnB,kCAAkC;AAClC,qCAAqC;AACrC,YAAY;AACZ,KAAK;AAEL,sCAAsC;AAEtC,+BAA+B;AAC/B,gDAAgD;AAChD,KAAK;AAEL,oDAAoD;AACpD,gDAAgD;AAChD,yBAAyB;AACzB,KAAK;AAEL,mEAAmE;AACnE,yCAAyC;AACzC,IAAI;AACJ,IAAI"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-actions.d.ts","sourceRoot":"","sources":["../../../src/outputs/node-controllers/github-actions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,YAAY,QAIpD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function applyGithubActions(self) {
|
|
2
|
+
self.group = group;
|
|
3
|
+
self.groupCollapsed = groupCollapsed;
|
|
4
|
+
self.groupEnd = groupEnd;
|
|
5
|
+
}
|
|
6
|
+
function group(message) {
|
|
7
|
+
this.stream.write(`::group::${message}\n`);
|
|
8
|
+
}
|
|
9
|
+
function groupCollapsed(message) {
|
|
10
|
+
this.stream.write(`::group::${message}\n`);
|
|
11
|
+
}
|
|
12
|
+
function groupEnd() {
|
|
13
|
+
this.stream.write(`::endgroup::\n`);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=github-actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-actions.js","sourceRoot":"","sources":["../../../src/outputs/node-controllers/github-actions.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,kBAAkB,CAAC,IAAkB;IACpD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACnB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACrC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC1B,CAAC;AAED,SAAS,KAAK,CAAiB,OAAe;IAC7C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,OAAO,IAAI,CAAC,CAAC;AAC5C,CAAC;AACD,SAAS,cAAc,CAAiB,OAAe;IACtD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,OAAO,IAAI,CAAC,CAAC;AAC5C,CAAC;AACD,SAAS,QAAQ;IAChB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/outputs/node-controllers/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGjD,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,YAAY,QAM9D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/outputs/node-controllers/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,UAAU,4BAA4B,CAAC,IAAkB;IAC9D,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACpB,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC;YAChC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;IACF,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Terminal } from '@idlebox/terminal-control';
|
|
2
|
+
import type { IInstrestedConsole } from '../common/types.js';
|
|
3
|
+
interface IOptions {
|
|
4
|
+
readonly stream: NodeJS.WritableStream;
|
|
5
|
+
readonly colorEnabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare class NodejsOutput implements IInstrestedConsole {
|
|
8
|
+
static defaultInstance(): IInstrestedConsole;
|
|
9
|
+
readonly colorEnabled: boolean;
|
|
10
|
+
readonly stream: NodeJS.WritableStream;
|
|
11
|
+
readonly terminal: Terminal;
|
|
12
|
+
constructor({ stream, colorEnabled }: IOptions);
|
|
13
|
+
clear(): void;
|
|
14
|
+
group(message: string): void;
|
|
15
|
+
groupCollapsed(message: string): void;
|
|
16
|
+
groupEnd(): void;
|
|
17
|
+
readonly error: (message: string) => void;
|
|
18
|
+
readonly warn: (message: string) => void;
|
|
19
|
+
readonly info: (message: string) => void;
|
|
20
|
+
readonly log: (message: string) => void;
|
|
21
|
+
readonly debug: (message: string) => void;
|
|
22
|
+
readonly trace: (message: string) => void;
|
|
23
|
+
private _writeLine;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=nodejs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodejs.d.ts","sourceRoot":"","sources":["../../src/outputs/nodejs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAuC7D,UAAU,QAAQ;IACjB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC;IACvC,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;CAChC;AAGD,qBAAa,YAAa,YAAW,kBAAkB;IACtD,MAAM,CAAC,eAAe,IAAI,kBAAkB;IAW5C,SAAgB,YAAY,UAAC;IAC7B,SAAgB,MAAM,wBAAC;IACvB,SAAgB,QAAQ,WAAC;gBACb,EAAE,MAAM,EAAE,YAAoB,EAAE,EAAE,QAAQ;IAatD,KAAK,IAAI,IAAI;IAIb,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI5B,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIrC,QAAQ,IAAI,IAAI;IAIhB,QAAQ,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,QAAQ,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAE1C,OAAO,CAAC,UAAU;CAGlB"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Terminal } from '@idlebox/terminal-control';
|
|
2
|
+
import { applyControllerByEnvironment } from './node-controllers/index.js';
|
|
3
|
+
function environmentColorEnabled(stream) {
|
|
4
|
+
// biome-ignore lint/performance/useTopLevelRegex: one time use
|
|
5
|
+
const colorArgReg = /^--color=|^--color$|^-[^-]+c/;
|
|
6
|
+
const colorArg = process.argv.find((e) => colorArgReg.test(e));
|
|
7
|
+
const noColorArg = process.argv.includes('--no-color');
|
|
8
|
+
// 命令行顶级优先
|
|
9
|
+
if (noColorArg)
|
|
10
|
+
return false;
|
|
11
|
+
if (colorArg)
|
|
12
|
+
return true;
|
|
13
|
+
// 环境变量
|
|
14
|
+
if (process.env.NO_COLOR || process.env.NODE_DISABLE_COLORS === '1') {
|
|
15
|
+
/**
|
|
16
|
+
* https://force-color.org/
|
|
17
|
+
* https://nodejs.org/docs/latest/api/cli.html#node_disable_colors1
|
|
18
|
+
*/
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
else if (process.env.FORCE_COLOR) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
// 目标输出是TTY
|
|
25
|
+
if (stream.isTTY) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
if (process.env.GITHUB_ACTIONS) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
// TODO 检测其他可能
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
let instance;
|
|
35
|
+
export class NodejsOutput {
|
|
36
|
+
static defaultInstance() {
|
|
37
|
+
if (!instance) {
|
|
38
|
+
instance = new NodejsOutput({
|
|
39
|
+
stream: process.stderr,
|
|
40
|
+
colorEnabled: environmentColorEnabled(process.stderr),
|
|
41
|
+
});
|
|
42
|
+
applyControllerByEnvironment(instance);
|
|
43
|
+
}
|
|
44
|
+
return instance;
|
|
45
|
+
}
|
|
46
|
+
colorEnabled;
|
|
47
|
+
stream;
|
|
48
|
+
terminal;
|
|
49
|
+
constructor({ stream, colorEnabled = false }) {
|
|
50
|
+
this.colorEnabled = colorEnabled;
|
|
51
|
+
this.stream = stream;
|
|
52
|
+
this.terminal = new Terminal(this.stream);
|
|
53
|
+
this.error = this._writeLine.bind(this);
|
|
54
|
+
this.warn = this._writeLine.bind(this);
|
|
55
|
+
this.info = this._writeLine.bind(this);
|
|
56
|
+
this.log = this._writeLine.bind(this);
|
|
57
|
+
this.debug = this._writeLine.bind(this);
|
|
58
|
+
this.trace = this._writeLine.bind(this);
|
|
59
|
+
}
|
|
60
|
+
clear() {
|
|
61
|
+
this.terminal.resetIf(this.colorEnabled);
|
|
62
|
+
}
|
|
63
|
+
group(message) {
|
|
64
|
+
this.stream.write(`[${message}] START\n`);
|
|
65
|
+
}
|
|
66
|
+
groupCollapsed(message) {
|
|
67
|
+
this.stream.write(`[${message}] START (collapsed)\n`);
|
|
68
|
+
}
|
|
69
|
+
groupEnd() {
|
|
70
|
+
this.stream.write(`[GROUP] END\n`);
|
|
71
|
+
}
|
|
72
|
+
error;
|
|
73
|
+
warn;
|
|
74
|
+
info;
|
|
75
|
+
log;
|
|
76
|
+
debug;
|
|
77
|
+
trace;
|
|
78
|
+
_writeLine(message) {
|
|
79
|
+
this.stream.write(`${message}\n`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=nodejs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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I,OAAO,uBAAuB,CAAC,CAAC;IACvD,CAAC;IAED,QAAQ;QACP,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IACpC,CAAC;IAEQ,KAAK,CAA4B;IACjC,IAAI,CAA4B;IAChC,IAAI,CAA4B;IAChC,GAAG,CAA4B;IAC/B,KAAK,CAA4B;IACjC,KAAK,CAA4B;IAElC,UAAU,CAAC,OAAe;QACjC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;IACnC,CAAC;CACD"}
|
package/lib/printers/file.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/printers/file.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/printers/file.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,CAiB5D"}
|
package/lib/printers/file.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createWriteStream } from 'node:fs';
|
|
2
2
|
import { resolve } from 'node:path';
|
|
3
3
|
import { Transform } from 'node:stream';
|
|
4
|
+
import { NodejsOutput } from '../outputs/nodejs.js';
|
|
4
5
|
export function createLogFile(filePath) {
|
|
5
6
|
const file = resolve(process.cwd(), filePath);
|
|
6
7
|
console.log(`Creating log file: ${file}`);
|
|
@@ -16,7 +17,7 @@ export function createLogFile(filePath) {
|
|
|
16
17
|
});
|
|
17
18
|
const filter = new ColorRemoveStream();
|
|
18
19
|
filter.pipe(target, { end: true });
|
|
19
|
-
return filter;
|
|
20
|
+
return new NodejsOutput({ stream: filter, colorEnabled: false });
|
|
20
21
|
}
|
|
21
22
|
class ColorRemoveStream extends Transform {
|
|
22
23
|
_transform(chunk, _encoding, callback) {
|