limina 0.1.2 → 0.2.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/LICENSE.md +535 -794
- package/bin/limina.js +5 -9
- package/checker-host-process.js +49 -0
- package/chunks/dep-BOg2f5FD.js +42 -0
- package/chunks/{dep-DJz9JBTi.js → dep-D63Sc9OL.js} +1074 -329
- package/chunks/dep-gI8bWpox.js +1092 -0
- package/cli.js +40572 -40696
- package/flow-renderer-process.js +4 -6
- package/index.d.ts +209 -50
- package/index.js +2 -3
- package/package.json +20 -15
- package/schemas/tsconfig-schema.json +9 -5
- package/chunks/dep-BPK-6PAr.js +0 -114
- package/chunks/dep-esXeyN9I.js +0 -194
- package/chunks/dep-mnWOqiGN.js +0 -244
|
@@ -0,0 +1,1092 @@
|
|
|
1
|
+
import { stripVTControlCharacters } from "node:util";
|
|
2
|
+
//#region ../../node_modules/.pnpm/ansi-regex@6.2.2/node_modules/ansi-regex/index.js
|
|
3
|
+
function ansiRegex({ onlyFirst = false } = {}) {
|
|
4
|
+
return new RegExp(`(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]`, onlyFirst ? void 0 : "g");
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region ../../node_modules/.pnpm/strip-ansi@7.1.2/node_modules/strip-ansi/index.js
|
|
8
|
+
const regex = ansiRegex();
|
|
9
|
+
function stripAnsi(string) {
|
|
10
|
+
if (typeof string !== "string") throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
11
|
+
return string.replace(regex, "");
|
|
12
|
+
}
|
|
13
|
+
const ambiguousRanges = [
|
|
14
|
+
161,
|
|
15
|
+
161,
|
|
16
|
+
164,
|
|
17
|
+
164,
|
|
18
|
+
167,
|
|
19
|
+
168,
|
|
20
|
+
170,
|
|
21
|
+
170,
|
|
22
|
+
173,
|
|
23
|
+
174,
|
|
24
|
+
176,
|
|
25
|
+
180,
|
|
26
|
+
182,
|
|
27
|
+
186,
|
|
28
|
+
188,
|
|
29
|
+
191,
|
|
30
|
+
198,
|
|
31
|
+
198,
|
|
32
|
+
208,
|
|
33
|
+
208,
|
|
34
|
+
215,
|
|
35
|
+
216,
|
|
36
|
+
222,
|
|
37
|
+
225,
|
|
38
|
+
230,
|
|
39
|
+
230,
|
|
40
|
+
232,
|
|
41
|
+
234,
|
|
42
|
+
236,
|
|
43
|
+
237,
|
|
44
|
+
240,
|
|
45
|
+
240,
|
|
46
|
+
242,
|
|
47
|
+
243,
|
|
48
|
+
247,
|
|
49
|
+
250,
|
|
50
|
+
252,
|
|
51
|
+
252,
|
|
52
|
+
254,
|
|
53
|
+
254,
|
|
54
|
+
257,
|
|
55
|
+
257,
|
|
56
|
+
273,
|
|
57
|
+
273,
|
|
58
|
+
275,
|
|
59
|
+
275,
|
|
60
|
+
283,
|
|
61
|
+
283,
|
|
62
|
+
294,
|
|
63
|
+
295,
|
|
64
|
+
299,
|
|
65
|
+
299,
|
|
66
|
+
305,
|
|
67
|
+
307,
|
|
68
|
+
312,
|
|
69
|
+
312,
|
|
70
|
+
319,
|
|
71
|
+
322,
|
|
72
|
+
324,
|
|
73
|
+
324,
|
|
74
|
+
328,
|
|
75
|
+
331,
|
|
76
|
+
333,
|
|
77
|
+
333,
|
|
78
|
+
338,
|
|
79
|
+
339,
|
|
80
|
+
358,
|
|
81
|
+
359,
|
|
82
|
+
363,
|
|
83
|
+
363,
|
|
84
|
+
462,
|
|
85
|
+
462,
|
|
86
|
+
464,
|
|
87
|
+
464,
|
|
88
|
+
466,
|
|
89
|
+
466,
|
|
90
|
+
468,
|
|
91
|
+
468,
|
|
92
|
+
470,
|
|
93
|
+
470,
|
|
94
|
+
472,
|
|
95
|
+
472,
|
|
96
|
+
474,
|
|
97
|
+
474,
|
|
98
|
+
476,
|
|
99
|
+
476,
|
|
100
|
+
593,
|
|
101
|
+
593,
|
|
102
|
+
609,
|
|
103
|
+
609,
|
|
104
|
+
708,
|
|
105
|
+
708,
|
|
106
|
+
711,
|
|
107
|
+
711,
|
|
108
|
+
713,
|
|
109
|
+
715,
|
|
110
|
+
717,
|
|
111
|
+
717,
|
|
112
|
+
720,
|
|
113
|
+
720,
|
|
114
|
+
728,
|
|
115
|
+
731,
|
|
116
|
+
733,
|
|
117
|
+
733,
|
|
118
|
+
735,
|
|
119
|
+
735,
|
|
120
|
+
768,
|
|
121
|
+
879,
|
|
122
|
+
913,
|
|
123
|
+
929,
|
|
124
|
+
931,
|
|
125
|
+
937,
|
|
126
|
+
945,
|
|
127
|
+
961,
|
|
128
|
+
963,
|
|
129
|
+
969,
|
|
130
|
+
1025,
|
|
131
|
+
1025,
|
|
132
|
+
1040,
|
|
133
|
+
1103,
|
|
134
|
+
1105,
|
|
135
|
+
1105,
|
|
136
|
+
8208,
|
|
137
|
+
8208,
|
|
138
|
+
8211,
|
|
139
|
+
8214,
|
|
140
|
+
8216,
|
|
141
|
+
8217,
|
|
142
|
+
8220,
|
|
143
|
+
8221,
|
|
144
|
+
8224,
|
|
145
|
+
8226,
|
|
146
|
+
8228,
|
|
147
|
+
8231,
|
|
148
|
+
8240,
|
|
149
|
+
8240,
|
|
150
|
+
8242,
|
|
151
|
+
8243,
|
|
152
|
+
8245,
|
|
153
|
+
8245,
|
|
154
|
+
8251,
|
|
155
|
+
8251,
|
|
156
|
+
8254,
|
|
157
|
+
8254,
|
|
158
|
+
8308,
|
|
159
|
+
8308,
|
|
160
|
+
8319,
|
|
161
|
+
8319,
|
|
162
|
+
8321,
|
|
163
|
+
8324,
|
|
164
|
+
8364,
|
|
165
|
+
8364,
|
|
166
|
+
8451,
|
|
167
|
+
8451,
|
|
168
|
+
8453,
|
|
169
|
+
8453,
|
|
170
|
+
8457,
|
|
171
|
+
8457,
|
|
172
|
+
8467,
|
|
173
|
+
8467,
|
|
174
|
+
8470,
|
|
175
|
+
8470,
|
|
176
|
+
8481,
|
|
177
|
+
8482,
|
|
178
|
+
8486,
|
|
179
|
+
8486,
|
|
180
|
+
8491,
|
|
181
|
+
8491,
|
|
182
|
+
8531,
|
|
183
|
+
8532,
|
|
184
|
+
8539,
|
|
185
|
+
8542,
|
|
186
|
+
8544,
|
|
187
|
+
8555,
|
|
188
|
+
8560,
|
|
189
|
+
8569,
|
|
190
|
+
8585,
|
|
191
|
+
8585,
|
|
192
|
+
8592,
|
|
193
|
+
8601,
|
|
194
|
+
8632,
|
|
195
|
+
8633,
|
|
196
|
+
8658,
|
|
197
|
+
8658,
|
|
198
|
+
8660,
|
|
199
|
+
8660,
|
|
200
|
+
8679,
|
|
201
|
+
8679,
|
|
202
|
+
8704,
|
|
203
|
+
8704,
|
|
204
|
+
8706,
|
|
205
|
+
8707,
|
|
206
|
+
8711,
|
|
207
|
+
8712,
|
|
208
|
+
8715,
|
|
209
|
+
8715,
|
|
210
|
+
8719,
|
|
211
|
+
8719,
|
|
212
|
+
8721,
|
|
213
|
+
8721,
|
|
214
|
+
8725,
|
|
215
|
+
8725,
|
|
216
|
+
8730,
|
|
217
|
+
8730,
|
|
218
|
+
8733,
|
|
219
|
+
8736,
|
|
220
|
+
8739,
|
|
221
|
+
8739,
|
|
222
|
+
8741,
|
|
223
|
+
8741,
|
|
224
|
+
8743,
|
|
225
|
+
8748,
|
|
226
|
+
8750,
|
|
227
|
+
8750,
|
|
228
|
+
8756,
|
|
229
|
+
8759,
|
|
230
|
+
8764,
|
|
231
|
+
8765,
|
|
232
|
+
8776,
|
|
233
|
+
8776,
|
|
234
|
+
8780,
|
|
235
|
+
8780,
|
|
236
|
+
8786,
|
|
237
|
+
8786,
|
|
238
|
+
8800,
|
|
239
|
+
8801,
|
|
240
|
+
8804,
|
|
241
|
+
8807,
|
|
242
|
+
8810,
|
|
243
|
+
8811,
|
|
244
|
+
8814,
|
|
245
|
+
8815,
|
|
246
|
+
8834,
|
|
247
|
+
8835,
|
|
248
|
+
8838,
|
|
249
|
+
8839,
|
|
250
|
+
8853,
|
|
251
|
+
8853,
|
|
252
|
+
8857,
|
|
253
|
+
8857,
|
|
254
|
+
8869,
|
|
255
|
+
8869,
|
|
256
|
+
8895,
|
|
257
|
+
8895,
|
|
258
|
+
8978,
|
|
259
|
+
8978,
|
|
260
|
+
9312,
|
|
261
|
+
9449,
|
|
262
|
+
9451,
|
|
263
|
+
9547,
|
|
264
|
+
9552,
|
|
265
|
+
9587,
|
|
266
|
+
9600,
|
|
267
|
+
9615,
|
|
268
|
+
9618,
|
|
269
|
+
9621,
|
|
270
|
+
9632,
|
|
271
|
+
9633,
|
|
272
|
+
9635,
|
|
273
|
+
9641,
|
|
274
|
+
9650,
|
|
275
|
+
9651,
|
|
276
|
+
9654,
|
|
277
|
+
9655,
|
|
278
|
+
9660,
|
|
279
|
+
9661,
|
|
280
|
+
9664,
|
|
281
|
+
9665,
|
|
282
|
+
9670,
|
|
283
|
+
9672,
|
|
284
|
+
9675,
|
|
285
|
+
9675,
|
|
286
|
+
9678,
|
|
287
|
+
9681,
|
|
288
|
+
9698,
|
|
289
|
+
9701,
|
|
290
|
+
9711,
|
|
291
|
+
9711,
|
|
292
|
+
9733,
|
|
293
|
+
9734,
|
|
294
|
+
9737,
|
|
295
|
+
9737,
|
|
296
|
+
9742,
|
|
297
|
+
9743,
|
|
298
|
+
9756,
|
|
299
|
+
9756,
|
|
300
|
+
9758,
|
|
301
|
+
9758,
|
|
302
|
+
9792,
|
|
303
|
+
9792,
|
|
304
|
+
9794,
|
|
305
|
+
9794,
|
|
306
|
+
9824,
|
|
307
|
+
9825,
|
|
308
|
+
9827,
|
|
309
|
+
9829,
|
|
310
|
+
9831,
|
|
311
|
+
9834,
|
|
312
|
+
9836,
|
|
313
|
+
9837,
|
|
314
|
+
9839,
|
|
315
|
+
9839,
|
|
316
|
+
9886,
|
|
317
|
+
9887,
|
|
318
|
+
9919,
|
|
319
|
+
9919,
|
|
320
|
+
9926,
|
|
321
|
+
9933,
|
|
322
|
+
9935,
|
|
323
|
+
9939,
|
|
324
|
+
9941,
|
|
325
|
+
9953,
|
|
326
|
+
9955,
|
|
327
|
+
9955,
|
|
328
|
+
9960,
|
|
329
|
+
9961,
|
|
330
|
+
9963,
|
|
331
|
+
9969,
|
|
332
|
+
9972,
|
|
333
|
+
9972,
|
|
334
|
+
9974,
|
|
335
|
+
9977,
|
|
336
|
+
9979,
|
|
337
|
+
9980,
|
|
338
|
+
9982,
|
|
339
|
+
9983,
|
|
340
|
+
10045,
|
|
341
|
+
10045,
|
|
342
|
+
10102,
|
|
343
|
+
10111,
|
|
344
|
+
11094,
|
|
345
|
+
11097,
|
|
346
|
+
12872,
|
|
347
|
+
12879,
|
|
348
|
+
57344,
|
|
349
|
+
63743,
|
|
350
|
+
65024,
|
|
351
|
+
65039,
|
|
352
|
+
65533,
|
|
353
|
+
65533,
|
|
354
|
+
127232,
|
|
355
|
+
127242,
|
|
356
|
+
127248,
|
|
357
|
+
127277,
|
|
358
|
+
127280,
|
|
359
|
+
127337,
|
|
360
|
+
127344,
|
|
361
|
+
127373,
|
|
362
|
+
127375,
|
|
363
|
+
127376,
|
|
364
|
+
127387,
|
|
365
|
+
127404,
|
|
366
|
+
917760,
|
|
367
|
+
917999,
|
|
368
|
+
983040,
|
|
369
|
+
1048573,
|
|
370
|
+
1048576,
|
|
371
|
+
1114109
|
|
372
|
+
];
|
|
373
|
+
const fullwidthRanges = [
|
|
374
|
+
12288,
|
|
375
|
+
12288,
|
|
376
|
+
65281,
|
|
377
|
+
65376,
|
|
378
|
+
65504,
|
|
379
|
+
65510
|
|
380
|
+
];
|
|
381
|
+
const wideRanges = [
|
|
382
|
+
4352,
|
|
383
|
+
4447,
|
|
384
|
+
8986,
|
|
385
|
+
8987,
|
|
386
|
+
9001,
|
|
387
|
+
9002,
|
|
388
|
+
9193,
|
|
389
|
+
9196,
|
|
390
|
+
9200,
|
|
391
|
+
9200,
|
|
392
|
+
9203,
|
|
393
|
+
9203,
|
|
394
|
+
9725,
|
|
395
|
+
9726,
|
|
396
|
+
9748,
|
|
397
|
+
9749,
|
|
398
|
+
9776,
|
|
399
|
+
9783,
|
|
400
|
+
9800,
|
|
401
|
+
9811,
|
|
402
|
+
9855,
|
|
403
|
+
9855,
|
|
404
|
+
9866,
|
|
405
|
+
9871,
|
|
406
|
+
9875,
|
|
407
|
+
9875,
|
|
408
|
+
9889,
|
|
409
|
+
9889,
|
|
410
|
+
9898,
|
|
411
|
+
9899,
|
|
412
|
+
9917,
|
|
413
|
+
9918,
|
|
414
|
+
9924,
|
|
415
|
+
9925,
|
|
416
|
+
9934,
|
|
417
|
+
9934,
|
|
418
|
+
9940,
|
|
419
|
+
9940,
|
|
420
|
+
9962,
|
|
421
|
+
9962,
|
|
422
|
+
9970,
|
|
423
|
+
9971,
|
|
424
|
+
9973,
|
|
425
|
+
9973,
|
|
426
|
+
9978,
|
|
427
|
+
9978,
|
|
428
|
+
9981,
|
|
429
|
+
9981,
|
|
430
|
+
9989,
|
|
431
|
+
9989,
|
|
432
|
+
9994,
|
|
433
|
+
9995,
|
|
434
|
+
10024,
|
|
435
|
+
10024,
|
|
436
|
+
10060,
|
|
437
|
+
10060,
|
|
438
|
+
10062,
|
|
439
|
+
10062,
|
|
440
|
+
10067,
|
|
441
|
+
10069,
|
|
442
|
+
10071,
|
|
443
|
+
10071,
|
|
444
|
+
10133,
|
|
445
|
+
10135,
|
|
446
|
+
10160,
|
|
447
|
+
10160,
|
|
448
|
+
10175,
|
|
449
|
+
10175,
|
|
450
|
+
11035,
|
|
451
|
+
11036,
|
|
452
|
+
11088,
|
|
453
|
+
11088,
|
|
454
|
+
11093,
|
|
455
|
+
11093,
|
|
456
|
+
11904,
|
|
457
|
+
11929,
|
|
458
|
+
11931,
|
|
459
|
+
12019,
|
|
460
|
+
12032,
|
|
461
|
+
12245,
|
|
462
|
+
12272,
|
|
463
|
+
12287,
|
|
464
|
+
12289,
|
|
465
|
+
12350,
|
|
466
|
+
12353,
|
|
467
|
+
12438,
|
|
468
|
+
12441,
|
|
469
|
+
12543,
|
|
470
|
+
12549,
|
|
471
|
+
12591,
|
|
472
|
+
12593,
|
|
473
|
+
12686,
|
|
474
|
+
12688,
|
|
475
|
+
12773,
|
|
476
|
+
12783,
|
|
477
|
+
12830,
|
|
478
|
+
12832,
|
|
479
|
+
12871,
|
|
480
|
+
12880,
|
|
481
|
+
42124,
|
|
482
|
+
42128,
|
|
483
|
+
42182,
|
|
484
|
+
43360,
|
|
485
|
+
43388,
|
|
486
|
+
44032,
|
|
487
|
+
55203,
|
|
488
|
+
63744,
|
|
489
|
+
64255,
|
|
490
|
+
65040,
|
|
491
|
+
65049,
|
|
492
|
+
65072,
|
|
493
|
+
65106,
|
|
494
|
+
65108,
|
|
495
|
+
65126,
|
|
496
|
+
65128,
|
|
497
|
+
65131,
|
|
498
|
+
94176,
|
|
499
|
+
94180,
|
|
500
|
+
94192,
|
|
501
|
+
94198,
|
|
502
|
+
94208,
|
|
503
|
+
101589,
|
|
504
|
+
101631,
|
|
505
|
+
101662,
|
|
506
|
+
101760,
|
|
507
|
+
101874,
|
|
508
|
+
110576,
|
|
509
|
+
110579,
|
|
510
|
+
110581,
|
|
511
|
+
110587,
|
|
512
|
+
110589,
|
|
513
|
+
110590,
|
|
514
|
+
110592,
|
|
515
|
+
110882,
|
|
516
|
+
110898,
|
|
517
|
+
110898,
|
|
518
|
+
110928,
|
|
519
|
+
110930,
|
|
520
|
+
110933,
|
|
521
|
+
110933,
|
|
522
|
+
110948,
|
|
523
|
+
110951,
|
|
524
|
+
110960,
|
|
525
|
+
111355,
|
|
526
|
+
119552,
|
|
527
|
+
119638,
|
|
528
|
+
119648,
|
|
529
|
+
119670,
|
|
530
|
+
126980,
|
|
531
|
+
126980,
|
|
532
|
+
127183,
|
|
533
|
+
127183,
|
|
534
|
+
127374,
|
|
535
|
+
127374,
|
|
536
|
+
127377,
|
|
537
|
+
127386,
|
|
538
|
+
127488,
|
|
539
|
+
127490,
|
|
540
|
+
127504,
|
|
541
|
+
127547,
|
|
542
|
+
127552,
|
|
543
|
+
127560,
|
|
544
|
+
127568,
|
|
545
|
+
127569,
|
|
546
|
+
127584,
|
|
547
|
+
127589,
|
|
548
|
+
127744,
|
|
549
|
+
127776,
|
|
550
|
+
127789,
|
|
551
|
+
127797,
|
|
552
|
+
127799,
|
|
553
|
+
127868,
|
|
554
|
+
127870,
|
|
555
|
+
127891,
|
|
556
|
+
127904,
|
|
557
|
+
127946,
|
|
558
|
+
127951,
|
|
559
|
+
127955,
|
|
560
|
+
127968,
|
|
561
|
+
127984,
|
|
562
|
+
127988,
|
|
563
|
+
127988,
|
|
564
|
+
127992,
|
|
565
|
+
128062,
|
|
566
|
+
128064,
|
|
567
|
+
128064,
|
|
568
|
+
128066,
|
|
569
|
+
128252,
|
|
570
|
+
128255,
|
|
571
|
+
128317,
|
|
572
|
+
128331,
|
|
573
|
+
128334,
|
|
574
|
+
128336,
|
|
575
|
+
128359,
|
|
576
|
+
128378,
|
|
577
|
+
128378,
|
|
578
|
+
128405,
|
|
579
|
+
128406,
|
|
580
|
+
128420,
|
|
581
|
+
128420,
|
|
582
|
+
128507,
|
|
583
|
+
128591,
|
|
584
|
+
128640,
|
|
585
|
+
128709,
|
|
586
|
+
128716,
|
|
587
|
+
128716,
|
|
588
|
+
128720,
|
|
589
|
+
128722,
|
|
590
|
+
128725,
|
|
591
|
+
128728,
|
|
592
|
+
128732,
|
|
593
|
+
128735,
|
|
594
|
+
128747,
|
|
595
|
+
128748,
|
|
596
|
+
128756,
|
|
597
|
+
128764,
|
|
598
|
+
128992,
|
|
599
|
+
129003,
|
|
600
|
+
129008,
|
|
601
|
+
129008,
|
|
602
|
+
129292,
|
|
603
|
+
129338,
|
|
604
|
+
129340,
|
|
605
|
+
129349,
|
|
606
|
+
129351,
|
|
607
|
+
129535,
|
|
608
|
+
129648,
|
|
609
|
+
129660,
|
|
610
|
+
129664,
|
|
611
|
+
129674,
|
|
612
|
+
129678,
|
|
613
|
+
129734,
|
|
614
|
+
129736,
|
|
615
|
+
129736,
|
|
616
|
+
129741,
|
|
617
|
+
129756,
|
|
618
|
+
129759,
|
|
619
|
+
129770,
|
|
620
|
+
129775,
|
|
621
|
+
129784,
|
|
622
|
+
131072,
|
|
623
|
+
196605,
|
|
624
|
+
196608,
|
|
625
|
+
262141
|
|
626
|
+
];
|
|
627
|
+
//#endregion
|
|
628
|
+
//#region ../../node_modules/.pnpm/get-east-asian-width@1.6.0/node_modules/get-east-asian-width/utilities.js
|
|
629
|
+
/**
|
|
630
|
+
Binary search on a sorted flat array of [start, end] pairs.
|
|
631
|
+
|
|
632
|
+
@param {number[]} ranges - Flat array of inclusive [start, end] range pairs, e.g. [0, 5, 10, 20].
|
|
633
|
+
@param {number} codePoint - The value to search for.
|
|
634
|
+
@returns {boolean} Whether the value falls within any of the ranges.
|
|
635
|
+
*/
|
|
636
|
+
const isInRange = (ranges, codePoint) => {
|
|
637
|
+
let low = 0;
|
|
638
|
+
let high = Math.floor(ranges.length / 2) - 1;
|
|
639
|
+
while (low <= high) {
|
|
640
|
+
const mid = Math.floor((low + high) / 2);
|
|
641
|
+
const i = mid * 2;
|
|
642
|
+
if (codePoint < ranges[i]) high = mid - 1;
|
|
643
|
+
else if (codePoint > ranges[i + 1]) low = mid + 1;
|
|
644
|
+
else return true;
|
|
645
|
+
}
|
|
646
|
+
return false;
|
|
647
|
+
};
|
|
648
|
+
//#endregion
|
|
649
|
+
//#region ../../node_modules/.pnpm/get-east-asian-width@1.6.0/node_modules/get-east-asian-width/lookup.js
|
|
650
|
+
const commonCjkCodePoint = 19968;
|
|
651
|
+
const [wideFastPathStart, wideFastPathEnd] = /* #__PURE__ */ findWideFastPathRange(wideRanges);
|
|
652
|
+
function findWideFastPathRange(ranges) {
|
|
653
|
+
let fastPathStart = ranges[0];
|
|
654
|
+
let fastPathEnd = ranges[1];
|
|
655
|
+
for (let index = 0; index < ranges.length; index += 2) {
|
|
656
|
+
const start = ranges[index];
|
|
657
|
+
const end = ranges[index + 1];
|
|
658
|
+
if (commonCjkCodePoint >= start && commonCjkCodePoint <= end) return [start, end];
|
|
659
|
+
if (end - start > fastPathEnd - fastPathStart) {
|
|
660
|
+
fastPathStart = start;
|
|
661
|
+
fastPathEnd = end;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
return [fastPathStart, fastPathEnd];
|
|
665
|
+
}
|
|
666
|
+
const isAmbiguous = (codePoint) => {
|
|
667
|
+
if (codePoint < 161 || codePoint > 1114109) return false;
|
|
668
|
+
return isInRange(ambiguousRanges, codePoint);
|
|
669
|
+
};
|
|
670
|
+
const isFullWidth = (codePoint) => {
|
|
671
|
+
if (codePoint < 12288 || codePoint > 65510) return false;
|
|
672
|
+
return isInRange(fullwidthRanges, codePoint);
|
|
673
|
+
};
|
|
674
|
+
const isWide = (codePoint) => {
|
|
675
|
+
if (codePoint >= wideFastPathStart && codePoint <= wideFastPathEnd) return true;
|
|
676
|
+
if (codePoint < 4352 || codePoint > 262141) return false;
|
|
677
|
+
return isInRange(wideRanges, codePoint);
|
|
678
|
+
};
|
|
679
|
+
//#endregion
|
|
680
|
+
//#region ../../node_modules/.pnpm/get-east-asian-width@1.6.0/node_modules/get-east-asian-width/index.js
|
|
681
|
+
function validate(codePoint) {
|
|
682
|
+
if (!Number.isSafeInteger(codePoint)) throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
683
|
+
}
|
|
684
|
+
function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
|
|
685
|
+
validate(codePoint);
|
|
686
|
+
if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) return 2;
|
|
687
|
+
return 1;
|
|
688
|
+
}
|
|
689
|
+
//#endregion
|
|
690
|
+
//#region ../../node_modules/.pnpm/string-width@8.2.2/node_modules/string-width/index.js
|
|
691
|
+
/**
|
|
692
|
+
Logic:
|
|
693
|
+
- Segment graphemes to match how terminals render clusters.
|
|
694
|
+
- Width rules:
|
|
695
|
+
1. Skip non-printing clusters (Default_Ignorable, Control, pure nonspacing/enclosing Mark, lone Surrogates). Tabs are ignored by design.
|
|
696
|
+
2. RGI emoji clusters (\p{RGI_Emoji}) are double-width.
|
|
697
|
+
3. Minimally-qualified/unqualified emoji clusters (ZWJ sequences with 2+ Extended_Pictographic, or keycap sequences) are double-width.
|
|
698
|
+
4. Hangul jamo collapse each standard modern Hangul L+V or L+V+T syllable piece to width 2.
|
|
699
|
+
Unmatched repeated leading/vowel/trailing jamo stay additive because that matches how the terminals we target render them.
|
|
700
|
+
5. Otherwise use East Asian Width of the cluster's first visible code point, and add widths for trailing spacing marks and Halfwidth/Fullwidth Forms within the same cluster (e.g., dakuten/handakuten/prolonged sound mark).
|
|
701
|
+
*/
|
|
702
|
+
const segmenter = new Intl.Segmenter();
|
|
703
|
+
const zeroWidthClusterRegex = /^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Format}|\p{Nonspacing_Mark}|\p{Enclosing_Mark}|\p{Surrogate})+$/v;
|
|
704
|
+
const leadingNonPrintingRegex = /^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Nonspacing_Mark}\p{Enclosing_Mark}\p{Surrogate}]+/v;
|
|
705
|
+
const spacingMarkRegex = /\p{Spacing_Mark}/v;
|
|
706
|
+
const rgiEmojiRegex = /^\p{RGI_Emoji}$/v;
|
|
707
|
+
const unqualifiedKeycapRegex = /^[\d#*]\u20E3$/;
|
|
708
|
+
const extendedPictographicRegex = /\p{Extended_Pictographic}/gu;
|
|
709
|
+
function isDoubleWidthNonRgiEmojiSequence(segment) {
|
|
710
|
+
if (segment.length > 50) return false;
|
|
711
|
+
if (unqualifiedKeycapRegex.test(segment)) return true;
|
|
712
|
+
if (segment.includes("")) {
|
|
713
|
+
const pictographics = segment.match(extendedPictographicRegex);
|
|
714
|
+
return pictographics !== null && pictographics.length >= 2;
|
|
715
|
+
}
|
|
716
|
+
return false;
|
|
717
|
+
}
|
|
718
|
+
function baseVisible(segment) {
|
|
719
|
+
return segment.replace(leadingNonPrintingRegex, "");
|
|
720
|
+
}
|
|
721
|
+
function isZeroWidthCluster(segment) {
|
|
722
|
+
return zeroWidthClusterRegex.test(segment);
|
|
723
|
+
}
|
|
724
|
+
function isHangulLeadingJamo(codePoint) {
|
|
725
|
+
return codePoint >= 4352 && codePoint <= 4447 || codePoint >= 43360 && codePoint <= 43388;
|
|
726
|
+
}
|
|
727
|
+
function isHangulVowelJamo(codePoint) {
|
|
728
|
+
return codePoint >= 4448 && codePoint <= 4519 || codePoint >= 55216 && codePoint <= 55238;
|
|
729
|
+
}
|
|
730
|
+
function isHangulTrailingJamo(codePoint) {
|
|
731
|
+
return codePoint >= 4520 && codePoint <= 4607 || codePoint >= 55243 && codePoint <= 55291;
|
|
732
|
+
}
|
|
733
|
+
function isHangulJamo(codePoint) {
|
|
734
|
+
return isHangulLeadingJamo(codePoint) || isHangulVowelJamo(codePoint) || isHangulTrailingJamo(codePoint);
|
|
735
|
+
}
|
|
736
|
+
function hangulClusterWidth(visibleSegment, eastAsianWidthOptions) {
|
|
737
|
+
const codePoints = [];
|
|
738
|
+
for (const character of visibleSegment) {
|
|
739
|
+
if (zeroWidthClusterRegex.test(character)) continue;
|
|
740
|
+
codePoints.push(character.codePointAt(0));
|
|
741
|
+
}
|
|
742
|
+
if (codePoints.length === 0) return;
|
|
743
|
+
let width = 0;
|
|
744
|
+
for (let index = 0; index < codePoints.length; index++) {
|
|
745
|
+
const codePoint = codePoints[index];
|
|
746
|
+
if (!isHangulJamo(codePoint)) {
|
|
747
|
+
if (width === 0) return;
|
|
748
|
+
for (let remaining = index; remaining < codePoints.length; remaining++) width += eastAsianWidth(codePoints[remaining], eastAsianWidthOptions);
|
|
749
|
+
return width;
|
|
750
|
+
}
|
|
751
|
+
if (isHangulLeadingJamo(codePoint) && isHangulVowelJamo(codePoints[index + 1])) {
|
|
752
|
+
width += 2;
|
|
753
|
+
index += isHangulTrailingJamo(codePoints[index + 2]) ? 2 : 1;
|
|
754
|
+
continue;
|
|
755
|
+
}
|
|
756
|
+
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
757
|
+
}
|
|
758
|
+
return width;
|
|
759
|
+
}
|
|
760
|
+
function trailingWidth(visibleSegment, eastAsianWidthOptions) {
|
|
761
|
+
let extra = 0;
|
|
762
|
+
let first = true;
|
|
763
|
+
for (const character of visibleSegment) {
|
|
764
|
+
if (first) {
|
|
765
|
+
first = false;
|
|
766
|
+
continue;
|
|
767
|
+
}
|
|
768
|
+
if (spacingMarkRegex.test(character) || character >= "" && character <= "") extra += eastAsianWidth(character.codePointAt(0), eastAsianWidthOptions);
|
|
769
|
+
}
|
|
770
|
+
return extra;
|
|
771
|
+
}
|
|
772
|
+
function stringWidth(input, options = {}) {
|
|
773
|
+
if (typeof input !== "string" || input.length === 0) return 0;
|
|
774
|
+
const { ambiguousIsNarrow = true, countAnsiEscapeCodes = false } = options;
|
|
775
|
+
let string = input;
|
|
776
|
+
if (!countAnsiEscapeCodes && (string.includes("\x1B") || string.includes(""))) string = stripAnsi(string);
|
|
777
|
+
if (string.length === 0) return 0;
|
|
778
|
+
if (/^[\u0020-\u007E]*$/.test(string)) return string.length;
|
|
779
|
+
let width = 0;
|
|
780
|
+
const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
|
|
781
|
+
for (const { segment } of segmenter.segment(string)) {
|
|
782
|
+
if (isZeroWidthCluster(segment)) continue;
|
|
783
|
+
if (rgiEmojiRegex.test(segment) || isDoubleWidthNonRgiEmojiSequence(segment)) {
|
|
784
|
+
width += 2;
|
|
785
|
+
continue;
|
|
786
|
+
}
|
|
787
|
+
const visibleSegment = baseVisible(segment);
|
|
788
|
+
const hangulWidth = hangulClusterWidth(visibleSegment, eastAsianWidthOptions);
|
|
789
|
+
if (hangulWidth !== void 0) {
|
|
790
|
+
width += hangulWidth;
|
|
791
|
+
continue;
|
|
792
|
+
}
|
|
793
|
+
const codePoint = visibleSegment.codePointAt(0);
|
|
794
|
+
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
795
|
+
width += trailingWidth(visibleSegment, eastAsianWidthOptions);
|
|
796
|
+
}
|
|
797
|
+
return width;
|
|
798
|
+
}
|
|
799
|
+
//#endregion
|
|
800
|
+
//#region src/flow/terminal-position.ts
|
|
801
|
+
const TAB_STOP_COLUMNS = 8;
|
|
802
|
+
const graphemeSegmenter = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
803
|
+
function advanceColumns(position, width, columns) {
|
|
804
|
+
if (width <= 0) return;
|
|
805
|
+
if (position.column > 0 && position.column + width > columns) {
|
|
806
|
+
position.rowsAdvanced += 1;
|
|
807
|
+
position.column = 0;
|
|
808
|
+
}
|
|
809
|
+
position.column += width;
|
|
810
|
+
while (position.column >= columns) {
|
|
811
|
+
position.rowsAdvanced += 1;
|
|
812
|
+
position.column -= columns;
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
function stripTerminalControlSequences(text) {
|
|
816
|
+
return stripVTControlCharacters(text).replaceAll("\r", "");
|
|
817
|
+
}
|
|
818
|
+
function advanceTerminalPosition(text, columns, initialColumn = 0) {
|
|
819
|
+
const normalizedColumns = Math.max(1, columns);
|
|
820
|
+
const position = {
|
|
821
|
+
column: Math.max(0, initialColumn) % normalizedColumns,
|
|
822
|
+
rowsAdvanced: Math.floor(Math.max(0, initialColumn) / normalizedColumns)
|
|
823
|
+
};
|
|
824
|
+
const visibleText = stripTerminalControlSequences(text);
|
|
825
|
+
for (const { segment } of graphemeSegmenter.segment(visibleText)) {
|
|
826
|
+
if (segment === "\n") {
|
|
827
|
+
position.rowsAdvanced += 1;
|
|
828
|
+
position.column = 0;
|
|
829
|
+
continue;
|
|
830
|
+
}
|
|
831
|
+
if (segment === " ") {
|
|
832
|
+
advanceColumns(position, TAB_STOP_COLUMNS - position.column % TAB_STOP_COLUMNS, normalizedColumns);
|
|
833
|
+
continue;
|
|
834
|
+
}
|
|
835
|
+
advanceColumns(position, stringWidth(segment), normalizedColumns);
|
|
836
|
+
}
|
|
837
|
+
return position;
|
|
838
|
+
}
|
|
839
|
+
var TerminalTextStream = class {
|
|
840
|
+
#decoder = new TextDecoder();
|
|
841
|
+
#state = "text";
|
|
842
|
+
decode(chunk) {
|
|
843
|
+
const text = typeof chunk === "string" ? `${this.#decoder.decode()}${chunk}` : this.#decoder.decode(chunk, { stream: true });
|
|
844
|
+
let visibleText = "";
|
|
845
|
+
for (const character of text) switch (this.#state) {
|
|
846
|
+
case "control-string":
|
|
847
|
+
if (character === "\x07") this.#state = "text";
|
|
848
|
+
else if (character === "\x1B") this.#state = "control-string-escape";
|
|
849
|
+
break;
|
|
850
|
+
case "control-string-escape":
|
|
851
|
+
this.#state = character === "\\" ? "text" : "control-string";
|
|
852
|
+
break;
|
|
853
|
+
case "csi":
|
|
854
|
+
if (/^[\u0040-\u007E]$/u.test(character)) this.#state = "text";
|
|
855
|
+
break;
|
|
856
|
+
case "escape":
|
|
857
|
+
if (character === "[") this.#state = "csi";
|
|
858
|
+
else if (character === "]" || character === "P" || character === "X" || character === "^" || character === "_") this.#state = "control-string";
|
|
859
|
+
else this.#state = "text";
|
|
860
|
+
break;
|
|
861
|
+
case "text":
|
|
862
|
+
if (character === "\x1B") this.#state = "escape";
|
|
863
|
+
else if (character !== "\r") visibleText += character;
|
|
864
|
+
break;
|
|
865
|
+
}
|
|
866
|
+
return visibleText;
|
|
867
|
+
}
|
|
868
|
+
reset() {
|
|
869
|
+
this.#decoder = new TextDecoder();
|
|
870
|
+
this.#state = "text";
|
|
871
|
+
}
|
|
872
|
+
};
|
|
873
|
+
//#endregion
|
|
874
|
+
//#region src/flow/render-model.ts
|
|
875
|
+
const ANSI_RESET = "\x1B[0m";
|
|
876
|
+
const ANSI_GREEN = "\x1B[32m";
|
|
877
|
+
const ANSI_RED = "\x1B[31m";
|
|
878
|
+
const ANSI_YELLOW = "\x1B[33m";
|
|
879
|
+
const DEFAULT_TERMINAL_COLUMNS = 80;
|
|
880
|
+
const TERMINAL_FRAME_MARGIN_LINES = 1;
|
|
881
|
+
const TERMINAL_FRAME_CONTEXT_LINES = 6;
|
|
882
|
+
const OMITTED_LINES_MARKER = "│ ...";
|
|
883
|
+
const SPINNER_FRAMES = [
|
|
884
|
+
"⠋",
|
|
885
|
+
"⠙",
|
|
886
|
+
"⠹",
|
|
887
|
+
"⠸",
|
|
888
|
+
"⠼",
|
|
889
|
+
"⠴",
|
|
890
|
+
"⠦",
|
|
891
|
+
"⠧",
|
|
892
|
+
"⠇",
|
|
893
|
+
"⠏"
|
|
894
|
+
];
|
|
895
|
+
const FLOW_SYMBOL_BY_STATUS = {
|
|
896
|
+
block: "⊘",
|
|
897
|
+
fail: "✕",
|
|
898
|
+
info: "│",
|
|
899
|
+
pass: "◆",
|
|
900
|
+
planned: "◇",
|
|
901
|
+
skip: "◇",
|
|
902
|
+
start: "◇",
|
|
903
|
+
warn: "▲"
|
|
904
|
+
};
|
|
905
|
+
function colorInteractiveSymbol(status, symbol) {
|
|
906
|
+
if (status === "pass") return `${ANSI_GREEN}${symbol}${ANSI_RESET}`;
|
|
907
|
+
if (status === "fail") return `${ANSI_RED}${symbol}${ANSI_RESET}`;
|
|
908
|
+
if (status === "warn" || status === "block") return `${ANSI_YELLOW}${symbol}${ANSI_RESET}`;
|
|
909
|
+
return symbol;
|
|
910
|
+
}
|
|
911
|
+
function formatElapsedTime(milliseconds) {
|
|
912
|
+
if (milliseconds < 1e3) return `${Math.round(milliseconds)}ms`;
|
|
913
|
+
return `${(milliseconds / 1e3).toFixed(2)}s`;
|
|
914
|
+
}
|
|
915
|
+
function formatMessageWithElapsed(message, elapsedTimeMs) {
|
|
916
|
+
return typeof elapsedTimeMs === "number" ? `${message} (${formatElapsedTime(elapsedTimeMs)})` : message;
|
|
917
|
+
}
|
|
918
|
+
function indentMessage(message, depth) {
|
|
919
|
+
if (depth <= 0) return message;
|
|
920
|
+
return `${" ".repeat(depth)}${message}`;
|
|
921
|
+
}
|
|
922
|
+
function formatInteractiveLine(status, message, depth, spinnerFrameIndex) {
|
|
923
|
+
const renderedMessage = indentMessage(message, depth);
|
|
924
|
+
return `${colorInteractiveSymbol(status, status === "start" ? SPINNER_FRAMES[spinnerFrameIndex % SPINNER_FRAMES.length] : FLOW_SYMBOL_BY_STATUS[status])} ${renderedMessage}`;
|
|
925
|
+
}
|
|
926
|
+
function toTreeFlowStatus(status) {
|
|
927
|
+
switch (status) {
|
|
928
|
+
case "blocked": return "block";
|
|
929
|
+
case "failed": return "fail";
|
|
930
|
+
case "passed": return "pass";
|
|
931
|
+
case "planned": return "planned";
|
|
932
|
+
case "running": return "start";
|
|
933
|
+
case "skipped": return "skip";
|
|
934
|
+
}
|
|
935
|
+
throw new Error(`Unsupported flow tree node status: ${status}`);
|
|
936
|
+
}
|
|
937
|
+
function isTreeNodeTerminal(node) {
|
|
938
|
+
return node.status === "failed" || node.status === "blocked" || node.status === "passed" || node.status === "skipped";
|
|
939
|
+
}
|
|
940
|
+
function areTreeNodeDescendantsTerminal(node) {
|
|
941
|
+
return node.children.every((child) => isTreeNodeTerminal(child) && areTreeNodeDescendantsTerminal(child));
|
|
942
|
+
}
|
|
943
|
+
function renderTreeNodeLine(node, spinnerFrameIndex) {
|
|
944
|
+
const elapsedTimeMs = isTreeNodeTerminal(node) && areTreeNodeDescendantsTerminal(node) ? node.elapsedTimeMs : void 0;
|
|
945
|
+
return formatInteractiveLine(toTreeFlowStatus(node.status), formatMessageWithElapsed(node.message, elapsedTimeMs), node.depth, spinnerFrameIndex);
|
|
946
|
+
}
|
|
947
|
+
function renderTreeNodeLines(node, spinnerFrameIndex) {
|
|
948
|
+
return [renderTreeNodeLine(node, spinnerFrameIndex), ...node.children.flatMap((child) => renderTreeNodeLines(child, spinnerFrameIndex))];
|
|
949
|
+
}
|
|
950
|
+
function renderCompactTreeNodeLines(node, spinnerFrameIndex) {
|
|
951
|
+
return [renderTreeNodeLine(node, spinnerFrameIndex), ...node.children.map((child) => renderTreeNodeLine(child, spinnerFrameIndex))];
|
|
952
|
+
}
|
|
953
|
+
function renderSnapshotLines(snapshot, spinnerFrameIndex) {
|
|
954
|
+
const lines = snapshot.entries.flatMap((entry) => {
|
|
955
|
+
if (entry.kind === "line") return [entry.line];
|
|
956
|
+
if (entry.kind === "flow-line") return [formatInteractiveLine(entry.status, formatMessageWithElapsed(entry.message, entry.elapsedTimeMs), entry.depth, spinnerFrameIndex)];
|
|
957
|
+
return snapshot.treeRoots.flatMap((root) => renderTreeNodeLines(root, spinnerFrameIndex));
|
|
958
|
+
});
|
|
959
|
+
return snapshot.outroMessage ? [...lines, `└ ${snapshot.outroMessage}`] : lines;
|
|
960
|
+
}
|
|
961
|
+
function renderCompactSnapshotLines(snapshot, spinnerFrameIndex) {
|
|
962
|
+
const flowLineDepths = snapshot.entries.filter((entry) => entry.kind === "flow-line").map((entry) => entry.depth);
|
|
963
|
+
const maxCompactFlowLineDepth = flowLineDepths.length > 0 ? Math.min(...flowLineDepths) + 1 : Number.POSITIVE_INFINITY;
|
|
964
|
+
const lines = snapshot.entries.flatMap((entry) => {
|
|
965
|
+
if (entry.kind === "line") return [entry.line];
|
|
966
|
+
if (entry.kind === "flow-line") {
|
|
967
|
+
if (entry.depth > maxCompactFlowLineDepth) return [];
|
|
968
|
+
return [formatInteractiveLine(entry.status, formatMessageWithElapsed(entry.message, entry.elapsedTimeMs), entry.depth, spinnerFrameIndex)];
|
|
969
|
+
}
|
|
970
|
+
return snapshot.treeRoots.flatMap((root) => renderCompactTreeNodeLines(root, spinnerFrameIndex));
|
|
971
|
+
});
|
|
972
|
+
return snapshot.outroMessage ? [...lines, `└ ${snapshot.outroMessage}`] : lines;
|
|
973
|
+
}
|
|
974
|
+
function countRenderedTerminalRows(line, columns) {
|
|
975
|
+
return advanceTerminalPosition(line, columns).rowsAdvanced + 1;
|
|
976
|
+
}
|
|
977
|
+
function countRenderedRows(lines, dimensions) {
|
|
978
|
+
const columns = Math.max(1, dimensions.columns ?? DEFAULT_TERMINAL_COLUMNS);
|
|
979
|
+
return lines.reduce((sum, line) => sum + countRenderedTerminalRows(line, columns), 0);
|
|
980
|
+
}
|
|
981
|
+
function fitsRenderedLines(lines, dimensions, options = {}) {
|
|
982
|
+
if (dimensions.rows === void 0) return true;
|
|
983
|
+
const contextLines = options.reserveContext && dimensions.rows > TERMINAL_FRAME_CONTEXT_LINES * 2 ? TERMINAL_FRAME_CONTEXT_LINES : 0;
|
|
984
|
+
const lineLimit = Math.max(1, dimensions.rows - TERMINAL_FRAME_MARGIN_LINES - contextLines);
|
|
985
|
+
return countRenderedRows(lines, dimensions) <= lineLimit;
|
|
986
|
+
}
|
|
987
|
+
function fitRenderedLinesToTerminal(lines, dimensions, options = {}) {
|
|
988
|
+
if (fitsRenderedLines(lines, dimensions) && !options.omittedLines) return lines;
|
|
989
|
+
if (dimensions.rows === void 0) return options.omittedLines ? addOmittedLinesMarker(lines) : lines;
|
|
990
|
+
const lineLimit = Math.max(1, dimensions.rows - TERMINAL_FRAME_MARGIN_LINES);
|
|
991
|
+
const columns = Math.max(1, dimensions.columns ?? DEFAULT_TERMINAL_COLUMNS);
|
|
992
|
+
const lastLine = lines.at(-1);
|
|
993
|
+
const shouldPreserveOutro = lastLine?.startsWith("└ ") ?? false;
|
|
994
|
+
const bodyLineCount = lines.length - (shouldPreserveOutro ? 1 : 0);
|
|
995
|
+
const bodyLines = lines.slice(0, bodyLineCount);
|
|
996
|
+
const ellipsisRows = countRenderedTerminalRows(OMITTED_LINES_MARKER, columns);
|
|
997
|
+
const reservedRows = shouldPreserveOutro && lastLine ? countRenderedTerminalRows(lastLine, columns) : 0;
|
|
998
|
+
const availableBodyRows = Math.max(0, lineLimit - reservedRows);
|
|
999
|
+
const bodyRows = countRenderedRows(bodyLines, { columns });
|
|
1000
|
+
const shouldShowOmissionMarker = (options.omittedLines === true || bodyRows > availableBodyRows) && availableBodyRows >= ellipsisRows;
|
|
1001
|
+
const fittedLines = [];
|
|
1002
|
+
let remainingRows = availableBodyRows;
|
|
1003
|
+
if (shouldShowOmissionMarker) remainingRows -= ellipsisRows;
|
|
1004
|
+
for (let index = 0; index < bodyLineCount && remainingRows > 0; index++) {
|
|
1005
|
+
const line = lines[index];
|
|
1006
|
+
const rowCount = countRenderedTerminalRows(line, columns);
|
|
1007
|
+
if (rowCount > remainingRows) break;
|
|
1008
|
+
fittedLines.push(line);
|
|
1009
|
+
remainingRows -= rowCount;
|
|
1010
|
+
}
|
|
1011
|
+
if (shouldShowOmissionMarker) fittedLines.push(OMITTED_LINES_MARKER);
|
|
1012
|
+
if (shouldPreserveOutro && lastLine && reservedRows <= lineLimit) fittedLines.push(lastLine);
|
|
1013
|
+
if (fittedLines.length > 0) return fittedLines;
|
|
1014
|
+
return lines.slice(0, 1);
|
|
1015
|
+
}
|
|
1016
|
+
function addOmittedLinesMarker(lines) {
|
|
1017
|
+
if (lines.includes(OMITTED_LINES_MARKER)) return lines;
|
|
1018
|
+
const lastLine = lines.at(-1);
|
|
1019
|
+
if (lastLine?.startsWith("└ ")) return [
|
|
1020
|
+
...lines.slice(0, -1),
|
|
1021
|
+
OMITTED_LINES_MARKER,
|
|
1022
|
+
lastLine
|
|
1023
|
+
];
|
|
1024
|
+
return [...lines, OMITTED_LINES_MARKER];
|
|
1025
|
+
}
|
|
1026
|
+
function renderSnapshotLinesForTerminal(snapshot, spinnerFrameIndex, dimensions) {
|
|
1027
|
+
const shouldPreferCompact = snapshot.compactMode === "check-flow" && snapshot.outroMessage !== void 0;
|
|
1028
|
+
const fullLines = renderSnapshotLines(snapshot, spinnerFrameIndex);
|
|
1029
|
+
if (!shouldPreferCompact && fitsRenderedLines(fullLines, dimensions, { reserveContext: true })) return fullLines;
|
|
1030
|
+
const compactLines = renderCompactSnapshotLines(snapshot, spinnerFrameIndex);
|
|
1031
|
+
return fitRenderedLinesToTerminal(compactLines, dimensions, { omittedLines: compactLines.length < fullLines.length });
|
|
1032
|
+
}
|
|
1033
|
+
function hasRunningSnapshotWork(snapshot) {
|
|
1034
|
+
const hasRunningTreeNode = (node) => node.status === "running" || node.children.some(hasRunningTreeNode);
|
|
1035
|
+
return snapshot.entries.some((entry) => entry.kind === "flow-line" && entry.status === "start") || snapshot.treeRoots.some(hasRunningTreeNode);
|
|
1036
|
+
}
|
|
1037
|
+
function toWritableText(chunk) {
|
|
1038
|
+
if (chunk instanceof Uint8Array) return Buffer.from(chunk).toString();
|
|
1039
|
+
return chunk;
|
|
1040
|
+
}
|
|
1041
|
+
//#endregion
|
|
1042
|
+
//#region src/flow/terminal-frame.ts
|
|
1043
|
+
var TerminalFrameTracker = class {
|
|
1044
|
+
#completedLineCount = 0;
|
|
1045
|
+
#currentLine = "";
|
|
1046
|
+
#textStream = new TerminalTextStream();
|
|
1047
|
+
#getColumns;
|
|
1048
|
+
constructor(getColumns) {
|
|
1049
|
+
this.#getColumns = getColumns;
|
|
1050
|
+
}
|
|
1051
|
+
get lineCount() {
|
|
1052
|
+
return this.#completedLineCount + advanceTerminalPosition(this.#currentLine, Math.max(1, this.#getColumns())).rowsAdvanced;
|
|
1053
|
+
}
|
|
1054
|
+
record(chunk) {
|
|
1055
|
+
const text = this.#textStream.decode(chunk);
|
|
1056
|
+
const columns = Math.max(1, this.#getColumns());
|
|
1057
|
+
const lines = text.split("\n");
|
|
1058
|
+
this.#currentLine += lines.shift() ?? "";
|
|
1059
|
+
for (const line of lines) {
|
|
1060
|
+
this.#completedLineCount += advanceTerminalPosition(this.#currentLine, columns).rowsAdvanced + 1;
|
|
1061
|
+
this.#currentLine = line;
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
reset() {
|
|
1065
|
+
this.#completedLineCount = 0;
|
|
1066
|
+
this.#currentLine = "";
|
|
1067
|
+
this.#textStream.reset();
|
|
1068
|
+
}
|
|
1069
|
+
setLineCount(lineCount) {
|
|
1070
|
+
this.#completedLineCount = Math.max(0, lineCount);
|
|
1071
|
+
this.#currentLine = "";
|
|
1072
|
+
this.#textStream.reset();
|
|
1073
|
+
}
|
|
1074
|
+
};
|
|
1075
|
+
function patchWriteStream(stream, onWrite) {
|
|
1076
|
+
if (typeof stream?.write !== "function") return;
|
|
1077
|
+
const originalWrite = stream.write;
|
|
1078
|
+
const patchedWrite = (...args) => {
|
|
1079
|
+
onWrite(args[0]);
|
|
1080
|
+
return writeWithFlowArgs(originalWrite, args);
|
|
1081
|
+
};
|
|
1082
|
+
stream.write = patchedWrite;
|
|
1083
|
+
return () => {
|
|
1084
|
+
stream.write = originalWrite;
|
|
1085
|
+
};
|
|
1086
|
+
}
|
|
1087
|
+
function writeWithFlowArgs(write, args) {
|
|
1088
|
+
if (typeof args[1] === "string") return write(args[0], args[1], args[2]);
|
|
1089
|
+
return write(args[0], args[1]);
|
|
1090
|
+
}
|
|
1091
|
+
//#endregion
|
|
1092
|
+
export { formatInteractiveLine as a, renderSnapshotLinesForTerminal as c, stripAnsi as d, SPINNER_FRAMES as i, toTreeFlowStatus as l, patchWriteStream as n, formatMessageWithElapsed as o, writeWithFlowArgs as r, hasRunningSnapshotWork as s, TerminalFrameTracker as t, toWritableText as u };
|