ciorent 1.0.5 → 1.0.7
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/deferred.d.ts +22 -0
- package/deferred.js +1 -0
- package/index.d.ts +46 -0
- package/index.js +1 -0
- package/iterators.d.ts +33 -0
- package/iterators.js +1 -0
- package/mutex.d.ts +17 -0
- package/mutex.js +1 -0
- package/package.json +1 -38
- package/rate-limit.d.ts +22 -0
- package/rate-limit.js +1 -0
- package/semaphore.d.ts +46 -0
- package/semaphore.js +1 -0
- package/signal.d.ts +41 -0
- package/signal.js +1 -0
- package/utils.d.ts +5 -0
- package/utils.js +1 -0
- package/bench/await.bench.ts +0 -29
- package/bench/bun.lock +0 -38
- package/bench/package.json +0 -11
- package/bench/promise-all.bench.ts +0 -42
- package/bench/semaphore.bench.ts +0 -101
- package/bench/shallow-clone.bench.ts +0 -69
- package/bench/tsconfig.json +0 -3
- package/biome.json +0 -62
- package/bun.lock +0 -117
- package/scripts/bench.ts +0 -38
- package/scripts/build.ts +0 -62
- package/scripts/publish.ts +0 -4
- package/scripts/report-size.ts +0 -33
- package/scripts/task.ts +0 -8
- package/scripts/tsconfig.json +0 -12
- package/scripts/tsconfig.ts +0 -16
- package/scripts/utils.ts +0 -15
- package/src/index.ts +0 -96
- package/src/mutex.ts +0 -44
- package/src/rate-limit.ts +0 -64
- package/src/semaphore.ts +0 -74
- package/src/signal.ts +0 -71
- package/src/utils.ts +0 -16
- package/tsconfig.json +0 -42
package/bun.lock
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"lockfileVersion": 1,
|
|
3
|
-
"configVersion": 0,
|
|
4
|
-
"workspaces": {
|
|
5
|
-
"": {
|
|
6
|
-
"name": "ciorent",
|
|
7
|
-
"devDependencies": {
|
|
8
|
-
"@biomejs/biome": "^2.1.3",
|
|
9
|
-
"@types/bun": "^1.2.19",
|
|
10
|
-
"ciorent": "./lib",
|
|
11
|
-
"jiti": "^2.5.1",
|
|
12
|
-
"mitata": "^1.0.34",
|
|
13
|
-
"oxc-minify": "^0.64.0",
|
|
14
|
-
"oxc-transform": "^0.65.0",
|
|
15
|
-
"typescript": "^5.9.2",
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
"trustedDependencies": [
|
|
20
|
-
"@biomejs/biome",
|
|
21
|
-
],
|
|
22
|
-
"packages": {
|
|
23
|
-
"@biomejs/biome": ["@biomejs/biome@2.1.3", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "2.1.3", "@biomejs/cli-darwin-x64": "2.1.3", "@biomejs/cli-linux-arm64": "2.1.3", "@biomejs/cli-linux-arm64-musl": "2.1.3", "@biomejs/cli-linux-x64": "2.1.3", "@biomejs/cli-linux-x64-musl": "2.1.3", "@biomejs/cli-win32-arm64": "2.1.3", "@biomejs/cli-win32-x64": "2.1.3" }, "bin": { "biome": "bin/biome" } }, "sha512-KE/tegvJIxTkl7gJbGWSgun7G6X/n2M6C35COT6ctYrAy7SiPyNvi6JtoQERVK/VRbttZfgGq96j2bFmhmnH4w=="],
|
|
24
|
-
|
|
25
|
-
"@biomejs/cli-darwin-arm64": ["@biomejs/cli-darwin-arm64@2.1.3", "", { "os": "darwin", "cpu": "arm64" }, "sha512-LFLkSWRoSGS1wVUD/BE6Nlt2dSn0ulH3XImzg2O/36BoToJHKXjSxzPEMAqT9QvwVtk7/9AQhZpTneERU9qaXA=="],
|
|
26
|
-
|
|
27
|
-
"@biomejs/cli-darwin-x64": ["@biomejs/cli-darwin-x64@2.1.3", "", { "os": "darwin", "cpu": "x64" }, "sha512-Q/4OTw8P9No9QeowyxswcWdm0n2MsdCwWcc5NcKQQvzwPjwuPdf8dpPPf4r+x0RWKBtl1FLiAUtJvBlri6DnYw=="],
|
|
28
|
-
|
|
29
|
-
"@biomejs/cli-linux-arm64": ["@biomejs/cli-linux-arm64@2.1.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-2hS6LgylRqMFmAZCOFwYrf77QMdUwJp49oe8PX/O8+P2yKZMSpyQTf3Eo5ewnsMFUEmYbPOskafdV1ds1MZMJA=="],
|
|
30
|
-
|
|
31
|
-
"@biomejs/cli-linux-arm64-musl": ["@biomejs/cli-linux-arm64-musl@2.1.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-KXouFSBnoxAWZYDQrnNRzZBbt5s9UJkIm40hdvSL9mBxSSoxRFQJbtg1hP3aa8A2SnXyQHxQfpiVeJlczZt76w=="],
|
|
32
|
-
|
|
33
|
-
"@biomejs/cli-linux-x64": ["@biomejs/cli-linux-x64@2.1.3", "", { "os": "linux", "cpu": "x64" }, "sha512-NxlSCBhLvQtWGagEztfAZ4WcE1AkMTntZV65ZvR+J9jp06+EtOYEBPQndA70ZGhHbEDG57bR6uNvqkd1WrEYVA=="],
|
|
34
|
-
|
|
35
|
-
"@biomejs/cli-linux-x64-musl": ["@biomejs/cli-linux-x64-musl@2.1.3", "", { "os": "linux", "cpu": "x64" }, "sha512-KaLAxnROouzIWtl6a0Y88r/4hW5oDUJTIqQorOTVQITaKQsKjZX4XCUmHIhdEk8zMnaiLZzRTAwk1yIAl+mIew=="],
|
|
36
|
-
|
|
37
|
-
"@biomejs/cli-win32-arm64": ["@biomejs/cli-win32-arm64@2.1.3", "", { "os": "win32", "cpu": "arm64" }, "sha512-V9CUZCtWH4u0YwyCYbQ3W5F4ZGPWp2C2TYcsiWFNNyRfmOW1j/TY/jAurl33SaRjgZPO5UUhGyr9m6BN9t84NQ=="],
|
|
38
|
-
|
|
39
|
-
"@biomejs/cli-win32-x64": ["@biomejs/cli-win32-x64@2.1.3", "", { "os": "win32", "cpu": "x64" }, "sha512-dxy599q6lgp8ANPpR8sDMscwdp9oOumEsVXuVCVT9N2vAho8uYXlCz53JhxX6LtJOXaE73qzgkGQ7QqvFlMC0g=="],
|
|
40
|
-
|
|
41
|
-
"@emnapi/core": ["@emnapi/core@1.4.3", "", { "dependencies": { "@emnapi/wasi-threads": "1.0.2", "tslib": "^2.4.0" } }, "sha512-4m62DuCE07lw01soJwPiBGC0nAww0Q+RY70VZ+n49yDIO13yyinhbWCeNnaob0lakDtWQzSdtNWzJeOJt2ma+g=="],
|
|
42
|
-
|
|
43
|
-
"@emnapi/runtime": ["@emnapi/runtime@1.4.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-pBPWdu6MLKROBX05wSNKcNb++m5Er+KQ9QkB+WVM+pW2Kx9hoSrVTnu3BdkI5eBLZoKu/J6mW/B6i6bJB2ytXQ=="],
|
|
44
|
-
|
|
45
|
-
"@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.0.2", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-5n3nTJblwRi8LlXkJ9eBzu+kZR8Yxcc7ubakyQTFzPMtIhFpUBRbsnc2Dv88IZDIbCDlBiWrknhB4Lsz7mg6BA=="],
|
|
46
|
-
|
|
47
|
-
"@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@0.2.9", "", { "dependencies": { "@emnapi/core": "^1.4.0", "@emnapi/runtime": "^1.4.0", "@tybys/wasm-util": "^0.9.0" } }, "sha512-OKRBiajrrxB9ATokgEQoG87Z25c67pCpYcCwmXYX8PBftC9pBfN18gnm/fh1wurSLEKIAt+QRFLFCQISrb66Jg=="],
|
|
48
|
-
|
|
49
|
-
"@oxc-minify/binding-darwin-arm64": ["@oxc-minify/binding-darwin-arm64@0.64.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-vjkAMgzTmoLxBVMNtueUPF3Zc9g42+T0kFy/vHnnyt+8UgMwiqakcPpbYwjUk0lRIGpIR9eMQ/ygoIaLp9J0YA=="],
|
|
50
|
-
|
|
51
|
-
"@oxc-minify/binding-darwin-x64": ["@oxc-minify/binding-darwin-x64@0.64.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-5drEZMsjPND+P6xygTsK2Avhpqsc61yoFRfIQxpsryFT3Ryf8Vz3tXzgxUVYItzwv3OlHBKfvQJfmN1KrGlAiw=="],
|
|
52
|
-
|
|
53
|
-
"@oxc-minify/binding-linux-arm-gnueabihf": ["@oxc-minify/binding-linux-arm-gnueabihf@0.64.0", "", { "os": "linux", "cpu": "arm" }, "sha512-7U6pA+1vCDYBtkrv5Uy51Lu8x4vZgUGV01aCFm5gMymkj5EVU595iiqPo/59wkJ9U/3ia6UeSi7ANxiG7LtrOQ=="],
|
|
54
|
-
|
|
55
|
-
"@oxc-minify/binding-linux-arm64-gnu": ["@oxc-minify/binding-linux-arm64-gnu@0.64.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-LLuw+y498KXqosUPiv5szXK0ZHCHZudiclDSiSghYj3jFH3eLo47XOiQNIWYyOsErTMdzg1yI/J79ZcfxUrhVg=="],
|
|
56
|
-
|
|
57
|
-
"@oxc-minify/binding-linux-arm64-musl": ["@oxc-minify/binding-linux-arm64-musl@0.64.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-5JC2tdDmyn4GpbwJjgTpb7wu/H59l4tXd8gE8Cb26k49Ir2cmijAS+X24wB7qO+iPj+xfGFzhBCcoT/6hIxeOw=="],
|
|
58
|
-
|
|
59
|
-
"@oxc-minify/binding-linux-x64-gnu": ["@oxc-minify/binding-linux-x64-gnu@0.64.0", "", { "os": "linux", "cpu": "x64" }, "sha512-YpJv27iwyf7oE8dbPV8I8cyaijmIe2TwBwSHJtQIv/hDv1jZWTcFzV9gxkd10MLwzZ802VGwGuiH7dEscTcXqQ=="],
|
|
60
|
-
|
|
61
|
-
"@oxc-minify/binding-linux-x64-musl": ["@oxc-minify/binding-linux-x64-musl@0.64.0", "", { "os": "linux", "cpu": "x64" }, "sha512-YOyL3lUQw0vJ7ZvU5TATA0PDzbgNy4aMac3H8C20aZ35Mamde1GlRhMC7nh8h4Cp2a2X6ios/mFn1nqFMPTWGA=="],
|
|
62
|
-
|
|
63
|
-
"@oxc-minify/binding-wasm32-wasi": ["@oxc-minify/binding-wasm32-wasi@0.64.0", "", { "dependencies": { "@napi-rs/wasm-runtime": "^0.2.9" }, "cpu": "none" }, "sha512-87ycAkjA0dkMlUruNCT39YEFPIe18CJ0bwZww2ZFzi2ImWMcttmovWX+MoSdHAbP2bu0DURM/A9WjcNusg+xxw=="],
|
|
64
|
-
|
|
65
|
-
"@oxc-minify/binding-win32-arm64-msvc": ["@oxc-minify/binding-win32-arm64-msvc@0.64.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-e1eh4pmBh09gOfroAmaTK9TgBN4FtOpuov0BkbWOBcDPh0kH0722YmAq/f/p85xAHjS284fXwkK8DlLeHQapDA=="],
|
|
66
|
-
|
|
67
|
-
"@oxc-minify/binding-win32-x64-msvc": ["@oxc-minify/binding-win32-x64-msvc@0.64.0", "", { "os": "win32", "cpu": "x64" }, "sha512-BQkLBUjobThdSVR2eL+iudr7X/RISk7uj8Z93yixBX89puwQxa/oAxBZQ9TbXgXXLBg5nkxoJgHwL++UHY3lYQ=="],
|
|
68
|
-
|
|
69
|
-
"@oxc-transform/binding-darwin-arm64": ["@oxc-transform/binding-darwin-arm64@0.65.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-hHfhOKyH+8DOj0VUmWl6RPLy3F0jCMCUMuKICzfelvSEs5uu8YRJ7fmQSsQD9E0oTrbbdkNVjq/1mcAPHzIBsg=="],
|
|
70
|
-
|
|
71
|
-
"@oxc-transform/binding-darwin-x64": ["@oxc-transform/binding-darwin-x64@0.65.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-MNeaCPBVB1oOdb4kMZnKej8kSoxqf4XqAfFIKgx2mV1gJnW3PfwAbpqhad+XH3QM49dB++Gyaw7SPNwQLpL3YQ=="],
|
|
72
|
-
|
|
73
|
-
"@oxc-transform/binding-linux-arm-gnueabihf": ["@oxc-transform/binding-linux-arm-gnueabihf@0.65.0", "", { "os": "linux", "cpu": "arm" }, "sha512-YpmBf4AhtAdsLV7XYY9/UxVmgewumgVlNVcPXXXAQ5shMEYhu2K/fCvlWBFe6vYNXFmXAAnDihOjLrq8n+NhnA=="],
|
|
74
|
-
|
|
75
|
-
"@oxc-transform/binding-linux-arm64-gnu": ["@oxc-transform/binding-linux-arm64-gnu@0.65.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-HbGl1QBvxCBVfRJdrcZliOsvjeoyMJQn6UUbYzQR8ud7SY2Ozp0Qf5VG0yjXvt/9BPcmOYMIxVCeKqSSkQ74XA=="],
|
|
76
|
-
|
|
77
|
-
"@oxc-transform/binding-linux-arm64-musl": ["@oxc-transform/binding-linux-arm64-musl@0.65.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-80gSeSVY9fm+xoLBkTYdJT2RYCqMy/NAqT6azQoJj3DczoNKU/4GV4F6jpINRWYUqIUAZt3RSvAQtdW3tWAjfw=="],
|
|
78
|
-
|
|
79
|
-
"@oxc-transform/binding-linux-x64-gnu": ["@oxc-transform/binding-linux-x64-gnu@0.65.0", "", { "os": "linux", "cpu": "x64" }, "sha512-Wsl+qLcaC3EeZT/ZjPuGTOtcHYu25HeEO1jCnZmIhFfz+1RWmaEK5P5xVVJbrAgNPMVOfqbUM0EwMCfvNmmPaQ=="],
|
|
80
|
-
|
|
81
|
-
"@oxc-transform/binding-linux-x64-musl": ["@oxc-transform/binding-linux-x64-musl@0.65.0", "", { "os": "linux", "cpu": "x64" }, "sha512-0kvRnt7EsKeGxxyt90l7yotSH5Ik5G9fbFJxkDCzPT23FzIQC8U4O1GzqNxnSj8VT/lRJGKcCL6KfSa6ttzQRQ=="],
|
|
82
|
-
|
|
83
|
-
"@oxc-transform/binding-wasm32-wasi": ["@oxc-transform/binding-wasm32-wasi@0.65.0", "", { "dependencies": { "@napi-rs/wasm-runtime": "^0.2.9" }, "cpu": "none" }, "sha512-gKfpf5BY28Cq0scUV//oBlzXg+XFbi2tKpKDqE/ee4Z0ySeDQ66pwBUp3nnEG7EsVZjKhE8yksPN4YOCoZhG9g=="],
|
|
84
|
-
|
|
85
|
-
"@oxc-transform/binding-win32-arm64-msvc": ["@oxc-transform/binding-win32-arm64-msvc@0.65.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-InHZNcL6hB2QLaiw3KNe+Aqnk+FRt4vuVmDXUibZ0fZSQorcFw/T267PtVVuWIzFNa6CQPU4ie0rxIdP0sHcFg=="],
|
|
86
|
-
|
|
87
|
-
"@oxc-transform/binding-win32-x64-msvc": ["@oxc-transform/binding-win32-x64-msvc@0.65.0", "", { "os": "win32", "cpu": "x64" }, "sha512-qvLEPowed0OcSEgztGXw1QF53KhLYYYWGxOK2H+9PSXpkNcYaeUQ1XOngR9kO8yIhpBt1/EOrVFeNK8biy0c7g=="],
|
|
88
|
-
|
|
89
|
-
"@tybys/wasm-util": ["@tybys/wasm-util@0.9.0", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-6+7nlbMVX/PVDCwaIQ8nTOPveOcFLSt8GcXdx8hD0bt39uWxYT88uXzqTd4fTvqta7oeUJqudepapKNt2DYJFw=="],
|
|
90
|
-
|
|
91
|
-
"@types/bun": ["@types/bun@1.2.19", "", { "dependencies": { "bun-types": "1.2.19" } }, "sha512-d9ZCmrH3CJ2uYKXQIUuZ/pUnTqIvLDS0SK7pFmbx8ma+ziH/FRMoAq5bYpRG7y+w1gl+HgyNZbtqgMq4W4e2Lg=="],
|
|
92
|
-
|
|
93
|
-
"@types/node": ["@types/node@22.14.0", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-Kmpl+z84ILoG+3T/zQFyAJsU6EPTmOCj8/2+83fSN6djd6I4o7uOuGIH6vq3PrjY5BGitSbFuMN18j3iknubbA=="],
|
|
94
|
-
|
|
95
|
-
"@types/react": ["@types/react@19.1.9", "", { "dependencies": { "csstype": "^3.0.2" } }, "sha512-WmdoynAX8Stew/36uTSVMcLJJ1KRh6L3IZRx1PZ7qJtBqT3dYTgyDTx8H1qoRghErydW7xw9mSJ3wS//tCRpFA=="],
|
|
96
|
-
|
|
97
|
-
"bun-types": ["bun-types@1.2.19", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-uAOTaZSPuYsWIXRpj7o56Let0g/wjihKCkeRqUBhlLVM/Bt+Fj9xTo+LhC1OV1XDaGkz4hNC80et5xgy+9KTHQ=="],
|
|
98
|
-
|
|
99
|
-
"ciorent": ["ciorent@file:lib", {}],
|
|
100
|
-
|
|
101
|
-
"csstype": ["csstype@3.1.3", "", {}, "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="],
|
|
102
|
-
|
|
103
|
-
"jiti": ["jiti@2.5.1", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-twQoecYPiVA5K/h6SxtORw/Bs3ar+mLUtoPSc7iMXzQzK8d7eJ/R09wmTwAjiamETn1cXYPGfNnu7DMoHgu12w=="],
|
|
104
|
-
|
|
105
|
-
"mitata": ["mitata@1.0.34", "", {}, "sha512-Mc3zrtNBKIMeHSCQ0XqRLo1vbdIx1wvFV9c8NJAiyho6AjNfMY8bVhbS12bwciUdd1t4rj8099CH3N3NFahaUA=="],
|
|
106
|
-
|
|
107
|
-
"oxc-minify": ["oxc-minify@0.64.0", "", { "optionalDependencies": { "@oxc-minify/binding-darwin-arm64": "0.64.0", "@oxc-minify/binding-darwin-x64": "0.64.0", "@oxc-minify/binding-linux-arm-gnueabihf": "0.64.0", "@oxc-minify/binding-linux-arm64-gnu": "0.64.0", "@oxc-minify/binding-linux-arm64-musl": "0.64.0", "@oxc-minify/binding-linux-x64-gnu": "0.64.0", "@oxc-minify/binding-linux-x64-musl": "0.64.0", "@oxc-minify/binding-wasm32-wasi": "0.64.0", "@oxc-minify/binding-win32-arm64-msvc": "0.64.0", "@oxc-minify/binding-win32-x64-msvc": "0.64.0" } }, "sha512-nyQ4qGRlr210mVSkS9whn+ghhe2o6ba22ksTBWMj4CHUhNJWfY0S/h1yEUvDZxNFtuxSReLSlQATUzUyo7/wzQ=="],
|
|
108
|
-
|
|
109
|
-
"oxc-transform": ["oxc-transform@0.65.0", "", { "optionalDependencies": { "@oxc-transform/binding-darwin-arm64": "0.65.0", "@oxc-transform/binding-darwin-x64": "0.65.0", "@oxc-transform/binding-linux-arm-gnueabihf": "0.65.0", "@oxc-transform/binding-linux-arm64-gnu": "0.65.0", "@oxc-transform/binding-linux-arm64-musl": "0.65.0", "@oxc-transform/binding-linux-x64-gnu": "0.65.0", "@oxc-transform/binding-linux-x64-musl": "0.65.0", "@oxc-transform/binding-wasm32-wasi": "0.65.0", "@oxc-transform/binding-win32-arm64-msvc": "0.65.0", "@oxc-transform/binding-win32-x64-msvc": "0.65.0" } }, "sha512-TWAMi8zVvORQw545O1/1irpbMPDQGD6ernen5QyY5PCL9nj3RqgR1ULlQiHVDXEl2rW+OtHF8KS0ItAUyOfQ+Q=="],
|
|
110
|
-
|
|
111
|
-
"tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
|
|
112
|
-
|
|
113
|
-
"typescript": ["typescript@5.9.2", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A=="],
|
|
114
|
-
|
|
115
|
-
"undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
|
|
116
|
-
}
|
|
117
|
-
}
|
package/scripts/bench.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { parseArgs } from 'node:util';
|
|
2
|
-
import { Glob } from 'bun';
|
|
3
|
-
import { BENCH, cd, exec } from './utils.ts';
|
|
4
|
-
|
|
5
|
-
const CMD: Dict<string> = {
|
|
6
|
-
bun: 'bun run',
|
|
7
|
-
node: 'node --import jiti/register --expose-gc --allow-natives-syntax',
|
|
8
|
-
deno: 'deno run --allow-all --v8-flags=--expose-gc,--allow-natives-syntax',
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const args = parseArgs({
|
|
12
|
-
options: {
|
|
13
|
-
runtime: {
|
|
14
|
-
type: 'string',
|
|
15
|
-
default: 'node',
|
|
16
|
-
short: 'r',
|
|
17
|
-
},
|
|
18
|
-
target: {
|
|
19
|
-
type: 'string',
|
|
20
|
-
short: 't',
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
}).values;
|
|
24
|
-
|
|
25
|
-
const EXE = CMD[args.runtime];
|
|
26
|
-
if (EXE == null) throw new Error('Unrecognized runtime: ' + args.runtime);
|
|
27
|
-
|
|
28
|
-
cd(BENCH);
|
|
29
|
-
|
|
30
|
-
if (args.target != null) {
|
|
31
|
-
const path = `${args.target}.bench.ts`;
|
|
32
|
-
console.log('Running benchmark:', path);
|
|
33
|
-
await exec`${{ raw: EXE }} ${path}`;
|
|
34
|
-
} else
|
|
35
|
-
for (const path of new Glob('**/*.bench.ts').scanSync(BENCH)) {
|
|
36
|
-
console.log('Running benchmark:', path);
|
|
37
|
-
await exec`${{ raw: EXE }} ${path}`;
|
|
38
|
-
}
|
package/scripts/build.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/// <reference types='bun-types' />
|
|
2
|
-
import { existsSync, rmSync } from 'node:fs';
|
|
3
|
-
import { minify } from 'oxc-minify';
|
|
4
|
-
import { transform } from 'oxc-transform';
|
|
5
|
-
import pkg from '../package.json';
|
|
6
|
-
import { cp, LIB, ROOT, SOURCE } from './utils.ts';
|
|
7
|
-
|
|
8
|
-
// Remove old content
|
|
9
|
-
if (existsSync(LIB)) rmSync(LIB, { recursive: true });
|
|
10
|
-
|
|
11
|
-
// @ts-ignore
|
|
12
|
-
const exports = (pkg.exports = {} as Record<string, string>);
|
|
13
|
-
|
|
14
|
-
await Promise.all(
|
|
15
|
-
[...new Bun.Glob('**/*.ts').scanSync(SOURCE)].map(async (path) => {
|
|
16
|
-
const pathNoExt = path.slice(0, path.lastIndexOf('.') >>> 0);
|
|
17
|
-
|
|
18
|
-
const transformed = transform(
|
|
19
|
-
path,
|
|
20
|
-
await Bun.file(`${SOURCE}/${path}`).text(),
|
|
21
|
-
{
|
|
22
|
-
sourceType: 'module',
|
|
23
|
-
typescript: {
|
|
24
|
-
declaration: {
|
|
25
|
-
stripInternal: true,
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
lang: 'ts',
|
|
29
|
-
},
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
if (transformed.code !== '')
|
|
33
|
-
Bun.write(
|
|
34
|
-
`${LIB}/${pathNoExt}.js`,
|
|
35
|
-
minify(
|
|
36
|
-
path,
|
|
37
|
-
transformed.code.replace(/const (.*) =/g, (a) =>
|
|
38
|
-
a.replace('const', 'let'),
|
|
39
|
-
),
|
|
40
|
-
{
|
|
41
|
-
compress: false,
|
|
42
|
-
mangle: false,
|
|
43
|
-
},
|
|
44
|
-
).code,
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
if (transformed.declaration) {
|
|
48
|
-
Bun.write(`${LIB}/${pathNoExt}.d.ts`, transformed.declaration);
|
|
49
|
-
exports[
|
|
50
|
-
pathNoExt === 'index'
|
|
51
|
-
? '.'
|
|
52
|
-
: './' +
|
|
53
|
-
(pathNoExt.endsWith('/index') ? pathNoExt.slice(0, -6) : pathNoExt)
|
|
54
|
-
] = './' + pathNoExt + (transformed.code === '' ? '.d.ts' : '.js');
|
|
55
|
-
}
|
|
56
|
-
}),
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
pkg.trustedDependencies = pkg.devDependencies = pkg.scripts = undefined as any;
|
|
60
|
-
|
|
61
|
-
Bun.write(LIB + '/package.json', JSON.stringify(pkg));
|
|
62
|
-
cp(ROOT, LIB, 'README.md');
|
package/scripts/publish.ts
DELETED
package/scripts/report-size.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { minify } from 'oxc-minify';
|
|
2
|
-
import { LIB } from './utils.ts';
|
|
3
|
-
|
|
4
|
-
const toByte = (num: number) =>
|
|
5
|
-
num >= 1e3 ? (num / 1e3).toFixed(2) + 'KB' : num + 'B';
|
|
6
|
-
|
|
7
|
-
const arr = await Promise.all(
|
|
8
|
-
[...new Bun.Glob('**/*.js').scanSync(LIB)].map(async (path) => {
|
|
9
|
-
const file = Bun.file(LIB + '/' + path);
|
|
10
|
-
const code = await file.text();
|
|
11
|
-
const minfiedCode = minify(path, code).code!;
|
|
12
|
-
|
|
13
|
-
return {
|
|
14
|
-
entry: path,
|
|
15
|
-
size: file.size,
|
|
16
|
-
minified: Buffer.from(minfiedCode).byteLength,
|
|
17
|
-
gzip: Bun.gzipSync(code).byteLength,
|
|
18
|
-
minifiedGzip: Bun.gzipSync(minfiedCode).byteLength,
|
|
19
|
-
};
|
|
20
|
-
}),
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
console.table(
|
|
24
|
-
arr
|
|
25
|
-
.sort((a, b) => a.size - b.size)
|
|
26
|
-
.map((val) => ({
|
|
27
|
-
Entry: val.entry,
|
|
28
|
-
Size: toByte(val.size),
|
|
29
|
-
Minify: toByte(val.minified),
|
|
30
|
-
GZIP: toByte(val.gzip),
|
|
31
|
-
'Minify GZIP': toByte(val.minifiedGzip),
|
|
32
|
-
})),
|
|
33
|
-
);
|
package/scripts/task.ts
DELETED
package/scripts/tsconfig.json
DELETED
package/scripts/tsconfig.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { join, relative } from 'node:path';
|
|
2
|
-
import { SCRIPTS } from './utils.ts';
|
|
3
|
-
|
|
4
|
-
const paths = process.argv.slice(2);
|
|
5
|
-
|
|
6
|
-
for (const path of paths)
|
|
7
|
-
Bun.write(
|
|
8
|
-
join(path, 'tsconfig.json'),
|
|
9
|
-
JSON.stringify(
|
|
10
|
-
{
|
|
11
|
-
extends: relative(path, SCRIPTS + '/tsconfig.json'),
|
|
12
|
-
},
|
|
13
|
-
null,
|
|
14
|
-
2,
|
|
15
|
-
),
|
|
16
|
-
);
|
package/scripts/utils.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { join, resolve } from 'node:path/posix';
|
|
2
|
-
import { $, file, write } from 'bun';
|
|
3
|
-
|
|
4
|
-
export const SCRIPTS = import.meta.dir;
|
|
5
|
-
export const ROOT = resolve(SCRIPTS, '..');
|
|
6
|
-
export const SOURCE = ROOT + '/src';
|
|
7
|
-
export const LIB = ROOT + '/lib';
|
|
8
|
-
export const BENCH = ROOT + '/bench';
|
|
9
|
-
export const EXAMPLES = ROOT + '/examples/src';
|
|
10
|
-
|
|
11
|
-
export const cp = (from: string, to: string, path: string) =>
|
|
12
|
-
write(join(to, path), file(join(from, path)));
|
|
13
|
-
export const exec = (...args: Parameters<typeof $>) =>
|
|
14
|
-
$(...args).catch((err) => process.stderr.write(err.stderr as any));
|
|
15
|
-
export const cd = (dir: string) => $.cwd(dir);
|
package/src/index.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
loadedReject,
|
|
3
|
-
loadedResolve,
|
|
4
|
-
loadResolve,
|
|
5
|
-
loadResolvers,
|
|
6
|
-
} from './utils.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Continue the execution on next event loop cycle.
|
|
10
|
-
*
|
|
11
|
-
* You can `await` this **occasionally** in an expensive synchronous operation to avoid
|
|
12
|
-
* blocking the main thread and let other asynchronous task to run.
|
|
13
|
-
*/
|
|
14
|
-
export const nextTick: Promise<void> = Promise.resolve();
|
|
15
|
-
|
|
16
|
-
const getFinishedState = async (s: [number], p: Promise<any>) => {
|
|
17
|
-
try {
|
|
18
|
-
await p;
|
|
19
|
-
s[0] = 1;
|
|
20
|
-
} catch (e) {
|
|
21
|
-
s[0] = 0;
|
|
22
|
-
|
|
23
|
-
// Don't swallow error
|
|
24
|
-
return p;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Get the state of a promise on next tick:
|
|
29
|
-
* - `0`: Input promise rejected
|
|
30
|
-
* - `1`: Input promise resolves
|
|
31
|
-
* - `2`: Input promise pending
|
|
32
|
-
*/
|
|
33
|
-
export const state = async (p: Promise<any>): Promise<0 | 1 | 2> => {
|
|
34
|
-
const res = [2] as [0 | 1 | 2];
|
|
35
|
-
getFinishedState(res, p);
|
|
36
|
-
await nextTick;
|
|
37
|
-
return res[0] as any;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Check whether a value is awaitable
|
|
42
|
-
* @param p
|
|
43
|
-
* @returns
|
|
44
|
-
*/
|
|
45
|
-
export const isThenable = <T>(p: unknown): p is PromiseLike<T> =>
|
|
46
|
-
p !== null &&
|
|
47
|
-
typeof p === 'object' &&
|
|
48
|
-
!Array.isArray(p) &&
|
|
49
|
-
// @ts-ignore
|
|
50
|
-
typeof p.then === 'function';
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Timeout a promise
|
|
54
|
-
* @param p
|
|
55
|
-
* @param ms
|
|
56
|
-
*/
|
|
57
|
-
export const timeout = <T>(p: Promise<T>, ms: number): Promise<T | void> => {
|
|
58
|
-
const promise = new Promise<void>(loadResolvers);
|
|
59
|
-
setTimeout(loadedResolve, ms);
|
|
60
|
-
p.then(loadedResolve, loadedReject);
|
|
61
|
-
return promise;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Sleep for a duration.
|
|
66
|
-
* @param ms - Sleep duration in milliseconds
|
|
67
|
-
*/
|
|
68
|
-
export const sleep: (ms: number) => Promise<void> =
|
|
69
|
-
globalThis.Bun?.sleep ??
|
|
70
|
-
globalThis.process?.getBuiltinModule?.('timers/promises').setTimeout ??
|
|
71
|
-
((ms) => {
|
|
72
|
-
const promise = new Promise(loadResolve);
|
|
73
|
-
setTimeout(loadedResolve, ms);
|
|
74
|
-
return promise;
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
const sharedBuf = new Int32Array(new SharedArrayBuffer(4));
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Sleep for a duration synchronously.
|
|
81
|
-
*
|
|
82
|
-
* This method blocks the current thread.
|
|
83
|
-
*
|
|
84
|
-
* On the browser it only works in workers.
|
|
85
|
-
* @param ms - Sleep duration in milliseconds
|
|
86
|
-
*/
|
|
87
|
-
export const sleepSync: (ms: number) => void =
|
|
88
|
-
globalThis.Bun?.sleepSync ??
|
|
89
|
-
((ms) => {
|
|
90
|
-
Atomics.wait(sharedBuf, 0, 0, ms);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
export * as mutex from './mutex.js';
|
|
94
|
-
export * as limit from './rate-limit.js';
|
|
95
|
-
export * as semaphore from './semaphore.js';
|
|
96
|
-
export * as signal from './signal.js';
|
package/src/mutex.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { nextTick } from './index.js';
|
|
2
|
-
import { type Extend, loadedResolve, loadResolve } from './utils.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Describe a mutex.
|
|
6
|
-
*/
|
|
7
|
-
export type Mutex = [Promise<void>];
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Create a mutex.
|
|
11
|
-
*/
|
|
12
|
-
export const init = (): Mutex => [nextTick];
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Acquire a mutex.
|
|
16
|
-
*/
|
|
17
|
-
export const acquire = async (mu: Extend<Mutex>): Promise<() => void> => {
|
|
18
|
-
const currentLock = mu[0];
|
|
19
|
-
mu[0] = new Promise<void>(loadResolve);
|
|
20
|
-
|
|
21
|
-
const release = loadedResolve;
|
|
22
|
-
await currentLock;
|
|
23
|
-
return release;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const chainLock = async (
|
|
27
|
-
lock: Promise<void>,
|
|
28
|
-
fn: any,
|
|
29
|
-
...args: any[]
|
|
30
|
-
): Promise<any> => {
|
|
31
|
-
try {
|
|
32
|
-
await lock;
|
|
33
|
-
} finally {
|
|
34
|
-
return fn(...args);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Automatically acquire and run a task.
|
|
39
|
-
*/
|
|
40
|
-
export const run = <const T extends (...args: any[]) => Promise<any>>(
|
|
41
|
-
mu: Extend<Mutex>,
|
|
42
|
-
fn: T,
|
|
43
|
-
...args: Parameters<T>
|
|
44
|
-
): ReturnType<T> => (mu[0] = chainLock(mu[0], fn, ...args) as any);
|
package/src/rate-limit.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Describe a rate limiter
|
|
3
|
-
*/
|
|
4
|
-
export type Limiter = (limit: number, ms: number) => () => boolean;
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Fixed window strategy
|
|
8
|
-
* @param limit
|
|
9
|
-
* @param ms
|
|
10
|
-
*/
|
|
11
|
-
export const fixedWindow: Limiter = (limit, ms) => {
|
|
12
|
-
let cur = limit;
|
|
13
|
-
const unlock = () => {
|
|
14
|
-
cur = limit;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
return () => {
|
|
18
|
-
if (cur === 0) return false;
|
|
19
|
-
if (cur-- === limit) setTimeout(unlock, ms);
|
|
20
|
-
|
|
21
|
-
return true;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Sliding window strategy
|
|
27
|
-
* @param limit
|
|
28
|
-
* @param ms
|
|
29
|
-
*/
|
|
30
|
-
export const slidingWindow: Limiter = (limit, ms) => {
|
|
31
|
-
let cur = limit;
|
|
32
|
-
const unlock = () => {
|
|
33
|
-
cur++;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
return () => {
|
|
37
|
-
if (cur === 0) return false;
|
|
38
|
-
|
|
39
|
-
cur--;
|
|
40
|
-
setTimeout(unlock, ms);
|
|
41
|
-
return true;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Token bucket strategy
|
|
47
|
-
* @param limit
|
|
48
|
-
* @param ms
|
|
49
|
-
*/
|
|
50
|
-
export const tokenBucket: Limiter = (limit, ms) => {
|
|
51
|
-
let cur = limit;
|
|
52
|
-
|
|
53
|
-
ms /= limit;
|
|
54
|
-
const unlock = () => {
|
|
55
|
-
if (cur++ < limit) setTimeout(unlock, ms);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
return () => {
|
|
59
|
-
if (cur === 0) return false;
|
|
60
|
-
if (cur-- === limit) setTimeout(unlock, ms);
|
|
61
|
-
|
|
62
|
-
return true;
|
|
63
|
-
};
|
|
64
|
-
};
|
package/src/semaphore.ts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { type Extend, loadedResolve, loadResolve } from './utils.js';
|
|
2
|
-
|
|
3
|
-
type QueueItem = () => void;
|
|
4
|
-
type Queue = [(QueueItem | null)[], len: number, head: number, tail: number];
|
|
5
|
-
|
|
6
|
-
const push = (qu: Extend<Queue>, item: QueueItem): void => {
|
|
7
|
-
const tail = qu[3];
|
|
8
|
-
qu[3] = tail + 1 === qu[1] ? 0 : tail + 1;
|
|
9
|
-
qu[0][tail] = item;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Check whether the semaphore queue is full.
|
|
14
|
-
*/
|
|
15
|
-
export const full = (qu: Extend<Queue>): boolean =>
|
|
16
|
-
qu[2] === qu[3] && qu[0][qu[2]] !== null;
|
|
17
|
-
|
|
18
|
-
const pop = (qu: Extend<Queue>): QueueItem => {
|
|
19
|
-
const head = qu[2];
|
|
20
|
-
qu[2] = head + 1 === qu[1] ? 0 : head + 1;
|
|
21
|
-
|
|
22
|
-
const val = qu[0][head];
|
|
23
|
-
qu[0][head] = null;
|
|
24
|
-
return val!;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export type Semaphore = [...Queue, remain: number];
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Create a semaphore.
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* // maximum of 10 concurrent tasks and 200 waiting tasks.
|
|
34
|
-
* const sem = semaphore.init(10, 200);
|
|
35
|
-
*/
|
|
36
|
-
export const init = (permits: number, capacity: number): Semaphore => [
|
|
37
|
-
new Array(capacity).fill(null),
|
|
38
|
-
capacity,
|
|
39
|
-
0,
|
|
40
|
-
0,
|
|
41
|
-
permits,
|
|
42
|
-
];
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Acquire a permit.
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
*
|
|
49
|
-
* if (semaphore.full(sem)) {
|
|
50
|
-
* // Internal queue is full
|
|
51
|
-
* }
|
|
52
|
-
*
|
|
53
|
-
* await semaphore.acquire(sem);
|
|
54
|
-
*
|
|
55
|
-
* // Do something and then release the permit.
|
|
56
|
-
* semaphore.release(sem);
|
|
57
|
-
*/
|
|
58
|
-
export const acquire = (sem: Extend<Semaphore>): Promise<void> | void => {
|
|
59
|
-
if (--sem[4] < 0) {
|
|
60
|
-
const promise = new Promise<void>(loadResolve);
|
|
61
|
-
push(sem, loadedResolve);
|
|
62
|
-
return promise;
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Release a permit.
|
|
68
|
-
*
|
|
69
|
-
* @example
|
|
70
|
-
* semaphore.release(sem);
|
|
71
|
-
*/
|
|
72
|
-
export const release = (sem: Extend<Semaphore>): void => {
|
|
73
|
-
sem[4]++ < 0 && pop(sem)();
|
|
74
|
-
};
|
package/src/signal.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Describe a signal
|
|
3
|
-
*/
|
|
4
|
-
export type Signal = [interrupted: boolean, ...parents: Signal[]];
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Create a signal
|
|
8
|
-
*/
|
|
9
|
-
export const init = (): Signal => [false];
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Create a signal that aborts when any of the input signals abort
|
|
13
|
-
* @param sigs
|
|
14
|
-
*/
|
|
15
|
-
export const any = (signals: Signal[]): Signal => {
|
|
16
|
-
const sig: Signal = [false];
|
|
17
|
-
for (let i = 0; i < signals.length; i++) signals[i].push(sig);
|
|
18
|
-
return sig;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const _ = [false];
|
|
22
|
-
/**
|
|
23
|
-
* Create a signal that when interrupted will interrupt a group of other signals
|
|
24
|
-
*/
|
|
25
|
-
export const group = (signals: Signal[]): Signal =>
|
|
26
|
-
_.concat(signals as any) as any;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Check whether the signal has been aborted
|
|
30
|
-
* @param t
|
|
31
|
-
*/
|
|
32
|
-
export const aborted = (t: Signal): boolean => t[0];
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Abort a signal
|
|
36
|
-
* @param t
|
|
37
|
-
*/
|
|
38
|
-
export const abort = (t: Signal): void => {
|
|
39
|
-
if (!t[0]) {
|
|
40
|
-
t[0] = true;
|
|
41
|
-
if (t.length > 1) for (let i = 1; i < t.length; i++) abort(t[i] as Signal);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Abort a signal after a duration
|
|
47
|
-
* @param t
|
|
48
|
-
*/
|
|
49
|
-
export const abortAfter = (ms: number, t: Signal): void => {
|
|
50
|
-
setTimeout(() => abort(t), ms);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Create a signal that aborts after ms
|
|
55
|
-
* @param ms
|
|
56
|
-
*/
|
|
57
|
-
export const timeout = (ms: number): Signal => {
|
|
58
|
-
const sig: Signal = [false];
|
|
59
|
-
abortAfter(ms, sig);
|
|
60
|
-
return sig;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Attach a signal to a `DisposableStack` or `AsyncDisposableStack`
|
|
65
|
-
*/
|
|
66
|
-
export const adopt = (
|
|
67
|
-
t: Signal,
|
|
68
|
-
stack: DisposableStack | AsyncDisposableStack,
|
|
69
|
-
): void => {
|
|
70
|
-
stack.adopt(t, abort);
|
|
71
|
-
};
|