@jsenv/test 3.6.11 → 3.6.13
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/dist/jsenv_test.js +102 -4
- package/dist/jsenv_test_node_modules.js +391 -1
- package/package.json +14 -9
package/dist/jsenv_test.js
CHANGED
|
@@ -7,8 +7,8 @@ import { pathToFileURL, fileURLToPath } from "node:url";
|
|
|
7
7
|
import { createRequire } from "node:module";
|
|
8
8
|
import { applyBabelPlugins } from "@jsenv/ast";
|
|
9
9
|
import { cpuUsage, memoryUsage } from "node:process";
|
|
10
|
-
import { createSupportsColor, isUnicodeSupported, clearTerminal, eraseLines } from "./jsenv_test_node_modules.js";
|
|
11
|
-
import {
|
|
10
|
+
import { createSupportsColor, isUnicodeSupported, emojiRegex, eastAsianWidth, clearTerminal, eraseLines } from "./jsenv_test_node_modules.js";
|
|
11
|
+
import { stripVTControlCharacters } from "node:util";
|
|
12
12
|
import { createException } from "@jsenv/exception";
|
|
13
13
|
import crypto from "node:crypto";
|
|
14
14
|
import { dirname } from "node:path";
|
|
@@ -1333,6 +1333,101 @@ const error = (...args) => console.error(...args);
|
|
|
1333
1333
|
|
|
1334
1334
|
const errorDisabled = () => {};
|
|
1335
1335
|
|
|
1336
|
+
const createMeasureTextWidth = ({ stripAnsi }) => {
|
|
1337
|
+
const segmenter = new Intl.Segmenter();
|
|
1338
|
+
const defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
|
|
1339
|
+
|
|
1340
|
+
const measureTextWidth = (
|
|
1341
|
+
string,
|
|
1342
|
+
{
|
|
1343
|
+
ambiguousIsNarrow = true,
|
|
1344
|
+
countAnsiEscapeCodes = false,
|
|
1345
|
+
skipEmojis = false,
|
|
1346
|
+
} = {},
|
|
1347
|
+
) => {
|
|
1348
|
+
if (typeof string !== "string" || string.length === 0) {
|
|
1349
|
+
return 0;
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
if (!countAnsiEscapeCodes) {
|
|
1353
|
+
string = stripAnsi(string);
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
if (string.length === 0) {
|
|
1357
|
+
return 0;
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
let width = 0;
|
|
1361
|
+
const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
|
|
1362
|
+
|
|
1363
|
+
for (const { segment: character } of segmenter.segment(string)) {
|
|
1364
|
+
const codePoint = character.codePointAt(0);
|
|
1365
|
+
|
|
1366
|
+
// Ignore control characters
|
|
1367
|
+
if (codePoint <= 0x1f || (codePoint >= 0x7f && codePoint <= 0x9f)) {
|
|
1368
|
+
continue;
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
// Ignore zero-width characters
|
|
1372
|
+
if (
|
|
1373
|
+
(codePoint >= 0x20_0b && codePoint <= 0x20_0f) || // Zero-width space, non-joiner, joiner, left-to-right mark, right-to-left mark
|
|
1374
|
+
codePoint === 0xfe_ff // Zero-width no-break space
|
|
1375
|
+
) {
|
|
1376
|
+
continue;
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
// Ignore combining characters
|
|
1380
|
+
if (
|
|
1381
|
+
(codePoint >= 0x3_00 && codePoint <= 0x3_6f) || // Combining diacritical marks
|
|
1382
|
+
(codePoint >= 0x1a_b0 && codePoint <= 0x1a_ff) || // Combining diacritical marks extended
|
|
1383
|
+
(codePoint >= 0x1d_c0 && codePoint <= 0x1d_ff) || // Combining diacritical marks supplement
|
|
1384
|
+
(codePoint >= 0x20_d0 && codePoint <= 0x20_ff) || // Combining diacritical marks for symbols
|
|
1385
|
+
(codePoint >= 0xfe_20 && codePoint <= 0xfe_2f) // Combining half marks
|
|
1386
|
+
) {
|
|
1387
|
+
continue;
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
// Ignore surrogate pairs
|
|
1391
|
+
if (codePoint >= 0xd8_00 && codePoint <= 0xdf_ff) {
|
|
1392
|
+
continue;
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
// Ignore variation selectors
|
|
1396
|
+
if (codePoint >= 0xfe_00 && codePoint <= 0xfe_0f) {
|
|
1397
|
+
continue;
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
// This covers some of the above cases, but we still keep them for performance reasons.
|
|
1401
|
+
if (defaultIgnorableCodePointRegex.test(character)) {
|
|
1402
|
+
continue;
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
if (!skipEmojis && emojiRegex().test(character)) {
|
|
1406
|
+
if (process.env.CAPTURING_SIDE_EFFECTS) {
|
|
1407
|
+
if (character === "✔️") {
|
|
1408
|
+
width += 2;
|
|
1409
|
+
continue;
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
width += measureTextWidth(character, {
|
|
1413
|
+
skipEmojis: true,
|
|
1414
|
+
countAnsiEscapeCodes: true, // to skip call to stripAnsi
|
|
1415
|
+
});
|
|
1416
|
+
continue;
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
return width;
|
|
1423
|
+
};
|
|
1424
|
+
return measureTextWidth;
|
|
1425
|
+
};
|
|
1426
|
+
|
|
1427
|
+
const measureTextWidth = createMeasureTextWidth({
|
|
1428
|
+
stripAnsi: stripVTControlCharacters,
|
|
1429
|
+
});
|
|
1430
|
+
|
|
1336
1431
|
/*
|
|
1337
1432
|
* see also https://github.com/vadimdemedes/ink
|
|
1338
1433
|
*/
|
|
@@ -2054,8 +2149,11 @@ const getParentDirectoryUrl = (url) => {
|
|
|
2054
2149
|
return new URL(url.endsWith("/") ? "../" : "./", url).href;
|
|
2055
2150
|
};
|
|
2056
2151
|
|
|
2057
|
-
const
|
|
2152
|
+
const findSelfOrAncestorDirectoryUrl = (url, callback) => {
|
|
2058
2153
|
url = String(url);
|
|
2154
|
+
if (!url.endsWith("/")) {
|
|
2155
|
+
url = new URL("./", url).href;
|
|
2156
|
+
}
|
|
2059
2157
|
while (url !== "file:///") {
|
|
2060
2158
|
if (callback(url)) {
|
|
2061
2159
|
return url;
|
|
@@ -3342,7 +3440,7 @@ const writeDirectorySync = (
|
|
|
3342
3440
|
if (e.code === "ENOTDIR") {
|
|
3343
3441
|
let previousNonDirUrl = destinationUrl;
|
|
3344
3442
|
// we must try all parent directories as long as it fails with ENOTDIR
|
|
3345
|
-
|
|
3443
|
+
findSelfOrAncestorDirectoryUrl(destinationUrl, (ancestorUrl) => {
|
|
3346
3444
|
try {
|
|
3347
3445
|
statSync(new URL(ancestorUrl));
|
|
3348
3446
|
return true;
|
|
@@ -211,6 +211,396 @@ function isUnicodeSupported() {
|
|
|
211
211
|
|| env.TERMINAL_EMULATOR === 'JetBrains-JediTerm';
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
+
const r = String.raw;
|
|
215
|
+
const seq = r`(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})`;
|
|
216
|
+
const sTags = r`\u{E0061}-\u{E007A}`;
|
|
217
|
+
const emojiRegex = () => new RegExp(r`[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[${sTags}]{2}[\u{E0030}-\u{E0039}${sTags}]{1,3}\u{E007F}|${seq}(?:\u200D${seq})*`, 'gu');
|
|
218
|
+
|
|
219
|
+
// Generated code.
|
|
220
|
+
|
|
221
|
+
function isAmbiguous(x) {
|
|
222
|
+
return x === 0xA1
|
|
223
|
+
|| x === 0xA4
|
|
224
|
+
|| x === 0xA7
|
|
225
|
+
|| x === 0xA8
|
|
226
|
+
|| x === 0xAA
|
|
227
|
+
|| x === 0xAD
|
|
228
|
+
|| x === 0xAE
|
|
229
|
+
|| x >= 0xB0 && x <= 0xB4
|
|
230
|
+
|| x >= 0xB6 && x <= 0xBA
|
|
231
|
+
|| x >= 0xBC && x <= 0xBF
|
|
232
|
+
|| x === 0xC6
|
|
233
|
+
|| x === 0xD0
|
|
234
|
+
|| x === 0xD7
|
|
235
|
+
|| x === 0xD8
|
|
236
|
+
|| x >= 0xDE && x <= 0xE1
|
|
237
|
+
|| x === 0xE6
|
|
238
|
+
|| x >= 0xE8 && x <= 0xEA
|
|
239
|
+
|| x === 0xEC
|
|
240
|
+
|| x === 0xED
|
|
241
|
+
|| x === 0xF0
|
|
242
|
+
|| x === 0xF2
|
|
243
|
+
|| x === 0xF3
|
|
244
|
+
|| x >= 0xF7 && x <= 0xFA
|
|
245
|
+
|| x === 0xFC
|
|
246
|
+
|| x === 0xFE
|
|
247
|
+
|| x === 0x101
|
|
248
|
+
|| x === 0x111
|
|
249
|
+
|| x === 0x113
|
|
250
|
+
|| x === 0x11B
|
|
251
|
+
|| x === 0x126
|
|
252
|
+
|| x === 0x127
|
|
253
|
+
|| x === 0x12B
|
|
254
|
+
|| x >= 0x131 && x <= 0x133
|
|
255
|
+
|| x === 0x138
|
|
256
|
+
|| x >= 0x13F && x <= 0x142
|
|
257
|
+
|| x === 0x144
|
|
258
|
+
|| x >= 0x148 && x <= 0x14B
|
|
259
|
+
|| x === 0x14D
|
|
260
|
+
|| x === 0x152
|
|
261
|
+
|| x === 0x153
|
|
262
|
+
|| x === 0x166
|
|
263
|
+
|| x === 0x167
|
|
264
|
+
|| x === 0x16B
|
|
265
|
+
|| x === 0x1CE
|
|
266
|
+
|| x === 0x1D0
|
|
267
|
+
|| x === 0x1D2
|
|
268
|
+
|| x === 0x1D4
|
|
269
|
+
|| x === 0x1D6
|
|
270
|
+
|| x === 0x1D8
|
|
271
|
+
|| x === 0x1DA
|
|
272
|
+
|| x === 0x1DC
|
|
273
|
+
|| x === 0x251
|
|
274
|
+
|| x === 0x261
|
|
275
|
+
|| x === 0x2C4
|
|
276
|
+
|| x === 0x2C7
|
|
277
|
+
|| x >= 0x2C9 && x <= 0x2CB
|
|
278
|
+
|| x === 0x2CD
|
|
279
|
+
|| x === 0x2D0
|
|
280
|
+
|| x >= 0x2D8 && x <= 0x2DB
|
|
281
|
+
|| x === 0x2DD
|
|
282
|
+
|| x === 0x2DF
|
|
283
|
+
|| x >= 0x300 && x <= 0x36F
|
|
284
|
+
|| x >= 0x391 && x <= 0x3A1
|
|
285
|
+
|| x >= 0x3A3 && x <= 0x3A9
|
|
286
|
+
|| x >= 0x3B1 && x <= 0x3C1
|
|
287
|
+
|| x >= 0x3C3 && x <= 0x3C9
|
|
288
|
+
|| x === 0x401
|
|
289
|
+
|| x >= 0x410 && x <= 0x44F
|
|
290
|
+
|| x === 0x451
|
|
291
|
+
|| x === 0x2010
|
|
292
|
+
|| x >= 0x2013 && x <= 0x2016
|
|
293
|
+
|| x === 0x2018
|
|
294
|
+
|| x === 0x2019
|
|
295
|
+
|| x === 0x201C
|
|
296
|
+
|| x === 0x201D
|
|
297
|
+
|| x >= 0x2020 && x <= 0x2022
|
|
298
|
+
|| x >= 0x2024 && x <= 0x2027
|
|
299
|
+
|| x === 0x2030
|
|
300
|
+
|| x === 0x2032
|
|
301
|
+
|| x === 0x2033
|
|
302
|
+
|| x === 0x2035
|
|
303
|
+
|| x === 0x203B
|
|
304
|
+
|| x === 0x203E
|
|
305
|
+
|| x === 0x2074
|
|
306
|
+
|| x === 0x207F
|
|
307
|
+
|| x >= 0x2081 && x <= 0x2084
|
|
308
|
+
|| x === 0x20AC
|
|
309
|
+
|| x === 0x2103
|
|
310
|
+
|| x === 0x2105
|
|
311
|
+
|| x === 0x2109
|
|
312
|
+
|| x === 0x2113
|
|
313
|
+
|| x === 0x2116
|
|
314
|
+
|| x === 0x2121
|
|
315
|
+
|| x === 0x2122
|
|
316
|
+
|| x === 0x2126
|
|
317
|
+
|| x === 0x212B
|
|
318
|
+
|| x === 0x2153
|
|
319
|
+
|| x === 0x2154
|
|
320
|
+
|| x >= 0x215B && x <= 0x215E
|
|
321
|
+
|| x >= 0x2160 && x <= 0x216B
|
|
322
|
+
|| x >= 0x2170 && x <= 0x2179
|
|
323
|
+
|| x === 0x2189
|
|
324
|
+
|| x >= 0x2190 && x <= 0x2199
|
|
325
|
+
|| x === 0x21B8
|
|
326
|
+
|| x === 0x21B9
|
|
327
|
+
|| x === 0x21D2
|
|
328
|
+
|| x === 0x21D4
|
|
329
|
+
|| x === 0x21E7
|
|
330
|
+
|| x === 0x2200
|
|
331
|
+
|| x === 0x2202
|
|
332
|
+
|| x === 0x2203
|
|
333
|
+
|| x === 0x2207
|
|
334
|
+
|| x === 0x2208
|
|
335
|
+
|| x === 0x220B
|
|
336
|
+
|| x === 0x220F
|
|
337
|
+
|| x === 0x2211
|
|
338
|
+
|| x === 0x2215
|
|
339
|
+
|| x === 0x221A
|
|
340
|
+
|| x >= 0x221D && x <= 0x2220
|
|
341
|
+
|| x === 0x2223
|
|
342
|
+
|| x === 0x2225
|
|
343
|
+
|| x >= 0x2227 && x <= 0x222C
|
|
344
|
+
|| x === 0x222E
|
|
345
|
+
|| x >= 0x2234 && x <= 0x2237
|
|
346
|
+
|| x === 0x223C
|
|
347
|
+
|| x === 0x223D
|
|
348
|
+
|| x === 0x2248
|
|
349
|
+
|| x === 0x224C
|
|
350
|
+
|| x === 0x2252
|
|
351
|
+
|| x === 0x2260
|
|
352
|
+
|| x === 0x2261
|
|
353
|
+
|| x >= 0x2264 && x <= 0x2267
|
|
354
|
+
|| x === 0x226A
|
|
355
|
+
|| x === 0x226B
|
|
356
|
+
|| x === 0x226E
|
|
357
|
+
|| x === 0x226F
|
|
358
|
+
|| x === 0x2282
|
|
359
|
+
|| x === 0x2283
|
|
360
|
+
|| x === 0x2286
|
|
361
|
+
|| x === 0x2287
|
|
362
|
+
|| x === 0x2295
|
|
363
|
+
|| x === 0x2299
|
|
364
|
+
|| x === 0x22A5
|
|
365
|
+
|| x === 0x22BF
|
|
366
|
+
|| x === 0x2312
|
|
367
|
+
|| x >= 0x2460 && x <= 0x24E9
|
|
368
|
+
|| x >= 0x24EB && x <= 0x254B
|
|
369
|
+
|| x >= 0x2550 && x <= 0x2573
|
|
370
|
+
|| x >= 0x2580 && x <= 0x258F
|
|
371
|
+
|| x >= 0x2592 && x <= 0x2595
|
|
372
|
+
|| x === 0x25A0
|
|
373
|
+
|| x === 0x25A1
|
|
374
|
+
|| x >= 0x25A3 && x <= 0x25A9
|
|
375
|
+
|| x === 0x25B2
|
|
376
|
+
|| x === 0x25B3
|
|
377
|
+
|| x === 0x25B6
|
|
378
|
+
|| x === 0x25B7
|
|
379
|
+
|| x === 0x25BC
|
|
380
|
+
|| x === 0x25BD
|
|
381
|
+
|| x === 0x25C0
|
|
382
|
+
|| x === 0x25C1
|
|
383
|
+
|| x >= 0x25C6 && x <= 0x25C8
|
|
384
|
+
|| x === 0x25CB
|
|
385
|
+
|| x >= 0x25CE && x <= 0x25D1
|
|
386
|
+
|| x >= 0x25E2 && x <= 0x25E5
|
|
387
|
+
|| x === 0x25EF
|
|
388
|
+
|| x === 0x2605
|
|
389
|
+
|| x === 0x2606
|
|
390
|
+
|| x === 0x2609
|
|
391
|
+
|| x === 0x260E
|
|
392
|
+
|| x === 0x260F
|
|
393
|
+
|| x === 0x261C
|
|
394
|
+
|| x === 0x261E
|
|
395
|
+
|| x === 0x2640
|
|
396
|
+
|| x === 0x2642
|
|
397
|
+
|| x === 0x2660
|
|
398
|
+
|| x === 0x2661
|
|
399
|
+
|| x >= 0x2663 && x <= 0x2665
|
|
400
|
+
|| x >= 0x2667 && x <= 0x266A
|
|
401
|
+
|| x === 0x266C
|
|
402
|
+
|| x === 0x266D
|
|
403
|
+
|| x === 0x266F
|
|
404
|
+
|| x === 0x269E
|
|
405
|
+
|| x === 0x269F
|
|
406
|
+
|| x === 0x26BF
|
|
407
|
+
|| x >= 0x26C6 && x <= 0x26CD
|
|
408
|
+
|| x >= 0x26CF && x <= 0x26D3
|
|
409
|
+
|| x >= 0x26D5 && x <= 0x26E1
|
|
410
|
+
|| x === 0x26E3
|
|
411
|
+
|| x === 0x26E8
|
|
412
|
+
|| x === 0x26E9
|
|
413
|
+
|| x >= 0x26EB && x <= 0x26F1
|
|
414
|
+
|| x === 0x26F4
|
|
415
|
+
|| x >= 0x26F6 && x <= 0x26F9
|
|
416
|
+
|| x === 0x26FB
|
|
417
|
+
|| x === 0x26FC
|
|
418
|
+
|| x === 0x26FE
|
|
419
|
+
|| x === 0x26FF
|
|
420
|
+
|| x === 0x273D
|
|
421
|
+
|| x >= 0x2776 && x <= 0x277F
|
|
422
|
+
|| x >= 0x2B56 && x <= 0x2B59
|
|
423
|
+
|| x >= 0x3248 && x <= 0x324F
|
|
424
|
+
|| x >= 0xE000 && x <= 0xF8FF
|
|
425
|
+
|| x >= 0xFE00 && x <= 0xFE0F
|
|
426
|
+
|| x === 0xFFFD
|
|
427
|
+
|| x >= 0x1F100 && x <= 0x1F10A
|
|
428
|
+
|| x >= 0x1F110 && x <= 0x1F12D
|
|
429
|
+
|| x >= 0x1F130 && x <= 0x1F169
|
|
430
|
+
|| x >= 0x1F170 && x <= 0x1F18D
|
|
431
|
+
|| x === 0x1F18F
|
|
432
|
+
|| x === 0x1F190
|
|
433
|
+
|| x >= 0x1F19B && x <= 0x1F1AC
|
|
434
|
+
|| x >= 0xE0100 && x <= 0xE01EF
|
|
435
|
+
|| x >= 0xF0000 && x <= 0xFFFFD
|
|
436
|
+
|| x >= 0x100000 && x <= 0x10FFFD;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
function isFullWidth(x) {
|
|
440
|
+
return x === 0x3000
|
|
441
|
+
|| x >= 0xFF01 && x <= 0xFF60
|
|
442
|
+
|| x >= 0xFFE0 && x <= 0xFFE6;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
function isWide(x) {
|
|
446
|
+
return x >= 0x1100 && x <= 0x115F
|
|
447
|
+
|| x === 0x231A
|
|
448
|
+
|| x === 0x231B
|
|
449
|
+
|| x === 0x2329
|
|
450
|
+
|| x === 0x232A
|
|
451
|
+
|| x >= 0x23E9 && x <= 0x23EC
|
|
452
|
+
|| x === 0x23F0
|
|
453
|
+
|| x === 0x23F3
|
|
454
|
+
|| x === 0x25FD
|
|
455
|
+
|| x === 0x25FE
|
|
456
|
+
|| x === 0x2614
|
|
457
|
+
|| x === 0x2615
|
|
458
|
+
|| x >= 0x2630 && x <= 0x2637
|
|
459
|
+
|| x >= 0x2648 && x <= 0x2653
|
|
460
|
+
|| x === 0x267F
|
|
461
|
+
|| x >= 0x268A && x <= 0x268F
|
|
462
|
+
|| x === 0x2693
|
|
463
|
+
|| x === 0x26A1
|
|
464
|
+
|| x === 0x26AA
|
|
465
|
+
|| x === 0x26AB
|
|
466
|
+
|| x === 0x26BD
|
|
467
|
+
|| x === 0x26BE
|
|
468
|
+
|| x === 0x26C4
|
|
469
|
+
|| x === 0x26C5
|
|
470
|
+
|| x === 0x26CE
|
|
471
|
+
|| x === 0x26D4
|
|
472
|
+
|| x === 0x26EA
|
|
473
|
+
|| x === 0x26F2
|
|
474
|
+
|| x === 0x26F3
|
|
475
|
+
|| x === 0x26F5
|
|
476
|
+
|| x === 0x26FA
|
|
477
|
+
|| x === 0x26FD
|
|
478
|
+
|| x === 0x2705
|
|
479
|
+
|| x === 0x270A
|
|
480
|
+
|| x === 0x270B
|
|
481
|
+
|| x === 0x2728
|
|
482
|
+
|| x === 0x274C
|
|
483
|
+
|| x === 0x274E
|
|
484
|
+
|| x >= 0x2753 && x <= 0x2755
|
|
485
|
+
|| x === 0x2757
|
|
486
|
+
|| x >= 0x2795 && x <= 0x2797
|
|
487
|
+
|| x === 0x27B0
|
|
488
|
+
|| x === 0x27BF
|
|
489
|
+
|| x === 0x2B1B
|
|
490
|
+
|| x === 0x2B1C
|
|
491
|
+
|| x === 0x2B50
|
|
492
|
+
|| x === 0x2B55
|
|
493
|
+
|| x >= 0x2E80 && x <= 0x2E99
|
|
494
|
+
|| x >= 0x2E9B && x <= 0x2EF3
|
|
495
|
+
|| x >= 0x2F00 && x <= 0x2FD5
|
|
496
|
+
|| x >= 0x2FF0 && x <= 0x2FFF
|
|
497
|
+
|| x >= 0x3001 && x <= 0x303E
|
|
498
|
+
|| x >= 0x3041 && x <= 0x3096
|
|
499
|
+
|| x >= 0x3099 && x <= 0x30FF
|
|
500
|
+
|| x >= 0x3105 && x <= 0x312F
|
|
501
|
+
|| x >= 0x3131 && x <= 0x318E
|
|
502
|
+
|| x >= 0x3190 && x <= 0x31E5
|
|
503
|
+
|| x >= 0x31EF && x <= 0x321E
|
|
504
|
+
|| x >= 0x3220 && x <= 0x3247
|
|
505
|
+
|| x >= 0x3250 && x <= 0xA48C
|
|
506
|
+
|| x >= 0xA490 && x <= 0xA4C6
|
|
507
|
+
|| x >= 0xA960 && x <= 0xA97C
|
|
508
|
+
|| x >= 0xAC00 && x <= 0xD7A3
|
|
509
|
+
|| x >= 0xF900 && x <= 0xFAFF
|
|
510
|
+
|| x >= 0xFE10 && x <= 0xFE19
|
|
511
|
+
|| x >= 0xFE30 && x <= 0xFE52
|
|
512
|
+
|| x >= 0xFE54 && x <= 0xFE66
|
|
513
|
+
|| x >= 0xFE68 && x <= 0xFE6B
|
|
514
|
+
|| x >= 0x16FE0 && x <= 0x16FE4
|
|
515
|
+
|| x === 0x16FF0
|
|
516
|
+
|| x === 0x16FF1
|
|
517
|
+
|| x >= 0x17000 && x <= 0x187F7
|
|
518
|
+
|| x >= 0x18800 && x <= 0x18CD5
|
|
519
|
+
|| x >= 0x18CFF && x <= 0x18D08
|
|
520
|
+
|| x >= 0x1AFF0 && x <= 0x1AFF3
|
|
521
|
+
|| x >= 0x1AFF5 && x <= 0x1AFFB
|
|
522
|
+
|| x === 0x1AFFD
|
|
523
|
+
|| x === 0x1AFFE
|
|
524
|
+
|| x >= 0x1B000 && x <= 0x1B122
|
|
525
|
+
|| x === 0x1B132
|
|
526
|
+
|| x >= 0x1B150 && x <= 0x1B152
|
|
527
|
+
|| x === 0x1B155
|
|
528
|
+
|| x >= 0x1B164 && x <= 0x1B167
|
|
529
|
+
|| x >= 0x1B170 && x <= 0x1B2FB
|
|
530
|
+
|| x >= 0x1D300 && x <= 0x1D356
|
|
531
|
+
|| x >= 0x1D360 && x <= 0x1D376
|
|
532
|
+
|| x === 0x1F004
|
|
533
|
+
|| x === 0x1F0CF
|
|
534
|
+
|| x === 0x1F18E
|
|
535
|
+
|| x >= 0x1F191 && x <= 0x1F19A
|
|
536
|
+
|| x >= 0x1F200 && x <= 0x1F202
|
|
537
|
+
|| x >= 0x1F210 && x <= 0x1F23B
|
|
538
|
+
|| x >= 0x1F240 && x <= 0x1F248
|
|
539
|
+
|| x === 0x1F250
|
|
540
|
+
|| x === 0x1F251
|
|
541
|
+
|| x >= 0x1F260 && x <= 0x1F265
|
|
542
|
+
|| x >= 0x1F300 && x <= 0x1F320
|
|
543
|
+
|| x >= 0x1F32D && x <= 0x1F335
|
|
544
|
+
|| x >= 0x1F337 && x <= 0x1F37C
|
|
545
|
+
|| x >= 0x1F37E && x <= 0x1F393
|
|
546
|
+
|| x >= 0x1F3A0 && x <= 0x1F3CA
|
|
547
|
+
|| x >= 0x1F3CF && x <= 0x1F3D3
|
|
548
|
+
|| x >= 0x1F3E0 && x <= 0x1F3F0
|
|
549
|
+
|| x === 0x1F3F4
|
|
550
|
+
|| x >= 0x1F3F8 && x <= 0x1F43E
|
|
551
|
+
|| x === 0x1F440
|
|
552
|
+
|| x >= 0x1F442 && x <= 0x1F4FC
|
|
553
|
+
|| x >= 0x1F4FF && x <= 0x1F53D
|
|
554
|
+
|| x >= 0x1F54B && x <= 0x1F54E
|
|
555
|
+
|| x >= 0x1F550 && x <= 0x1F567
|
|
556
|
+
|| x === 0x1F57A
|
|
557
|
+
|| x === 0x1F595
|
|
558
|
+
|| x === 0x1F596
|
|
559
|
+
|| x === 0x1F5A4
|
|
560
|
+
|| x >= 0x1F5FB && x <= 0x1F64F
|
|
561
|
+
|| x >= 0x1F680 && x <= 0x1F6C5
|
|
562
|
+
|| x === 0x1F6CC
|
|
563
|
+
|| x >= 0x1F6D0 && x <= 0x1F6D2
|
|
564
|
+
|| x >= 0x1F6D5 && x <= 0x1F6D7
|
|
565
|
+
|| x >= 0x1F6DC && x <= 0x1F6DF
|
|
566
|
+
|| x === 0x1F6EB
|
|
567
|
+
|| x === 0x1F6EC
|
|
568
|
+
|| x >= 0x1F6F4 && x <= 0x1F6FC
|
|
569
|
+
|| x >= 0x1F7E0 && x <= 0x1F7EB
|
|
570
|
+
|| x === 0x1F7F0
|
|
571
|
+
|| x >= 0x1F90C && x <= 0x1F93A
|
|
572
|
+
|| x >= 0x1F93C && x <= 0x1F945
|
|
573
|
+
|| x >= 0x1F947 && x <= 0x1F9FF
|
|
574
|
+
|| x >= 0x1FA70 && x <= 0x1FA7C
|
|
575
|
+
|| x >= 0x1FA80 && x <= 0x1FA89
|
|
576
|
+
|| x >= 0x1FA8F && x <= 0x1FAC6
|
|
577
|
+
|| x >= 0x1FACE && x <= 0x1FADC
|
|
578
|
+
|| x >= 0x1FADF && x <= 0x1FAE9
|
|
579
|
+
|| x >= 0x1FAF0 && x <= 0x1FAF8
|
|
580
|
+
|| x >= 0x20000 && x <= 0x2FFFD
|
|
581
|
+
|| x >= 0x30000 && x <= 0x3FFFD;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
function validate(codePoint) {
|
|
585
|
+
if (!Number.isSafeInteger(codePoint)) {
|
|
586
|
+
throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
function eastAsianWidth(codePoint, {ambiguousAsWide = false} = {}) {
|
|
591
|
+
validate(codePoint);
|
|
592
|
+
|
|
593
|
+
if (
|
|
594
|
+
isFullWidth(codePoint)
|
|
595
|
+
|| isWide(codePoint)
|
|
596
|
+
|| (ambiguousAsWide && isAmbiguous(codePoint))
|
|
597
|
+
) {
|
|
598
|
+
return 2;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
return 1;
|
|
602
|
+
}
|
|
603
|
+
|
|
214
604
|
/* globals WorkerGlobalScope, DedicatedWorkerGlobalScope, SharedWorkerGlobalScope, ServiceWorkerGlobalScope */
|
|
215
605
|
|
|
216
606
|
const isBrowser = globalThis.window?.document !== undefined;
|
|
@@ -292,4 +682,4 @@ const clearTerminal = isWindows
|
|
|
292
682
|
// More info: https://www.real-world-systems.com/docs/ANSIcode.html
|
|
293
683
|
: `${eraseScreen}${ESC}3J${ESC}H`;
|
|
294
684
|
|
|
295
|
-
export { clearTerminal, createSupportsColor, eraseLines, isUnicodeSupported };
|
|
685
|
+
export { clearTerminal, createSupportsColor, eastAsianWidth, emojiRegex, eraseLines, isUnicodeSupported };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/test",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.13",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,7 +29,12 @@
|
|
|
29
29
|
],
|
|
30
30
|
"sideEffects": [
|
|
31
31
|
"./src/runtime_node/node_child_process_controlled.mjs",
|
|
32
|
-
"./src/runtime_node/node_worker_thread_controlled.mjs"
|
|
32
|
+
"./src/runtime_node/node_worker_thread_controlled.mjs",
|
|
33
|
+
"./dist/js/node_child_process_controlled.mjs",
|
|
34
|
+
"./dist/js/node_worker_thread_controlled.mjs",
|
|
35
|
+
"./dist/jsenv_test_node_modules.js",
|
|
36
|
+
"./dist/js/node_child_process_controlled.mjs",
|
|
37
|
+
"./dist/js/node_worker_thread_controlled.mjs"
|
|
33
38
|
],
|
|
34
39
|
"scripts": {
|
|
35
40
|
"build": "node --conditions=development ./scripts/build.mjs",
|
|
@@ -41,16 +46,16 @@
|
|
|
41
46
|
"dependencies": {
|
|
42
47
|
"@c88/v8-coverage": "0.1.1",
|
|
43
48
|
"@jsenv/abort": "4.3.1",
|
|
44
|
-
"@jsenv/ast": "6.6.
|
|
49
|
+
"@jsenv/ast": "6.6.9",
|
|
45
50
|
"@jsenv/exception": "1.1.7",
|
|
46
|
-
"@jsenv/filesystem": "4.
|
|
47
|
-
"@jsenv/github-check-run": "0.2.
|
|
51
|
+
"@jsenv/filesystem": "4.15.0",
|
|
52
|
+
"@jsenv/github-check-run": "0.2.23",
|
|
48
53
|
"@jsenv/node-esm-resolution": "1.2.0",
|
|
49
|
-
"@jsenv/humanize": "1.
|
|
50
|
-
"@jsenv/plugin-supervisor": "1.6.
|
|
51
|
-
"@jsenv/sourcemap": "1.3.
|
|
54
|
+
"@jsenv/humanize": "1.5.0",
|
|
55
|
+
"@jsenv/plugin-supervisor": "1.6.13",
|
|
56
|
+
"@jsenv/sourcemap": "1.3.5",
|
|
52
57
|
"@jsenv/url-meta": "8.5.6",
|
|
53
|
-
"@jsenv/urls": "2.7.
|
|
58
|
+
"@jsenv/urls": "2.7.2",
|
|
54
59
|
"@jsenv/utils": "2.3.0",
|
|
55
60
|
"he": "1.2.0",
|
|
56
61
|
"istanbul-lib-coverage": "3.2.2",
|