@jsenv/core 27.0.0-alpha.91 → 27.0.0-alpha.92
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/main.js +21 -3
- package/package.json +2 -2
package/dist/main.js
CHANGED
|
@@ -7825,6 +7825,24 @@ const readFileSync = (value, {
|
|
|
7825
7825
|
};
|
|
7826
7826
|
|
|
7827
7827
|
const guardTooFastSecondCall = (callback, cooldownBetweenFileEvents = 40) => {
|
|
7828
|
+
let previousCallMs;
|
|
7829
|
+
return (...args) => {
|
|
7830
|
+
const nowMs = Date.now();
|
|
7831
|
+
|
|
7832
|
+
if (previousCallMs) {
|
|
7833
|
+
const msEllapsed = nowMs - previousCallMs;
|
|
7834
|
+
|
|
7835
|
+
if (msEllapsed < cooldownBetweenFileEvents) {
|
|
7836
|
+
previousCallMs = null;
|
|
7837
|
+
return;
|
|
7838
|
+
}
|
|
7839
|
+
}
|
|
7840
|
+
|
|
7841
|
+
previousCallMs = nowMs;
|
|
7842
|
+
callback(...args);
|
|
7843
|
+
};
|
|
7844
|
+
};
|
|
7845
|
+
const guardTooFastSecondCallPerFile = (callback, cooldownBetweenFileEvents = 40) => {
|
|
7828
7846
|
const previousCallMsMap = new Map();
|
|
7829
7847
|
return fileEvent => {
|
|
7830
7848
|
const {
|
|
@@ -7936,15 +7954,15 @@ const registerDirectoryLifecycle = (source, {
|
|
|
7936
7954
|
|
|
7937
7955
|
if (cooldownBetweenFileEvents) {
|
|
7938
7956
|
if (added) {
|
|
7939
|
-
added =
|
|
7957
|
+
added = guardTooFastSecondCallPerFile(added, cooldownBetweenFileEvents);
|
|
7940
7958
|
}
|
|
7941
7959
|
|
|
7942
7960
|
if (updated) {
|
|
7943
|
-
updated =
|
|
7961
|
+
updated = guardTooFastSecondCallPerFile(updated, cooldownBetweenFileEvents);
|
|
7944
7962
|
}
|
|
7945
7963
|
|
|
7946
7964
|
if (removed) {
|
|
7947
|
-
removed =
|
|
7965
|
+
removed = guardTooFastSecondCallPerFile(removed, cooldownBetweenFileEvents);
|
|
7948
7966
|
}
|
|
7949
7967
|
}
|
|
7950
7968
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/core",
|
|
3
|
-
"version": "27.0.0-alpha.
|
|
3
|
+
"version": "27.0.0-alpha.92",
|
|
4
4
|
"description": "Tool to develop, test and build js projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"@financial-times/polyfill-useragent-normaliser": "2.0.1",
|
|
68
68
|
"@jsenv/ast": "1.1.1",
|
|
69
69
|
"@jsenv/abort": "4.2.3",
|
|
70
|
-
"@jsenv/filesystem": "4.0
|
|
70
|
+
"@jsenv/filesystem": "4.1.0",
|
|
71
71
|
"@jsenv/importmap": "1.2.1",
|
|
72
72
|
"@jsenv/integrity": "0.0.1",
|
|
73
73
|
"@jsenv/node-esm-resolution": "0.1.0",
|