This commit is contained in:
Simon Priet
2021-09-05 22:53:58 +02:00
commit 9e2991e668
17888 changed files with 1263126 additions and 0 deletions

12
node_modules/syntax-error/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,12 @@
language: node_js
node_js:
- stable
- 8
- 6
- 4
- "iojs"
- "0.12"
- "0.10"
- "0.8"
before_install:
- nvm install-latest-npm

18
node_modules/syntax-error/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,18 @@
This software is released under the MIT license:
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
node_modules/syntax-error/example/check.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
var fs = require('fs');
var check = require('../');
var file = __dirname + '/src.js';
var src = fs.readFileSync(file);
var err = check(src, file);
if (err) {
console.error('ERROR DETECTED' + Array(62).join('!'));
console.error(err);
console.error(Array(76).join('-'));
}

9
node_modules/syntax-error/example/src.js generated vendored Normal file
View File

@@ -0,0 +1,9 @@
module.exports = function (xs, fn) {
var res = [];
for (var i = 0; i < xs.length; i++) {
var x = fn(xs[i], i);
if (Array.isArray(x) res.push.apply(res, x);
else res.push(x);
}
return res;
};

57
node_modules/syntax-error/index.js generated vendored Normal file
View File

@@ -0,0 +1,57 @@
var aparse = require('acorn-node').parse;
function parse (src, opts) {
if (!opts) opts = {}
return aparse(src, opts);
}
module.exports = function (src, file,opts) {
if (typeof src !== 'string') src = String(src);
try {
eval('throw "STOP"; (function () { ' + src + '\n})()');
return;
}
catch (err) {
if (err === 'STOP') return undefined;
if (err.constructor.name !== 'SyntaxError') return err;
return errorInfo(src, file, opts);
}
};
function errorInfo (src, file, opts) {
try { parse(src,opts) }
catch (err) {
return new ParseError(err, src, file);
}
return undefined;
}
function ParseError (err, src, file) {
SyntaxError.call(this);
this.message = err.message.replace(/\s+\(\d+:\d+\)$/, '');
this.line = err.loc.line;
this.column = err.loc.column + 1;
this.annotated = '\n'
+ (file || '(anonymous file)')
+ ':' + this.line
+ '\n'
+ src.split('\n')[this.line - 1]
+ '\n'
+ Array(this.column).join(' ') + '^'
+ '\n'
+ 'ParseError: ' + this.message
;
}
ParseError.prototype = Object.create(SyntaxError.prototype);
ParseError.prototype.toString = function () {
return this.annotated;
};
ParseError.prototype.inspect = function () {
return this.annotated;
};

37
node_modules/syntax-error/package.json generated vendored Normal file
View File

@@ -0,0 +1,37 @@
{
"name": "syntax-error",
"version": "1.4.0",
"description": "detect and report syntax errors in source code strings",
"main": "index.js",
"dependencies": {
"acorn-node": "^1.2.0"
},
"devDependencies": {
"tap": "^1.1.0"
},
"scripts": {
"test": "tap test/*.js"
},
"repository": {
"type": "git",
"url": "git://github.com/substack/node-syntax-error.git"
},
"homepage": "https://github.com/substack/node-syntax-error",
"keywords": [
"syntax",
"error",
"esprima",
"stack",
"line",
"column"
],
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
"url": "http://substack.net"
},
"license": "MIT",
"engine": {
"node": ">=0.6"
}
}

90
node_modules/syntax-error/readme.markdown generated vendored Normal file
View File

