init
This commit is contained in:
1
client/node_modules/.bin/JSONStream
generated
vendored
1
client/node_modules/.bin/JSONStream
generated
vendored
@@ -1 +0,0 @@
|
||||
../JSONStream/bin.js
|
||||
1
client/node_modules/.bin/acorn
generated
vendored
1
client/node_modules/.bin/acorn
generated
vendored
@@ -1 +0,0 @@
|
||||
../acorn/bin/acorn
|
||||
1
client/node_modules/.bin/browser-pack
generated
vendored
1
client/node_modules/.bin/browser-pack
generated
vendored
@@ -1 +0,0 @@
|
||||
../browser-pack/bin/cmd.js
|
||||
1
client/node_modules/.bin/browserify
generated
vendored
1
client/node_modules/.bin/browserify
generated
vendored
@@ -1 +0,0 @@
|
||||
../browserify/bin/cmd.js
|
||||
1
client/node_modules/.bin/deps-sort
generated
vendored
1
client/node_modules/.bin/deps-sort
generated
vendored
@@ -1 +0,0 @@
|
||||
../deps-sort/bin/cmd.js
|
||||
1
client/node_modules/.bin/detective
generated
vendored
1
client/node_modules/.bin/detective
generated
vendored
@@ -1 +0,0 @@
|
||||
../detective/bin/detective.js
|
||||
1
client/node_modules/.bin/insert-module-globals
generated
vendored
1
client/node_modules/.bin/insert-module-globals
generated
vendored
@@ -1 +0,0 @@
|
||||
../insert-module-globals/bin/cmd.js
|
||||
1
client/node_modules/.bin/miller-rabin
generated
vendored
1
client/node_modules/.bin/miller-rabin
generated
vendored
@@ -1 +0,0 @@
|
||||
../miller-rabin/bin/miller-rabin
|
||||
1
client/node_modules/.bin/module-deps
generated
vendored
1
client/node_modules/.bin/module-deps
generated
vendored
@@ -1 +0,0 @@
|
||||
../module-deps/bin/cmd.js
|
||||
1
client/node_modules/.bin/semver
generated
vendored
1
client/node_modules/.bin/semver
generated
vendored
@@ -1 +0,0 @@
|
||||
../semver/bin/semver.js
|
||||
1
client/node_modules/.bin/sha.js
generated
vendored
1
client/node_modules/.bin/sha.js
generated
vendored
@@ -1 +0,0 @@
|
||||
../sha.js/bin.js
|
||||
1
client/node_modules/.bin/tsc
generated
vendored
1
client/node_modules/.bin/tsc
generated
vendored
@@ -1 +0,0 @@
|
||||
../typescript/bin/tsc
|
||||
1
client/node_modules/.bin/tsserver
generated
vendored
1
client/node_modules/.bin/tsserver
generated
vendored
@@ -1 +0,0 @@
|
||||
../typescript/bin/tsserver
|
||||
1
client/node_modules/.bin/uglifyjs
generated
vendored
1
client/node_modules/.bin/uglifyjs
generated
vendored
@@ -1 +0,0 @@
|
||||
../uglify-js/bin/uglifyjs
|
||||
1
client/node_modules/.bin/umd
generated
vendored
1
client/node_modules/.bin/umd
generated
vendored
@@ -1 +0,0 @@
|
||||
../umd/bin/cli.js
|
||||
1
client/node_modules/.bin/undeclared-identifiers
generated
vendored
1
client/node_modules/.bin/undeclared-identifiers
generated
vendored
@@ -1 +0,0 @@
|
||||
../undeclared-identifiers/bin.js
|
||||
1757
client/node_modules/.package-lock.json
generated
vendored
1757
client/node_modules/.package-lock.json
generated
vendored
File diff suppressed because it is too large
Load Diff
8
client/node_modules/JSONStream/.travis.yml
generated
vendored
8
client/node_modules/JSONStream/.travis.yml
generated
vendored
@@ -1,8 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 4
|
||||
- 5
|
||||
- 6
|
||||
sudo: false
|
||||
|
||||
|
||||
15
client/node_modules/JSONStream/LICENSE.APACHE2
generated
vendored
15
client/node_modules/JSONStream/LICENSE.APACHE2
generated
vendored
@@ -1,15 +0,0 @@
|
||||
Apache License, Version 2.0
|
||||
|
||||
Copyright (c) 2011 Dominic Tarr
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
24
client/node_modules/JSONStream/LICENSE.MIT
generated
vendored
24
client/node_modules/JSONStream/LICENSE.MIT
generated
vendored
@@ -1,24 +0,0 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2011 Dominic Tarr
|
||||
|
||||
Permission is hereby granted, free of charge,
|
||||
to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify,
|
||||
merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom
|
||||
the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice
|
||||
shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
12
client/node_modules/JSONStream/bin.js
generated
vendored
12
client/node_modules/JSONStream/bin.js
generated
vendored
@@ -1,12 +0,0 @@
|
||||
#! /usr/bin/env node
|
||||
|
||||
var JSONStream = require('./')
|
||||
|
||||
if(!module.parent && process.title !== 'browser') {
|
||||
process.stdin
|
||||
.pipe(JSONStream.parse(process.argv[2]))
|
||||
.pipe(JSONStream.stringify('[', ',\n', ']\n', 2))
|
||||
.pipe(process.stdout)
|
||||
}
|
||||
|
||||
|
||||
13
client/node_modules/JSONStream/examples/all_docs.js
generated
vendored
13
client/node_modules/JSONStream/examples/all_docs.js
generated
vendored
@@ -1,13 +0,0 @@
|
||||
var request = require('request')
|
||||
, JSONStream = require('JSONStream')
|
||||
, es = require('event-stream')
|
||||
|
||||
var parser = JSONStream.parse(['rows', true]) //emit parts that match this path (any element of the rows array)
|
||||
, req = request({url: 'http://isaacs.couchone.com/registry/_all_docs'})
|
||||
, logger = es.mapSync(function (data) { //create a stream that logs to stderr,
|
||||
console.error(data)
|
||||
return data
|
||||
})
|
||||
|
||||
req.pipe(parser)
|
||||
parser.pipe(logger)
|
||||
247
client/node_modules/JSONStream/index.js
generated
vendored
247
client/node_modules/JSONStream/index.js
generated
vendored
@@ -1,247 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
var Parser = require('jsonparse')
|
||||
, through = require('through')
|
||||
|
||||
var bufferFrom = Buffer.from && Buffer.from !== Uint8Array.from
|
||||
|
||||
/*
|
||||
|
||||
the value of this.stack that creationix's jsonparse has is weird.
|
||||
|
||||
it makes this code ugly, but his problem is way harder that mine,
|
||||
so i'll forgive him.
|
||||
|
||||
*/
|
||||
|
||||
exports.parse = function (path, map) {
|
||||
var header, footer
|
||||
var parser = new Parser()
|
||||
var stream = through(function (chunk) {
|
||||
if('string' === typeof chunk)
|
||||
chunk = bufferFrom ? Buffer.from(chunk) : new Buffer(chunk)
|
||||
parser.write(chunk)
|
||||
},
|
||||
function (data) {
|
||||
if(data)
|
||||
stream.write(data)
|
||||
if (header)
|
||||
stream.emit('header', header)
|
||||
if (footer)
|
||||
stream.emit('footer', footer)
|
||||
stream.queue(null)
|
||||
})
|
||||
|
||||
if('string' === typeof path)
|
||||
path = path.split('.').map(function (e) {
|
||||
if (e === '$*')
|
||||
return {emitKey: true}
|
||||
else if (e === '*')
|
||||
return true
|
||||
else if (e === '') // '..'.split('.') returns an empty string
|
||||
return {recurse: true}
|
||||
else
|
||||
return e
|
||||
})
|
||||
|
||||
|
||||
var count = 0, _key
|
||||
if(!path || !path.length)
|
||||
path = null
|
||||
|
||||
parser.onValue = function (value) {
|
||||
if (!this.root)
|
||||
stream.root = value
|
||||
|
||||
if(! path) return
|
||||
|
||||
var i = 0 // iterates on path
|
||||
var j = 0 // iterates on stack
|
||||
var emitKey = false;
|
||||
var emitPath = false;
|
||||
while (i < path.length) {
|
||||
var key = path[i]
|
||||
var c
|
||||
j++
|
||||
|
||||
if (key && !key.recurse) {
|
||||
c = (j === this.stack.length) ? this : this.stack[j]
|
||||
if (!c) return
|
||||
if (! check(key, c.key)) {
|
||||
setHeaderFooter(c.key, value)
|
||||
return
|
||||
}
|
||||
emitKey = !!key.emitKey;
|
||||
emitPath = !!key.emitPath;
|
||||
i++
|
||||
} else {
|
||||
i++
|
||||
var nextKey = path[i]
|
||||
if (! nextKey) return
|
||||
while (true) {
|
||||
c = (j === this.stack.length) ? this : this.stack[j]
|
||||
if (!c) return
|
||||
if (check(nextKey, c.key)) {
|
||||
i++;
|
||||
if (!Object.isFrozen(this.stack[j]))
|
||||
this.stack[j].value = null
|
||||
break
|
||||
} else {
|
||||
setHeaderFooter(c.key, value)
|
||||
}
|
||||
j++
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// emit header
|
||||
if (header) {
|
||||
stream.emit('header', header);
|
||||
header = false;
|
||||
}
|
||||
if (j !== this.stack.length) return
|
||||
|
||||
count ++
|
||||
var actualPath = this.stack.slice(1).map(function(element) { return element.key }).concat([this.key])
|
||||
var data = value
|
||||
if(null != data)
|
||||
if(null != (data = map ? map(data, actualPath) : data)) {
|
||||
if (emitKey || emitPath) {
|
||||
data = { value: data };
|
||||
if (emitKey)
|
||||
data["key"] = this.key;
|
||||
if (emitPath)
|
||||
data["path"] = actualPath;
|
||||
}
|
||||
|
||||
stream.queue(data)
|
||||
}
|
||||
if (this.value) delete this.value[this.key]
|
||||
for(var k in this.stack)
|
||||
if (!Object.isFrozen(this.stack[k]))
|
||||
this.stack[k].value = null
|
||||
}
|
||||
parser._onToken = parser.onToken;
|
||||
|
||||
parser.onToken = function (token, value) {
|
||||
parser._onToken(token, value);
|
||||
if (this.stack.length === 0) {
|
||||
if (stream.root) {
|
||||
if(!path)
|
||||
stream.queue(stream.root)
|
||||
count = 0;
|
||||
stream.root = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
parser.onError = function (err) {
|
||||
if(err.message.indexOf("at position") > -1)
|
||||
err.message = "Invalid JSON (" + err.message + ")";
|
||||
stream.emit('error', err)
|
||||
}
|
||||
|
||||
return stream
|
||||
|
||||
function setHeaderFooter(key, value) {
|
||||
// header has not been emitted yet
|
||||
if (header !== false) {
|
||||
header = header || {}
|
||||
header[key] = value
|
||||
}
|
||||
|
||||
// footer has not been emitted yet but header has
|
||||
if (footer !== false && header === false) {
|
||||
footer = footer || {}
|
||||
footer[key] = value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function check (x, y) {
|
||||
if ('string' === typeof x)
|
||||
return y == x
|
||||
else if (x && 'function' === typeof x.exec)
|
||||
return x.exec(y)
|
||||
else if ('boolean' === typeof x || 'object' === typeof x)
|
||||
return x
|
||||
else if ('function' === typeof x)
|
||||
return x(y)
|
||||
return false
|
||||
}
|
||||
|
||||
exports.stringify = function (op, sep, cl, indent) {
|
||||
indent = indent || 0
|
||||
if (op === false){
|
||||
op = ''
|
||||
sep = '\n'
|
||||
cl = ''
|
||||
} else if (op == null) {
|
||||
|
||||
op = '[\n'
|
||||
sep = '\n,\n'
|
||||
cl = '\n]\n'
|
||||
|
||||
}
|
||||
|
||||
//else, what ever you like
|
||||
|
||||
var stream
|
||||
, first = true
|
||||
, anyData = false
|
||||
stream = through(function (data) {
|
||||
anyData = true
|
||||
try {
|
||||
var json = JSON.stringify(data, null, indent)
|
||||
} catch (err) {
|
||||
return stream.emit('error', err)
|
||||
}
|
||||
if(first) { first = false ; stream.queue(op + json)}
|
||||
else stream.queue(sep + json)
|
||||
},
|
||||
function (data) {
|
||||
if(!anyData)
|
||||
stream.queue(op)
|
||||
stream.queue(cl)
|
||||
stream.queue(null)
|
||||
})
|
||||
|
||||
return stream
|
||||
}
|
||||
|
||||
exports.stringifyObject = function (op, sep, cl, indent) {
|
||||
indent = indent || 0
|
||||
if (op === false){
|
||||
op = ''
|
||||
sep = '\n'
|
||||
cl = ''
|
||||
} else if (op == null) {
|
||||
|
||||
op = '{\n'
|
||||
sep = '\n,\n'
|
||||
cl = '\n}\n'
|
||||
|
||||
}
|
||||
|
||||
//else, what ever you like
|
||||
|
||||
var first = true
|
||||
var anyData = false
|
||||
var stream = through(function (data) {
|
||||
anyData = true
|
||||
var json = JSON.stringify(data[0]) + ':' + JSON.stringify(data[1], null, indent)
|
||||
if(first) { first = false ; this.queue(op + json)}
|
||||
else this.queue(sep + json)
|
||||
},
|
||||
function (data) {
|
||||
if(!anyData) this.queue(op)
|
||||
this.queue(cl)
|
||||
|
||||
this.queue(null)
|
||||
})
|
||||
|
||||
return stream
|
||||
}
|
||||
|
||||
|
||||
40
client/node_modules/JSONStream/package.json
generated
vendored
40
client/node_modules/JSONStream/package.json
generated
vendored
@@ -1,40 +0,0 @@
|
||||
{
|
||||
"name": "JSONStream",
|
||||
"version": "1.3.5",
|
||||
"description": "rawStream.pipe(JSONStream.parse()).pipe(streamOfObjects)",
|
||||
"homepage": "http://github.com/dominictarr/JSONStream",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/dominictarr/JSONStream.git"
|
||||
},
|
||||
"license": "(MIT OR Apache-2.0)",
|
||||
"keywords": [
|
||||
"json",
|
||||
"stream",
|
||||
"streaming",
|
||||
"parser",
|
||||
"async",
|
||||
"parsing"
|
||||
],
|
||||
"dependencies": {
|
||||
"jsonparse": "^1.2.0",
|
||||
"through": ">=2.2.7 <3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"it-is": "~1",
|
||||
"assertions": "~2.2.2",
|
||||
"render": "~0.1.1",
|
||||
"trees": "~0.0.3",
|
||||
"event-stream": "~0.7.0",
|
||||
"tape": "~2.12.3"
|
||||
},
|
||||
"bin": "./bin.js",
|
||||
"author": "Dominic Tarr <dominic.tarr@gmail.com> (http://bit.ly/dominictarr)",
|
||||
"scripts": {
|
||||
"test": "node test/run.js"
|
||||
},
|
||||
"optionalDependencies": {},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
}
|
||||
207
client/node_modules/JSONStream/readme.markdown
generated
vendored
207
client/node_modules/JSONStream/readme.markdown
generated
vendored
@@ -1,207 +0,0 @@
|
||||
# JSONStream
|
||||
|
||||
streaming JSON.parse and stringify
|
||||
|
||||

|
||||
|
||||
## install
|
||||
```npm install JSONStream```
|
||||
|
||||
## example
|
||||
|
||||
``` js
|
||||
|
||||
var request = require('request')
|
||||
, JSONStream = require('JSONStream')
|
||||
, es = require('event-stream')
|
||||
|
||||
request({url: 'http://isaacs.couchone.com/registry/_all_docs'})
|
||||
.pipe(JSONStream.parse('rows.*'))
|
||||
.pipe(es.mapSync(function (data) {
|
||||
console.error(data)
|
||||
return data
|
||||
}))
|
||||
```
|
||||
|
||||
## JSONStream.parse(path)
|
||||
|
||||
parse stream of values that match a path
|
||||
|
||||
``` js
|
||||
JSONStream.parse('rows.*.doc')
|
||||
```
|
||||
|
||||
The `..` operator is the recursive descent operator from [JSONPath](http://goessner.net/articles/JsonPath/), which will match a child at any depth (see examples below).
|
||||
|
||||
If your keys have keys that include `.` or `*` etc, use an array instead.
|
||||
`['row', true, /^doc/]`.
|
||||
|
||||
If you use an array, `RegExp`s, booleans, and/or functions. The `..` operator is also available in array representation, using `{recurse: true}`.
|
||||
any object that matches the path will be emitted as 'data' (and `pipe`d down stream)
|
||||
|
||||
If `path` is empty or null, no 'data' events are emitted.
|
||||
|
||||
If you want to have keys emitted, you can prefix your `*` operator with `$`: `obj.$*` - in this case the data passed to the stream is an object with a `key` holding the key and a `value` property holding the data.
|
||||
|
||||
### Examples
|
||||
|
||||
query a couchdb view:
|
||||
|
||||
``` bash
|
||||
curl -sS localhost:5984/tests/_all_docs&include_docs=true
|
||||
```
|
||||
you will get something like this:
|
||||
|
||||
``` js
|
||||
{"total_rows":129,"offset":0,"rows":[
|
||||
{ "id":"change1_0.6995461115147918"
|
||||
, "key":"change1_0.6995461115147918"
|
||||
, "value":{"rev":"1-e240bae28c7bb3667f02760f6398d508"}
|
||||
, "doc":{
|
||||
"_id": "change1_0.6995461115147918"
|
||||
, "_rev": "1-e240bae28c7bb3667f02760f6398d508","hello":1}
|
||||
},
|
||||
{ "id":"change2_0.6995461115147918"
|
||||
, "key":"change2_0.6995461115147918"
|
||||
, "value":{"rev":"1-13677d36b98c0c075145bb8975105153"}
|
||||
, "doc":{
|
||||
"_id":"change2_0.6995461115147918"
|
||||
, "_rev":"1-13677d36b98c0c075145bb8975105153"
|
||||
, "hello":2
|
||||
}
|
||||
},
|
||||
]}
|
||||
|
||||
```
|
||||
|
||||
we are probably most interested in the `rows.*.doc`
|
||||
|
||||
create a `Stream` that parses the documents from the feed like this:
|
||||
|
||||
``` js
|
||||
var stream = JSONStream.parse(['rows', true, 'doc']) //rows, ANYTHING, doc
|
||||
|
||||
stream.on('data', function(data) {
|
||||
console.log('received:', data);
|
||||
});
|
||||
//emits anything from _before_ the first match
|
||||
stream.on('header', function (data) {
|
||||
console.log('header:', data) // => {"total_rows":129,"offset":0}
|
||||
})
|
||||
|
||||
```
|
||||
awesome!
|
||||
|
||||
In case you wanted the contents the doc emitted:
|
||||
|
||||
``` js
|
||||
var stream = JSONStream.parse(['rows', true, 'doc', {emitKey: true}]) //rows, ANYTHING, doc, items in docs with keys
|
||||
|
||||
stream.on('data', function(data) {
|
||||
console.log('key:', data.key);
|
||||
console.log('value:', data.value);
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
You can also emit the path:
|
||||
|
||||
``` js
|
||||
var stream = JSONStream.parse(['rows', true, 'doc', {emitPath: true}]) //rows, ANYTHING, doc, items in docs with keys
|
||||
|
||||
stream.on('data', function(data) {
|
||||
console.log('path:', data.path);
|
||||
console.log('value:', data.value);
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
### recursive patterns (..)
|
||||
|
||||
`JSONStream.parse('docs..value')`
|
||||
(or `JSONStream.parse(['docs', {recurse: true}, 'value'])` using an array)
|
||||
will emit every `value` object that is a child, grand-child, etc. of the
|
||||
`docs` object. In this example, it will match exactly 5 times at various depth
|
||||
levels, emitting 0, 1, 2, 3 and 4 as results.
|
||||
|
||||
```js
|
||||
{
|
||||
"total": 5,
|
||||
"docs": [
|
||||
{
|
||||
"key": {
|
||||
"value": 0,
|
||||
"some": "property"
|
||||
}
|
||||
},
|
||||
{"value": 1},
|
||||
{"value": 2},
|
||||
{"blbl": [{}, {"a":0, "b":1, "value":3}, 10]},
|
||||
{"value": 4}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## JSONStream.parse(pattern, map)
|
||||
|
||||
provide a function that can be used to map or filter
|
||||
the json output. `map` is passed the value at that node of the pattern,
|
||||
if `map` return non-nullish (anything but `null` or `undefined`)
|
||||
that value will be emitted in the stream. If it returns a nullish value,
|
||||
nothing will be emitted.
|
||||
|
||||
`JSONStream` also emits `'header'` and `'footer'` events,
|
||||
the `'header'` event contains anything in the output that was before
|
||||
the first match, and the `'footer'`, is anything after the last match.
|
||||
|
||||
## JSONStream.stringify(open, sep, close)
|
||||
|
||||
Create a writable stream.
|
||||
|
||||
you may pass in custom `open`, `close`, and `seperator` strings.
|
||||
But, by default, `JSONStream.stringify()` will create an array,
|
||||
(with default options `open='[\n', sep='\n,\n', close='\n]\n'`)
|
||||
|
||||
If you call `JSONStream.stringify(false)`
|
||||
the elements will only be seperated by a newline.
|
||||
|
||||
If you only write one item this will be valid JSON.
|
||||
|
||||
If you write many items,
|
||||
you can use a `RegExp` to split it into valid chunks.
|
||||
|
||||
## JSONStream.stringifyObject(open, sep, close)
|
||||
|
||||
Very much like `JSONStream.stringify`,
|
||||
but creates a writable stream for objects instead of arrays.
|
||||
|
||||
Accordingly, `open='{\n', sep='\n,\n', close='\n}\n'`.
|
||||
|
||||
When you `.write()` to the stream you must supply an array with `[ key, data ]`
|
||||
as the first argument.
|
||||
|
||||
## unix tool
|
||||
|
||||
query npm to see all the modules that browserify has ever depended on.
|
||||
|
||||
``` bash
|
||||
curl https://registry.npmjs.org/browserify | JSONStream 'versions.*.dependencies'
|
||||
```
|
||||
|
||||
## numbers
|
||||
|
||||
numbers will be emitted as numbers.
|
||||
huge numbers that cannot be represented in memory as javascript numbers will be emitted as strings.
|
||||
cf https://github.com/creationix/jsonparse/commit/044b268f01c4b8f97fb936fc85d3bcfba179e5bb for details.
|
||||
|
||||
## Acknowlegements
|
||||
|
||||
this module depends on https://github.com/creationix/jsonparse
|
||||
by Tim Caswell
|
||||
and also thanks to Florent Jaby for teaching me about parsing with:
|
||||
https://github.com/Floby/node-json-streams
|
||||
|
||||
## license
|
||||
|
||||
Dual-licensed under the MIT License or the Apache License, version 2.0
|
||||
|
||||
41
client/node_modules/JSONStream/test/bool.js
generated
vendored
41
client/node_modules/JSONStream/test/bool.js
generated
vendored
@@ -1,41 +0,0 @@
|
||||
|
||||
var fs = require ('fs')
|
||||
, join = require('path').join
|
||||
, file = join(__dirname, 'fixtures','all_npm.json')
|
||||
, JSONStream = require('../')
|
||||
, it = require('it-is').style('colour')
|
||||
|
||||
function randomObj () {
|
||||
return (
|
||||
Math.random () < 0.4
|
||||
? {hello: 'eonuhckmqjk',
|
||||
whatever: 236515,
|
||||
lies: true,
|
||||
nothing: [null],
|
||||
// stuff: [Math.random(),Math.random(),Math.random()]
|
||||
}
|
||||
: ['AOREC', 'reoubaor', {ouec: 62642}, [[[], {}, 53]]]
|
||||
)
|
||||
}
|
||||
|
||||
var expected = []
|
||||
, stringify = JSONStream.stringify()
|
||||
, es = require('event-stream')
|
||||
, stringified = ''
|
||||
, called = 0
|
||||
, count = 10
|
||||
, ended = false
|
||||
|
||||
while (count --)
|
||||
expected.push(randomObj())
|
||||
|
||||
es.connect(
|
||||
es.readArray(expected),
|
||||
stringify,
|
||||
JSONStream.parse([true]),
|
||||
es.writeArray(function (err, lines) {
|
||||
|
||||
it(lines).has(expected)
|
||||
console.error('PASSED')
|
||||
})
|
||||
)
|
||||
18
client/node_modules/JSONStream/test/browser.js
generated
vendored
18
client/node_modules/JSONStream/test/browser.js
generated
vendored
@@ -1,18 +0,0 @@
|
||||
var test = require('tape')
|
||||
var JSONStream = require('../')
|
||||
var testData = '{"rows":[{"hello":"world"}, {"foo": "bar"}]}'
|
||||
|
||||
test('basic parsing', function (t) {
|
||||
t.plan(2)
|
||||
var parsed = JSONStream.parse("rows.*")
|
||||
var parsedKeys = {}
|
||||
parsed.on('data', function(match) {
|
||||
parsedKeys[Object.keys(match)[0]] = true
|
||||
})
|
||||
parsed.on('end', function() {
|
||||
t.equal(!!parsedKeys['hello'], true)
|
||||
t.equal(!!parsedKeys['foo'], true)
|
||||
})
|
||||
parsed.write(testData)
|
||||
parsed.end()
|
||||
})
|
||||
27
client/node_modules/JSONStream/test/destroy_missing.js
generated
vendored
27
client/node_modules/JSONStream/test/destroy_missing.js
generated
vendored
@@ -1,27 +0,0 @@
|
||||
var fs = require ('fs');
|
||||
var net = require('net');
|
||||
var join = require('path').join;
|
||||
var file = join(__dirname, 'fixtures','all_npm.json');
|
||||
var JSONStream = require('../');
|
||||
|
||||
|
||||
var server = net.createServer(function(client) {
|
||||
var parser = JSONStream.parse([]);
|
||||
parser.on('end', function() {
|
||||
console.log('close')
|
||||
console.error('PASSED');
|
||||
server.close();
|
||||
});
|
||||
client.pipe(parser);
|
||||
var n = 4
|
||||
client.on('data', function () {
|
||||
if(--n) return
|
||||
client.end();
|
||||
})
|
||||
});
|
||||
server.listen(9999);
|
||||
|
||||
|
||||
var client = net.connect({ port : 9999 }, function() {
|
||||
fs.createReadStream(file).pipe(client).on('data', console.log) //.resume();
|
||||
});
|
||||
29
client/node_modules/JSONStream/test/doubledot1.js
generated
vendored
29
client/node_modules/JSONStream/test/doubledot1.js
generated
vendored
@@ -1,29 +0,0 @@
|
||||
var fs = require ('fs')
|
||||
, join = require('path').join
|
||||
, file = join(__dirname, 'fixtures','all_npm.json')
|
||||
, JSONStream = require('../')
|
||||
, it = require('it-is')
|
||||
|
||||
var expected = JSON.parse(fs.readFileSync(file))
|
||||
, parser = JSONStream.parse('rows..rev')
|
||||
, called = 0
|
||||
, ended = false
|
||||
, parsed = []
|
||||
|
||||
fs.createReadStream(file).pipe(parser)
|
||||
|
||||
parser.on('data', function (data) {
|
||||
called ++
|
||||
parsed.push(data)
|
||||
})
|
||||
|
||||
parser.on('end', function () {
|
||||
ended = true
|
||||
})
|
||||
|
||||
process.on('exit', function () {
|
||||
it(called).equal(expected.rows.length)
|
||||
for (var i = 0 ; i < expected.rows.length ; i++)
|
||||
it(parsed[i]).deepEqual(expected.rows[i].value.rev)
|
||||
console.error('PASSED')
|
||||
})
|
||||
30
client/node_modules/JSONStream/test/doubledot2.js
generated
vendored
30
client/node_modules/JSONStream/test/doubledot2.js
generated
vendored
@@ -1,30 +0,0 @@
|
||||
var fs = require ('fs')
|
||||
, join = require('path').join
|
||||
, file = join(__dirname, 'fixtures','depth.json')
|
||||
, JSONStream = require('../')
|
||||
, it = require('it-is')
|
||||
|
||||
var expected = JSON.parse(fs.readFileSync(file))
|
||||
, parser = JSONStream.parse(['docs', {recurse: true}, 'value'])
|
||||
, called = 0
|
||||
, ended = false
|
||||
, parsed = []
|
||||
|
||||
fs.createReadStream(file).pipe(parser)
|
||||
|
||||
parser.on('data', function (data) {
|
||||
called ++
|
||||
parsed.push(data)
|
||||
})
|
||||
|
||||
parser.on('end', function () {
|
||||
ended = true
|
||||
})
|
||||
|
||||
process.on('exit', function () {
|
||||
var expectedValues = [0, [1], {"a": 2}, "3", 4]
|
||||
it(called).equal(expectedValues.length)
|
||||
for (var i = 0 ; i < 5 ; i++)
|
||||
it(parsed[i]).deepEqual(expectedValues[i])
|
||||
console.error('PASSED')
|
||||
})
|
||||
44
client/node_modules/JSONStream/test/empty.js
generated
vendored
44
client/node_modules/JSONStream/test/empty.js
generated
vendored
@@ -1,44 +0,0 @@
|
||||
var JSONStream = require('../')
|
||||
, stream = require('stream')
|
||||
, it = require('it-is')
|
||||
|
||||
var output = [ [], [] ]
|
||||
|
||||
var parser1 = JSONStream.parse(['docs', /./])
|
||||
parser1.on('data', function(data) {
|
||||
output[0].push(data)
|
||||
})
|
||||
|
||||
var parser2 = JSONStream.parse(['docs', /./])
|
||||
parser2.on('data', function(data) {
|
||||
output[1].push(data)
|
||||
})
|
||||
|
||||
var pending = 2
|
||||
function onend () {
|
||||
if (--pending > 0) return
|
||||
it(output).deepEqual([
|
||||
[], [{hello: 'world'}]
|
||||
])
|
||||
console.error('PASSED')
|
||||
}
|
||||
parser1.on('end', onend)
|
||||
parser2.on('end', onend)
|
||||
|
||||
function makeReadableStream() {
|
||||
var readStream = new stream.Stream()
|
||||
readStream.readable = true
|
||||
readStream.write = function (data) { this.emit('data', data) }
|
||||
readStream.end = function (data) { this.emit('end') }
|
||||
return readStream
|
||||
}
|
||||
|
||||
var emptyArray = makeReadableStream()
|
||||
emptyArray.pipe(parser1)
|
||||
emptyArray.write('{"docs":[]}')
|
||||
emptyArray.end()
|
||||
|
||||
var objectArray = makeReadableStream()
|
||||
objectArray.pipe(parser2)
|
||||
objectArray.write('{"docs":[{"hello":"world"}]}')
|
||||
objectArray.end()
|
||||
45
client/node_modules/JSONStream/test/error_contents.js
generated
vendored
45
client/node_modules/JSONStream/test/error_contents.js
generated
vendored
@@ -1,45 +0,0 @@
|
||||
|
||||
|
||||
var fs = require ('fs')
|
||||
, join = require('path').join
|
||||
, file = join(__dirname, 'fixtures','error.json')
|
||||
, JSONStream = require('../')
|
||||
, it = require('it-is')
|
||||
|
||||
var expected = JSON.parse(fs.readFileSync(file))
|
||||
, parser = JSONStream.parse(['rows'])
|
||||
, called = 0
|
||||
, headerCalled = 0
|
||||
, footerCalled = 0
|
||||
, ended = false
|
||||
, parsed = []
|
||||
|
||||
fs.createReadStream(file).pipe(parser)
|
||||
|
||||
parser.on('header', function (data) {
|
||||
headerCalled ++
|
||||
it(data).deepEqual({
|
||||
error: 'error_code',
|
||||
message: 'this is an error message'
|
||||
})
|
||||
})
|
||||
|
||||
parser.on('footer', function (data) {
|
||||
footerCalled ++
|
||||
})
|
||||
|
||||
parser.on('data', function (data) {
|
||||
called ++
|
||||
parsed.push(data)
|
||||
})
|
||||
|
||||
parser.on('end', function () {
|
||||
ended = true
|
||||
})
|
||||
|
||||
process.on('exit', function () {
|
||||
it(called).equal(0)
|
||||
it(headerCalled).equal(1)
|
||||
it(footerCalled).equal(0)
|
||||
console.error('PASSED')
|
||||
})
|
||||
4030
client/node_modules/JSONStream/test/fixtures/all_npm.json
generated
vendored
4030
client/node_modules/JSONStream/test/fixtures/all_npm.json
generated
vendored
File diff suppressed because it is too large
Load Diff
18
client/node_modules/JSONStream/test/fixtures/couch_sample.json
generated
vendored
18
client/node_modules/JSONStream/test/fixtures/couch_sample.json
generated
vendored
@@ -1,18 +0,0 @@
|
||||
{"total_rows":129,"offset":0,"rows":[
|
||||
{ "id":"change1_0.6995461115147918"
|
||||
, "key":"change1_0.6995461115147918"
|
||||
, "value":{"rev":"1-e240bae28c7bb3667f02760f6398d508"}
|
||||
, "doc":{
|
||||
"_id": "change1_0.6995461115147918"
|
||||
, "_rev": "1-e240bae28c7bb3667f02760f6398d508","hello":1}
|
||||
},
|
||||
{ "id":"change2_0.6995461115147918"
|
||||
, "key":"change2_0.6995461115147918"
|
||||
, "value":{"rev":"1-13677d36b98c0c075145bb8975105153"}
|
||||
, "doc":{
|
||||
"_id":"change2_0.6995461115147918"
|
||||
, "_rev":"1-13677d36b98c0c075145bb8975105153"
|
||||
, "hello":2
|
||||
}
|
||||
},
|
||||
]}
|
||||
15
client/node_modules/JSONStream/test/fixtures/depth.json
generated
vendored
15
client/node_modules/JSONStream/test/fixtures/depth.json
generated
vendored
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"total": 5,
|
||||
"docs": [
|
||||
{
|
||||
"key": {
|
||||
"value": 0,
|
||||
"some": "property"
|
||||
}
|
||||
},
|
||||
{"value": [1]},
|
||||
{"value": {"a":2}},
|
||||
{"blbl": [{}, {"a":0, "b":1, "value":"3"}, 10]},
|
||||
{"value": 4}
|
||||
]
|
||||
}
|
||||
1
client/node_modules/JSONStream/test/fixtures/error.json
generated
vendored
1
client/node_modules/JSONStream/test/fixtures/error.json
generated
vendored
@@ -1 +0,0 @@
|
||||
{"error": "error_code", "message": "this is an error message"}
|
||||
19
client/node_modules/JSONStream/test/fixtures/header_footer.json
generated
vendored
19
client/node_modules/JSONStream/test/fixtures/header_footer.json
generated
vendored
@@ -1,19 +0,0 @@
|
||||
{"total_rows":129,"offset":0,"rows":[
|
||||
{ "id":"change1_0.6995461115147918"
|
||||
, "key":"change1_0.6995461115147918"
|
||||
, "value":{"rev":"1-e240bae28c7bb3667f02760f6398d508"}
|
||||
, "doc":{
|
||||
"_id": "change1_0.6995461115147918"
|
||||
, "_rev": "1-e240bae28c7bb3667f02760f6398d508","hello":1}
|
||||
},
|
||||
{ "id":"change2_0.6995461115147918"
|
||||
, "key":"change2_0.6995461115147918"
|
||||
, "value":{"rev":"1-13677d36b98c0c075145bb8975105153"}
|
||||
, "doc":{
|
||||
"_id":"change2_0.6995461115147918"
|
||||
, "_rev":"1-13677d36b98c0c075145bb8975105153"
|
||||
, "hello":2
|
||||
}
|
||||
}
|
||||
],
|
||||
"foo": {"bar": "baz"}}
|
||||
39
client/node_modules/JSONStream/test/fn.js
generated
vendored
39
client/node_modules/JSONStream/test/fn.js
generated
vendored
@@ -1,39 +0,0 @@
|
||||
|
||||
|
||||
var fs = require ('fs')
|
||||
, join = require('path').join
|
||||
, file = join(__dirname, 'fixtures','all_npm.json')
|
||||
, JSONStream = require('../')
|
||||
, it = require('it-is')
|
||||
|
||||
function fn (s) {
|
||||
return !isNaN(parseInt(s, 10))
|
||||
}
|
||||
|
||||
var expected = JSON.parse(fs.readFileSync(file))
|
||||
, parser = JSONStream.parse(['rows', fn])
|
||||
, called = 0
|
||||
, ended = false
|
||||
, parsed = []
|
||||
|
||||
fs.createReadStream(file).pipe(parser)
|
||||
|
||||
parser.on('data', function (data) {
|
||||
called ++
|
||||
it.has({
|
||||
id: it.typeof('string'),
|
||||
value: {rev: it.typeof('string')},
|
||||
key:it.typeof('string')
|
||||
})
|
||||
parsed.push(data)
|
||||
})
|
||||
|
||||
parser.on('end', function () {
|
||||
ended = true
|
||||
})
|
||||
|
||||
process.on('exit', function () {
|
||||
it(called).equal(expected.rows.length)
|
||||
it(parsed).deepEqual(expected.rows)
|
||||
console.error('PASSED')
|
||||
})
|
||||
135
client/node_modules/JSONStream/test/gen.js
generated
vendored
135
client/node_modules/JSONStream/test/gen.js
generated
vendored
@@ -1,135 +0,0 @@
|
||||
return // dont run this test for now since tape is weird and broken on 0.10
|
||||
|
||||
var fs = require('fs')
|
||||
var JSONStream = require('../')
|
||||
var file = process.argv[2] || '/tmp/JSONStream-test-large.json'
|
||||
var size = Number(process.argv[3] || 100000)
|
||||
var tape = require('tape')
|
||||
// if (process.title !== 'browser') {
|
||||
tape('out of mem', function (t) {
|
||||
t.plan(1)
|
||||
//////////////////////////////////////////////////////
|
||||
// Produces a random number between arg1 and arg2
|
||||
//////////////////////////////////////////////////////
|
||||
var randomNumber = function (min, max) {
|
||||
var number = Math.floor(Math.random() * (max - min + 1) + min);
|
||||
return number;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Produces a random string of a length between arg1 and arg2
|
||||
//////////////////////////////////////////////////////
|
||||
var randomString = function (min, max) {
|
||||
|
||||
// add several spaces to increase chanses of creating 'words'
|
||||
var chars = ' 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
var result = '';
|
||||
|
||||
var randomLength = randomNumber(min, max);
|
||||
|
||||
for (var i = randomLength; i > 0; --i) {
|
||||
result += chars[Math.round(Math.random() * (chars.length - 1))];
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Produces a random JSON document, as a string
|
||||
//////////////////////////////////////////////////////
|
||||
var randomJsonDoc = function () {
|
||||
|
||||
var doc = {
|
||||
"CrashOccurenceID": randomNumber(10000, 50000),
|
||||
"CrashID": randomNumber(1000, 10000),
|
||||
"SiteName": randomString(10, 25),
|
||||
"MachineName": randomString(10, 25),
|
||||
"Date": randomString(26, 26),
|
||||
"ProcessDuration": randomString(18, 18),
|
||||
"ThreadIdentityName": null,
|
||||
"WindowsIdentityName": randomString(15, 40),
|
||||
"OperatingSystemName": randomString(35, 65),
|
||||
"DetailedExceptionInformation": randomString(100, 800)
|
||||
};
|
||||
|
||||
doc = JSON.stringify(doc);
|
||||
doc = doc.replace(/\,/g, ',\n'); // add new lines after each attribute
|
||||
return doc;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// generates test data
|
||||
//////////////////////////////////////////////////////
|
||||
var generateTestData = function (cb) {
|
||||
|
||||
console.log('generating large data file...');
|
||||
|
||||
var stream = fs.createWriteStream(file, {
|
||||
encoding: 'utf8'
|
||||
});
|
||||
|
||||
var i = 0;
|
||||
var max = size;
|
||||
var writing = false
|
||||
var split = ',\n';
|
||||
var doc = randomJsonDoc();
|
||||
stream.write('[');
|
||||
|
||||
function write () {
|
||||
if(writing) return
|
||||
writing = true
|
||||
while(++i < max) {
|
||||
if(Math.random() < 0.001)
|
||||
console.log('generate..', i + ' / ' + size)
|
||||
if(!stream.write(doc + split)) {
|
||||
writing = false
|
||||
return stream.once('drain', write)
|
||||
}
|
||||
}
|
||||
stream.write(doc + ']')
|
||||
stream.end();
|
||||
console.log('END')
|
||||
}
|
||||
write()
|
||||
stream.on('close', cb)
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Shows that parsing 100000 instances using JSONStream fails
|
||||
//
|
||||
// After several seconds, you will get this crash
|
||||
// FATAL ERROR: JS Allocation failed - process out of memory
|
||||
//////////////////////////////////////////////////////
|
||||
var testJSONStreamParse_causesOutOfMem = function (done) {
|
||||
var items = 0
|
||||
console.log('parsing data files using JSONStream...');
|
||||
|
||||
var parser = JSONStream.parse([true]);
|
||||
var stream = fs.createReadStream(file);
|
||||
stream.pipe(parser);
|
||||
|
||||
parser.on('data', function (data) {
|
||||
items++
|
||||
if(Math.random() < 0.01) console.log(items, '...')
|
||||
});
|
||||
|
||||
parser.on('end', function () {
|
||||
t.equal(items, size)
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// main
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
fs.stat(file, function (err, stat) {
|
||||
console.log(stat)
|
||||
if(err)
|
||||
generateTestData(testJSONStreamParse_causesOutOfMem);
|
||||
else
|
||||
testJSONStreamParse_causesOutOfMem()
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
// }
|
||||
55
client/node_modules/JSONStream/test/header_footer.js
generated
vendored
55
client/node_modules/JSONStream/test/header_footer.js
generated
vendored
@@ -1,55 +0,0 @@
|
||||
|
||||
|
||||
var fs = require ('fs')
|
||||
, join = require('path').join
|
||||
, file = join(__dirname, 'fixtures','header_footer.json')
|
||||
, JSONStream = require('../')
|
||||
, it = require('it-is')
|
||||
|
||||
var expected = JSON.parse(fs.readFileSync(file))
|
||||
, parser = JSONStream.parse(['rows', /\d+/ /*, 'value'*/])
|
||||
, called = 0
|
||||
, headerCalled = 0
|
||||
, footerCalled = 0
|
||||
, ended = false
|
||||
, parsed = []
|
||||
|
||||
fs.createReadStream(file).pipe(parser)
|
||||
|
||||
parser.on('header', function (data) {
|
||||
headerCalled ++
|
||||
it(data).deepEqual({
|
||||
total_rows: 129,
|
||||
offset: 0
|
||||
})
|
||||
})
|
||||
|
||||
parser.on('footer', function (data) {
|
||||
footerCalled ++
|
||||
it(data).deepEqual({
|
||||
foo: { bar: 'baz' }
|
||||
})
|
||||
})
|
||||
|
||||
parser.on('data', function (data) {
|
||||
called ++
|
||||
it.has({
|
||||
id: it.typeof('string'),
|
||||
value: {rev: it.typeof('string')},
|
||||
key:it.typeof('string')
|
||||
})
|
||||
it(headerCalled).equal(1)
|
||||
parsed.push(data)
|
||||
})
|
||||
|
||||
parser.on('end', function () {
|
||||
ended = true
|
||||
})
|
||||
|
||||
process.on('exit', function () {
|
||||
it(called).equal(expected.rows.length)
|
||||
it(headerCalled).equal(1)
|
||||
it(footerCalled).equal(1)
|
||||
it(parsed).deepEqual(expected.rows)
|
||||
console.error('PASSED')
|
||||
})
|
||||
34
client/node_modules/JSONStream/test/issues.js
generated
vendored
34
client/node_modules/JSONStream/test/issues.js
generated
vendored
@@ -1,34 +0,0 @@
|
||||
var JSONStream = require('../');
|
||||
var test = require('tape')
|
||||
|
||||
test('#66', function (t) {
|
||||
var error = 0;
|
||||
var stream = JSONStream
|
||||
.parse()
|
||||
.on('error', function (err) {
|
||||
t.ok(err);
|
||||
error++;
|
||||
})
|
||||
.on('end', function () {
|
||||
t.ok(error === 1);
|
||||
t.end();
|
||||
});
|
||||
|
||||
stream.write('["foo":bar[');
|
||||
stream.end();
|
||||
|
||||
});
|
||||
|
||||
test('#81 - failure to parse nested objects', function (t) {
|
||||
var stream = JSONStream
|
||||
.parse('.bar.foo')
|
||||
.on('error', function (err) {
|
||||
t.error(err);
|
||||
})
|
||||
.on('end', function () {
|
||||
t.end();
|
||||
});
|
||||
|
||||
stream.write('{"bar":{"foo":"baz"}}');
|
||||
stream.end();
|
||||
});
|
||||
105
client/node_modules/JSONStream/test/keys.js
generated
vendored
105
client/node_modules/JSONStream/test/keys.js
generated
vendored
@@ -1,105 +0,0 @@
|
||||
var test = require('tape');
|
||||
var fs = require ('fs');
|
||||
var join = require('path').join;
|
||||
var couch_sample_file = join(__dirname, 'fixtures','couch_sample.json');
|
||||
var JSONStream = require('../');
|
||||
|
||||
var fixture = {
|
||||
obj: {
|
||||
one: 1,
|
||||
two: 2,
|
||||
three: 3
|
||||
}
|
||||
};
|
||||
|
||||
function assertFixtureKeys(stream, t) {
|
||||
var keys = [];
|
||||
var values = [];
|
||||
stream.on('data', function(data) {
|
||||
keys.push(data.key);
|
||||
values.push(data.value);
|
||||
});
|
||||
|
||||
stream.on('end', function() {
|
||||
t.deepEqual(keys, ['one', 'two', 'three']);
|
||||
t.deepEqual(values, [1,2,3]);
|
||||
t.end();
|
||||
});
|
||||
stream.write(JSON.stringify(fixture));
|
||||
stream.end();
|
||||
}
|
||||
|
||||
test('keys via string', function(t) {
|
||||
var stream = JSONStream.parse('obj.$*');
|
||||
assertFixtureKeys(stream, t);
|
||||
});
|
||||
|
||||
test('keys via array', function(t) {
|
||||
var stream = JSONStream.parse(['obj',{emitKey: true}]);
|
||||
assertFixtureKeys(stream, t);
|
||||
});
|
||||
|
||||
test('path via array', function(t) {
|
||||
var stream = JSONStream.parse(['obj',{emitPath: true}]);
|
||||
|
||||
var paths = [];
|
||||
var values = [];
|
||||
stream.on('data', function(data) {
|
||||
console.log(JSON.stringify(data));
|
||||
paths.push(data.path);
|
||||
values.push(data.value);
|
||||
});
|
||||
|
||||
stream.on('end', function() {
|
||||
t.deepEqual(paths, [['obj', 'one'], ['obj', 'two'], ['obj', 'three']]);
|
||||
t.deepEqual(values, [1,2,3]);
|
||||
t.end();
|
||||
});
|
||||
stream.write(JSON.stringify(fixture));
|
||||
stream.end();
|
||||
});
|
||||
|
||||
test('advanced keys', function(t) {
|
||||
var advanced = fs.readFileSync(couch_sample_file);
|
||||
var stream = JSONStream.parse(['rows', true, 'doc', {emitKey: true}]);
|
||||
|
||||
var keys = [];
|
||||
var values = [];
|
||||
stream.on('data', function(data) {
|
||||
keys.push(data.key);
|
||||
values.push(data.value);
|
||||
});
|
||||
|
||||
stream.on('end', function() {
|
||||
t.deepEqual(keys, [
|
||||
'_id', '_rev', 'hello',
|
||||
'_id', '_rev', 'hello'
|
||||
]);
|
||||
t.deepEqual(values, [
|
||||
"change1_0.6995461115147918", "1-e240bae28c7bb3667f02760f6398d508", 1,
|
||||
"change2_0.6995461115147918", "1-13677d36b98c0c075145bb8975105153", 2
|
||||
]);
|
||||
t.end();
|
||||
});
|
||||
stream.write(advanced);
|
||||
stream.end();
|
||||
});
|
||||
|
||||
test('parent keys', function(t) {
|
||||
var stream = JSONStream.parse('$*');
|
||||
var d = null;
|
||||
stream.on('data', function(data) {
|
||||
if(d) t.fail('should only be called once');
|
||||
d = data;
|
||||
});
|
||||
|
||||
stream.on('end', function() {
|
||||
t.deepEqual(d,{
|
||||
key: 'obj',
|
||||
value: fixture.obj
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
stream.write(JSON.stringify(fixture));
|
||||
stream.end();
|
||||
})
|
||||
40
client/node_modules/JSONStream/test/map.js
generated
vendored
40
client/node_modules/JSONStream/test/map.js
generated
vendored
@@ -1,40 +0,0 @@
|
||||
|
||||
var test = require('tape')
|
||||
|
||||
var JSONStream = require('../')
|
||||
|
||||
test('map function', function (t) {
|
||||
|
||||
var actual = []
|
||||
|
||||
stream = JSONStream.parse([true], function (e) { return e*10 })
|
||||
stream.on('data', function (v) { actual.push(v)})
|
||||
stream.on('end', function () {
|
||||
t.deepEqual(actual, [10,20,30,40,50,60])
|
||||
t.end()
|
||||
|
||||
})
|
||||
|
||||
stream.write(JSON.stringify([1,2,3,4,5,6], null, 2))
|
||||
stream.end()
|
||||
|
||||
})
|
||||
|
||||
test('filter function', function (t) {
|
||||
|
||||
var actual = []
|
||||
|
||||
stream = JSONStream
|
||||
.parse([true], function (e) { return e%2 ? e : null})
|
||||
.on('data', function (v) { actual.push(v)})
|
||||
.on('end', function () {
|
||||
t.deepEqual(actual, [1,3,5])
|
||||
t.end()
|
||||
|
||||
})
|
||||
|
||||
stream.write(JSON.stringify([1,2,3,4,5,6], null, 2))
|
||||
stream.end()
|
||||
|
||||
})
|
||||
|
||||
36
client/node_modules/JSONStream/test/multiple_objects.js
generated
vendored
36
client/node_modules/JSONStream/test/multiple_objects.js
generated
vendored
@@ -1,36 +0,0 @@
|
||||
var fs = require ('fs');
|
||||
var net = require('net');
|
||||
var join = require('path').join;
|
||||
var file = join(__dirname, 'fixtures','all_npm.json');
|
||||
var it = require('it-is');
|
||||
var JSONStream = require('../');
|
||||
|
||||
var str = fs.readFileSync(file);
|
||||
|
||||
var datas = {}
|
||||
|
||||
var server = net.createServer(function(client) {
|
||||
var data_calls = 0;
|
||||
var parser = JSONStream.parse(['rows', true, 'key']);
|
||||
parser.on('data', function(data) {
|
||||
++ data_calls;
|
||||
datas[data] = (datas[data] || 0) + 1
|
||||
it(data).typeof('string')
|
||||
});
|
||||
|
||||
parser.on('end', function() {
|
||||
console.log('END')
|
||||
var min = Infinity
|
||||
for (var d in datas)
|
||||
min = min > datas[d] ? datas[d] : min
|
||||
it(min).equal(3);
|
||||
server.close();
|
||||
});
|
||||
client.pipe(parser);
|
||||
});
|
||||
server.listen(9999);
|
||||
|
||||
var client = net.connect({ port : 9999 }, function() {
|
||||
var msgs = str + ' ' + str + '\n\n' + str
|
||||
client.end(msgs);
|
||||
});
|
||||
29
client/node_modules/JSONStream/test/multiple_objects_error.js
generated
vendored
29
client/node_modules/JSONStream/test/multiple_objects_error.js
generated
vendored
@@ -1,29 +0,0 @@
|
||||
var fs = require ('fs');
|
||||
var net = require('net');
|
||||
var join = require('path').join;
|
||||
var file = join(__dirname, 'fixtures','all_npm.json');
|
||||
var it = require('it-is');
|
||||
var JSONStream = require('../');
|
||||
|
||||
var str = fs.readFileSync(file);
|
||||
|
||||
var server = net.createServer(function(client) {
|
||||
var data_calls = 0;
|
||||
var parser = JSONStream.parse();
|
||||
parser.on('error', function(err) {
|
||||
console.log(err);
|
||||
server.close();
|
||||
});
|
||||
|
||||
parser.on('end', function() {
|
||||
console.log('END');
|
||||
server.close();
|
||||
});
|
||||
client.pipe(parser);
|
||||
});
|
||||
server.listen(9999);
|
||||
|
||||
var client = net.connect({ port : 9999 }, function() {
|
||||
var msgs = str + '}';
|
||||
client.end(msgs);
|
||||
});
|
||||
28
client/node_modules/JSONStream/test/null.js
generated
vendored
28
client/node_modules/JSONStream/test/null.js
generated
vendored
@@ -1,28 +0,0 @@
|
||||
var JSONStream = require('../')
|
||||
|
||||
var data = [
|
||||
{ID: 1, optional: null},
|
||||
{ID: 2, optional: null},
|
||||
{ID: 3, optional: 20},
|
||||
{ID: 4, optional: null},
|
||||
{ID: 5, optional: 'hello'},
|
||||
{ID: 6, optional: null}
|
||||
]
|
||||
|
||||
|
||||
var test = require('tape')
|
||||
|
||||
test ('null properties', function (t) {
|
||||
var actual = []
|
||||
var stream =
|
||||
|
||||
JSONStream.parse('*.optional')
|
||||
.on('data', function (v) { actual.push(v) })
|
||||
.on('end', function () {
|
||||
t.deepEqual(actual, [20, 'hello'])
|
||||
t.end()
|
||||
})
|
||||
|
||||
stream.write(JSON.stringify(data, null, 2))
|
||||
stream.end()
|
||||
})
|
||||
29
client/node_modules/JSONStream/test/parsejson.js
generated
vendored
29
client/node_modules/JSONStream/test/parsejson.js
generated
vendored
@@ -1,29 +0,0 @@
|
||||
|
||||
|
||||
/*
|
||||
sometimes jsonparse changes numbers slightly.
|
||||
*/
|
||||
|
||||
var r = Math.random()
|
||||
, Parser = require('jsonparse')
|
||||
, p = new Parser()
|
||||
, assert = require('assert')
|
||||
, times = 20
|
||||
, bufferFrom = Buffer.from && Buffer.from !== Uint8Array.from
|
||||
, str
|
||||
|
||||
while (times --) {
|
||||
|
||||
assert.equal(JSON.parse(JSON.stringify(r)), r, 'core JSON')
|
||||
|
||||
p.onValue = function (v) {
|
||||
console.error('parsed', v)
|
||||
assert.equal(v,r)
|
||||
}
|
||||
console.error('correct', r)
|
||||
str = JSON.stringify([r])
|
||||
p.write (bufferFrom ? Buffer.from(str) : new Buffer(str))
|
||||
|
||||
|
||||
|
||||
}
|
||||
13
client/node_modules/JSONStream/test/run.js
generated
vendored
13
client/node_modules/JSONStream/test/run.js
generated
vendored
@@ -1,13 +0,0 @@
|
||||
var readdirSync = require('fs').readdirSync
|
||||
var spawnSync = require('child_process').spawnSync
|
||||
var extname = require('path').extname
|
||||
|
||||
var files = readdirSync(__dirname)
|
||||
files.forEach(function(file){
|
||||
if (extname(file) !== '.js' || file === 'run.js')
|
||||
return
|
||||
console.log(`*** ${file} ***`)
|
||||
var result = spawnSync(process.argv0, [file], { stdio: 'inherit', cwd: __dirname} )
|
||||
if (result.status !== 0)
|
||||
process.exit(result.status)
|
||||
})
|
||||
41
client/node_modules/JSONStream/test/stringify.js
generated
vendored
41
client/node_modules/JSONStream/test/stringify.js
generated
vendored
@@ -1,41 +0,0 @@
|
||||
|
||||
var fs = require ('fs')
|
||||
, join = require('path').join
|
||||
, file = join(__dirname, 'fixtures','all_npm.json')
|
||||
, JSONStream = require('../')
|
||||
, it = require('it-is').style('colour')
|
||||
|
||||
function randomObj () {
|
||||
return (
|
||||
Math.random () < 0.4
|
||||
? {hello: 'eonuhckmqjk',
|
||||
whatever: 236515,
|
||||
lies: true,
|
||||
nothing: [null],
|
||||
stuff: [Math.random(),Math.random(),Math.random()]
|
||||
}
|
||||
: ['AOREC', 'reoubaor', {ouec: 62642}, [[[], {}, 53]]]
|
||||
)
|
||||
}
|
||||
|
||||
var expected = []
|
||||
, stringify = JSONStream.stringify()
|
||||
, es = require('event-stream')
|
||||
, stringified = ''
|
||||
, called = 0
|
||||
, count = 10
|
||||
, ended = false
|
||||
|
||||
while (count --)
|
||||
expected.push(randomObj())
|
||||
|
||||
es.connect(
|
||||
es.readArray(expected),
|
||||
stringify,
|
||||
//JSONStream.parse([/./]),
|
||||
es.writeArray(function (err, lines) {
|
||||
|
||||
it(JSON.parse(lines.join(''))).deepEqual(expected)
|
||||
console.error('PASSED')
|
||||
})
|
||||
)
|
||||
47
client/node_modules/JSONStream/test/stringify_object.js
generated
vendored
47
client/node_modules/JSONStream/test/stringify_object.js
generated
vendored
@@ -1,47 +0,0 @@
|
||||
|
||||
var fs = require ('fs')
|
||||
, join = require('path').join
|
||||
, file = join(__dirname, 'fixtures','all_npm.json')
|
||||
, JSONStream = require('../')
|
||||
, it = require('it-is').style('colour')
|
||||
, es = require('event-stream')
|
||||
, pending = 10
|
||||
, passed = true
|
||||
|
||||
function randomObj () {
|
||||
return (
|
||||
Math.random () < 0.4
|
||||
? {hello: 'eonuhckmqjk',
|
||||
whatever: 236515,
|
||||
lies: true,
|
||||
nothing: [null],
|
||||
stuff: [Math.random(),Math.random(),Math.random()]
|
||||
}
|
||||
: ['AOREC', 'reoubaor', {ouec: 62642}, [[[], {}, 53]]]
|
||||
)
|
||||
}
|
||||
|
||||
for (var ix = 0; ix < pending; ix++) (function (count) {
|
||||
var expected = {}
|
||||
, stringify = JSONStream.stringifyObject()
|
||||
|
||||
es.connect(
|
||||
stringify,
|
||||
es.writeArray(function (err, lines) {
|
||||
it(JSON.parse(lines.join(''))).deepEqual(expected)
|
||||
if (--pending === 0) {
|
||||
console.error('PASSED')
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
while (count --) {
|
||||
var key = Math.random().toString(16).slice(2)
|
||||
expected[key] = randomObj()
|
||||
stringify.write([ key, expected[key] ])
|
||||
}
|
||||
|
||||
process.nextTick(function () {
|
||||
stringify.end()
|
||||
})
|
||||
})(ix)
|
||||
35
client/node_modules/JSONStream/test/test.js
generated
vendored
35
client/node_modules/JSONStream/test/test.js
generated
vendored
@@ -1,35 +0,0 @@
|
||||
|
||||
|
||||
var fs = require ('fs')
|
||||
, join = require('path').join
|
||||
, file = join(__dirname, 'fixtures','all_npm.json')
|
||||
, JSONStream = require('../')
|
||||
, it = require('it-is')
|
||||
|
||||
var expected = JSON.parse(fs.readFileSync(file))
|
||||
, parser = JSONStream.parse(['rows', /\d+/ /*, 'value'*/])
|
||||
, called = 0
|
||||
, ended = false
|
||||
, parsed = []
|
||||
|
||||
fs.createReadStream(file).pipe(parser)
|
||||
|
||||
parser.on('data', function (data) {
|
||||
called ++
|
||||
it.has({
|
||||
id: it.typeof('string'),
|
||||
value: {rev: it.typeof('string')},
|
||||
key:it.typeof('string')
|
||||
})
|
||||
parsed.push(data)
|
||||
})
|
||||
|
||||
parser.on('end', function () {
|
||||
ended = true
|
||||
})
|
||||
|
||||
process.on('exit', function () {
|
||||
it(called).equal(expected.rows.length)
|
||||
it(parsed).deepEqual(expected.rows)
|
||||
console.error('PASSED')
|
||||
})
|
||||
29
client/node_modules/JSONStream/test/test2.js
generated
vendored
29
client/node_modules/JSONStream/test/test2.js
generated
vendored
@@ -1,29 +0,0 @@
|
||||
|
||||
|
||||
var fs = require ('fs')
|
||||
, join = require('path').join
|
||||
, file = join(__dirname, '..','package.json')
|
||||
, JSONStream = require('../')
|
||||
, it = require('it-is')
|
||||
|
||||
var expected = JSON.parse(fs.readFileSync(file))
|
||||
, parser = JSONStream.parse([])
|
||||
, called = 0
|
||||
, ended = false
|
||||
, parsed = []
|
||||
|
||||
fs.createReadStream(file).pipe(parser)
|
||||
|
||||
parser.on('data', function (data) {
|
||||
called ++
|
||||
it(data).deepEqual(expected)
|
||||
})
|
||||
|
||||
parser.on('end', function () {
|
||||
ended = true
|
||||
})
|
||||
|
||||
process.on('exit', function () {
|
||||
it(called).equal(1)
|
||||
console.error('PASSED')
|
||||
})
|
||||
41
client/node_modules/JSONStream/test/two-ways.js
generated
vendored
41
client/node_modules/JSONStream/test/two-ways.js
generated
vendored
@@ -1,41 +0,0 @@
|
||||
|
||||
var fs = require ('fs')
|
||||
, join = require('path').join
|
||||
, file = join(__dirname, 'fixtures','all_npm.json')
|
||||
, JSONStream = require('../')
|
||||
, it = require('it-is').style('colour')
|
||||
|
||||
function randomObj () {
|
||||
return (
|
||||
Math.random () < 0.4
|
||||
? {hello: 'eonuhckmqjk',
|
||||
whatever: 236515,
|
||||
lies: true,
|
||||
nothing: [null],
|
||||
// stuff: [Math.random(),Math.random(),Math.random()]
|
||||
}
|
||||
: ['AOREC', 'reoubaor', {ouec: 62642}, [[[], {}, 53]]]
|
||||
)
|
||||
}
|
||||
|
||||
var expected = []
|
||||
, stringify = JSONStream.stringify()
|
||||
, es = require('event-stream')
|
||||
, stringified = ''
|
||||
, called = 0
|
||||
, count = 10
|
||||
, ended = false
|
||||
|
||||
while (count --)
|
||||
expected.push(randomObj())
|
||||
|
||||
es.connect(
|
||||
es.readArray(expected),
|
||||
stringify,
|
||||
JSONStream.parse([/./]),
|
||||
es.writeArray(function (err, lines) {
|
||||
|
||||
it(lines).has(expected)
|
||||
console.error('PASSED')
|
||||
})
|
||||
)
|
||||
22
client/node_modules/acorn-node/.travis.yml
generated
vendored
22
client/node_modules/acorn-node/.travis.yml
generated
vendored
@@ -1,22 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- '12'
|
||||
- '11'
|
||||
- '10'
|
||||
- '9'
|
||||
- '8'
|
||||
- '6'
|
||||
- '4'
|
||||
- '0.12'
|
||||
- '0.10'
|
||||
- '0.8'
|
||||
- '0.6'
|
||||
before_install:
|
||||
- 'nvm install-latest-npm'
|
||||
install:
|
||||
- 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ] || [ "${TRAVIS_NODE_VERSION}" = "0.9" ]; then nvm install --latest-npm 0.8 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;'
|
||||
sudo: false
|
||||
matrix:
|
||||
fast_finish: true
|
||||
allow_failures:
|
||||
- node_js: "0.6"
|
||||
94
client/node_modules/acorn-node/CHANGELOG.md
generated
vendored
94
client/node_modules/acorn-node/CHANGELOG.md
generated
vendored
@@ -1,94 +0,0 @@
|
||||
# acorn-node change log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## 1.8.2
|
||||
* Revert a breaking change in import.meta parsing.
|
||||
|
||||
## 1.8.1
|
||||
* Fix crash in compiled private-class-elements code.
|
||||
|
||||
## 1.8.0
|
||||
* Upgrade acorn to v7.
|
||||
|
||||
For backwards compatibility, `acorn-node` still uses the `Import` node type for dynamic imports, _NOT_ `ImportExpression` like acorn v7 and estree.
|
||||
* Add numeric separator support:
|
||||
```js
|
||||
var a = 10_000_000_000_000_000_000_000_000n;
|
||||
```
|
||||
|
||||
## 1.7.0
|
||||
* Add class instance fields support:
|
||||
```js
|
||||
class X {
|
||||
pub = 1;
|
||||
#priv = 2;
|
||||
}
|
||||
```
|
||||
* Add class static fields support:
|
||||
```js
|
||||
class X {
|
||||
static pub = 1;
|
||||
static #priv = 2;
|
||||
}
|
||||
```
|
||||
* Add `export * as ns` support when `sourceType` is 'module':
|
||||
```js
|
||||
export * as ns from './ns.mjs';
|
||||
```
|
||||
|
||||
## 1.6.2
|
||||
|
||||
* Allow dynamic `import()` in scripts.
|
||||
* Update minimum dependency versions, fixing a peerDependency warning.
|
||||
* Add Node 10 and 11 to CI.
|
||||
|
||||
## 1.6.1
|
||||
|
||||
* Update acorn-dynamic-import to v4.
|
||||
|
||||
## 1.6.0
|
||||
|
||||
* Upgrade acorn to v6.
|
||||
* Add bigint support.
|
||||
|
||||
## 1.5.2
|
||||
|
||||
* Upgrade acorn to support optional catch binding in the AST walker.
|
||||
|
||||
## 1.5.1
|
||||
|
||||
* Fix tests on Node <= 0.12.
|
||||
|
||||
## 1.5.0
|
||||
|
||||
* Add tests for async iteration, optional catch binding, import.meta,
|
||||
dynamic import, bigint (currently unsupported).
|
||||
* Add import.meta support. (`sourceType: 'module'` only)
|
||||
* Add dynamic import support. (`sourceType: 'module'` only)
|
||||
* Fix optional catch binding support in the walker.
|
||||
|
||||
## 1.4.0
|
||||
|
||||
* Upgrade acorn to 5.6, which supports optional catch bindings and other
|
||||
new syntax features.
|
||||
* Set ecmaVersion to 2019 to opt in to optional catch bindings etc.
|
||||
|
||||
## 1.3.0
|
||||
|
||||
* Upgrade acorn to 5.4, which supports object spread and async iteration.
|
||||
* Remove acorn5-object-spread plugin.
|
||||
|
||||
## 1.2.0
|
||||
|
||||
* Expose `acorn/dist/walk` as `acorn-node/walk`.
|
||||
|
||||
## 1.1.0
|
||||
|
||||
* Enable `allowHashBang` and `allowReturnOutsideFunction` by default.
|
||||
|
||||
## 1.0.0
|
||||
|
||||
* Initial release.
|
||||
95
client/node_modules/acorn-node/LICENSE.md
generated
vendored
95
client/node_modules/acorn-node/LICENSE.md
generated
vendored
@@ -1,95 +0,0 @@
|
||||
# [Apache License 2.0](https://spdx.org/licenses/Apache-2.0)
|
||||
|
||||
Copyright 2018 Renée Kooi <renee@kooi.me>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
> http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
## acorn-bigint
|
||||
|
||||
The code in the `lib/bigint` folder is compiled from code licensed as MIT:
|
||||
|
||||
> Copyright (C) 2017-2018 by Adrian Heine
|
||||
>
|
||||
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
> of this software and associated documentation files (the "Software"), to deal
|
||||
> in the Software without restriction, including without limitation the rights
|
||||
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
> copies of the Software, and to permit persons to whom the Software is
|
||||
> furnished to do so, subject to the following conditions:
|
||||
>
|
||||
> The above copyright notice and this permission notice shall be included in
|
||||
> all copies or substantial portions of the Software.
|
||||
>
|
||||
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
> THE SOFTWARE.
|
||||
|
||||
Find the source code at https://github.com/acornjs/acorn-bigint.
|
||||
|
||||
## acorn-import-meta
|
||||
|
||||
The code in the `lib/import-meta` folder is compiled from code licensed as MIT:
|
||||
|
||||
> Copyright (C) 2017-2018 by Adrian Heine
|
||||
>
|
||||
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
> of this software and associated documentation files (the "Software"), to deal
|
||||
> in the Software without restriction, including without limitation the rights
|
||||
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
> copies of the Software, and to permit persons to whom the Software is
|
||||
> furnished to do so, subject to the following conditions:
|
||||
>
|
||||
> The above copyright notice and this permission notice shall be included in
|
||||
> all copies or substantial portions of the Software.
|
||||
>
|
||||
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
> THE SOFTWARE.
|
||||
|
||||
Find the source code at https://github.com/acornjs/acorn-import-meta.
|
||||
|
||||
## acorn-dynamic-import
|
||||
|
||||
The code in the `lib/dynamic-import` folder is licensed as MIT:
|
||||
|
||||
> MIT License
|
||||
>
|
||||
> Copyright (c) 2016 Jordan Gensler
|
||||
>
|
||||
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
> of this software and associated documentation files (the "Software"), to deal
|
||||
> in the Software without restriction, including without limitation the rights
|
||||
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
> copies of the Software, and to permit persons to whom the Software is
|
||||
> furnished to do so, subject to the following conditions:
|
||||
>
|
||||
> The above copyright notice and this permission notice shall be included in all
|
||||
> copies or substantial portions of the Software.
|
||||
>
|
||||
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
> SOFTWARE.
|
||||
|
||||
Find the source code at https://github.com/kesne/acorn-dynamic-import.
|
||||
65
client/node_modules/acorn-node/README.md
generated
vendored
65
client/node_modules/acorn-node/README.md
generated
vendored
@@ -1,65 +0,0 @@
|
||||
# acorn-node
|
||||
|
||||
[Acorn](https://github.com/acornjs/acorn) preloaded with plugins for syntax parity with recent Node versions.
|
||||
|
||||
It also includes versions of the plugins compiled with [Bublé](https://github.com/rich-harris/buble), so they can be run on old Node versions (0.6 and up).
|
||||
|
||||
[![npm][npm-image]][npm-url]
|
||||
[![travis][travis-image]][travis-url]
|
||||
[![standard][standard-image]][standard-url]
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/acorn-node.svg?style=flat-square
|
||||
[npm-url]: https://www.npmjs.com/package/acorn-node
|
||||
[travis-image]: https://img.shields.io/travis/browserify/acorn-node/master.svg?style=flat-square
|
||||
[travis-url]: https://travis-ci.org/browserify/acorn-node
|
||||
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
|
||||
[standard-url]: http://npm.im/standard
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
npm install acorn-node
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var acorn = require('acorn-node')
|
||||
```
|
||||
|
||||
The API is the same as [acorn](https://github.com/acornjs/acorn), but the following syntax features are enabled by default:
|
||||
|
||||
- Bigint syntax `10n`
|
||||
- Numeric separators syntax `10_000`
|
||||
- Public and private class instance fields
|
||||
- Public and private class static fields
|
||||
- Dynamic `import()`
|
||||
- The `import.meta` property
|
||||
- `export * as ns from` syntax
|
||||
|
||||
And the following options have different defaults from acorn, to match Node modules:
|
||||
|
||||
- `ecmaVersion: 2019`
|
||||
- `allowHashBang: true`
|
||||
- `allowReturnOutsideFunction: true`
|
||||
|
||||
```js
|
||||
var walk = require('acorn-node/walk')
|
||||
```
|
||||
|
||||
The Acorn syntax tree walker. Comes preconfigured for the syntax plugins if necessary.
|
||||
See the [acorn documentation](https://github.com/acornjs/acorn#distwalkjs) for details.
|
||||
|
||||
## License
|
||||
|
||||
The files in the repo root and the ./test folder are licensed as [Apache-2.0](LICENSE.md).
|
||||
|
||||
The files in lib/ are generated from other packages:
|
||||
|
||||
- lib/bigint: [acorn-bigint](https://github.com/acornjs/acorn-bigint]), MIT
|
||||
- lib/class-private-elements: [acorn-class-private-elements](https://github.com/acornjs/acorn-class-private-elements), MIT
|
||||
- lib/dynamic-import: [acorn-dynamic-import](https://github.com/acornjs/acorn-dynamic-import), MIT
|
||||
- lib/export-ns-from: [acorn-export-ns-from](https://github.com/acornjs/acorn-export-ns-from), MIT
|
||||
- lib/import-meta: [acorn-import-meta](https://github.com/acornjs/acorn-import-meta), MIT
|
||||
- lib/numeric-separator: [acorn-numeric-separator](https://github.com/acornjs/acorn-numeric-separator]), MIT
|
||||
- lib/static-class-features: [acorn-static-class-features](https://github.com/acornjs/acorn-static-class-features), MIT
|
||||
36
client/node_modules/acorn-node/build.js
generated
vendored
36
client/node_modules/acorn-node/build.js
generated
vendored
@@ -1,36 +0,0 @@
|
||||
var fs = require('fs')
|
||||
var path = require('path')
|
||||
var mkdirp = require('mkdirp')
|
||||
var buble = require('buble')
|
||||
|
||||
var HEADER = '/* Generated by `npm run build`, do not edit! */\n\n'
|
||||
|
||||
function compile (name, output, fix) {
|
||||
console.log(name, '→', output)
|
||||
mkdirp.sync(path.dirname(path.join(__dirname, output)))
|
||||
var source = fs.readFileSync(require.resolve(name), 'utf8')
|
||||
if (fix) source = fix(source)
|
||||
var result = buble.transform(source, {
|
||||
transforms: {
|
||||
dangerousForOf: true
|
||||
}
|
||||
})
|
||||
fs.writeFileSync(path.join(__dirname, output), HEADER + result.code, 'utf8')
|
||||
}
|
||||
|
||||
function privateClassElements (str) {
|
||||
return str.replace('acorn-private-class-elements', '../private-class-elements')
|
||||
}
|
||||
|
||||
compile('acorn-bigint', './lib/bigint/index.js')
|
||||
compile('acorn-numeric-separator', './lib/numeric-separator/index.js')
|
||||
compile('acorn-dynamic-import', './lib/dynamic-import/index.js')
|
||||
compile('acorn-import-meta', './lib/import-meta/index.js')
|
||||
compile('acorn-export-ns-from', './lib/export-ns-from/index.js')
|
||||
compile('acorn-class-fields', './lib/class-fields/index.js', privateClassElements)
|
||||
compile('acorn-static-class-features', './lib/static-class-features/index.js', privateClassElements)
|
||||
compile('acorn-private-class-elements', './lib/private-class-elements/index.js', function (str) {
|
||||
return str.replace('class extends Parser', 'class Parser_ extends Parser')
|
||||
// it also works with v7
|
||||
.replace('if (acorn.version.indexOf("6.") != 0 || acorn.version.indexOf("6.0.") == 0) {', 'if (false) {')
|
||||
})
|
||||
38
client/node_modules/acorn-node/index.js
generated
vendored
38
client/node_modules/acorn-node/index.js
generated
vendored
@@ -1,38 +0,0 @@
|
||||
var acorn = require('acorn')
|
||||
var xtend = require('xtend')
|
||||
|
||||
var CJSParser = acorn.Parser
|
||||
.extend(require('./lib/bigint'))
|
||||
.extend(require('./lib/class-fields'))
|
||||
.extend(require('./lib/static-class-features'))
|
||||
.extend(require('./lib/numeric-separator'))
|
||||
.extend(require('./lib/dynamic-import').default)
|
||||
var ESModulesParser = CJSParser
|
||||
.extend(require('./lib/export-ns-from'))
|
||||
.extend(require('./lib/import-meta'))
|
||||
|
||||
function mapOptions (opts) {
|
||||
if (!opts) opts = {}
|
||||
return xtend({
|
||||
ecmaVersion: 2020,
|
||||
allowHashBang: true,
|
||||
allowReturnOutsideFunction: true
|
||||
}, opts)
|
||||
}
|
||||
|
||||
function getParser (opts) {
|
||||
if (!opts) opts = {}
|
||||
return opts.sourceType === 'module' ? ESModulesParser : CJSParser
|
||||
}
|
||||
|
||||
module.exports = exports = xtend(acorn, {
|
||||
parse: function parse (src, opts) {
|
||||
return getParser(opts).parse(src, mapOptions(opts))
|
||||
},
|
||||
parseExpressionAt: function parseExpressionAt (src, offset, opts) {
|
||||
return getParser(opts).parseExpressionAt(src, offset, mapOptions(opts))
|
||||
},
|
||||
tokenizer: function tokenizer (src, opts) {
|
||||
return getParser(opts).tokenizer(src, mapOptions(opts))
|
||||
}
|
||||
})
|
||||
71
client/node_modules/acorn-node/lib/bigint/index.js
generated
vendored
71
client/node_modules/acorn-node/lib/bigint/index.js
generated
vendored
@@ -1,71 +0,0 @@
|
||||
/* Generated by `npm run build`, do not edit! */
|
||||
|
||||
"use strict"
|
||||
|
||||
var acorn = require("acorn")
|
||||
var tt = acorn.tokTypes
|
||||
var isIdentifierStart = acorn.isIdentifierStart
|
||||
|
||||
module.exports = function(Parser) {
|
||||
return /*@__PURE__*/(function (Parser) {
|
||||
function anonymous () {
|
||||
Parser.apply(this, arguments);
|
||||
}
|
||||
|
||||
if ( Parser ) anonymous.__proto__ = Parser;
|
||||
anonymous.prototype = Object.create( Parser && Parser.prototype );
|
||||
anonymous.prototype.constructor = anonymous;
|
||||
|
||||
anonymous.prototype.parseLiteral = function parseLiteral (value) {
|
||||
var node = Parser.prototype.parseLiteral.call(this, value)
|
||||
if (node.raw.charCodeAt(node.raw.length - 1) == 110) { node.bigint = this.getNumberInput(node.start, node.end) }
|
||||
return node
|
||||
};
|
||||
|
||||
anonymous.prototype.readRadixNumber = function readRadixNumber (radix) {
|
||||
var start = this.pos
|
||||
this.pos += 2 // 0x
|
||||
var val = this.readInt(radix)
|
||||
if (val === null) { this.raise(this.start + 2, ("Expected number in radix " + radix)) }
|
||||
if (this.input.charCodeAt(this.pos) == 110) {
|
||||
var str = this.getNumberInput(start, this.pos)
|
||||
val = typeof BigInt !== "undefined" ? BigInt(str) : null
|
||||
++this.pos
|
||||
} else if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number") }
|
||||
return this.finishToken(tt.num, val)
|
||||
};
|
||||
|
||||
anonymous.prototype.readNumber = function readNumber (startsWithDot) {
|
||||
var start = this.pos
|
||||
|
||||
// Not an int
|
||||
if (startsWithDot) { return Parser.prototype.readNumber.call(this, startsWithDot) }
|
||||
|
||||
// Legacy octal
|
||||
if (this.input.charCodeAt(start) === 48 && this.input.charCodeAt(start + 1) !== 110) {
|
||||
return Parser.prototype.readNumber.call(this, startsWithDot)
|
||||
}
|
||||
|
||||
if (this.readInt(10) === null) { this.raise(start, "Invalid number") }
|
||||
|
||||
// Not a BigInt, reset and parse again
|
||||
if (this.input.charCodeAt(this.pos) != 110) {
|
||||
this.pos = start
|
||||
return Parser.prototype.readNumber.call(this, startsWithDot)
|
||||
}
|
||||
|
||||
var str = this.getNumberInput(start, this.pos)
|
||||
var val = typeof BigInt !== "undefined" ? BigInt(str) : null
|
||||
++this.pos
|
||||
return this.finishToken(tt.num, val)
|
||||
};
|
||||
|
||||
// This is basically a hook for acorn-numeric-separator
|
||||
anonymous.prototype.getNumberInput = function getNumberInput (start, end) {
|
||||
if (Parser.prototype.getNumberInput) { return Parser.prototype.getNumberInput.call(this, start, end) }
|
||||
return this.input.slice(start, end)
|
||||
};
|
||||
|
||||
return anonymous;
|
||||
}(Parser))
|
||||
}
|
||||
70
client/node_modules/acorn-node/lib/class-fields/index.js
generated
vendored
70
client/node_modules/acorn-node/lib/class-fields/index.js
generated
vendored
@@ -1,70 +0,0 @@
|
||||
/* Generated by `npm run build`, do not edit! */
|
||||
|
||||
"use strict"
|
||||
|
||||
var acorn = require("acorn")
|
||||
var tt = acorn.tokTypes
|
||||
var privateClassElements = require("../private-class-elements")
|
||||
|
||||
function maybeParseFieldValue(field) {
|
||||
if (this.eat(tt.eq)) {
|
||||
var oldInFieldValue = this._inFieldValue
|
||||
this._inFieldValue = true
|
||||
field.value = this.parseExpression()
|
||||
this._inFieldValue = oldInFieldValue
|
||||
} else { field.value = null }
|
||||
}
|
||||
|
||||
module.exports = function(Parser) {
|
||||
Parser = privateClassElements(Parser)
|
||||
return /*@__PURE__*/(function (Parser) {
|
||||
function anonymous () {
|
||||
Parser.apply(this, arguments);
|
||||
}
|
||||
|
||||
if ( Parser ) anonymous.__proto__ = Parser;
|
||||
anonymous.prototype = Object.create( Parser && Parser.prototype );
|
||||
anonymous.prototype.constructor = anonymous;
|
||||
|
||||
anonymous.prototype.parseClassElement = function parseClassElement (_constructorAllowsSuper) {
|
||||
if (this.options.ecmaVersion >= 8 && (this.type == tt.name || this.type == this.privateNameToken || this.type == tt.bracketL || this.type == tt.string)) {
|
||||
var branch = this._branch()
|
||||
if (branch.type == tt.bracketL) {
|
||||
var count = 0
|
||||
do {
|
||||
if (branch.eat(tt.bracketL)) { ++count }
|
||||
else if (branch.eat(tt.bracketR)) { --count }
|
||||
else { branch.next() }
|
||||
} while (count > 0)
|
||||
} else { branch.next() }
|
||||
if (branch.type == tt.eq || branch.canInsertSemicolon() || branch.type == tt.semi) {
|
||||
var node = this.startNode()
|
||||
if (this.type == this.privateNameToken) {
|
||||
this.parsePrivateClassElementName(node)
|
||||
} else {
|
||||
this.parsePropertyName(node)
|
||||
}
|
||||
if ((node.key.type === "Identifier" && node.key.name === "constructor") ||
|
||||
(node.key.type === "Literal" && node.key.value === "constructor")) {
|
||||
this.raise(node.key.start, "Classes may not have a field called constructor")
|
||||
}
|
||||
maybeParseFieldValue.call(this, node)
|
||||
this.finishNode(node, "FieldDefinition")
|
||||
this.semicolon()
|
||||
return node
|
||||
}
|
||||
}
|
||||
|
||||
return Parser.prototype.parseClassElement.apply(this, arguments)
|
||||
};
|
||||
|
||||
// Prohibit arguments in class field initializers
|
||||
anonymous.prototype.parseIdent = function parseIdent (liberal, isBinding) {
|
||||
var ident = Parser.prototype.parseIdent.call(this, liberal, isBinding)
|
||||
if (this._inFieldValue && ident.name == "arguments") { this.raise(ident.start, "A class field initializer may not contain arguments") }
|
||||
return ident
|
||||
};
|
||||
|
||||
return anonymous;
|
||||
}(Parser))
|
||||
}
|
||||
86
client/node_modules/acorn-node/lib/dynamic-import/index.js
generated
vendored
86
client/node_modules/acorn-node/lib/dynamic-import/index.js
generated
vendored
@@ -1,86 +0,0 @@
|
||||
/* Generated by `npm run build`, do not edit! */
|
||||
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.DynamicImportKey = undefined;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) { descriptor.writable = true; } Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) { defineProperties(Constructor.prototype, protoProps); } if (staticProps) { defineProperties(Constructor, staticProps); } return Constructor; }; }();
|
||||
|
||||
var _get = function () {
|
||||
function get(object, property, receiver) { if (object === null) { object = Function.prototype; } var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }
|
||||
|
||||
return get;
|
||||
}();
|
||||
|
||||
exports['default'] = dynamicImport;
|
||||
|
||||
var _acorn = require('acorn');
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) { Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } } /* eslint-disable no-underscore-dangle */
|
||||
|
||||
|
||||
var DynamicImportKey = exports.DynamicImportKey = 'Import';
|
||||
|
||||
// NOTE: This allows `yield import()` to parse correctly.
|
||||
_acorn.tokTypes._import.startsExpr = true;
|
||||
|
||||
function parseDynamicImport() {
|
||||
var node = this.startNode();
|
||||
this.next();
|
||||
if (this.type !== _acorn.tokTypes.parenL) {
|
||||
this.unexpected();
|
||||
}
|
||||
return this.finishNode(node, DynamicImportKey);
|
||||
}
|
||||
|
||||
function parenAfter() {
|
||||
return (/^(\s|\/\/.*|\/\*[^]*?\*\/)*\(/.test(this.input.slice(this.pos))
|
||||
);
|
||||
}
|
||||
|
||||
function dynamicImport(Parser) {
|
||||
return function (_Parser) {
|
||||
_inherits(_class, _Parser);
|
||||
|
||||
function _class() {
|
||||
_classCallCheck(this, _class);
|
||||
|
||||
return _possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).apply(this, arguments));
|
||||
}
|
||||
|
||||
_createClass(_class, [{
|
||||
key: 'parseStatement',
|
||||
value: function () {
|
||||
function parseStatement(context, topLevel, exports) {
|
||||
if (this.type === _acorn.tokTypes._import && parenAfter.call(this)) {
|
||||
return this.parseExpressionStatement(this.startNode(), this.parseExpression());
|
||||
}
|
||||
return _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'parseStatement', this).call(this, context, topLevel, exports);
|
||||
}
|
||||
|
||||
return parseStatement;
|
||||
}()
|
||||
}, {
|
||||
key: 'parseExprAtom',
|
||||
value: function () {
|
||||
function parseExprAtom(refDestructuringErrors) {
|
||||
if (this.type === _acorn.tokTypes._import) {
|
||||
return parseDynamicImport.call(this);
|
||||
}
|
||||
return _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'parseExprAtom', this).call(this, refDestructuringErrors);
|
||||
}
|
||||
|
||||
return parseExprAtom;
|
||||
}()
|
||||
}]);
|
||||
|
||||
return _class;
|
||||
}(Parser);
|
||||
}
|
||||
43
client/node_modules/acorn-node/lib/export-ns-from/index.js
generated
vendored
43
client/node_modules/acorn-node/lib/export-ns-from/index.js
generated
vendored
@@ -1,43 +0,0 @@
|
||||
/* Generated by `npm run build`, do not edit! */
|
||||
|
||||
"use strict"
|
||||
|
||||
var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g
|
||||
|
||||
var tt = require("acorn").tokTypes
|
||||
|
||||
module.exports = function(Parser) {
|
||||
return /*@__PURE__*/(function (Parser) {
|
||||
function anonymous () {
|
||||
Parser.apply(this, arguments);
|
||||
}
|
||||
|
||||
if ( Parser ) anonymous.__proto__ = Parser;
|
||||
anonymous.prototype = Object.create( Parser && Parser.prototype );
|
||||
anonymous.prototype.constructor = anonymous;
|
||||
|
||||
anonymous.prototype.parseExport = function parseExport (node, exports) {
|
||||
skipWhiteSpace.lastIndex = this.pos
|
||||
var skip = skipWhiteSpace.exec(this.input)
|
||||
var next = this.input.charAt(this.pos + skip[0].length)
|
||||
if (next !== "*") { return Parser.prototype.parseExport.call(this, node, exports) }
|
||||
|
||||
this.next()
|
||||
var specifier = this.startNode()
|
||||
this.expect(tt.star)
|
||||
if (this.eatContextual("as")) {
|
||||
node.declaration = null
|
||||
specifier.exported = this.parseIdent(true)
|
||||
this.checkExport(exports, specifier.exported.name, this.lastTokStart)
|
||||
node.specifiers = [this.finishNode(specifier, "ExportNamespaceSpecifier")]
|
||||
}
|
||||
this.expectContextual("from")
|
||||
if (this.type !== tt.string) { this.unexpected() }
|
||||
node.source = this.parseExprAtom()
|
||||
this.semicolon()
|
||||
return this.finishNode(node, node.specifiers ? "ExportNamedDeclaration" : "ExportAllDeclaration")
|
||||
};
|
||||
|
||||
return anonymous;
|
||||
}(Parser))
|
||||
}
|
||||
55
client/node_modules/acorn-node/lib/import-meta/index.js
generated
vendored
55
client/node_modules/acorn-node/lib/import-meta/index.js
generated
vendored
@@ -1,55 +0,0 @@
|
||||
/* Generated by `npm run build`, do not edit! */
|
||||
|
||||
"use strict"
|
||||
|
||||
var tt = require("acorn").tokTypes
|
||||
|
||||
var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g
|
||||
|
||||
var nextTokenIsDot = function (parser) {
|
||||
skipWhiteSpace.lastIndex = parser.pos
|
||||
var skip = skipWhiteSpace.exec(parser.input)
|
||||
var next = parser.pos + skip[0].length
|
||||
return parser.input.slice(next, next + 1) === "."
|
||||
}
|
||||
|
||||
module.exports = function(Parser) {
|
||||
return /*@__PURE__*/(function (Parser) {
|
||||
function anonymous () {
|
||||
Parser.apply(this, arguments);
|
||||
}
|
||||
|
||||
if ( Parser ) anonymous.__proto__ = Parser;
|
||||
anonymous.prototype = Object.create( Parser && Parser.prototype );
|
||||
anonymous.prototype.constructor = anonymous;
|
||||
|
||||
anonymous.prototype.parseExprAtom = function parseExprAtom (refDestructuringErrors) {
|
||||
if (this.type !== tt._import || !nextTokenIsDot(this)) { return Parser.prototype.parseExprAtom.call(this, refDestructuringErrors) }
|
||||
|
||||
if (!this.options.allowImportExportEverywhere && !this.inModule) {
|
||||
this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'")
|
||||
}
|
||||
|
||||
var node = this.startNode()
|
||||
node.meta = this.parseIdent(true)
|
||||
this.expect(tt.dot)
|
||||
node.property = this.parseIdent(true)
|
||||
if (node.property.name !== "meta") {
|
||||
this.raiseRecoverable(node.property.start, "The only valid meta property for import is import.meta")
|
||||
}
|
||||
return this.finishNode(node, "MetaProperty")
|
||||
};
|
||||
|
||||
anonymous.prototype.parseStatement = function parseStatement (context, topLevel, exports) {
|
||||
if (this.type !== tt._import || !nextTokenIsDot(this)) {
|
||||
return Parser.prototype.parseStatement.call(this, context, topLevel, exports)
|
||||
}
|
||||
|
||||
var node = this.startNode()
|
||||
var expr = this.parseExpression()
|
||||
return this.parseExpressionStatement(node, expr)
|
||||
};
|
||||
|
||||
return anonymous;
|
||||
}(Parser))
|
||||
}
|
||||
61
client/node_modules/acorn-node/lib/numeric-separator/index.js
generated
vendored
61
client/node_modules/acorn-node/lib/numeric-separator/index.js
generated
vendored
@@ -1,61 +0,0 @@
|
||||
/* Generated by `npm run build`, do not edit! */
|
||||
|
||||
"use strict"
|
||||
|
||||
module.exports = function(Parser) {
|
||||
return /*@__PURE__*/(function (Parser) {
|
||||
function anonymous () {
|
||||
Parser.apply(this, arguments);
|
||||
}
|
||||
|
||||
if ( Parser ) anonymous.__proto__ = Parser;
|
||||
anonymous.prototype = Object.create( Parser && Parser.prototype );
|
||||
anonymous.prototype.constructor = anonymous;
|
||||
|
||||
anonymous.prototype.readInt = function readInt (radix, len) {
|
||||
// Hack: len is only != null for unicode escape sequences,
|
||||
// where numeric separators are not allowed
|
||||
if (len != null) { return Parser.prototype.readInt.call(this, radix, len) }
|
||||
|
||||
var start = this.pos, total = 0, acceptUnderscore = false
|
||||
for (;;) {
|
||||
var code = this.input.charCodeAt(this.pos), val = (void 0)
|
||||
if (code >= 97) { val = code - 97 + 10 } // a
|
||||
else if (code == 95) {
|
||||
if (!acceptUnderscore) { this.raise(this.pos, "Invalid numeric separator") }
|
||||
++this.pos
|
||||
acceptUnderscore = false
|
||||
continue
|
||||
} else if (code >= 65) { val = code - 65 + 10 } // A
|
||||
else if (code >= 48 && code <= 57) { val = code - 48 } // 0-9
|
||||
else { val = Infinity }
|
||||
if (val >= radix) { break }
|
||||
++this.pos
|
||||
total = total * radix + val
|
||||
acceptUnderscore = true
|
||||
}
|
||||
if (this.pos === start) { return null }
|
||||
if (!acceptUnderscore) { this.raise(this.pos - 1, "Invalid numeric separator") }
|
||||
|
||||
return total
|
||||
};
|
||||
|
||||
anonymous.prototype.readNumber = function readNumber (startsWithDot) {
|
||||
var token = Parser.prototype.readNumber.call(this, startsWithDot)
|
||||
var octal = this.end - this.start >= 2 && this.input.charCodeAt(this.start) === 48
|
||||
var stripped = this.getNumberInput(this.start, this.end)
|
||||
if (stripped.length < this.end - this.start) {
|
||||
if (octal) { this.raise(this.start, "Invalid number") }
|
||||
this.value = parseFloat(stripped)
|
||||
}
|
||||
return token
|
||||
};
|
||||
|
||||
// This is used by acorn-bigint
|
||||
anonymous.prototype.getNumberInput = function getNumberInput (start, end) {
|
||||
return this.input.slice(start, end).replace(/_/g, "")
|
||||
};
|
||||
|
||||
return anonymous;
|
||||
}(Parser))
|
||||
}
|
||||
135
client/node_modules/acorn-node/lib/private-class-elements/index.js
generated
vendored
135
client/node_modules/acorn-node/lib/private-class-elements/index.js
generated
vendored
@@ -1,135 +0,0 @@
|
||||
/* Generated by `npm run build`, do not edit! */
|
||||
|
||||
"use strict"
|
||||
|
||||
var acorn = require("acorn")
|
||||
if (false) {
|
||||
throw new Error(("acorn-private-class-elements requires acorn@^6.1.0, not " + (acorn.version)))
|
||||
}
|
||||
var tt = acorn.tokTypes
|
||||
var TokenType = acorn.TokenType
|
||||
|
||||
module.exports = function(Parser) {
|
||||
// Only load this plugin once.
|
||||
if (Parser.prototype.parsePrivateName) {
|
||||
return Parser
|
||||
}
|
||||
|
||||
// Make sure `Parser` comes from the same acorn as our `tt`,
|
||||
// otherwise the comparisons fail.
|
||||
var cur = Parser
|
||||
while (cur && cur !== acorn.Parser) {
|
||||
cur = cur.__proto__
|
||||
}
|
||||
if (cur !== acorn.Parser) {
|
||||
throw new Error("acorn-private-class-elements does not support mixing different acorn copies")
|
||||
}
|
||||
|
||||
Parser = /*@__PURE__*/(function (Parser) {
|
||||
function Parser_ () {
|
||||
Parser.apply(this, arguments);
|
||||
}
|
||||
|
||||
if ( Parser ) Parser_.__proto__ = Parser;
|
||||
Parser_.prototype = Object.create( Parser && Parser.prototype );
|
||||
Parser_.prototype.constructor = Parser_;
|
||||
|
||||
Parser_.prototype._branch = function _branch () {
|
||||
this.__branch = this.__branch || new Parser({ecmaVersion: this.options.ecmaVersion}, this.input)
|
||||
this.__branch.end = this.end
|
||||
this.__branch.pos = this.pos
|
||||
this.__branch.type = this.type
|
||||
this.__branch.value = this.value
|
||||
this.__branch.containsEsc = this.containsEsc
|
||||
return this.__branch
|
||||
};
|
||||
|
||||
Parser_.prototype.parsePrivateClassElementName = function parsePrivateClassElementName (element) {
|
||||
element.computed = false
|
||||
element.key = this.parsePrivateName()
|
||||
if (element.key.name == "constructor") { this.raise(element.key.start, "Classes may not have a private element named constructor") }
|
||||
var accept = {get: "set", set: "get"}[element.kind]
|
||||
var privateBoundNames = this._privateBoundNamesStack[this._privateBoundNamesStack.length - 1]
|
||||
if (Object.prototype.hasOwnProperty.call(privateBoundNames, element.key.name) && privateBoundNames[element.key.name] !== accept) {
|
||||
this.raise(element.start, "Duplicate private element")
|
||||
}
|
||||
privateBoundNames[element.key.name] = element.kind || true
|
||||
delete this._unresolvedPrivateNamesStack[this._unresolvedPrivateNamesStack.length - 1][element.key.name]
|
||||
return element.key
|
||||
};
|
||||
|
||||
Parser_.prototype.parsePrivateName = function parsePrivateName () {
|
||||
var node = this.startNode()
|
||||
node.name = this.value
|
||||
this.next()
|
||||
this.finishNode(node, "PrivateName")
|
||||
if (this.options.allowReserved == "never") { this.checkUnreserved(node) }
|
||||
return node
|
||||
};
|
||||
|
||||
// Parse # token
|
||||
Parser_.prototype.getTokenFromCode = function getTokenFromCode (code) {
|
||||
if (code === 35) {
|
||||
++this.pos
|
||||
var word = this.readWord1()
|
||||
return this.finishToken(this.privateNameToken, word)
|
||||
}
|
||||
return Parser.prototype.getTokenFromCode.call(this, code)
|
||||
};
|
||||
|
||||
// Manage stacks and check for undeclared private names
|
||||
Parser_.prototype.parseClass = function parseClass (node, isStatement) {
|
||||
this._privateBoundNamesStack = this._privateBoundNamesStack || []
|
||||
var privateBoundNames = Object.create(this._privateBoundNamesStack[this._privateBoundNamesStack.length - 1] || null)
|
||||
this._privateBoundNamesStack.push(privateBoundNames)
|
||||
this._unresolvedPrivateNamesStack = this._unresolvedPrivateNamesStack || []
|
||||
var unresolvedPrivateNames = Object.create(null)
|
||||
this._unresolvedPrivateNamesStack.push(unresolvedPrivateNames)
|
||||
var _return = Parser.prototype.parseClass.call(this, node, isStatement)
|
||||
this._privateBoundNamesStack.pop()
|
||||
this._unresolvedPrivateNamesStack.pop()
|
||||
if (!this._unresolvedPrivateNamesStack.length) {
|
||||
var names = Object.keys(unresolvedPrivateNames)
|
||||
if (names.length) {
|
||||
names.sort(function (n1, n2) { return unresolvedPrivateNames[n1] - unresolvedPrivateNames[n2]; })
|
||||
this.raise(unresolvedPrivateNames[names[0]], "Usage of undeclared private name")
|
||||
}
|
||||
} else { Object.assign(this._unresolvedPrivateNamesStack[this._unresolvedPrivateNamesStack.length - 1], unresolvedPrivateNames) }
|
||||
return _return
|
||||
};
|
||||
|
||||
// Parse private element access
|
||||
Parser_.prototype.parseSubscript = function parseSubscript (base, startPos, startLoc, noCalls, maybeAsyncArrow) {
|
||||
if (!this.eat(tt.dot)) {
|
||||
return Parser.prototype.parseSubscript.call(this, base, startPos, startLoc, noCalls, maybeAsyncArrow)
|
||||
}
|
||||
var node = this.startNodeAt(startPos, startLoc)
|
||||
node.object = base
|
||||
node.computed = false
|
||||
if (this.type == this.privateNameToken) {
|
||||
node.property = this.parsePrivateName()
|
||||
if (!this._privateBoundNamesStack.length || !this._privateBoundNamesStack[this._privateBoundNamesStack.length - 1][node.property.name]) {
|
||||
this._unresolvedPrivateNamesStack[this._unresolvedPrivateNamesStack.length - 1][node.property.name] = node.property.start
|
||||
}
|
||||
} else {
|
||||
node.property = this.parseIdent(true)
|
||||
}
|
||||
return this.finishNode(node, "MemberExpression")
|
||||
};
|
||||
|
||||
// Prohibit delete of private class elements
|
||||
Parser_.prototype.parseMaybeUnary = function parseMaybeUnary (refDestructuringErrors, sawUnary) {
|
||||
var _return = Parser.prototype.parseMaybeUnary.call(this, refDestructuringErrors, sawUnary)
|
||||
if (_return.operator == "delete") {
|
||||
if (_return.argument.type == "MemberExpression" && _return.argument.property.type == "PrivateName") {
|
||||
this.raise(_return.start, "Private elements may not be deleted")
|
||||
}
|
||||
}
|
||||
return _return
|
||||
};
|
||||
|
||||
return Parser_;
|
||||
}(Parser))
|
||||
Parser.prototype.privateNameToken = new TokenType("privateName")
|
||||
return Parser
|
||||
}
|
||||
139
client/node_modules/acorn-node/lib/static-class-features/index.js
generated
vendored
139
client/node_modules/acorn-node/lib/static-class-features/index.js
generated
vendored
@@ -1,139 +0,0 @@
|
||||
/* Generated by `npm run build`, do not edit! */
|
||||
|
||||
"use strict"
|
||||
|
||||
var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g
|
||||
|
||||
var acorn = require("acorn")
|
||||
var tt = acorn.tokTypes
|
||||
|
||||
function maybeParseFieldValue(field) {
|
||||
if (this.eat(tt.eq)) {
|
||||
var oldInFieldValue = this._inStaticFieldValue
|
||||
this._inStaticFieldValue = true
|
||||
field.value = this.parseExpression()
|
||||
this._inStaticFieldValue = oldInFieldValue
|
||||
} else { field.value = null }
|
||||
}
|
||||
|
||||
var privateClassElements = require("../private-class-elements")
|
||||
|
||||
module.exports = function(Parser) {
|
||||
var ExtendedParser = privateClassElements(Parser)
|
||||
|
||||
return /*@__PURE__*/(function (ExtendedParser) {
|
||||
function anonymous () {
|
||||
ExtendedParser.apply(this, arguments);
|
||||
}
|
||||
|
||||
if ( ExtendedParser ) anonymous.__proto__ = ExtendedParser;
|
||||
anonymous.prototype = Object.create( ExtendedParser && ExtendedParser.prototype );
|
||||
anonymous.prototype.constructor = anonymous;
|
||||
|
||||
anonymous.prototype.parseClassElement = function parseClassElement (_constructorAllowsSuper) {
|
||||
var this$1 = this;
|
||||
|
||||
if (this.eat(tt.semi)) { return null }
|
||||
|
||||
var node = this.startNode()
|
||||
|
||||
var tryContextual = function (k, noLineBreak) {
|
||||
if (typeof noLineBreak == "undefined") { noLineBreak = false }
|
||||
var start = this$1.start, startLoc = this$1.startLoc
|
||||
if (!this$1.eatContextual(k)) { return false }
|
||||
if (this$1.type !== tt.parenL && (!noLineBreak || !this$1.canInsertSemicolon())) { return true }
|
||||
if (node.key) { this$1.unexpected() }
|
||||
node.computed = false
|
||||
node.key = this$1.startNodeAt(start, startLoc)
|
||||
node.key.name = k
|
||||
this$1.finishNode(node.key, "Identifier")
|
||||
return false
|
||||
}
|
||||
|
||||
node.static = tryContextual("static")
|
||||
if (!node.static) { return ExtendedParser.prototype.parseClassElement.apply(this, arguments) }
|
||||
|
||||
var isGenerator = this.eat(tt.star)
|
||||
var isAsync = false
|
||||
if (!isGenerator) {
|
||||
// Special-case for `async`, since `parseClassMember` currently looks
|
||||
// for `(` to determine whether `async` is a method name
|
||||
if (this.options.ecmaVersion >= 8 && this.isContextual("async")) {
|
||||
skipWhiteSpace.lastIndex = this.pos
|
||||
var skip = skipWhiteSpace.exec(this.input)
|
||||
var next = this.input.charAt(this.pos + skip[0].length)
|
||||
if (next === ";" || next === "=") {
|
||||
node.key = this.parseIdent(true)
|
||||
node.computed = false
|
||||
maybeParseFieldValue.call(this, node)
|
||||
this.finishNode(node, "FieldDefinition")
|
||||
this.semicolon()
|
||||
return node
|
||||
} else if (this.options.ecmaVersion >= 8 && tryContextual("async", true)) {
|
||||
isAsync = true
|
||||
isGenerator = this.options.ecmaVersion >= 9 && this.eat(tt.star)
|
||||
}
|
||||
} else if (tryContextual("get")) {
|
||||
node.kind = "get"
|
||||
} else if (tryContextual("set")) {
|
||||
node.kind = "set"
|
||||
}
|
||||
}
|
||||
if (this.type === this.privateNameToken) {
|
||||
this.parsePrivateClassElementName(node)
|
||||
if (this.type !== tt.parenL) {
|
||||
if (node.key.name === "prototype") {
|
||||
this.raise(node.key.start, "Classes may not have a private static property named prototype")
|
||||
}
|
||||
maybeParseFieldValue.call(this, node)
|
||||
this.finishNode(node, "FieldDefinition")
|
||||
this.semicolon()
|
||||
return node
|
||||
}
|
||||
} else if (!node.key) {
|
||||
this.parsePropertyName(node)
|
||||
if ((node.key.name || node.key.value) === "prototype" && !node.computed) {
|
||||
this.raise(node.key.start, "Classes may not have a static property named prototype")
|
||||
}
|
||||
}
|
||||
if (!node.kind) { node.kind = "method" }
|
||||
this.parseClassMethod(node, isGenerator, isAsync)
|
||||
if (!node.kind && (node.key.name || node.key.value) === "constructor" && !node.computed) {
|
||||
this.raise(node.key.start, "Classes may not have a static field named constructor")
|
||||
}
|
||||
if (node.kind === "get" && node.value.params.length !== 0) {
|
||||
this.raiseRecoverable(node.value.start, "getter should have no params")
|
||||
}
|
||||
if (node.kind === "set" && node.value.params.length !== 1) {
|
||||
this.raiseRecoverable(node.value.start, "setter should have exactly one param")
|
||||
}
|
||||
if (node.kind === "set" && node.value.params[0].type === "RestElement") {
|
||||
this.raiseRecoverable(node.value.params[0].start, "Setter cannot use rest params")
|
||||
}
|
||||
|
||||
return node
|
||||
|
||||
};
|
||||
|
||||
// Parse public static fields
|
||||
anonymous.prototype.parseClassMethod = function parseClassMethod (method, isGenerator, isAsync, _allowsDirectSuper) {
|
||||
if (isGenerator || isAsync || method.kind != "method" || !method.static || this.options.ecmaVersion < 8 || this.type == tt.parenL) {
|
||||
return ExtendedParser.prototype.parseClassMethod.apply(this, arguments)
|
||||
}
|
||||
maybeParseFieldValue.call(this, method)
|
||||
delete method.kind
|
||||
method = this.finishNode(method, "FieldDefinition")
|
||||
this.semicolon()
|
||||
return method
|
||||
};
|
||||
|
||||
// Prohibit arguments in class field initializers
|
||||
anonymous.prototype.parseIdent = function parseIdent (liberal, isBinding) {
|
||||
var ident = ExtendedParser.prototype.parseIdent.call(this, liberal, isBinding)
|
||||
if (this._inStaticFieldValue && ident.name == "arguments") { this.raise(ident.start, "A static class field initializer may not contain arguments") }
|
||||
return ident
|
||||
};
|
||||
|
||||
return anonymous;
|
||||
}(ExtendedParser))
|
||||
}
|
||||
51
client/node_modules/acorn-node/package.json
generated
vendored
51
client/node_modules/acorn-node/package.json
generated
vendored
@@ -1,51 +0,0 @@
|
||||
{
|
||||
"name": "acorn-node",
|
||||
"description": "the acorn javascript parser, preloaded with plugins for syntax parity with recent node versions",
|
||||
"version": "1.8.2",
|
||||
"author": "Renée Kooi <renee@kooi.me>",
|
||||
"bugs": {
|
||||
"url": "https://github.com/browserify/acorn-node/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"acorn": "^7.0.0",
|
||||
"acorn-walk": "^7.0.0",
|
||||
"xtend": "^4.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"acorn-bigint": "^0.4.0",
|
||||
"acorn-class-fields": "^0.3.1",
|
||||
"acorn-dynamic-import": "^4.0.0",
|
||||
"acorn-export-ns-from": "^0.1.0",
|
||||
"acorn-import-meta": "^0.3.0",
|
||||
"acorn-numeric-separator": "^0.3.0",
|
||||
"acorn-private-class-elements": "^0.1.1",
|
||||
"acorn-static-class-features": "^0.2.0",
|
||||
"buble": "^0.19.8",
|
||||
"mkdirp": "^0.5.1",
|
||||
"standard": "^13.1.0",
|
||||
"tape": "^4.11.0"
|
||||
},
|
||||
"homepage": "https://github.com/browserify/acorn-node",
|
||||
"keywords": [
|
||||
"acorn",
|
||||
"browserify",
|
||||
"javascript",
|
||||
"parser"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/browserify/acorn-node.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && node test/index.js",
|
||||
"prepublishOnly": "npm run build",
|
||||
"build": "node build.js"
|
||||
},
|
||||
"standard": {
|
||||
"ignore": [
|
||||
"lib/*/*.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
154
client/node_modules/acorn-node/test/index.js
generated
vendored
154
client/node_modules/acorn-node/test/index.js
generated
vendored
@@ -1,154 +0,0 @@
|
||||
var test = require('tape')
|
||||
var acorn = require('../')
|
||||
var walk = require('../walk')
|
||||
var baseAcorn = require('acorn')
|
||||
|
||||
test('parses object spread syntax', function (t) {
|
||||
var ast = acorn.parse('var a = { ...b }')
|
||||
t.equal(ast.body[0].declarations[0].init.type, 'ObjectExpression')
|
||||
t.equal(ast.body[0].declarations[0].init.properties[0].type, 'SpreadElement')
|
||||
|
||||
ast = acorn.parse('function a ({ ...b }) {}')
|
||||
t.equal(ast.body[0].params[0].type, 'ObjectPattern')
|
||||
t.equal(ast.body[0].params[0].properties[0].type, 'RestElement')
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('does not change main acorn module', function (t) {
|
||||
t.throws(function () {
|
||||
baseAcorn.parse('var a = 10n')
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('tokenizes object spread syntax', function (t) {
|
||||
var tokenizer = acorn.tokenizer('var a = { ...b }')
|
||||
|
||||
t.doesNotThrow(function (t) {
|
||||
while (tokenizer.getToken().type !== acorn.tokTypes.eof) {}
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('allows hashbangs by default', function (t) {
|
||||
t.doesNotThrow(function () {
|
||||
acorn.parse('#!/usr/bin/env node\nconsole.log("ok")')
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('allows top level return by default', function (t) {
|
||||
t.doesNotThrow(function () {
|
||||
acorn.parse('console.log("ok"); return; console.log("not ok")')
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('supports async generators', function (t) {
|
||||
t.doesNotThrow(function () {
|
||||
acorn.parse('async function* a () { await x; yield 1 }')
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('supports async iteration', function (t) {
|
||||
t.doesNotThrow(function () {
|
||||
acorn.parse('async function l (y) { for await (const x of y) {} }')
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('supports optional catch', function (t) {
|
||||
t.doesNotThrow(function () {
|
||||
acorn.parse('try { throw null } catch {}')
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('supports bigint', function (t) {
|
||||
t.doesNotThrow(function () {
|
||||
acorn.parse('50n ** 50n')
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('supports numeric separators', function (t) {
|
||||
t.doesNotThrow(function () {
|
||||
acorn.parse('50_000_000n ** 1n')
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('supports import.meta with sourceType: module', function (t) {
|
||||
t.doesNotThrow(function () {
|
||||
acorn.parse('console.log(import.meta.url)', { sourceType: 'module' })
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('supports dynamic import() with sourceType: module', function (t) {
|
||||
t.doesNotThrow(function () {
|
||||
acorn.parse('import("./whatever.mjs")', { sourceType: 'module' })
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('supports dynamic import() with sourceType: script', function (t) {
|
||||
t.doesNotThrow(function () {
|
||||
acorn.parse('import("./whatever.mjs")', { sourceType: 'script' })
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('supports class instance properties', function (t) {
|
||||
t.doesNotThrow(function () {
|
||||
acorn.parse('class X { x = y }', { sourceType: 'script' })
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('supports private class instance properties', function (t) {
|
||||
t.doesNotThrow(function () {
|
||||
acorn.parse('class X { #x = y }', { sourceType: 'script' })
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('supports class static properties', function (t) {
|
||||
t.doesNotThrow(function () {
|
||||
acorn.parse('class X { static x = y }', { sourceType: 'script' })
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('supports private class static properties', function (t) {
|
||||
t.doesNotThrow(function () {
|
||||
acorn.parse('class X { static #x = y }', { sourceType: 'script' })
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('supports namespace export syntax with sourceType: module', function (t) {
|
||||
t.doesNotThrow(function () {
|
||||
acorn.parse('export * as x from "./x.mjs";', { sourceType: 'module' })
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('walk supports plugin syntax', function (t) {
|
||||
var ast = acorn.parse(
|
||||
'async function* a() { try { await import(xyz); } catch { for await (x of null) {} } yield import.meta.url }',
|
||||
{ sourceType: 'module' }
|
||||
)
|
||||
t.plan(2)
|
||||
walk.simple(ast, {
|
||||
Import: function () {
|
||||
t.pass('import()')
|
||||
},
|
||||
MetaProperty: function () {
|
||||
t.pass('import.meta')
|
||||
}
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
57
client/node_modules/acorn-node/walk.js
generated
vendored
57
client/node_modules/acorn-node/walk.js
generated
vendored
@@ -1,57 +0,0 @@
|
||||
var xtend = require('xtend')
|
||||
var walk = require('acorn-walk')
|
||||
|
||||
var base = xtend(walk.base)
|
||||
base.Import = function () {}
|
||||
|
||||
function simple (node, visitors, baseVisitor, state, override) {
|
||||
return walk.simple(node, visitors, baseVisitor || base, state, override)
|
||||
}
|
||||
|
||||
function ancestor (node, visitors, baseVisitor, state) {
|
||||
return walk.ancestor(node, visitors, baseVisitor || base, state)
|
||||
}
|
||||
|
||||
function recursive (node, state, funcs, baseVisitor, override) {
|
||||
return walk.recursive(node, state, funcs, baseVisitor || base, override)
|
||||
}
|
||||
|
||||
function full (node, callback, baseVisitor, state, override) {
|
||||
return walk.full(node, callback, baseVisitor || base, state, override)
|
||||
}
|
||||
|
||||
function fullAncestor (node, callback, baseVisitor, state) {
|
||||
return walk.fullAncestor(node, callback, baseVisitor || base, state)
|
||||
}
|
||||
|
||||
function findNodeAt (node, start, end, test, baseVisitor, state) {
|
||||
return walk.findNodeAt(node, start, end, test, baseVisitor || base, state)
|
||||
}
|
||||
|
||||
function findNodeAround (node, pos, test, baseVisitor, state) {
|
||||
return walk.findNodeAround(node, pos, test, baseVisitor || base, state)
|
||||
}
|
||||
|
||||
function findNodeAfter (node, pos, test, baseVisitor, state) {
|
||||
return walk.findNodeAfter(node, pos, test, baseVisitor || base, state)
|
||||
}
|
||||
|
||||
function findNodeBefore (node, pos, test, baseVisitor, state) {
|
||||
return walk.findNodeBefore(node, pos, test, baseVisitor || base, state)
|
||||
}
|
||||
|
||||
function make (funcs, baseVisitor) {
|
||||
return walk.make(funcs, baseVisitor || base)
|
||||
}
|
||||
|
||||
exports.simple = simple
|
||||
exports.ancestor = ancestor
|
||||
exports.recursive = recursive
|
||||
exports.full = full
|
||||
exports.fullAncestor = fullAncestor
|
||||
exports.findNodeAt = findNodeAt
|
||||
exports.findNodeAround = findNodeAround
|
||||
exports.findNodeAfter = findNodeAfter
|
||||
exports.findNodeBefore = findNodeBefore
|
||||
exports.make = make
|
||||
exports.base = base
|
||||
131
client/node_modules/acorn-walk/CHANGELOG.md
generated
vendored
131
client/node_modules/acorn-walk/CHANGELOG.md
generated
vendored
@@ -1,131 +0,0 @@
|
||||
## 7.2.0 (2020-06-17)
|
||||
|
||||
### New features
|
||||
|
||||
Support optional chaining and nullish coalescing.
|
||||
|
||||
Support `import.meta`.
|
||||
|
||||
Add support for `export * as ns from "source"`.
|
||||
|
||||
## 7.1.1 (2020-02-13)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Clean up the type definitions to actually work well with the main parser.
|
||||
|
||||
## 7.1.0 (2020-02-11)
|
||||
|
||||
### New features
|
||||
|
||||
Add a TypeScript definition file for the library.
|
||||
|
||||
## 7.0.0 (2017-08-12)
|
||||
|
||||
### New features
|
||||
|
||||
Support walking `ImportExpression` nodes.
|
||||
|
||||
## 6.2.0 (2017-07-04)
|
||||
|
||||
### New features
|
||||
|
||||
Add support for `Import` nodes.
|
||||
|
||||
## 6.1.0 (2018-09-28)
|
||||
|
||||
### New features
|
||||
|
||||
The walker now walks `TemplateElement` nodes.
|
||||
|
||||
## 6.0.1 (2018-09-14)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix bad "main" field in package.json.
|
||||
|
||||
## 6.0.0 (2018-09-14)
|
||||
|
||||
### Breaking changes
|
||||
|
||||
This is now a separate package, `acorn-walk`, rather than part of the main `acorn` package.
|
||||
|
||||
The `ScopeBody` and `ScopeExpression` meta-node-types are no longer supported.
|
||||
|
||||
## 5.7.1 (2018-06-15)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Make sure the walker and bin files are rebuilt on release (the previous release didn't get the up-to-date versions).
|
||||
|
||||
## 5.7.0 (2018-06-15)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix crash in walker when walking a binding-less catch node.
|
||||
|
||||
## 5.6.2 (2018-06-05)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
In the walker, go back to allowing the `baseVisitor` argument to be null to default to the default base everywhere.
|
||||
|
||||
## 5.6.1 (2018-06-01)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix regression when passing `null` as fourth argument to `walk.recursive`.
|
||||
|
||||
## 5.6.0 (2018-05-31)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix a bug in the walker that caused a crash when walking an object pattern spread.
|
||||
|
||||
## 5.5.1 (2018-03-06)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix regression in walker causing property values in object patterns to be walked as expressions.
|
||||
|
||||
## 5.5.0 (2018-02-27)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Support object spread in the AST walker.
|
||||
|
||||
## 5.4.1 (2018-02-02)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
5.4.0 somehow accidentally included an old version of walk.js.
|
||||
|
||||
## 5.2.0 (2017-10-30)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
The `full` and `fullAncestor` walkers no longer visit nodes multiple times.
|
||||
|
||||
## 5.1.0 (2017-07-05)
|
||||
|
||||
### New features
|
||||
|
||||
New walker functions `full` and `fullAncestor`.
|
||||
|
||||
## 3.2.0 (2016-06-07)
|
||||
|
||||
### New features
|
||||
|
||||
Make it possible to use `visit.ancestor` with a walk state.
|
||||
|
||||
## 3.1.0 (2016-04-18)
|
||||
|
||||
### New features
|
||||
|
||||
The walker now allows defining handlers for `CatchClause` nodes.
|
||||
|
||||
## 2.5.2 (2015-10-27)
|
||||
|
||||
### Fixes
|
||||
|
||||
Fix bug where the walker walked an exported `let` statement as an expression.
|
||||
19
client/node_modules/acorn-walk/LICENSE
generated
vendored
19
client/node_modules/acorn-walk/LICENSE
generated
vendored
@@ -1,19 +0,0 @@
|
||||
Copyright (C) 2012-2018 by various contributors (see AUTHORS)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
126
client/node_modules/acorn-walk/README.md
generated
vendored
126
client/node_modules/acorn-walk/README.md
generated
vendored
@@ -1,126 +0,0 @@
|
||||
# Acorn AST walker
|
||||
|
||||
An abstract syntax tree walker for the
|
||||
[ESTree](https://github.com/estree/estree) format.
|
||||
|
||||
## Community
|
||||
|
||||
Acorn is open source software released under an
|
||||
[MIT license](https://github.com/acornjs/acorn/blob/master/acorn-walk/LICENSE).
|
||||
|
||||
You are welcome to
|
||||
[report bugs](https://github.com/acornjs/acorn/issues) or create pull
|
||||
requests on [github](https://github.com/acornjs/acorn). For questions
|
||||
and discussion, please use the
|
||||
[Tern discussion forum](https://discuss.ternjs.net).
|
||||
|
||||
## Installation
|
||||
|
||||
The easiest way to install acorn is from [`npm`](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
npm install acorn-walk
|
||||
```
|
||||
|
||||
Alternately, you can download the source and build acorn yourself:
|
||||
|
||||
```sh
|
||||
git clone https://github.com/acornjs/acorn.git
|
||||
cd acorn
|
||||
npm install
|
||||
```
|
||||
|
||||
## Interface
|
||||
|
||||
An algorithm for recursing through a syntax tree is stored as an
|
||||
object, with a property for each tree node type holding a function
|
||||
that will recurse through such a node. There are several ways to run
|
||||
such a walker.
|
||||
|
||||
**simple**`(node, visitors, base, state)` does a 'simple' walk over a
|
||||
tree. `node` should be the AST node to walk, and `visitors` an object
|
||||
with properties whose names correspond to node types in the [ESTree
|
||||
spec](https://github.com/estree/estree). The properties should contain
|
||||
functions that will be called with the node object and, if applicable
|
||||
the state at that point. The last two arguments are optional. `base`
|
||||
is a walker algorithm, and `state` is a start state. The default
|
||||
walker will simply visit all statements and expressions and not
|
||||
produce a meaningful state. (An example of a use of state is to track
|
||||
scope at each point in the tree.)
|
||||
|
||||
```js
|
||||
const acorn = require("acorn")
|
||||
const walk = require("acorn-walk")
|
||||
|
||||
walk.simple(acorn.parse("let x = 10"), {
|
||||
Literal(node) {
|
||||
console.log(`Found a literal: ${node.value}`)
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
**ancestor**`(node, visitors, base, state)` does a 'simple' walk over
|
||||
a tree, building up an array of ancestor nodes (including the current node)
|
||||
and passing the array to the callbacks as a third parameter.
|
||||
|
||||
```js
|
||||
const acorn = require("acorn")
|
||||
const walk = require("acorn-walk")
|
||||
|
||||
walk.ancestor(acorn.parse("foo('hi')"), {
|
||||
Literal(_, ancestors) {
|
||||
console.log("This literal's ancestors are:", ancestors.map(n => n.type))
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
**recursive**`(node, state, functions, base)` does a 'recursive'
|
||||
walk, where the walker functions are responsible for continuing the
|
||||
walk on the child nodes of their target node. `state` is the start
|
||||
state, and `functions` should contain an object that maps node types
|
||||
to walker functions. Such functions are called with `(node, state, c)`
|
||||
arguments, and can cause the walk to continue on a sub-node by calling
|
||||
the `c` argument on it with `(node, state)` arguments. The optional
|
||||
`base` argument provides the fallback walker functions for node types
|
||||
that aren't handled in the `functions` object. If not given, the
|
||||
default walkers will be used.
|
||||
|
||||
**make**`(functions, base)` builds a new walker object by using the
|
||||
walker functions in `functions` and filling in the missing ones by
|
||||
taking defaults from `base`.
|
||||
|
||||
**full**`(node, callback, base, state)` does a 'full' walk over a
|
||||
tree, calling the callback with the arguments (node, state, type) for
|
||||
each node
|
||||
|
||||
**fullAncestor**`(node, callback, base, state)` does a 'full' walk
|
||||
over a tree, building up an array of ancestor nodes (including the
|
||||
current node) and passing the array to the callbacks as a third
|
||||
parameter.
|
||||
|
||||
```js
|
||||
const acorn = require("acorn")
|
||||
const walk = require("acorn-walk")
|
||||
|
||||
walk.full(acorn.parse("1 + 1"), node => {
|
||||
console.log(`There's a ${node.type} node at ${node.ch}`)
|
||||
})
|
||||
```
|
||||
|
||||
**findNodeAt**`(node, start, end, test, base, state)` tries to locate
|
||||
a node in a tree at the given start and/or end offsets, which
|
||||
satisfies the predicate `test`. `start` and `end` can be either `null`
|
||||
(as wildcard) or a number. `test` may be a string (indicating a node
|
||||
type) or a function that takes `(nodeType, node)` arguments and
|
||||
returns a boolean indicating whether this node is interesting. `base`
|
||||
and `state` are optional, and can be used to specify a custom walker.
|
||||
Nodes are tested from inner to outer, so if two nodes match the
|
||||
boundaries, the inner one will be preferred.
|
||||
|
||||
**findNodeAround**`(node, pos, test, base, state)` is a lot like
|
||||
`findNodeAt`, but will match any node that exists 'around' (spanning)
|
||||
the given position.
|
||||
|
||||
**findNodeAfter**`(node, pos, test, base, state)` is similar to
|
||||
`findNodeAround`, but will match all nodes *after* the given position
|
||||
(testing outer nodes before inner nodes).
|
||||
112
client/node_modules/acorn-walk/dist/walk.d.ts
generated
vendored
112
client/node_modules/acorn-walk/dist/walk.d.ts
generated
vendored
@@ -1,112 +0,0 @@
|
||||
import {Node} from 'acorn';
|
||||
|
||||
declare module "acorn-walk" {
|
||||
type FullWalkerCallback<TState> = (
|
||||
node: Node,
|
||||
state: TState,
|
||||
type: string
|
||||
) => void;
|
||||
|
||||
type FullAncestorWalkerCallback<TState> = (
|
||||
node: Node,
|
||||
state: TState | Node[],
|
||||
ancestors: Node[],
|
||||
type: string
|
||||
) => void;
|
||||
type WalkerCallback<TState> = (node: Node, state: TState) => void;
|
||||
|
||||
type SimpleWalkerFn<TState> = (
|
||||
node: Node,
|
||||
state: TState
|
||||
) => void;
|
||||
|
||||
type AncestorWalkerFn<TState> = (
|
||||
node: Node,
|
||||
state: TState| Node[],
|
||||
ancestors: Node[]
|
||||
) => void;
|
||||
|
||||
type RecursiveWalkerFn<TState> = (
|
||||
node: Node,
|
||||
state: TState,
|
||||
callback: WalkerCallback<TState>
|
||||
) => void;
|
||||
|
||||
type SimpleVisitors<TState> = {
|
||||
[type: string]: SimpleWalkerFn<TState>
|
||||
};
|
||||
|
||||
type AncestorVisitors<TState> = {
|
||||
[type: string]: AncestorWalkerFn<TState>
|
||||
};
|
||||
|
||||
type RecursiveVisitors<TState> = {
|
||||
[type: string]: RecursiveWalkerFn<TState>
|
||||
};
|
||||
|
||||
type FindPredicate = (type: string, node: Node) => boolean;
|
||||
|
||||
interface Found<TState> {
|
||||
node: Node,
|
||||
state: TState
|
||||
}
|
||||
|
||||
export function simple<TState>(
|
||||
node: Node,
|
||||
visitors: SimpleVisitors<TState>,
|
||||
base?: RecursiveVisitors<TState>,
|
||||
state?: TState
|
||||
): void;
|
||||
|
||||
export function ancestor<TState>(
|
||||
node: Node,
|
||||
visitors: AncestorVisitors<TState>,
|
||||
base?: RecursiveVisitors<TState>,
|
||||
state?: TState
|
||||
): void;
|
||||
|
||||
export function recursive<TState>(
|
||||
node: Node,
|
||||
state: TState,
|
||||
functions: RecursiveVisitors<TState>,
|
||||
base?: RecursiveVisitors<TState>
|
||||
): void;
|
||||
|
||||
export function full<TState>(
|
||||
node: Node,
|
||||
callback: FullWalkerCallback<TState>,
|
||||
base?: RecursiveVisitors<TState>,
|
||||
state?: TState
|
||||
): void;
|
||||
|
||||
export function fullAncestor<TState>(
|
||||
node: Node,
|
||||
callback: FullAncestorWalkerCallback<TState>,
|
||||
base?: RecursiveVisitors<TState>,
|
||||
state?: TState
|
||||
): void;
|
||||
|
||||
export function make<TState>(
|
||||
functions: RecursiveVisitors<TState>,
|
||||
base?: RecursiveVisitors<TState>
|
||||
): RecursiveVisitors<TState>;
|
||||
|
||||
export function findNodeAt<TState>(
|
||||
node: Node,
|
||||
start: number | undefined,
|
||||
end?: number | undefined,
|
||||
type?: FindPredicate | string,
|
||||
base?: RecursiveVisitors<TState>,
|
||||
state?: TState
|
||||
): Found<TState> | undefined;
|
||||
|
||||
export function findNodeAround<TState>(
|
||||
node: Node,
|
||||
start: number | undefined,
|
||||
type?: FindPredicate | string,
|
||||
base?: RecursiveVisitors<TState>,
|
||||
state?: TState
|
||||
): Found<TState> | undefined;
|
||||
|
||||
export const findNodeAfter: typeof findNodeAround;
|
||||
}
|
||||
463
client/node_modules/acorn-walk/dist/walk.js
generated
vendored
463
client/node_modules/acorn-walk/dist/walk.js
generated
vendored
@@ -1,463 +0,0 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(global = global || self, factory((global.acorn = global.acorn || {}, global.acorn.walk = {})));
|
||||
}(this, (function (exports) { 'use strict';
|
||||
|
||||
// AST walker module for Mozilla Parser API compatible trees
|
||||
|
||||
// A simple walk is one where you simply specify callbacks to be
|
||||
// called on specific nodes. The last two arguments are optional. A
|
||||
// simple use would be
|
||||
//
|
||||
// walk.simple(myTree, {
|
||||
// Expression: function(node) { ... }
|
||||
// });
|
||||
//
|
||||
// to do something with all expressions. All Parser API node types
|
||||
// can be used to identify node types, as well as Expression and
|
||||
// Statement, which denote categories of nodes.
|
||||
//
|
||||
// The base argument can be used to pass a custom (recursive)
|
||||
// walker, and state can be used to give this walked an initial
|
||||
// state.
|
||||
|
||||
function simple(node, visitors, baseVisitor, state, override) {
|
||||
if (!baseVisitor) { baseVisitor = base
|
||||
; }(function c(node, st, override) {
|
||||
var type = override || node.type, found = visitors[type];
|
||||
baseVisitor[type](node, st, c);
|
||||
if (found) { found(node, st); }
|
||||
})(node, state, override);
|
||||
}
|
||||
|
||||
// An ancestor walk keeps an array of ancestor nodes (including the
|
||||
// current node) and passes them to the callback as third parameter
|
||||
// (and also as state parameter when no other state is present).
|
||||
function ancestor(node, visitors, baseVisitor, state, override) {
|
||||
var ancestors = [];
|
||||
if (!baseVisitor) { baseVisitor = base
|
||||
; }(function c(node, st, override) {
|
||||
var type = override || node.type, found = visitors[type];
|
||||
var isNew = node !== ancestors[ancestors.length - 1];
|
||||
if (isNew) { ancestors.push(node); }
|
||||
baseVisitor[type](node, st, c);
|
||||
if (found) { found(node, st || ancestors, ancestors); }
|
||||
if (isNew) { ancestors.pop(); }
|
||||
})(node, state, override);
|
||||
}
|
||||
|
||||
// A recursive walk is one where your functions override the default
|
||||
// walkers. They can modify and replace the state parameter that's
|
||||
// threaded through the walk, and can opt how and whether to walk
|
||||
// their child nodes (by calling their third argument on these
|
||||
// nodes).
|
||||
function recursive(node, state, funcs, baseVisitor, override) {
|
||||
var visitor = funcs ? make(funcs, baseVisitor || undefined) : baseVisitor
|
||||
;(function c(node, st, override) {
|
||||
visitor[override || node.type](node, st, c);
|
||||
})(node, state, override);
|
||||
}
|
||||
|
||||
function makeTest(test) {
|
||||
if (typeof test === "string")
|
||||
{ return function (type) { return type === test; } }
|
||||
else if (!test)
|
||||
{ return function () { return true; } }
|
||||
else
|
||||
{ return test }
|
||||
}
|
||||
|
||||
var Found = function Found(node, state) { this.node = node; this.state = state; };
|
||||
|
||||
// A full walk triggers the callback on each node
|
||||
function full(node, callback, baseVisitor, state, override) {
|
||||
if (!baseVisitor) { baseVisitor = base
|
||||
; }(function c(node, st, override) {
|
||||
var type = override || node.type;
|
||||
baseVisitor[type](node, st, c);
|
||||
if (!override) { callback(node, st, type); }
|
||||
})(node, state, override);
|
||||
}
|
||||
|
||||
// An fullAncestor walk is like an ancestor walk, but triggers
|
||||
// the callback on each node
|
||||
function fullAncestor(node, callback, baseVisitor, state) {
|
||||
if (!baseVisitor) { baseVisitor = base; }
|
||||
var ancestors = []
|
||||
;(function c(node, st, override) {
|
||||
var type = override || node.type;
|
||||
var isNew = node !== ancestors[ancestors.length - 1];
|
||||
if (isNew) { ancestors.push(node); }
|
||||
baseVisitor[type](node, st, c);
|
||||
if (!override) { callback(node, st || ancestors, ancestors, type); }
|
||||
if (isNew) { ancestors.pop(); }
|
||||
})(node, state);
|
||||
}
|
||||
|
||||
// Find a node with a given start, end, and type (all are optional,
|
||||
// null can be used as wildcard). Returns a {node, state} object, or
|
||||
// undefined when it doesn't find a matching node.
|
||||
function findNodeAt(node, start, end, test, baseVisitor, state) {
|
||||
if (!baseVisitor) { baseVisitor = base; }
|
||||
test = makeTest(test);
|
||||
try {
|
||||
(function c(node, st, override) {
|
||||
var type = override || node.type;
|
||||
if ((start == null || node.start <= start) &&
|
||||
(end == null || node.end >= end))
|
||||
{ baseVisitor[type](node, st, c); }
|
||||
if ((start == null || node.start === start) &&
|
||||
(end == null || node.end === end) &&
|
||||
test(type, node))
|
||||
{ throw new Found(node, st) }
|
||||
})(node, state);
|
||||
} catch (e) {
|
||||
if (e instanceof Found) { return e }
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
// Find the innermost node of a given type that contains the given
|
||||
// position. Interface similar to findNodeAt.
|
||||
function findNodeAround(node, pos, test, baseVisitor, state) {
|
||||
test = makeTest(test);
|
||||
if (!baseVisitor) { baseVisitor = base; }
|
||||
try {
|
||||
(function c(node, st, override) {
|
||||
var type = override || node.type;
|
||||
if (node.start > pos || node.end < pos) { return }
|
||||
baseVisitor[type](node, st, c);
|
||||
if (test(type, node)) { throw new Found(node, st) }
|
||||
})(node, state);
|
||||
} catch (e) {
|
||||
if (e instanceof Found) { return e }
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
// Find the outermost matching node after a given position.
|
||||
function findNodeAfter(node, pos, test, baseVisitor, state) {
|
||||
test = makeTest(test);
|
||||
if (!baseVisitor) { baseVisitor = base; }
|
||||
try {
|
||||
(function c(node, st, override) {
|
||||
if (node.end < pos) { return }
|
||||
var type = override || node.type;
|
||||
if (node.start >= pos && test(type, node)) { throw new Found(node, st) }
|
||||
baseVisitor[type](node, st, c);
|
||||
})(node, state);
|
||||
} catch (e) {
|
||||
if (e instanceof Found) { return e }
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
// Find the outermost matching node before a given position.
|
||||
function findNodeBefore(node, pos, test, baseVisitor, state) {
|
||||
test = makeTest(test);
|
||||
if (!baseVisitor) { baseVisitor = base; }
|
||||
var max
|
||||
;(function c(node, st, override) {
|
||||
if (node.start > pos) { return }
|
||||
var type = override || node.type;
|
||||
if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node))
|
||||
{ max = new Found(node, st); }
|
||||
baseVisitor[type](node, st, c);
|
||||
})(node, state);
|
||||
return max
|
||||
}
|
||||
|
||||
// Fallback to an Object.create polyfill for older environments.
|
||||
var create = Object.create || function(proto) {
|
||||
function Ctor() {}
|
||||
Ctor.prototype = proto;
|
||||
return new Ctor
|
||||
};
|
||||
|
||||
// Used to create a custom walker. Will fill in all missing node
|
||||
// type properties with the defaults.
|
||||
function make(funcs, baseVisitor) {
|
||||
var visitor = create(baseVisitor || base);
|
||||
for (var type in funcs) { visitor[type] = funcs[type]; }
|
||||
return visitor
|
||||
}
|
||||
|
||||
function skipThrough(node, st, c) { c(node, st); }
|
||||
function ignore(_node, _st, _c) {}
|
||||
|
||||
// Node walkers.
|
||||
|
||||
var base = {};
|
||||
|
||||
base.Program = base.BlockStatement = function (node, st, c) {
|
||||
for (var i = 0, list = node.body; i < list.length; i += 1)
|
||||
{
|
||||
var stmt = list[i];
|
||||
|
||||
c(stmt, st, "Statement");
|
||||
}
|
||||
};
|
||||
base.Statement = skipThrough;
|
||||
base.EmptyStatement = ignore;
|
||||
base.ExpressionStatement = base.ParenthesizedExpression = base.ChainExpression =
|
||||
function (node, st, c) { return c(node.expression, st, "Expression"); };
|
||||
base.IfStatement = function (node, st, c) {
|
||||
c(node.test, st, "Expression");
|
||||
c(node.consequent, st, "Statement");
|
||||
if (node.alternate) { c(node.alternate, st, "Statement"); }
|
||||
};
|
||||
base.LabeledStatement = function (node, st, c) { return c(node.body, st, "Statement"); };
|
||||
base.BreakStatement = base.ContinueStatement = ignore;
|
||||
base.WithStatement = function (node, st, c) {
|
||||
c(node.object, st, "Expression");
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
base.SwitchStatement = function (node, st, c) {
|
||||
c(node.discriminant, st, "Expression");
|
||||
for (var i$1 = 0, list$1 = node.cases; i$1 < list$1.length; i$1 += 1) {
|
||||
var cs = list$1[i$1];
|
||||
|
||||
if (cs.test) { c(cs.test, st, "Expression"); }
|
||||
for (var i = 0, list = cs.consequent; i < list.length; i += 1)
|
||||
{
|
||||
var cons = list[i];
|
||||
|
||||
c(cons, st, "Statement");
|
||||
}
|
||||
}
|
||||
};
|
||||
base.SwitchCase = function (node, st, c) {
|
||||
if (node.test) { c(node.test, st, "Expression"); }
|
||||
for (var i = 0, list = node.consequent; i < list.length; i += 1)
|
||||
{
|
||||
var cons = list[i];
|
||||
|
||||
c(cons, st, "Statement");
|
||||
}
|
||||
};
|
||||
base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function (node, st, c) {
|
||||
if (node.argument) { c(node.argument, st, "Expression"); }
|
||||
};
|
||||
base.ThrowStatement = base.SpreadElement =
|
||||
function (node, st, c) { return c(node.argument, st, "Expression"); };
|
||||
base.TryStatement = function (node, st, c) {
|
||||
c(node.block, st, "Statement");
|
||||
if (node.handler) { c(node.handler, st); }
|
||||
if (node.finalizer) { c(node.finalizer, st, "Statement"); }
|
||||
};
|
||||
base.CatchClause = function (node, st, c) {
|
||||
if (node.param) { c(node.param, st, "Pattern"); }
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
base.WhileStatement = base.DoWhileStatement = function (node, st, c) {
|
||||
c(node.test, st, "Expression");
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
base.ForStatement = function (node, st, c) {
|
||||
if (node.init) { c(node.init, st, "ForInit"); }
|
||||
if (node.test) { c(node.test, st, "Expression"); }
|
||||
if (node.update) { c(node.update, st, "Expression"); }
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
base.ForInStatement = base.ForOfStatement = function (node, st, c) {
|
||||
c(node.left, st, "ForInit");
|
||||
c(node.right, st, "Expression");
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
base.ForInit = function (node, st, c) {
|
||||
if (node.type === "VariableDeclaration") { c(node, st); }
|
||||
else { c(node, st, "Expression"); }
|
||||
};
|
||||
base.DebuggerStatement = ignore;
|
||||
|
||||
base.FunctionDeclaration = function (node, st, c) { return c(node, st, "Function"); };
|
||||
base.VariableDeclaration = function (node, st, c) {
|
||||
for (var i = 0, list = node.declarations; i < list.length; i += 1)
|
||||
{
|
||||
var decl = list[i];
|
||||
|
||||
c(decl, st);
|
||||
}
|
||||
};
|
||||
base.VariableDeclarator = function (node, st, c) {
|
||||
c(node.id, st, "Pattern");
|
||||
if (node.init) { c(node.init, st, "Expression"); }
|
||||
};
|
||||
|
||||
base.Function = function (node, st, c) {
|
||||
if (node.id) { c(node.id, st, "Pattern"); }
|
||||
for (var i = 0, list = node.params; i < list.length; i += 1)
|
||||
{
|
||||
var param = list[i];
|
||||
|
||||
c(param, st, "Pattern");
|
||||
}
|
||||
c(node.body, st, node.expression ? "Expression" : "Statement");
|
||||
};
|
||||
|
||||
base.Pattern = function (node, st, c) {
|
||||
if (node.type === "Identifier")
|
||||
{ c(node, st, "VariablePattern"); }
|
||||
else if (node.type === "MemberExpression")
|
||||
{ c(node, st, "MemberPattern"); }
|
||||
else
|
||||
{ c(node, st); }
|
||||
};
|
||||
base.VariablePattern = ignore;
|
||||
base.MemberPattern = skipThrough;
|
||||
base.RestElement = function (node, st, c) { return c(node.argument, st, "Pattern"); };
|
||||
base.ArrayPattern = function (node, st, c) {
|
||||
for (var i = 0, list = node.elements; i < list.length; i += 1) {
|
||||
var elt = list[i];
|
||||
|
||||
if (elt) { c(elt, st, "Pattern"); }
|
||||
}
|
||||
};
|
||||
base.ObjectPattern = function (node, st, c) {
|
||||
for (var i = 0, list = node.properties; i < list.length; i += 1) {
|
||||
var prop = list[i];
|
||||
|
||||
if (prop.type === "Property") {
|
||||
if (prop.computed) { c(prop.key, st, "Expression"); }
|
||||
c(prop.value, st, "Pattern");
|
||||
} else if (prop.type === "RestElement") {
|
||||
c(prop.argument, st, "Pattern");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
base.Expression = skipThrough;
|
||||
base.ThisExpression = base.Super = base.MetaProperty = ignore;
|
||||
base.ArrayExpression = function (node, st, c) {
|
||||
for (var i = 0, list = node.elements; i < list.length; i += 1) {
|
||||
var elt = list[i];
|
||||
|
||||
if (elt) { c(elt, st, "Expression"); }
|
||||
}
|
||||
};
|
||||
base.ObjectExpression = function (node, st, c) {
|
||||
for (var i = 0, list = node.properties; i < list.length; i += 1)
|
||||
{
|
||||
var prop = list[i];
|
||||
|
||||
c(prop, st);
|
||||
}
|
||||
};
|
||||
base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration;
|
||||
base.SequenceExpression = function (node, st, c) {
|
||||
for (var i = 0, list = node.expressions; i < list.length; i += 1)
|
||||
{
|
||||
var expr = list[i];
|
||||
|
||||
c(expr, st, "Expression");
|
||||
}
|
||||
};
|
||||
base.TemplateLiteral = function (node, st, c) {
|
||||
for (var i = 0, list = node.quasis; i < list.length; i += 1)
|
||||
{
|
||||
var quasi = list[i];
|
||||
|
||||
c(quasi, st);
|
||||
}
|
||||
|
||||
for (var i$1 = 0, list$1 = node.expressions; i$1 < list$1.length; i$1 += 1)
|
||||
{
|
||||
var expr = list$1[i$1];
|
||||
|
||||
c(expr, st, "Expression");
|
||||
}
|
||||
};
|
||||
base.TemplateElement = ignore;
|
||||
base.UnaryExpression = base.UpdateExpression = function (node, st, c) {
|
||||
c(node.argument, st, "Expression");
|
||||
};
|
||||
base.BinaryExpression = base.LogicalExpression = function (node, st, c) {
|
||||
c(node.left, st, "Expression");
|
||||
c(node.right, st, "Expression");
|
||||
};
|
||||
base.AssignmentExpression = base.AssignmentPattern = function (node, st, c) {
|
||||
c(node.left, st, "Pattern");
|
||||
c(node.right, st, "Expression");
|
||||
};
|
||||
base.ConditionalExpression = function (node, st, c) {
|
||||
c(node.test, st, "Expression");
|
||||
c(node.consequent, st, "Expression");
|
||||
c(node.alternate, st, "Expression");
|
||||
};
|
||||
base.NewExpression = base.CallExpression = function (node, st, c) {
|
||||
c(node.callee, st, "Expression");
|
||||
if (node.arguments)
|
||||
{ for (var i = 0, list = node.arguments; i < list.length; i += 1)
|
||||
{
|
||||
var arg = list[i];
|
||||
|
||||
c(arg, st, "Expression");
|
||||
} }
|
||||
};
|
||||
base.MemberExpression = function (node, st, c) {
|
||||
c(node.object, st, "Expression");
|
||||
if (node.computed) { c(node.property, st, "Expression"); }
|
||||
};
|
||||
base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) {
|
||||
if (node.declaration)
|
||||
{ c(node.declaration, st, node.type === "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); }
|
||||
if (node.source) { c(node.source, st, "Expression"); }
|
||||
};
|
||||
base.ExportAllDeclaration = function (node, st, c) {
|
||||
if (node.exported)
|
||||
{ c(node.exported, st); }
|
||||
c(node.source, st, "Expression");
|
||||
};
|
||||
base.ImportDeclaration = function (node, st, c) {
|
||||
for (var i = 0, list = node.specifiers; i < list.length; i += 1)
|
||||
{
|
||||
var spec = list[i];
|
||||
|
||||
c(spec, st);
|
||||
}
|
||||
c(node.source, st, "Expression");
|
||||
};
|
||||
base.ImportExpression = function (node, st, c) {
|
||||
c(node.source, st, "Expression");
|
||||
};
|
||||
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore;
|
||||
|
||||
base.TaggedTemplateExpression = function (node, st, c) {
|
||||
c(node.tag, st, "Expression");
|
||||
c(node.quasi, st, "Expression");
|
||||
};
|
||||
base.ClassDeclaration = base.ClassExpression = function (node, st, c) { return c(node, st, "Class"); };
|
||||
base.Class = function (node, st, c) {
|
||||
if (node.id) { c(node.id, st, "Pattern"); }
|
||||
if (node.superClass) { c(node.superClass, st, "Expression"); }
|
||||
c(node.body, st);
|
||||
};
|
||||
base.ClassBody = function (node, st, c) {
|
||||
for (var i = 0, list = node.body; i < list.length; i += 1)
|
||||
{
|
||||
var elt = list[i];
|
||||
|
||||
c(elt, st);
|
||||
}
|
||||
};
|
||||
base.MethodDefinition = base.Property = function (node, st, c) {
|
||||
if (node.computed) { c(node.key, st, "Expression"); }
|
||||
c(node.value, st, "Expression");
|
||||
};
|
||||
|
||||
exports.ancestor = ancestor;
|
||||
exports.base = base;
|
||||
exports.findNodeAfter = findNodeAfter;
|
||||
exports.findNodeAround = findNodeAround;
|
||||
exports.findNodeAt = findNodeAt;
|
||||
exports.findNodeBefore = findNodeBefore;
|
||||
exports.full = full;
|
||||
exports.fullAncestor = fullAncestor;
|
||||
exports.make = make;
|
||||
exports.recursive = recursive;
|
||||
exports.simple = simple;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
})));
|
||||
1
client/node_modules/acorn-walk/dist/walk.js.map
generated
vendored
1
client/node_modules/acorn-walk/dist/walk.js.map
generated
vendored
File diff suppressed because one or more lines are too long
443
client/node_modules/acorn-walk/dist/walk.mjs
generated
vendored
443
client/node_modules/acorn-walk/dist/walk.mjs
generated
vendored
@@ -1,443 +0,0 @@
|
||||
// AST walker module for Mozilla Parser API compatible trees
|
||||
|
||||
// A simple walk is one where you simply specify callbacks to be
|
||||
// called on specific nodes. The last two arguments are optional. A
|
||||
// simple use would be
|
||||
//
|
||||
// walk.simple(myTree, {
|
||||
// Expression: function(node) { ... }
|
||||
// });
|
||||
//
|
||||
// to do something with all expressions. All Parser API node types
|
||||
// can be used to identify node types, as well as Expression and
|
||||
// Statement, which denote categories of nodes.
|
||||
//
|
||||
// The base argument can be used to pass a custom (recursive)
|
||||
// walker, and state can be used to give this walked an initial
|
||||
// state.
|
||||
|
||||
function simple(node, visitors, baseVisitor, state, override) {
|
||||
if (!baseVisitor) { baseVisitor = base
|
||||
; }(function c(node, st, override) {
|
||||
var type = override || node.type, found = visitors[type];
|
||||
baseVisitor[type](node, st, c);
|
||||
if (found) { found(node, st); }
|
||||
})(node, state, override);
|
||||
}
|
||||
|
||||
// An ancestor walk keeps an array of ancestor nodes (including the
|
||||
// current node) and passes them to the callback as third parameter
|
||||
// (and also as state parameter when no other state is present).
|
||||
function ancestor(node, visitors, baseVisitor, state, override) {
|
||||
var ancestors = [];
|
||||
if (!baseVisitor) { baseVisitor = base
|
||||
; }(function c(node, st, override) {
|
||||
var type = override || node.type, found = visitors[type];
|
||||
var isNew = node !== ancestors[ancestors.length - 1];
|
||||
if (isNew) { ancestors.push(node); }
|
||||
baseVisitor[type](node, st, c);
|
||||
if (found) { found(node, st || ancestors, ancestors); }
|
||||
if (isNew) { ancestors.pop(); }
|
||||
})(node, state, override);
|
||||
}
|
||||
|
||||
// A recursive walk is one where your functions override the default
|
||||
// walkers. They can modify and replace the state parameter that's
|
||||
// threaded through the walk, and can opt how and whether to walk
|
||||
// their child nodes (by calling their third argument on these
|
||||
// nodes).
|
||||
function recursive(node, state, funcs, baseVisitor, override) {
|
||||
var visitor = funcs ? make(funcs, baseVisitor || undefined) : baseVisitor
|
||||
;(function c(node, st, override) {
|
||||
visitor[override || node.type](node, st, c);
|
||||
})(node, state, override);
|
||||
}
|
||||
|
||||
function makeTest(test) {
|
||||
if (typeof test === "string")
|
||||
{ return function (type) { return type === test; } }
|
||||
else if (!test)
|
||||
{ return function () { return true; } }
|
||||
else
|
||||
{ return test }
|
||||
}
|
||||
|
||||
var Found = function Found(node, state) { this.node = node; this.state = state; };
|
||||
|
||||
// A full walk triggers the callback on each node
|
||||
function full(node, callback, baseVisitor, state, override) {
|
||||
if (!baseVisitor) { baseVisitor = base
|
||||
; }(function c(node, st, override) {
|
||||
var type = override || node.type;
|
||||
baseVisitor[type](node, st, c);
|
||||
if (!override) { callback(node, st, type); }
|
||||
})(node, state, override);
|
||||
}
|
||||
|
||||
// An fullAncestor walk is like an ancestor walk, but triggers
|
||||
// the callback on each node
|
||||
function fullAncestor(node, callback, baseVisitor, state) {
|
||||
if (!baseVisitor) { baseVisitor = base; }
|
||||
var ancestors = []
|
||||
;(function c(node, st, override) {
|
||||
var type = override || node.type;
|
||||
var isNew = node !== ancestors[ancestors.length - 1];
|
||||
if (isNew) { ancestors.push(node); }
|
||||
baseVisitor[type](node, st, c);
|
||||
if (!override) { callback(node, st || ancestors, ancestors, type); }
|
||||
if (isNew) { ancestors.pop(); }
|
||||
})(node, state);
|
||||
}
|
||||
|
||||
// Find a node with a given start, end, and type (all are optional,
|
||||
// null can be used as wildcard). Returns a {node, state} object, or
|
||||
// undefined when it doesn't find a matching node.
|
||||
function findNodeAt(node, start, end, test, baseVisitor, state) {
|
||||
if (!baseVisitor) { baseVisitor = base; }
|
||||
test = makeTest(test);
|
||||
try {
|
||||
(function c(node, st, override) {
|
||||
var type = override || node.type;
|
||||
if ((start == null || node.start <= start) &&
|
||||
(end == null || node.end >= end))
|
||||
{ baseVisitor[type](node, st, c); }
|
||||
if ((start == null || node.start === start) &&
|
||||
(end == null || node.end === end) &&
|
||||
test(type, node))
|
||||
{ throw new Found(node, st) }
|
||||
})(node, state);
|
||||
} catch (e) {
|
||||
if (e instanceof Found) { return e }
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
// Find the innermost node of a given type that contains the given
|
||||
// position. Interface similar to findNodeAt.
|
||||
function findNodeAround(node, pos, test, baseVisitor, state) {
|
||||
test = makeTest(test);
|
||||
if (!baseVisitor) { baseVisitor = base; }
|
||||
try {
|
||||
(function c(node, st, override) {
|
||||
var type = override || node.type;
|
||||
if (node.start > pos || node.end < pos) { return }
|
||||
baseVisitor[type](node, st, c);
|
||||
if (test(type, node)) { throw new Found(node, st) }
|
||||
})(node, state);
|
||||
} catch (e) {
|
||||
if (e instanceof Found) { return e }
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
// Find the outermost matching node after a given position.
|
||||
function findNodeAfter(node, pos, test, baseVisitor, state) {
|
||||
test = makeTest(test);
|
||||
if (!baseVisitor) { baseVisitor = base; }
|
||||
try {
|
||||
(function c(node, st, override) {
|
||||
if (node.end < pos) { return }
|
||||
var type = override || node.type;
|
||||
if (node.start >= pos && test(type, node)) { throw new Found(node, st) }
|
||||
baseVisitor[type](node, st, c);
|
||||
})(node, state);
|
||||
} catch (e) {
|
||||
if (e instanceof Found) { return e }
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
// Find the outermost matching node before a given position.
|
||||
function findNodeBefore(node, pos, test, baseVisitor, state) {
|
||||
test = makeTest(test);
|
||||
if (!baseVisitor) { baseVisitor = base; }
|
||||
var max
|
||||
;(function c(node, st, override) {
|
||||
if (node.start > pos) { return }
|
||||
var type = override || node.type;
|
||||
if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node))
|
||||
{ max = new Found(node, st); }
|
||||
baseVisitor[type](node, st, c);
|
||||
})(node, state);
|
||||
return max
|
||||
}
|
||||
|
||||
// Fallback to an Object.create polyfill for older environments.
|
||||
var create = Object.create || function(proto) {
|
||||
function Ctor() {}
|
||||
Ctor.prototype = proto;
|
||||
return new Ctor
|
||||
};
|
||||
|
||||
// Used to create a custom walker. Will fill in all missing node
|
||||
// type properties with the defaults.
|
||||
function make(funcs, baseVisitor) {
|
||||
var visitor = create(baseVisitor || base);
|
||||
for (var type in funcs) { visitor[type] = funcs[type]; }
|
||||
return visitor
|
||||
}
|
||||
|
||||
function skipThrough(node, st, c) { c(node, st); }
|
||||
function ignore(_node, _st, _c) {}
|
||||
|
||||
// Node walkers.
|
||||
|
||||
var base = {};
|
||||
|
||||
base.Program = base.BlockStatement = function (node, st, c) {
|
||||
for (var i = 0, list = node.body; i < list.length; i += 1)
|
||||
{
|
||||
var stmt = list[i];
|
||||
|
||||
c(stmt, st, "Statement");
|
||||
}
|
||||
};
|
||||
base.Statement = skipThrough;
|
||||
base.EmptyStatement = ignore;
|
||||
base.ExpressionStatement = base.ParenthesizedExpression = base.ChainExpression =
|
||||
function (node, st, c) { return c(node.expression, st, "Expression"); };
|
||||
base.IfStatement = function (node, st, c) {
|
||||
c(node.test, st, "Expression");
|
||||
c(node.consequent, st, "Statement");
|
||||
if (node.alternate) { c(node.alternate, st, "Statement"); }
|
||||
};
|
||||
base.LabeledStatement = function (node, st, c) { return c(node.body, st, "Statement"); };
|
||||
base.BreakStatement = base.ContinueStatement = ignore;
|
||||
base.WithStatement = function (node, st, c) {
|
||||
c(node.object, st, "Expression");
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
base.SwitchStatement = function (node, st, c) {
|
||||
c(node.discriminant, st, "Expression");
|
||||
for (var i$1 = 0, list$1 = node.cases; i$1 < list$1.length; i$1 += 1) {
|
||||
var cs = list$1[i$1];
|
||||
|
||||
if (cs.test) { c(cs.test, st, "Expression"); }
|
||||
for (var i = 0, list = cs.consequent; i < list.length; i += 1)
|
||||
{
|
||||
var cons = list[i];
|
||||
|
||||
c(cons, st, "Statement");
|
||||
}
|
||||
}
|
||||
};
|
||||
base.SwitchCase = function (node, st, c) {
|
||||
if (node.test) { c(node.test, st, "Expression"); }
|
||||
for (var i = 0, list = node.consequent; i < list.length; i += 1)
|
||||
{
|
||||
var cons = list[i];
|
||||
|
||||
c(cons, st, "Statement");
|
||||
}
|
||||
};
|
||||
base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function (node, st, c) {
|
||||
if (node.argument) { c(node.argument, st, "Expression"); }
|
||||
};
|
||||
base.ThrowStatement = base.SpreadElement =
|
||||
function (node, st, c) { return c(node.argument, st, "Expression"); };
|
||||
base.TryStatement = function (node, st, c) {
|
||||
c(node.block, st, "Statement");
|
||||
if (node.handler) { c(node.handler, st); }
|
||||
if (node.finalizer) { c(node.finalizer, st, "Statement"); }
|
||||
};
|
||||
base.CatchClause = function (node, st, c) {
|
||||
if (node.param) { c(node.param, st, "Pattern"); }
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
base.WhileStatement = base.DoWhileStatement = function (node, st, c) {
|
||||
c(node.test, st, "Expression");
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
base.ForStatement = function (node, st, c) {
|
||||
if (node.init) { c(node.init, st, "ForInit"); }
|
||||
if (node.test) { c(node.test, st, "Expression"); }
|
||||
if (node.update) { c(node.update, st, "Expression"); }
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
base.ForInStatement = base.ForOfStatement = function (node, st, c) {
|
||||
c(node.left, st, "ForInit");
|
||||
c(node.right, st, "Expression");
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
base.ForInit = function (node, st, c) {
|
||||
if (node.type === "VariableDeclaration") { c(node, st); }
|
||||
else { c(node, st, "Expression"); }
|
||||
};
|
||||
base.DebuggerStatement = ignore;
|
||||
|
||||
base.FunctionDeclaration = function (node, st, c) { return c(node, st, "Function"); };
|
||||
base.VariableDeclaration = function (node, st, c) {
|
||||
for (var i = 0, list = node.declarations; i < list.length; i += 1)
|
||||
{
|
||||
var decl = list[i];
|
||||
|
||||
c(decl, st);
|
||||
}
|
||||
};
|
||||
base.VariableDeclarator = function (node, st, c) {
|
||||
c(node.id, st, "Pattern");
|
||||
if (node.init) { c(node.init, st, "Expression"); }
|
||||
};
|
||||
|
||||
base.Function = function (node, st, c) {
|
||||
if (node.id) { c(node.id, st, "Pattern"); }
|
||||
for (var i = 0, list = node.params; i < list.length; i += 1)
|
||||
{
|
||||
var param = list[i];
|
||||
|
||||
c(param, st, "Pattern");
|
||||
}
|
||||
c(node.body, st, node.expression ? "Expression" : "Statement");
|
||||
};
|
||||
|
||||
base.Pattern = function (node, st, c) {
|
||||
if (node.type === "Identifier")
|
||||
{ c(node, st, "VariablePattern"); }
|
||||
else if (node.type === "MemberExpression")
|
||||
{ c(node, st, "MemberPattern"); }
|
||||
else
|
||||
{ c(node, st); }
|
||||
};
|
||||
base.VariablePattern = ignore;
|
||||
base.MemberPattern = skipThrough;
|
||||
base.RestElement = function (node, st, c) { return c(node.argument, st, "Pattern"); };
|
||||
base.ArrayPattern = function (node, st, c) {
|
||||
for (var i = 0, list = node.elements; i < list.length; i += 1) {
|
||||
var elt = list[i];
|
||||
|
||||
if (elt) { c(elt, st, "Pattern"); }
|
||||
}
|
||||
};
|
||||
base.ObjectPattern = function (node, st, c) {
|
||||
for (var i = 0, list = node.properties; i < list.length; i += 1) {
|
||||
var prop = list[i];
|
||||
|
||||
if (prop.type === "Property") {
|
||||
if (prop.computed) { c(prop.key, st, "Expression"); }
|
||||
c(prop.value, st, "Pattern");
|
||||
} else if (prop.type === "RestElement") {
|
||||
c(prop.argument, st, "Pattern");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
base.Expression = skipThrough;
|
||||
base.ThisExpression = base.Super = base.MetaProperty = ignore;
|
||||
base.ArrayExpression = function (node, st, c) {
|
||||
for (var i = 0, list = node.elements; i < list.length; i += 1) {
|
||||
var elt = list[i];
|
||||
|
||||
if (elt) { c(elt, st, "Expression"); }
|
||||
}
|
||||
};
|
||||
base.ObjectExpression = function (node, st, c) {
|
||||
for (var i = 0, list = node.properties; i < list.length; i += 1)
|
||||
{
|
||||
var prop = list[i];
|
||||
|
||||
c(prop, st);
|
||||
}
|
||||
};
|
||||
base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration;
|
||||
base.SequenceExpression = function (node, st, c) {
|
||||
for (var i = 0, list = node.expressions; i < list.length; i += 1)
|
||||
{
|
||||
var expr = list[i];
|
||||
|
||||
c(expr, st, "Expression");
|
||||
}
|
||||
};
|
||||
base.TemplateLiteral = function (node, st, c) {
|
||||
for (var i = 0, list = node.quasis; i < list.length; i += 1)
|
||||
{
|
||||
var quasi = list[i];
|
||||
|
||||
c(quasi, st);
|
||||
}
|
||||
|
||||
for (var i$1 = 0, list$1 = node.expressions; i$1 < list$1.length; i$1 += 1)
|
||||
{
|
||||
var expr = list$1[i$1];
|
||||
|
||||
c(expr, st, "Expression");
|
||||
}
|
||||
};
|
||||
base.TemplateElement = ignore;
|
||||
base.UnaryExpression = base.UpdateExpression = function (node, st, c) {
|
||||
c(node.argument, st, "Expression");
|
||||
};
|
||||
base.BinaryExpression = base.LogicalExpression = function (node, st, c) {
|
||||
c(node.left, st, "Expression");
|
||||
c(node.right, st, "Expression");
|
||||
};
|
||||
base.AssignmentExpression = base.AssignmentPattern = function (node, st, c) {
|
||||
c(node.left, st, "Pattern");
|
||||
c(node.right, st, "Expression");
|
||||
};
|
||||
base.ConditionalExpression = function (node, st, c) {
|
||||
c(node.test, st, "Expression");
|
||||
c(node.consequent, st, "Expression");
|
||||
c(node.alternate, st, "Expression");
|
||||
};
|
||||
base.NewExpression = base.CallExpression = function (node, st, c) {
|
||||
c(node.callee, st, "Expression");
|
||||
if (node.arguments)
|
||||
{ for (var i = 0, list = node.arguments; i < list.length; i += 1)
|
||||
{
|
||||
var arg = list[i];
|
||||
|
||||
c(arg, st, "Expression");
|
||||
} }
|
||||
};
|
||||
base.MemberExpression = function (node, st, c) {
|
||||
c(node.object, st, "Expression");
|
||||
if (node.computed) { c(node.property, st, "Expression"); }
|
||||
};
|
||||
base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) {
|
||||
if (node.declaration)
|
||||
{ c(node.declaration, st, node.type === "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); }
|
||||
if (node.source) { c(node.source, st, "Expression"); }
|
||||
};
|
||||
base.ExportAllDeclaration = function (node, st, c) {
|
||||
if (node.exported)
|
||||
{ c(node.exported, st); }
|
||||
c(node.source, st, "Expression");
|
||||
};
|
||||
base.ImportDeclaration = function (node, st, c) {
|
||||
for (var i = 0, list = node.specifiers; i < list.length; i += 1)
|
||||
{
|
||||
var spec = list[i];
|
||||
|
||||
c(spec, st);
|
||||
}
|
||||
c(node.source, st, "Expression");
|
||||
};
|
||||
base.ImportExpression = function (node, st, c) {
|
||||
c(node.source, st, "Expression");
|
||||
};
|
||||
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore;
|
||||
|
||||
base.TaggedTemplateExpression = function (node, st, c) {
|
||||
c(node.tag, st, "Expression");
|
||||
c(node.quasi, st, "Expression");
|
||||
};
|
||||
base.ClassDeclaration = base.ClassExpression = function (node, st, c) { return c(node, st, "Class"); };
|
||||
base.Class = function (node, st, c) {
|
||||
if (node.id) { c(node.id, st, "Pattern"); }
|
||||
if (node.superClass) { c(node.superClass, st, "Expression"); }
|
||||
c(node.body, st);
|
||||
};
|
||||
base.ClassBody = function (node, st, c) {
|
||||
for (var i = 0, list = node.body; i < list.length; i += 1)
|
||||
{
|
||||
var elt = list[i];
|
||||
|
||||
c(elt, st);
|
||||
}
|
||||
};
|
||||
base.MethodDefinition = base.Property = function (node, st, c) {
|
||||
if (node.computed) { c(node.key, st, "Expression"); }
|
||||
c(node.value, st, "Expression");
|
||||
};
|
||||
|
||||
export { ancestor, base, findNodeAfter, findNodeAround, findNodeAt, findNodeBefore, full, fullAncestor, make, recursive, simple };
|
||||
1
client/node_modules/acorn-walk/dist/walk.mjs.map
generated
vendored
1
client/node_modules/acorn-walk/dist/walk.mjs.map
generated
vendored
File diff suppressed because one or more lines are too long
34
client/node_modules/acorn-walk/package.json
generated
vendored
34
client/node_modules/acorn-walk/package.json
generated
vendored
@@ -1,34 +0,0 @@
|
||||
{
|
||||
"name": "acorn-walk",
|
||||
"description": "ECMAScript (ESTree) AST walker",
|
||||
"homepage": "https://github.com/acornjs/acorn",
|
||||
"main": "dist/walk.js",
|
||||
"types": "dist/walk.d.ts",
|
||||
"module": "dist/walk.mjs",
|
||||
"version": "7.2.0",
|
||||
"engines": {"node": ">=0.4.0"},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Marijn Haverbeke",
|
||||
"email": "marijnh@gmail.com",
|
||||
"web": "https://marijnhaverbeke.nl"
|
||||
},
|
||||
{
|
||||
"name": "Ingvar Stepanyan",
|
||||
"email": "me@rreverser.com",
|
||||
"web": "https://rreverser.com/"
|
||||
},
|
||||
{
|
||||
"name": "Adrian Heine",
|
||||
"web": "http://adrianheine.de"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/acornjs/acorn.git"
|
||||
},
|
||||
"scripts": {
|
||||
"prepare": "cd ..; npm run build:walk"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
620
client/node_modules/acorn/CHANGELOG.md
generated
vendored
620
client/node_modules/acorn/CHANGELOG.md
generated
vendored
@@ -1,620 +0,0 @@
|
||||
## 7.4.0 (2020-08-03)
|
||||
|
||||
### New features
|
||||
|
||||
Add support for logical assignment operators.
|
||||
|
||||
Add support for numeric separators.
|
||||
|
||||
## 7.3.1 (2020-06-11)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Make the string in the `version` export match the actual library version.
|
||||
|
||||
## 7.3.0 (2020-06-11)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix a bug that caused parsing of object patterns with a property named `set` that had a default value to fail.
|
||||
|
||||
### New features
|
||||
|
||||
Add support for optional chaining (`?.`).
|
||||
|
||||
## 7.2.0 (2020-05-09)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix precedence issue in parsing of async arrow functions.
|
||||
|
||||
### New features
|
||||
|
||||
Add support for nullish coalescing.
|
||||
|
||||
Add support for `import.meta`.
|
||||
|
||||
Support `export * as ...` syntax.
|
||||
|
||||
Upgrade to Unicode 13.
|
||||
|
||||
## 6.4.1 (2020-03-09)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
More carefully check for valid UTF16 surrogate pairs in regexp validator.
|
||||
|
||||
## 7.1.1 (2020-03-01)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Treat `\8` and `\9` as invalid escapes in template strings.
|
||||
|
||||
Allow unicode escapes in property names that are keywords.
|
||||
|
||||
Don't error on an exponential operator expression as argument to `await`.
|
||||
|
||||
More carefully check for valid UTF16 surrogate pairs in regexp validator.
|
||||
|
||||
## 7.1.0 (2019-09-24)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Disallow trailing object literal commas when ecmaVersion is less than 5.
|
||||
|
||||
### New features
|
||||
|
||||
Add a static `acorn` property to the `Parser` class that contains the entire module interface, to allow plugins to access the instance of the library that they are acting on.
|
||||
|
||||
## 7.0.0 (2019-08-13)
|
||||
|
||||
### Breaking changes
|
||||
|
||||
Changes the node format for dynamic imports to use the `ImportExpression` node type, as defined in [ESTree](https://github.com/estree/estree/blob/master/es2020.md#importexpression).
|
||||
|
||||
Makes 10 (ES2019) the default value for the `ecmaVersion` option.
|
||||
|
||||
## 6.3.0 (2019-08-12)
|
||||
|
||||
### New features
|
||||
|
||||
`sourceType: "module"` can now be used even when `ecmaVersion` is less than 6, to parse module-style code that otherwise conforms to an older standard.
|
||||
|
||||
## 6.2.1 (2019-07-21)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix bug causing Acorn to treat some characters as identifier characters that shouldn't be treated as such.
|
||||
|
||||
Fix issue where setting the `allowReserved` option to `"never"` allowed reserved words in some circumstances.
|
||||
|
||||
## 6.2.0 (2019-07-04)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Improve valid assignment checking in `for`/`in` and `for`/`of` loops.
|
||||
|
||||
Disallow binding `let` in patterns.
|
||||
|
||||
### New features
|
||||
|
||||
Support bigint syntax with `ecmaVersion` >= 11.
|
||||
|
||||
Support dynamic `import` syntax with `ecmaVersion` >= 11.
|
||||
|
||||
Upgrade to Unicode version 12.
|
||||
|
||||
## 6.1.1 (2019-02-27)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix bug that caused parsing default exports of with names to fail.
|
||||
|
||||
## 6.1.0 (2019-02-08)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix scope checking when redefining a `var` as a lexical binding.
|
||||
|
||||
### New features
|
||||
|
||||
Split up `parseSubscripts` to use an internal `parseSubscript` method to make it easier to extend with plugins.
|
||||
|
||||
## 6.0.7 (2019-02-04)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Check that exported bindings are defined.
|
||||
|
||||
Don't treat `\u180e` as a whitespace character.
|
||||
|
||||
Check for duplicate parameter names in methods.
|
||||
|
||||
Don't allow shorthand properties when they are generators or async methods.
|
||||
|
||||
Forbid binding `await` in async arrow function's parameter list.
|
||||
|
||||
## 6.0.6 (2019-01-30)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
The content of class declarations and expressions is now always parsed in strict mode.
|
||||
|
||||
Don't allow `let` or `const` to bind the variable name `let`.
|
||||
|
||||
Treat class declarations as lexical.
|
||||
|
||||
Don't allow a generator function declaration as the sole body of an `if` or `else`.
|
||||
|
||||
Ignore `"use strict"` when after an empty statement.
|
||||
|
||||
Allow string line continuations with special line terminator characters.
|
||||
|
||||
Treat `for` bodies as part of the `for` scope when checking for conflicting bindings.
|
||||
|
||||
Fix bug with parsing `yield` in a `for` loop initializer.
|
||||
|
||||
Implement special cases around scope checking for functions.
|
||||
|
||||
## 6.0.5 (2019-01-02)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix TypeScript type for `Parser.extend` and add `allowAwaitOutsideFunction` to options type.
|
||||
|
||||
Don't treat `let` as a keyword when the next token is `{` on the next line.
|
||||
|
||||
Fix bug that broke checking for parentheses around an object pattern in a destructuring assignment when `preserveParens` was on.
|
||||
|
||||
## 6.0.4 (2018-11-05)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Further improvements to tokenizing regular expressions in corner cases.
|
||||
|
||||
## 6.0.3 (2018-11-04)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix bug in tokenizing an expression-less return followed by a function followed by a regular expression.
|
||||
|
||||
Remove stray symlink in the package tarball.
|
||||
|
||||
## 6.0.2 (2018-09-26)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix bug where default expressions could fail to parse inside an object destructuring assignment expression.
|
||||
|
||||
## 6.0.1 (2018-09-14)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix wrong value in `version` export.
|
||||
|
||||
## 6.0.0 (2018-09-14)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Better handle variable-redefinition checks for catch bindings and functions directly under if statements.
|
||||
|
||||
Forbid `new.target` in top-level arrow functions.
|
||||
|
||||
Fix issue with parsing a regexp after `yield` in some contexts.
|
||||
|
||||
### New features
|
||||
|
||||
The package now comes with TypeScript definitions.
|
||||
|
||||
### Breaking changes
|
||||
|
||||
The default value of the `ecmaVersion` option is now 9 (2018).
|
||||
|
||||
Plugins work differently, and will have to be rewritten to work with this version.
|
||||
|
||||
The loose parser and walker have been moved into separate packages (`acorn-loose` and `acorn-walk`).
|
||||
|
||||
## 5.7.3 (2018-09-10)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix failure to tokenize regexps after expressions like `x.of`.
|
||||
|
||||
Better error message for unterminated template literals.
|
||||
|
||||
## 5.7.2 (2018-08-24)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Properly handle `allowAwaitOutsideFunction` in for statements.
|
||||
|
||||
Treat function declarations at the top level of modules like let bindings.
|
||||
|
||||
Don't allow async function declarations as the only statement under a label.
|
||||
|
||||
## 5.7.0 (2018-06-15)
|
||||
|
||||
### New features
|
||||
|
||||
Upgraded to Unicode 11.
|
||||
|
||||
## 5.6.0 (2018-05-31)
|
||||
|
||||
### New features
|
||||
|
||||
Allow U+2028 and U+2029 in string when ECMAVersion >= 10.
|
||||
|
||||
Allow binding-less catch statements when ECMAVersion >= 10.
|
||||
|
||||
Add `allowAwaitOutsideFunction` option for parsing top-level `await`.
|
||||
|
||||
## 5.5.3 (2018-03-08)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
A _second_ republish of the code in 5.5.1, this time with yarn, to hopefully get valid timestamps.
|
||||
|
||||
## 5.5.2 (2018-03-08)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
A republish of the code in 5.5.1 in an attempt to solve an issue with the file timestamps in the npm package being 0.
|
||||
|
||||
## 5.5.1 (2018-03-06)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix misleading error message for octal escapes in template strings.
|
||||
|
||||
## 5.5.0 (2018-02-27)
|
||||
|
||||
### New features
|
||||
|
||||
The identifier character categorization is now based on Unicode version 10.
|
||||
|
||||
Acorn will now validate the content of regular expressions, including new ES9 features.
|
||||
|
||||
## 5.4.0 (2018-02-01)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Disallow duplicate or escaped flags on regular expressions.
|
||||
|
||||
Disallow octal escapes in strings in strict mode.
|
||||
|
||||
### New features
|
||||
|
||||
Add support for async iteration.
|
||||
|
||||
Add support for object spread and rest.
|
||||
|
||||
## 5.3.0 (2017-12-28)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix parsing of floating point literals with leading zeroes in loose mode.
|
||||
|
||||
Allow duplicate property names in object patterns.
|
||||
|
||||
Don't allow static class methods named `prototype`.
|
||||
|
||||
Disallow async functions directly under `if` or `else`.
|
||||
|
||||
Parse right-hand-side of `for`/`of` as an assignment expression.
|
||||
|
||||
Stricter parsing of `for`/`in`.
|
||||
|
||||
Don't allow unicode escapes in contextual keywords.
|
||||
|
||||
### New features
|
||||
|
||||
Parsing class members was factored into smaller methods to allow plugins to hook into it.
|
||||
|
||||
## 5.2.1 (2017-10-30)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix a token context corruption bug.
|
||||
|
||||
## 5.2.0 (2017-10-30)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix token context tracking for `class` and `function` in property-name position.
|
||||
|
||||
Make sure `%*` isn't parsed as a valid operator.
|
||||
|
||||
Allow shorthand properties `get` and `set` to be followed by default values.
|
||||
|
||||
Disallow `super` when not in callee or object position.
|
||||
|
||||
### New features
|
||||
|
||||
Support [`directive` property](https://github.com/estree/estree/compare/b3de58c9997504d6fba04b72f76e6dd1619ee4eb...1da8e603237144f44710360f8feb7a9977e905e0) on directive expression statements.
|
||||
|
||||
## 5.1.2 (2017-09-04)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Disable parsing of legacy HTML-style comments in modules.
|
||||
|
||||
Fix parsing of async methods whose names are keywords.
|
||||
|
||||
## 5.1.1 (2017-07-06)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix problem with disambiguating regexp and division after a class.
|
||||
|
||||
## 5.1.0 (2017-07-05)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix tokenizing of regexps in an object-desctructuring `for`/`of` loop and after `yield`.
|
||||
|
||||
Parse zero-prefixed numbers with non-octal digits as decimal.
|
||||
|
||||
Allow object/array patterns in rest parameters.
|
||||
|
||||
Don't error when `yield` is used as a property name.
|
||||
|
||||
Allow `async` as a shorthand object property.
|
||||
|
||||
### New features
|
||||
|
||||
Implement the [template literal revision proposal](https://github.com/tc39/proposal-template-literal-revision) for ES9.
|
||||
|
||||
## 5.0.3 (2017-04-01)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix spurious duplicate variable definition errors for named functions.
|
||||
|
||||
## 5.0.2 (2017-03-30)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
A binary operator after a parenthesized arrow expression is no longer incorrectly treated as an error.
|
||||
|
||||
## 5.0.0 (2017-03-28)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Raise an error for duplicated lexical bindings.
|
||||
|
||||
Fix spurious error when an assignement expression occurred after a spread expression.
|
||||
|
||||
Accept regular expressions after `of` (in `for`/`of`), `yield` (in a generator), and braced arrow functions.
|
||||
|
||||
Allow labels in front or `var` declarations, even in strict mode.
|
||||
|
||||
### Breaking changes
|
||||
|
||||
Parse declarations following `export default` as declaration nodes, not expressions. This means that class and function declarations nodes can now have `null` as their `id`.
|
||||
|
||||
## 4.0.11 (2017-02-07)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Allow all forms of member expressions to be parenthesized as lvalue.
|
||||
|
||||
## 4.0.10 (2017-02-07)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Don't expect semicolons after default-exported functions or classes, even when they are expressions.
|
||||
|
||||
Check for use of `'use strict'` directives in non-simple parameter functions, even when already in strict mode.
|
||||
|
||||
## 4.0.9 (2017-02-06)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix incorrect error raised for parenthesized simple assignment targets, so that `(x) = 1` parses again.
|
||||
|
||||
## 4.0.8 (2017-02-03)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Solve spurious parenthesized pattern errors by temporarily erring on the side of accepting programs that our delayed errors don't handle correctly yet.
|
||||
|
||||
## 4.0.7 (2017-02-02)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Accept invalidly rejected code like `(x).y = 2` again.
|
||||
|
||||
Don't raise an error when a function _inside_ strict code has a non-simple parameter list.
|
||||
|
||||
## 4.0.6 (2017-02-02)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix exponential behavior (manifesting itself as a complete hang for even relatively small source files) introduced by the new 'use strict' check.
|
||||
|
||||
## 4.0.5 (2017-02-02)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Disallow parenthesized pattern expressions.
|
||||
|
||||
Allow keywords as export names.
|
||||
|
||||
Don't allow the `async` keyword to be parenthesized.
|
||||
|
||||
Properly raise an error when a keyword contains a character escape.
|
||||
|
||||
Allow `"use strict"` to appear after other string literal expressions.
|
||||
|
||||
Disallow labeled declarations.
|
||||
|
||||
## 4.0.4 (2016-12-19)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix crash when `export` was followed by a keyword that can't be
|
||||
exported.
|
||||
|
||||
## 4.0.3 (2016-08-16)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Allow regular function declarations inside single-statement `if` branches in loose mode. Forbid them entirely in strict mode.
|
||||
|
||||
Properly parse properties named `async` in ES2017 mode.
|
||||
|
||||
Fix bug where reserved words were broken in ES2017 mode.
|
||||
|
||||
## 4.0.2 (2016-08-11)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Don't ignore period or 'e' characters after octal numbers.
|
||||
|
||||
Fix broken parsing for call expressions in default parameter values of arrow functions.
|
||||
|
||||
## 4.0.1 (2016-08-08)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix false positives in duplicated export name errors.
|
||||
|
||||
## 4.0.0 (2016-08-07)
|
||||
|
||||
### Breaking changes
|
||||
|
||||
The default `ecmaVersion` option value is now 7.
|
||||
|
||||
A number of internal method signatures changed, so plugins might need to be updated.
|
||||
|
||||
### Bug fixes
|
||||
|
||||
The parser now raises errors on duplicated export names.
|
||||
|
||||
`arguments` and `eval` can now be used in shorthand properties.
|
||||
|
||||
Duplicate parameter names in non-simple argument lists now always produce an error.
|
||||
|
||||
### New features
|
||||
|
||||
The `ecmaVersion` option now also accepts year-style version numbers
|
||||
(2015, etc).
|
||||
|
||||
Support for `async`/`await` syntax when `ecmaVersion` is >= 8.
|
||||
|
||||
Support for trailing commas in call expressions when `ecmaVersion` is >= 8.
|
||||
|
||||
## 3.3.0 (2016-07-25)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix bug in tokenizing of regexp operator after a function declaration.
|
||||
|
||||
Fix parser crash when parsing an array pattern with a hole.
|
||||
|
||||
### New features
|
||||
|
||||
Implement check against complex argument lists in functions that enable strict mode in ES7.
|
||||
|
||||
## 3.2.0 (2016-06-07)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Improve handling of lack of unicode regexp support in host
|
||||
environment.
|
||||
|
||||
Properly reject shorthand properties whose name is a keyword.
|
||||
|
||||
### New features
|
||||
|
||||
Visitors created with `visit.make` now have their base as _prototype_, rather than copying properties into a fresh object.
|
||||
|
||||
## 3.1.0 (2016-04-18)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Properly tokenize the division operator directly after a function expression.
|
||||
|
||||
Allow trailing comma in destructuring arrays.
|
||||
|
||||
## 3.0.4 (2016-02-25)
|
||||
|
||||
### Fixes
|
||||
|
||||
Allow update expressions as left-hand-side of the ES7 exponential operator.
|
||||
|
||||
## 3.0.2 (2016-02-10)
|
||||
|
||||
### Fixes
|
||||
|
||||
Fix bug that accidentally made `undefined` a reserved word when parsing ES7.
|
||||
|
||||
## 3.0.0 (2016-02-10)
|
||||
|
||||
### Breaking changes
|
||||
|
||||
The default value of the `ecmaVersion` option is now 6 (used to be 5).
|
||||
|
||||
Support for comprehension syntax (which was dropped from the draft spec) has been removed.
|
||||
|
||||
### Fixes
|
||||
|
||||
`let` and `yield` are now “contextual keywords”, meaning you can mostly use them as identifiers in ES5 non-strict code.
|
||||
|
||||
A parenthesized class or function expression after `export default` is now parsed correctly.
|
||||
|
||||
### New features
|
||||
|
||||
When `ecmaVersion` is set to 7, Acorn will parse the exponentiation operator (`**`).
|
||||
|
||||
The identifier character ranges are now based on Unicode 8.0.0.
|
||||
|
||||
Plugins can now override the `raiseRecoverable` method to override the way non-critical errors are handled.
|
||||
|
||||
## 2.7.0 (2016-01-04)
|
||||
|
||||
### Fixes
|
||||
|
||||
Stop allowing rest parameters in setters.
|
||||
|
||||
Disallow `y` rexexp flag in ES5.
|
||||
|
||||
Disallow `\00` and `\000` escapes in strict mode.
|
||||
|
||||
Raise an error when an import name is a reserved word.
|
||||
|
||||
## 2.6.2 (2015-11-10)
|
||||
|
||||
### Fixes
|
||||
|
||||
Don't crash when no options object is passed.
|
||||
|
||||
## 2.6.0 (2015-11-09)
|
||||
|
||||
### Fixes
|
||||
|
||||
Add `await` as a reserved word in module sources.
|
||||
|
||||
Disallow `yield` in a parameter default value for a generator.
|
||||
|
||||
Forbid using a comma after a rest pattern in an array destructuring.
|
||||
|
||||
### New features
|
||||
|
||||
Support parsing stdin in command-line tool.
|
||||
|
||||
## 2.5.0 (2015-10-27)
|
||||
|
||||
### Fixes
|
||||
|
||||
Fix tokenizer support in the command-line tool.
|
||||
|
||||
Stop allowing `new.target` outside of functions.
|
||||
|
||||
Remove legacy `guard` and `guardedHandler` properties from try nodes.
|
||||
|
||||
Stop allowing multiple `__proto__` properties on an object literal in strict mode.
|
||||
|
||||
Don't allow rest parameters to be non-identifier patterns.
|
||||
|
||||
Check for duplicate paramter names in arrow functions.
|
||||
21
client/node_modules/acorn/LICENSE
generated
vendored
21
client/node_modules/acorn/LICENSE
generated
vendored
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (C) 2012-2018 by various contributors (see AUTHORS)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
269
client/node_modules/acorn/README.md
generated
vendored
269
client/node_modules/acorn/README.md
generated
vendored
@@ -1,269 +0,0 @@
|
||||
# Acorn
|
||||
|
||||
A tiny, fast JavaScript parser written in JavaScript.
|
||||
|
||||
## Community
|
||||
|
||||
Acorn is open source software released under an
|
||||
[MIT license](https://github.com/acornjs/acorn/blob/master/acorn/LICENSE).
|
||||
|
||||
You are welcome to
|
||||
[report bugs](https://github.com/acornjs/acorn/issues) or create pull
|
||||
requests on [github](https://github.com/acornjs/acorn). For questions
|
||||
and discussion, please use the
|
||||
[Tern discussion forum](https://discuss.ternjs.net).
|
||||
|
||||
## Installation
|
||||
|
||||
The easiest way to install acorn is from [`npm`](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
npm install acorn
|
||||
```
|
||||
|
||||
Alternately, you can download the source and build acorn yourself:
|
||||
|
||||
```sh
|
||||
git clone https://github.com/acornjs/acorn.git
|
||||
cd acorn
|
||||
npm install
|
||||
```
|
||||
|
||||
## Interface
|
||||
|
||||
**parse**`(input, options)` is the main interface to the library. The
|
||||
`input` parameter is a string, `options` can be undefined or an object
|
||||
setting some of the options listed below. The return value will be an
|
||||
abstract syntax tree object as specified by the [ESTree
|
||||
spec](https://github.com/estree/estree).
|
||||
|
||||
```javascript
|
||||
let acorn = require("acorn");
|
||||
console.log(acorn.parse("1 + 1"));
|
||||
```
|
||||
|
||||
When encountering a syntax error, the parser will raise a
|
||||
`SyntaxError` object with a meaningful message. The error object will
|
||||
have a `pos` property that indicates the string offset at which the
|
||||
error occurred, and a `loc` object that contains a `{line, column}`
|
||||
object referring to that same position.
|
||||
|
||||
Options can be provided by passing a second argument, which should be
|
||||
an object containing any of these fields:
|
||||
|
||||
- **ecmaVersion**: Indicates the ECMAScript version to parse. Must be
|
||||
either 3, 5, 6 (2015), 7 (2016), 8 (2017), 9 (2018), 10 (2019) or 11
|
||||
(2020, partial support). This influences support for strict mode,
|
||||
the set of reserved words, and support for new syntax features.
|
||||
Default is 10.
|
||||
|
||||
**NOTE**: Only 'stage 4' (finalized) ECMAScript features are being
|
||||
implemented by Acorn. Other proposed new features can be implemented
|
||||
through plugins.
|
||||
|
||||
- **sourceType**: Indicate the mode the code should be parsed in. Can be
|
||||
either `"script"` or `"module"`. This influences global strict mode
|
||||
and parsing of `import` and `export` declarations.
|
||||
|
||||
**NOTE**: If set to `"module"`, then static `import` / `export` syntax
|
||||
will be valid, even if `ecmaVersion` is less than 6.
|
||||
|
||||
- **onInsertedSemicolon**: If given a callback, that callback will be
|
||||
called whenever a missing semicolon is inserted by the parser. The
|
||||
callback will be given the character offset of the point where the
|
||||
semicolon is inserted as argument, and if `locations` is on, also a
|
||||
`{line, column}` object representing this position.
|
||||
|
||||
- **onTrailingComma**: Like `onInsertedSemicolon`, but for trailing
|
||||
commas.
|
||||
|
||||
- **allowReserved**: If `false`, using a reserved word will generate
|
||||
an error. Defaults to `true` for `ecmaVersion` 3, `false` for higher
|
||||
versions. When given the value `"never"`, reserved words and
|
||||
keywords can also not be used as property names (as in Internet
|
||||
Explorer's old parser).
|
||||
|
||||
- **allowReturnOutsideFunction**: By default, a return statement at
|
||||
the top level raises an error. Set this to `true` to accept such
|
||||
code.
|
||||
|
||||
- **allowImportExportEverywhere**: By default, `import` and `export`
|
||||
declarations can only appear at a program's top level. Setting this
|
||||
option to `true` allows them anywhere where a statement is allowed.
|
||||
|
||||
- **allowAwaitOutsideFunction**: By default, `await` expressions can
|
||||
only appear inside `async` functions. Setting this option to
|
||||
`true` allows to have top-level `await` expressions. They are
|
||||
still not allowed in non-`async` functions, though.
|
||||
|
||||
- **allowHashBang**: When this is enabled (off by default), if the
|
||||
code starts with the characters `#!` (as in a shellscript), the
|
||||
first line will be treated as a comment.
|
||||
|
||||
- **locations**: When `true`, each node has a `loc` object attached
|
||||
with `start` and `end` subobjects, each of which contains the
|
||||
one-based line and zero-based column numbers in `{line, column}`
|
||||
form. Default is `false`.
|
||||
|
||||
- **onToken**: If a function is passed for this option, each found
|
||||
token will be passed in same format as tokens returned from
|
||||
`tokenizer().getToken()`.
|
||||
|
||||
If array is passed, each found token is pushed to it.
|
||||
|
||||
Note that you are not allowed to call the parser from the
|
||||
callback—that will corrupt its internal state.
|
||||
|
||||
- **onComment**: If a function is passed for this option, whenever a
|
||||
comment is encountered the function will be called with the
|
||||
following parameters:
|
||||
|
||||
- `block`: `true` if the comment is a block comment, false if it
|
||||
is a line comment.
|
||||
- `text`: The content of the comment.
|
||||
- `start`: Character offset of the start of the comment.
|
||||
- `end`: Character offset of the end of the comment.
|
||||
|
||||
When the `locations` options is on, the `{line, column}` locations
|
||||
of the comment’s start and end are passed as two additional
|
||||
parameters.
|
||||
|
||||
If array is passed for this option, each found comment is pushed
|
||||
to it as object in Esprima format:
|
||||
|
||||
```javascript
|
||||
{
|
||||
"type": "Line" | "Block",
|
||||
"value": "comment text",
|
||||
"start": Number,
|
||||
"end": Number,
|
||||
// If `locations` option is on:
|
||||
"loc": {
|
||||
"start": {line: Number, column: Number}
|
||||
"end": {line: Number, column: Number}
|
||||
},
|
||||
// If `ranges` option is on:
|
||||
"range": [Number, Number]
|
||||
}
|
||||
```
|
||||
|
||||
Note that you are not allowed to call the parser from the
|
||||
callback—that will corrupt its internal state.
|
||||
|
||||
- **ranges**: Nodes have their start and end characters offsets
|
||||
recorded in `start` and `end` properties (directly on the node,
|
||||
rather than the `loc` object, which holds line/column data. To also
|
||||
add a
|
||||
[semi-standardized](https://bugzilla.mozilla.org/show_bug.cgi?id=745678)
|
||||
`range` property holding a `[start, end]` array with the same
|
||||
numbers, set the `ranges` option to `true`.
|
||||
|
||||
- **program**: It is possible to parse multiple files into a single
|
||||
AST by passing the tree produced by parsing the first file as the
|
||||
`program` option in subsequent parses. This will add the toplevel
|
||||
forms of the parsed file to the "Program" (top) node of an existing
|
||||
parse tree.
|
||||
|
||||
- **sourceFile**: When the `locations` option is `true`, you can pass
|
||||
this option to add a `source` attribute in every node’s `loc`
|
||||
object. Note that the contents of this option are not examined or
|
||||
processed in any way; you are free to use whatever format you
|
||||
choose.
|
||||
|
||||
- **directSourceFile**: Like `sourceFile`, but a `sourceFile` property
|
||||
will be added (regardless of the `location` option) directly to the
|
||||
nodes, rather than the `loc` object.
|
||||
|
||||
- **preserveParens**: If this option is `true`, parenthesized expressions
|
||||
are represented by (non-standard) `ParenthesizedExpression` nodes
|
||||
that have a single `expression` property containing the expression
|
||||
inside parentheses.
|
||||
|
||||
**parseExpressionAt**`(input, offset, options)` will parse a single
|
||||
expression in a string, and return its AST. It will not complain if
|
||||
there is more of the string left after the expression.
|
||||
|
||||
**tokenizer**`(input, options)` returns an object with a `getToken`
|
||||
method that can be called repeatedly to get the next token, a `{start,
|
||||
end, type, value}` object (with added `loc` property when the
|
||||
`locations` option is enabled and `range` property when the `ranges`
|
||||
option is enabled). When the token's type is `tokTypes.eof`, you
|
||||
should stop calling the method, since it will keep returning that same
|
||||
token forever.
|
||||
|
||||
In ES6 environment, returned result can be used as any other
|
||||
protocol-compliant iterable:
|
||||
|
||||
```javascript
|
||||
for (let token of acorn.tokenizer(str)) {
|
||||
// iterate over the tokens
|
||||
}
|
||||
|
||||
// transform code to array of tokens:
|
||||
var tokens = [...acorn.tokenizer(str)];
|
||||
```
|
||||
|
||||
**tokTypes** holds an object mapping names to the token type objects
|
||||
that end up in the `type` properties of tokens.
|
||||
|
||||
**getLineInfo**`(input, offset)` can be used to get a `{line,
|
||||
column}` object for a given program string and offset.
|
||||
|
||||
### The `Parser` class
|
||||
|
||||
Instances of the **`Parser`** class contain all the state and logic
|
||||
that drives a parse. It has static methods `parse`,
|
||||
`parseExpressionAt`, and `tokenizer` that match the top-level
|
||||
functions by the same name.
|
||||
|
||||
When extending the parser with plugins, you need to call these methods
|
||||
on the extended version of the class. To extend a parser with plugins,
|
||||
you can use its static `extend` method.
|
||||
|
||||
```javascript
|
||||
var acorn = require("acorn");
|
||||
var jsx = require("acorn-jsx");
|
||||
var JSXParser = acorn.Parser.extend(jsx());
|
||||
JSXParser.parse("foo(<bar/>)");
|
||||
```
|
||||
|
||||
The `extend` method takes any number of plugin values, and returns a
|
||||
new `Parser` class that includes the extra parser logic provided by
|
||||
the plugins.
|
||||
|
||||
## Command line interface
|
||||
|
||||
The `bin/acorn` utility can be used to parse a file from the command
|
||||
line. It accepts as arguments its input file and the following
|
||||
options:
|
||||
|
||||
- `--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|--ecma10`: Sets the ECMAScript version
|
||||
to parse. Default is version 9.
|
||||
|
||||
- `--module`: Sets the parsing mode to `"module"`. Is set to `"script"` otherwise.
|
||||
|
||||
- `--locations`: Attaches a "loc" object to each node with "start" and
|
||||
"end" subobjects, each of which contains the one-based line and
|
||||
zero-based column numbers in `{line, column}` form.
|
||||
|
||||
- `--allow-hash-bang`: If the code starts with the characters #! (as
|
||||
in a shellscript), the first line will be treated as a comment.
|
||||
|
||||
- `--compact`: No whitespace is used in the AST output.
|
||||
|
||||
- `--silent`: Do not output the AST, just return the exit status.
|
||||
|
||||
- `--help`: Print the usage information and quit.
|
||||
|
||||
The utility spits out the syntax tree as JSON data.
|
||||
|
||||
## Existing plugins
|
||||
|
||||
- [`acorn-jsx`](https://github.com/RReverser/acorn-jsx): Parse [Facebook JSX syntax extensions](https://github.com/facebook/jsx)
|
||||
|
||||
Plugins for ECMAScript proposals:
|
||||
|
||||
- [`acorn-stage3`](https://github.com/acornjs/acorn-stage3): Parse most stage 3 proposals, bundling:
|
||||
- [`acorn-class-fields`](https://github.com/acornjs/acorn-class-fields): Parse [class fields proposal](https://github.com/tc39/proposal-class-fields)
|
||||
- [`acorn-import-meta`](https://github.com/acornjs/acorn-import-meta): Parse [import.meta proposal](https://github.com/tc39/proposal-import-meta)
|
||||
- [`acorn-private-methods`](https://github.com/acornjs/acorn-private-methods): parse [private methods, getters and setters proposal](https://github.com/tc39/proposal-private-methods)n
|
||||
4
client/node_modules/acorn/bin/acorn
generated
vendored
4
client/node_modules/acorn/bin/acorn
generated
vendored
@@ -1,4 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
require('../dist/bin.js');
|
||||
209
client/node_modules/acorn/dist/acorn.d.ts
generated
vendored
209
client/node_modules/acorn/dist/acorn.d.ts
generated
vendored
@@ -1,209 +0,0 @@
|
||||
export as namespace acorn
|
||||
export = acorn
|
||||
|
||||
declare namespace acorn {
|
||||
function parse(input: string, options?: Options): Node
|
||||
|
||||
function parseExpressionAt(input: string, pos?: number, options?: Options): Node
|
||||
|
||||
function tokenizer(input: string, options?: Options): {
|
||||
getToken(): Token
|
||||
[Symbol.iterator](): Iterator<Token>
|
||||
}
|
||||
|
||||
interface Options {
|
||||
ecmaVersion?: 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020
|
||||
sourceType?: 'script' | 'module'
|
||||
onInsertedSemicolon?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
|
||||
onTrailingComma?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
|
||||
allowReserved?: boolean | 'never'
|
||||
allowReturnOutsideFunction?: boolean
|
||||
allowImportExportEverywhere?: boolean
|
||||
allowAwaitOutsideFunction?: boolean
|
||||
allowHashBang?: boolean
|
||||
locations?: boolean
|
||||
onToken?: ((token: Token) => any) | Token[]
|
||||
onComment?: ((
|
||||
isBlock: boolean, text: string, start: number, end: number, startLoc?: Position,
|
||||
endLoc?: Position
|
||||
) => void) | Comment[]
|
||||
ranges?: boolean
|
||||
program?: Node
|
||||
sourceFile?: string
|
||||
directSourceFile?: string
|
||||
preserveParens?: boolean
|
||||
}
|
||||
|
||||
class Parser {
|
||||
constructor(options: Options, input: string, startPos?: number)
|
||||
parse(this: Parser): Node
|
||||
static parse(this: typeof Parser, input: string, options?: Options): Node
|
||||
static parseExpressionAt(this: typeof Parser, input: string, pos: number, options?: Options): Node
|
||||
static tokenizer(this: typeof Parser, input: string, options?: Options): {
|
||||
getToken(): Token
|
||||
[Symbol.iterator](): Iterator<Token>
|
||||
}
|
||||
static extend(this: typeof Parser, ...plugins: ((BaseParser: typeof Parser) => typeof Parser)[]): typeof Parser
|
||||
}
|
||||
|
||||
interface Position { line: number; column: number; offset: number }
|
||||
|
||||
const defaultOptions: Options
|
||||
|
||||
function getLineInfo(input: string, offset: number): Position
|
||||
|
||||
class SourceLocation {
|
||||
start: Position
|
||||
end: Position
|
||||
source?: string | null
|
||||
constructor(p: Parser, start: Position, end: Position)
|
||||
}
|
||||
|
||||
class Node {
|
||||
type: string
|
||||
start: number
|
||||
end: number
|
||||
loc?: SourceLocation
|
||||
sourceFile?: string
|
||||
range?: [number, number]
|
||||
constructor(parser: Parser, pos: number, loc?: SourceLocation)
|
||||
}
|
||||
|
||||
class TokenType {
|
||||
label: string
|
||||
keyword: string
|
||||
beforeExpr: boolean
|
||||
startsExpr: boolean
|
||||
isLoop: boolean
|
||||
isAssign: boolean
|
||||
prefix: boolean
|
||||
postfix: boolean
|
||||
binop: number
|
||||
updateContext?: (prevType: TokenType) => void
|
||||
constructor(label: string, conf?: any)
|
||||
}
|
||||
|
||||
const tokTypes: {
|
||||
num: TokenType
|
||||
regexp: TokenType
|
||||
string: TokenType
|
||||
name: TokenType
|
||||
eof: TokenType
|
||||
bracketL: TokenType
|
||||
bracketR: TokenType
|
||||
braceL: TokenType
|
||||
braceR: TokenType
|
||||
parenL: TokenType
|
||||
parenR: TokenType
|
||||
comma: TokenType
|
||||
semi: TokenType
|
||||
colon: TokenType
|
||||
dot: TokenType
|
||||
question: TokenType
|
||||
arrow: TokenType
|
||||
template: TokenType
|
||||
ellipsis: TokenType
|
||||
backQuote: TokenType
|
||||
dollarBraceL: TokenType
|
||||
eq: TokenType
|
||||
assign: TokenType
|
||||
incDec: TokenType
|
||||
prefix: TokenType
|
||||
logicalOR: TokenType
|
||||
logicalAND: TokenType
|
||||
bitwiseOR: TokenType
|
||||
bitwiseXOR: TokenType
|
||||
bitwiseAND: TokenType
|
||||
equality: TokenType
|
||||
relational: TokenType
|
||||
bitShift: TokenType
|
||||
plusMin: TokenType
|
||||
modulo: TokenType
|
||||
star: TokenType
|
||||
slash: TokenType
|
||||
starstar: TokenType
|
||||
_break: TokenType
|
||||
_case: TokenType
|
||||
_catch: TokenType
|
||||
_continue: TokenType
|
||||
_debugger: TokenType
|
||||
_default: TokenType
|
||||
_do: TokenType
|
||||
_else: TokenType
|
||||
_finally: TokenType
|
||||
_for: TokenType
|
||||
_function: TokenType
|
||||
_if: TokenType
|
||||
_return: TokenType
|
||||
_switch: TokenType
|
||||
_throw: TokenType
|
||||
_try: TokenType
|
||||
_var: TokenType
|
||||
_const: TokenType
|
||||
_while: TokenType
|
||||
_with: TokenType
|
||||
_new: TokenType
|
||||
_this: TokenType
|
||||
_super: TokenType
|
||||
_class: TokenType
|
||||
_extends: TokenType
|
||||
_export: TokenType
|
||||
_import: TokenType
|
||||
_null: TokenType
|
||||
_true: TokenType
|
||||
_false: TokenType
|
||||
_in: TokenType
|
||||
_instanceof: TokenType
|
||||
_typeof: TokenType
|
||||
_void: TokenType
|
||||
_delete: TokenType
|
||||
}
|
||||
|
||||
class TokContext {
|
||||
constructor(token: string, isExpr: boolean, preserveSpace: boolean, override?: (p: Parser) => void)
|
||||
}
|
||||
|
||||
const tokContexts: {
|
||||
b_stat: TokContext
|
||||
b_expr: TokContext
|
||||
b_tmpl: TokContext
|
||||
p_stat: TokContext
|
||||
p_expr: TokContext
|
||||
q_tmpl: TokContext
|
||||
f_expr: TokContext
|
||||
}
|
||||
|
||||
function isIdentifierStart(code: number, astral?: boolean): boolean
|
||||
|
||||
function isIdentifierChar(code: number, astral?: boolean): boolean
|
||||
|
||||
interface AbstractToken {
|
||||
}
|
||||
|
||||
interface Comment extends AbstractToken {
|
||||
type: string
|
||||
value: string
|
||||
start: number
|
||||
end: number
|
||||
loc?: SourceLocation
|
||||
range?: [number, number]
|
||||
}
|
||||
|
||||
class Token {
|
||||
type: TokenType
|
||||
value: any
|
||||
start: number
|
||||
end: number
|
||||
loc?: SourceLocation
|
||||
range?: [number, number]
|
||||
constructor(p: Parser)
|
||||
}
|
||||
|
||||
function isNewLine(code: number): boolean
|
||||
|
||||
const lineBreak: RegExp
|
||||
|
||||
const lineBreakG: RegExp
|
||||
|
||||
const version: string
|
||||
}
|
||||
5186
client/node_modules/acorn/dist/acorn.js
generated
vendored
5186
client/node_modules/acorn/dist/acorn.js
generated
vendored
File diff suppressed because it is too large
Load Diff
1
client/node_modules/acorn/dist/acorn.js.map
generated
vendored
1
client/node_modules/acorn/dist/acorn.js.map
generated
vendored
File diff suppressed because one or more lines are too long
5155
client/node_modules/acorn/dist/acorn.mjs
generated
vendored
5155
client/node_modules/acorn/dist/acorn.mjs
generated
vendored
File diff suppressed because it is too large
Load Diff
2
client/node_modules/acorn/dist/acorn.mjs.d.ts
generated
vendored
2
client/node_modules/acorn/dist/acorn.mjs.d.ts
generated
vendored
@@ -1,2 +0,0 @@
|
||||
import * as acorn from "./acorn";
|
||||
export = acorn;
|
||||
1
client/node_modules/acorn/dist/acorn.mjs.map
generated
vendored
1
client/node_modules/acorn/dist/acorn.mjs.map
generated
vendored
File diff suppressed because one or more lines are too long
64
client/node_modules/acorn/dist/bin.js
generated
vendored
64
client/node_modules/acorn/dist/bin.js
generated
vendored
@@ -1,64 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var acorn = require('./acorn.js');
|
||||
|
||||
var infile, forceFile, silent = false, compact = false, tokenize = false;
|
||||
var options = {};
|
||||
|
||||
function help(status) {
|
||||
var print = (status === 0) ? console.log : console.error;
|
||||
print("usage: " + path.basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|...|--ecma2015|--ecma2016|--ecma2017|--ecma2018|...]");
|
||||
print(" [--tokenize] [--locations] [---allow-hash-bang] [--compact] [--silent] [--module] [--help] [--] [infile]");
|
||||
process.exit(status);
|
||||
}
|
||||
|
||||
for (var i = 2; i < process.argv.length; ++i) {
|
||||
var arg = process.argv[i];
|
||||
if ((arg === "-" || arg[0] !== "-") && !infile) { infile = arg; }
|
||||
else if (arg === "--" && !infile && i + 2 === process.argv.length) { forceFile = infile = process.argv[++i]; }
|
||||
else if (arg === "--locations") { options.locations = true; }
|
||||
else if (arg === "--allow-hash-bang") { options.allowHashBang = true; }
|
||||
else if (arg === "--silent") { silent = true; }
|
||||
else if (arg === "--compact") { compact = true; }
|
||||
else if (arg === "--help") { help(0); }
|
||||
else if (arg === "--tokenize") { tokenize = true; }
|
||||
else if (arg === "--module") { options.sourceType = "module"; }
|
||||
else {
|
||||
var match = arg.match(/^--ecma(\d+)$/);
|
||||
if (match)
|
||||
{ options.ecmaVersion = +match[1]; }
|
||||
else
|
||||
{ help(1); }
|
||||
}
|
||||
}
|
||||
|
||||
function run(code) {
|
||||
var result;
|
||||
try {
|
||||
if (!tokenize) {
|
||||
result = acorn.parse(code, options);
|
||||
} else {
|
||||
result = [];
|
||||
var tokenizer = acorn.tokenizer(code, options), token;
|
||||
do {
|
||||
token = tokenizer.getToken();
|
||||
result.push(token);
|
||||
} while (token.type !== acorn.tokTypes.eof)
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(infile && infile !== "-" ? e.message.replace(/\(\d+:\d+\)$/, function (m) { return m.slice(0, 1) + infile + " " + m.slice(1); }) : e.message);
|
||||
process.exit(1);
|
||||
}
|
||||
if (!silent) { console.log(JSON.stringify(result, null, compact ? null : 2)); }
|
||||
}
|
||||
|
||||
if (forceFile || infile && infile !== "-") {
|
||||
run(fs.readFileSync(infile, "utf8"));
|
||||
} else {
|
||||
var code = "";
|
||||
process.stdin.resume();
|
||||
process.stdin.on("data", function (chunk) { return code += chunk; });
|
||||
process.stdin.on("end", function () { return run(code); });
|
||||
}
|
||||
35
client/node_modules/acorn/package.json
generated
vendored
35
client/node_modules/acorn/package.json
generated
vendored
@@ -1,35 +0,0 @@
|
||||
{
|
||||
"name": "acorn",
|
||||
"description": "ECMAScript parser",
|
||||
"homepage": "https://github.com/acornjs/acorn",
|
||||
"main": "dist/acorn.js",
|
||||
"types": "dist/acorn.d.ts",
|
||||
"module": "dist/acorn.mjs",
|
||||
"version": "7.4.1",
|
||||
"engines": {"node": ">=0.4.0"},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Marijn Haverbeke",
|
||||
"email": "marijnh@gmail.com",
|
||||
"web": "https://marijnhaverbeke.nl"
|
||||
},
|
||||
{
|
||||
"name": "Ingvar Stepanyan",
|
||||
"email": "me@rreverser.com",
|
||||
"web": "https://rreverser.com/"
|
||||
},
|
||||
{
|
||||
"name": "Adrian Heine",
|
||||
"web": "http://adrianheine.de"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/acornjs/acorn.git"
|
||||
},
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"prepare": "cd ..; npm run build:main && npm run build:bin"
|
||||
},
|
||||
"bin": {"acorn": "./bin/acorn"}
|
||||
}
|
||||
4
client/node_modules/any-promise/.jshintrc
generated
vendored
4
client/node_modules/any-promise/.jshintrc
generated
vendored
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"node":true,
|
||||
"strict":true
|
||||
}
|
||||
7
client/node_modules/any-promise/.npmignore
generated
vendored
7
client/node_modules/any-promise/.npmignore
generated
vendored
@@ -1,7 +0,0 @@
|
||||
.git*
|
||||
test/
|
||||
test-browser/
|
||||
build/
|
||||
.travis.yml
|
||||
*.swp
|
||||
Makefile
|
||||
19
client/node_modules/any-promise/LICENSE
generated
vendored
19
client/node_modules/any-promise/LICENSE
generated
vendored
@@ -1,19 +0,0 @@
|
||||
Copyright (C) 2014-2016 Kevin Beaty
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
161
client/node_modules/any-promise/README.md
generated
vendored
161
client/node_modules/any-promise/README.md
generated
vendored
@@ -1,161 +0,0 @@
|
||||
## Any Promise
|
||||
|
||||
[](http://travis-ci.org/kevinbeaty/any-promise)
|
||||
|
||||
Let your library support any ES 2015 (ES6) compatible `Promise` and leave the choice to application authors. The application can *optionally* register its preferred `Promise` implementation and it will be exported when requiring `any-promise` from library code.
|
||||
|
||||
If no preference is registered, defaults to the global `Promise` for newer Node.js versions. The browser version defaults to the window `Promise`, so polyfill or register as necessary.
|
||||
|
||||
### Usage with global Promise:
|
||||
|
||||
Assuming the global `Promise` is the desired implementation:
|
||||
|
||||
```bash
|
||||
# Install any libraries depending on any-promise
|
||||
$ npm install mz
|
||||
```
|
||||
|
||||
The installed libraries will use global Promise by default.
|
||||
|
||||
```js
|
||||
// in library
|
||||
var Promise = require('any-promise') // the global Promise
|
||||
|
||||
function promiseReturningFunction(){
|
||||
return new Promise(function(resolve, reject){...})
|
||||
}
|
||||
```
|
||||
|
||||
### Usage with registration:
|
||||
|
||||
Assuming `bluebird` is the desired Promise implementation:
|
||||
|
||||
```bash
|
||||
# Install preferred promise library
|
||||
$ npm install bluebird
|
||||
# Install any-promise to allow registration
|
||||
$ npm install any-promise
|
||||
# Install any libraries you would like to use depending on any-promise
|
||||
$ npm install mz
|
||||
```
|
||||
|
||||
Register your preference in the application entry point before any other `require` of packages that load `any-promise`:
|
||||
|
||||
```javascript
|
||||
// top of application index.js or other entry point
|
||||
require('any-promise/register/bluebird')
|
||||
|
||||
// -or- Equivalent to above, but allows customization of Promise library
|
||||
require('any-promise/register')('bluebird', {Promise: require('bluebird')})
|
||||
```
|
||||
|
||||
Now that the implementation is registered, you can use any package depending on `any-promise`:
|
||||
|
||||
|
||||
```javascript
|
||||
var fsp = require('mz/fs') // mz/fs will use registered bluebird promises
|
||||
var Promise = require('any-promise') // the registered bluebird promise
|
||||
```
|
||||
|
||||
It is safe to call `register` multiple times, but it must always be with the same implementation.
|
||||
|
||||
Again, registration is *optional*. It should only be called by the application user if overriding the global `Promise` implementation is desired.
|
||||
|
||||
### Optional Application Registration
|
||||
|
||||
As an application author, you can *optionally* register a preferred `Promise` implementation on application startup (before any call to `require('any-promise')`:
|
||||
|
||||
You must register your preference before any call to `require('any-promise')` (by you or required packages), and only one implementation can be registered. Typically, this registration would occur at the top of the application entry point.
|
||||
|
||||
|
||||
#### Registration shortcuts
|
||||
|
||||
If you are using a known `Promise` implementation, you can register your preference with a shortcut:
|
||||
|
||||
|
||||
```js
|
||||
require('any-promise/register/bluebird')
|
||||
// -or-
|
||||
import 'any-promise/register/q';
|
||||
```
|
||||
|
||||
Shortcut registration is the preferred registration method as it works in the browser and Node.js. It is also convenient for using with `import` and many test runners, that offer a `--require` flag:
|
||||
|
||||
```
|
||||
$ ava --require=any-promise/register/bluebird test.js
|
||||
```
|
||||
|
||||
Current known implementations include `bluebird`, `q`, `when`, `rsvp`, `es6-promise`, `promise`, `native-promise-only`, `pinkie`, `vow` and `lie`. If you are not using a known implementation, you can use another registration method described below.
|
||||
|
||||
|
||||
#### Basic Registration
|
||||
|
||||
As an alternative to registration shortcuts, you can call the `register` function with the preferred `Promise` implementation. The benefit of this approach is that a `Promise` library can be required by name without being a known implementation. This approach does NOT work in the browser. To use `any-promise` in the browser use either registration shortcuts or specify the `Promise` constructor using advanced registration (see below).
|
||||
|
||||
```javascript
|
||||
require('any-promise/register')('when')
|
||||
// -or- require('any-promise/register')('any other ES6 compatible library (known or otherwise)')
|
||||
```
|
||||
|
||||
This registration method will try to detect the `Promise` constructor from requiring the specified implementation. If you would like to specify your own constructor, see advanced registration.
|
||||
|
||||
|
||||
#### Advanced Registration
|
||||
|
||||
To use the browser version, you should either install a polyfill or explicitly register the `Promise` constructor:
|
||||
|
||||
```javascript
|
||||
require('any-promise/register')('bluebird', {Promise: require('bluebird')})
|
||||
```
|
||||
|
||||
This could also be used for registering a custom `Promise` implementation or subclass.
|
||||
|
||||
Your preference will be registered globally, allowing a single registration even if multiple versions of `any-promise` are installed in the NPM dependency tree or are using multiple bundled JavaScript files in the browser. You can bypass this global registration in options:
|
||||
|
||||
|
||||
```javascript
|
||||
require('../register')('es6-promise', {Promise: require('es6-promise').Promise, global: false})
|
||||
```
|
||||
|
||||
### Library Usage
|
||||
|
||||
To use any `Promise` constructor, simply require it:
|
||||
|
||||
```javascript
|
||||
var Promise = require('any-promise');
|
||||
|
||||
return Promise
|
||||
.all([xf, f, init, coll])
|
||||
.then(fn);
|
||||
|
||||
|
||||
return new Promise(function(resolve, reject){
|
||||
try {
|
||||
resolve(item);
|
||||
} catch(e){
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
Except noted below, libraries using `any-promise` should only use [documented](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) functions as there is no guarantee which implementation will be chosen by the application author. Libraries should never call `register`, only the application user should call if desired.
|
||||
|
||||
|
||||
#### Advanced Library Usage
|
||||
|
||||
If your library needs to branch code based on the registered implementation, you can retrieve it using `var impl = require('any-promise/implementation')`, where `impl` will be the package name (`"bluebird"`, `"when"`, etc.) if registered, `"global.Promise"` if using the global version on Node.js, or `"window.Promise"` if using the browser version. You should always include a default case, as there is no guarantee what package may be registered.
|
||||
|
||||
|
||||
### Support for old Node.js versions
|
||||
|
||||
Node.js versions prior to `v0.12` may have contained buggy versions of the global `Promise`. For this reason, the global `Promise` is not loaded automatically for these old versions. If using `any-promise` in Node.js versions versions `<= v0.12`, the user should register a desired implementation.
|
||||
|
||||
If an implementation is not registered, `any-promise` will attempt to discover an installed `Promise` implementation. If no implementation can be found, an error will be thrown on `require('any-promise')`. While the auto-discovery usually avoids errors, it is non-deterministic. It is recommended that the user always register a preferred implementation for older Node.js versions.
|
||||
|
||||
This auto-discovery is only available for Node.jS versions prior to `v0.12`. Any newer versions will always default to the global `Promise` implementation.
|
||||
|
||||
### Related
|
||||
|
||||
- [any-observable](https://github.com/sindresorhus/any-observable) - `any-promise` for Observables.
|
||||
|
||||
3
client/node_modules/any-promise/implementation.d.ts
generated
vendored
3
client/node_modules/any-promise/implementation.d.ts
generated
vendored
@@ -1,3 +0,0 @@
|
||||
declare var implementation: string;
|
||||
|
||||
export = implementation;
|
||||
1
client/node_modules/any-promise/implementation.js
generated
vendored
1
client/node_modules/any-promise/implementation.js
generated
vendored
@@ -1 +0,0 @@
|
||||
module.exports = require('./register')().implementation
|
||||
73
client/node_modules/any-promise/index.d.ts
generated
vendored
73
client/node_modules/any-promise/index.d.ts
generated
vendored
@@ -1,73 +0,0 @@
|
||||
declare class Promise <R> implements Promise.Thenable <R> {
|
||||
/**
|
||||
* If you call resolve in the body of the callback passed to the constructor,
|
||||
* your promise is fulfilled with result object passed to resolve.
|
||||
* If you call reject your promise is rejected with the object passed to resolve.
|
||||
* For consistency and debugging (eg stack traces), obj should be an instanceof Error.
|
||||
* Any errors thrown in the constructor callback will be implicitly passed to reject().
|
||||
*/
|
||||
constructor (callback: (resolve : (value?: R | Promise.Thenable<R>) => void, reject: (error?: any) => void) => void);
|
||||
|
||||
/**
|
||||
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
|
||||
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
|
||||
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
|
||||
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
|
||||
* If an error is thrown in the callback, the returned promise rejects with that error.
|
||||
*
|
||||
* @param onFulfilled called when/if "promise" resolves
|
||||
* @param onRejected called when/if "promise" rejects
|
||||
*/
|
||||
then <U> (onFulfilled?: (value: R) => U | Promise.Thenable<U>, onRejected?: (error: any) => U | Promise.Thenable<U>): Promise<U>;
|
||||
then <U> (onFulfilled?: (value: R) => U | Promise.Thenable<U>, onRejected?: (error: any) => void): Promise<U>;
|
||||
|
||||
/**
|
||||
* Sugar for promise.then(undefined, onRejected)
|
||||
*
|
||||
* @param onRejected called when/if "promise" rejects
|
||||
*/
|
||||
catch <U> (onRejected?: (error: any) => U | Promise.Thenable<U>): Promise<U>;
|
||||
|
||||
/**
|
||||
* Make a new promise from the thenable.
|
||||
* A thenable is promise-like in as far as it has a "then" method.
|
||||
*/
|
||||
static resolve (): Promise<void>;
|
||||
static resolve <R> (value: R | Promise.Thenable<R>): Promise<R>;
|
||||
|
||||
/**
|
||||
* Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error
|
||||
*/
|
||||
static reject <R> (error: any): Promise<R>;
|
||||
|
||||
/**
|
||||
* Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects.
|
||||
* the array passed to all can be a mixture of promise-like objects and other objects.
|
||||
* The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value.
|
||||
*/
|
||||
static all <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> (values: [T1 | Promise.Thenable<T1>, T2 | Promise.Thenable<T2>, T3 | Promise.Thenable<T3>, T4 | Promise.Thenable <T4>, T5 | Promise.Thenable<T5>, T6 | Promise.Thenable<T6>, T7 | Promise.Thenable<T7>, T8 | Promise.Thenable<T8>, T9 | Promise.Thenable<T9>, T10 | Promise.Thenable<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
|
||||
static all <T1, T2, T3, T4, T5, T6, T7, T8, T9> (values: [T1 | Promise.Thenable<T1>, T2 | Promise.Thenable<T2>, T3 | Promise.Thenable<T3>, T4 | Promise.Thenable <T4>, T5 | Promise.Thenable<T5>, T6 | Promise.Thenable<T6>, T7 | Promise.Thenable<T7>, T8 | Promise.Thenable<T8>, T9 | Promise.Thenable<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
|
||||
static all <T1, T2, T3, T4, T5, T6, T7, T8> (values: [T1 | Promise.Thenable<T1>, T2 | Promise.Thenable<T2>, T3 | Promise.Thenable<T3>, T4 | Promise.Thenable <T4>, T5 | Promise.Thenable<T5>, T6 | Promise.Thenable<T6>, T7 | Promise.Thenable<T7>, T8 | Promise.Thenable<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
|
||||
static all <T1, T2, T3, T4, T5, T6, T7> (values: [T1 | Promise.Thenable<T1>, T2 | Promise.Thenable<T2>, T3 | Promise.Thenable<T3>, T4 | Promise.Thenable <T4>, T5 | Promise.Thenable<T5>, T6 | Promise.Thenable<T6>, T7 | Promise.Thenable<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
|
||||
static all <T1, T2, T3, T4, T5, T6> (values: [T1 | Promise.Thenable<T1>, T2 | Promise.Thenable<T2>, T3 | Promise.Thenable<T3>, T4 | Promise.Thenable <T4>, T5 | Promise.Thenable<T5>, T6 | Promise.Thenable<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
|
||||
static all <T1, T2, T3, T4, T5> (values: [T1 | Promise.Thenable<T1>, T2 | Promise.Thenable<T2>, T3 | Promise.Thenable<T3>, T4 | Promise.Thenable <T4>, T5 | Promise.Thenable<T5>]): Promise<[T1, T2, T3, T4, T5]>;
|
||||
static all <T1, T2, T3, T4> (values: [T1 | Promise.Thenable<T1>, T2 | Promise.Thenable<T2>, T3 | Promise.Thenable<T3>, T4 | Promise.Thenable <T4>]): Promise<[T1, T2, T3, T4]>;
|
||||
static all <T1, T2, T3> (values: [T1 | Promise.Thenable<T1>, T2 | Promise.Thenable<T2>, T3 | Promise.Thenable<T3>]): Promise<[T1, T2, T3]>;
|
||||
static all <T1, T2> (values: [T1 | Promise.Thenable<T1>, T2 | Promise.Thenable<T2>]): Promise<[T1, T2]>;
|
||||
static all <T1> (values: [T1 | Promise.Thenable<T1>]): Promise<[T1]>;
|
||||
static all <TAll> (values: Array<TAll | Promise.Thenable<TAll>>): Promise<TAll[]>;
|
||||
|
||||
/**
|
||||
* Make a Promise that fulfills when any item fulfills, and rejects if any item rejects.
|
||||
*/
|
||||
static race <R> (promises: (R | Promise.Thenable<R>)[]): Promise<R>;
|
||||
}
|
||||
|
||||
declare namespace Promise {
|
||||
export interface Thenable <R> {
|
||||
then <U> (onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
|
||||
then <U> (onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => void): Thenable<U>;
|
||||
}
|
||||
}
|
||||
|
||||
export = Promise;
|
||||
1
client/node_modules/any-promise/index.js
generated
vendored
1
client/node_modules/any-promise/index.js
generated
vendored
@@ -1 +0,0 @@
|
||||
module.exports = require('./register')().Promise
|
||||
78
client/node_modules/any-promise/loader.js
generated
vendored
78
client/node_modules/any-promise/loader.js
generated
vendored
@@ -1,78 +0,0 @@
|
||||
"use strict"
|
||||
// global key for user preferred registration
|
||||
var REGISTRATION_KEY = '@@any-promise/REGISTRATION',
|
||||
// Prior registration (preferred or detected)
|
||||
registered = null
|
||||
|
||||
/**
|
||||
* Registers the given implementation. An implementation must
|
||||
* be registered prior to any call to `require("any-promise")`,
|
||||
* typically on application load.
|
||||
*
|
||||
* If called with no arguments, will return registration in
|
||||
* following priority:
|
||||
*
|
||||
* For Node.js:
|
||||
*
|
||||
* 1. Previous registration
|
||||
* 2. global.Promise if node.js version >= 0.12
|
||||
* 3. Auto detected promise based on first sucessful require of
|
||||
* known promise libraries. Note this is a last resort, as the
|
||||
* loaded library is non-deterministic. node.js >= 0.12 will
|
||||
* always use global.Promise over this priority list.
|
||||
* 4. Throws error.
|
||||
*
|
||||
* For Browser:
|
||||
*
|
||||
* 1. Previous registration
|
||||
* 2. window.Promise
|
||||
* 3. Throws error.
|
||||
*
|
||||
* Options:
|
||||
*
|
||||
* Promise: Desired Promise constructor
|
||||
* global: Boolean - Should the registration be cached in a global variable to
|
||||
* allow cross dependency/bundle registration? (default true)
|
||||
*/
|
||||
module.exports = function(root, loadImplementation){
|
||||
return function register(implementation, opts){
|
||||
implementation = implementation || null
|
||||
opts = opts || {}
|
||||
// global registration unless explicitly {global: false} in options (default true)
|
||||
var registerGlobal = opts.global !== false;
|
||||
|
||||
// load any previous global registration
|
||||
if(registered === null && registerGlobal){
|
||||
registered = root[REGISTRATION_KEY] || null
|
||||
}
|
||||
|
||||
if(registered !== null
|
||||
&& implementation !== null
|
||||
&& registered.implementation !== implementation){
|
||||
// Throw error if attempting to redefine implementation
|
||||
throw new Error('any-promise already defined as "'+registered.implementation+
|
||||
'". You can only register an implementation before the first '+
|
||||
' call to require("any-promise") and an implementation cannot be changed')
|
||||
}
|
||||
|
||||
if(registered === null){
|
||||
// use provided implementation
|
||||
if(implementation !== null && typeof opts.Promise !== 'undefined'){
|
||||
registered = {
|
||||
Promise: opts.Promise,
|
||||
implementation: implementation
|
||||
}
|
||||
} else {
|
||||
// require implementation if implementation is specified but not provided
|
||||
registered = loadImplementation(implementation)
|
||||
}
|
||||
|
||||
if(registerGlobal){
|
||||
// register preference globally in case multiple installations
|
||||
root[REGISTRATION_KEY] = registered
|
||||
}
|
||||
}
|
||||
|
||||
return registered
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user