bananass-utils-console 0.4.0 → 0.5.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/README.md CHANGED
@@ -137,16 +137,16 @@ npm create bananass@latest
137
137
 
138
138
  다만, 올바른 커뮤니티 환경을 준수하고 더 나은 오픈 소스를 만들기 위해, 바나나 프레임워크에 기여하기 전 반드시 아래 내용들을 확인해주세요.
139
139
 
140
- - [기여자 행동 강령 규약](CODE_OF_CONDUCT.md)
140
+ - [기여자 행동 강령 규약](https://github.com/lumirlumir/.github/blob/main/CODE_OF_CONDUCT_KO.md#%EA%B8%B0%EC%97%AC%EC%9E%90-%ED%96%89%EB%8F%99-%EA%B0%95%EB%A0%B9-%EA%B7%9C%EC%95%BD)
141
141
  - [기여하기](CONTRIBUTING.md)
142
142
 
143
143
  ## 버전 정책<sup>Versioning</sup>
144
144
 
145
- 바나나 프레임워크는 [유의적 버전 정책<sup>Sementic Versioning</sup>](https://semver.org/lang/ko/)을 따릅니다. 모든 릴리즈 버전은 `주(MAJOR).부(MINOR).수(PATCH)` 형식을 따릅니다.
145
+ 바나나 프레임워크는 [유의적 버전 정책<sup>Semantic Versioning</sup>](https://semver.org/lang/ko/)을 따릅니다. 모든 릴리즈 버전은 `주(MAJOR).부(MINOR).수(PATCH)` 형식을 따릅니다.
146
146
 
147
147
  ## 기여자 행동 강령 규약<sup>Code of Conduct</sup>
148
148
 
149
- 커뮤니티에 기여하기 전, [기여자 행동 강령 규약](CODE_OF_CONDUCT.md)을 참고해주세요.
149
+ 커뮤니티에 기여하기 전, [기여자 행동 강령 규약](https://github.com/lumirlumir/.github/blob/main/CODE_OF_CONDUCT_KO.md#%EA%B8%B0%EC%97%AC%EC%9E%90-%ED%96%89%EB%8F%99-%EA%B0%95%EB%A0%B9-%EA%B7%9C%EC%95%BD)을 참고해주세요.
150
150
 
151
151
  ## 변경 사항<sup>Change Log</sup>
152
152
 
@@ -24,5 +24,5 @@ export const infoText: string;
24
24
  export const defaultSpinner: SpinnerStyle;
25
25
  export type SpinnerStyle = {
26
26
  frames: string[];
27
- interval?: number;
27
+ interval: number;
28
28
  };
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Create a new `Logger` instance.
3
3
  *
4
- * @param {Options} options
4
+ * @param {Options} [options]
5
5
  * @returns {Logger} A new `Logger` instance.
6
6
  *
7
7
  * @example
@@ -18,7 +18,7 @@
18
18
  * .debug('Hello, debug!');
19
19
  * .eol();
20
20
  */
21
- export default function createLogger(options: Options): Logger;
21
+ export default function createLogger(options?: Options): Logger;
22
22
  /**
23
23
  * Logger options.
24
24
  */
@@ -26,21 +26,21 @@ export type Options = {
26
26
  /**
27
27
  * Enable debug mode.
28
28
  */
29
- debug?: boolean;
29
+ debug?: boolean | undefined;
30
30
  /**
31
31
  * Enable quiet mode.
32
32
  */
33
- quiet?: boolean;
33
+ quiet?: boolean | undefined;
34
34
  /**
35
35
  * Text prefix.
36
36
  */
37
- textPrefix?: string | boolean;
37
+ textPrefix?: string | boolean | undefined;
38
38
  };
39
39
  /**
40
40
  * @typedef {object} Options Logger options.
41
- * @property {boolean} [debug] Enable debug mode.
42
- * @property {boolean} [quiet] Enable quiet mode.
43
- * @property {string | boolean} [textPrefix] Text prefix.
41
+ * @property {boolean | undefined} [debug] Enable debug mode.
42
+ * @property {boolean | undefined} [quiet] Enable quiet mode.
43
+ * @property {string | boolean | undefined} [textPrefix] Text prefix.
44
44
  */
45
45
  declare class Logger {
46
46
  /** @param {Options} options */
@@ -56,10 +56,10 @@ declare class Logger {
56
56
  * - `quiet === true`: output X
57
57
  * - `quiet === false`: output O
58
58
  *
59
- * @param {...any} params
59
+ * @param {...unknown} params
60
60
  * @returns {Logger}
61
61
  */
62
- log(...params: any[]): Logger;
62
+ log(...params: unknown[]): Logger;
63
63
  /**
64
64
  * Log a message or executes a callback in debug mode.
65
65
  *
@@ -72,10 +72,10 @@ declare class Logger {
72
72
  * - `quiet === false && debug === true`: output O
73
73
  * - `quiet === false && debug === false`: output X
74
74
  *
75
- * @param {...any} params
75
+ * @param {...unknown} params
76
76
  * @returns {Logger}
77
77
  */
78
- debug(...params: any[]): Logger;
78
+ debug(...params: unknown[]): Logger;
79
79
  /**
80
80
  * Ends the current line by logging an empty line using the last method called.
81
81
  *
@@ -88,7 +88,6 @@ declare class Logger {
88
88
  eol(): Logger;
89
89
  /**
90
90
  * Get the last method called.
91
- *
92
91
  * @returns {'log' | 'debug'}
93
92
  */
94
93
  get lastMethodCalled(): "log" | "debug";
@@ -25,7 +25,7 @@ export default function createSpinner(options?: Options): Spinner;
25
25
  export type ForegroundColors = "black" | "blackBright" | "blue" | "blueBright" | "cyan" | "cyanBright" | "gray" | "green" | "greenBright" | "grey" | "magenta" | "magentaBright" | "red" | "redBright" | "white" | "whiteBright" | "yellow" | "yellowBright";
26
26
  export type SpinnerStyle = {
27
27
  frames: string[];
28
- interval?: number;
28
+ interval: number;
29
29
  };
30
30
  /**
31
31
  * Spinner options.
@@ -34,19 +34,19 @@ export type Options = {
34
34
  /**
35
35
  * Text to display next to the spinner. (default: `''`)
36
36
  */
37
- text?: string;
37
+ text?: string | undefined;
38
38
  /**
39
39
  * The color of the spinner. (default: `'yellow'`)
40
40
  */
41
- color?: ForegroundColors;
41
+ color?: ForegroundColors | undefined;
42
42
  /**
43
43
  * The stream to which the spinner is written. (default: `process.stderr`)
44
44
  */
45
- stream?: NodeJS.WriteStream;
45
+ stream?: NodeJS.WriteStream | undefined;
46
46
  /**
47
47
  * Whether the spinner should be interactive. (default: Auto-detected)
48
48
  */
49
- isInteractive?: boolean;
49
+ isInteractive?: boolean | undefined;
50
50
  /**
51
51
  * Customize the spinner animation with a custom set of frames and interval.
52
52
  *
@@ -59,7 +59,7 @@ export type Options = {
59
59
  *
60
60
  * Pass in any spinner from [`cli-spinners`](https://github.com/sindresorhus/cli-spinners).
61
61
  */
62
- spinner?: SpinnerStyle;
62
+ spinner?: SpinnerStyle | undefined;
63
63
  };
64
64
  /**
65
65
  * @typedef {"black"|"blackBright"|"blue"|"blueBright"|"cyan"|"cyanBright"|"gray"|"green"|"greenBright"|"grey"|"magenta"|"magentaBright"|"red"|"redBright"|"white"|"whiteBright"|"yellow"|"yellowBright"} ForegroundColors
@@ -67,15 +67,15 @@ export type Options = {
67
67
  /**
68
68
  * @typedef {object} SpinnerStyle
69
69
  * @property {string[]} frames
70
- * @property {number} [interval]
70
+ * @property {number} interval
71
71
  */
72
72
  /**
73
73
  * @typedef {object} Options Spinner options.
74
- * @property {string} [text] Text to display next to the spinner. (default: `''`)
75
- * @property {ForegroundColors} [color] The color of the spinner. (default: `'yellow'`)
76
- * @property {NodeJS.WriteStream} [stream] The stream to which the spinner is written. (default: `process.stderr`)
77
- * @property {boolean} [isInteractive] Whether the spinner should be interactive. (default: Auto-detected)
78
- * @property {SpinnerStyle} [spinner]
74
+ * @property {string | undefined} [text] Text to display next to the spinner. (default: `''`)
75
+ * @property {ForegroundColors | undefined} [color] The color of the spinner. (default: `'yellow'`)
76
+ * @property {NodeJS.WriteStream | undefined} [stream] The stream to which the spinner is written. (default: `process.stderr`)
77
+ * @property {boolean | undefined} [isInteractive] Whether the spinner should be interactive. (default: Auto-detected)
78
+ * @property {SpinnerStyle | undefined} [spinner]
79
79
  * Customize the spinner animation with a custom set of frames and interval.
80
80
  *
81
81
  * ```
@@ -2,7 +2,7 @@
2
2
  * Returns a green-colored success message prefixed with an icon.
3
3
  *
4
4
  * @param {string} str The success message to format.
5
- * @param {boolean} showIcon Whether to show the icon. Defaults to `false`.
5
+ * @param {boolean} [showIcon] Whether to show the icon. Defaults to `false`.
6
6
  * @returns {string} Returns a green-colored success message prefixed with an icon.
7
7
  *
8
8
  * @example
@@ -14,7 +14,7 @@ export function success(str: string, showIcon?: boolean): string;
14
14
  * Returns a red-colored error message prefixed with an icon.
15
15
  *
16
16
  * @param {string} str The error message to format.
17
- * @param {boolean} showIcon Whether to show the icon. Defaults to `false`.
17
+ * @param {boolean} [showIcon] Whether to show the icon. Defaults to `false`.
18
18
  * @returns {string} Returns a red-colored error message prefixed with an icon.
19
19
  *
20
20
  * @example
@@ -26,7 +26,7 @@ export function error(str: string, showIcon?: boolean): string;
26
26
  * Returns a yellow-colored warning message prefixed with an icon.
27
27
  *
28
28
  * @param {string} str The warning message to format.
29
- * @param {boolean} showIcon Whether to show the icon. Defaults to `false`.
29
+ * @param {boolean} [showIcon] Whether to show the icon. Defaults to `false`.
30
30
  * @returns {string} Returns a yellow-colored warning message prefixed with an icon.
31
31
  *
32
32
  * @example
@@ -38,7 +38,7 @@ export function warning(str: string, showIcon?: boolean): string;
38
38
  * Returns a blue-colored info message prefixed with an icon.
39
39
  *
40
40
  * @param {string} str The info message to format.
41
- * @param {boolean} showIcon Whether to show the icon. Defaults to `false`.
41
+ * @param {boolean} [showIcon] Whether to show the icon. Defaults to `false`.
42
42
  * @returns {string} Returns a blue-colored info message prefixed with an icon.
43
43
  *
44
44
  * @example
@@ -50,7 +50,7 @@ export function info(str: string, showIcon?: boolean): string;
50
50
  * Returns a yellow-colored error message prefixed with an icon.
51
51
  *
52
52
  * @param {string} str The bananass message to format.
53
- * @param {boolean} showIcon Whether to show the icon. Defaults to `false`.
53
+ * @param {boolean} [showIcon] Whether to show the icon. Defaults to `false`.
54
54
  * @returns Returns a yellow-colored error message prefixed with an icon.
55
55
  *
56
56
  * @example
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bananass-utils-console",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "description": "Console Utilities for Bananass Framework.🍌",
6
6
  "exports": {
@@ -88,7 +88,7 @@
88
88
  "url": "https://github.com/lumirlumir/npm-bananass/issues"
89
89
  },
90
90
  "engines": {
91
- "node": "^20.18.0 || ^22.3.0 || >= 24.0.0"
91
+ "node": "^20.19.0 || ^22.13.0 || >=24.0.0"
92
92
  },
93
93
  "publishConfig": {
94
94
  "provenance": true
@@ -98,5 +98,5 @@
98
98
  "build": "npx tsc && node ../../scripts/cp.mjs ../../LICENSE.md LICENSE.md ../../README.md README.md",
99
99
  "test": "node --test"
100
100
  },
101
- "gitHead": "9ef4b5d85c599fd179cd90de4619668d6ee6867f"
101
+ "gitHead": "fb88d1af9375f2f49f56402a17216a7a217a6ac0"
102
102
  }
@@ -16,7 +16,7 @@ import isUnicodeSupported from '../is-unicode-supported/index.js';
16
16
  /**
17
17
  * @typedef {object} SpinnerStyle
18
18
  * @property {string[]} frames
19
- * @property {number} [interval]
19
+ * @property {number} interval
20
20
  */
21
21
 
22
22
  // --------------------------------------------------------------------------------
@@ -24,9 +24,10 @@ import isUnicodeSupported from '../is-unicode-supported/index.js';
24
24
  // --------------------------------------------------------------------------------
25
25
 
26
26
  /**
27
- * @param {string | string[]} unicode Used when Unicode is supported.
28
- * @param {string | string[]} ascii Used when Unicode is not supported.
29
- * @returns {any}
27
+ * @template {string | string[]} T
28
+ * @param {T} unicode Used when Unicode is supported.
29
+ * @param {T} ascii Used when Unicode is not supported.
30
+ * @returns {T}
30
31
  */
31
32
  const choose = (unicode, ascii) => (isUnicodeSupported() ? unicode : ascii);
32
33
 
@@ -15,9 +15,9 @@ import { styleText } from 'node:util';
15
15
 
16
16
  /**
17
17
  * @typedef {object} Options Logger options.
18
- * @property {boolean} [debug] Enable debug mode.
19
- * @property {boolean} [quiet] Enable quiet mode.
20
- * @property {string | boolean} [textPrefix] Text prefix.
18
+ * @property {boolean | undefined} [debug] Enable debug mode.
19
+ * @property {boolean | undefined} [quiet] Enable quiet mode.
20
+ * @property {string | boolean | undefined} [textPrefix] Text prefix.
21
21
  */
22
22
 
23
23
  // --------------------------------------------------------------------------------
@@ -69,7 +69,7 @@ class Logger {
69
69
  * - `quiet === true`: output X
70
70
  * - `quiet === false`: output O
71
71
  *
72
- * @param {...any} params
72
+ * @param {...unknown} params
73
73
  * @returns {Logger}
74
74
  */
75
75
  log(...params) {
@@ -111,7 +111,7 @@ class Logger {
111
111
  * - `quiet === false && debug === true`: output O
112
112
  * - `quiet === false && debug === false`: output X
113
113
  *
114
- * @param {...any} params
114
+ * @param {...unknown} params
115
115
  * @returns {Logger}
116
116
  */
117
117
  debug(...params) {
@@ -172,7 +172,6 @@ class Logger {
172
172
 
173
173
  /**
174
174
  * Get the last method called.
175
- *
176
175
  * @returns {'log' | 'debug'}
177
176
  */
178
177
  get lastMethodCalled() {
@@ -187,7 +186,7 @@ class Logger {
187
186
  /**
188
187
  * Create a new `Logger` instance.
189
188
  *
190
- * @param {Options} options
189
+ * @param {Options} [options]
191
190
  * @returns {Logger} A new `Logger` instance.
192
191
  *
193
192
  * @example
@@ -29,16 +29,16 @@ import {
29
29
  /**
30
30
  * @typedef {object} SpinnerStyle
31
31
  * @property {string[]} frames
32
- * @property {number} [interval]
32
+ * @property {number} interval
33
33
  */
34
34
 
35
35
  /**
36
36
  * @typedef {object} Options Spinner options.
37
- * @property {string} [text] Text to display next to the spinner. (default: `''`)
38
- * @property {ForegroundColors} [color] The color of the spinner. (default: `'yellow'`)
39
- * @property {NodeJS.WriteStream} [stream] The stream to which the spinner is written. (default: `process.stderr`)
40
- * @property {boolean} [isInteractive] Whether the spinner should be interactive. (default: Auto-detected)
41
- * @property {SpinnerStyle} [spinner]
37
+ * @property {string | undefined} [text] Text to display next to the spinner. (default: `''`)
38
+ * @property {ForegroundColors | undefined} [color] The color of the spinner. (default: `'yellow'`)
39
+ * @property {NodeJS.WriteStream | undefined} [stream] The stream to which the spinner is written. (default: `process.stderr`)
40
+ * @property {boolean | undefined} [isInteractive] Whether the spinner should be interactive. (default: Auto-detected)
41
+ * @property {SpinnerStyle | undefined} [spinner]
42
42
  * Customize the spinner animation with a custom set of frames and interval.
43
43
  *
44
44
  * ```
@@ -66,8 +66,8 @@ class Spinner {
66
66
  #interval;
67
67
  /** @type {number} */
68
68
  #currentFrame = -1;
69
- /** @type {NodeJS.Timeout} */
70
- #timer;
69
+ /** @type {NodeJS.Timeout | undefined} */
70
+ #timer = undefined;
71
71
  /** @type {string} */
72
72
  #text;
73
73
  /** @type {NodeJS.WriteStream} */
@@ -100,9 +100,9 @@ class Spinner {
100
100
  // Private Methods
101
101
  // ------------------------------------------------------------------------------
102
102
 
103
- /** @param {string} symbol @param {string} text */
104
- #symbolStop(symbol, text) {
105
- return this.stop(`${symbol} ${text ?? this.#text}`);
103
+ /** @param {string} symbol @param {string} [text] */
104
+ #symbolStop(symbol, text = this.#text) {
105
+ return this.stop(`${symbol} ${text}`);
106
106
  }
107
107
 
108
108
  #render() {
@@ -40,7 +40,7 @@ const format = (str, showIcon, color, icon) =>
40
40
  * Returns a green-colored success message prefixed with an icon.
41
41
  *
42
42
  * @param {string} str The success message to format.
43
- * @param {boolean} showIcon Whether to show the icon. Defaults to `false`.
43
+ * @param {boolean} [showIcon] Whether to show the icon. Defaults to `false`.
44
44
  * @returns {string} Returns a green-colored success message prefixed with an icon.
45
45
  *
46
46
  * @example
@@ -55,7 +55,7 @@ export function success(str, showIcon = false) {
55
55
  * Returns a red-colored error message prefixed with an icon.
56
56
  *
57
57
  * @param {string} str The error message to format.
58
- * @param {boolean} showIcon Whether to show the icon. Defaults to `false`.
58
+ * @param {boolean} [showIcon] Whether to show the icon. Defaults to `false`.
59
59
  * @returns {string} Returns a red-colored error message prefixed with an icon.
60
60
  *
61
61
  * @example
@@ -70,7 +70,7 @@ export function error(str, showIcon = false) {
70
70
  * Returns a yellow-colored warning message prefixed with an icon.
71
71
  *
72
72
  * @param {string} str The warning message to format.
73
- * @param {boolean} showIcon Whether to show the icon. Defaults to `false`.
73
+ * @param {boolean} [showIcon] Whether to show the icon. Defaults to `false`.
74
74
  * @returns {string} Returns a yellow-colored warning message prefixed with an icon.
75
75
  *
76
76
  * @example
@@ -85,7 +85,7 @@ export function warning(str, showIcon = false) {
85
85
  * Returns a blue-colored info message prefixed with an icon.
86
86
  *
87
87
  * @param {string} str The info message to format.
88
- * @param {boolean} showIcon Whether to show the icon. Defaults to `false`.
88
+ * @param {boolean} [showIcon] Whether to show the icon. Defaults to `false`.
89
89
  * @returns {string} Returns a blue-colored info message prefixed with an icon.
90
90
  *
91
91
  * @example
@@ -100,7 +100,7 @@ export function info(str, showIcon = false) {
100
100
  * Returns a yellow-colored error message prefixed with an icon.
101
101
  *
102
102
  * @param {string} str The bananass message to format.
103
- * @param {boolean} showIcon Whether to show the icon. Defaults to `false`.
103
+ * @param {boolean} [showIcon] Whether to show the icon. Defaults to `false`.
104
104
  * @returns Returns a yellow-colored error message prefixed with an icon.
105
105
  *
106
106
  * @example