@likec4/log 1.17.1 → 1.19.0

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/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@likec4/log",
3
3
  "license": "MIT",
4
- "version": "1.17.1",
4
+ "version": "1.19.0",
5
5
  "bugs": "https://github.com/likec4/likec4/issues",
6
6
  "homepage": "https://likec4.dev",
7
7
  "author": "Denis Davydkov <denis@davydkov.com>",
8
8
  "files": [
9
- "dist"
9
+ "dist",
10
+ "src"
10
11
  ],
11
12
  "repository": {
12
13
  "type": "git",
@@ -14,19 +15,24 @@
14
15
  "directory": "packages/log"
15
16
  },
16
17
  "type": "module",
17
- "sideEffects": false,
18
18
  "exports": {
19
19
  ".": {
20
+ "development": "./src/index.ts",
20
21
  "node": {
21
- "types": "./dist/node.d.ts",
22
- "import": "./dist/node.mjs",
23
- "require": "./dist/node.cjs"
24
- },
25
- "default": {
26
22
  "types": "./dist/index.d.ts",
27
23
  "import": "./dist/index.mjs",
28
24
  "require": "./dist/index.cjs"
25
+ },
26
+ "default": {
27
+ "types": "./dist/index.d.ts",
28
+ "import": "./dist/browser.mjs",
29
+ "require": "./dist/browser.cjs"
29
30
  }
31
+ },
32
+ "./browser": {
33
+ "types": "./dist/index.d.ts",
34
+ "import": "./dist/browser.mjs",
35
+ "require": "./dist/browser.cjs"
30
36
  }
31
37
  },
32
38
  "publishConfig": {
@@ -35,16 +41,18 @@
35
41
  },
36
42
  "scripts": {
37
43
  "typecheck": "tsc --noEmit",
38
- "prepack": "unbuild",
39
- "generate": "unbuild"
44
+ "build": "unbuild"
40
45
  },
41
46
  "devDependencies": {
42
- "@likec4/tsconfig": "1.17.1",
47
+ "@likec4/tsconfig": "1.19.0",
43
48
  "@types/node": "^20.17.7",
44
- "consola": "^3.2.3",
49
+ "consola": "^3.3.3",
50
+ "merge-error-cause": "^5.0.0",
51
+ "safe-stringify": "^1.1.1",
45
52
  "std-env": "^3.8.0",
46
53
  "typescript": "^5.7.2",
47
- "unbuild": "^3.0.0-rc.11"
54
+ "unbuild": "^3.1.0",
55
+ "wrap-error-message": "^3.0.0"
48
56
  },
49
57
  "packageManager": "yarn@4.5.3"
50
58
  }
