tty-table 6.1.0 → 7.0.1
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 +6 -4
- package/dist/browser/tty-table.global.js +1903 -3673
- package/dist/browser/tty-table.global.js.map +1 -1
- package/dist/browser.js +191 -368
- package/dist/browser.js.map +1 -1
- package/dist/browser.mjs +189 -366
- package/dist/browser.mjs.map +1 -1
- package/dist/cli.js +223 -402
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +221 -400
- package/dist/cli.mjs.map +1 -1
- package/dist/index.js +191 -368
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +189 -366
- package/dist/index.mjs.map +1 -1
- package/dist/mcp.js +195 -374
- package/dist/mcp.js.map +1 -1
- package/dist/mcp.mjs +193 -372
- package/dist/mcp.mjs.map +1 -1
- package/package.json +4 -6
package/dist/cli.js
CHANGED
|
@@ -26,351 +26,181 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
|
|
29
|
-
// node_modules/
|
|
30
|
-
var
|
|
31
|
-
"node_modules/
|
|
29
|
+
// node_modules/breakword/src/main.js
|
|
30
|
+
var require_main = __commonJS({
|
|
31
|
+
"node_modules/breakword/src/main.js"(exports2, module2) {
|
|
32
32
|
"use strict";
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
33
|
+
var UNICODE_VERSION = "18.0.0";
|
|
34
|
+
var WIDE_RANGES = [
|
|
35
|
+
[4352, 4447],
|
|
36
|
+
[8986, 8987],
|
|
37
|
+
[9001, 9002],
|
|
38
|
+
[9193, 9196],
|
|
39
|
+
[9200, 9200],
|
|
40
|
+
[9203, 9203],
|
|
41
|
+
[9725, 9726],
|
|
42
|
+
[9748, 9749],
|
|
43
|
+
[9776, 9783],
|
|
44
|
+
[9800, 9811],
|
|
45
|
+
[9855, 9855],
|
|
46
|
+
[9866, 9871],
|
|
47
|
+
[9875, 9875],
|
|
48
|
+
[9889, 9889],
|
|
49
|
+
[9898, 9899],
|
|
50
|
+
[9917, 9918],
|
|
51
|
+
[9924, 9925],
|
|
52
|
+
[9934, 9934],
|
|
53
|
+
[9940, 9940],
|
|
54
|
+
[9962, 9962],
|
|
55
|
+
[9970, 9971],
|
|
56
|
+
[9973, 9973],
|
|
57
|
+
[9978, 9978],
|
|
58
|
+
[9981, 9981],
|
|
59
|
+
[9989, 9989],
|
|
60
|
+
[9994, 9995],
|
|
61
|
+
[10024, 10024],
|
|
62
|
+
[10060, 10060],
|
|
63
|
+
[10062, 10062],
|
|
64
|
+
[10067, 10069],
|
|
65
|
+
[10071, 10071],
|
|
66
|
+
[10133, 10135],
|
|
67
|
+
[10160, 10160],
|
|
68
|
+
[10175, 10175],
|
|
69
|
+
[11035, 11036],
|
|
70
|
+
[11088, 11088],
|
|
71
|
+
[11093, 11093],
|
|
72
|
+
[11904, 11929],
|
|
73
|
+
[11931, 12019],
|
|
74
|
+
[12032, 12245],
|
|
75
|
+
[12272, 12350],
|
|
76
|
+
[12353, 12438],
|
|
77
|
+
[12441, 12543],
|
|
78
|
+
[12549, 12591],
|
|
79
|
+
[12593, 12686],
|
|
80
|
+
[12688, 12773],
|
|
81
|
+
[12783, 12830],
|
|
82
|
+
[12832, 12871],
|
|
83
|
+
[12880, 42124],
|
|
84
|
+
[42128, 42182],
|
|
85
|
+
[43360, 43388],
|
|
86
|
+
[44032, 55203],
|
|
87
|
+
[63744, 64255],
|
|
88
|
+
[65040, 65049],
|
|
89
|
+
[65072, 65106],
|
|
90
|
+
[65108, 65126],
|
|
91
|
+
[65128, 65131],
|
|
92
|
+
[65281, 65376],
|
|
93
|
+
[65504, 65510],
|
|
94
|
+
[94176, 94180],
|
|
95
|
+
[94192, 94198],
|
|
96
|
+
[94208, 101594],
|
|
97
|
+
[101631, 101664],
|
|
98
|
+
[101760, 101874],
|
|
99
|
+
[101888, 102801],
|
|
100
|
+
[102816, 102866],
|
|
101
|
+
[110576, 110579],
|
|
102
|
+
[110581, 110587],
|
|
103
|
+
[110589, 110590],
|
|
104
|
+
[110592, 110888],
|
|
105
|
+
[110898, 110898],
|
|
106
|
+
[110928, 110930],
|
|
107
|
+
[110933, 110933],
|
|
108
|
+
[110948, 110952],
|
|
109
|
+
[110960, 111355],
|
|
110
|
+
[119552, 119638],
|
|
111
|
+
[119648, 119670],
|
|
112
|
+
[126980, 126980],
|
|
113
|
+
[127183, 127183],
|
|
114
|
+
[127374, 127374],
|
|
115
|
+
[127377, 127386],
|
|
116
|
+
[127406, 127406],
|
|
117
|
+
[127488, 127490],
|
|
118
|
+
[127504, 127547],
|
|
119
|
+
[127552, 127560],
|
|
120
|
+
[127568, 127569],
|
|
121
|
+
[127584, 127589],
|
|
122
|
+
[127744, 127776],
|
|
123
|
+
[127789, 127797],
|
|
124
|
+
[127799, 127868],
|
|
125
|
+
[127870, 127891],
|
|
126
|
+
[127904, 127946],
|
|
127
|
+
[127951, 127955],
|
|
128
|
+
[127968, 127984],
|
|
129
|
+
[127988, 127988],
|
|
130
|
+
[127992, 128062],
|
|
131
|
+
[128064, 128064],
|
|
132
|
+
[128066, 128252],
|
|
133
|
+
[128255, 128317],
|
|
134
|
+
[128331, 128334],
|
|
135
|
+
[128336, 128359],
|
|
136
|
+
[128378, 128378],
|
|
137
|
+
[128405, 128406],
|
|
138
|
+
[128420, 128420],
|
|
139
|
+
[128507, 128591],
|
|
140
|
+
[128640, 128709],
|
|
141
|
+
[128716, 128716],
|
|
142
|
+
[128720, 128722],
|
|
143
|
+
[128725, 128729],
|
|
144
|
+
[128732, 128735],
|
|
145
|
+
[128747, 128748],
|
|
146
|
+
[128756, 128764],
|
|
147
|
+
[128986, 128986],
|
|
148
|
+
[128992, 129003],
|
|
149
|
+
[129008, 129008],
|
|
150
|
+
[129292, 129338],
|
|
151
|
+
[129340, 129349],
|
|
152
|
+
[129351, 129535],
|
|
153
|
+
[129648, 129660],
|
|
154
|
+
[129664, 129734],
|
|
155
|
+
[129736, 129736],
|
|
156
|
+
[129740, 129757],
|
|
157
|
+
[129759, 129771],
|
|
158
|
+
[129775, 129786],
|
|
159
|
+
[131072, 196605],
|
|
160
|
+
[196608, 262141]
|
|
161
|
+
];
|
|
162
|
+
var cell = (cp) => cp <= 65535 ? `\\u${cp.toString(16).toUpperCase().padStart(4, "0")}` : `\\u{${cp.toString(16).toUpperCase()}}`;
|
|
163
|
+
var WIDE = new RegExp(
|
|
164
|
+
"[" + WIDE_RANGES.map(([lo, hi]) => cell(lo) + (hi > lo ? `-${cell(hi)}` : "")).join("") + "]",
|
|
165
|
+
"u"
|
|
166
|
+
);
|
|
167
|
+
var ZERO = /[\u200B\p{Mn}\p{Me}\p{Cf}\u1160-\u11FF]/u;
|
|
168
|
+
var EMOJI = /\p{Emoji_Presentation}/u;
|
|
169
|
+
function width(char) {
|
|
170
|
+
if (typeof char !== "string") {
|
|
171
|
+
throw new TypeError("width() expects a string");
|
|
126
172
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
function __isRegExp(o) {
|
|
130
|
-
return typeof o === "object" && __objToStr(o) === "[object RegExp]";
|
|
173
|
+
if (char.length === 0) {
|
|
174
|
+
return 0;
|
|
131
175
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
function __getRegExpFlags(re) {
|
|
135
|
-
var flags = "";
|
|
136
|
-
if (re.global) flags += "g";
|
|
137
|
-
if (re.ignoreCase) flags += "i";
|
|
138
|
-
if (re.multiline) flags += "m";
|
|
139
|
-
return flags;
|
|
176
|
+
if (char.length > 1 && [...char].length > 1) {
|
|
177
|
+
throw new TypeError("width() expects exactly one Unicode code point");
|
|
140
178
|
}
|
|
141
|
-
;
|
|
142
|
-
|
|
143
|
-
return
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
179
|
+
const cp = char.codePointAt(0);
|
|
180
|
+
if (cp < 32 || cp >= 127 && cp < 160) return 0;
|
|
181
|
+
if (cp === 173) return 1;
|
|
182
|
+
if (ZERO.test(char)) return 0;
|
|
183
|
+
if (EMOJI.test(char) && !(cp >= 127462 && cp <= 127487)) return 2;
|
|
184
|
+
return WIDE.test(char) ? 2 : 1;
|
|
147
185
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
options = options || {};
|
|
158
|
-
Object.keys(defaults2).forEach(function(key) {
|
|
159
|
-
if (typeof options[key] === "undefined") {
|
|
160
|
-
options[key] = clone(defaults2[key]);
|
|
186
|
+
module2.exports = function breakword2(input, breakAtLength) {
|
|
187
|
+
const str = String(input);
|
|
188
|
+
let indexOfLastFitChar = 0;
|
|
189
|
+
let fittableLength = 0;
|
|
190
|
+
let index = 0;
|
|
191
|
+
for (const char of str) {
|
|
192
|
+
const currentLength = fittableLength + width(char);
|
|
193
|
+
if (currentLength > breakAtLength) {
|
|
194
|
+
break;
|
|
161
195
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
// node_modules/wcwidth/combining.js
|
|
169
|
-
var require_combining = __commonJS({
|
|
170
|
-
"node_modules/wcwidth/combining.js"(exports2, module2) {
|
|
171
|
-
"use strict";
|
|
172
|
-
module2.exports = [
|
|
173
|
-
[768, 879],
|
|
174
|
-
[1155, 1158],
|
|
175
|
-
[1160, 1161],
|
|
176
|
-
[1425, 1469],
|
|
177
|
-
[1471, 1471],
|
|
178
|
-
[1473, 1474],
|
|
179
|
-
[1476, 1477],
|
|
180
|
-
[1479, 1479],
|
|
181
|
-
[1536, 1539],
|
|
182
|
-
[1552, 1557],
|
|
183
|
-
[1611, 1630],
|
|
184
|
-
[1648, 1648],
|
|
185
|
-
[1750, 1764],
|
|
186
|
-
[1767, 1768],
|
|
187
|
-
[1770, 1773],
|
|
188
|
-
[1807, 1807],
|
|
189
|
-
[1809, 1809],
|
|
190
|
-
[1840, 1866],
|
|
191
|
-
[1958, 1968],
|
|
192
|
-
[2027, 2035],
|
|
193
|
-
[2305, 2306],
|
|
194
|
-
[2364, 2364],
|
|
195
|
-
[2369, 2376],
|
|
196
|
-
[2381, 2381],
|
|
197
|
-
[2385, 2388],
|
|
198
|
-
[2402, 2403],
|
|
199
|
-
[2433, 2433],
|
|
200
|
-
[2492, 2492],
|
|
201
|
-
[2497, 2500],
|
|
202
|
-
[2509, 2509],
|
|
203
|
-
[2530, 2531],
|
|
204
|
-
[2561, 2562],
|
|
205
|
-
[2620, 2620],
|
|
206
|
-
[2625, 2626],
|
|
207
|
-
[2631, 2632],
|
|
208
|
-
[2635, 2637],
|
|
209
|
-
[2672, 2673],
|
|
210
|
-
[2689, 2690],
|
|
211
|
-
[2748, 2748],
|
|
212
|
-
[2753, 2757],
|
|
213
|
-
[2759, 2760],
|
|
214
|
-
[2765, 2765],
|
|
215
|
-
[2786, 2787],
|
|
216
|
-
[2817, 2817],
|
|
217
|
-
[2876, 2876],
|
|
218
|
-
[2879, 2879],
|
|
219
|
-
[2881, 2883],
|
|
220
|
-
[2893, 2893],
|
|
221
|
-
[2902, 2902],
|
|
222
|
-
[2946, 2946],
|
|
223
|
-
[3008, 3008],
|
|
224
|
-
[3021, 3021],
|
|
225
|
-
[3134, 3136],
|
|
226
|
-
[3142, 3144],
|
|
227
|
-
[3146, 3149],
|
|
228
|
-
[3157, 3158],
|
|
229
|
-
[3260, 3260],
|
|
230
|
-
[3263, 3263],
|
|
231
|
-
[3270, 3270],
|
|
232
|
-
[3276, 3277],
|
|
233
|
-
[3298, 3299],
|
|
234
|
-
[3393, 3395],
|
|
235
|
-
[3405, 3405],
|
|
236
|
-
[3530, 3530],
|
|
237
|
-
[3538, 3540],
|
|
238
|
-
[3542, 3542],
|
|
239
|
-
[3633, 3633],
|
|
240
|
-
[3636, 3642],
|
|
241
|
-
[3655, 3662],
|
|
242
|
-
[3761, 3761],
|
|
243
|
-
[3764, 3769],
|
|
244
|
-
[3771, 3772],
|
|
245
|
-
[3784, 3789],
|
|
246
|
-
[3864, 3865],
|
|
247
|
-
[3893, 3893],
|
|
248
|
-
[3895, 3895],
|
|
249
|
-
[3897, 3897],
|
|
250
|
-
[3953, 3966],
|
|
251
|
-
[3968, 3972],
|
|
252
|
-
[3974, 3975],
|
|
253
|
-
[3984, 3991],
|
|
254
|
-
[3993, 4028],
|
|
255
|
-
[4038, 4038],
|
|
256
|
-
[4141, 4144],
|
|
257
|
-
[4146, 4146],
|
|
258
|
-
[4150, 4151],
|
|
259
|
-
[4153, 4153],
|
|
260
|
-
[4184, 4185],
|
|
261
|
-
[4448, 4607],
|
|
262
|
-
[4959, 4959],
|
|
263
|
-
[5906, 5908],
|
|
264
|
-
[5938, 5940],
|
|
265
|
-
[5970, 5971],
|
|
266
|
-
[6002, 6003],
|
|
267
|
-
[6068, 6069],
|
|
268
|
-
[6071, 6077],
|
|
269
|
-
[6086, 6086],
|
|
270
|
-
[6089, 6099],
|
|
271
|
-
[6109, 6109],
|
|
272
|
-
[6155, 6157],
|
|
273
|
-
[6313, 6313],
|
|
274
|
-
[6432, 6434],
|
|
275
|
-
[6439, 6440],
|
|
276
|
-
[6450, 6450],
|
|
277
|
-
[6457, 6459],
|
|
278
|
-
[6679, 6680],
|
|
279
|
-
[6912, 6915],
|
|
280
|
-
[6964, 6964],
|
|
281
|
-
[6966, 6970],
|
|
282
|
-
[6972, 6972],
|
|
283
|
-
[6978, 6978],
|
|
284
|
-
[7019, 7027],
|
|
285
|
-
[7616, 7626],
|
|
286
|
-
[7678, 7679],
|
|
287
|
-
[8203, 8207],
|
|
288
|
-
[8234, 8238],
|
|
289
|
-
[8288, 8291],
|
|
290
|
-
[8298, 8303],
|
|
291
|
-
[8400, 8431],
|
|
292
|
-
[12330, 12335],
|
|
293
|
-
[12441, 12442],
|
|
294
|
-
[43014, 43014],
|
|
295
|
-
[43019, 43019],
|
|
296
|
-
[43045, 43046],
|
|
297
|
-
[64286, 64286],
|
|
298
|
-
[65024, 65039],
|
|
299
|
-
[65056, 65059],
|
|
300
|
-
[65279, 65279],
|
|
301
|
-
[65529, 65531],
|
|
302
|
-
[68097, 68099],
|
|
303
|
-
[68101, 68102],
|
|
304
|
-
[68108, 68111],
|
|
305
|
-
[68152, 68154],
|
|
306
|
-
[68159, 68159],
|
|
307
|
-
[119143, 119145],
|
|
308
|
-
[119155, 119170],
|
|
309
|
-
[119173, 119179],
|
|
310
|
-
[119210, 119213],
|
|
311
|
-
[119362, 119364],
|
|
312
|
-
[917505, 917505],
|
|
313
|
-
[917536, 917631],
|
|
314
|
-
[917760, 917999]
|
|
315
|
-
];
|
|
316
|
-
}
|
|
317
|
-
});
|
|
318
|
-
|
|
319
|
-
// node_modules/wcwidth/index.js
|
|
320
|
-
var require_wcwidth = __commonJS({
|
|
321
|
-
"node_modules/wcwidth/index.js"(exports2, module2) {
|
|
322
|
-
"use strict";
|
|
323
|
-
var defaults2 = require_defaults();
|
|
324
|
-
var combining = require_combining();
|
|
325
|
-
var DEFAULTS = {
|
|
326
|
-
nul: 0,
|
|
327
|
-
control: 0
|
|
328
|
-
};
|
|
329
|
-
module2.exports = function wcwidth3(str) {
|
|
330
|
-
return wcswidth(str, DEFAULTS);
|
|
331
|
-
};
|
|
332
|
-
module2.exports.config = function(opts) {
|
|
333
|
-
opts = defaults2(opts || {}, DEFAULTS);
|
|
334
|
-
return function wcwidth3(str) {
|
|
335
|
-
return wcswidth(str, opts);
|
|
336
|
-
};
|
|
337
|
-
};
|
|
338
|
-
function wcswidth(str, opts) {
|
|
339
|
-
if (typeof str !== "string") return wcwidth2(str, opts);
|
|
340
|
-
var s = 0;
|
|
341
|
-
for (var i = 0; i < str.length; i++) {
|
|
342
|
-
var n = wcwidth2(str.charCodeAt(i), opts);
|
|
343
|
-
if (n < 0) return -1;
|
|
344
|
-
s += n;
|
|
345
|
-
}
|
|
346
|
-
return s;
|
|
347
|
-
}
|
|
348
|
-
function wcwidth2(ucs, opts) {
|
|
349
|
-
if (ucs === 0) return opts.nul;
|
|
350
|
-
if (ucs < 32 || ucs >= 127 && ucs < 160) return opts.control;
|
|
351
|
-
if (bisearch(ucs)) return 0;
|
|
352
|
-
return 1 + (ucs >= 4352 && (ucs <= 4447 || // Hangul Jamo init. consonants
|
|
353
|
-
ucs == 9001 || ucs == 9002 || ucs >= 11904 && ucs <= 42191 && ucs != 12351 || // CJK ... Yi
|
|
354
|
-
ucs >= 44032 && ucs <= 55203 || // Hangul Syllables
|
|
355
|
-
ucs >= 63744 && ucs <= 64255 || // CJK Compatibility Ideographs
|
|
356
|
-
ucs >= 65040 && ucs <= 65049 || // Vertical forms
|
|
357
|
-
ucs >= 65072 && ucs <= 65135 || // CJK Compatibility Forms
|
|
358
|
-
ucs >= 65280 && ucs <= 65376 || // Fullwidth Forms
|
|
359
|
-
ucs >= 65504 && ucs <= 65510 || ucs >= 131072 && ucs <= 196605 || ucs >= 196608 && ucs <= 262141));
|
|
360
|
-
}
|
|
361
|
-
function bisearch(ucs) {
|
|
362
|
-
var min = 0;
|
|
363
|
-
var max = combining.length - 1;
|
|
364
|
-
var mid;
|
|
365
|
-
if (ucs < combining[0][0] || ucs > combining[max][1]) return false;
|
|
366
|
-
while (max >= min) {
|
|
367
|
-
mid = Math.floor((min + max) / 2);
|
|
368
|
-
if (ucs > combining[mid][1]) min = mid + 1;
|
|
369
|
-
else if (ucs < combining[mid][0]) max = mid - 1;
|
|
370
|
-
else return true;
|
|
196
|
+
indexOfLastFitChar = index;
|
|
197
|
+
fittableLength = currentLength;
|
|
198
|
+
index += 1;
|
|
371
199
|
}
|
|
372
|
-
return
|
|
373
|
-
}
|
|
200
|
+
return indexOfLastFitChar;
|
|
201
|
+
};
|
|
202
|
+
module2.exports.width = width;
|
|
203
|
+
module2.exports.internals = { UNICODE_VERSION, WIDE_RANGES, WIDE, ZERO, EMOJI, width };
|
|
374
204
|
}
|
|
375
205
|
});
|
|
376
206
|
|
|
@@ -457,24 +287,18 @@ var defaults_default = defaults;
|
|
|
457
287
|
|
|
458
288
|
// src/style.ts
|
|
459
289
|
var import_chalk = __toESM(require("chalk"));
|
|
460
|
-
var import_kleur = __toESM(require("kleur"));
|
|
461
290
|
var import_strip_ansi = __toESM(require("strip-ansi"));
|
|
462
|
-
var colorLib = process && process.stdout ? import_chalk.default :
|
|
463
|
-
var
|
|
464
|
-
const
|
|
465
|
-
|
|
466
|
-
}, str);
|
|
467
|
-
return out;
|
|
291
|
+
var colorLib = typeof process !== "undefined" && process.stdout ? import_chalk.default : new import_chalk.default.Instance({ level: 1 });
|
|
292
|
+
var colorize = (value, color) => {
|
|
293
|
+
const fn = colorLib[color];
|
|
294
|
+
return typeof fn === "function" ? fn(value) : value;
|
|
468
295
|
};
|
|
296
|
+
var style = (str, ...colors) => colors.reduce(colorize, str);
|
|
469
297
|
var styleEachChar = (str, ...colors) => {
|
|
470
298
|
const chars = [...(0, import_strip_ansi.default)(str)];
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
return colorLib[color](input);
|
|
474
|
-
}, current);
|
|
475
|
-
return prev + coded;
|
|
299
|
+
return chars.reduce((result, char) => {
|
|
300
|
+
return result + colors.reduce(colorize, char);
|
|
476
301
|
}, "");
|
|
477
|
-
return out;
|
|
478
302
|
};
|
|
479
303
|
var resetStyle = function(str) {
|
|
480
304
|
this.configure({ reset: true });
|
|
@@ -497,25 +321,56 @@ var colorizeCell = (str, cellOptions, rowType) => {
|
|
|
497
321
|
}
|
|
498
322
|
return str;
|
|
499
323
|
};
|
|
500
|
-
var isColorEnabled = () =>
|
|
501
|
-
return process && process.stdout ? colorLib.level > 0 : colorLib.enabled;
|
|
502
|
-
};
|
|
324
|
+
var isColorEnabled = () => colorLib.level > 0;
|
|
503
325
|
|
|
504
326
|
// src/format.ts
|
|
505
|
-
var import_strip_ansi2 = __toESM(require("strip-ansi"));
|
|
506
327
|
var import_smartwrap = __toESM(require("smartwrap"));
|
|
507
|
-
|
|
328
|
+
|
|
329
|
+
// src/ansi.ts
|
|
330
|
+
var import_breakword = __toESM(require_main());
|
|
331
|
+
var ANSI = /\u001B\[[0-?]*[ -\/]*[@-~]/g;
|
|
332
|
+
var codes = {
|
|
333
|
+
reset: "0",
|
|
334
|
+
bold: "1",
|
|
335
|
+
dim: "2",
|
|
336
|
+
italic: "3",
|
|
337
|
+
underline: "4",
|
|
338
|
+
inverse: "7",
|
|
339
|
+
hidden: "8",
|
|
340
|
+
strikethrough: "9",
|
|
341
|
+
black: "30",
|
|
342
|
+
red: "31",
|
|
343
|
+
green: "32",
|
|
344
|
+
yellow: "33",
|
|
345
|
+
blue: "34",
|
|
346
|
+
magenta: "35",
|
|
347
|
+
cyan: "36",
|
|
348
|
+
white: "37",
|
|
349
|
+
gray: "90",
|
|
350
|
+
grey: "90",
|
|
351
|
+
bgBlack: "40",
|
|
352
|
+
bgRed: "41",
|
|
353
|
+
bgGreen: "42",
|
|
354
|
+
bgYellow: "43",
|
|
355
|
+
bgBlue: "44",
|
|
356
|
+
bgMagenta: "45",
|
|
357
|
+
bgCyan: "46",
|
|
358
|
+
bgWhite: "47"
|
|
359
|
+
};
|
|
360
|
+
var stripAnsi2 = (value) => value.replace(ANSI, "");
|
|
361
|
+
var codePointWidth = (value) => [...value].reduce((total, char) => total + import_breakword.default.width(char), 0);
|
|
362
|
+
var displayWidth = (value) => Math.max(0, ...stripAnsi2(value).split(/\r?\n/).map(codePointWidth));
|
|
363
|
+
var style2 = (value, ...styles) => {
|
|
364
|
+
const active = styles.map((s) => codes[s]).filter(Boolean);
|
|
365
|
+
return active.length ? `\x1B[${active.join(";")}m${value}\x1B[0m` : value;
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
// src/format.ts
|
|
508
369
|
var addPadding = (config, width) => {
|
|
509
370
|
return width + config.paddingLeft + config.paddingRight;
|
|
510
371
|
};
|
|
511
372
|
var getDisplayWidth = (value) => {
|
|
512
|
-
|
|
513
|
-
let widest = 0;
|
|
514
|
-
for (const line of lines) {
|
|
515
|
-
const width = (0, import_wcwidth.default)(line);
|
|
516
|
-
if (width > widest) widest = width;
|
|
517
|
-
}
|
|
518
|
-
return widest;
|
|
373
|
+
return displayWidth(value.toString());
|
|
519
374
|
};
|
|
520
375
|
var getMaxLength = (columnOptions, rows, columnIndex) => {
|
|
521
376
|
let widest = 0;
|
|
@@ -549,7 +404,7 @@ var getAvailableWidth = (config) => {
|
|
|
549
404
|
return config.COLUMNS - config.marginLeft;
|
|
550
405
|
};
|
|
551
406
|
var getStringLength = (str) => {
|
|
552
|
-
return (
|
|
407
|
+
return displayWidth(str);
|
|
553
408
|
};
|
|
554
409
|
var wrapCellText = (config, cellValue, columnIndex, cellOptions, rowType) => {
|
|
555
410
|
const startAnsiRegexp = /^(\x1b\[[0-9;]*m)+/;
|
|
@@ -608,10 +463,10 @@ var wrapCellText = (config, cellValue, columnIndex, cellOptions, rowType) => {
|
|
|
608
463
|
return { cell, innerWidth };
|
|
609
464
|
};
|
|
610
465
|
var truncate = (str, cellOptions, maxWidth) => {
|
|
611
|
-
const stringWidth = (
|
|
466
|
+
const stringWidth = displayWidth(str);
|
|
612
467
|
if (maxWidth < stringWidth) {
|
|
613
468
|
str = (0, import_smartwrap.default)(str, {
|
|
614
|
-
width: maxWidth - cellOptions.truncate
|
|
469
|
+
width: maxWidth - displayWidth(cellOptions.truncate),
|
|
615
470
|
breakword: true
|
|
616
471
|
}).split("\n")[0];
|
|
617
472
|
str = str + cellOptions.truncate;
|
|
@@ -669,7 +524,7 @@ var getColumnWidths = (config, rows) => {
|
|
|
669
524
|
};
|
|
670
525
|
|
|
671
526
|
// src/render.ts
|
|
672
|
-
var
|
|
527
|
+
var import_strip_ansi2 = __toESM(require("strip-ansi"));
|
|
673
528
|
var stringifyData = (config, inputData) => {
|
|
674
529
|
const sections = { header: [], body: [], footer: [] };
|
|
675
530
|
const marginLeft = " ".repeat(config.marginLeft);
|
|
@@ -778,7 +633,7 @@ var buildCell = (config, elem, columnIndex, rowType, rowIndex, rowData, inputDat
|
|
|
778
633
|
switch (true) {
|
|
779
634
|
case (typeof elem === "undefined" || elem === null):
|
|
780
635
|
cellValue = config.errorOnNull ? config.defaultErrorValue : config.defaultValue;
|
|
781
|
-
if (!isColorEnabled()) cellValue = (0,
|
|
636
|
+
if (!isColorEnabled()) cellValue = (0, import_strip_ansi2.default)(cellValue);
|
|
782
637
|
cellOptions.isNull = true;
|
|
783
638
|
break;
|
|
784
639
|
case (typeof elem === "object" && elem !== null && typeof elem.value !== "undefined"):
|
|
@@ -952,40 +807,6 @@ var factory_default = Table;
|
|
|
952
807
|
// src/index.ts
|
|
953
808
|
var src_default = factory_default;
|
|
954
809
|
|
|
955
|
-
// src/ansi.ts
|
|
956
|
-
var codes = {
|
|
957
|
-
reset: "0",
|
|
958
|
-
bold: "1",
|
|
959
|
-
dim: "2",
|
|
960
|
-
italic: "3",
|
|
961
|
-
underline: "4",
|
|
962
|
-
inverse: "7",
|
|
963
|
-
hidden: "8",
|
|
964
|
-
strikethrough: "9",
|
|
965
|
-
black: "30",
|
|
966
|
-
red: "31",
|
|
967
|
-
green: "32",
|
|
968
|
-
yellow: "33",
|
|
969
|
-
blue: "34",
|
|
970
|
-
magenta: "35",
|
|
971
|
-
cyan: "36",
|
|
972
|
-
white: "37",
|
|
973
|
-
gray: "90",
|
|
974
|
-
grey: "90",
|
|
975
|
-
bgBlack: "40",
|
|
976
|
-
bgRed: "41",
|
|
977
|
-
bgGreen: "42",
|
|
978
|
-
bgYellow: "43",
|
|
979
|
-
bgBlue: "44",
|
|
980
|
-
bgMagenta: "45",
|
|
981
|
-
bgCyan: "46",
|
|
982
|
-
bgWhite: "47"
|
|
983
|
-
};
|
|
984
|
-
var style2 = (value, ...styles) => {
|
|
985
|
-
const active = styles.map((s) => codes[s]).filter(Boolean);
|
|
986
|
-
return active.length ? `\x1B[${active.join(";")}m${value}\x1B[0m` : value;
|
|
987
|
-
};
|
|
988
|
-
|
|
989
810
|
// src/cli.ts
|
|
990
811
|
var main = async () => {
|
|
991
812
|
const argv = await (0, import_yargs.default)((0, import_helpers.hideBin)(process.argv)).options({
|