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/read/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,15 @@
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
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.

39
spa/node_modules/read/README.md generated vendored Normal file
View File

@@ -0,0 +1,39 @@
## read
For reading user input from stdin.
Similar to the `readline` builtin's `question()` method, but with a
few more features.
## Usage
```javascript
var read = require("read")
try {
const result = await read(options, callback)
} catch (er) {
console.error(er)
}
```
## Options
Every option is optional.
* `prompt` What to write to stdout before reading input.
* `silent` Don't echo the output as the user types it.
* `replace` Replace silenced characters with the supplied character value.
* `timeout` Number of ms to wait for user input before giving up.
* `default` The default value if the user enters nothing.
* `edit` Allow the user to edit the default value.
* `terminal` Treat the output as a TTY, whether it is or not.
* `input` Readable stream to get input data from. (default `process.stdin`)
* `output` Writable stream to write prompts to. (default: `process.stdout`)
* `completer` Autocomplete callback (see [official api](https://nodejs.org/api/readline.html#readline_readline_createinterface_options) for details
If silent is true, and the input is a TTY, then read will set raw
mode, and read character by character.
## Contributing
Patches welcome.

82
spa/node_modules/read/lib/read.js generated vendored Normal file
View File

@@ -0,0 +1,82 @@
const readline = require('readline')
const Mute = require('mute-stream')
module.exports = async function read ({
default: def = '',
input = process.stdin,
output = process.stdout,
completer,
prompt = '',
silent,
timeout,
edit,
terminal,
replace,
}) {
if (typeof def !== 'undefined' && typeof def !== 'string' && typeof def !== 'number') {
throw new Error('default value must be string or number')
}
let editDef = false
prompt = prompt.trim() + ' '
terminal = !!(terminal || output.isTTY)
if (def) {
if (silent) {
prompt += '(<default hidden>) '
} else if (edit) {
editDef = true
} else {
prompt += '(' + def + ') '
}
}
const m = new Mute({ replace, prompt })
m.pipe(output, { end: false })
output = m
return new Promise((resolve, reject) => {
const rl = readline.createInterface({ input, output, terminal, silent: true, completer })
const timer = timeout && setTimeout(() => onError(new Error('timed out')), timeout)
output.unmute()
rl.setPrompt(prompt)
rl.prompt()
if (silent) {
output.mute()
} else if (editDef) {
rl.line = def
rl.cursor = def.length
rl._refreshLine()
}
const done = () => {
rl.close()
clearTimeout(timer)
output.mute()
output.end()
}
const onError = (er) => {
done()
reject(er)
}
rl.on('error', onError)
rl.on('line', (line) => {
if (silent && terminal) {
output.unmute()
}
done()
// truncate the \n at the end.
const res = line.replace(/\r?\n?$/, '') || def || ''
return resolve(res)
})
rl.on('SIGINT', () => {
rl.close()
onError(new Error('canceled'))
})
})
}

15
spa/node_modules/read/node_modules/mute-stream/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,15 @@
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
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.

View File

@@ -0,0 +1,68 @@
# mute-stream
Bytes go in, but they don't come out (when muted).
This is a basic pass-through stream, but when muted, the bytes are
silently dropped, rather than being passed through.
## Usage
```javascript
const MuteStream = require('mute-stream')
const ms = new MuteStream(options)
ms.pipe(process.stdout)
ms.write('foo') // writes 'foo' to stdout
ms.mute()
ms.write('bar') // does not write 'bar'
ms.unmute()
ms.write('baz') // writes 'baz' to stdout
// can also be used to mute incoming data
const ms = new MuteStream
input.pipe(ms)
ms.on('data', function (c) {
console.log('data: ' + c)
})
input.emit('data', 'foo') // logs 'foo'
ms.mute()
input.emit('data', 'bar') // does not log 'bar'
ms.unmute()
input.emit('data', 'baz') // logs 'baz'
```
## Options
All options are optional.
* `replace` Set to a string to replace each character with the
specified string when muted. (So you can show `****` instead of the
password, for example.)
* `prompt` If you are using a replacement char, and also using a
prompt with a readline stream (as for a `Password: *****` input),
then specify what the prompt is so that backspace will work
properly. Otherwise, pressing backspace will overwrite the prompt
with the replacement character, which is weird.
## ms.mute()
Set `muted` to `true`. Turns `.write()` into a no-op.
## ms.unmute()
Set `muted` to `false`
## ms.isTTY
True if the pipe destination is a TTY, or if the incoming pipe source is
a TTY.
## Other stream methods...
The other standard readable and writable stream methods are all
available. The MuteStream object acts as a facade to its pipe source
and destination.

View File

@@ -0,0 +1,142 @@
const Stream = require('stream')
class MuteStream extends Stream {
#isTTY = null
constructor (opts = {}) {
super(opts)
this.writable = this.readable = true
this.muted = false
this.on('pipe', this._onpipe)
this.replace = opts.replace
// For readline-type situations
// This much at the start of a line being redrawn after a ctrl char
// is seen (such as backspace) won't be redrawn as the replacement
this._prompt = opts.prompt || null
this._hadControl = false
}
#destSrc (key, def) {
if (this._dest) {
return this._dest[key]
}
if (this._src) {
return this._src[key]
}
return def
}
#proxy (method, ...args) {
if (typeof this._dest?.[method] === 'function') {
this._dest[method](...args)
}
if (typeof this._src?.[method] === 'function') {
this._src[method](...args)
}
}
get isTTY () {
if (this.#isTTY !== null) {
return this.#isTTY
}
return this.#destSrc('isTTY', false)
}
// basically just get replace the getter/setter with a regular value
set isTTY (val) {
this.#isTTY = val
}
get rows () {
return this.#destSrc('rows')
}
get columns () {
return this.#destSrc('columns')
}
mute () {
this.muted = true
}
unmute () {
this.muted = false
}
_onpipe (src) {
this._src = src
}
pipe (dest, options) {
this._dest = dest
return super.pipe(dest, options)
}
pause () {
if (this._src) {
return this._src.pause()
}
}
resume () {
if (this._src) {
return this._src.resume()
}
}
write (c) {
if (this.muted) {
if (!this.replace) {
return true
}
// eslint-disable-next-line no-control-regex
if (c.match(/^\u001b/)) {
if (c.indexOf(this._prompt) === 0) {
c = c.slice(this._prompt.length)
c = c.replace(/./g, this.replace)
c = this._prompt + c
}
this._hadControl = true
return this.emit('data', c)
} else {
if (this._prompt && this._hadControl &&
c.indexOf(this._prompt) === 0) {
this._hadControl = false
this.emit('data', this._prompt)
c = c.slice(this._prompt.length)
}
c = c.toString().replace(/./g, this.replace)
}
}
this.emit('data', c)
}
end (c) {
if (this.muted) {
if (c && this.replace) {
c = c.toString().replace(/./g, this.replace)
} else {
c = null
}
}
if (c) {
this.emit('data', c)
}
this.emit('end')
}
destroy (...args) {
return this.#proxy('destroy', ...args)
}
destroySoon (...args) {
return this.#proxy('destroySoon', ...args)
}
close (...args) {
return this.#proxy('close', ...args)
}
}
module.exports = MuteStream

