@ix-xs/node-comfort 1.2.0 → 2.0.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.
Files changed (75) hide show
  1. package/CHANGELOG.md +190 -0
  2. package/README.md +136 -549
  3. package/index.js +80 -35
  4. package/package.json +160 -33
  5. package/src/Arr.js +887 -419
  6. package/src/Async.js +585 -0
  7. package/src/Cache.js +329 -0
  8. package/src/Checker.js +971 -539
  9. package/src/Cli.js +1034 -0
  10. package/src/Color.js +415 -0
  11. package/src/Crypto.js +707 -0
  12. package/src/Emitter.js +289 -0
  13. package/src/Env.js +555 -0
  14. package/src/FS.js +1483 -894
  15. package/src/Func.js +670 -353
  16. package/src/Http.js +538 -0
  17. package/src/Id.js +384 -201
  18. package/src/Logger.js +739 -378
  19. package/src/Num.js +844 -361
  20. package/src/Obj.js +855 -372
  21. package/src/SQLite.js +1308 -1005
  22. package/src/Schema.js +1586 -0
  23. package/src/Str.js +983 -436
  24. package/src/Sys.js +511 -0
  25. package/src/Time.js +1260 -422
  26. package/src/Utils.js +321 -325
  27. package/src/errors.js +292 -0
  28. package/types/index.d.ts +693 -526
  29. package/types/src/Arr.d.ts +455 -145
  30. package/types/src/Arr.d.ts.map +1 -1
  31. package/types/src/Async.d.ts +321 -0
  32. package/types/src/Async.d.ts.map +1 -0
  33. package/types/src/Cache.d.ts +195 -0
  34. package/types/src/Cache.d.ts.map +1 -0
  35. package/types/src/Checker.d.ts +501 -235
  36. package/types/src/Checker.d.ts.map +1 -1
  37. package/types/src/Cli.d.ts +582 -0
  38. package/types/src/Cli.d.ts.map +1 -0
  39. package/types/src/Color.d.ts +294 -0
  40. package/types/src/Color.d.ts.map +1 -0
  41. package/types/src/Crypto.d.ts +534 -0
  42. package/types/src/Crypto.d.ts.map +1 -0
  43. package/types/src/Emitter.d.ts +170 -0
  44. package/types/src/Emitter.d.ts.map +1 -0
  45. package/types/src/Env.d.ts +382 -0
  46. package/types/src/Env.d.ts.map +1 -0
  47. package/types/src/FS.d.ts +686 -238
  48. package/types/src/FS.d.ts.map +1 -1
  49. package/types/src/Func.d.ts +380 -135
  50. package/types/src/Func.d.ts.map +1 -1
  51. package/types/src/Http.d.ts +374 -0
  52. package/types/src/Http.d.ts.map +1 -0
  53. package/types/src/Id.d.ts +149 -68
  54. package/types/src/Id.d.ts.map +1 -1
  55. package/types/src/Logger.d.ts +363 -46
  56. package/types/src/Logger.d.ts.map +1 -1
  57. package/types/src/Num.d.ts +473 -137
  58. package/types/src/Num.d.ts.map +1 -1
  59. package/types/src/Obj.d.ts +390 -104
  60. package/types/src/Obj.d.ts.map +1 -1
  61. package/types/src/SQLite.d.ts +646 -309
  62. package/types/src/SQLite.d.ts.map +1 -1
  63. package/types/src/Schema.d.ts +940 -0
  64. package/types/src/Schema.d.ts.map +1 -0
  65. package/types/src/Str.d.ts +569 -166
  66. package/types/src/Str.d.ts.map +1 -1
  67. package/types/src/Sys.d.ts +269 -0
  68. package/types/src/Sys.d.ts.map +1 -0
  69. package/types/src/Time.d.ts +663 -204
  70. package/types/src/Time.d.ts.map +1 -1
  71. package/types/src/Utils.d.ts +154 -102
  72. package/types/src/Utils.d.ts.map +1 -1
  73. package/types/src/errors.d.ts +292 -0
  74. package/types/src/errors.d.ts.map +1 -0
  75. package/types/index.d.ts.map +0 -1
