Last commit july 5th

This commit is contained in:
2024-07-05 13:46:23 +02:00
parent dad0d86e8c
commit b0e4dfbb76
24982 changed files with 2621219 additions and 413 deletions

15
spa/node_modules/promise-call-limit/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,15 @@
The ISC License
Copyright (c) Isaac Z. Schlueter
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

30
spa/node_modules/promise-call-limit/README.md generated vendored Normal file
View File

@@ -0,0 +1,30 @@
# promise-call-limit
Call an array of promise-returning functions, restricting concurrency to a
specified limit.
## USAGE
```js
const promiseCallLimit = require('promise-call-limit')
const things = getLongListOfThingsToFrobulate()
// frobulate no more than 4 things in parallel
promiseCallLimit(things.map(thing => () => frobulateThing(thing)), 4)
.then(results => console.log('frobulated 4 at a time', results))
```
## API
### promiseCallLimit(queue Array<() => Promise>, limit = defaultLimit)
The default limit is the number of CPUs on the system - 1, or 1.
The reason for subtracting one is that presumably the main thread is taking
up a CPU as well, so let's not be greedy.
Note that the array should be a list of Promise-_returning_ functions, not
Promises themselves. If you have a bunch of Promises already, you're best
off just calling `Promise.all()`.
The functions in the queue are called without any arguments.

52
spa/node_modules/promise-call-limit/index.js generated vendored Normal file
View File

@@ -0,0 +1,52 @@
const os = require('os')
// availableParallelism available only since node v19, for older versions use
// cpus() cpus() can return an empty list if /proc is not mounted, use 1 in
// this case
/* istanbul ignore next - version-specific workaround */
const defLimit = 'availableParallelism' in os
? os.availableParallelism()
: Math.max(1, os.cpus().length)
const callLimit = (queue, limit = defLimit) => new Promise((res, rej) => {
let active = 0
let current = 0
const results = []
let rejected = false
const reject = er => {
if (rejected)
return
rejected = true
rej(er)
}
let resolved = false
const resolve = () => {
if (resolved || active > 0)
return
resolved = true
res(results)
}
const run = () => {
const c = current++
if (c >= queue.length) {
return resolve()
}
active ++
results[c] = queue[c]().then(result => {
active --
results[c] = result
run()
return result
}, reject)
}
for (let i = 0; i < limit; i++) {
run()
}
})
module.exports = callLimit

29
spa/node_modules/promise-call-limit/package.json generated vendored Normal file
View File

@@ -0,0 +1,29 @@
{
"name": "promise-call-limit",
"version": "1.0.2",
"files": [
"index.js"
],
"description": "Call an array of promise-returning functions, restricting concurrency to a specified limit.",
"repository": {
"type": "git",
"url": "git+https://github.com/isaacs/promise-call-limit"
},
"author": "Isaac Z. Schlueter <i@izs.me> (https://izs.me)",
"license": "ISC",
"scripts": {
"test": "tap",
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags"
},
"tap": {
"check-coverage": true
},
"devDependencies": {
"tap": "^16.0.0"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
}