WIP - add extractor, generate snippet_data

This commit is contained in:
Stefan Fejes
2019-08-20 15:52:05 +02:00
parent 88084d3d30
commit cc8f1d8a7a
37396 changed files with 4588842 additions and 133 deletions

15
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.

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

@ -0,0 +1,53 @@
## 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")
read(options, callback)
```
The callback gets called with either the user input, or the default
specified, or an error, as `callback(error, result, isDefault)`
node style.
## 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` Writeable stream to write prompts to. (default: `process.stdout`)
If silent is true, and the input is a TTY, then read will set raw
mode, and read character by character.
## COMPATIBILITY
This module works sort of with node 0.6. It does not work with node
versions less than 0.6. It is best on node 0.8.
On node version 0.6, it will remove all listeners on the input
stream's `data` and `keypress` events, because the readline module did
not fully clean up after itself in that version of node, and did not
make it possible to clean up after it in a way that has no potential
for side effects.
Additionally, some of the readline options (like `terminal`) will not
function in versions of node before 0.8, because they were not
implemented in the builtin readline module.
## CONTRIBUTING
Patches welcome.

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

@ -0,0 +1,113 @@
module.exports = read
var readline = require('readline')
var Mute = require('mute-stream')
function read (opts, cb) {
if (opts.num) {
throw new Error('read() no longer accepts a char number limit')
}
if (typeof opts.default !== 'undefined' &&
typeof opts.default !== 'string' &&
typeof opts.default !== 'number') {
throw new Error('default value must be string or number')
}
var input = opts.input || process.stdin
var output = opts.output || process.stdout
var prompt = (opts.prompt || '').trim() + ' '
var silent = opts.silent
var editDef = false
var timeout = opts.timeout
var def = opts.default || ''
if (def) {
if (silent) {
prompt += '(<default hidden>) '
} else if (opts.edit) {
editDef = true
} else {
prompt += '(' + def + ') '
}
}
var terminal = !!(opts.terminal || output.isTTY)
var m = new Mute({ replace: opts.replace, prompt: prompt })
m.pipe(output, {end: false})
output = m
var rlOpts = { input: input, output: output, terminal: terminal }
if (process.version.match(/^v0\.6/)) {
var rl = readline.createInterface(rlOpts.input, rlOpts.output)
} else {
var rl = readline.createInterface(rlOpts)
}
output.unmute()
rl.setPrompt(prompt)
rl.prompt()
if (silent) {
output.mute()
} else if (editDef) {
rl.line = def
rl.cursor = def.length
rl._refreshLine()
}
var called = false
rl.on('line', onLine)
rl.on('error', onError)
rl.on('SIGINT', function () {
rl.close()
onError(new Error('canceled'))
})
var timer
if (timeout) {
timer = setTimeout(function () {
onError(new Error('timed out'))
}, timeout)
}
function done () {
called = true
rl.close()
if (process.version.match(/^v0\.6/)) {
rl.input.removeAllListeners('data')
rl.input.removeAllListeners('keypress')
rl.input.pause()
}
clearTimeout(timer)
output.mute()
output.end()
}
function onError (er) {
if (called) return
done()
return cb(er)
}
function onLine (line) {
if (called) return
if (silent && terminal) {
output.unmute()
output.write('\r\n')
}
done()
// truncate the \n at the end.
line = line.replace(/\r?\n$/, '')
var isDefault = !!(editDef && line === def)
if (def && !line) {
isDefault = true
line = def
}
cb(null, line, isDefault)
}
}

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

@ -0,0 +1,60 @@
{
"_from": "read@^1.0.7",
"_id": "read@1.0.7",
"_inBundle": false,
"_integrity": "sha1-s9oZvQUkMal2cdRKQmNK33ELQMQ=",
"_location": "/read",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "read@^1.0.7",
"name": "read",
"escapedName": "read",
"rawSpec": "^1.0.7",
"saveSpec": null,
"fetchSpec": "^1.0.7"
},
"_requiredBy": [
"/yurnalist"
],
"_resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz",
"_shasum": "b3da19bd052431a97671d44a42634adf710b40c4",
"_spec": "read@^1.0.7",
"_where": "/Users/stefanfejes/Projects/30-seconds-of-python-code/node_modules/yurnalist",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
"url": "http://blog.izs.me/"
},
"bugs": {
"url": "https://github.com/isaacs/read/issues"
},
"bundleDependencies": false,
"dependencies": {
"mute-stream": "~0.0.4"
},
"deprecated": false,
"description": "read(1) for node programs",
"devDependencies": {
"tap": "^1.2.0"
},
"engines": {
"node": ">=0.8"
},
"files": [
"lib/read.js"
],
"homepage": "https://github.com/isaacs/read#readme",
"license": "ISC",
"main": "lib/read.js",
"name": "read",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/read.git"
},
"scripts": {
"test": "tap test/*.js"
},
"version": "1.0.7"
}