@jsenv/test 3.7.20 → 3.7.22
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 +167 -85
- package/dist/jsenv_test_node_modules.js +14 -22
- package/package.json +20 -20
package/dist/jsenv_test.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createSupportsColor, isUnicodeSupported, stripAnsi,
|
|
1
|
+
import { createSupportsColor, isUnicodeSupported, stripAnsi, eastAsianWidth, clearTerminal, eraseLines } from "./jsenv_test_node_modules.js";
|
|
2
2
|
import { URL_META, createException } from "./exception.js";
|
|
3
3
|
import { readdir, chmod, stat, lstat, chmodSync, statSync, lstatSync, promises, readFile as readFile$1, readdirSync, openSync, closeSync, unlinkSync, rmdirSync, mkdirSync, readFileSync, writeFileSync as writeFileSync$1, unlink, rmdir, existsSync, realpathSync } from "node:fs";
|
|
4
4
|
import { takeCoverage } from "node:v8";
|
|
@@ -1385,23 +1385,122 @@ const error = (...args) => console.error(...args);
|
|
|
1385
1385
|
|
|
1386
1386
|
const errorDisabled = () => {};
|
|
1387
1387
|
|
|
1388
|
+
// Whole-cluster zero-width: Default_Ignorable, Control, Format, Mark, Surrogate
|
|
1389
|
+
const zeroWidthClusterRegex =
|
|
1390
|
+
/^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}\p{Surrogate}]+$/v;
|
|
1391
|
+
|
|
1392
|
+
// Strip leading non-printing chars to get the first visible scalar of a cluster
|
|
1393
|
+
const leadingNonPrintingRegex =
|
|
1394
|
+
/^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}\p{Surrogate}]+/v;
|
|
1395
|
+
|
|
1396
|
+
// RGI emoji sequences (e.g. flag sequences, ZWJ families, keycap+VS16)
|
|
1397
|
+
const rgiEmojiRegex = /^\p{RGI_Emoji}$/v;
|
|
1398
|
+
|
|
1399
|
+
// Unqualified keycap: digit/# /* + combining enclosing keycap (no VS16)
|
|
1400
|
+
const unqualifiedKeycapRegex = /^[\d#*]\u20E3$/;
|
|
1401
|
+
const extendedPictographicRegex = /\p{Extended_Pictographic}/gv;
|
|
1402
|
+
|
|
1403
|
+
const isDoubleWidthNonRgiEmojiSequence = (segment) => {
|
|
1404
|
+
if (segment.length > 50) {
|
|
1405
|
+
return false;
|
|
1406
|
+
}
|
|
1407
|
+
if (unqualifiedKeycapRegex.test(segment)) {
|
|
1408
|
+
return true;
|
|
1409
|
+
}
|
|
1410
|
+
// ZWJ sequences with 2+ Extended_Pictographic
|
|
1411
|
+
if (segment.includes("\u200D")) {
|
|
1412
|
+
const pictographics = segment.match(extendedPictographicRegex);
|
|
1413
|
+
return pictographics !== null && pictographics.length >= 2;
|
|
1414
|
+
}
|
|
1415
|
+
return false;
|
|
1416
|
+
};
|
|
1417
|
+
|
|
1418
|
+
const baseVisible = (segment) => {
|
|
1419
|
+
return segment.replace(leadingNonPrintingRegex, "");
|
|
1420
|
+
};
|
|
1421
|
+
|
|
1422
|
+
const isHangulLeadingJamo = (cp) => {
|
|
1423
|
+
return (cp >= 0x11_00 && cp <= 0x11_5f) || (cp >= 0xa9_60 && cp <= 0xa9_7c);
|
|
1424
|
+
};
|
|
1425
|
+
const isHangulVowelJamo = (cp) => {
|
|
1426
|
+
return (cp >= 0x11_60 && cp <= 0x11_a7) || (cp >= 0xd7_b0 && cp <= 0xd7_c6);
|
|
1427
|
+
};
|
|
1428
|
+
const isHangulTrailingJamo = (cp) => {
|
|
1429
|
+
return (cp >= 0x11_a8 && cp <= 0x11_ff) || (cp >= 0xd7_cb && cp <= 0xd7_fb);
|
|
1430
|
+
};
|
|
1431
|
+
const isHangulJamo = (cp) => {
|
|
1432
|
+
return (
|
|
1433
|
+
isHangulLeadingJamo(cp) || isHangulVowelJamo(cp) || isHangulTrailingJamo(cp)
|
|
1434
|
+
);
|
|
1435
|
+
};
|
|
1436
|
+
|
|
1437
|
+
const hangulClusterWidth = (visibleSegment, eastAsianWidthOptions) => {
|
|
1438
|
+
const codePoints = [];
|
|
1439
|
+
for (const character of visibleSegment) {
|
|
1440
|
+
if (zeroWidthClusterRegex.test(character)) {
|
|
1441
|
+
continue;
|
|
1442
|
+
}
|
|
1443
|
+
codePoints.push(character.codePointAt(0));
|
|
1444
|
+
}
|
|
1445
|
+
if (codePoints.length === 0) {
|
|
1446
|
+
return undefined;
|
|
1447
|
+
}
|
|
1448
|
+
let width = 0;
|
|
1449
|
+
for (let index = 0; index < codePoints.length; index++) {
|
|
1450
|
+
const codePoint = codePoints[index];
|
|
1451
|
+
if (!isHangulJamo(codePoint)) {
|
|
1452
|
+
if (width === 0) {
|
|
1453
|
+
return undefined;
|
|
1454
|
+
}
|
|
1455
|
+
for (let remaining = index; remaining < codePoints.length; remaining++) {
|
|
1456
|
+
width += eastAsianWidth(codePoints[remaining], eastAsianWidthOptions);
|
|
1457
|
+
}
|
|
1458
|
+
return width;
|
|
1459
|
+
}
|
|
1460
|
+
if (
|
|
1461
|
+
isHangulLeadingJamo(codePoint) &&
|
|
1462
|
+
isHangulVowelJamo(codePoints[index + 1])
|
|
1463
|
+
) {
|
|
1464
|
+
width += 2;
|
|
1465
|
+
index += isHangulTrailingJamo(codePoints[index + 2]) ? 2 : 1;
|
|
1466
|
+
continue;
|
|
1467
|
+
}
|
|
1468
|
+
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
1469
|
+
}
|
|
1470
|
+
return width;
|
|
1471
|
+
};
|
|
1472
|
+
|
|
1473
|
+
const trailingHalfwidthWidth = (visibleSegment, eastAsianWidthOptions) => {
|
|
1474
|
+
let extra = 0;
|
|
1475
|
+
let first = true;
|
|
1476
|
+
for (const character of visibleSegment) {
|
|
1477
|
+
if (first) {
|
|
1478
|
+
first = false;
|
|
1479
|
+
continue;
|
|
1480
|
+
}
|
|
1481
|
+
if (character >= "\uFF00" && character <= "\uFFEF") {
|
|
1482
|
+
extra += eastAsianWidth(character.codePointAt(0), eastAsianWidthOptions);
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
return extra;
|
|
1486
|
+
};
|
|
1487
|
+
|
|
1388
1488
|
const createMeasureTextWidth = ({ stripAnsi }) => {
|
|
1389
1489
|
const segmenter = new Intl.Segmenter();
|
|
1390
|
-
const defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
|
|
1391
1490
|
|
|
1392
1491
|
const measureTextWidth = (
|
|
1393
1492
|
string,
|
|
1394
|
-
{
|
|
1395
|
-
ambiguousIsNarrow = true,
|
|
1396
|
-
countAnsiEscapeCodes = false,
|
|
1397
|
-
skipEmojis = false,
|
|
1398
|
-
} = {},
|
|
1493
|
+
{ ambiguousIsNarrow = true, countAnsiEscapeCodes = false } = {},
|
|
1399
1494
|
) => {
|
|
1400
1495
|
if (typeof string !== "string" || string.length === 0) {
|
|
1401
1496
|
return 0;
|
|
1402
1497
|
}
|
|
1403
1498
|
|
|
1404
|
-
|
|
1499
|
+
// Only strip ANSI when escape codes are actually present
|
|
1500
|
+
if (
|
|
1501
|
+
!countAnsiEscapeCodes &&
|
|
1502
|
+
(string.includes("\u001B") || string.includes("\u009B"))
|
|
1503
|
+
) {
|
|
1405
1504
|
string = stripAnsi(string);
|
|
1406
1505
|
}
|
|
1407
1506
|
|
|
@@ -1409,70 +1508,54 @@ const createMeasureTextWidth = ({ stripAnsi }) => {
|
|
|
1409
1508
|
return 0;
|
|
1410
1509
|
}
|
|
1411
1510
|
|
|
1511
|
+
// Fast path: printable ASCII needs no segmenter or EAW lookup
|
|
1512
|
+
if (/^[\u0020-\u007E]*$/.test(string)) {
|
|
1513
|
+
return string.length;
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1412
1516
|
let width = 0;
|
|
1413
1517
|
const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
|
|
1414
1518
|
|
|
1415
|
-
for (const { segment
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
// Ignore control characters
|
|
1419
|
-
if (codePoint <= 0x1f || (codePoint >= 0x7f && codePoint <= 0x9f)) {
|
|
1420
|
-
continue;
|
|
1421
|
-
}
|
|
1422
|
-
|
|
1423
|
-
// Ignore zero-width characters
|
|
1424
|
-
if (
|
|
1425
|
-
(codePoint >= 0x20_0b && codePoint <= 0x20_0f) || // Zero-width space, non-joiner, joiner, left-to-right mark, right-to-left mark
|
|
1426
|
-
codePoint === 0xfe_ff // Zero-width no-break space
|
|
1427
|
-
) {
|
|
1519
|
+
for (const { segment } of segmenter.segment(string)) {
|
|
1520
|
+
if (zeroWidthClusterRegex.test(segment)) {
|
|
1428
1521
|
continue;
|
|
1429
1522
|
}
|
|
1430
1523
|
|
|
1431
|
-
//
|
|
1524
|
+
// RGI emoji + unqualified emoji sequences are double-width
|
|
1432
1525
|
if (
|
|
1433
|
-
(
|
|
1434
|
-
(
|
|
1435
|
-
(codePoint >= 0x1d_c0 && codePoint <= 0x1d_ff) || // Combining diacritical marks supplement
|
|
1436
|
-
(codePoint >= 0x20_d0 && codePoint <= 0x20_ff) || // Combining diacritical marks for symbols
|
|
1437
|
-
(codePoint >= 0xfe_20 && codePoint <= 0xfe_2f) // Combining half marks
|
|
1526
|
+
rgiEmojiRegex.test(segment) ||
|
|
1527
|
+
isDoubleWidthNonRgiEmojiSequence(segment)
|
|
1438
1528
|
) {
|
|
1529
|
+
if (process.env.CAPTURING_SIDE_EFFECTS && segment === "✔️") {
|
|
1530
|
+
width += 2;
|
|
1531
|
+
continue;
|
|
1532
|
+
}
|
|
1533
|
+
width += 2;
|
|
1439
1534
|
continue;
|
|
1440
1535
|
}
|
|
1441
1536
|
|
|
1442
|
-
|
|
1443
|
-
if (codePoint >= 0xd8_00 && codePoint <= 0xdf_ff) {
|
|
1444
|
-
continue;
|
|
1445
|
-
}
|
|
1446
|
-
|
|
1447
|
-
// Ignore variation selectors
|
|
1448
|
-
if (codePoint >= 0xfe_00 && codePoint <= 0xfe_0f) {
|
|
1449
|
-
continue;
|
|
1450
|
-
}
|
|
1451
|
-
|
|
1452
|
-
// This covers some of the above cases, but we still keep them for performance reasons.
|
|
1453
|
-
if (defaultIgnorableCodePointRegex.test(character)) {
|
|
1454
|
-
continue;
|
|
1455
|
-
}
|
|
1537
|
+
const visibleSegment = baseVisible(segment);
|
|
1456
1538
|
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
}
|
|
1464
|
-
width += measureTextWidth(character, {
|
|
1465
|
-
skipEmojis: true,
|
|
1466
|
-
countAnsiEscapeCodes: true, // to skip call to stripAnsi
|
|
1467
|
-
});
|
|
1539
|
+
const hangulWidth = hangulClusterWidth(
|
|
1540
|
+
visibleSegment,
|
|
1541
|
+
eastAsianWidthOptions,
|
|
1542
|
+
);
|
|
1543
|
+
if (hangulWidth !== undefined) {
|
|
1544
|
+
width += hangulWidth;
|
|
1468
1545
|
continue;
|
|
1469
1546
|
}
|
|
1470
1547
|
|
|
1548
|
+
// EAW of the cluster's first visible scalar
|
|
1549
|
+
const codePoint = visibleSegment.codePointAt(0);
|
|
1471
1550
|
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
1551
|
+
|
|
1552
|
+
// Add width for trailing Halfwidth/Fullwidth Forms (e.g. ゙, ゚, ー)
|
|
1553
|
+
width += trailingHalfwidthWidth(visibleSegment, eastAsianWidthOptions);
|
|
1472
1554
|
}
|
|
1473
1555
|
|
|
1474
1556
|
return width;
|
|
1475
1557
|
};
|
|
1558
|
+
|
|
1476
1559
|
return measureTextWidth;
|
|
1477
1560
|
};
|
|
1478
1561
|
|
|
@@ -3824,30 +3907,27 @@ const createPackageImportNotDefinedError = (
|
|
|
3824
3907
|
const isSpecifierForNodeBuiltin = (specifier) => {
|
|
3825
3908
|
return (
|
|
3826
3909
|
specifier.startsWith("node:") ||
|
|
3827
|
-
|
|
3910
|
+
NODE_BUILTIN_MODULE_SPECIFIER_SET.has(specifier)
|
|
3828
3911
|
);
|
|
3829
3912
|
};
|
|
3830
3913
|
|
|
3831
|
-
const
|
|
3914
|
+
const NODE_BUILTIN_MODULE_SPECIFIER_SET = new Set([
|
|
3832
3915
|
"assert",
|
|
3833
3916
|
"assert/strict",
|
|
3834
3917
|
"async_hooks",
|
|
3835
|
-
"buffer_ieee754",
|
|
3836
3918
|
"buffer",
|
|
3837
3919
|
"child_process",
|
|
3838
3920
|
"cluster",
|
|
3839
3921
|
"console",
|
|
3840
3922
|
"constants",
|
|
3841
3923
|
"crypto",
|
|
3842
|
-
"_debugger",
|
|
3843
3924
|
"diagnostics_channel",
|
|
3844
3925
|
"dgram",
|
|
3845
3926
|
"dns",
|
|
3927
|
+
"dns/promises",
|
|
3846
3928
|
"domain",
|
|
3847
3929
|
"events",
|
|
3848
|
-
"freelist",
|
|
3849
3930
|
"fs",
|
|
3850
|
-
"fsevents",
|
|
3851
3931
|
"fs/promises",
|
|
3852
3932
|
"_http_agent",
|
|
3853
3933
|
"_http_client",
|
|
@@ -3859,21 +3939,21 @@ const NODE_BUILTIN_MODULE_SPECIFIERS = [
|
|
|
3859
3939
|
"http2",
|
|
3860
3940
|
"https",
|
|
3861
3941
|
"inspector",
|
|
3862
|
-
"
|
|
3942
|
+
"inspector/promises",
|
|
3863
3943
|
"module",
|
|
3864
3944
|
"net",
|
|
3865
|
-
"node-inspect/lib/_inspect",
|
|
3866
|
-
"node-inspect/lib/internal/inspect_client",
|
|
3867
|
-
"node-inspect/lib/internal/inspect_repl",
|
|
3868
3945
|
"os",
|
|
3869
3946
|
"path",
|
|
3947
|
+
"path/posix",
|
|
3948
|
+
"path/win32",
|
|
3870
3949
|
"perf_hooks",
|
|
3871
3950
|
"process",
|
|
3872
3951
|
"punycode",
|
|
3873
3952
|
"querystring",
|
|
3874
3953
|
"readline",
|
|
3954
|
+
"readline/promises",
|
|
3875
3955
|
"repl",
|
|
3876
|
-
"
|
|
3956
|
+
"sea",
|
|
3877
3957
|
"sqlite",
|
|
3878
3958
|
"_stream_duplex",
|
|
3879
3959
|
"_stream_transform",
|
|
@@ -3882,10 +3962,15 @@ const NODE_BUILTIN_MODULE_SPECIFIERS = [
|
|
|
3882
3962
|
"_stream_readable",
|
|
3883
3963
|
"_stream_writable",
|
|
3884
3964
|
"stream",
|
|
3965
|
+
"stream/consumers",
|
|
3885
3966
|
"stream/promises",
|
|
3967
|
+
"stream/web",
|
|
3886
3968
|
"string_decoder",
|
|
3887
3969
|
"sys",
|
|
3970
|
+
"test",
|
|
3971
|
+
"test/reporters",
|
|
3888
3972
|
"timers",
|
|
3973
|
+
"timers/promises",
|
|
3889
3974
|
"_tls_common",
|
|
3890
3975
|
"_tls_legacy",
|
|
3891
3976
|
"_tls_wrap",
|
|
@@ -3894,20 +3979,15 @@ const NODE_BUILTIN_MODULE_SPECIFIERS = [
|
|
|
3894
3979
|
"tty",
|
|
3895
3980
|
"url",
|
|
3896
3981
|
"util",
|
|
3897
|
-
"
|
|
3898
|
-
"v8/tools/codemap",
|
|
3899
|
-
"v8/tools/consarray",
|
|
3900
|
-
"v8/tools/csvparser",
|
|
3901
|
-
"v8/tools/logreader",
|
|
3902
|
-
"v8/tools/profile_view",
|
|
3903
|
-
"v8/tools/splaytree",
|
|
3982
|
+
"util/types",
|
|
3904
3983
|
"v8",
|
|
3905
3984
|
"vm",
|
|
3985
|
+
"wasi",
|
|
3906
3986
|
"worker_threads",
|
|
3907
3987
|
"zlib",
|
|
3908
3988
|
// global is special
|
|
3909
3989
|
"global",
|
|
3910
|
-
];
|
|
3990
|
+
]);
|
|
3911
3991
|
|
|
3912
3992
|
/*
|
|
3913
3993
|
* https://nodejs.org/api/esm.html#resolver-algorithm-specification
|
|
@@ -4544,20 +4624,22 @@ const applyLegacySubpathResolution = (packageSubpath, resolutionContext) => {
|
|
|
4544
4624
|
|
|
4545
4625
|
const applyLegacyMainResolution = (packageSubpath, resolutionContext) => {
|
|
4546
4626
|
const { conditions, packageDirectoryUrl, packageJson } = resolutionContext;
|
|
4547
|
-
|
|
4548
|
-
const
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4627
|
+
if (packageJson) {
|
|
4628
|
+
for (const condition of conditions) {
|
|
4629
|
+
const conditionResolver = mainLegacyResolvers[condition];
|
|
4630
|
+
if (!conditionResolver) {
|
|
4631
|
+
continue;
|
|
4632
|
+
}
|
|
4633
|
+
const resolved = conditionResolver(resolutionContext);
|
|
4634
|
+
if (resolved) {
|
|
4635
|
+
return createResolutionResult({
|
|
4636
|
+
type: resolved.type,
|
|
4637
|
+
isMain: resolved.isMain,
|
|
4638
|
+
packageDirectoryUrl,
|
|
4639
|
+
packageJson,
|
|
4640
|
+
url: new URL(resolved.path, packageDirectoryUrl).href,
|
|
4641
|
+
});
|
|
4642
|
+
}
|
|
4561
4643
|
}
|
|
4562
4644
|
}
|
|
4563
4645
|
return createResolutionResult({
|
|
@@ -252,19 +252,18 @@ function stripAnsi(string) {
|
|
|
252
252
|
return string.replace(regex, '');
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
-
const r = String.raw,
|
|
256
|
-
e = r`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`;
|
|
257
|
-
const emojiRegex = () => new RegExp(r`\p{RI}{2}|(?)${e}(?:\u200D${e})*`, 'gu');
|
|
258
|
-
|
|
259
255
|
// Generated by scripts/build.js
|
|
260
256
|
|
|
261
|
-
|
|
257
|
+
const ambiguousMinimalCodePoint = 161;
|
|
258
|
+
const ambiguousMaximumCodePoint = 1114109;
|
|
262
259
|
const ambiguousRanges = [161, 161, 164, 164, 167, 168, 170, 170, 173, 174, 176, 180, 182, 186, 188, 191, 198, 198, 208, 208, 215, 216, 222, 225, 230, 230, 232, 234, 236, 237, 240, 240, 242, 243, 247, 250, 252, 252, 254, 254, 257, 257, 273, 273, 275, 275, 283, 283, 294, 295, 299, 299, 305, 307, 312, 312, 319, 322, 324, 324, 328, 331, 333, 333, 338, 339, 358, 359, 363, 363, 462, 462, 464, 464, 466, 466, 468, 468, 470, 470, 472, 472, 474, 474, 476, 476, 593, 593, 609, 609, 708, 708, 711, 711, 713, 715, 717, 717, 720, 720, 728, 731, 733, 733, 735, 735, 768, 879, 913, 929, 931, 937, 945, 961, 963, 969, 1025, 1025, 1040, 1103, 1105, 1105, 8208, 8208, 8211, 8214, 8216, 8217, 8220, 8221, 8224, 8226, 8228, 8231, 8240, 8240, 8242, 8243, 8245, 8245, 8251, 8251, 8254, 8254, 8308, 8308, 8319, 8319, 8321, 8324, 8364, 8364, 8451, 8451, 8453, 8453, 8457, 8457, 8467, 8467, 8470, 8470, 8481, 8482, 8486, 8486, 8491, 8491, 8531, 8532, 8539, 8542, 8544, 8555, 8560, 8569, 8585, 8585, 8592, 8601, 8632, 8633, 8658, 8658, 8660, 8660, 8679, 8679, 8704, 8704, 8706, 8707, 8711, 8712, 8715, 8715, 8719, 8719, 8721, 8721, 8725, 8725, 8730, 8730, 8733, 8736, 8739, 8739, 8741, 8741, 8743, 8748, 8750, 8750, 8756, 8759, 8764, 8765, 8776, 8776, 8780, 8780, 8786, 8786, 8800, 8801, 8804, 8807, 8810, 8811, 8814, 8815, 8834, 8835, 8838, 8839, 8853, 8853, 8857, 8857, 8869, 8869, 8895, 8895, 8978, 8978, 9312, 9449, 9451, 9547, 9552, 9587, 9600, 9615, 9618, 9621, 9632, 9633, 9635, 9641, 9650, 9651, 9654, 9655, 9660, 9661, 9664, 9665, 9670, 9672, 9675, 9675, 9678, 9681, 9698, 9701, 9711, 9711, 9733, 9734, 9737, 9737, 9742, 9743, 9756, 9756, 9758, 9758, 9792, 9792, 9794, 9794, 9824, 9825, 9827, 9829, 9831, 9834, 9836, 9837, 9839, 9839, 9886, 9887, 9919, 9919, 9926, 9933, 9935, 9939, 9941, 9953, 9955, 9955, 9960, 9961, 9963, 9969, 9972, 9972, 9974, 9977, 9979, 9980, 9982, 9983, 10045, 10045, 10102, 10111, 11094, 11097, 12872, 12879, 57344, 63743, 65024, 65039, 65533, 65533, 127232, 127242, 127248, 127277, 127280, 127337, 127344, 127373, 127375, 127376, 127387, 127404, 917760, 917999, 983040, 1048573, 1048576, 1114109];
|
|
263
260
|
|
|
264
|
-
|
|
261
|
+
const fullwidthMinimalCodePoint = 12288;
|
|
262
|
+
const fullwidthMaximumCodePoint = 65510;
|
|
265
263
|
const fullwidthRanges = [12288, 12288, 65281, 65376, 65504, 65510];
|
|
266
264
|
|
|
267
|
-
|
|
265
|
+
const wideMinimalCodePoint = 4352;
|
|
266
|
+
const wideMaximumCodePoint = 262141;
|
|
268
267
|
const wideRanges = [4352, 4447, 8986, 8987, 9001, 9002, 9193, 9196, 9200, 9200, 9203, 9203, 9725, 9726, 9748, 9749, 9776, 9783, 9800, 9811, 9855, 9855, 9866, 9871, 9875, 9875, 9889, 9889, 9898, 9899, 9917, 9918, 9924, 9925, 9934, 9934, 9940, 9940, 9962, 9962, 9970, 9971, 9973, 9973, 9978, 9978, 9981, 9981, 9989, 9989, 9994, 9995, 10024, 10024, 10060, 10060, 10062, 10062, 10067, 10069, 10071, 10071, 10133, 10135, 10160, 10160, 10175, 10175, 11035, 11036, 11088, 11088, 11093, 11093, 11904, 11929, 11931, 12019, 12032, 12245, 12272, 12287, 12289, 12350, 12353, 12438, 12441, 12543, 12549, 12591, 12593, 12686, 12688, 12773, 12783, 12830, 12832, 12871, 12880, 42124, 42128, 42182, 43360, 43388, 44032, 55203, 63744, 64255, 65040, 65049, 65072, 65106, 65108, 65126, 65128, 65131, 94176, 94180, 94192, 94198, 94208, 101589, 101631, 101662, 101760, 101874, 110576, 110579, 110581, 110587, 110589, 110590, 110592, 110882, 110898, 110898, 110928, 110930, 110933, 110933, 110948, 110951, 110960, 111355, 119552, 119638, 119648, 119670, 126980, 126980, 127183, 127183, 127374, 127374, 127377, 127386, 127488, 127490, 127504, 127547, 127552, 127560, 127568, 127569, 127584, 127589, 127744, 127776, 127789, 127797, 127799, 127868, 127870, 127891, 127904, 127946, 127951, 127955, 127968, 127984, 127988, 127988, 127992, 128062, 128064, 128064, 128066, 128252, 128255, 128317, 128331, 128334, 128336, 128359, 128378, 128378, 128405, 128406, 128420, 128420, 128507, 128591, 128640, 128709, 128716, 128716, 128720, 128722, 128725, 128728, 128732, 128735, 128747, 128748, 128756, 128764, 128992, 129003, 129008, 129008, 129292, 129338, 129340, 129349, 129351, 129535, 129648, 129660, 129664, 129674, 129678, 129734, 129736, 129736, 129741, 129756, 129759, 129770, 129775, 129784, 131072, 196605, 196608, 262141];
|
|
269
268
|
|
|
270
269
|
/**
|
|
@@ -292,15 +291,8 @@ const isInRange = (ranges, codePoint) => {
|
|
|
292
291
|
return false;
|
|
293
292
|
};
|
|
294
293
|
|
|
295
|
-
const minimumAmbiguousCodePoint = ambiguousRanges[0];
|
|
296
|
-
const maximumAmbiguousCodePoint = ambiguousRanges.at(-1);
|
|
297
|
-
const minimumFullWidthCodePoint = fullwidthRanges[0];
|
|
298
|
-
const maximumFullWidthCodePoint = fullwidthRanges.at(-1);
|
|
299
|
-
const minimumWideCodePoint = wideRanges[0];
|
|
300
|
-
const maximumWideCodePoint = wideRanges.at(-1);
|
|
301
|
-
|
|
302
294
|
const commonCjkCodePoint = 0x4E_00;
|
|
303
|
-
const [wideFastPathStart, wideFastPathEnd] = findWideFastPathRange(wideRanges);
|
|
295
|
+
const [wideFastPathStart, wideFastPathEnd] = /* #__PURE__ */ findWideFastPathRange(wideRanges);
|
|
304
296
|
|
|
305
297
|
// Use a hot-path range so common `isWide` calls can skip binary search.
|
|
306
298
|
// The range containing U+4E00 covers common CJK ideographs;
|
|
@@ -331,8 +323,8 @@ function findWideFastPathRange(ranges) {
|
|
|
331
323
|
|
|
332
324
|
const isAmbiguous = codePoint => {
|
|
333
325
|
if (
|
|
334
|
-
codePoint <
|
|
335
|
-
|| codePoint >
|
|
326
|
+
codePoint < ambiguousMinimalCodePoint
|
|
327
|
+
|| codePoint > ambiguousMaximumCodePoint
|
|
336
328
|
) {
|
|
337
329
|
return false;
|
|
338
330
|
}
|
|
@@ -342,8 +334,8 @@ const isAmbiguous = codePoint => {
|
|
|
342
334
|
|
|
343
335
|
const isFullWidth = codePoint => {
|
|
344
336
|
if (
|
|
345
|
-
codePoint <
|
|
346
|
-
|| codePoint >
|
|
337
|
+
codePoint < fullwidthMinimalCodePoint
|
|
338
|
+
|| codePoint > fullwidthMaximumCodePoint
|
|
347
339
|
) {
|
|
348
340
|
return false;
|
|
349
341
|
}
|
|
@@ -360,8 +352,8 @@ const isWide = codePoint => {
|
|
|
360
352
|
}
|
|
361
353
|
|
|
362
354
|
if (
|
|
363
|
-
codePoint <
|
|
364
|
-
|| codePoint >
|
|
355
|
+
codePoint < wideMinimalCodePoint
|
|
356
|
+
|| codePoint > wideMaximumCodePoint
|
|
365
357
|
) {
|
|
366
358
|
return false;
|
|
367
359
|
}
|
|
@@ -664,4 +656,4 @@ function parseStackTrace(stack) {
|
|
|
664
656
|
return parseFirefoxWebkit(lines);
|
|
665
657
|
}
|
|
666
658
|
|
|
667
|
-
export { clearTerminal, createSupportsColor, eastAsianWidth,
|
|
659
|
+
export { clearTerminal, createSupportsColor, eastAsianWidth, eraseLines, isUnicodeSupported, parseStackTrace, stripAnsi };
|
package/package.json
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/test",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.22",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"repository": {
|
|
5
6
|
"type": "git",
|
|
6
7
|
"url": "https://github.com/jsenv/core",
|
|
7
8
|
"directory": "packages/related/test"
|
|
8
9
|
},
|
|
9
10
|
"license": "MIT",
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
"./dist/js/node_child_process_controlled.mjs",
|
|
14
|
-
"./dist/js/node_worker_thread_controlled.mjs",
|
|
15
|
-
"./dist/jsenv_test_node_modules.js",
|
|
16
|
-
"./dist/jsenv_test.js"
|
|
17
|
-
],
|
|
18
|
-
"type": "module",
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=20.11.0"
|
|
13
|
+
},
|
|
19
14
|
"exports": {
|
|
20
15
|
".": {
|
|
21
16
|
"import": {
|
|
@@ -35,8 +30,8 @@
|
|
|
35
30
|
},
|
|
36
31
|
"dependencies": {
|
|
37
32
|
"@c88/v8-coverage": "0.1.1",
|
|
38
|
-
"@jsenv/ast": "6.
|
|
39
|
-
"@jsenv/plugin-supervisor": "1.8.
|
|
33
|
+
"@jsenv/ast": "6.8.1",
|
|
34
|
+
"@jsenv/plugin-supervisor": "1.8.2",
|
|
40
35
|
"@jsenv/sourcemap": "1.3.17",
|
|
41
36
|
"he": "1.2.0",
|
|
42
37
|
"istanbul-lib-coverage": "3.2.2",
|
|
@@ -46,6 +41,10 @@
|
|
|
46
41
|
"pidtree": "0.6.0",
|
|
47
42
|
"v8-to-istanbul": "9.3.0"
|
|
48
43
|
},
|
|
44
|
+
"optionalDependencies": {
|
|
45
|
+
"playwright": "1.x",
|
|
46
|
+
"playwright-core": "1.x"
|
|
47
|
+
},
|
|
49
48
|
"devDependencies": {
|
|
50
49
|
"@jsenv/abort": "../../tooling/abort",
|
|
51
50
|
"@jsenv/assert": "../tooling/assert",
|
|
@@ -69,14 +68,15 @@
|
|
|
69
68
|
"strip-ansi": "7.2.0",
|
|
70
69
|
"supports-color": "10.2.2"
|
|
71
70
|
},
|
|
72
|
-
"optionalDependencies": {
|
|
73
|
-
"playwright": "1.x",
|
|
74
|
-
"playwright-core": "1.x"
|
|
75
|
-
},
|
|
76
|
-
"engines": {
|
|
77
|
-
"node": ">=20.11.0"
|
|
78
|
-
},
|
|
79
71
|
"publishConfig": {
|
|
80
72
|
"access": "public"
|
|
81
|
-
}
|
|
73
|
+
},
|
|
74
|
+
"sideEffects": [
|
|
75
|
+
"./src/runtime_node/node_child_process_controlled.mjs",
|
|
76
|
+
"./src/runtime_node/node_worker_thread_controlled.mjs",
|
|
77
|
+
"./dist/js/node_child_process_controlled.mjs",
|
|
78
|
+
"./dist/js/node_worker_thread_controlled.mjs",
|
|
79
|
+
"./dist/jsenv_test_node_modules.js",
|
|
80
|
+
"./dist/jsenv_test.js"
|
|
81
|
+
]
|
|
82
82
|
}
|