View File

@@ -0,0 +1,52 @@
{
"name": "mute-stream",
"version": "1.0.0",
"main": "lib/index.js",
"devDependencies": {
"@npmcli/eslint-config": "^4.0.0",
"@npmcli/template-oss": "4.11.0",
"tap": "^16.3.0"
},
"scripts": {
"test": "tap",
"lint": "eslint \"**/*.js\"",
"postlint": "template-oss-check",
"template-oss-apply": "template-oss-apply --force",
"lintfix": "npm run lint -- --fix",
"snap": "tap",
"posttest": "npm run lint"
},
"repository": {
"type": "git",
"url": "https://github.com/npm/mute-stream.git"
},
"keywords": [
"mute",
"stream",
"pipe"
],
"author": "GitHub Inc.",
"license": "ISC",
"description": "Bytes go in, but they don't come out (when muted).",
"files": [
"bin/",
"lib/"
],
"tap": {
"statements": 70,
"branches": 60,
"functions": 81,
"lines": 70,
"nyc-arg": [
"--exclude",
"tap-snapshots/**"
]
},
"engines": {
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
},
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "4.11.0"
}
}

52
spa/node_modules/read/package.json generated vendored Normal file
View File

@@ -0,0 +1,52 @@
{
"name": "read",
"version": "2.1.0",
"main": "lib/read.js",
"dependencies": {
"mute-stream": "~1.0.0"
},
"devDependencies": {
"@npmcli/eslint-config": "^4.0.0",
"@npmcli/template-oss": "4.13.0",
"tap": "^16.3.0"
},
"engines": {
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
},
"author": "GitHub Inc.",
"description": "read(1) for node programs",
"repository": {
"type": "git",
"url": "https://github.com/npm/read.git"
},
"license": "ISC",
"scripts": {
"test": "tap",
"lint": "eslint \"**/*.js\"",
"postlint": "template-oss-check",
"template-oss-apply": "template-oss-apply --force",
"lintfix": "npm run lint -- --fix",
"snap": "tap",
"posttest": "npm run lint"
},
"files": [
"bin/",
"lib/"
],
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "4.13.0",
"publish": "true"
},
"tap": {
"statements": 77,
"branches": 75,
"functions": 57,
"lines": 78,
"test-ignore": "fixtures/",
"nyc-arg": [
"--exclude",
"tap-snapshots/**"
]
}
}