@reliverse/relinka 1.3.2 → 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 (55) 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/{dist-npm → bin/deprecated}/components/relinka/logger.d.ts +5 -5
  13. package/{dist-npm → bin/deprecated}/components/relinka/mod.d.ts +21 -21
  14. package/{dist-npm → bin/deprecated}/components/relinka/mod.js +3 -3
  15. package/{dist-npm → bin/deprecated}/components/relinka/relinka.d.ts +141 -140
  16. package/{dist-npm → bin/deprecated}/components/relinka/relinka.js +14 -11
  17. package/{dist-npm → bin/deprecated}/components/reporters/basic.d.ts +11 -11
  18. package/{dist-npm → bin/deprecated}/components/reporters/basic.js +10 -6
  19. package/{dist-npm → bin/deprecated}/components/reporters/browser.d.ts +10 -10
  20. package/{dist-npm → bin/deprecated}/components/reporters/fancy.d.ts +10 -10
  21. package/{dist-npm → bin/deprecated}/components/reporters/fancy.js +16 -11
  22. package/{dist-npm/main.js → bin/deprecated/depd-main.d.ts} +2 -2
  23. package/{dist-npm → bin/deprecated}/types/mod.d.ts +150 -149
  24. package/{dist-npm → bin/deprecated}/utils/box.d.ts +114 -114
  25. package/{dist-npm → bin/deprecated}/utils/box.js +1 -1
  26. package/{dist-npm → bin/deprecated}/utils/deprecatedColors.d.ts +69 -69
  27. package/{dist-npm → bin/deprecated}/utils/deprecatedColors.js +3 -9
  28. package/{dist-npm → bin/deprecated}/utils/error.d.ts +6 -6
  29. package/{dist-npm → bin/deprecated}/utils/format.d.ts +14 -14
  30. package/{dist-npm → bin/deprecated}/utils/format.js +2 -2
  31. package/{dist-npm → bin/deprecated}/utils/log.d.ts +13 -13
  32. package/bin/deprecated/utils/mod.d.ts +3 -0
  33. package/bin/deprecated/utils/mod.js +9 -0
  34. package/{dist-npm → bin/deprecated}/utils/stream.d.ts +15 -14
  35. package/{dist-npm → bin/deprecated}/utils/string.d.ts +50 -50
  36. package/{dist-npm → bin/deprecated}/utils/tree.d.ts +41 -41
  37. package/bin/main.d.ts +1 -0
  38. package/bin/main.js +1 -0
  39. package/package.json +46 -83
  40. package/dist-npm/components/core/core.d.ts +0 -2
  41. package/dist-npm/components/core/core.js +0 -2
  42. package/dist-npm/components/modes/shared.d.ts +0 -5
  43. package/dist-npm/components/modes/shared.js +0 -2
  44. package/dist-npm/utils/mod.d.ts +0 -3
  45. package/dist-npm/utils/mod.js +0 -9
  46. /package/{dist-npm → bin/deprecated}/components/levels/levels.js +0 -0
  47. /package/{dist-npm → bin/deprecated}/components/relinka/logger.js +0 -0
  48. /package/{dist-npm → bin/deprecated}/components/reporters/browser.js +0 -0
  49. /package/{dist-npm/main.d.ts → bin/deprecated/depd-main.js} +0 -0
  50. /package/{dist-npm → bin/deprecated}/types/mod.js +0 -0
  51. /package/{dist-npm → bin/deprecated}/utils/error.js +0 -0
  52. /package/{dist-npm → bin/deprecated}/utils/log.js +0 -0
  53. /package/{dist-npm → bin/deprecated}/utils/stream.js +0 -0
  54. /package/{dist-npm → bin/deprecated}/utils/string.js +0 -0
  55. /package/{dist-npm → bin/deprecated}/utils/tree.js +0 -0
