@jsenv/test 3.7.51 → 3.7.53
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_node_modules.js +23 -13
- package/package.json +4 -4
|
@@ -47,7 +47,11 @@ function envForceColor() {
|
|
|
47
47
|
return 1;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
if (!/^\d+$/v.test(env.FORCE_COLOR)) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const level = Math.min(Number(env.FORCE_COLOR), 3);
|
|
51
55
|
|
|
52
56
|
if (![0, 1, 2, 3].includes(level)) {
|
|
53
57
|
return;
|
|
@@ -69,6 +73,7 @@ function translateLevel(level) {
|
|
|
69
73
|
};
|
|
70
74
|
}
|
|
71
75
|
|
|
76
|
+
// eslint-disable-next-line complexity -- Color support detection necessarily handles multiple environments.
|
|
72
77
|
function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
|
|
73
78
|
const noFlagForceColor = envForceColor();
|
|
74
79
|
if (noFlagForceColor !== undefined) {
|
|
@@ -93,6 +98,11 @@ function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
|
|
|
93
98
|
}
|
|
94
99
|
}
|
|
95
100
|
|
|
101
|
+
// A numeric `FORCE_COLOR` requests an exact level, while `FORCE_COLOR=true` and `FORCE_COLOR=` only enable color and let the level be detected.
|
|
102
|
+
if (forceColor !== undefined && /^\d+$/v.test(env.FORCE_COLOR)) {
|
|
103
|
+
return forceColor;
|
|
104
|
+
}
|
|
105
|
+
|
|
96
106
|
// Check for Azure DevOps pipelines.
|
|
97
107
|
// Has to be above the `!streamIsTTY` check.
|
|
98
108
|
if ('TF_BUILD' in env && 'AGENT_NAME' in env) {
|
|
@@ -124,11 +134,11 @@ function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
|
|
|
124
134
|
}
|
|
125
135
|
|
|
126
136
|
if ('CI' in env) {
|
|
127
|
-
if (['GITHUB_ACTIONS', 'GITEA_ACTIONS', 'CIRCLECI'].some(key => key
|
|
137
|
+
if (['GITHUB_ACTIONS', 'GITEA_ACTIONS', 'CIRCLECI'].some(key => Object.hasOwn(env, key))) {
|
|
128
138
|
return 3;
|
|
129
139
|
}
|
|
130
140
|
|
|
131
|
-
if (['TRAVIS', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign
|
|
141
|
+
if (['TRAVIS', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => Object.hasOwn(env, sign)) || env.CI_NAME === 'codeship') {
|
|
132
142
|
return 1;
|
|
133
143
|
}
|
|
134
144
|
|
|
@@ -136,7 +146,7 @@ function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
|
|
|
136
146
|
}
|
|
137
147
|
|
|
138
148
|
if ('TEAMCITY_VERSION' in env) {
|
|
139
|
-
return /^(9\.
|
|
149
|
+
return /^(?:9\.0*[1-9]\d*\.|\d{2,}\.)/v.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
140
150
|
}
|
|
141
151
|
|
|
142
152
|
if (env.COLORTERM === 'truecolor') {
|
|
@@ -156,7 +166,7 @@ function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
|
|
|
156
166
|
}
|
|
157
167
|
|
|
158
168
|
if ('TERM_PROGRAM' in env) {
|
|
159
|
-
const version = Number
|
|
169
|
+
const version = Number((env.TERM_PROGRAM_VERSION || '').split('.', 1)[0]);
|
|
160
170
|
|
|
161
171
|
switch (env.TERM_PROGRAM) {
|
|
162
172
|
case 'iTerm.app': {
|
|
@@ -170,11 +180,11 @@ function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
|
|
|
170
180
|
}
|
|
171
181
|
}
|
|
172
182
|
|
|
173
|
-
if (/-256(color)?$/
|
|
183
|
+
if (/-256(?:color)?$/iv.test(env.TERM)) {
|
|
174
184
|
return 2;
|
|
175
185
|
}
|
|
176
186
|
|
|
177
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/
|
|
187
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/iv.test(env.TERM)) {
|
|
178
188
|
return 1;
|
|
179
189
|
}
|
|
180
190
|
|
|
@@ -223,9 +233,9 @@ function ansiRegex({onlyFirst = false} = {}) {
|
|
|
223
233
|
// Valid string terminator sequences are BEL, ESC\, and 0x9c
|
|
224
234
|
const ST = '(?:\\u0007|\\u001B\\u005C|\\u009C)';
|
|
225
235
|
|
|
226
|
-
// OSC sequences only: ESC ] ... ST
|
|
227
|
-
// The payload stops at the first terminator character rather than scanning ahead for one, so an unterminated `ESC ]` cannot rescan the rest of the input. Terminals likewise abort a control string on an unexpected ESC.
|
|
228
|
-
const osc = `(?:\\u001B\\][^\\u0007\\u001B\\u009C]*${ST})`;
|
|
236
|
+
// OSC sequences only: ESC ] ... ST (or the C1 introducer 0x9d ... ST)
|
|
237
|
+
// The payload stops at the first terminator character rather than scanning ahead for one, so an unterminated `ESC ]` cannot rescan the rest of the input. Terminals likewise abort a control string on an unexpected ESC. The payload also stops at 0x9d so an unterminated C1 OSC cannot swallow the next one.
|
|
238
|
+
const osc = `(?:(?:\\u001B\\]|\\u009D)[^\\u0007\\u001B\\u009C\\u009D]*${ST})`;
|
|
229
239
|
|
|
230
240
|
// CSI and related: ESC/C1, optional intermediates, optional params (supports ; and :) then final byte
|
|
231
241
|
const csi = '[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]';
|
|
@@ -265,7 +275,7 @@ const fullwidthRanges = [12288, 12288, 65281, 65376, 65504, 65510];
|
|
|
265
275
|
|
|
266
276
|
const wideMinimalCodePoint = 4352;
|
|
267
277
|
const wideMaximumCodePoint = 262141;
|
|
268
|
-
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,
|
|
278
|
+
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, 101594, 101631, 101664, 101760, 101874, 101888, 102801, 102816, 102866, 110576, 110579, 110581, 110587, 110589, 110590, 110592, 110888, 110898, 110898, 110928, 110930, 110933, 110933, 110948, 110952, 110960, 111355, 119552, 119638, 119648, 119670, 126980, 126980, 127183, 127183, 127374, 127374, 127377, 127386, 127406, 127406, 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, 128729, 128732, 128735, 128747, 128748, 128756, 128764, 128986, 128986, 128992, 129003, 129008, 129008, 129292, 129338, 129340, 129349, 129351, 129535, 129648, 129660, 129664, 129734, 129736, 129736, 129740, 129757, 129759, 129771, 129775, 129786, 131072, 196605, 196608, 262141];
|
|
269
279
|
|
|
270
280
|
/**
|
|
271
281
|
Binary search on a sorted flat array of [start, end] pairs.
|
|
@@ -333,7 +343,7 @@ const isAmbiguous = codePoint => {
|
|
|
333
343
|
return isInRange(ambiguousRanges, codePoint);
|
|
334
344
|
};
|
|
335
345
|
|
|
336
|
-
const
|
|
346
|
+
const isFullwidth = codePoint => {
|
|
337
347
|
if (
|
|
338
348
|
codePoint < fullwidthMinimalCodePoint
|
|
339
349
|
|| codePoint > fullwidthMaximumCodePoint
|
|
@@ -372,7 +382,7 @@ function eastAsianWidth(codePoint, {ambiguousAsWide = false} = {}) {
|
|
|
372
382
|
validate(codePoint);
|
|
373
383
|
|
|
374
384
|
if (
|
|
375
|
-
|
|
385
|
+
isFullwidth(codePoint)
|
|
376
386
|
|| isWide(codePoint)
|
|
377
387
|
|| (ambiguousAsWide && isAmbiguous(codePoint))
|
|
378
388
|
) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/test",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.53",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@c88/v8-coverage": "0.1.1",
|
|
34
|
-
"@jsenv/ast": "6.10.
|
|
35
|
-
"@jsenv/plugin-supervisor": "1.8.
|
|
36
|
-
"@jsenv/sourcemap": "1.4.
|
|
34
|
+
"@jsenv/ast": "6.10.11",
|
|
35
|
+
"@jsenv/plugin-supervisor": "1.8.30",
|
|
36
|
+
"@jsenv/sourcemap": "1.4.14",
|
|
37
37
|
"he": "1.2.0",
|
|
38
38
|
"istanbul-lib-coverage": "3.2.2",
|
|
39
39
|
"istanbul-lib-instrument": "6.0.3",
|