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