@@ -1,69 +1,69 @@
1
- /**
2
- * Based on https://github.com/jorgebucaran/colorette
3
- * Read LICENSE file for more information
4
- * https://github.com/jorgebucaran/colorette/blob/20fc196d07d0f87c61e0256eadd7831c79b24108/index.js
5
- */
6
- declare const colorDefs: {
7
- reset: (string: string) => string;
8
- bold: (string: string) => string;
9
- dim: (string: string) => string;
10
- italic: (string: string) => string;
11
- underline: (string: string) => string;
12
- inverse: (string: string) => string;
13
- hidden: (string: string) => string;
14
- strikethrough: (string: string) => string;
15
- black: (string: string) => string;
16
- red: (string: string) => string;
17
- green: (string: string) => string;
18
- yellow: (string: string) => string;
19
- blue: (string: string) => string;
20
- magenta: (string: string) => string;
21
- cyan: (string: string) => string;
22
- white: (string: string) => string;
23
- gray: (string: string) => string;
24
- bgBlack: (string: string) => string;
25
- bgRed: (string: string) => string;
26
- bgGreen: (string: string) => string;
27
- bgYellow: (string: string) => string;
28
- bgBlue: (string: string) => string;
29
- bgMagenta: (string: string) => string;
30
- bgCyan: (string: string) => string;
31
- bgWhite: (string: string) => string;
32
- blackBright: (string: string) => string;
33
- redBright: (string: string) => string;
34
- greenBright: (string: string) => string;
35
- yellowBright: (string: string) => string;
36
- blueBright: (string: string) => string;
37
- magentaBright: (string: string) => string;
38
- cyanBright: (string: string) => string;
39
- whiteBright: (string: string) => string;
40
- bgBlackBright: (string: string) => string;
41
- bgRedBright: (string: string) => string;
42
- bgGreenBright: (string: string) => string;
43
- bgYellowBright: (string: string) => string;
44
- bgBlueBright: (string: string) => string;
45
- bgMagentaBright: (string: string) => string;
46
- bgCyanBright: (string: string) => string;
47
- bgWhiteBright: (string: string) => string;
48
- };
49
- export type ColorName = keyof typeof colorDefs;
50
- export type ColorFunction = (text: string | number) => string;
51
- /**
52
- * An object containing functions for coloring text. Each function corresponds to a terminal color. See {@link ColorName} for available colors.
53
- */
54
- export declare const colors: Record<ColorName, ColorFunction>;
55
- /**
56
- * Gets a color function by name, with an option for a fallback color if the requested color is not found.
57
- * @param {ColorName} color - The name of the color function to get. See {@link ColorName}.
58
- * @param {ColorName} [fallback="reset"] - The name of the fallback color function if the requested color is not found. See {@link ColorName}.
59
- * @returns {ColorFunction} The color function that corresponds to the requested color, or the fallback color function. See {@link ColorFunction}.
60
- */
61
- export declare function getColor(color: ColorName, fallback?: ColorName): ColorFunction;
62
- /**
63
- * Applies a specified color to a given text string or number.
64
- * @param {ColorName} color - The color to apply. See {@link ColorName}.
65
- * @param {string | number} text - The text to color.
66
- * @returns {string} The colored text.
67
- */
68
- export declare function colorize(color: ColorName, text: string | number): string;
69
- export {};
1
+ /**
2
+ * Based on https://github.com/jorgebucaran/colorette
3
+ * Read LICENSE file for more information
4
+ * https://github.com/jorgebucaran/colorette/blob/20fc196d07d0f87c61e0256eadd7831c79b24108/index.js
5
+ */
6
+ declare const colorDefs: {
7
+ reset: (string: string) => string;
8
+ bold: (string: string) => string;
9
+ dim: (string: string) => string;
10
+ italic: (string: string) => string;
11
+ underline: (string: string) => string;
12
+ inverse: (string: string) => string;
13
+ hidden: (string: string) => string;
14
+ strikethrough: (string: string) => string;
15
+ black: (string: string) => string;
16
+ red: (string: string) => string;
17
+ green: (string: string) => string;
18
+ yellow: (string: string) => string;
19
+ blue: (string: string) => string;
20
+ magenta: (string: string) => string;
21
+ cyan: (string: string) => string;
22
+ white: (string: string) => string;
23
+ gray: (string: string) => string;
24
+ bgBlack: (string: string) => string;
25
+ bgRed: (string: string) => string;
26
+ bgGreen: (string: string) => string;
27
+ bgYellow: (string: string) => string;
28
+ bgBlue: (string: string) => string;
29
+ bgMagenta: (string: string) => string;
30
+ bgCyan: (string: string) => string;
31
+ bgWhite: (string: string) => string;
32
+ blackBright: (string: string) => string;
33
+ redBright: (string: string) => string;
34
+ greenBright: (string: string) => string;
35
+ yellowBright: (string: string) => string;
36
+ blueBright: (string: string) => string;
37
+ magentaBright: (string: string) => string;
38
+ cyanBright: (string: string) => string;
39
+ whiteBright: (string: string) => string;
40
+ bgBlackBright: (string: string) => string;
41
+ bgRedBright: (string: string) => string;
42
+ bgGreenBright: (string: string) => string;
43
+ bgYellowBright: (string: string) => string;
44
+ bgBlueBright: (string: string) => string;
45
+ bgMagentaBright: (string: string) => string;
46
+ bgCyanBright: (string: string) => string;
47
+ bgWhiteBright: (string: string) => string;
48
+ };
49
+ export type ColorName = keyof typeof colorDefs;
50
+ export type ColorFunction = (text: string | number) => string;
51
+ /**
52
+ * An object containing functions for coloring text. Each function corresponds to a terminal color. See {@link ColorName} for available colors.
53
+ */
54
+ export declare const colors: Record<"bold" | "reset" | "dim" | "italic" | "underline" | "inverse" | "hidden" | "strikethrough" | "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "bgBlack" | "bgRed" | "bgGreen" | "bgYellow" | "bgBlue" | "bgMagenta" | "bgCyan" | "bgWhite" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright" | "bgBlackBright" | "bgRedBright" | "bgGreenBright" | "bgYellowBright" | "bgBlueBright" | "bgMagentaBright" | "bgCyanBright" | "bgWhiteBright", ColorFunction>;
55
+ /**
56
+ * Gets a color function by name, with an option for a fallback color if the requested color is not found.
57
+ * @param {ColorName} color - The name of the color function to get. See {@link ColorName}.
58
+ * @param {ColorName} [fallback="reset"] - The name of the fallback color function if the requested color is not found. See {@link ColorName}.
59
+ * @returns {ColorFunction} The color function that corresponds to the requested color, or the fallback color function. See {@link ColorFunction}.
60
+ */
61
+ export declare function getColor(color: ColorName, fallback?: ColorName): ColorFunction;
62
+ /**
63
+ * Applies a specified color to a given text string or number.
64
+ * @param {ColorName} color - The color to apply. See {@link ColorName}.
65
+ * @param {string | number} text - The text to color.
66
+ * @returns {string} The colored text.
67
+ */
68
+ export declare function colorize(color: ColorName, text: string | number): string;
69
+ export {};
@@ -7,10 +7,10 @@ const {
7
7
  const isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
8
8
  const isForced = "FORCE_COLOR" in env || argv.includes("--color");
9
9
  const isWindows = platform === "win32";
10
- const isDumbTerminal = env["TERM"] === "dumb";
10
+ const isDumbTerminal = env.TERM === "dumb";
11
11
  const isCompatibleTerminal = (
12
12
  // eslint-disable-next-line @typescript-eslint/prefer-optional-chain
13
- tty && tty.isatty && tty.isatty(1) && env["TERM"] && !isDumbTerminal
13
+ tty?.isatty?.(1) && env.TERM && !isDumbTerminal
14
14
  );
15
15
  const isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
16
16
  const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
@@ -21,13 +21,7 @@ function clearBleed(index, string, open, close, replace) {
21
21
  return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
22
22
  }
23
23
  function filterEmpty(open, close, replace = open, at = open.length + 1) {
24
- return (string) => string || !(string === "" || string === void 0) ? clearBleed(
25
- ("" + string).indexOf(close, at),
26
- string,
27
- open,
28
- close,
29
- replace
30
- ) : "";
24
+ return (string) => string || !(string === "" || string === void 0) ? clearBleed(`${string}`.indexOf(close, at), string, open, close, replace) : "";
31
25
  }
32
26
  function init(open, close, replace) {
33
27
  return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
@@ -1,6 +1,6 @@
1
- /**
2
- * Parses a stack trace string and normalizes its paths by removing the current working directory and the "file://" protocol.
3
- * @param {string} stack - The stack trace string.
4
- * @returns {string[]} An array of stack trace lines with normalized paths.
5
- */
6
- export declare function parseStack(stack: string): string[];
1
+ /**
2
+ * Parses a stack trace string and normalizes its paths by removing the current working directory and the "file://" protocol.
3
+ * @param {string} stack - The stack trace string.
4
+ * @returns {string[]} An array of stack trace lines with normalized paths.
5
+ */
6
+ export declare function parseStack(stack: string): string[];
@@ -1,14 +1,14 @@
1
- /**
2
- * Compiles a format string by replacing placeholders with appropriate position indices.
3
- * Caches compiled formats for efficiency.
4
- * @param {string} format - The format string containing the placeholders to replace.
5
- * @returns {string} The compiled format string with placeholders replaced by positional indices.
6
- */
7
- export declare function compileFormat(format: string): any;
8
- /**
9
- * Formats a string according to a custom format, using vsprintf for string formatting.
10
- * @param {string} format - The custom format string.
11
- * @param {any[]} argv - The arguments to format into the string.
12
- * @returns {string} The formatted string.
13
- */
14
- export declare function formatString(format: string, argv: any): string;
1
+ /**
2
+ * Compiles a format string by replacing placeholders with appropriate position indices.
3
+ * Caches compiled formats for efficiency.
4
+ * @param {string} format - The format string containing the placeholders to replace.
5
+ * @returns {string} The compiled format string with placeholders replaced by positional indices.
6
+ */
7
+ export declare function compileFormat(format: string): any;
8
+ /**
9
+ * Formats a string according to a custom format, using vsprintf for string formatting.
10
+ * @param {string} format - The custom format string.
11
+ * @param {any[]} argv - The arguments to format into the string.
12
+ * @returns {string} The formatted string.
13
+ */
14
+ export declare function formatString(format: string, argv: any): string;
@@ -14,8 +14,8 @@ export function compileFormat(format) {
14
14
  let _format = format;
15
15
  for (const arg of FORMAT_ARGS) {
16
16
  _format = _format.replace(
17
- new RegExp("([%-])" + arg[0], "g"),
18
- "$1" + arg[1]
17
+ new RegExp(`([%-])${arg[0]}`, "g"),
18
+ `$1${arg[1]}`
19
19
  );
20
20
  }
21
21
  _compileCache[format] = _format;
@@ -1,13 +1,13 @@
1
- /**
2
- * Checks if the given argument is a simple JavaScript object.
3
- * @param {any} obj - The object to test.
4
- * @returns {boolean} `true` if the argument is a plain object, otherwise `false`.
5
- */
6
- export declare function isPlainObject(obj: any): boolean;
7
- /**
8
- * Determines whether the given argument is a protocol object. A log object must be a simple object and
9
- * must contain either a 'message' or 'args' field, but not a 'stack' field.
10
- * @param {any} arg - The argument to check.
11
- * @returns {boolean} `true` if the argument is a log object according to the specified criteria, otherwise `false`.
12
- */
13
- export declare function isLogObj(arg: any): boolean;
1
+ /**
2
+ * Checks if the given argument is a simple JavaScript object.
3
+ * @param {any} obj - The object to test.
4
+ * @returns {boolean} `true` if the argument is a plain object, otherwise `false`.
5
+ */
6
+ export declare function isPlainObject(obj: any): boolean;
7
+ /**
8
+ * Determines whether the given argument is a protocol object. A log object must be a simple object and
9
+ * must contain either a 'message' or 'args' field, but not a 'stack' field.
10
+ * @param {any} arg - The argument to check.
11
+ * @returns {boolean} `true` if the argument is a log object according to the specified criteria, otherwise `false`.
12
+ */
13
+ export declare function isLogObj(arg: any): boolean;
@@ -0,0 +1,3 @@
1
+ export * from "./box.js";
2
+ export * from "./deprecatedColors.js";
3
+ export { stripAnsi, centerAlign, rightAlign, leftAlign, align, } from "./string.js";
@@ -0,0 +1,9 @@
1
+ export * from "./box.js";
2
+ export * from "./deprecatedColors.js";
3
+ export {
4
+ stripAnsi,
5
+ centerAlign,
6
+ rightAlign,
7
+ leftAlign,
8
+ align
9
+ } from "./string.js";
@@ -1,14 +1,15 @@
1
- /**
2
- * Writes data to a specified NodeJS writable stream. This function supports streams that have a custom
3
- * `__write' method, and will fall back to the default `write' method if `__write' is not present.
4
- *
5
- * @param {any} data - The data to write to the stream. This can be a string, a buffer, or any data type
6
- * supported by the stream's `write' or `__write' method.
7
- * @param {NodeJS.WriteStream} stream - The writable stream to write the data to. This stream
8
- * must implement the `write' method, and can optionally implement a custom `__write' method.
9
- * @returns {boolean} `true` if the data has been completely processed by the write operation,
10
- * indicating that further writes can be performed immediately. Returns `false` if the data is
11
- * buffered by the stream, indicating that the `drain` event should be waited for before writing
12
- * more data.
13
- */
14
- export declare function writeStream(data: any, stream: NodeJS.WriteStream): any;
1
+ /// <reference types="node" />
2
+ /**
3
+ * Writes data to a specified NodeJS writable stream. This function supports streams that have a custom
4
+ * `__write' method, and will fall back to the default `write' method if `__write' is not present.
5
+ *
6
+ * @param {any} data - The data to write to the stream. This can be a string, a buffer, or any data type
7
+ * supported by the stream's `write' or `__write' method.
8
+ * @param {NodeJS.WriteStream} stream - The writable stream to write the data to. This stream
9
+ * must implement the `write' method, and can optionally implement a custom `__write' method.
10
+ * @returns {boolean} `true` if the data has been completely processed by the write operation,
11
+ * indicating that further writes can be performed immediately. Returns `false` if the data is
12
+ * buffered by the stream, indicating that the `drain` event should be waited for before writing
13
+ * more data.
14
+ */
15
+ export declare function writeStream(data: any, stream: NodeJS.WriteStream): any;
@@ -1,50 +1,50 @@
1
- /**
2
- * Removes ANSI escape codes from a given string. This is particularly useful for
3
- * processing text that contains formatting codes, such as colors or styles, so that the
4
- * the raw text without any visual formatting.
5
- *
6
- * @param {string} text - The text string from which to strip the ANSI escape codes.
7
- * @returns {string} The text without ANSI escape codes.
8
- */
9
- export declare function stripAnsi(text: string): string;
10
- /**
11
- * Centers a string within a specified total width, padding it with spaces or another specified character.
12
- * If the string is longer than the total width, it is returned as is.
13
- *
14
- * @param {string} str - The string to centre.
15
- * @param {number} len - The total width in which to centre the string.
16
- * @param {string} [space=" "] - The character to use for padding. Defaults to a space.
17
- * @returns {string} The centred string.
18
- */
19
- export declare function centerAlign(str: string, len: number, space?: string): string;
20
- /**
21
- * Right-justifies a string within a given total width, padding it with whitespace or another specified character.
22
- * If the string is longer than the total width, it is returned as is.
23
- *
24
- * @param {string} str - The string to right-justify.
25
- * @param {number} len - The total width to align the string.
26
- * @param {string} [space=" "] - The character to use for padding. Defaults to a space.
27
- * @returns {string} The right-justified string.
28
- */
29
- export declare function rightAlign(str: string, len: number, space?: string): string;
30
- /**
31
- * Left-aligns a string within a given total width, padding it with whitespace or another specified character on the right.
32
- * If the string is longer than the total width, it is returned as is.
33
- *
34
- * @param {string} str - The string to align left.
35
- * @param {number} len - The total width to align the string.
36
- * @param {string} [space=" "] - The character to use for padding. Defaults to a space.
37
- * @returns {string} The left-justified string.
38
- */
39
- export declare function leftAlign(str: string, len: number, space?: string): string;
40
- /**
41
- * Aligns a string (left, right, or centre) within a given total width, padding it with spaces or another specified character.
42
- * If the string is longer than the total width, it is returned as is. This function acts as a wrapper for individual alignment functions.
43
- *
44
- * @param {"left" | "right" | "centre"} alignment - The desired alignment of the string.
45
- * @param {string} str - The string to align.
46
- * @param {number} len - The total width in which to align the string.
47
- * @param {string} [space=" "] - The character to use for padding. Defaults to a space.
48
- * @returns {string} The aligned string, according to the given alignment.
49
- */
50
- export declare function align(alignment: "left" | "right" | "center", str: string, len: number, space?: string): string;
1
+ /**
2
+ * Removes ANSI escape codes from a given string. This is particularly useful for
3
+ * processing text that contains formatting codes, such as colors or styles, so that the
4
+ * the raw text without any visual formatting.
5
+ *
6
+ * @param {string} text - The text string from which to strip the ANSI escape codes.
7
+ * @returns {string} The text without ANSI escape codes.
8
+ */
9
+ export declare function stripAnsi(text: string): string;
10
+ /**
11
+ * Centers a string within a specified total width, padding it with spaces or another specified character.
12
+ * If the string is longer than the total width, it is returned as is.
13
+ *
14
+ * @param {string} str - The string to centre.
15
+ * @param {number} len - The total width in which to centre the string.
16
+ * @param {string} [space=" "] - The character to use for padding. Defaults to a space.
17
+ * @returns {string} The centred string.
18
+ */
19
+ export declare function centerAlign(str: string, len: number, space?: string): string;
20
+ /**
21
+ * Right-justifies a string within a given total width, padding it with whitespace or another specified character.
22
+ * If the string is longer than the total width, it is returned as is.
23
+ *
24
+ * @param {string} str - The string to right-justify.
25
+ * @param {number} len - The total width to align the string.
26
+ * @param {string} [space=" "] - The character to use for padding. Defaults to a space.
27
+ * @returns {string} The right-justified string.
28
+ */
29
+ export declare function rightAlign(str: string, len: number, space?: string): string;
30
+ /**
31
+ * Left-aligns a string within a given total width, padding it with whitespace or another specified character on the right.
32
+ * If the string is longer than the total width, it is returned as is.
33
+ *
34
+ * @param {string} str - The string to align left.
35
+ * @param {number} len - The total width to align the string.
36
+ * @param {string} [space=" "] - The character to use for padding. Defaults to a space.
37
+ * @returns {string} The left-justified string.
38
+ */
39
+ export declare function leftAlign(str: string, len: number, space?: string): string;
40
+ /**
41
+ * Aligns a string (left, right, or centre) within a given total width, padding it with spaces or another specified character.
42
+ * If the string is longer than the total width, it is returned as is. This function acts as a wrapper for individual alignment functions.
43
+ *
44
+ * @param {"left" | "right" | "centre"} alignment - The desired alignment of the string.
45
+ * @param {string} str - The string to align.
46
+ * @param {number} len - The total width in which to align the string.
47
+ * @param {string} [space=" "] - The character to use for padding. Defaults to a space.
48
+ * @returns {string} The aligned string, according to the given alignment.
49
+ */
50
+ export declare function align(alignment: "left" | "right" | "center", str: string, len: number, space?: string): string;
@@ -1,41 +1,41 @@
1
- import { type ColorName } from "./deprecatedColors.js";
2
- export type TreeItemObject = {
3
- /**
4
- * Text of the item
5
- */
6
- text: string;
7
- /**
8
- * Children of the item
9
- */
10
- children?: TreeItem[];
11
- /**
12
- * Color of the item
13
- */
14
- color?: ColorName;
15
- };
16
- export type TreeItem = string | TreeItemObject;
17
- export type TreeOptions = {
18
- /**
19
- * Color of the tree
20
- */
21
- color?: ColorName;
22
- /**
23
- * Prefix of the tree
24
- *
25
- * @default " "
26
- */
27
- prefix?: string;
28
- };
29
- /**
30
- * Formats a hierarchical list of items into a string representing a tree structure.
31
- * Each item in the tree can be a simple string or an object defining the text of the item,
32
- * optional children, and color. The tree structure can be customized with options
33
- * Specify the overall color and the prefix used for indentation and tree lines.
34
- *
35
- * @param {TreeItem[]} items - An array of items to include in the tree. Each item can be
36
- * either a string or an object with `text', `children' and `color' properties.
37
- * @param {TreeOptions} [options] - Optional settings to customize the appearance of the tree, including
38
- * the color of the tree text and the prefix for branches. See {@link TreeOptions}.
39
- * @returns {string} The formatted tree as a string, ready for printing to the console or elsewhere.
40
- */
41
- export declare function formatTree(items: TreeItem[], options?: TreeOptions): string;
1
+ import { type ColorName } from "./deprecatedColors.js";
2
+ export type TreeItemObject = {
3
+ /**
4
+ * Text of the item
5
+ */
6
+ text: string;
7
+ /**
8
+ * Children of the item
9
+ */
10
+ children?: TreeItem[];
11
+ /**
12
+ * Color of the item
13
+ */
14
+ color?: ColorName;
15
+ };
16
+ export type TreeItem = string | TreeItemObject;
17
+ export type TreeOptions = {
18
+ /**
19
+ * Color of the tree
20
+ */
21
+ color?: ColorName;
22
+ /**
23
+ * Prefix of the tree
24
+ *
25
+ * @default " "
26
+ */
27
+ prefix?: string;
28
+ };
29
+ /**
30
+ * Formats a hierarchical list of items into a string representing a tree structure.
31
+ * Each item in the tree can be a simple string or an object defining the text of the item,
32
+ * optional children, and color. The tree structure can be customized with options
33
+ * Specify the overall color and the prefix used for indentation and tree lines.
34
+ *
35
+ * @param {TreeItem[]} items - An array of items to include in the tree. Each item can be
36
+ * either a string or an object with `text', `children' and `color' properties.
37
+ * @param {TreeOptions} [options] - Optional settings to customize the appearance of the tree, including
38
+ * the color of the tree text and the prefix for branches. See {@link TreeOptions}.
39
+ * @returns {string} The formatted tree as a string, ready for printing to the console or elsewhere.
40
+ */
41
+ export declare function formatTree(items: TreeItem[], options?: TreeOptions): string;
package/bin/main.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./deprecated/depd-main.js";
package/bin/main.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./deprecated/depd-main.js";