@jsenv/test 3.7.42 → 3.7.44
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/exception.js +34 -10
- package/dist/jsenv_test.js +3 -1
- package/dist/v8_coverage/v8_coverage.js +34 -10
- package/package.json +11 -11
package/dist/exception.js
CHANGED
|
@@ -407,20 +407,44 @@ const asFlatAssociations = (associations) => {
|
|
|
407
407
|
return flatAssociations;
|
|
408
408
|
};
|
|
409
409
|
|
|
410
|
+
// The same associations object is matched against the same urls over and
|
|
411
|
+
// over (node esm resolution conditions, ignore checks: once per reference).
|
|
412
|
+
// Matched values are memoized per (associations, url); the returned object
|
|
413
|
+
// stays built fresh on every call (callers may mutate it). The per-url map
|
|
414
|
+
// is capped: in a long-lived dev server, urls carry changing search params
|
|
415
|
+
// (?hot=timestamp) and would otherwise accumulate without bound.
|
|
416
|
+
const matchedValuesCacheMap = new WeakMap();
|
|
417
|
+
const MATCHED_VALUES_CACHE_LIMIT = 4096;
|
|
418
|
+
|
|
410
419
|
const applyAssociations = ({ url, associations }) => {
|
|
411
420
|
if (url && typeof url.href === "string") url = url.href;
|
|
412
421
|
assertUrlLike(url);
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
422
|
+
let urlCache = matchedValuesCacheMap.get(associations);
|
|
423
|
+
if (!urlCache) {
|
|
424
|
+
urlCache = new Map();
|
|
425
|
+
matchedValuesCacheMap.set(associations, urlCache);
|
|
426
|
+
}
|
|
427
|
+
let matchedValues = urlCache.get(url);
|
|
428
|
+
if (!matchedValues) {
|
|
429
|
+
const flatAssociations = asFlatAssociations(associations);
|
|
430
|
+
matchedValues = [];
|
|
431
|
+
for (const pattern of Object.keys(flatAssociations)) {
|
|
432
|
+
const { matched } = applyPatternMatching({
|
|
433
|
+
pattern,
|
|
434
|
+
url,
|
|
435
|
+
});
|
|
436
|
+
if (matched) {
|
|
437
|
+
matchedValues.push(flatAssociations[pattern]);
|
|
438
|
+
}
|
|
423
439
|
}
|
|
440
|
+
if (urlCache.size >= MATCHED_VALUES_CACHE_LIMIT) {
|
|
441
|
+
urlCache.clear();
|
|
442
|
+
}
|
|
443
|
+
urlCache.set(url, matchedValues);
|
|
444
|
+
}
|
|
445
|
+
let associatedValue = {};
|
|
446
|
+
for (const value of matchedValues) {
|
|
447
|
+
associatedValue = deepAssign(associatedValue, value);
|
|
424
448
|
}
|
|
425
449
|
return associatedValue;
|
|
426
450
|
};
|
package/dist/jsenv_test.js
CHANGED
|
@@ -5052,7 +5052,9 @@ const startMonitoringCpuUsage = () => {
|
|
|
5052
5052
|
|
|
5053
5053
|
const startMonitoringMemoryUsage = () => {
|
|
5054
5054
|
const processMemoryUsageMonitoring = startMonitoringMetric(() => {
|
|
5055
|
-
|
|
5055
|
+
// memoryUsage.rss() reads only rss; the full memoryUsage() computes
|
|
5056
|
+
// every field and shows up in build profiles
|
|
5057
|
+
return memoryUsage.rss();
|
|
5056
5058
|
});
|
|
5057
5059
|
const osMemoryUsageMonitoring = startMonitoringMetric(() => {
|
|
5058
5060
|
const total = totalmem();
|
|
@@ -404,20 +404,44 @@ const asFlatAssociations = (associations) => {
|
|
|
404
404
|
return flatAssociations;
|
|
405
405
|
};
|
|
406
406
|
|
|
407
|
+
// The same associations object is matched against the same urls over and
|
|
408
|
+
// over (node esm resolution conditions, ignore checks: once per reference).
|
|
409
|
+
// Matched values are memoized per (associations, url); the returned object
|
|
410
|
+
// stays built fresh on every call (callers may mutate it). The per-url map
|
|
411
|
+
// is capped: in a long-lived dev server, urls carry changing search params
|
|
412
|
+
// (?hot=timestamp) and would otherwise accumulate without bound.
|
|
413
|
+
const matchedValuesCacheMap = new WeakMap();
|
|
414
|
+
const MATCHED_VALUES_CACHE_LIMIT = 4096;
|
|
415
|
+
|
|
407
416
|
const applyAssociations = ({ url, associations }) => {
|
|
408
417
|
if (url && typeof url.href === "string") url = url.href;
|
|
409
418
|
assertUrlLike(url);
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
419
|
+
let urlCache = matchedValuesCacheMap.get(associations);
|
|
420
|
+
if (!urlCache) {
|
|
421
|
+
urlCache = new Map();
|
|
422
|
+
matchedValuesCacheMap.set(associations, urlCache);
|
|
423
|
+
}
|
|
424
|
+
let matchedValues = urlCache.get(url);
|
|
425
|
+
if (!matchedValues) {
|
|
426
|
+
const flatAssociations = asFlatAssociations(associations);
|
|
427
|
+
matchedValues = [];
|
|
428
|
+
for (const pattern of Object.keys(flatAssociations)) {
|
|
429
|
+
const { matched } = applyPatternMatching({
|
|
430
|
+
pattern,
|
|
431
|
+
url,
|
|
432
|
+
});
|
|
433
|
+
if (matched) {
|
|
434
|
+
matchedValues.push(flatAssociations[pattern]);
|
|
435
|
+
}
|
|
420
436
|
}
|
|
437
|
+
if (urlCache.size >= MATCHED_VALUES_CACHE_LIMIT) {
|
|
438
|
+
urlCache.clear();
|
|
439
|
+
}
|
|
440
|
+
urlCache.set(url, matchedValues);
|
|
441
|
+
}
|
|
442
|
+
let associatedValue = {};
|
|
443
|
+
for (const value of matchedValues) {
|
|
444
|
+
associatedValue = deepAssign(associatedValue, value);
|
|
421
445
|
}
|
|
422
446
|
return associatedValue;
|
|
423
447
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/test",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.44",
|
|
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.2",
|
|
35
|
+
"@jsenv/plugin-supervisor": "1.8.21",
|
|
36
|
+
"@jsenv/sourcemap": "1.4.7",
|
|
37
37
|
"he": "1.2.0",
|
|
38
38
|
"istanbul-lib-coverage": "3.2.2",
|
|
39
39
|
"istanbul-lib-instrument": "6.0.3",
|
|
@@ -48,19 +48,19 @@
|
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@jsenv/abort": "../../tooling/abort",
|
|
51
|
-
"@jsenv/assert": "
|
|
52
|
-
"@jsenv/core": "
|
|
53
|
-
"@jsenv/exception": "../../
|
|
54
|
-
"@jsenv/filesystem": "../../
|
|
51
|
+
"@jsenv/assert": "../../tooling/assert",
|
|
52
|
+
"@jsenv/core": "../../../",
|
|
53
|
+
"@jsenv/exception": "../../tooling/exception",
|
|
54
|
+
"@jsenv/filesystem": "../../tooling/filesystem",
|
|
55
55
|
"@jsenv/github-check-run": "../../tooling/github-check-run",
|
|
56
56
|
"@jsenv/humanize": "../../tooling/humanize",
|
|
57
57
|
"@jsenv/importmap": "../../tooling/importmap",
|
|
58
58
|
"@jsenv/node-esm-resolution": "../../tooling/node-esm-resolution",
|
|
59
59
|
"@jsenv/os-metrics": "../../tooling/os-metrics",
|
|
60
60
|
"@jsenv/plugin-explorer": "../plugin-explorer",
|
|
61
|
-
"@jsenv/server": "
|
|
62
|
-
"@jsenv/snapshot": "
|
|
63
|
-
"@jsenv/terminal-recorder": "
|
|
61
|
+
"@jsenv/server": "../../backend/server",
|
|
62
|
+
"@jsenv/snapshot": "../../tooling/snapshot",
|
|
63
|
+
"@jsenv/terminal-recorder": "../../tooling/terminal-recorder",
|
|
64
64
|
"@jsenv/test": "./",
|
|
65
65
|
"@jsenv/url-meta": "../../tooling/url-meta",
|
|
66
66
|
"@jsenv/urls": "../../tooling/urls",
|