@reliverse/relinka 1.3.1 → 1.3.3

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.
Files changed (69) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +87 -134
  3. package/bin/deprecated/components/core/core.d.ts +2 -0
  4. package/bin/deprecated/components/core/core.js +2 -0
  5. package/{dist-npm → bin/deprecated}/components/levels/levels.d.ts +26 -26
  6. package/{dist-npm → bin/deprecated}/components/modes/basic.d.ts +20 -20
  7. package/{dist-npm → bin/deprecated}/components/modes/basic.js +5 -5
  8. package/{dist-npm → bin/deprecated}/components/modes/browser.d.ts +19 -19
  9. package/{dist-npm → bin/deprecated}/components/modes/browser.js +2 -2
  10. package/bin/deprecated/components/modes/shared.d.ts +5 -0
  11. package/bin/deprecated/components/modes/shared.js +2 -0
  12. package/bin/deprecated/components/relinka/logger.d.ts +5 -0
  13. package/bin/deprecated/components/relinka/logger.js +5 -0
  14. package/{dist-npm → bin/deprecated}/components/relinka/mod.d.ts +21 -21
  15. package/{dist-npm → bin/deprecated}/components/relinka/mod.js +3 -3
  16. package/{dist-npm → bin/deprecated}/components/relinka/relinka.d.ts +141 -140
  17. package/{dist-npm → bin/deprecated}/components/relinka/relinka.js +14 -11
  18. package/{dist-npm → bin/deprecated}/components/reporters/basic.d.ts +11 -11
  19. package/{dist-npm → bin/deprecated}/components/reporters/basic.js +10 -6
  20. package/{dist-npm → bin/deprecated}/components/reporters/browser.d.ts +10 -10
  21. package/{dist-npm → bin/deprecated}/components/reporters/fancy.d.ts +10 -10
  22. package/{dist-npm → bin/deprecated}/components/reporters/fancy.js +16 -11
  23. package/{dist-npm/main.d.ts → bin/deprecated/depd-main.d.ts} +2 -3
  24. package/{dist-npm/main.js → bin/deprecated/depd-main.js} +0 -1
  25. package/{dist-npm → bin/deprecated}/types/mod.d.ts +150 -149
  26. package/{dist-npm → bin/deprecated}/utils/box.d.ts +114 -114
  27. package/{dist-npm → bin/deprecated}/utils/box.js +1 -1
  28. package/{dist-npm → bin/deprecated}/utils/deprecatedColors.d.ts +69 -69
  29. package/{dist-npm → bin/deprecated}/utils/deprecatedColors.js +3 -9
  30. package/{dist-npm → bin/deprecated}/utils/error.d.ts +6 -6
  31. package/{dist-npm → bin/deprecated}/utils/format.d.ts +14 -14
  32. package/{dist-npm → bin/deprecated}/utils/format.js +2 -2
  33. package/{dist-npm → bin/deprecated}/utils/log.d.ts +13 -13
  34. package/bin/deprecated/utils/mod.d.ts +3 -0
  35. package/bin/deprecated/utils/mod.js +9 -0
  36. package/{dist-npm → bin/deprecated}/utils/stream.d.ts +15 -14
  37. package/{dist-npm → bin/deprecated}/utils/string.d.ts +50 -50
  38. package/{dist-npm → bin/deprecated}/utils/tree.d.ts +41 -41
  39. package/bin/main.d.ts +1 -0
  40. package/bin/main.js +1 -0
  41. package/package.json +46 -83
  42. package/dist-npm/components/core/core.d.ts +0 -2
  43. package/dist-npm/components/core/core.js +0 -2
  44. package/dist-npm/components/messages/mapping.d.ts +0 -3
  45. package/dist-npm/components/messages/mapping.js +0 -49
  46. package/dist-npm/components/messages/messages.d.ts +0 -89
  47. package/dist-npm/components/messages/messages.js +0 -314
  48. package/dist-npm/components/messages/mod.d.ts +0 -5
  49. package/dist-npm/components/messages/mod.js +0 -5
  50. package/dist-npm/components/messages/terminal.d.ts +0 -15
  51. package/dist-npm/components/messages/terminal.js +0 -57
  52. package/dist-npm/components/messages/types.d.ts +0 -12
  53. package/dist-npm/components/messages/types.js +0 -0
  54. package/dist-npm/components/messages/variants.d.ts +0 -12
  55. package/dist-npm/components/messages/variants.js +0 -52
  56. package/dist-npm/components/modes/shared.d.ts +0 -5
  57. package/dist-npm/components/modes/shared.js +0 -2
  58. package/dist-npm/components/relinka/logger.d.ts +0 -12
  59. package/dist-npm/components/relinka/logger.js +0 -52
  60. package/dist-npm/utils/mod.d.ts +0 -3
  61. package/dist-npm/utils/mod.js +0 -9
  62. /package/{dist-npm → bin/deprecated}/components/levels/levels.js +0 -0
  63. /package/{dist-npm → bin/deprecated}/components/reporters/browser.js +0 -0
  64. /package/{dist-npm → bin/deprecated}/types/mod.js +0 -0
  65. /package/{dist-npm → bin/deprecated}/utils/error.js +0 -0
  66. /package/{dist-npm → bin/deprecated}/utils/log.js +0 -0
  67. /package/{dist-npm → bin/deprecated}/utils/stream.js +0 -0
  68. /package/{dist-npm → bin/deprecated}/utils/string.js +0 -0
  69. /package/{dist-npm → bin/deprecated}/utils/tree.js +0 -0