@@ -0,0 +1,90 @@
# syntax-error
Detect and report syntax errors in source code strings.
[![build status](https://secure.travis-ci.org/substack/node-syntax-error.png)](http://travis-ci.org/substack/node-syntax-error)
When you type `node src.js` you get a friendly error report about exactly where
the syntax error is. This module lets you check for syntax errors and report
them in a similarly friendly format that wrapping a try/catch around
`Function()` or `vm.runInNewContext()` doesn't get you.
# example
``` js
var fs = require('fs');
var check = require('syntax-error');
var file = __dirname + '/src.js';
var src = fs.readFileSync(file);
var err = check(src, file);
if (err) {
console.error('ERROR DETECTED' + Array(62).join('!'));
console.error(err);
console.error(Array(76).join('-'));
}
```
---
```
$ node check.js
ERROR DETECTED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
/home/substack/projects/node-syntax-error/example/src.js:5
if (Array.isArray(x) res.push.apply(res, x);
^
ParseError: Unexpected identifier
---------------------------------------------------------------------------
```
# methods
``` js
var check = require('syntax-error')
```
## var err = check(src, file, opts={})
Check the source code string `src` for syntax errors.
Optionally you can specify a filename `file` that will show up in the output.
If `src` has a syntax error, return an error object `err` that can be printed or
stringified.
If there are no syntax errors in `src`, return `undefined`.
Options will be passed through to [acorn-node](https://github.com/browserify/acorn-node).
acorn-node defaults to options that match the most recent Node versions.
## err.toString()
Return the long string description with a source snippet and a `^` under
pointing exactly where the error was detected.
# attributes
## err.message
short string description of the error type
## err.line
line number of the error in the original source (indexing starts at 1)
## err.column
column number of the error in the original source (indexing starts at 1)
# install
With [npm](http://npmjs.org) do:
```
npm install syntax-error
```
# license
MIT

17
node_modules/syntax-error/test/check.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
var test = require('tap').test;
var fs = require('fs');
var check = require('../');
var file = __dirname + '/sources/check.js';
var src = fs.readFileSync(file);
test('check', function (t) {
var err = check(src, file);
t.ok(err);
t.equal(err.line, 5);
t.equal(err.column, 30);
t.equal(err.message, 'Unexpected token');
t.ok(String(err).indexOf(file + ':5'));
t.end();
});

23
node_modules/syntax-error/test/esm.js generated vendored Normal file
View File

@@ -0,0 +1,23 @@
var test = require('tap').test;
var fs = require('fs');
var check = require('../');
var file = __dirname + '/sources/esm.js';
var src = fs.readFileSync(file);
test('esm with sourceType script', function (t) {
var err = check(src, file);
t.ok(err);
t.equal(err.line, 1);
t.equal(err.column, 1);
t.equal(err.message, "'import' and 'export' may appear only with 'sourceType: module'");
t.ok(String(err).indexOf(file + ':1'));
t.end();
});
test('esm with sourceType module', function (t) {
var err = check(src, file, { sourceType: 'module' });
t.notOk(err);
t.end();
});

16
node_modules/syntax-error/test/html.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
var test = require('tap').test;
var fs = require('fs');
var check = require('../');
var src = '<html></html>';
test('html', function (t) {
var err = check(src, 'foo.js');
t.ok(err);
t.equal(err.line, 1);
t.equal(err.column, 1);
t.equal(err.message, 'Unexpected token');
t.ok(/foo.js:1/.test(err), 'foo.js:1');
t.end();
});

13
node_modules/syntax-error/test/ok.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
var test = require('tap').test;
var fs = require('fs');
var check = require('../');
var file = __dirname + '/sources/ok.js';
var src = fs.readFileSync(file);
test('ok', function (t) {
var err = check(src, file);
t.notOk(err);
t.end();
});

12
node_modules/syntax-error/test/run.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
var test = require('tap').test;
var check = require('../');
var fs = require('fs');
var file = __dirname + '/sources/run.js';
var src = fs.readFileSync(file);
test('do not run sources', function (t) {
t.plan(1);
var err = check(src, file);
t.notOk(err);
});

12
node_modules/syntax-error/test/run2.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
var test = require('tap').test;
var check = require('../');
var fs = require('fs');
var file = __dirname + '/sources/run2.js';
var src = fs.readFileSync(file);
test('do not run sources (2)', function (t) {
t.plan(1);
var err = check(src, file);
t.notOk(err);
});

13
node_modules/syntax-error/test/shebang.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
var test = require('tap').test;
var fs = require('fs');
var check = require('../');
var file = __dirname + '/sources/shebang.js';
var src = fs.readFileSync(file);
test('shebang', function (t) {
var err = check(src, file);
t.notOk(err);
t.end();
});

9
node_modules/syntax-error/test/sources/check.js generated vendored Normal file
View File

@@ -0,0 +1,9 @@
module.exports = function (xs, fn) {
var res = [];
for (var i = 0; i < xs.length; i++) {
var x = fn(xs[i], i);
if (Array.isArray(x) res.push.apply(res, x);
else res.push(x);
}
return res;
};

2
node_modules/syntax-error/test/sources/esm.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import x from 'y';
export default z;

1
node_modules/syntax-error/test/sources/ok.js generated vendored Normal file
View File

@@ -0,0 +1 @@
function f () {}

1
node_modules/syntax-error/test/sources/run.js generated vendored Normal file
View File

@@ -0,0 +1 @@
process.exit(1);

3
node_modules/syntax-error/test/sources/run2.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
})();
process.exit(1);
(function () {

2
node_modules/syntax-error/test/sources/shebang.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env node
console.log('foo');

2
node_modules/syntax-error/test/sources/spread.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
var a = { ...b }
;({ d, ...e } = a)

13
node_modules/syntax-error/test/sources/yield.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
function *foo () {
yield 5
}
(function *() {
console.log(foo().next().value)
})().next();
(function *() { })();
(function * () {
yield yield 3
})();

13
node_modules/syntax-error/test/spread.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
var test = require('tap').test;
var fs = require('fs');
var check = require('../');
var file = __dirname + '/sources/spread.js';
var src = fs.readFileSync(file);
test('spread', function (t) {
var err = check(src, file);
t.notOk(err);
t.end();
});

13
node_modules/syntax-error/test/yield.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
var test = require('tap').test;
var fs = require('fs');
var check = require('../');
var file = __dirname + '/sources/yield.js';
var src = fs.readFileSync(file);
test('yield', function (t) {
var err = check(src, file);
t.notOk(err);
t.end();
});