package/src/browser.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { createConsola } from 'consola/browser'
2
+ import { type LogObject, LogLevels } from 'consola/core'
3
+ import { type FormattedLogObject, formattedLogObj } from './format'
4
+
5
+ export type * from 'consola/core'
6
+ export type { FormattedLogObject }
7
+
8
+ const consola = createConsola({
9
+ level: LogLevels.debug,
10
+ })
11
+
12
+ export function formatLogObj(logObj: LogObject): FormattedLogObject {
13
+ return formattedLogObj(logObj)
14
+ }
15
+
16
+ export { consola, consola as logger, consola as rootLogger, LogLevels }
package/src/format.ts ADDED
@@ -0,0 +1,60 @@
1
+ import type { LogObject } from 'consola/core'
2
+ import mergeErrorCause from 'merge-error-cause'
3
+ import safeStringify from 'safe-stringify'
4
+ import wrapErrorMessage from 'wrap-error-message'
5
+
6
+ export type FormattedLogObject = {
7
+ message: string
8
+ error?: {
9
+ message: string
10
+ name: string
11
+ stack?: string
12
+ }
13
+ }
14
+
15
+ const defaultParseStack = (stack: string): string[] => {
16
+ const lines = stack.split('\n').map((l) => l.trim().replace('file://', ''))
17
+ return lines
18
+ }
19
+
20
+ export function formattedLogObj(
21
+ logObj: LogObject,
22
+ parseStack = defaultParseStack,
23
+ ): FormattedLogObject {
24
+ const result: FormattedLogObject = {
25
+ message: '',
26
+ }
27
+ const error = logObj.args.find(a => a instanceof Error)
28
+ if (!error) {
29
+ result.message = logObj.args.map(arg => typeof arg === 'string' ? arg : safeStringify(arg)).join('; ')
30
+ if (typeof logObj.tag === 'string' && logObj.tag.length > 0) {
31
+ result.message = `[${logObj.tag}] ${result.message}`
32
+ }
33
+ return result
34
+ }
35
+
36
+ const mergedErr = logObj.args.reduce(
37
+ (acc: Error, arg) => {
38
+ if (arg === error) {
39
+ return acc
40
+ }
41
+ const msg = typeof arg === 'string' ? arg : safeStringify(arg)
42
+ return wrapErrorMessage(acc, msg)
43
+ },
44
+ mergeErrorCause(error),
45
+ )
46
+ result.message = mergedErr.message
47
+ result.error = {
48
+ message: mergedErr.message,
49
+ name: mergedErr.name,
50
+ }
51
+ if (mergedErr.stack) {
52
+ const stack = parseStack(mergedErr.stack)
53
+ result.error.stack = stack.join('\n')
54
+ result.message += '\n' + stack.slice(1).map(l => ' ' + l).join('\n')
55
+ }
56
+ if (typeof logObj.tag === 'string' && logObj.tag.length > 0) {
57
+ result.message = `[${logObj.tag}] ${result.message}`
58
+ }
59
+ return result
60
+ }
package/src/index.ts ADDED
@@ -0,0 +1,34 @@
1
+ import { createConsola } from 'consola'
2
+ import { type LogObject, LogLevels } from 'consola/core'
3
+ import { sep } from 'node:path'
4
+ import { cwd } from 'node:process'
5
+ import { type FormattedLogObject, formattedLogObj } from './format'
6
+
7
+ export type * from 'consola/core'
8
+ export type { FormattedLogObject }
9
+
10
+ function parseStack(stack: string): string[] {
11
+ const currentDir = cwd() + sep
12
+ const lines = stack.split('\n').map((l) => l.trim().replace('file://', '').replace(currentDir, ''))
13
+ return lines
14
+ }
15
+
16
+ export function formatLogObj(logObj: LogObject): FormattedLogObject {
17
+ return formattedLogObj(logObj, parseStack)
18
+ }
19
+
20
+ const level = LogLevels.debug
21
+
22
+ const consola = createConsola({
23
+ level,
24
+ defaults: {
25
+ level,
26
+ },
27
+ formatOptions: {
28
+ colors: true,
29
+ compact: false,
30
+ date: false,
31
+ },
32
+ })
33
+
34
+ export { consola, consola as logger, consola as rootLogger, LogLevels }
package/dist/node.cjs DELETED
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- const node = require('./shared/log.CIkEHqaW.cjs');
4
- require('node:util');
5
- require('node:path');
6
- require('node:process');
7
- require('node:tty');
8
-
9
-
10
-
11
- exports.LogLevels = node.LogLevels;
12
- exports.consola = node.consola;
13
- exports.logger = node.consola;
14
- exports.rootLogger = node.consola;
package/dist/node.d.cts DELETED
@@ -1,126 +0,0 @@
1
- type SelectOption = {
2
- label: string;
3
- value: string;
4
- hint?: string;
5
- };
6
- type TextOptions = {
7
- type?: "text";
8
- default?: string;
9
- placeholder?: string;
10
- initial?: string;
11
- };
12
- type ConfirmOptions = {
13
- type: "confirm";
14
- initial?: boolean;
15
- };
16
- type SelectOptions = {
17
- type: "select";
18
- initial?: string;
19
- options: (string | SelectOption)[];
20
- };
21
- type MultiSelectOptions = {
22
- type: "multiselect";
23
- initial?: string;
24
- options: string[] | SelectOption[];
25
- required?: boolean;
26
- };
27
- type PromptOptions = TextOptions | ConfirmOptions | SelectOptions | MultiSelectOptions;
28
- 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;
29
- declare function prompt<_ = any, __ = any, T extends PromptOptions = TextOptions>(message: string, opts?: PromptOptions): Promise<inferPromptReturnType<T>>;
30
-
31
- type LogLevel = 0 | 1 | 2 | 3 | 4 | 5 | (number & {});
32
- declare const LogLevels: Record<LogType, number>;
33
- type LogType = "silent" | "fatal" | "error" | "warn" | "log" | "info" | "success" | "fail" | "ready" | "start" | "box" | "debug" | "trace" | "verbose";
34
- declare const LogTypes: Record<LogType, Partial<LogObject>>;
35
-
36
- interface ConsolaOptions {
37
- reporters: ConsolaReporter[];
38
- types: Record<LogType, InputLogObject>;
39
- level: LogLevel;
40
- defaults: InputLogObject;
41
- throttle: number;
42
- throttleMin: number;
43
- stdout?: NodeJS.WriteStream;
44
- stderr?: NodeJS.WriteStream;
45
- mockFn?: (type: LogType, defaults: InputLogObject) => (...args: any) => void;
46
- prompt?: typeof prompt | undefined;
47
- formatOptions: FormatOptions;
48
- }
49
- /**
50
- * @see https://nodejs.org/api/util.html#util_util_inspect_object_showhidden_depth_colors
51
- */
52
- interface FormatOptions {
53
- columns?: number;
54
- date?: boolean;
55
- colors?: boolean;
56
- compact?: boolean | number;
57
- [key: string]: unknown;
58
- }
59
- interface InputLogObject {
60
- level?: LogLevel;
61
- tag?: string;
62
- type?: LogType;
63
- message?: string;
64
- additional?: string | string[];
65
- args?: any[];
66
- date?: Date;
67
- }
68
- interface LogObject extends InputLogObject {
69
- level: LogLevel;
70
- type: LogType;
71
- tag: string;
72
- args: any[];
73
- date: Date;
74
- [key: string]: unknown;
75
- }
76
- interface ConsolaReporter {
77
- log: (logObj: LogObject, ctx: {
78
- options: ConsolaOptions;
79
- }) => void;
80
- }
81
-
82
- declare class Consola {
83
- options: ConsolaOptions;
84
- _lastLog: {
85
- serialized?: string;
86
- object?: LogObject;
87
- count?: number;
88
- time?: Date;
89
- timeout?: ReturnType<typeof setTimeout>;
90
- };
91
- _mockFn?: ConsolaOptions["mockFn"];
92
- constructor(options?: Partial<ConsolaOptions>);
93
- get level(): LogLevel;
94
- set level(level: LogLevel);
95
- 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>;
96
- create(options: Partial<ConsolaOptions>): ConsolaInstance;
97
- withDefaults(defaults: InputLogObject): ConsolaInstance;
98
- withTag(tag: string): ConsolaInstance;
99
- addReporter(reporter: ConsolaReporter): this;
100
- removeReporter(reporter: ConsolaReporter): ConsolaReporter[] | this;
101
- setReporters(reporters: ConsolaReporter[]): this;
102
- wrapAll(): void;
103
- restoreAll(): void;
104
- wrapConsole(): void;
105
- restoreConsole(): void;
106
- wrapStd(): void;
107
- _wrapStream(stream: NodeJS.WriteStream | undefined, type: LogType): void;
108
- restoreStd(): void;
109
- _restoreStream(stream?: NodeJS.WriteStream): void;
110
- pauseLogs(): void;
111
- resumeLogs(): void;
112
- mockTypes(mockFn?: ConsolaOptions["mockFn"]): void;
113
- _wrapLogFn(defaults: InputLogObject, isRaw?: boolean): (...args: any[]) => false | undefined;
114
- _logFn(defaults: InputLogObject, args: any[], isRaw?: boolean): false | undefined;
115
- _log(logObj: LogObject): void;
116
- }
117
- interface LogFn {
118
- (message: InputLogObject | any, ...args: any[]): void;
119
- raw: (...args: any[]) => void;
120
- }
121
- type ConsolaInstance = Consola & Record<LogType, LogFn>;
122
- declare function createConsola(options?: Partial<ConsolaOptions>): ConsolaInstance;
123
-
124
- declare const consola: ConsolaInstance;
125
-
126
- export { Consola, type ConsolaInstance, type ConsolaOptions, type ConsolaReporter, type FormatOptions, type InputLogObject, type LogLevel, LogLevels, type LogObject, type LogType, LogTypes, consola, createConsola, consola as logger, consola as rootLogger };
package/dist/node.d.mts DELETED
@@ -1,126 +0,0 @@
1
- type SelectOption = {
2
- label: string;
3
- value: string;
4
- hint?: string;
5
- };
6
- type TextOptions = {
7
- type?: "text";
8
- default?: string;
9
- placeholder?: string;
10
- initial?: string;
11
- };
12
- type ConfirmOptions = {
13
- type: "confirm";
14
- initial?: boolean;
15
- };
16
- type SelectOptions = {
17
- type: "select";
18
- initial?: string;
19
- options: (string | SelectOption)[];
20
- };
21
- type MultiSelectOptions = {
22
- type: "multiselect";
23
- initial?: string;
24
- options: string[] | SelectOption[];
25
- required?: boolean;
26
- };
27
- type PromptOptions = TextOptions | ConfirmOptions | SelectOptions | MultiSelectOptions;
28
- 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;
29
- declare function prompt<_ = any, __ = any, T extends PromptOptions = TextOptions>(message: string, opts?: PromptOptions): Promise<inferPromptReturnType<T>>;
30
-
31
- type LogLevel = 0 | 1 | 2 | 3 | 4 | 5 | (number & {});
32
- declare const LogLevels: Record<LogType, number>;
33
- type LogType = "silent" | "fatal" | "error" | "warn" | "log" | "info" | "success" | "fail" | "ready" | "start" | "box" | "debug" | "trace" | "verbose";
34
- declare const LogTypes: Record<LogType, Partial<LogObject>>;
35
-
36
- interface ConsolaOptions {
37
- reporters: ConsolaReporter[];
38
- types: Record<LogType, InputLogObject>;
39
- level: LogLevel;
40
- defaults: InputLogObject;
41
- throttle: number;
42
- throttleMin: number;
43
- stdout?: NodeJS.WriteStream;
44
- stderr?: NodeJS.WriteStream;
45
- mockFn?: (type: LogType, defaults: InputLogObject) => (...args: any) => void;
46
- prompt?: typeof prompt | undefined;
47
- formatOptions: FormatOptions;
48
- }
49
- /**
50
- * @see https://nodejs.org/api/util.html#util_util_inspect_object_showhidden_depth_colors
51
- */
52
- interface FormatOptions {
53
- columns?: number;
54
- date?: boolean;
55
- colors?: boolean;
56
- compact?: boolean | number;
57
- [key: string]: unknown;
58
- }
59
- interface InputLogObject {
60
- level?: LogLevel;
61
- tag?: string;
62
- type?: LogType;
63
- message?: string;
64
- additional?: string | string[];
65
- args?: any[];
66
- date?: Date;
67
- }
68
- interface LogObject extends InputLogObject {
69
- level: LogLevel;
70
- type: LogType;
71
- tag: string;
72
- args: any[];
73
- date: Date;
74
- [key: string]: unknown;
75
- }
76
- interface ConsolaReporter {
77
- log: (logObj: LogObject, ctx: {
78
- options: ConsolaOptions;
79
- }) => void;
80
- }
81
-
82
- declare class Consola {
83
- options: ConsolaOptions;
84
- _lastLog: {
85
- serialized?: string;
86
- object?: LogObject;
87
- count?: number;
88
- time?: Date;
89
- timeout?: ReturnType<typeof setTimeout>;
90
- };
91
- _mockFn?: ConsolaOptions["mockFn"];
92
- constructor(options?: Partial<ConsolaOptions>);
93
- get level(): LogLevel;
94
- set level(level: LogLevel);
95
- 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>;
96
- create(options: Partial<ConsolaOptions>): ConsolaInstance;
97
- withDefaults(defaults: InputLogObject): ConsolaInstance;
98
- withTag(tag: string): ConsolaInstance;
99
- addReporter(reporter: ConsolaReporter): this;
100
- removeReporter(reporter: ConsolaReporter): ConsolaReporter[] | this;
101
- setReporters(reporters: ConsolaReporter[]): this;
102
- wrapAll(): void;
103
- restoreAll(): void;
104
- wrapConsole(): void;
105
- restoreConsole(): void;
106
- wrapStd(): void;
107
- _wrapStream(stream: NodeJS.WriteStream | undefined, type: LogType): void;
108
- restoreStd(): void;
109
- _restoreStream(stream?: NodeJS.WriteStream): void;
110
- pauseLogs(): void;
111
- resumeLogs(): void;
112
- mockTypes(mockFn?: ConsolaOptions["mockFn"]): void;
113
- _wrapLogFn(defaults: InputLogObject, isRaw?: boolean): (...args: any[]) => false | undefined;
114
- _logFn(defaults: InputLogObject, args: any[], isRaw?: boolean): false | undefined;
115
- _log(logObj: LogObject): void;
116
- }
117
- interface LogFn {
118
- (message: InputLogObject | any, ...args: any[]): void;
119
- raw: (...args: any[]) => void;
120
- }
121
- type ConsolaInstance = Consola & Record<LogType, LogFn>;
122
- declare function createConsola(options?: Partial<ConsolaOptions>): ConsolaInstance;
123
-
124
- declare const consola: ConsolaInstance;
125
-
126
- export { Consola, type ConsolaInstance, type ConsolaOptions, type ConsolaReporter, type FormatOptions, type InputLogObject, type LogLevel, LogLevels, type LogObject, type LogType, LogTypes, consola, createConsola, consola as logger, consola as rootLogger };
package/dist/node.d.ts DELETED
@@ -1,126 +0,0 @@
1
- type SelectOption = {
2
- label: string;
3
- value: string;
4
- hint?: string;
5
- };
6
- type TextOptions = {
7
- type?: "text";
8
- default?: string;
9
- placeholder?: string;
10
- initial?: string;
11
- };
12
- type ConfirmOptions = {
13
- type: "confirm";
14
- initial?: boolean;
15
- };
16
- type SelectOptions = {
17
- type: "select";
18
- initial?: string;
19
- options: (string | SelectOption)[];
20
- };
21
- type MultiSelectOptions = {
22
- type: "multiselect";
23
- initial?: string;
24
- options: string[] | SelectOption[];
25
- required?: boolean;
26
- };
27
- type PromptOptions = TextOptions | ConfirmOptions | SelectOptions | MultiSelectOptions;
28
- 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;
29
- declare function prompt<_ = any, __ = any, T extends PromptOptions = TextOptions>(message: string, opts?: PromptOptions): Promise<inferPromptReturnType<T>>;
30
-
31
- type LogLevel = 0 | 1 | 2 | 3 | 4 | 5 | (number & {});
32
- declare const LogLevels: Record<LogType, number>;
33
- type LogType = "silent" | "fatal" | "error" | "warn" | "log" | "info" | "success" | "fail" | "ready" | "start" | "box" | "debug" | "trace" | "verbose";
34
- declare const LogTypes: Record<LogType, Partial<LogObject>>;
35
-
36
- interface ConsolaOptions {
37
- reporters: ConsolaReporter[];
38
- types: Record<LogType, InputLogObject>;
39
- level: LogLevel;
40
- defaults: InputLogObject;
41
- throttle: number;
42
- throttleMin: number;
43
- stdout?: NodeJS.WriteStream;
44
- stderr?: NodeJS.WriteStream;
45
- mockFn?: (type: LogType, defaults: InputLogObject) => (...args: any) => void;
46
- prompt?: typeof prompt | undefined;
47
- formatOptions: FormatOptions;
48
- }
49
- /**
50
- * @see https://nodejs.org/api/util.html#util_util_inspect_object_showhidden_depth_colors
51
- */
52
- interface FormatOptions {
53
- columns?: number;
54
- date?: boolean;
55
- colors?: boolean;
56
- compact?: boolean | number;
57
- [key: string]: unknown;
58
- }
59
- interface InputLogObject {
60
- level?: LogLevel;
61
- tag?: string;
62
- type?: LogType;
63
- message?: string;
64
- additional?: string | string[];
65
- args?: any[];
66
- date?: Date;
67
- }
68
- interface LogObject extends InputLogObject {
69
- level: LogLevel;
70
- type: LogType;
71
- tag: string;
72
- args: any[];
73
- date: Date;
74
- [key: string]: unknown;
75
- }
76
- interface ConsolaReporter {
77
- log: (logObj: LogObject, ctx: {
78
- options: ConsolaOptions;
79
- }) => void;
80
- }
81
-
82
- declare class Consola {
83
- options: ConsolaOptions;
84
- _lastLog: {
85
- serialized?: string;
86
- object?: LogObject;
87
- count?: number;
88
- time?: Date;
89
- timeout?: ReturnType<typeof setTimeout>;
90
- };
91
- _mockFn?: ConsolaOptions["mockFn"];
92
- constructor(options?: Partial<ConsolaOptions>);
93
- get level(): LogLevel;
94
- set level(level: LogLevel);
95
- 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>;
96
- create(options: Partial<ConsolaOptions>): ConsolaInstance;
97
- withDefaults(defaults: InputLogObject): ConsolaInstance;
98
- withTag(tag: string): ConsolaInstance;
99
- addReporter(reporter: ConsolaReporter): this;
100
- removeReporter(reporter: ConsolaReporter): ConsolaReporter[] | this;
101
- setReporters(reporters: ConsolaReporter[]): this;
102
- wrapAll(): void;
103
- restoreAll(): void;
104
- wrapConsole(): void;
105
- restoreConsole(): void;
106
- wrapStd(): void;
107
- _wrapStream(stream: NodeJS.WriteStream | undefined, type: LogType): void;
108
- restoreStd(): void;
109
- _restoreStream(stream?: NodeJS.WriteStream): void;
110
- pauseLogs(): void;
111
- resumeLogs(): void;
112
- mockTypes(mockFn?: ConsolaOptions["mockFn"]): void;
113
- _wrapLogFn(defaults: InputLogObject, isRaw?: boolean): (...args: any[]) => false | undefined;
114
- _logFn(defaults: InputLogObject, args: any[], isRaw?: boolean): false | undefined;
115
- _log(logObj: LogObject): void;
116
- }
117
- interface LogFn {
118
- (message: InputLogObject | any, ...args: any[]): void;
119
- raw: (...args: any[]) => void;
120
- }
121
- type ConsolaInstance = Consola & Record<LogType, LogFn>;
122
- declare function createConsola(options?: Partial<ConsolaOptions>): ConsolaInstance;
123
-
124
- declare const consola: ConsolaInstance;
125
-
126
- export { Consola, type ConsolaInstance, type ConsolaOptions, type ConsolaReporter, type FormatOptions, type InputLogObject, type LogLevel, LogLevels, type LogObject, type LogType, LogTypes, consola, createConsola, consola as logger, consola as rootLogger };
package/dist/node.mjs DELETED
@@ -1,5 +0,0 @@
1
- export { L as LogLevels, a as consola, a as logger, a as rootLogger } from './shared/log.C5OT49Cy.mjs';
2
- import 'node:util';
3
- import 'node:path';
4
- import 'node:process';
5
- import 'node:tty';