@lodestar/utils 1.30.0-dev.2a4f1bcd49 → 1.30.0-dev.dd729f5ece
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/lib/timeout.js +4 -1
- package/lib/timeout.js.map +1 -1
- package/package.json +6 -6
package/lib/timeout.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { anySignal } from "any-signal";
|
|
2
|
-
import { TimeoutError } from "./errors.js";
|
|
2
|
+
import { ErrorAborted, TimeoutError } from "./errors.js";
|
|
3
3
|
import { sleep } from "./sleep.js";
|
|
4
4
|
export async function withTimeout(asyncFn, timeoutMs, signal) {
|
|
5
|
+
if (signal?.aborted) {
|
|
6
|
+
throw new ErrorAborted();
|
|
7
|
+
}
|
|
5
8
|
const timeoutAbortController = new AbortController();
|
|
6
9
|
const timeoutAndParentSignal = anySignal([timeoutAbortController.signal, ...(signal ? [signal] : [])]);
|
|
7
10
|
async function timeoutPromise(signal) {
|
package/lib/timeout.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeout.js","sourceRoot":"","sources":["../src/timeout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AACrC,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"timeout.js","sourceRoot":"","sources":["../src/timeout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AACrC,OAAO,EAAC,YAAY,EAAE,YAAY,EAAC,MAAM,aAAa,CAAC;AACvD,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAC;AAEjC,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,OAA6D,EAC7D,SAAiB,EACjB,MAAoB;IAEpB,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,YAAY,EAAE,CAAC;IAC3B,CAAC;IAED,MAAM,sBAAsB,GAAG,IAAI,eAAe,EAAE,CAAC;IACrD,MAAM,sBAAsB,GAAG,SAAS,CAAC,CAAC,sBAAsB,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAEvG,KAAK,UAAU,cAAc,CAAC,MAAmB;QAC/C,MAAM,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAC/B,MAAM,IAAI,YAAY,EAAE,CAAC;IAC3B,CAAC;IAED,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC,EAAE,cAAc,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;IACvG,CAAC;YAAS,CAAC;QACT,sBAAsB,CAAC,KAAK,EAAE,CAAC;IACjC,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/ChainSafe/lodestar/issues"
|
|
13
13
|
},
|
|
14
|
-
"version": "1.30.0-dev.
|
|
14
|
+
"version": "1.30.0-dev.dd729f5ece",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": "./lib/index.js",
|
|
17
17
|
"files": [
|
|
@@ -27,17 +27,17 @@
|
|
|
27
27
|
"build:watch": "yarn run build --watch",
|
|
28
28
|
"build:release": "yarn clean && yarn build",
|
|
29
29
|
"check-build": "node -e \"(async function() { await import('./lib/index.js') })()\"",
|
|
30
|
-
"check-types": "tsc && vitest run --
|
|
30
|
+
"check-types": "tsc && vitest run --project types",
|
|
31
31
|
"lint": "biome check src/ test/",
|
|
32
32
|
"lint:fix": "yarn run lint --write",
|
|
33
|
-
"test:unit": "vitest run --
|
|
34
|
-
"test:browsers": "vitest run --
|
|
33
|
+
"test:unit": "vitest run --project unit",
|
|
34
|
+
"test:browsers": "vitest run --project browser",
|
|
35
35
|
"check-readme": "typescript-docs-verifier"
|
|
36
36
|
},
|
|
37
37
|
"types": "lib/index.d.ts",
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@chainsafe/as-sha256": "^1.1.0",
|
|
40
|
-
"any-signal": "
|
|
40
|
+
"any-signal": "^4.1.1",
|
|
41
41
|
"bigint-buffer": "^1.1.5",
|
|
42
42
|
"case": "^1.6.3",
|
|
43
43
|
"js-yaml": "^4.1.0"
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"beacon",
|
|
54
54
|
"blockchain"
|
|
55
55
|
],
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "b3a476ce83a58769cd2bd50d528fe69acb61f5cd"
|
|
57
57
|
}
|