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

View File

@@ -0,0 +1,3 @@
# These are supported funding model platforms
github: [isaacs]

24
spa/node_modules/promise-all-reject-late/.npmignore generated vendored Normal file
View File

@@ -0,0 +1,24 @@
# ignore most things, include some others
/*
/.*
!bin/
!lib/
!docs/
!package.json
!package-lock.json
!README.md
!CONTRIBUTING.md
!LICENSE
!CHANGELOG.md
!example/
!scripts/
!tap-snapshots/
!test/
!.github/
!.travis.yml
!.gitignore
!.gitattributes
!coverage-map.js
!map.js
!index.js

15
spa/node_modules/promise-all-reject-late/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.

40
spa/node_modules/promise-all-reject-late/README.md generated vendored Normal file
View File

@@ -0,0 +1,40 @@
# promise-all-reject-late
Like Promise.all, but save rejections until all promises are resolved.
This is handy when you want to do a bunch of things in parallel, and
rollback on failure, without clobbering or conflicting with those parallel
actions that may be in flight. For example, creating a bunch of files,
and deleting any if they don't all succeed.
Example:
```js
const lateReject = require('promise-all-reject-late')
const { promisify } = require('util')
const fs = require('fs')
const writeFile = promisify(fs.writeFile)
const createFilesOrRollback = (files) => {
return lateReject(files.map(file => writeFile(file, 'some data')))
.catch(er => {
// try to clean up, then fail with the initial error
// we know that all write attempts are finished at this point
return lateReject(files.map(file => rimraf(file)))
.catch(er => {
console.error('failed to clean up, youre on your own i guess', er)
})
.then(() => {
// fail with the original error
throw er
})
})
}
```
## API
* `lateReject([array, of, promises])` - Resolve all the promises,
returning a promise that rejects with the first error, or resolves with
the array of results, but only after all promises are settled.

27
spa/node_modules/promise-all-reject-late/index.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
const allSettled =
Promise.allSettled ? promises => Promise.allSettled(promises)
: promises => {
const reflections = []
for (let i = 0; i < promises.length; i++) {
reflections[i] = Promise.resolve(promises[i]).then(value => ({
status: 'fulfilled',
value,
}), reason => ({
status: 'rejected',
reason,
}))
}
return Promise.all(reflections)
}
module.exports = promises => allSettled(promises).then(results => {
let er = null
const ret = new Array(results.length)
results.forEach((result, i) => {
if (result.status === 'rejected')
throw result.reason
else
ret[i] = result.value
})
return ret
})

File diff suppressed because it is too large Load Diff

22
spa/node_modules/promise-all-reject-late/package.json generated vendored Normal file
View File

@@ -0,0 +1,22 @@
{
"name": "promise-all-reject-late",
"version": "1.0.1",
"description": "Like Promise.all, but save rejections until all promises are resolved",
"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": "^14.10.5"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
}

88
spa/node_modules/promise-all-reject-late/test/index.js generated vendored Normal file
View File

@@ -0,0 +1,88 @@
const t = require('tap')
const main = () => {
if (process.argv[2] === 'polyfill-all-settled') {
Promise.allSettled = null
runTests()
} else if (process.argv[2] === 'native-all-settled') {
Promise.allSettled = Promise.allSettled || (
promises => {
const reflections = []
for (let i = 0; i < promises.length; i++) {
reflections[i] = Promise.resolve(promises[i]).then(value => ({
status: 'fulfilled',
value,
}), reason => ({
status: 'rejected',
reason,
}))
}
return Promise.all(reflections)
}
)
runTests()
} else {
t.spawn(process.execPath, [__filename, 'polyfill-all-settled'])
t.spawn(process.execPath, [__filename, 'native-all-settled'])
}
}
const runTests = () => {
const lateFail = require('../')
t.test('fail only after all promises resolve', t => {
let resolvedSlow = false
const fast = () => Promise.reject('nope')
const slow = () => new Promise(res => setTimeout(res, 100))
.then(() => resolvedSlow = true)
// throw some holes and junk in the array to verify that we handle it
return t.rejects(lateFail([fast(),,,,slow(), null, {not: 'a promise'},,,]))
.then(() => t.equal(resolvedSlow, true, 'resolved slow before failure'))
})
t.test('works just like Promise.all() otherwise', t => {
const one = () => Promise.resolve(1)
const two = () => Promise.resolve(2)
const tre = () => Promise.resolve(3)
const fur = () => Promise.resolve(4)
const fiv = () => Promise.resolve(5)
const six = () => Promise.resolve(6)
const svn = () => Promise.resolve(7)
const eit = () => Promise.resolve(8)
const nin = () => Promise.resolve(9)
const ten = () => Promise.resolve(10)
const expect = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
const all = Promise.all([
one(),
two(),
tre(),
fur(),
fiv(),
six(),
svn(),
eit(),
nin(),
ten(),
])
const late = lateFail([
one(),
two(),
tre(),
fur(),
fiv(),
six(),
svn(),
eit(),
nin(),
ten(),
])
return Promise.all([all, late]).then(([all, late]) => {
t.strictSame(all, expect)
t.strictSame(late, expect)
})
})
}
main()