@decaf-ts/utils 0.2.6 → 0.2.7

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 (72) hide show
  1. package/bin/build-scripts.cjs +1018 -996
  2. package/bin/tag-release.cjs +1023 -1005
  3. package/bin/update-scripts.cjs +1016 -998
  4. package/dist/utils.cjs +83 -544
  5. package/dist/utils.esm.cjs +75 -530
  6. package/lib/cli/command.cjs +6 -7
  7. package/lib/cli/command.d.ts +5 -5
  8. package/lib/cli/commands/build-scripts.cjs +7 -3
  9. package/lib/cli/commands/build-scripts.d.ts +1 -1
  10. package/lib/cli/commands/tag-release.cjs +1 -1
  11. package/lib/cli/commands/tag-release.d.ts +1 -1
  12. package/lib/cli/commands/update-scripts.cjs +1 -1
  13. package/lib/cli/commands/update-scripts.d.ts +1 -1
  14. package/lib/cli/types.cjs +1 -1
  15. package/lib/cli/types.d.ts +1 -1
  16. package/lib/esm/cli/command.d.ts +5 -5
  17. package/lib/esm/cli/command.js +2 -3
  18. package/lib/esm/cli/commands/build-scripts.d.ts +1 -1
  19. package/lib/esm/cli/commands/build-scripts.js +7 -3
  20. package/lib/esm/cli/commands/tag-release.d.ts +1 -1
  21. package/lib/esm/cli/commands/tag-release.js +1 -1
  22. package/lib/esm/cli/commands/update-scripts.d.ts +1 -1
  23. package/lib/esm/cli/commands/update-scripts.js +1 -1
  24. package/lib/esm/cli/types.d.ts +1 -1
  25. package/lib/esm/cli/types.js +1 -1
  26. package/lib/esm/index.d.ts +2 -2
  27. package/lib/esm/index.js +2 -2
  28. package/lib/esm/input/input.d.ts +1 -2
  29. package/lib/esm/input/input.js +2 -2
  30. package/lib/esm/input/types.d.ts +83 -0
  31. package/lib/esm/input/types.js +1 -1
  32. package/lib/esm/output/common.d.ts +3 -3
  33. package/lib/esm/output/common.js +2 -2
  34. package/lib/esm/output/index.d.ts +1 -3
  35. package/lib/esm/output/index.js +2 -4
  36. package/lib/esm/utils/constants.d.ts +0 -77
  37. package/lib/esm/utils/constants.js +1 -114
  38. package/lib/esm/utils/fs.js +2 -2
  39. package/lib/esm/utils/http.d.ts +1 -1
  40. package/lib/esm/utils/http.js +2 -2
  41. package/lib/esm/utils/utils.d.ts +2 -2
  42. package/lib/esm/utils/utils.js +2 -2
  43. package/lib/esm/writers/StandardOutputWriter.d.ts +2 -2
  44. package/lib/esm/writers/StandardOutputWriter.js +2 -2
  45. package/lib/index.cjs +2 -2
  46. package/lib/index.d.ts +2 -2
  47. package/lib/input/input.cjs +2 -2
  48. package/lib/input/input.d.ts +1 -2
  49. package/lib/input/types.cjs +1 -1
  50. package/lib/input/types.d.ts +83 -0
  51. package/lib/output/common.cjs +2 -2
  52. package/lib/output/common.d.ts +3 -3
  53. package/lib/output/index.cjs +1 -3
  54. package/lib/output/index.d.ts +1 -3
  55. package/lib/utils/constants.cjs +2 -115
  56. package/lib/utils/constants.d.ts +0 -77
  57. package/lib/utils/fs.cjs +2 -2
  58. package/lib/utils/http.cjs +2 -2
  59. package/lib/utils/http.d.ts +1 -1
  60. package/lib/utils/utils.cjs +2 -2
  61. package/lib/utils/utils.d.ts +2 -2
  62. package/lib/writers/StandardOutputWriter.cjs +2 -2
  63. package/lib/writers/StandardOutputWriter.d.ts +2 -2
  64. package/package.json +3 -1
  65. package/lib/esm/output/logging.d.ts +0 -177
  66. package/lib/esm/output/logging.js +0 -349
  67. package/lib/esm/output/types.d.ts +0 -203
  68. package/lib/esm/output/types.js +0 -2
  69. package/lib/output/logging.cjs +0 -354
  70. package/lib/output/logging.d.ts +0 -177
  71. package/lib/output/types.cjs +0 -3
  72. package/lib/output/types.d.ts +0 -203