@@ -1,149 +1,150 @@
1
- import type { LogLevel, LogType } from "../components/levels/levels.js";
2
- export type RelinkaOptions = {
3
- /**
4
- * An array of RelinkaReporter instances used to handle and output log messages.
5
- */
6
- reporters: RelinkaReporter[];
7
- /**
8
- * A record mapping LogType to InputLogObject, defining the log configuration for each log type.
9
- * See {@link LogType} and {@link InputLogObject}.
10
- */
11
- types: Record<LogType, InputLogObject>;
12
- /**
13
- * The minimum log level to output. See {@link LogLevel}.
14
- */
15
- level: LogLevel;
16
- /**
17
- * Default properties applied to all log messages unless overridden. See {@link InputLogObject}.
18
- */
19
- defaults: InputLogObject;
20
- /**
21
- * The maximum number of times a log message can be repeated within a given timeframe.
22
- */
23
- throttle: number;
24
- /**
25
- * The minimum time in milliseconds that must elapse before a throttled log message can be logged again.
26
- */
27
- throttleMin: number;
28
- /**
29
- * The Node.js writable stream for standard output. See {@link NodeJS.WriteStream}.
30
- * @optional
31
- */
32
- stdout?: NodeJS.WriteStream;
33
- /**
34
- * The Node.js writeable stream for standard error output. See {@link NodeJS.WriteStream}.
35
- * @optional
36
- */
37
- stderr?: NodeJS.WriteStream;
38
- /**
39
- * A function that allows you to mock log messages for testing purposes.
40
- * @optional
41
- */
42
- mockFn?: (type: LogType, defaults: InputLogObject) => (...args: any) => void;
43
- /**
44
- * Configuration options for formatting log messages. See {@link FormatOptions}.
45
- */
46
- formatOptions: FormatOptions;
47
- };
48
- /**
49
- * @see https://nodejs.org/api/util.html#util_util_inspect_object_showhidden_depth_colors
50
- */
51
- export type FormatOptions = {
52
- /**
53
- * The maximum number of columns to output, affects formatting.
54
- * @optional
55
- */
56
- columns?: number;
57
- /**
58
- * Whether to include timestamp information in log messages.
59
- * @optional
60
- */
61
- date?: boolean;
62
- /**
63
- * Whether to use colors in the output.
64
- * @optional
65
- */
66
- colors?: boolean;
67
- /**
68
- * Specifies whether or not the output should be compact. Accepts a boolean or numeric level of compactness.
69
- * @optional
70
- */
71
- compact?: boolean | number;
72
- /**
73
- * Allows additional custom formatting options.
74
- */
75
- [key: string]: unknown;
76
- };
77
- export type InputLogObject = {
78
- /**
79
- * The logging level of the message. See {@link LogLevel}.
80
- * @optional
81
- */
82
- level?: LogLevel;
83
- /**
84
- * A string tag to categorize or identify the log message.
85
- * @optional
86
- */
87
- tag?: string;
88
- /**
89
- * The type of log message, which affects how it's processed and displayed. See {@link LogType}.
90
- * @optional
91
- */
92
- type?: LogType;
93
- /**
94
- * The main log message text.
95
- * @optional
96
- */
97
- message?: string;
98
- /**
99
- * Additional text or texts to be logged with the message.
100
- * @optional
101
- */
102
- additional?: string | string[];
103
- /**
104
- * Additional arguments to be logged with the message.
105
- * @optional
106
- */
107
- args?: any[];
108
- /**
109
- * The date and time when the log message was created.
110
- * @optional
111
- */
112
- date?: Date;
113
- };
114
- export type LogObject = {
115
- /**
116
- * The logging level of the message, overridden if required. See {@link LogLevel}.
117
- */
118
- level: LogLevel;
119
- /**
120
- * The type of log message, overridden if required. See {@link LogType}.
121
- */
122
- type: LogType;
123
- /**
124
- * A string tag to categorize or identify the log message, overridden if necessary.
125
- */
126
- tag: string;
127
- /**
128
- * Additional arguments to be logged with the message, overridden if necessary.
129
- */
130
- args: any[];
131
- /**
132
- * The date and time the log message was created, overridden if necessary.
133
- */
134
- date: Date;
135
- /**
136
- * Allows additional custom properties to be set on the log object.
137
- */
138
- [key: string]: unknown;
139
- } & InputLogObject;
140
- export type RelinkaReporter = {
141
- /**
142
- * Defines how a log message is processed and displayed by this reporter.
143
- * @param logObj The LogObject containing the log information to process. See {@link LogObject}.
144
- * @param ctx An object containing context information such as options. See {@link RelinkaOptions}.
145
- */
146
- log: (logObj: LogObject, ctx: {
147
- options: RelinkaOptions;
148
- }) => void;
149
- };
1
+ /// <reference types="node" />
2
+ import type { LogLevel, LogType } from "../components/levels/levels.js";
3
+ export type RelinkaOptions = {
4
+ /**
5
+ * An array of RelinkaReporter instances used to handle and output log messages.
6
+ */
7
+ reporters: RelinkaReporter[];
8
+ /**
9
+ * A record mapping LogType to InputLogObject, defining the log configuration for each log type.
10
+ * See {@link LogType} and {@link InputLogObject}.
11
+ */
12
+ types: Record<LogType, InputLogObject>;
13
+ /**
14
+ * The minimum log level to output. See {@link LogLevel}.
15
+ */
16
+ level: LogLevel;
17
+ /**
18
+ * Default properties applied to all log messages unless overridden. See {@link InputLogObject}.
19
+ */
20
+ defaults: InputLogObject;
21
+ /**
22
+ * The maximum number of times a log message can be repeated within a given timeframe.
23
+ */
24
+ throttle: number;
25
+ /**
26
+ * The minimum time in milliseconds that must elapse before a throttled log message can be logged again.
27
+ */
28
+ throttleMin: number;
29
+ /**
30
+ * The Node.js writable stream for standard output. See {@link NodeJS.WriteStream}.
31
+ * @optional
32
+ */
33
+ stdout?: NodeJS.WriteStream;
34
+ /**
35
+ * The Node.js writeable stream for standard error output. See {@link NodeJS.WriteStream}.
36
+ * @optional
37
+ */
38
+ stderr?: NodeJS.WriteStream;
39
+ /**
40
+ * A function that allows you to mock log messages for testing purposes.
41
+ * @optional
42
+ */
43
+ mockFn?: (type: LogType, defaults: InputLogObject) => (...args: any) => void;
44
+ /**
45
+ * Configuration options for formatting log messages. See {@link FormatOptions}.
46
+ */
47
+ formatOptions: FormatOptions;
48
+ };
49
+ /**
50
+ * @see https://nodejs.org/api/util.html#util_util_inspect_object_showhidden_depth_colors
51
+ */
52
+ export type FormatOptions = {
53
+ /**
54
+ * The maximum number of columns to output, affects formatting.
55
+ * @optional
56
+ */
57
+ columns?: number;
58
+ /**
59
+ * Whether to include timestamp information in log messages.
60
+ * @optional
61
+ */
62
+ date?: boolean;
63
+ /**
64
+ * Whether to use colors in the output.
65
+ * @optional
66
+ */
67
+ colors?: boolean;
68
+ /**
69
+ * Specifies whether or not the output should be compact. Accepts a boolean or numeric level of compactness.
70
+ * @optional
71
+ */
72
+ compact?: boolean | number;
73
+ /**
74
+ * Allows additional custom formatting options.
75
+ */
76
+ [key: string]: unknown;
77
+ };
78
+ export type InputLogObject = {
79
+ /**
80
+ * The logging level of the message. See {@link LogLevel}.
81
+ * @optional
82
+ */
83
+ level?: LogLevel;
84
+ /**
85
+ * A string tag to categorize or identify the log message.
86
+ * @optional
87
+ */
88
+ tag?: string;
89
+ /**
90
+ * The type of log message, which affects how it's processed and displayed. See {@link LogType}.
91
+ * @optional
92
+ */
93
+ type?: LogType;
94
+ /**
95
+ * The main log message text.
96
+ * @optional
97
+ */
98
+ message?: string;
99
+ /**
100
+ * Additional text or texts to be logged with the message.
101
+ * @optional
102
+ */
103
+ additional?: string | string[];
104
+ /**
105
+ * Additional arguments to be logged with the message.
106
+ * @optional
107
+ */
108
+ args?: any[];
109
+ /**
110
+ * The date and time when the log message was created.
111
+ * @optional
112
+ */
113
+ date?: Date;
114
+ };
115
+ export type LogObject = {
116
+ /**
117
+ * The logging level of the message, overridden if required. See {@link LogLevel}.
118
+ */
119
+ level: LogLevel;
120
+ /**
121
+ * The type of log message, overridden if required. See {@link LogType}.
122
+ */
123
+ type: LogType;
124
+ /**
125
+ * A string tag to categorize or identify the log message, overridden if necessary.
126
+ */
127
+ tag: string;
128
+ /**
129
+ * Additional arguments to be logged with the message, overridden if necessary.
130
+ */
131
+ args: any[];
132
+ /**
133
+ * The date and time the log message was created, overridden if necessary.
134
+ */
135
+ date: Date;
136
+ /**
137
+ * Allows additional custom properties to be set on the log object.
138
+ */
139
+ [key: string]: unknown;
140
+ } & InputLogObject;
141
+ export type RelinkaReporter = {
142
+ /**
143
+ * Defines how a log message is processed and displayed by this reporter.
144
+ * @param logObj The LogObject containing the log information to process. See {@link LogObject}.
145
+ * @param ctx An object containing context information such as options. See {@link RelinkaOptions}.
146
+ */
147
+ log: (logObj: LogObject, ctx: {
148
+ options: RelinkaOptions;
149
+ }) => void;
150
+ };
@@ -1,114 +1,114 @@
1
- export type BoxBorderStyle = {
2
- /**
3
- * Top left corner
4
- * @example `┌`
5
- * @example `╔`
6
- * @example `╓`
7
- */
8
- tl: string;
9
- /**
10
- * Top right corner
11
- * @example `┐`
12
- * @example `╗`
13
- * @example `╖`
14
- */
15
- tr: string;
16
- /**
17
- * Bottom left corner
18
- * @example `└`
19
- * @example `╚`
20
- * @example `╙`
21
- */
22
- bl: string;
23
- /**
24
- * Bottom right corner
25
- * @example `┘`
26
- * @example `╝`
27
- * @example `╜`
28
- */
29
- br: string;
30
- /**
31
- * Horizontal line
32
- * @example `─`
33
- * @example `═`
34
- * @example `─`
35
- */
36
- h: string;
37
- /**
38
- * Vertical line
39
- * @example `│`
40
- * @example `║`
41
- * @example `║`
42
- */
43
- v: string;
44
- };
45
- declare const boxStylePresets: Record<string, BoxBorderStyle>;
46
- export type BoxStyle = {
47
- /**
48
- * The border color
49
- * @default 'white'
50
- */
51
- borderColor: "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright";
52
- /**
53
- * The border style
54
- * @default 'solid'
55
- * @example 'single-double-rounded'
56
- * @example
57
- * ```ts
58
- * {
59
- * tl: '┌',
60
- * tr: '┐',
61
- * bl: '└',
62
- * br: '┘',
63
- * h: '─',
64
- * v: '│',
65
- * }
66
- * ```
67
- */
68
- borderStyle: BoxBorderStyle | keyof typeof boxStylePresets;
69
- /**
70
- * The vertical alignment of the text
71
- * @default 'center'
72
- */
73
- valign: "top" | "center" | "bottom";
74
- /**
75
- * The padding of the box
76
- * @default 2
77
- */
78
- padding: number;
79
- /**
80
- * The left margin of the box
81
- * @default 1
82
- */
83
- marginLeft: number;
84
- /**
85
- * The top margin of the box
86
- * @default 1
87
- */
88
- marginTop: number;
89
- /**
90
- * The top margin of the box
91
- * @default 1
92
- */
93
- marginBottom: number;
94
- };
95
- /**
96
- * The border options of the box
97
- */
98
- export type BoxOpts = {
99
- /**
100
- * Title that will be displayed on top of the box
101
- * @example 'Hello World'
102
- * @example 'Hello {name}'
103
- */
104
- title?: string;
105
- style?: Partial<BoxStyle>;
106
- };
107
- /**
108
- * Creates a styled box with text content, customizable via options.
109
- * @param {string} text - The text to display in the box.
110
- * @param {BoxOpts} [_opts={}] - Optional settings for the appearance and behavior of the box. See {@link BoxOpts}.
111
- * @returns {string} The formatted box as a string, ready for printing or logging.
112
- */
113
- export declare function box(text: string, _opts?: BoxOpts): string;
114
- export {};
1
+ export type BoxBorderStyle = {
2
+ /**
3
+ * Top left corner
4
+ * @example `┌`
5
+ * @example `╔`
6
+ * @example `╓`
7
+ */
8
+ tl: string;
9
+ /**
10
+ * Top right corner
11
+ * @example `┐`
12
+ * @example `╗`
13
+ * @example `╖`
14
+ */
15
+ tr: string;
16
+ /**
17
+ * Bottom left corner
18
+ * @example `└`
19
+ * @example `╚`
20
+ * @example `╙`
21
+ */
22
+ bl: string;
23
+ /**
24
+ * Bottom right corner
25
+ * @example `┘`
26
+ * @example `╝`
27
+ * @example `╜`
28
+ */
29
+ br: string;
30
+ /**
31
+ * Horizontal line
32
+ * @example `─`
33
+ * @example `═`
34
+ * @example `─`
35
+ */
36
+ h: string;
37
+ /**
38
+ * Vertical line
39
+ * @example `│`
40
+ * @example `║`
41
+ * @example `║`
42
+ */
43
+ v: string;
44
+ };
45
+ declare const boxStylePresets: Record<string, BoxBorderStyle>;
46
+ export type BoxStyle = {
47
+ /**
48
+ * The border color
49
+ * @default 'white'
50
+ */
51
+ borderColor: "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright";
52
+ /**
53
+ * The border style
54
+ * @default 'solid'
55
+ * @example 'single-double-rounded'
56
+ * @example
57
+ * ```ts
58
+ * {
59
+ * tl: '┌',
60
+ * tr: '┐',
61
+ * bl: '└',
62
+ * br: '┘',
63
+ * h: '─',
64
+ * v: '│',
65
+ * }
66
+ * ```
67
+ */
68
+ borderStyle: BoxBorderStyle | keyof typeof boxStylePresets;
69
+ /**
70
+ * The vertical alignment of the text
71
+ * @default 'center'
72
+ */
73
+ valign: "top" | "center" | "bottom";
74
+ /**
75
+ * The padding of the box
76
+ * @default 2
77
+ */
78
+ padding: number;
79
+ /**
80
+ * The left margin of the box
81
+ * @default 1
82
+ */
83
+ marginLeft: number;
84
+ /**
85
+ * The top margin of the box
86
+ * @default 1
87
+ */
88
+ marginTop: number;
89
+ /**
90
+ * The top margin of the box
91
+ * @default 1
92
+ */
93
+ marginBottom: number;
94
+ };
95
+ /**
96
+ * The border options of the box
97
+ */
98
+ export type BoxOpts = {
99
+ /**
100
+ * Title that will be displayed on top of the box
101
+ * @example 'Hello World'
102
+ * @example 'Hello {name}'
103
+ */
104
+ title?: string;
105
+ style?: Partial<BoxStyle>;
106
+ };
107
+ /**
108
+ * Creates a styled box with text content, customizable via options.
109
+ * @param {string} text - The text to display in the box.
110
+ * @param {BoxOpts} [_opts={}] - Optional settings for the appearance and behavior of the box. See {@link BoxOpts}.
111
+ * @returns {string} The formatted box as a string, ready for printing or logging.
112
+ */
113
+ export declare function box(text: string, _opts?: BoxOpts): string;
114
+ export {};
@@ -87,7 +87,7 @@ export function box(text, _opts = {}) {
87
87
  const boxLines = [];
88
88
  const _color = getColor(opts.style.borderColor);
89
89
  const borderStyle = {
90
- ...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets["solid"] : opts.style.borderStyle
90
+ ...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle
91
91
  };
92
92
  if (_color) {
93
93
  for (const key in borderStyle) {