@jsenv/test 3.7.18 → 3.7.19
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 +22 -18
- package/dist/jsenv_test_node_modules.js +114 -361
- package/package.json +5 -5
package/dist/jsenv_test.js
CHANGED
|
@@ -3952,6 +3952,10 @@ const applyNodeEsmResolution = ({
|
|
|
3952
3952
|
return resolution;
|
|
3953
3953
|
};
|
|
3954
3954
|
|
|
3955
|
+
const createResolutionResult = (data) => {
|
|
3956
|
+
return data;
|
|
3957
|
+
};
|
|
3958
|
+
|
|
3955
3959
|
const applyPackageSpecifierResolution = (specifier, resolutionContext) => {
|
|
3956
3960
|
const { parentUrl } = resolutionContext;
|
|
3957
3961
|
// relative specifier
|
|
@@ -3969,10 +3973,10 @@ const applyPackageSpecifierResolution = (specifier, resolutionContext) => {
|
|
|
3969
3973
|
return browserFieldResolution;
|
|
3970
3974
|
}
|
|
3971
3975
|
}
|
|
3972
|
-
return {
|
|
3976
|
+
return createResolutionResult({
|
|
3973
3977
|
type: "relative_specifier",
|
|
3974
3978
|
url: new URL(specifier, parentUrl).href,
|
|
3975
|
-
};
|
|
3979
|
+
});
|
|
3976
3980
|
}
|
|
3977
3981
|
if (specifier[0] === "#") {
|
|
3978
3982
|
return applyPackageImportsResolution(specifier, resolutionContext);
|
|
@@ -3980,15 +3984,15 @@ const applyPackageSpecifierResolution = (specifier, resolutionContext) => {
|
|
|
3980
3984
|
try {
|
|
3981
3985
|
const urlObject = new URL(specifier);
|
|
3982
3986
|
if (specifier.startsWith("node:")) {
|
|
3983
|
-
return {
|
|
3987
|
+
return createResolutionResult({
|
|
3984
3988
|
type: "node_builtin_specifier",
|
|
3985
3989
|
url: specifier,
|
|
3986
|
-
};
|
|
3990
|
+
});
|
|
3987
3991
|
}
|
|
3988
|
-
return {
|
|
3992
|
+
return createResolutionResult({
|
|
3989
3993
|
type: "absolute_specifier",
|
|
3990
3994
|
url: urlObject.href,
|
|
3991
|
-
};
|
|
3995
|
+
});
|
|
3992
3996
|
} catch {
|
|
3993
3997
|
// bare specifier
|
|
3994
3998
|
const browserFieldResolution = applyBrowserFieldResolution(
|
|
@@ -4049,13 +4053,13 @@ const applyBrowserFieldResolution = (specifier, resolutionContext) => {
|
|
|
4049
4053
|
}
|
|
4050
4054
|
}
|
|
4051
4055
|
if (url) {
|
|
4052
|
-
return {
|
|
4056
|
+
return createResolutionResult({
|
|
4053
4057
|
type: "field:browser",
|
|
4054
4058
|
isMain: true,
|
|
4055
4059
|
packageDirectoryUrl,
|
|
4056
4060
|
packageJson,
|
|
4057
4061
|
url,
|
|
4058
|
-
};
|
|
4062
|
+
});
|
|
4059
4063
|
}
|
|
4060
4064
|
return null;
|
|
4061
4065
|
};
|
|
@@ -4104,10 +4108,10 @@ const applyPackageResolve = (packageSpecifier, resolutionContext) => {
|
|
|
4104
4108
|
conditions.includes("node") &&
|
|
4105
4109
|
isSpecifierForNodeBuiltin(packageSpecifier)
|
|
4106
4110
|
) {
|
|
4107
|
-
return {
|
|
4111
|
+
return createResolutionResult({
|
|
4108
4112
|
type: "node_builtin_specifier",
|
|
4109
4113
|
url: `node:${packageSpecifier}`,
|
|
4110
|
-
};
|
|
4114
|
+
});
|
|
4111
4115
|
}
|
|
4112
4116
|
let { packageName, packageSubpath } = parsePackageSpecifier(packageSpecifier);
|
|
4113
4117
|
if (
|
|
@@ -4300,7 +4304,7 @@ const applyPackageTargetResolution = (target, resolutionContext) => {
|
|
|
4300
4304
|
resolutionContext,
|
|
4301
4305
|
);
|
|
4302
4306
|
}
|
|
4303
|
-
return {
|
|
4307
|
+
return createResolutionResult({
|
|
4304
4308
|
type: isImport ? "field:imports" : "field:exports",
|
|
4305
4309
|
isMain: subpath === "" || subpath === ".",
|
|
4306
4310
|
packageDirectoryUrl,
|
|
@@ -4308,7 +4312,7 @@ const applyPackageTargetResolution = (target, resolutionContext) => {
|
|
|
4308
4312
|
url: pattern
|
|
4309
4313
|
? targetUrl.replaceAll("*", subpath)
|
|
4310
4314
|
: new URL(subpath, targetUrl).href,
|
|
4311
|
-
};
|
|
4315
|
+
});
|
|
4312
4316
|
}
|
|
4313
4317
|
if (!isImport || target.startsWith("../") || isValidUrl(target)) {
|
|
4314
4318
|
throw createInvalidPackageTargetError(
|
|
@@ -4529,13 +4533,13 @@ const applyLegacySubpathResolution = (packageSubpath, resolutionContext) => {
|
|
|
4529
4533
|
if (browserFieldResolution) {
|
|
4530
4534
|
return browserFieldResolution;
|
|
4531
4535
|
}
|
|
4532
|
-
return {
|
|
4536
|
+
return createResolutionResult({
|
|
4533
4537
|
type: "subpath",
|
|
4534
4538
|
isMain: packageSubpath === ".",
|
|
4535
4539
|
packageDirectoryUrl,
|
|
4536
4540
|
packageJson,
|
|
4537
4541
|
url: new URL(packageSubpath, packageDirectoryUrl).href,
|
|
4538
|
-
};
|
|
4542
|
+
});
|
|
4539
4543
|
};
|
|
4540
4544
|
|
|
4541
4545
|
const applyLegacyMainResolution = (packageSubpath, resolutionContext) => {
|
|
@@ -4547,22 +4551,22 @@ const applyLegacyMainResolution = (packageSubpath, resolutionContext) => {
|
|
|
4547
4551
|
}
|
|
4548
4552
|
const resolved = conditionResolver(resolutionContext);
|
|
4549
4553
|
if (resolved) {
|
|
4550
|
-
return {
|
|
4554
|
+
return createResolutionResult({
|
|
4551
4555
|
type: resolved.type,
|
|
4552
4556
|
isMain: resolved.isMain,
|
|
4553
4557
|
packageDirectoryUrl,
|
|
4554
4558
|
packageJson,
|
|
4555
4559
|
url: new URL(resolved.path, packageDirectoryUrl).href,
|
|
4556
|
-
};
|
|
4560
|
+
});
|
|
4557
4561
|
}
|
|
4558
4562
|
}
|
|
4559
|
-
return {
|
|
4563
|
+
return createResolutionResult({
|
|
4560
4564
|
type: "field:main", // the absence of "main" field
|
|
4561
4565
|
isMain: true,
|
|
4562
4566
|
packageDirectoryUrl,
|
|
4563
4567
|
packageJson,
|
|
4564
4568
|
url: new URL("index.js", packageDirectoryUrl).href,
|
|
4565
|
-
};
|
|
4569
|
+
});
|
|
4566
4570
|
};
|
|
4567
4571
|
const mainLegacyResolvers = {
|
|
4568
4572
|
import: ({ packageJson }) => {
|
|
@@ -241,6 +241,11 @@ function stripAnsi(string) {
|
|
|
241
241
|
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
+
// Fast path: ANSI codes require ESC (7-bit) or CSI (8-bit) introducer
|
|
245
|
+
if (!string.includes('\u001B') && !string.includes('\u009B')) {
|
|
246
|
+
return string;
|
|
247
|
+
}
|
|
248
|
+
|
|
244
249
|
// Even though the regex is global, we don't need to reset the `.lastIndex`
|
|
245
250
|
// because unlike `.exec()` and `.test()`, `.replace()` does it automatically
|
|
246
251
|
// and doing it manually has a performance penalty.
|
|
@@ -251,371 +256,119 @@ const r = String.raw,
|
|
|
251
256
|
e = r`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`;
|
|
252
257
|
const emojiRegex = () => new RegExp(r`\p{RI}{2}|(?)${e}(?:\u200D${e})*`, 'gu');
|
|
253
258
|
|
|
254
|
-
// Generated
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|| x === 0x126
|
|
287
|
-
|| x === 0x127
|
|
288
|
-
|| x === 0x12B
|
|
289
|
-
|| x >= 0x131 && x <= 0x133
|
|
290
|
-
|| x === 0x138
|
|
291
|
-
|| x >= 0x13F && x <= 0x142
|
|
292
|
-
|| x === 0x144
|
|
293
|
-
|| x >= 0x148 && x <= 0x14B
|
|
294
|
-
|| x === 0x14D
|
|
295
|
-
|| x === 0x152
|
|
296
|
-
|| x === 0x153
|
|
297
|
-
|| x === 0x166
|
|
298
|
-
|| x === 0x167
|
|
299
|
-
|| x === 0x16B
|
|
300
|
-
|| x === 0x1CE
|
|
301
|
-
|| x === 0x1D0
|
|
302
|
-
|| x === 0x1D2
|
|
303
|
-
|| x === 0x1D4
|
|
304
|
-
|| x === 0x1D6
|
|
305
|
-
|| x === 0x1D8
|
|
306
|
-
|| x === 0x1DA
|
|
307
|
-
|| x === 0x1DC
|
|
308
|
-
|| x === 0x251
|
|
309
|
-
|| x === 0x261
|
|
310
|
-
|| x === 0x2C4
|
|
311
|
-
|| x === 0x2C7
|
|
312
|
-
|| x >= 0x2C9 && x <= 0x2CB
|
|
313
|
-
|| x === 0x2CD
|
|
314
|
-
|| x === 0x2D0
|
|
315
|
-
|| x >= 0x2D8 && x <= 0x2DB
|
|
316
|
-
|| x === 0x2DD
|
|
317
|
-
|| x === 0x2DF
|
|
318
|
-
|| x >= 0x300 && x <= 0x36F
|
|
319
|
-
|| x >= 0x391 && x <= 0x3A1
|
|
320
|
-
|| x >= 0x3A3 && x <= 0x3A9
|
|
321
|
-
|| x >= 0x3B1 && x <= 0x3C1
|
|
322
|
-
|| x >= 0x3C3 && x <= 0x3C9
|
|
323
|
-
|| x === 0x401
|
|
324
|
-
|| x >= 0x410 && x <= 0x44F
|
|
325
|
-
|| x === 0x451
|
|
326
|
-
|| x === 0x2010
|
|
327
|
-
|| x >= 0x2013 && x <= 0x2016
|
|
328
|
-
|| x === 0x2018
|
|
329
|
-
|| x === 0x2019
|
|
330
|
-
|| x === 0x201C
|
|
331
|
-
|| x === 0x201D
|
|
332
|
-
|| x >= 0x2020 && x <= 0x2022
|
|
333
|
-
|| x >= 0x2024 && x <= 0x2027
|
|
334
|
-
|| x === 0x2030
|
|
335
|
-
|| x === 0x2032
|
|
336
|
-
|| x === 0x2033
|
|
337
|
-
|| x === 0x2035
|
|
338
|
-
|| x === 0x203B
|
|
339
|
-
|| x === 0x203E
|
|
340
|
-
|| x === 0x2074
|
|
341
|
-
|| x === 0x207F
|
|
342
|
-
|| x >= 0x2081 && x <= 0x2084
|
|
343
|
-
|| x === 0x20AC
|
|
344
|
-
|| x === 0x2103
|
|
345
|
-
|| x === 0x2105
|
|
346
|
-
|| x === 0x2109
|
|
347
|
-
|| x === 0x2113
|
|
348
|
-
|| x === 0x2116
|
|
349
|
-
|| x === 0x2121
|
|
350
|
-
|| x === 0x2122
|
|
351
|
-
|| x === 0x2126
|
|
352
|
-
|| x === 0x212B
|
|
353
|
-
|| x === 0x2153
|
|
354
|
-
|| x === 0x2154
|
|
355
|
-
|| x >= 0x215B && x <= 0x215E
|
|
356
|
-
|| x >= 0x2160 && x <= 0x216B
|
|
357
|
-
|| x >= 0x2170 && x <= 0x2179
|
|
358
|
-
|| x === 0x2189
|
|
359
|
-
|| x >= 0x2190 && x <= 0x2199
|
|
360
|
-
|| x === 0x21B8
|
|
361
|
-
|| x === 0x21B9
|
|
362
|
-
|| x === 0x21D2
|
|
363
|
-
|| x === 0x21D4
|
|
364
|
-
|| x === 0x21E7
|
|
365
|
-
|| x === 0x2200
|
|
366
|
-
|| x === 0x2202
|
|
367
|
-
|| x === 0x2203
|
|
368
|
-
|| x === 0x2207
|
|
369
|
-
|| x === 0x2208
|
|
370
|
-
|| x === 0x220B
|
|
371
|
-
|| x === 0x220F
|
|
372
|
-
|| x === 0x2211
|
|
373
|
-
|| x === 0x2215
|
|
374
|
-
|| x === 0x221A
|
|
375
|
-
|| x >= 0x221D && x <= 0x2220
|
|
376
|
-
|| x === 0x2223
|
|
377
|
-
|| x === 0x2225
|
|
378
|
-
|| x >= 0x2227 && x <= 0x222C
|
|
379
|
-
|| x === 0x222E
|
|
380
|
-
|| x >= 0x2234 && x <= 0x2237
|
|
381
|
-
|| x === 0x223C
|
|
382
|
-
|| x === 0x223D
|
|
383
|
-
|| x === 0x2248
|
|
384
|
-
|| x === 0x224C
|
|
385
|
-
|| x === 0x2252
|
|
386
|
-
|| x === 0x2260
|
|
387
|
-
|| x === 0x2261
|
|
388
|
-
|| x >= 0x2264 && x <= 0x2267
|
|
389
|
-
|| x === 0x226A
|
|
390
|
-
|| x === 0x226B
|
|
391
|
-
|| x === 0x226E
|
|
392
|
-
|| x === 0x226F
|
|
393
|
-
|| x === 0x2282
|
|
394
|
-
|| x === 0x2283
|
|
395
|
-
|| x === 0x2286
|
|
396
|
-
|| x === 0x2287
|
|
397
|
-
|| x === 0x2295
|
|
398
|
-
|| x === 0x2299
|
|
399
|
-
|| x === 0x22A5
|
|
400
|
-
|| x === 0x22BF
|
|
401
|
-
|| x === 0x2312
|
|
402
|
-
|| x >= 0x2460 && x <= 0x24E9
|
|
403
|
-
|| x >= 0x24EB && x <= 0x254B
|
|
404
|
-
|| x >= 0x2550 && x <= 0x2573
|
|
405
|
-
|| x >= 0x2580 && x <= 0x258F
|
|
406
|
-
|| x >= 0x2592 && x <= 0x2595
|
|
407
|
-
|| x === 0x25A0
|
|
408
|
-
|| x === 0x25A1
|
|
409
|
-
|| x >= 0x25A3 && x <= 0x25A9
|
|
410
|
-
|| x === 0x25B2
|
|
411
|
-
|| x === 0x25B3
|
|
412
|
-
|| x === 0x25B6
|
|
413
|
-
|| x === 0x25B7
|
|
414
|
-
|| x === 0x25BC
|
|
415
|
-
|| x === 0x25BD
|
|
416
|
-
|| x === 0x25C0
|
|
417
|
-
|| x === 0x25C1
|
|
418
|
-
|| x >= 0x25C6 && x <= 0x25C8
|
|
419
|
-
|| x === 0x25CB
|
|
420
|
-
|| x >= 0x25CE && x <= 0x25D1
|
|
421
|
-
|| x >= 0x25E2 && x <= 0x25E5
|
|
422
|
-
|| x === 0x25EF
|
|
423
|
-
|| x === 0x2605
|
|
424
|
-
|| x === 0x2606
|
|
425
|
-
|| x === 0x2609
|
|
426
|
-
|| x === 0x260E
|
|
427
|
-
|| x === 0x260F
|
|
428
|
-
|| x === 0x261C
|
|
429
|
-
|| x === 0x261E
|
|
430
|
-
|| x === 0x2640
|
|
431
|
-
|| x === 0x2642
|
|
432
|
-
|| x === 0x2660
|
|
433
|
-
|| x === 0x2661
|
|
434
|
-
|| x >= 0x2663 && x <= 0x2665
|
|
435
|
-
|| x >= 0x2667 && x <= 0x266A
|
|
436
|
-
|| x === 0x266C
|
|
437
|
-
|| x === 0x266D
|
|
438
|
-
|| x === 0x266F
|
|
439
|
-
|| x === 0x269E
|
|
440
|
-
|| x === 0x269F
|
|
441
|
-
|| x === 0x26BF
|
|
442
|
-
|| x >= 0x26C6 && x <= 0x26CD
|
|
443
|
-
|| x >= 0x26CF && x <= 0x26D3
|
|
444
|
-
|| x >= 0x26D5 && x <= 0x26E1
|
|
445
|
-
|| x === 0x26E3
|
|
446
|
-
|| x === 0x26E8
|
|
447
|
-
|| x === 0x26E9
|
|
448
|
-
|| x >= 0x26EB && x <= 0x26F1
|
|
449
|
-
|| x === 0x26F4
|
|
450
|
-
|| x >= 0x26F6 && x <= 0x26F9
|
|
451
|
-
|| x === 0x26FB
|
|
452
|
-
|| x === 0x26FC
|
|
453
|
-
|| x === 0x26FE
|
|
454
|
-
|| x === 0x26FF
|
|
455
|
-
|| x === 0x273D
|
|
456
|
-
|| x >= 0x2776 && x <= 0x277F
|
|
457
|
-
|| x >= 0x2B56 && x <= 0x2B59
|
|
458
|
-
|| x >= 0x3248 && x <= 0x324F
|
|
459
|
-
|| x >= 0xE000 && x <= 0xF8FF
|
|
460
|
-
|| x >= 0xFE00 && x <= 0xFE0F
|
|
461
|
-
|| x === 0xFFFD
|
|
462
|
-
|| x >= 0x1F100 && x <= 0x1F10A
|
|
463
|
-
|| x >= 0x1F110 && x <= 0x1F12D
|
|
464
|
-
|| x >= 0x1F130 && x <= 0x1F169
|
|
465
|
-
|| x >= 0x1F170 && x <= 0x1F18D
|
|
466
|
-
|| x === 0x1F18F
|
|
467
|
-
|| x === 0x1F190
|
|
468
|
-
|| x >= 0x1F19B && x <= 0x1F1AC
|
|
469
|
-
|| x >= 0xE0100 && x <= 0xE01EF
|
|
470
|
-
|| x >= 0xF0000 && x <= 0xFFFFD
|
|
471
|
-
|| x >= 0x100000 && x <= 0x10FFFD;
|
|
472
|
-
}
|
|
259
|
+
// Generated by scripts/build.js
|
|
260
|
+
|
|
261
|
+
// prettier-ignore
|
|
262
|
+
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
|
+
|
|
264
|
+
// prettier-ignore
|
|
265
|
+
const fullwidthRanges = [12288, 12288, 65281, 65376, 65504, 65510];
|
|
266
|
+
|
|
267
|
+
// prettier-ignore
|
|
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, 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
|
+
|
|
270
|
+
/**
|
|
271
|
+
Binary search on a sorted flat array of [start, end] pairs.
|
|
272
|
+
|
|
273
|
+
@param {number[]} ranges - Flat array of inclusive [start, end] range pairs, e.g. [0, 5, 10, 20].
|
|
274
|
+
@param {number} codePoint - The value to search for.
|
|
275
|
+
@returns {boolean} Whether the value falls within any of the ranges.
|
|
276
|
+
*/
|
|
277
|
+
const isInRange = (ranges, codePoint) => {
|
|
278
|
+
let low = 0;
|
|
279
|
+
let high = Math.floor(ranges.length / 2) - 1;
|
|
280
|
+
while (low <= high) {
|
|
281
|
+
const mid = Math.floor((low + high) / 2);
|
|
282
|
+
const i = mid * 2;
|
|
283
|
+
if (codePoint < ranges[i]) {
|
|
284
|
+
high = mid - 1;
|
|
285
|
+
} else if (codePoint > ranges[i + 1]) {
|
|
286
|
+
low = mid + 1;
|
|
287
|
+
} else {
|
|
288
|
+
return true;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
473
291
|
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
292
|
+
return false;
|
|
293
|
+
};
|
|
294
|
+
|
|
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
|
+
const commonCjkCodePoint = 0x4E_00;
|
|
303
|
+
const [wideFastPathStart, wideFastPathEnd] = findWideFastPathRange(wideRanges);
|
|
304
|
+
|
|
305
|
+
// Use a hot-path range so common `isWide` calls can skip binary search.
|
|
306
|
+
// The range containing U+4E00 covers common CJK ideographs;
|
|
307
|
+
// fallback to the largest range for resilience to Unicode table changes.
|
|
308
|
+
function findWideFastPathRange(ranges) {
|
|
309
|
+
let fastPathStart = ranges[0];
|
|
310
|
+
let fastPathEnd = ranges[1];
|
|
311
|
+
|
|
312
|
+
for (let index = 0; index < ranges.length; index += 2) {
|
|
313
|
+
const start = ranges[index];
|
|
314
|
+
const end = ranges[index + 1];
|
|
479
315
|
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|| x >= 0x2648 && x <= 0x2653
|
|
495
|
-
|| x === 0x267F
|
|
496
|
-
|| x >= 0x268A && x <= 0x268F
|
|
497
|
-
|| x === 0x2693
|
|
498
|
-
|| x === 0x26A1
|
|
499
|
-
|| x === 0x26AA
|
|
500
|
-
|| x === 0x26AB
|
|
501
|
-
|| x === 0x26BD
|
|
502
|
-
|| x === 0x26BE
|
|
503
|
-
|| x === 0x26C4
|
|
504
|
-
|| x === 0x26C5
|
|
505
|
-
|| x === 0x26CE
|
|
506
|
-
|| x === 0x26D4
|
|
507
|
-
|| x === 0x26EA
|
|
508
|
-
|| x === 0x26F2
|
|
509
|
-
|| x === 0x26F3
|
|
510
|
-
|| x === 0x26F5
|
|
511
|
-
|| x === 0x26FA
|
|
512
|
-
|| x === 0x26FD
|
|
513
|
-
|| x === 0x2705
|
|
514
|
-
|| x === 0x270A
|
|
515
|
-
|| x === 0x270B
|
|
516
|
-
|| x === 0x2728
|
|
517
|
-
|| x === 0x274C
|
|
518
|
-
|| x === 0x274E
|
|
519
|
-
|| x >= 0x2753 && x <= 0x2755
|
|
520
|
-
|| x === 0x2757
|
|
521
|
-
|| x >= 0x2795 && x <= 0x2797
|
|
522
|
-
|| x === 0x27B0
|
|
523
|
-
|| x === 0x27BF
|
|
524
|
-
|| x === 0x2B1B
|
|
525
|
-
|| x === 0x2B1C
|
|
526
|
-
|| x === 0x2B50
|
|
527
|
-
|| x === 0x2B55
|
|
528
|
-
|| x >= 0x2E80 && x <= 0x2E99
|
|
529
|
-
|| x >= 0x2E9B && x <= 0x2EF3
|
|
530
|
-
|| x >= 0x2F00 && x <= 0x2FD5
|
|
531
|
-
|| x >= 0x2FF0 && x <= 0x2FFF
|
|
532
|
-
|| x >= 0x3001 && x <= 0x303E
|
|
533
|
-
|| x >= 0x3041 && x <= 0x3096
|
|
534
|
-
|| x >= 0x3099 && x <= 0x30FF
|
|
535
|
-
|| x >= 0x3105 && x <= 0x312F
|
|
536
|
-
|| x >= 0x3131 && x <= 0x318E
|
|
537
|
-
|| x >= 0x3190 && x <= 0x31E5
|
|
538
|
-
|| x >= 0x31EF && x <= 0x321E
|
|
539
|
-
|| x >= 0x3220 && x <= 0x3247
|
|
540
|
-
|| x >= 0x3250 && x <= 0xA48C
|
|
541
|
-
|| x >= 0xA490 && x <= 0xA4C6
|
|
542
|
-
|| x >= 0xA960 && x <= 0xA97C
|
|
543
|
-
|| x >= 0xAC00 && x <= 0xD7A3
|
|
544
|
-
|| x >= 0xF900 && x <= 0xFAFF
|
|
545
|
-
|| x >= 0xFE10 && x <= 0xFE19
|
|
546
|
-
|| x >= 0xFE30 && x <= 0xFE52
|
|
547
|
-
|| x >= 0xFE54 && x <= 0xFE66
|
|
548
|
-
|| x >= 0xFE68 && x <= 0xFE6B
|
|
549
|
-
|| x >= 0x16FE0 && x <= 0x16FE4
|
|
550
|
-
|| x >= 0x16FF0 && x <= 0x16FF6
|
|
551
|
-
|| x >= 0x17000 && x <= 0x18CD5
|
|
552
|
-
|| x >= 0x18CFF && x <= 0x18D1E
|
|
553
|
-
|| x >= 0x18D80 && x <= 0x18DF2
|
|
554
|
-
|| x >= 0x1AFF0 && x <= 0x1AFF3
|
|
555
|
-
|| x >= 0x1AFF5 && x <= 0x1AFFB
|
|
556
|
-
|| x === 0x1AFFD
|
|
557
|
-
|| x === 0x1AFFE
|
|
558
|
-
|| x >= 0x1B000 && x <= 0x1B122
|
|
559
|
-
|| x === 0x1B132
|
|
560
|
-
|| x >= 0x1B150 && x <= 0x1B152
|
|
561
|
-
|| x === 0x1B155
|
|
562
|
-
|| x >= 0x1B164 && x <= 0x1B167
|
|
563
|
-
|| x >= 0x1B170 && x <= 0x1B2FB
|
|
564
|
-
|| x >= 0x1D300 && x <= 0x1D356
|
|
565
|
-
|| x >= 0x1D360 && x <= 0x1D376
|
|
566
|
-
|| x === 0x1F004
|
|
567
|
-
|| x === 0x1F0CF
|
|
568
|
-
|| x === 0x1F18E
|
|
569
|
-
|| x >= 0x1F191 && x <= 0x1F19A
|
|
570
|
-
|| x >= 0x1F200 && x <= 0x1F202
|
|
571
|
-
|| x >= 0x1F210 && x <= 0x1F23B
|
|
572
|
-
|| x >= 0x1F240 && x <= 0x1F248
|
|
573
|
-
|| x === 0x1F250
|
|
574
|
-
|| x === 0x1F251
|
|
575
|
-
|| x >= 0x1F260 && x <= 0x1F265
|
|
576
|
-
|| x >= 0x1F300 && x <= 0x1F320
|
|
577
|
-
|| x >= 0x1F32D && x <= 0x1F335
|
|
578
|
-
|| x >= 0x1F337 && x <= 0x1F37C
|
|
579
|
-
|| x >= 0x1F37E && x <= 0x1F393
|
|
580
|
-
|| x >= 0x1F3A0 && x <= 0x1F3CA
|
|
581
|
-
|| x >= 0x1F3CF && x <= 0x1F3D3
|
|
582
|
-
|| x >= 0x1F3E0 && x <= 0x1F3F0
|
|
583
|
-
|| x === 0x1F3F4
|
|
584
|
-
|| x >= 0x1F3F8 && x <= 0x1F43E
|
|
585
|
-
|| x === 0x1F440
|
|
586
|
-
|| x >= 0x1F442 && x <= 0x1F4FC
|
|
587
|
-
|| x >= 0x1F4FF && x <= 0x1F53D
|
|
588
|
-
|| x >= 0x1F54B && x <= 0x1F54E
|
|
589
|
-
|| x >= 0x1F550 && x <= 0x1F567
|
|
590
|
-
|| x === 0x1F57A
|
|
591
|
-
|| x === 0x1F595
|
|
592
|
-
|| x === 0x1F596
|
|
593
|
-
|| x === 0x1F5A4
|
|
594
|
-
|| x >= 0x1F5FB && x <= 0x1F64F
|
|
595
|
-
|| x >= 0x1F680 && x <= 0x1F6C5
|
|
596
|
-
|| x === 0x1F6CC
|
|
597
|
-
|| x >= 0x1F6D0 && x <= 0x1F6D2
|
|
598
|
-
|| x >= 0x1F6D5 && x <= 0x1F6D8
|
|
599
|
-
|| x >= 0x1F6DC && x <= 0x1F6DF
|
|
600
|
-
|| x === 0x1F6EB
|
|
601
|
-
|| x === 0x1F6EC
|
|
602
|
-
|| x >= 0x1F6F4 && x <= 0x1F6FC
|
|
603
|
-
|| x >= 0x1F7E0 && x <= 0x1F7EB
|
|
604
|
-
|| x === 0x1F7F0
|
|
605
|
-
|| x >= 0x1F90C && x <= 0x1F93A
|
|
606
|
-
|| x >= 0x1F93C && x <= 0x1F945
|
|
607
|
-
|| x >= 0x1F947 && x <= 0x1F9FF
|
|
608
|
-
|| x >= 0x1FA70 && x <= 0x1FA7C
|
|
609
|
-
|| x >= 0x1FA80 && x <= 0x1FA8A
|
|
610
|
-
|| x >= 0x1FA8E && x <= 0x1FAC6
|
|
611
|
-
|| x === 0x1FAC8
|
|
612
|
-
|| x >= 0x1FACD && x <= 0x1FADC
|
|
613
|
-
|| x >= 0x1FADF && x <= 0x1FAEA
|
|
614
|
-
|| x >= 0x1FAEF && x <= 0x1FAF8
|
|
615
|
-
|| x >= 0x20000 && x <= 0x2FFFD
|
|
616
|
-
|| x >= 0x30000 && x <= 0x3FFFD;
|
|
316
|
+
if (
|
|
317
|
+
commonCjkCodePoint >= start
|
|
318
|
+
&& commonCjkCodePoint <= end
|
|
319
|
+
) {
|
|
320
|
+
return [start, end];
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
if ((end - start) > (fastPathEnd - fastPathStart)) {
|
|
324
|
+
fastPathStart = start;
|
|
325
|
+
fastPathEnd = end;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
return [fastPathStart, fastPathEnd];
|
|
617
330
|
}
|
|
618
331
|
|
|
332
|
+
const isAmbiguous = codePoint => {
|
|
333
|
+
if (
|
|
334
|
+
codePoint < minimumAmbiguousCodePoint
|
|
335
|
+
|| codePoint > maximumAmbiguousCodePoint
|
|
336
|
+
) {
|
|
337
|
+
return false;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
return isInRange(ambiguousRanges, codePoint);
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
const isFullWidth = codePoint => {
|
|
344
|
+
if (
|
|
345
|
+
codePoint < minimumFullWidthCodePoint
|
|
346
|
+
|| codePoint > maximumFullWidthCodePoint
|
|
347
|
+
) {
|
|
348
|
+
return false;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
return isInRange(fullwidthRanges, codePoint);
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
const isWide = codePoint => {
|
|
355
|
+
if (
|
|
356
|
+
codePoint >= wideFastPathStart
|
|
357
|
+
&& codePoint <= wideFastPathEnd
|
|
358
|
+
) {
|
|
359
|
+
return true;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
if (
|
|
363
|
+
codePoint < minimumWideCodePoint
|
|
364
|
+
|| codePoint > maximumWideCodePoint
|
|
365
|
+
) {
|
|
366
|
+
return false;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
return isInRange(wideRanges, codePoint);
|
|
370
|
+
};
|
|
371
|
+
|
|
619
372
|
function validate(codePoint) {
|
|
620
373
|
if (!Number.isSafeInteger(codePoint)) {
|
|
621
374
|
throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/test",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.19",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/jsenv/core",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@c88/v8-coverage": "0.1.1",
|
|
38
|
-
"@jsenv/ast": "6.7.
|
|
39
|
-
"@jsenv/plugin-supervisor": "1.7.
|
|
40
|
-
"@jsenv/sourcemap": "1.3.
|
|
38
|
+
"@jsenv/ast": "6.7.21",
|
|
39
|
+
"@jsenv/plugin-supervisor": "1.7.15",
|
|
40
|
+
"@jsenv/sourcemap": "1.3.17",
|
|
41
41
|
"he": "1.2.0",
|
|
42
42
|
"istanbul-lib-coverage": "3.2.2",
|
|
43
43
|
"istanbul-lib-instrument": "6.0.3",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@jsenv/urls": "../../tooling/urls",
|
|
67
67
|
"@jsenv/utils": "../../tooling/utils",
|
|
68
68
|
"prettier": "3.8.1",
|
|
69
|
-
"strip-ansi": "7.
|
|
69
|
+
"strip-ansi": "7.2.0",
|
|
70
70
|
"supports-color": "10.2.2"
|
|
71
71
|
},
|
|
72
72
|
"optionalDependencies": {
|