@@ -0,0 +1,294 @@
1
+ export = color;
2
+ /** @type {ColorModule} */
3
+ declare const color: ColorModule;
4
+ declare namespace color {
5
+ export { StyleName, ColorLevel, ColorStyleProps, ColorStyles, ColorChain, ColorMethods, ColorModule, ColorHelpers, StyleEntry };
6
+ }
7
+ /**
8
+ * Every named style.
9
+ */
10
+ type StyleName = "reset" | "bold" | "dim" | "italic" | "underline" | "overline" | "inverse" | "hidden" | "strikethrough" | "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright" | "bgBlack" | "bgRed" | "bgGreen" | "bgYellow" | "bgBlue" | "bgMagenta" | "bgCyan" | "bgWhite" | "bgGray" | "bgGrey" | "bgBlackBright" | "bgRedBright" | "bgGreenBright" | "bgYellowBright" | "bgBlueBright" | "bgMagentaBright" | "bgCyanBright" | "bgWhiteBright";
11
+ /**
12
+ * How many colors the terminal can show: `0` none, `1` 16, `2` 256, `3` millions.
13
+ */
14
+ type ColorLevel = 0 | 1 | 2 | 3;
15
+ /**
16
+ * The named styles. Each one can be called on text or chained with others:
17
+ * `color.red("x")`, `color.red.bold.underline("x")`.
18
+ */
19
+ type ColorStyleProps = {
20
+ /**
21
+ * Removes all styles.
22
+ */
23
+ reset: ColorChain;
24
+ /**
25
+ * Bold text.
26
+ */
27
+ bold: ColorChain;
28
+ /**
29
+ * Faint text.
30
+ */
31
+ dim: ColorChain;
32
+ /**
33
+ * Italic text, where the terminal supports it.
34
+ */
35
+ italic: ColorChain;
36
+ /**
37
+ * Underlined text.
38
+ */
39
+ underline: ColorChain;
40
+ /**
41
+ * Line above the text, where supported.
42
+ */
43
+ overline: ColorChain;
44
+ /**
45
+ * Swaps text and background colors.
46
+ */
47
+ inverse: ColorChain;
48
+ /**
49
+ * Invisible text, still copyable.
50
+ */
51
+ hidden: ColorChain;
52
+ /**
53
+ * Crossed-out text.
54
+ */
55
+ strikethrough: ColorChain;
56
+ /**
57
+ * Black text.
58
+ */
59
+ black: ColorChain;
60
+ /**
61
+ * Red text.
62
+ */
63
+ red: ColorChain;
64
+ /**
65
+ * Green text.
66
+ */
67
+ green: ColorChain;
68
+ /**
69
+ * Yellow text.
70
+ */
71
+ yellow: ColorChain;
72
+ /**
73
+ * Blue text.
74
+ */
75
+ blue: ColorChain;
76
+ /**
77
+ * Magenta text.
78
+ */
79
+ magenta: ColorChain;
80
+ /**
81
+ * Cyan text.
82
+ */
83
+ cyan: ColorChain;
84
+ /**
85
+ * White text.
86
+ */
87
+ white: ColorChain;
88
+ /**
89
+ * Gray text.
90
+ */
91
+ gray: ColorChain;
92
+ /**
93
+ * Same as `gray`.
94
+ */
95
+ grey: ColorChain;
96
+ /**
97
+ * Bright black text.
98
+ */
99
+ blackBright: ColorChain;
100
+ /**
101
+ * Bright red text.
102
+ */
103
+ redBright: ColorChain;
104
+ /**
105
+ * Bright green text.
106
+ */
107
+ greenBright: ColorChain;
108
+ /**
109
+ * Bright yellow text.
110
+ */
111
+ yellowBright: ColorChain;
112
+ /**
113
+ * Bright blue text.
114
+ */
115
+ blueBright: ColorChain;
116
+ /**
117
+ * Bright magenta text.
118
+ */
119
+ magentaBright: ColorChain;
120
+ /**
121
+ * Bright cyan text.
122
+ */
123
+ cyanBright: ColorChain;
124
+ /**
125
+ * Bright white text.
126
+ */
127
+ whiteBright: ColorChain;
128
+ /**
129
+ * Black background.
130
+ */
131
+ bgBlack: ColorChain;
132
+ /**
133
+ * Red background.
134
+ */
135
+ bgRed: ColorChain;
136
+ /**
137
+ * Green background.
138
+ */
139
+ bgGreen: ColorChain;
140
+ /**
141
+ * Yellow background.
142
+ */
143
+ bgYellow: ColorChain;
144
+ /**
145
+ * Blue background.
146
+ */
147
+ bgBlue: ColorChain;
148
+ /**
149
+ * Magenta background.
150
+ */
151
+ bgMagenta: ColorChain;
152
+ /**
153
+ * Cyan background.
154
+ */
155
+ bgCyan: ColorChain;
156
+ /**
157
+ * White background.
158
+ */
159
+ bgWhite: ColorChain;
160
+ /**
161
+ * Gray background.
162
+ */
163
+ bgGray: ColorChain;
164
+ /**
165
+ * Same as `bgGray`.
166
+ */
167
+ bgGrey: ColorChain;
168
+ /**
169
+ * Bright black background.
170
+ */
171
+ bgBlackBright: ColorChain;
172
+ /**
173
+ * Bright red background.
174
+ */
175
+ bgRedBright: ColorChain;
176
+ /**
177
+ * Bright green background.
178
+ */
179
+ bgGreenBright: ColorChain;
180
+ /**
181
+ * Bright yellow background.
182
+ */
183
+ bgYellowBright: ColorChain;
184
+ /**
185
+ * Bright blue background.
186
+ */
187
+ bgBlueBright: ColorChain;
188
+ /**
189
+ * Bright magenta background.
190
+ */
191
+ bgMagentaBright: ColorChain;
192
+ /**
193
+ * Bright cyan background.
194
+ */
195
+ bgCyanBright: ColorChain;
196
+ /**
197
+ * Bright white background.
198
+ */
199
+ bgWhiteBright: ColorChain;
200
+ };
201
+ /**
202
+ * The named styles, read-only.
203
+ */
204
+ type ColorStyles = Readonly<ColorStyleProps>;
205
+ /**
206
+ * A style you can call on text, or chain with more styles.
207
+ */
208
+ type ColorChain = ((...text: unknown[]) => string) & ColorStyles & ColorMethods;
209
+ /**
210
+ * Custom colors, available on every chain.
211
+ */
212
+ type ColorMethods = {
213
+ /**
214
+ * Text color from red, green and blue (0-255).
215
+ */
216
+ rgb: (r: number, g: number, b: number) => ColorChain;
217
+ /**
218
+ * Background from red, green and blue (0-255).
219
+ */
220
+ bgRgb: (r: number, g: number, b: number) => ColorChain;
221
+ /**
222
+ * Text color from a hex code like `"#f80"`.
223
+ */
224
+ hex: (hex: string) => ColorChain;
225
+ /**
226
+ * Background from a hex code.
227
+ */
228
+ bgHex: (hex: string) => ColorChain;
229
+ /**
230
+ * Text color from the 256-color palette.
231
+ */
232
+ ansi256: (code: number) => ColorChain;
233
+ /**
234
+ * Background from the 256-color palette.
235
+ */
236
+ bgAnsi256: (code: number) => ColorChain;
237
+ };
238
+ /**
239
+ * `nc.color`: every style and color, plus a few helpers.
240
+ */
241
+ type ColorModule = ColorStyles & ColorMethods & ColorHelpers;
242
+ /**
243
+ * Color helpers.
244
+ */
245
+ type ColorHelpers = {
246
+ /**
247
+ * The current color level. Set it to force one; `0` turns colors off.
248
+ */
249
+ level: ColorLevel;
250
+ /**
251
+ * Whether colors are being output.
252
+ */
253
+ enabled: boolean;
254
+ /**
255
+ * A separate instance with its own level, for another stream or for tests.
256
+ */
257
+ create: (level?: ColorLevel) => ColorModule;
258
+ /**
259
+ * The color level a stream supports, taking `NO_COLOR` and `FORCE_COLOR` into account.
260
+ */
261
+ detect: (stream?: NodeJS.WriteStream | {
262
+ isTTY?: boolean;
263
+ }) => ColorLevel;
264
+ /**
265
+ * Removes colors and other terminal escape codes.
266
+ */
267
+ strip: (text: string) => string;
268
+ /**
269
+ * How many columns the text takes, ignoring colors and counting emoji and CJK as 2.
270
+ */
271
+ width: (text: string) => number;
272
+ /**
273
+ * A clickable link in terminals that support it, `"text (url)"` elsewhere.
274
+ */
275
+ link: (text: string, url: string) => string;
276
+ /**
277
+ * Colors the text along a gradient of hex colors.
278
+ */
279
+ gradient: (text: string, colors: string[]) => string;
280
+ };
281
+ /**
282
+ * A style in a chain: fixed codes, or a color resolved at output time.
283
+ */
284
+ type StyleEntry = {
285
+ open: string;
286
+ close: string;
287
+ } | {
288
+ rgb: [number, number, number];
289
+ bg: boolean;
290
+ } | {
291
+ ansi256: number;
292
+ bg: boolean;
293
+ };
294
+ //# sourceMappingURL=Color.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Color.d.ts","sourceRoot":"","sources":["../../src/Color.js"],"names":[],"mappings":";AA0ZA,0BAA0B;AAC1B,qBADW,WAAW,CACiB;;;;;;;iBA3Y1B,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,eAAe,GAC7G,OAAO,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAC9F,aAAa,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,GAAG,YAAY,GAAG,eAAe,GAAG,YAAY,GAAG,aAAa,GAC5H,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAClH,eAAe,GAAG,aAAa,GAAG,eAAe,GAAG,gBAAgB,GAAG,cAAc,GAAG,iBAAiB,GAAG,cAAc,GAAG,eAA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