@@ -1,203 +0,0 @@
1
- import { LogLevel } from "../utils/constants";
2
- import { styles } from "styled-string-builder";
3
- export type StringLike = string | {
4
- toString: () => string;
5
- };
6
- export type LoggingContext = string | {
7
- new (...args: any[]): any;
8
- } | ((...args: any[]) => any);
9
- /**
10
- * @description Interface for a logger with verbosity levels.
11
- * @summary Defines methods for logging at different verbosity levels.
12
- * @interface VerbosityLogger
13
- * @memberOf @decaf-ts/utils
14
- */
15
- export interface VerbosityLogger {
16
- /**
17
- * @description Logs a `way too verbose` or a silly message.
18
- * @param {StringLike} msg - The message to log.
19
- */
20
- silly(msg: StringLike): void;
21
- /**
22
- * @description Logs a verbose message.
23
- * @param {StringLike} msg - The message to log.
24
- * @param {number} verbosity - The verbosity level of the message.
25
- */
26
- verbose(msg: StringLike, verbosity?: number): void;
27
- /**
28
- * @description Logs an info message.
29
- * @param {StringLike} msg - The message to log.
30
- */
31
- info(msg: StringLike): void;
32
- /**
33
- * @description Logs an error message.
34
- * @param {StringLike | Error} msg - The message to log.
35
- */
36
- error(msg: StringLike | Error): void;
37
- /**
38
- * @description Logs a debug message.
39
- * @param {string} msg - The message to log.
40
- */
41
- debug(msg: StringLike): void;
42
- for(method?: string | ((...args: any[]) => any), config?: Partial<LoggingConfig>): VerbosityLogger;
43
- setConfig(config: Partial<LoggingConfig>): void;
44
- }
45
- /**
46
- * @description Configuration for logging.
47
- * @summary Defines the log level and verbosity for logging.
48
- * @typedef {Object} LoggingConfig
49
- * @property {LogLevel} level - The logging level.
50
- * @property {number} verbose - The verbosity level.
51
- * @memberOf @decaf-ts/utils
52
- */
53
- export type LoggingConfig = {
54
- level: LogLevel;
55
- logLevel?: boolean;
56
- verbose: number;
57
- separator: string;
58
- style?: boolean;
59
- timestamp?: boolean;
60
- timestampFormat?: string;
61
- context?: boolean;
62
- theme?: Theme;
63
- };
64
- /**
65
- /**
66
- * @description Represents a theme option for console output styling.
67
- * @summary Defines the structure for styling a specific element in the console output.
68
- * It allows for customization of foreground color, background color, and additional styles.
69
- * Colors can be specified as a single number, an RGB array, or left undefined for default.
70
- *
71
- * @interface ThemeOption
72
- * @memberOf @decaf-ts/utils
73
- */
74
- export interface ThemeOption {
75
- fg?: number | [number] | [number, number, number];
76
- bg?: number | [number] | [number, number, number];
77
- style?: number[] | [keyof typeof styles];
78
- }
79
- export type ThemeOptionByLogLevel = Partial<Record<LogLevel, ThemeOption>>;
80
- /**
81
- /**
82
- * @description Defines the color theme for console output.
83
- * @summary This interface specifies the color scheme for various elements of console output,
84
- * including styling for different log levels and components. It uses ThemeOption to
85
- * define the styling for each element, allowing for customization of colors and styles
86
- * for different parts of the log output.
87
- *
88
- * @interface Theme
89
- * @memberOf @decaf-ts/utils
90
- */
91
- export interface Theme {
92
- /**
93
- * @description Styling for class names in the output.
94
- */
95
- class: ThemeOption | ThemeOptionByLogLevel;
96
- /**
97
- * @description Styling for timestamps in the output.
98
- */
99
- timestamp: ThemeOption | ThemeOptionByLogLevel;
100
- /**
101
- * @description Styling for the main message text in the output.
102
- */
103
- message: ThemeOption | ThemeOptionByLogLevel;
104
- /**
105
- * @description Styling for method names in the output.
106
- */
107
- method: ThemeOption | ThemeOptionByLogLevel;
108
- /**
109
- * @description Styling for identifier elements in the output.
110
- */
111
- id: ThemeOption | ThemeOptionByLogLevel;
112
- /**
113
- * @description Styling for identifier elements in the output.
114
- */
115
- stack: ThemeOption;
116
- /**
117
- * @description Styling for different log levels in the output.
118
- */
119
- logLevel: ThemeOptionByLogLevel;
120
- }
121
- /**
122
- * @description Represents a color function in the Kleur library.
123
- * @summary The Color interface defines a function that can be called with or without arguments
124
- * to apply color styling to text or chain multiple color operations.
125
- *
126
- * @interface Color
127
- * @memberOf module:@decaf-ts/utils
128
- * */
129
- export interface Color {
130
- /**
131
- * @description Applies the color to the given text.
132
- * @param {string | number} x - The text or number to be colored.
133
- * @return {string} The colored text.
134
- */
135
- (x: string | number): string;
136
- /**
137
- * @description Allows chaining of multiple color operations.
138
- * @return {Kleur} The Kleur instance for method chaining.
139
- */
140
- (): Kleur;
141
- }
142
- /**
143
- * @description Represents the main Kleur interface with all available color and style methods.
144
- * @summary The Kleur interface provides methods for applying various colors, background colors,
145
- * and text styles to strings in terminal output.
146
- *
147
- * @interface Kleur
148
- * @memberOf module:@decaf-ts/utils
149
- */
150
- export interface Kleur {
151
- /** @description Applies black color to the text. */
152
- black: Color;
153
- /** @description Applies red color to the text. */
154
- red: Color;
155
- /** @description Applies green color to the text. */
156
- green: Color;
157
- /** @description Applies yellow color to the text. */
158
- yellow: Color;
159
- /** @description Applies blue color to the text. */
160
- blue: Color;
161
- /** @description Applies magenta color to the text. */
162
- magenta: Color;
163
- /** @description Applies cyan color to the text. */
164
- cyan: Color;
165
- /** @description Applies white color to the text. */
166
- white: Color;
167
- /** @description Applies gray color to the text. */
168
- gray: Color;
169
- /** @description Alias for gray color. */
170
- grey: Color;
171
- /** @description Applies black background to the text. */
172
- bgBlack: Color;
173
- /** @description Applies red background to the text. */
174
- bgRed: Color;
175
- /** @description Applies green background to the text. */
176
- bgGreen: Color;
177
- /** @description Applies yellow background to the text. */
178
- bgYellow: Color;
179
- /** @description Applies blue background to the text. */
180
- bgBlue: Color;
181
- /** @description Applies magenta background to the text. */
182
- bgMagenta: Color;
183
- /** @description Applies cyan background to the text. */
184
- bgCyan: Color;
185
- /** @description Applies white background to the text. */
186
- bgWhite: Color;
187
- /** @description Resets all applied styles. */
188
- reset: Color;
189
- /** @description Applies bold style to the text. */
190
- bold: Color;
191
- /** @description Applies dim (decreased intensity) style to the text. */
192
- dim: Color;
193
- /** @description Applies italic style to the text. */
194
- italic: Color;
195
- /** @description Applies underline style to the text. */
196
- underline: Color;
197
- /** @description Inverts the foreground and background colors. */
198
- inverse: Color;
199
- /** @description Hides the text (same color as background). */
200
- hidden: Color;
201
- /** @description Applies strikethrough style to the text. */
202
- strikethrough: Color;
203
- }