mirror of
https://github.com/github/codeql-action.git
synced 2025-12-30 03:00:13 +08:00
Regenerating node_modules
This commit is contained in:
48
node_modules/read-pkg-up/node_modules/find-up/index.js
generated
vendored
Normal file
48
node_modules/read-pkg-up/node_modules/find-up/index.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const locatePath = require('locate-path');
|
||||
|
||||
module.exports = (filename, opts) => {
|
||||
opts = opts || {};
|
||||
|
||||
const startDir = path.resolve(opts.cwd || '');
|
||||
const root = path.parse(startDir).root;
|
||||
|
||||
const filenames = [].concat(filename);
|
||||
|
||||
return new Promise(resolve => {
|
||||
(function find(dir) {
|
||||
locatePath(filenames, {cwd: dir}).then(file => {
|
||||
if (file) {
|
||||
resolve(path.join(dir, file));
|
||||
} else if (dir === root) {
|
||||
resolve(null);
|
||||
} else {
|
||||
find(path.dirname(dir));
|
||||
}
|
||||
});
|
||||
})(startDir);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.sync = (filename, opts) => {
|
||||
opts = opts || {};
|
||||
|
||||
let dir = path.resolve(opts.cwd || '');
|
||||
const root = path.parse(dir).root;
|
||||
|
||||
const filenames = [].concat(filename);
|
||||
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
const file = locatePath.sync(filenames, {cwd: dir});
|
||||
|
||||
if (file) {
|
||||
return path.join(dir, file);
|
||||
} else if (dir === root) {
|
||||
return null;
|
||||
}
|
||||
|
||||
dir = path.dirname(dir);
|
||||
}
|
||||
};
|
||||
21
node_modules/read-pkg-up/node_modules/find-up/license
generated
vendored
Normal file
21
node_modules/read-pkg-up/node_modules/find-up/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
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.
|
||||
53
node_modules/read-pkg-up/node_modules/find-up/package.json
generated
vendored
Normal file
53
node_modules/read-pkg-up/node_modules/find-up/package.json
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"name": "find-up",
|
||||
"version": "2.1.0",
|
||||
"description": "Find a file by walking up parent directories",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/find-up",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"find",
|
||||
"up",
|
||||
"find-up",
|
||||
"findup",
|
||||
"look-up",
|
||||
"look",
|
||||
"file",
|
||||
"search",
|
||||
"match",
|
||||
"package",
|
||||
"resolve",
|
||||
"parent",
|
||||
"parents",
|
||||
"folder",
|
||||
"directory",
|
||||
"dir",
|
||||
"walk",
|
||||
"walking",
|
||||
"path"
|
||||
],
|
||||
"dependencies": {
|
||||
"locate-path": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"tempfile": "^1.1.1",
|
||||
"xo": "*"
|
||||
},
|
||||
"xo": {
|
||||
"esnext": true
|
||||
}
|
||||
}
|
||||
85
node_modules/read-pkg-up/node_modules/find-up/readme.md
generated
vendored
Normal file
85
node_modules/read-pkg-up/node_modules/find-up/readme.md
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
# find-up [](https://travis-ci.org/sindresorhus/find-up) [](https://ci.appveyor.com/project/sindresorhus/find-up/branch/master)
|
||||
|
||||
> Find a file by walking up parent directories
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save find-up
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
/
|
||||
└── Users
|
||||
└── sindresorhus
|
||||
├── unicorn.png
|
||||
└── foo
|
||||
└── bar
|
||||
├── baz
|
||||
└── example.js
|
||||
```
|
||||
|
||||
```js
|
||||
// example.js
|
||||
const findUp = require('find-up');
|
||||
|
||||
findUp('unicorn.png').then(filepath => {
|
||||
console.log(filepath);
|
||||
//=> '/Users/sindresorhus/unicorn.png'
|
||||
});
|
||||
|
||||
findUp(['rainbow.png', 'unicorn.png']).then(filepath => {
|
||||
console.log(filepath);
|
||||
//=> '/Users/sindresorhus/unicorn.png'
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### findUp(filename, [options])
|
||||
|
||||
Returns a `Promise` for the filepath or `null`.
|
||||
|
||||
### findUp([filenameA, filenameB], [options])
|
||||
|
||||
Returns a `Promise` for the first filepath found (by respecting the order) or `null`.
|
||||
|
||||
### findUp.sync(filename, [options])
|
||||
|
||||
Returns a filepath or `null`.
|
||||
|
||||
### findUp.sync([filenameA, filenameB], [options])
|
||||
|
||||
Returns the first filepath found (by respecting the order) or `null`.
|
||||
|
||||
#### filename
|
||||
|
||||
Type: `string`
|
||||
|
||||
Filename of the file to find.
|
||||
|
||||
#### options
|
||||
|
||||
##### cwd
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `process.cwd()`
|
||||
|
||||
Directory to start from.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [find-up-cli](https://github.com/sindresorhus/find-up-cli) - CLI for this module
|
||||
- [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file
|
||||
- [pkg-dir](https://github.com/sindresorhus/pkg-dir) - Find the root directory of an npm package
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
11
node_modules/read-pkg-up/node_modules/load-json-file/index.js
generated
vendored
Normal file
11
node_modules/read-pkg-up/node_modules/load-json-file/index.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const fs = require('graceful-fs');
|
||||
const stripBom = require('strip-bom');
|
||||
const parseJson = require('parse-json');
|
||||
const pify = require('pify');
|
||||
|
||||
const parse = (data, fp) => parseJson(stripBom(data), path.relative('.', fp));
|
||||
|
||||
module.exports = fp => pify(fs.readFile)(fp, 'utf8').then(data => parse(data, fp));
|
||||
module.exports.sync = fp => parse(fs.readFileSync(fp, 'utf8'), fp);
|
||||
21
node_modules/read-pkg-up/node_modules/load-json-file/license
generated
vendored
Normal file
21
node_modules/read-pkg-up/node_modules/load-json-file/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
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.
|
||||
43
node_modules/read-pkg-up/node_modules/load-json-file/package.json
generated
vendored
Normal file
43
node_modules/read-pkg-up/node_modules/load-json-file/package.json
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "load-json-file",
|
||||
"version": "2.0.0",
|
||||
"description": "Read and parse a JSON file",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/load-json-file",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"read",
|
||||
"json",
|
||||
"parse",
|
||||
"file",
|
||||
"fs",
|
||||
"graceful",
|
||||
"load"
|
||||
],
|
||||
"dependencies": {
|
||||
"graceful-fs": "^4.1.2",
|
||||
"parse-json": "^2.2.0",
|
||||
"pify": "^2.0.0",
|
||||
"strip-bom": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"xo": {
|
||||
"esnext": true
|
||||
}
|
||||
}
|
||||
45
node_modules/read-pkg-up/node_modules/load-json-file/readme.md
generated
vendored
Normal file
45
node_modules/read-pkg-up/node_modules/load-json-file/readme.md
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
# load-json-file [](https://travis-ci.org/sindresorhus/load-json-file)
|
||||
|
||||
> Read and parse a JSON file
|
||||
|
||||
[Strips UTF-8 BOM](https://github.com/sindresorhus/strip-bom), uses [`graceful-fs`](https://github.com/isaacs/node-graceful-fs), and throws more [helpful JSON errors](https://github.com/sindresorhus/parse-json).
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save load-json-file
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const loadJsonFile = require('load-json-file');
|
||||
|
||||
loadJsonFile('foo.json').then(json => {
|
||||
console.log(json);
|
||||
//=> {foo: true}
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### loadJsonFile(filepath)
|
||||
|
||||
Returns a promise for the parsed JSON.
|
||||
|
||||
### loadJsonFile.sync(filepath)
|
||||
|
||||
Returns the parsed JSON.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [write-json-file](https://github.com/sindresorhus/write-json-file) - Stringify and write JSON to a file atomically
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
24
node_modules/read-pkg-up/node_modules/locate-path/index.js
generated
vendored
Normal file
24
node_modules/read-pkg-up/node_modules/locate-path/index.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const pathExists = require('path-exists');
|
||||
const pLocate = require('p-locate');
|
||||
|
||||
module.exports = (iterable, opts) => {
|
||||
opts = Object.assign({
|
||||
cwd: process.cwd()
|
||||
}, opts);
|
||||
|
||||
return pLocate(iterable, el => pathExists(path.resolve(opts.cwd, el)), opts);
|
||||
};
|
||||
|
||||
module.exports.sync = (iterable, opts) => {
|
||||
opts = Object.assign({
|
||||
cwd: process.cwd()
|
||||
}, opts);
|
||||
|
||||
for (const el of iterable) {
|
||||
if (pathExists.sync(path.resolve(opts.cwd, el))) {
|
||||
return el;
|
||||
}
|
||||
}
|
||||
};
|
||||
21
node_modules/read-pkg-up/node_modules/locate-path/license
generated
vendored
Normal file
21
node_modules/read-pkg-up/node_modules/locate-path/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
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.
|
||||
47
node_modules/read-pkg-up/node_modules/locate-path/package.json
generated
vendored
Normal file
47
node_modules/read-pkg-up/node_modules/locate-path/package.json
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "locate-path",
|
||||
"version": "2.0.0",
|
||||
"description": "Get the first path that exists on disk of multiple paths",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/locate-path",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"locate",
|
||||
"path",
|
||||
"paths",
|
||||
"file",
|
||||
"files",
|
||||
"exists",
|
||||
"find",
|
||||
"finder",
|
||||
"search",
|
||||
"searcher",
|
||||
"array",
|
||||
"iterable",
|
||||
"iterator"
|
||||
],
|
||||
"dependencies": {
|
||||
"p-locate": "^2.0.0",
|
||||
"path-exists": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"xo": {
|
||||
"esnext": true
|
||||
}
|
||||
}
|
||||
99
node_modules/read-pkg-up/node_modules/locate-path/readme.md
generated
vendored
Normal file
99
node_modules/read-pkg-up/node_modules/locate-path/readme.md
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
# locate-path [](https://travis-ci.org/sindresorhus/locate-path)
|
||||
|
||||
> Get the first path that exists on disk of multiple paths
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save locate-path
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Here we find the first file that exists on disk, in array order.
|
||||
|
||||
```js
|
||||
const locatePath = require('locate-path');
|
||||
|
||||
const files = [
|
||||
'unicorn.png',
|
||||
'rainbow.png', // only this one actually exists on disk
|
||||
'pony.png'
|
||||
];
|
||||
|
||||
locatePath(files).then(foundPath => {
|
||||
console.log(foundPath);
|
||||
//=> 'rainbow'
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### locatePath(input, [options])
|
||||
|
||||
Returns a `Promise` for the first path that exists or `undefined` if none exists.
|
||||
|
||||
#### input
|
||||
|
||||
Type: `Iterable<string>`
|
||||
|
||||
Paths to check.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### concurrency
|
||||
|
||||
Type: `number`<br>
|
||||
Default: `Infinity`<br>
|
||||
Minimum: `1`
|
||||
|
||||
Number of concurrently pending promises.
|
||||
|
||||
##### preserveOrder
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
Preserve `input` order when searching.
|
||||
|
||||
Disable this to improve performance if you don't care about the order.
|
||||
|
||||
##### cwd
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `process.cwd()`
|
||||
|
||||
Current working directory.
|
||||
|
||||
### locatePath.sync(input, [options])
|
||||
|
||||
Returns the first path that exists or `undefined` if none exists.
|
||||
|
||||
#### input
|
||||
|
||||
Type: `Iterable<string>`
|
||||
|
||||
Paths to check.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### cwd
|
||||
|
||||
Same as above.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [path-exists](https://github.com/sindresorhus/path-exists) - Check if a path exists
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
42
node_modules/read-pkg-up/node_modules/p-limit/index.js
generated
vendored
Normal file
42
node_modules/read-pkg-up/node_modules/p-limit/index.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
'use strict';
|
||||
const pTry = require('p-try');
|
||||
|
||||
module.exports = concurrency => {
|
||||
if (concurrency < 1) {
|
||||
throw new TypeError('Expected `concurrency` to be a number from 1 and up');
|
||||
}
|
||||
|
||||
const queue = [];
|
||||
let activeCount = 0;
|
||||
|
||||
const next = () => {
|
||||
activeCount--;
|
||||
|
||||
if (queue.length > 0) {
|
||||
queue.shift()();
|
||||
}
|
||||
};
|
||||
|
||||
return fn => new Promise((resolve, reject) => {
|
||||
const run = () => {
|
||||
activeCount++;
|
||||
|
||||
pTry(fn).then(
|
||||
val => {
|
||||
resolve(val);
|
||||
next();
|
||||
},
|
||||
err => {
|
||||
reject(err);
|
||||
next();
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
if (activeCount < concurrency) {
|
||||
run();
|
||||
} else {
|
||||
queue.push(run);
|
||||
}
|
||||
});
|
||||
};
|
||||
9
node_modules/read-pkg-up/node_modules/p-limit/license
generated
vendored
Normal file
9
node_modules/read-pkg-up/node_modules/p-limit/license
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
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.
|
||||
49
node_modules/read-pkg-up/node_modules/p-limit/package.json
generated
vendored
Normal file
49
node_modules/read-pkg-up/node_modules/p-limit/package.json
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "p-limit",
|
||||
"version": "1.3.0",
|
||||
"description": "Run multiple promise-returning & async functions with limited concurrency",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/p-limit",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"promise",
|
||||
"limit",
|
||||
"limited",
|
||||
"concurrency",
|
||||
"throttle",
|
||||
"throat",
|
||||
"rate",
|
||||
"batch",
|
||||
"ratelimit",
|
||||
"task",
|
||||
"queue",
|
||||
"async",
|
||||
"await",
|
||||
"promises",
|
||||
"bluebird"
|
||||
],
|
||||
"dependencies": {
|
||||
"p-try": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"delay": "^2.0.0",
|
||||
"in-range": "^1.0.0",
|
||||
"random-int": "^1.0.0",
|
||||
"time-span": "^2.0.0",
|
||||
"xo": "*"
|
||||
}
|
||||
}
|
||||
69
node_modules/read-pkg-up/node_modules/p-limit/readme.md
generated
vendored
Normal file
69
node_modules/read-pkg-up/node_modules/p-limit/readme.md
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
# p-limit [](https://travis-ci.org/sindresorhus/p-limit)
|
||||
|
||||
> Run multiple promise-returning & async functions with limited concurrency
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install p-limit
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const pLimit = require('p-limit');
|
||||
|
||||
const limit = pLimit(1);
|
||||
|
||||
const input = [
|
||||
limit(() => fetchSomething('foo')),
|
||||
limit(() => fetchSomething('bar')),
|
||||
limit(() => doSomething())
|
||||
];
|
||||
|
||||
(async () => {
|
||||
// Only one promise is run at once
|
||||
const result = await Promise.all(input);
|
||||
console.log(result);
|
||||
})();
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### pLimit(concurrency)
|
||||
|
||||
Returns a `limit` function.
|
||||
|
||||
#### concurrency
|
||||
|
||||
Type: `number`<br>
|
||||
Minimum: `1`
|
||||
|
||||
Concurrency limit.
|
||||
|
||||
### limit(fn)
|
||||
|
||||
Returns the promise returned by calling `fn`.
|
||||
|
||||
#### fn
|
||||
|
||||
Type: `Function`
|
||||
|
||||
Promise-returning/async function.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [p-queue](https://github.com/sindresorhus/p-queue) - Promise queue with concurrency control
|
||||
- [p-throttle](https://github.com/sindresorhus/p-throttle) - Throttle promise-returning & async functions
|
||||
- [p-debounce](https://github.com/sindresorhus/p-debounce) - Debounce promise-returning & async functions
|
||||
- [p-all](https://github.com/sindresorhus/p-all) - Run promise-returning & async functions concurrently with optional limited concurrency
|
||||
- [More…](https://github.com/sindresorhus/promise-fun)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
31
node_modules/read-pkg-up/node_modules/p-locate/index.js
generated
vendored
Normal file
31
node_modules/read-pkg-up/node_modules/p-locate/index.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
'use strict';
|
||||
const pLimit = require('p-limit');
|
||||
|
||||
class EndError extends Error {
|
||||
constructor(value) {
|
||||
super();
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
// the input can also be a promise, so we `Promise.all()` them both
|
||||
const finder = el => Promise.all(el).then(val => val[1] === true && Promise.reject(new EndError(val[0])));
|
||||
|
||||
module.exports = (iterable, tester, opts) => {
|
||||
opts = Object.assign({
|
||||
concurrency: Infinity,
|
||||
preserveOrder: true
|
||||
}, opts);
|
||||
|
||||
const limit = pLimit(opts.concurrency);
|
||||
|
||||
// start all the promises concurrently with optional limit
|
||||
const items = Array.from(iterable).map(el => [el, limit(() => Promise.resolve(el).then(tester))]);
|
||||
|
||||
// check the promises either serially or concurrently
|
||||
const checkLimit = pLimit(opts.preserveOrder ? 1 : Infinity);
|
||||
|
||||
return Promise.all(items.map(el => checkLimit(() => finder(el))))
|
||||
.then(() => {})
|
||||
.catch(err => err instanceof EndError ? err.value : Promise.reject(err));
|
||||
};
|
||||
21
node_modules/read-pkg-up/node_modules/p-locate/license
generated
vendored
Normal file
21
node_modules/read-pkg-up/node_modules/p-locate/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
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.
|
||||
54
node_modules/read-pkg-up/node_modules/p-locate/package.json
generated
vendored
Normal file
54
node_modules/read-pkg-up/node_modules/p-locate/package.json
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"name": "p-locate",
|
||||
"version": "2.0.0",
|
||||
"description": "Get the first fulfilled promise that satisfies the provided testing function",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/p-locate",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"promise",
|
||||
"locate",
|
||||
"find",
|
||||
"finder",
|
||||
"search",
|
||||
"searcher",
|
||||
"test",
|
||||
"array",
|
||||
"collection",
|
||||
"iterable",
|
||||
"iterator",
|
||||
"race",
|
||||
"fulfilled",
|
||||
"fastest",
|
||||
"async",
|
||||
"await",
|
||||
"promises",
|
||||
"bluebird"
|
||||
],
|
||||
"dependencies": {
|
||||
"p-limit": "^1.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"delay": "^1.3.1",
|
||||
"in-range": "^1.0.0",
|
||||
"time-span": "^1.0.0",
|
||||
"xo": "*"
|
||||
},
|
||||
"xo": {
|
||||
"esnext": true
|
||||
}
|
||||
}
|
||||
86
node_modules/read-pkg-up/node_modules/p-locate/readme.md
generated
vendored
Normal file
86
node_modules/read-pkg-up/node_modules/p-locate/readme.md
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
# p-locate [](https://travis-ci.org/sindresorhus/p-locate)
|
||||
|
||||
> Get the first fulfilled promise that satisfies the provided testing function
|
||||
|
||||
Think of it like an async version of [`Array#find`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/find).
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save p-locate
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Here we find the first file that exists on disk, in array order.
|
||||
|
||||
```js
|
||||
const pathExists = require('path-exists');
|
||||
const pLocate = require('p-locate');
|
||||
|
||||
const files = [
|
||||
'unicorn.png',
|
||||
'rainbow.png', // only this one actually exists on disk
|
||||
'pony.png'
|
||||
];
|
||||
|
||||
pLocate(files, file => pathExists(file)).then(foundPath => {
|
||||
console.log(foundPath);
|
||||
//=> 'rainbow'
|
||||
});
|
||||
```
|
||||
|
||||
*The above is just an example. Use [`locate-path`](https://github.com/sindresorhus/locate-path) if you need this.*
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### pLocate(input, tester, [options])
|
||||
|
||||
Returns a `Promise` that is fulfilled when `tester` resolves to `true` or the iterable is done, or rejects if any of the promises reject. The fulfilled value is the current iterable value or `undefined` if `tester` never resolved to `true`.
|
||||
|
||||
#### input
|
||||
|
||||
Type: `Iterable<Promise|any>`
|
||||
|
||||
#### tester(element)
|
||||
|
||||
Type: `Function`
|
||||
|
||||
Expected to return a `Promise<boolean>` or boolean.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### concurrency
|
||||
|
||||
Type: `number`<br>
|
||||
Default: `Infinity`<br>
|
||||
Minimum: `1`
|
||||
|
||||
Number of concurrently pending promises returned by `tester`.
|
||||
|
||||
##### preserveOrder
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
Preserve `input` order when searching.
|
||||
|
||||
Disable this to improve performance if you don't care about the order.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently
|
||||
- [p-filter](https://github.com/sindresorhus/p-filter) - Filter promises concurrently
|
||||
- [p-any](https://github.com/sindresorhus/p-any) - Wait for any promise to be fulfilled
|
||||
- [More…](https://github.com/sindresorhus/promise-fun)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
4
node_modules/read-pkg-up/node_modules/p-try/index.js
generated
vendored
Normal file
4
node_modules/read-pkg-up/node_modules/p-try/index.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
module.exports = cb => new Promise(resolve => {
|
||||
resolve(cb());
|
||||
});
|
||||
21
node_modules/read-pkg-up/node_modules/p-try/license
generated
vendored
Normal file
21
node_modules/read-pkg-up/node_modules/p-try/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
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.
|
||||
43
node_modules/read-pkg-up/node_modules/p-try/package.json
generated
vendored
Normal file
43
node_modules/read-pkg-up/node_modules/p-try/package.json
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "p-try",
|
||||
"version": "1.0.0",
|
||||
"description": "`Promise#try()` ponyfill - Starts a promise chain",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/p-try",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"promise",
|
||||
"try",
|
||||
"resolve",
|
||||
"function",
|
||||
"catch",
|
||||
"async",
|
||||
"await",
|
||||
"promises",
|
||||
"settled",
|
||||
"ponyfill",
|
||||
"polyfill",
|
||||
"shim",
|
||||
"bluebird"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"xo": {
|
||||
"esnext": true
|
||||
}
|
||||
}
|
||||
38
node_modules/read-pkg-up/node_modules/p-try/readme.md
generated
vendored
Normal file
38
node_modules/read-pkg-up/node_modules/p-try/readme.md
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
# p-try [](https://travis-ci.org/sindresorhus/p-try)
|
||||
|
||||
> [`Promise#try()`](https://github.com/ljharb/proposal-promise-try) [ponyfill](https://ponyfill.com) - Starts a promise chain
|
||||
|
||||
[How is it useful?](http://cryto.net/~joepie91/blog/2016/05/11/what-is-promise-try-and-why-does-it-matter/)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save p-try
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const pTry = require('p-try');
|
||||
|
||||
pTry(() => {
|
||||
return synchronousFunctionThatMightThrow();
|
||||
}).then(value => {
|
||||
console.log(value);
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [p-finally](https://github.com/sindresorhus/p-finally) - `Promise#finally()` ponyfill - Invoked when the promise is settled regardless of outcome
|
||||
- [More…](https://github.com/sindresorhus/promise-fun)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
35
node_modules/read-pkg-up/node_modules/parse-json/index.js
generated
vendored
Normal file
35
node_modules/read-pkg-up/node_modules/parse-json/index.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
'use strict';
|
||||
var errorEx = require('error-ex');
|
||||
var fallback = require('./vendor/parse');
|
||||
|
||||
var JSONError = errorEx('JSONError', {
|
||||
fileName: errorEx.append('in %s')
|
||||
});
|
||||
|
||||
module.exports = function (x, reviver, filename) {
|
||||
if (typeof reviver === 'string') {
|
||||
filename = reviver;
|
||||
reviver = null;
|
||||
}
|
||||
|
||||
try {
|
||||
try {
|
||||
return JSON.parse(x, reviver);
|
||||
} catch (err) {
|
||||
fallback.parse(x, {
|
||||
mode: 'json',
|
||||
reviver: reviver
|
||||
});
|
||||
|
||||
throw err;
|
||||
}
|
||||
} catch (err) {
|
||||
var jsonErr = new JSONError(err);
|
||||
|
||||
if (filename) {
|
||||
jsonErr.fileName = filename;
|
||||
}
|
||||
|
||||
throw jsonErr;
|
||||
}
|
||||
};
|
||||
21
node_modules/read-pkg-up/node_modules/parse-json/license
generated
vendored
Normal file
21
node_modules/read-pkg-up/node_modules/parse-json/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
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.
|
||||
46
node_modules/read-pkg-up/node_modules/parse-json/package.json
generated
vendored
Normal file
46
node_modules/read-pkg-up/node_modules/parse-json/package.json
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "parse-json",
|
||||
"version": "2.2.0",
|
||||
"description": "Parse JSON with more helpful errors",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/parse-json",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && node test.js"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"vendor"
|
||||
],
|
||||
"keywords": [
|
||||
"parse",
|
||||
"json",
|
||||
"graceful",
|
||||
"error",
|
||||
"message",
|
||||
"humanize",
|
||||
"friendly",
|
||||
"helpful",
|
||||
"string",
|
||||
"str"
|
||||
],
|
||||
"dependencies": {
|
||||
"error-ex": "^1.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "0.0.4",
|
||||
"xo": "*"
|
||||
},
|
||||
"xo": {
|
||||
"ignores": [
|
||||
"vendor/**"
|
||||
]
|
||||
}
|
||||
}
|
||||
83
node_modules/read-pkg-up/node_modules/parse-json/readme.md
generated
vendored
Normal file
83
node_modules/read-pkg-up/node_modules/parse-json/readme.md
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
# parse-json [](https://travis-ci.org/sindresorhus/parse-json)
|
||||
|
||||
> Parse JSON with more helpful errors
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save parse-json
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var parseJson = require('parse-json');
|
||||
var json = '{\n\t"foo": true,\n}';
|
||||
|
||||
|
||||
JSON.parse(json);
|
||||
/*
|
||||
undefined:3
|
||||
}
|
||||
^
|
||||
SyntaxError: Unexpected token }
|
||||
*/
|
||||
|
||||
|
||||
parseJson(json);
|
||||
/*
|
||||
JSONError: Trailing comma in object at 3:1
|
||||
}
|
||||
^
|
||||
*/
|
||||
|
||||
|
||||
parseJson(json, 'foo.json');
|
||||
/*
|
||||
JSONError: Trailing comma in object at 3:1 in foo.json
|
||||
}
|
||||
^
|
||||
*/
|
||||
|
||||
|
||||
// you can also add the filename at a later point
|
||||
try {
|
||||
parseJson(json);
|
||||
} catch (err) {
|
||||
err.fileName = 'foo.json';
|
||||
throw err;
|
||||
}
|
||||
/*
|
||||
JSONError: Trailing comma in object at 3:1 in foo.json
|
||||
}
|
||||
^
|
||||
*/
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### parseJson(input, [reviver], [filename])
|
||||
|
||||
#### input
|
||||
|
||||
Type: `string`
|
||||
|
||||
#### reviver
|
||||
|
||||
Type: `function`
|
||||
|
||||
Prescribes how the value originally produced by parsing is transformed, before being returned. See [`JSON.parse` docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Using_the_reviver_parameter
|
||||
) for more.
|
||||
|
||||
#### filename
|
||||
|
||||
Type: `string`
|
||||
|
||||
Filename displayed in the error message.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
752
node_modules/read-pkg-up/node_modules/parse-json/vendor/parse.js
generated
vendored
Normal file
752
node_modules/read-pkg-up/node_modules/parse-json/vendor/parse.js
generated
vendored
Normal file
@@ -0,0 +1,752 @@
|
||||
/*
|
||||
* Author: Alex Kocharin <alex@kocharin.ru>
|
||||
* GIT: https://github.com/rlidwka/jju
|
||||
* License: WTFPL, grab your copy here: http://www.wtfpl.net/txt/copying/
|
||||
*/
|
||||
|
||||
// RTFM: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
|
||||
|
||||
var Uni = require('./unicode')
|
||||
|
||||
function isHexDigit(x) {
|
||||
return (x >= '0' && x <= '9')
|
||||
|| (x >= 'A' && x <= 'F')
|
||||
|| (x >= 'a' && x <= 'f')
|
||||
}
|
||||
|
||||
function isOctDigit(x) {
|
||||
return x >= '0' && x <= '7'
|
||||
}
|
||||
|
||||
function isDecDigit(x) {
|
||||
return x >= '0' && x <= '9'
|
||||
}
|
||||
|
||||
var unescapeMap = {
|
||||
'\'': '\'',
|
||||
'"' : '"',
|
||||
'\\': '\\',
|
||||
'b' : '\b',
|
||||
'f' : '\f',
|
||||
'n' : '\n',
|
||||
'r' : '\r',
|
||||
't' : '\t',
|
||||
'v' : '\v',
|
||||
'/' : '/',
|
||||
}
|
||||
|
||||
function formatError(input, msg, position, lineno, column, json5) {
|
||||
var result = msg + ' at ' + (lineno + 1) + ':' + (column + 1)
|
||||
, tmppos = position - column - 1
|
||||
, srcline = ''
|
||||
, underline = ''
|
||||
|
||||
var isLineTerminator = json5 ? Uni.isLineTerminator : Uni.isLineTerminatorJSON
|
||||
|
||||
// output no more than 70 characters before the wrong ones
|
||||
if (tmppos < position - 70) {
|
||||
tmppos = position - 70
|
||||
}
|
||||
|
||||
while (1) {
|
||||
var chr = input[++tmppos]
|
||||
|
||||
if (isLineTerminator(chr) || tmppos === input.length) {
|
||||
if (position >= tmppos) {
|
||||
// ending line error, so show it after the last char
|
||||
underline += '^'
|
||||
}
|
||||
break
|
||||
}
|
||||
srcline += chr
|
||||
|
||||
if (position === tmppos) {
|
||||
underline += '^'
|
||||
} else if (position > tmppos) {
|
||||
underline += input[tmppos] === '\t' ? '\t' : ' '
|
||||
}
|
||||
|
||||
// output no more than 78 characters on the string
|
||||
if (srcline.length > 78) break
|
||||
}
|
||||
|
||||
return result + '\n' + srcline + '\n' + underline
|
||||
}
|
||||
|
||||
function parse(input, options) {
|
||||
// parse as a standard JSON mode
|
||||
var json5 = !(options.mode === 'json' || options.legacy)
|
||||
var isLineTerminator = json5 ? Uni.isLineTerminator : Uni.isLineTerminatorJSON
|
||||
var isWhiteSpace = json5 ? Uni.isWhiteSpace : Uni.isWhiteSpaceJSON
|
||||
|
||||
var length = input.length
|
||||
, lineno = 0
|
||||
, linestart = 0
|
||||
, position = 0
|
||||
, stack = []
|
||||
|
||||
var tokenStart = function() {}
|
||||
var tokenEnd = function(v) {return v}
|
||||
|
||||
/* tokenize({
|
||||
raw: '...',
|
||||
type: 'whitespace'|'comment'|'key'|'literal'|'separator'|'newline',
|
||||
value: 'number'|'string'|'whatever',
|
||||
path: [...],
|
||||
})
|
||||
*/
|
||||
if (options._tokenize) {
|
||||
;(function() {
|
||||
var start = null
|
||||
tokenStart = function() {
|
||||
if (start !== null) throw Error('internal error, token overlap')
|
||||
start = position
|
||||
}
|
||||
|
||||
tokenEnd = function(v, type) {
|
||||
if (start != position) {
|
||||
var hash = {
|
||||
raw: input.substr(start, position-start),
|
||||
type: type,
|
||||
stack: stack.slice(0),
|
||||
}
|
||||
if (v !== undefined) hash.value = v
|
||||
options._tokenize.call(null, hash)
|
||||
}
|
||||
start = null
|
||||
return v
|
||||
}
|
||||
})()
|
||||
}
|
||||
|
||||
function fail(msg) {
|
||||
var column = position - linestart
|
||||
|
||||
if (!msg) {
|
||||
if (position < length) {
|
||||
var token = '\'' +
|
||||
JSON
|
||||
.stringify(input[position])
|
||||
.replace(/^"|"$/g, '')
|
||||
.replace(/'/g, "\\'")
|
||||
.replace(/\\"/g, '"')
|
||||
+ '\''
|
||||
|
||||
if (!msg) msg = 'Unexpected token ' + token
|
||||
} else {
|
||||
if (!msg) msg = 'Unexpected end of input'
|
||||
}
|
||||
}
|
||||
|
||||
var error = SyntaxError(formatError(input, msg, position, lineno, column, json5))
|
||||
error.row = lineno + 1
|
||||
error.column = column + 1
|
||||
throw error
|
||||
}
|
||||
|
||||
function newline(chr) {
|
||||
// account for <cr><lf>
|
||||
if (chr === '\r' && input[position] === '\n') position++
|
||||
linestart = position
|
||||
lineno++
|
||||
}
|
||||
|
||||
function parseGeneric() {
|
||||
var result
|
||||
|
||||
while (position < length) {
|
||||
tokenStart()
|
||||
var chr = input[position++]
|
||||
|
||||
if (chr === '"' || (chr === '\'' && json5)) {
|
||||
return tokenEnd(parseString(chr), 'literal')
|
||||
|
||||
} else if (chr === '{') {
|
||||
tokenEnd(undefined, 'separator')
|
||||
return parseObject()
|
||||
|
||||
} else if (chr === '[') {
|
||||
tokenEnd(undefined, 'separator')
|
||||
return parseArray()
|
||||
|
||||
} else if (chr === '-'
|
||||
|| chr === '.'
|
||||
|| isDecDigit(chr)
|
||||
// + number Infinity NaN
|
||||
|| (json5 && (chr === '+' || chr === 'I' || chr === 'N'))
|
||||
) {
|
||||
return tokenEnd(parseNumber(), 'literal')
|
||||
|
||||
} else if (chr === 'n') {
|
||||
parseKeyword('null')
|
||||
return tokenEnd(null, 'literal')
|
||||
|
||||
} else if (chr === 't') {
|
||||
parseKeyword('true')
|
||||
return tokenEnd(true, 'literal')
|
||||
|
||||
} else if (chr === 'f') {
|
||||
parseKeyword('false')
|
||||
return tokenEnd(false, 'literal')
|
||||
|
||||
} else {
|
||||
position--
|
||||
return tokenEnd(undefined)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function parseKey() {
|
||||
var result
|
||||
|
||||
while (position < length) {
|
||||
tokenStart()
|
||||
var chr = input[position++]
|
||||
|
||||
if (chr === '"' || (chr === '\'' && json5)) {
|
||||
return tokenEnd(parseString(chr), 'key')
|
||||
|
||||
} else if (chr === '{') {
|
||||
tokenEnd(undefined, 'separator')
|
||||
return parseObject()
|
||||
|
||||
} else if (chr === '[') {
|
||||
tokenEnd(undefined, 'separator')
|
||||
return parseArray()
|
||||
|
||||
} else if (chr === '.'
|
||||
|| isDecDigit(chr)
|
||||
) {
|
||||
return tokenEnd(parseNumber(true), 'key')
|
||||
|
||||
} else if (json5
|
||||
&& Uni.isIdentifierStart(chr) || (chr === '\\' && input[position] === 'u')) {
|
||||
// unicode char or a unicode sequence
|
||||
var rollback = position - 1
|
||||
var result = parseIdentifier()
|
||||
|
||||
if (result === undefined) {
|
||||
position = rollback
|
||||
return tokenEnd(undefined)
|
||||
} else {
|
||||
return tokenEnd(result, 'key')
|
||||
}
|
||||
|
||||
} else {
|
||||
position--
|
||||
return tokenEnd(undefined)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function skipWhiteSpace() {
|
||||
tokenStart()
|
||||
while (position < length) {
|
||||
var chr = input[position++]
|
||||
|
||||
if (isLineTerminator(chr)) {
|
||||
position--
|
||||
tokenEnd(undefined, 'whitespace')
|
||||
tokenStart()
|
||||
position++
|
||||
newline(chr)
|
||||
tokenEnd(undefined, 'newline')
|
||||
tokenStart()
|
||||
|
||||
} else if (isWhiteSpace(chr)) {
|
||||
// nothing
|
||||
|
||||
} else if (chr === '/'
|
||||
&& json5
|
||||
&& (input[position] === '/' || input[position] === '*')
|
||||
) {
|
||||
position--
|
||||
tokenEnd(undefined, 'whitespace')
|
||||
tokenStart()
|
||||
position++
|
||||
skipComment(input[position++] === '*')
|
||||
tokenEnd(undefined, 'comment')
|
||||
tokenStart()
|
||||
|
||||
} else {
|
||||
position--
|
||||
break
|
||||
}
|
||||
}
|
||||
return tokenEnd(undefined, 'whitespace')
|
||||
}
|
||||
|
||||
function skipComment(multi) {
|
||||
while (position < length) {
|
||||
var chr = input[position++]
|
||||
|
||||
if (isLineTerminator(chr)) {
|
||||
// LineTerminator is an end of singleline comment
|
||||
if (!multi) {
|
||||
// let parent function deal with newline
|
||||
position--
|
||||
return
|
||||
}
|
||||
|
||||
newline(chr)
|
||||
|
||||
} else if (chr === '*' && multi) {
|
||||
// end of multiline comment
|
||||
if (input[position] === '/') {
|
||||
position++
|
||||
return
|
||||
}
|
||||
|
||||
} else {
|
||||
// nothing
|
||||
}
|
||||
}
|
||||
|
||||
if (multi) {
|
||||
fail('Unclosed multiline comment')
|
||||
}
|
||||
}
|
||||
|
||||
function parseKeyword(keyword) {
|
||||
// keyword[0] is not checked because it should've checked earlier
|
||||
var _pos = position
|
||||
var len = keyword.length
|
||||
for (var i=1; i<len; i++) {
|
||||
if (position >= length || keyword[i] != input[position]) {
|
||||
position = _pos-1
|
||||
fail()
|
||||
}
|
||||
position++
|
||||
}
|
||||
}
|
||||
|
||||
function parseObject() {
|
||||
var result = options.null_prototype ? Object.create(null) : {}
|
||||
, empty_object = {}
|
||||
, is_non_empty = false
|
||||
|
||||
while (position < length) {
|
||||
skipWhiteSpace()
|
||||
var item1 = parseKey()
|
||||
skipWhiteSpace()
|
||||
tokenStart()
|
||||
var chr = input[position++]
|
||||
tokenEnd(undefined, 'separator')
|
||||
|
||||
if (chr === '}' && item1 === undefined) {
|
||||
if (!json5 && is_non_empty) {
|
||||
position--
|
||||
fail('Trailing comma in object')
|
||||
}
|
||||
return result
|
||||
|
||||
} else if (chr === ':' && item1 !== undefined) {
|
||||
skipWhiteSpace()
|
||||
stack.push(item1)
|
||||
var item2 = parseGeneric()
|
||||
stack.pop()
|
||||
|
||||
if (item2 === undefined) fail('No value found for key ' + item1)
|
||||
if (typeof(item1) !== 'string') {
|
||||
if (!json5 || typeof(item1) !== 'number') {
|
||||
fail('Wrong key type: ' + item1)
|
||||
}
|
||||
}
|
||||
|
||||
if ((item1 in empty_object || empty_object[item1] != null) && options.reserved_keys !== 'replace') {
|
||||
if (options.reserved_keys === 'throw') {
|
||||
fail('Reserved key: ' + item1)
|
||||
} else {
|
||||
// silently ignore it
|
||||
}
|
||||
} else {
|
||||
if (typeof(options.reviver) === 'function') {
|
||||
item2 = options.reviver.call(null, item1, item2)
|
||||
}
|
||||
|
||||
if (item2 !== undefined) {
|
||||
is_non_empty = true
|
||||
Object.defineProperty(result, item1, {
|
||||
value: item2,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
skipWhiteSpace()
|
||||
|
||||
tokenStart()
|
||||
var chr = input[position++]
|
||||
tokenEnd(undefined, 'separator')
|
||||
|
||||
if (chr === ',') {
|
||||
continue
|
||||
|
||||
} else if (chr === '}') {
|
||||
return result
|
||||
|
||||
} else {
|
||||
fail()
|
||||
}
|
||||
|
||||
} else {
|
||||
position--
|
||||
fail()
|
||||
}
|
||||
}
|
||||
|
||||
fail()
|
||||
}
|
||||
|
||||
function parseArray() {
|
||||
var result = []
|
||||
|
||||
while (position < length) {
|
||||
skipWhiteSpace()
|
||||
stack.push(result.length)
|
||||
var item = parseGeneric()
|
||||
stack.pop()
|
||||
skipWhiteSpace()
|
||||
tokenStart()
|
||||
var chr = input[position++]
|
||||
tokenEnd(undefined, 'separator')
|
||||
|
||||
if (item !== undefined) {
|
||||
if (typeof(options.reviver) === 'function') {
|
||||
item = options.reviver.call(null, String(result.length), item)
|
||||
}
|
||||
if (item === undefined) {
|
||||
result.length++
|
||||
item = true // hack for check below, not included into result
|
||||
} else {
|
||||
result.push(item)
|
||||
}
|
||||
}
|
||||
|
||||
if (chr === ',') {
|
||||
if (item === undefined) {
|
||||
fail('Elisions are not supported')
|
||||
}
|
||||
|
||||
} else if (chr === ']') {
|
||||
if (!json5 && item === undefined && result.length) {
|
||||
position--
|
||||
fail('Trailing comma in array')
|
||||
}
|
||||
return result
|
||||
|
||||
} else {
|
||||
position--
|
||||
fail()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function parseNumber() {
|
||||
// rewind because we don't know first char
|
||||
position--
|
||||
|
||||
var start = position
|
||||
, chr = input[position++]
|
||||
, t
|
||||
|
||||
var to_num = function(is_octal) {
|
||||
var str = input.substr(start, position - start)
|
||||
|
||||
if (is_octal) {
|
||||
var result = parseInt(str.replace(/^0o?/, ''), 8)
|
||||
} else {
|
||||
var result = Number(str)
|
||||
}
|
||||
|
||||
if (Number.isNaN(result)) {
|
||||
position--
|
||||
fail('Bad numeric literal - "' + input.substr(start, position - start + 1) + '"')
|
||||
} else if (!json5 && !str.match(/^-?(0|[1-9][0-9]*)(\.[0-9]+)?(e[+-]?[0-9]+)?$/i)) {
|
||||
// additional restrictions imposed by json
|
||||
position--
|
||||
fail('Non-json numeric literal - "' + input.substr(start, position - start + 1) + '"')
|
||||
} else {
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
// ex: -5982475.249875e+29384
|
||||
// ^ skipping this
|
||||
if (chr === '-' || (chr === '+' && json5)) chr = input[position++]
|
||||
|
||||
if (chr === 'N' && json5) {
|
||||
parseKeyword('NaN')
|
||||
return NaN
|
||||
}
|
||||
|
||||
if (chr === 'I' && json5) {
|
||||
parseKeyword('Infinity')
|
||||
|
||||
// returning +inf or -inf
|
||||
return to_num()
|
||||
}
|
||||
|
||||
if (chr >= '1' && chr <= '9') {
|
||||
// ex: -5982475.249875e+29384
|
||||
// ^^^ skipping these
|
||||
while (position < length && isDecDigit(input[position])) position++
|
||||
chr = input[position++]
|
||||
}
|
||||
|
||||
// special case for leading zero: 0.123456
|
||||
if (chr === '0') {
|
||||
chr = input[position++]
|
||||
|
||||
// new syntax, "0o777" old syntax, "0777"
|
||||
var is_octal = chr === 'o' || chr === 'O' || isOctDigit(chr)
|
||||
var is_hex = chr === 'x' || chr === 'X'
|
||||
|
||||
if (json5 && (is_octal || is_hex)) {
|
||||
while (position < length
|
||||
&& (is_hex ? isHexDigit : isOctDigit)( input[position] )
|
||||
) position++
|
||||
|
||||
var sign = 1
|
||||
if (input[start] === '-') {
|
||||
sign = -1
|
||||
start++
|
||||
} else if (input[start] === '+') {
|
||||
start++
|
||||
}
|
||||
|
||||
return sign * to_num(is_octal)
|
||||
}
|
||||
}
|
||||
|
||||
if (chr === '.') {
|
||||
// ex: -5982475.249875e+29384
|
||||
// ^^^ skipping these
|
||||
while (position < length && isDecDigit(input[position])) position++
|
||||
chr = input[position++]
|
||||
}
|
||||
|
||||
if (chr === 'e' || chr === 'E') {
|
||||
chr = input[position++]
|
||||
if (chr === '-' || chr === '+') position++
|
||||
// ex: -5982475.249875e+29384
|
||||
// ^^^ skipping these
|
||||
while (position < length && isDecDigit(input[position])) position++
|
||||
chr = input[position++]
|
||||
}
|
||||
|
||||
// we have char in the buffer, so count for it
|
||||
position--
|
||||
return to_num()
|
||||
}
|
||||
|
||||
function parseIdentifier() {
|
||||
// rewind because we don't know first char
|
||||
position--
|
||||
|
||||
var result = ''
|
||||
|
||||
while (position < length) {
|
||||
var chr = input[position++]
|
||||
|
||||
if (chr === '\\'
|
||||
&& input[position] === 'u'
|
||||
&& isHexDigit(input[position+1])
|
||||
&& isHexDigit(input[position+2])
|
||||
&& isHexDigit(input[position+3])
|
||||
&& isHexDigit(input[position+4])
|
||||
) {
|
||||
// UnicodeEscapeSequence
|
||||
chr = String.fromCharCode(parseInt(input.substr(position+1, 4), 16))
|
||||
position += 5
|
||||
}
|
||||
|
||||
if (result.length) {
|
||||
// identifier started
|
||||
if (Uni.isIdentifierPart(chr)) {
|
||||
result += chr
|
||||
} else {
|
||||
position--
|
||||
return result
|
||||
}
|
||||
|
||||
} else {
|
||||
if (Uni.isIdentifierStart(chr)) {
|
||||
result += chr
|
||||
} else {
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fail()
|
||||
}
|
||||
|
||||
function parseString(endChar) {
|
||||
// 7.8.4 of ES262 spec
|
||||
var result = ''
|
||||
|
||||
while (position < length) {
|
||||
var chr = input[position++]
|
||||
|
||||
if (chr === endChar) {
|
||||
return result
|
||||
|
||||
} else if (chr === '\\') {
|
||||
if (position >= length) fail()
|
||||
chr = input[position++]
|
||||
|
||||
if (unescapeMap[chr] && (json5 || (chr != 'v' && chr != "'"))) {
|
||||
result += unescapeMap[chr]
|
||||
|
||||
} else if (json5 && isLineTerminator(chr)) {
|
||||
// line continuation
|
||||
newline(chr)
|
||||
|
||||
} else if (chr === 'u' || (chr === 'x' && json5)) {
|
||||
// unicode/character escape sequence
|
||||
var off = chr === 'u' ? 4 : 2
|
||||
|
||||
// validation for \uXXXX
|
||||
for (var i=0; i<off; i++) {
|
||||
if (position >= length) fail()
|
||||
if (!isHexDigit(input[position])) fail('Bad escape sequence')
|
||||
position++
|
||||
}
|
||||
|
||||
result += String.fromCharCode(parseInt(input.substr(position-off, off), 16))
|
||||
} else if (json5 && isOctDigit(chr)) {
|
||||
if (chr < '4' && isOctDigit(input[position]) && isOctDigit(input[position+1])) {
|
||||
// three-digit octal
|
||||
var digits = 3
|
||||
} else if (isOctDigit(input[position])) {
|
||||
// two-digit octal
|
||||
var digits = 2
|
||||
} else {
|
||||
var digits = 1
|
||||
}
|
||||
position += digits - 1
|
||||
result += String.fromCharCode(parseInt(input.substr(position-digits, digits), 8))
|
||||
/*if (!isOctDigit(input[position])) {
|
||||
// \0 is allowed still
|
||||
result += '\0'
|
||||
} else {
|
||||
fail('Octal literals are not supported')
|
||||
}*/
|
||||
|
||||
} else if (json5) {
|
||||
// \X -> x
|
||||
result += chr
|
||||
|
||||
} else {
|
||||
position--
|
||||
fail()
|
||||
}
|
||||
|
||||
} else if (isLineTerminator(chr)) {
|
||||
fail()
|
||||
|
||||
} else {
|
||||
if (!json5 && chr.charCodeAt(0) < 32) {
|
||||
position--
|
||||
fail('Unexpected control character')
|
||||
}
|
||||
|
||||
// SourceCharacter but not one of " or \ or LineTerminator
|
||||
result += chr
|
||||
}
|
||||
}
|
||||
|
||||
fail()
|
||||
}
|
||||
|
||||
skipWhiteSpace()
|
||||
var return_value = parseGeneric()
|
||||
if (return_value !== undefined || position < length) {
|
||||
skipWhiteSpace()
|
||||
|
||||
if (position >= length) {
|
||||
if (typeof(options.reviver) === 'function') {
|
||||
return_value = options.reviver.call(null, '', return_value)
|
||||
}
|
||||
return return_value
|
||||
} else {
|
||||
fail()
|
||||
}
|
||||
|
||||
} else {
|
||||
if (position) {
|
||||
fail('No data, only a whitespace')
|
||||
} else {
|
||||
fail('No data, empty input')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* parse(text, options)
|
||||
* or
|
||||
* parse(text, reviver)
|
||||
*
|
||||
* where:
|
||||
* text - string
|
||||
* options - object
|
||||
* reviver - function
|
||||
*/
|
||||
module.exports.parse = function parseJSON(input, options) {
|
||||
// support legacy functions
|
||||
if (typeof(options) === 'function') {
|
||||
options = {
|
||||
reviver: options
|
||||
}
|
||||
}
|
||||
|
||||
if (input === undefined) {
|
||||
// parse(stringify(x)) should be equal x
|
||||
// with JSON functions it is not 'cause of undefined
|
||||
// so we're fixing it
|
||||
return undefined
|
||||
}
|
||||
|
||||
// JSON.parse compat
|
||||
if (typeof(input) !== 'string') input = String(input)
|
||||
if (options == null) options = {}
|
||||
if (options.reserved_keys == null) options.reserved_keys = 'ignore'
|
||||
|
||||
if (options.reserved_keys === 'throw' || options.reserved_keys === 'ignore') {
|
||||
if (options.null_prototype == null) {
|
||||
options.null_prototype = true
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
return parse(input, options)
|
||||
} catch(err) {
|
||||
// jju is a recursive parser, so JSON.parse("{{{{{{{") could blow up the stack
|
||||
//
|
||||
// this catch is used to skip all those internal calls
|
||||
if (err instanceof SyntaxError && err.row != null && err.column != null) {
|
||||
var old_err = err
|
||||
err = SyntaxError(old_err.message)
|
||||
err.column = old_err.column
|
||||
err.row = old_err.row
|
||||
}
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.tokenize = function tokenizeJSON(input, options) {
|
||||
if (options == null) options = {}
|
||||
|
||||
options._tokenize = function(smth) {
|
||||
if (options._addstack) smth.stack.unshift.apply(smth.stack, options._addstack)
|
||||
tokens.push(smth)
|
||||
}
|
||||
|
||||
var tokens = []
|
||||
tokens.data = module.exports.parse(input, options)
|
||||
return tokens
|
||||
}
|
||||
|
||||
71
node_modules/read-pkg-up/node_modules/parse-json/vendor/unicode.js
generated
vendored
Normal file
71
node_modules/read-pkg-up/node_modules/parse-json/vendor/unicode.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
17
node_modules/read-pkg-up/node_modules/path-exists/index.js
generated
vendored
Normal file
17
node_modules/read-pkg-up/node_modules/path-exists/index.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
const fs = require('fs');
|
||||
|
||||
module.exports = fp => new Promise(resolve => {
|
||||
fs.access(fp, err => {
|
||||
resolve(!err);
|
||||
});
|
||||
});
|
||||
|
||||
module.exports.sync = fp => {
|
||||
try {
|
||||
fs.accessSync(fp);
|
||||
return true;
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
21
node_modules/read-pkg-up/node_modules/path-exists/license
generated
vendored
Normal file
21
node_modules/read-pkg-up/node_modules/path-exists/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
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.
|
||||
40
node_modules/read-pkg-up/node_modules/path-exists/package.json
generated
vendored
Normal file
40
node_modules/read-pkg-up/node_modules/path-exists/package.json
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "path-exists",
|
||||
"version": "3.0.0",
|
||||
"description": "Check if a path exists",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/path-exists",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"path",
|
||||
"exists",
|
||||
"exist",
|
||||
"file",
|
||||
"filepath",
|
||||
"fs",
|
||||
"filesystem",
|
||||
"file-system",
|
||||
"access",
|
||||
"stat"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"xo": {
|
||||
"esnext": true
|
||||
}
|
||||
}
|
||||
50
node_modules/read-pkg-up/node_modules/path-exists/readme.md
generated
vendored
Normal file
50
node_modules/read-pkg-up/node_modules/path-exists/readme.md
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
# path-exists [](https://travis-ci.org/sindresorhus/path-exists)
|
||||
|
||||
> Check if a path exists
|
||||
|
||||
Because [`fs.exists()`](https://nodejs.org/api/fs.html#fs_fs_exists_path_callback) is being [deprecated](https://github.com/iojs/io.js/issues/103), but there's still a genuine use-case of being able to check if a path exists for other purposes than doing IO with it.
|
||||
|
||||
Never use this before handling a file though:
|
||||
|
||||
> In particular, checking if a file exists before opening it is an anti-pattern that leaves you vulnerable to race conditions: another process may remove the file between the calls to `fs.exists()` and `fs.open()`. Just open the file and handle the error when it's not there.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save path-exists
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
// foo.js
|
||||
const pathExists = require('path-exists');
|
||||
|
||||
pathExists('foo.js').then(exists => {
|
||||
console.log(exists);
|
||||
//=> true
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### pathExists(path)
|
||||
|
||||
Returns a promise for a boolean of whether the path exists.
|
||||
|
||||
### pathExists.sync(path)
|
||||
|
||||
Returns a boolean of whether the path exists.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [path-exists-cli](https://github.com/sindresorhus/path-exists-cli) - CLI for this module
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
26
node_modules/read-pkg-up/node_modules/path-type/index.js
generated
vendored
Normal file
26
node_modules/read-pkg-up/node_modules/path-type/index.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
const fs = require('fs');
|
||||
const pify = require('pify');
|
||||
|
||||
function type(fn, fn2, fp) {
|
||||
if (typeof fp !== 'string') {
|
||||
return Promise.reject(new TypeError(`Expected a string, got ${typeof fp}`));
|
||||
}
|
||||
|
||||
return pify(fs[fn])(fp).then(stats => stats[fn2]());
|
||||
}
|
||||
|
||||
function typeSync(fn, fn2, fp) {
|
||||
if (typeof fp !== 'string') {
|
||||
throw new TypeError(`Expected a string, got ${typeof fp}`);
|
||||
}
|
||||
|
||||
return fs[fn](fp)[fn2]();
|
||||
}
|
||||
|
||||
exports.file = type.bind(null, 'stat', 'isFile');
|
||||
exports.dir = type.bind(null, 'stat', 'isDirectory');
|
||||
exports.symlink = type.bind(null, 'lstat', 'isSymbolicLink');
|
||||
exports.fileSync = typeSync.bind(null, 'statSync', 'isFile');
|
||||
exports.dirSync = typeSync.bind(null, 'statSync', 'isDirectory');
|
||||
exports.symlinkSync = typeSync.bind(null, 'lstatSync', 'isSymbolicLink');
|
||||
21
node_modules/read-pkg-up/node_modules/path-type/license
generated
vendored
Normal file
21
node_modules/read-pkg-up/node_modules/path-type/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
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.
|
||||
48
node_modules/read-pkg-up/node_modules/path-type/package.json
generated
vendored
Normal file
48
node_modules/read-pkg-up/node_modules/path-type/package.json
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "path-type",
|
||||
"version": "2.0.0",
|
||||
"description": "Check if a path is a file, directory, or symlink",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/path-type",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"path",
|
||||
"fs",
|
||||
"type",
|
||||
"is",
|
||||
"check",
|
||||
"directory",
|
||||
"dir",
|
||||
"file",
|
||||
"filepath",
|
||||
"symlink",
|
||||
"symbolic",
|
||||
"link",
|
||||
"stat",
|
||||
"stats",
|
||||
"filesystem"
|
||||
],
|
||||
"dependencies": {
|
||||
"pify": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"xo": {
|
||||
"esnext": true
|
||||
}
|
||||
}
|
||||
42
node_modules/read-pkg-up/node_modules/path-type/readme.md
generated
vendored
Normal file
42
node_modules/read-pkg-up/node_modules/path-type/readme.md
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
# path-type [](https://travis-ci.org/sindresorhus/path-type)
|
||||
|
||||
> Check if a path is a file, directory, or symlink
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save path-type
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const pathType = require('path-type');
|
||||
|
||||
pathType.file('package.json').then(isFile => {
|
||||
console.log(isFile);
|
||||
//=> true
|
||||
})
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### .file(path)
|
||||
### .dir(path)
|
||||
### .symlink(path)
|
||||
|
||||
Returns a `Promise` for a `boolean` of whether the path is the checked type.
|
||||
|
||||
### .fileSync(path)
|
||||
### .dirSync(path)
|
||||
### .symlinkSync(path)
|
||||
|
||||
Returns a `boolean` of whether the path is the checked type.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
68
node_modules/read-pkg-up/node_modules/pify/index.js
generated
vendored
Normal file
68
node_modules/read-pkg-up/node_modules/pify/index.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
'use strict';
|
||||
|
||||
var processFn = function (fn, P, opts) {
|
||||
return function () {
|
||||
var that = this;
|
||||
var args = new Array(arguments.length);
|
||||
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
args[i] = arguments[i];
|
||||
}
|
||||
|
||||
return new P(function (resolve, reject) {
|
||||
args.push(function (err, result) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else if (opts.multiArgs) {
|
||||
var results = new Array(arguments.length - 1);
|
||||
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
results[i - 1] = arguments[i];
|
||||
}
|
||||
|
||||
resolve(results);
|
||||
} else {
|
||||
resolve(result);
|
||||
}
|
||||
});
|
||||
|
||||
fn.apply(that, args);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var pify = module.exports = function (obj, P, opts) {
|
||||
if (typeof P !== 'function') {
|
||||
opts = P;
|
||||
P = Promise;
|
||||
}
|
||||
|
||||
opts = opts || {};
|
||||
opts.exclude = opts.exclude || [/.+Sync$/];
|
||||
|
||||
var filter = function (key) {
|
||||
var match = function (pattern) {
|
||||
return typeof pattern === 'string' ? key === pattern : pattern.test(key);
|
||||
};
|
||||
|
||||
return opts.include ? opts.include.some(match) : !opts.exclude.some(match);
|
||||
};
|
||||
|
||||
var ret = typeof obj === 'function' ? function () {
|
||||
if (opts.excludeMain) {
|
||||
return obj.apply(this, arguments);
|
||||
}
|
||||
|
||||
return processFn(obj, P, opts).apply(this, arguments);
|
||||
} : {};
|
||||
|
||||
return Object.keys(obj).reduce(function (ret, key) {
|
||||
var x = obj[key];
|
||||
|
||||
ret[key] = typeof x === 'function' && filter(key) ? processFn(x, P, opts) : x;
|
||||
|
||||
return ret;
|
||||
}, ret);
|
||||
};
|
||||
|
||||
pify.all = pify;
|
||||
21
node_modules/read-pkg-up/node_modules/pify/license
generated
vendored
Normal file
21
node_modules/read-pkg-up/node_modules/pify/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
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.
|
||||
48
node_modules/read-pkg-up/node_modules/pify/package.json
generated
vendored
Normal file
48
node_modules/read-pkg-up/node_modules/pify/package.json
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "pify",
|
||||
"version": "2.3.0",
|
||||
"description": "Promisify a callback-style function",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/pify",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && npm run optimization-test",
|
||||
"optimization-test": "node --allow-natives-syntax optimization-test.js"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"promise",
|
||||
"promises",
|
||||
"promisify",
|
||||
"denodify",
|
||||
"denodeify",
|
||||
"callback",
|
||||
"cb",
|
||||
"node",
|
||||
"then",
|
||||
"thenify",
|
||||
"convert",
|
||||
"transform",
|
||||
"wrap",
|
||||
"wrapper",
|
||||
"bind",
|
||||
"to",
|
||||
"async",
|
||||
"es2015"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"pinkie-promise": "^1.0.0",
|
||||
"v8-natives": "0.0.2",
|
||||
"xo": "*"
|
||||
}
|
||||
}
|
||||
119
node_modules/read-pkg-up/node_modules/pify/readme.md
generated
vendored
Normal file
119
node_modules/read-pkg-up/node_modules/pify/readme.md
generated
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
# pify [](https://travis-ci.org/sindresorhus/pify)
|
||||
|
||||
> Promisify a callback-style function
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save pify
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const fs = require('fs');
|
||||
const pify = require('pify');
|
||||
|
||||
// promisify a single function
|
||||
|
||||
pify(fs.readFile)('package.json', 'utf8').then(data => {
|
||||
console.log(JSON.parse(data).name);
|
||||
//=> 'pify'
|
||||
});
|
||||
|
||||
// or promisify all methods in a module
|
||||
|
||||
pify(fs).readFile('package.json', 'utf8').then(data => {
|
||||
console.log(JSON.parse(data).name);
|
||||
//=> 'pify'
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### pify(input, [promiseModule], [options])
|
||||
|
||||
Returns a promise wrapped version of the supplied function or module.
|
||||
|
||||
#### input
|
||||
|
||||
Type: `function`, `object`
|
||||
|
||||
Callback-style function or module whose methods you want to promisify.
|
||||
|
||||
#### promiseModule
|
||||
|
||||
Type: `function`
|
||||
|
||||
Custom promise module to use instead of the native one.
|
||||
|
||||
Check out [`pinkie-promise`](https://github.com/floatdrop/pinkie-promise) if you need a tiny promise polyfill.
|
||||
|
||||
#### options
|
||||
|
||||
##### multiArgs
|
||||
|
||||
Type: `boolean`
|
||||
Default: `false`
|
||||
|
||||
By default, the promisified function will only return the second argument from the callback, which works fine for most APIs. This option can be useful for modules like `request` that return multiple arguments. Turning this on will make it return an array of all arguments from the callback, excluding the error argument, instead of just the second argument.
|
||||
|
||||
```js
|
||||
const request = require('request');
|
||||
const pify = require('pify');
|
||||
|
||||
pify(request, {multiArgs: true})('https://sindresorhus.com').then(result => {
|
||||
const [httpResponse, body] = result;
|
||||
});
|
||||
```
|
||||
|
||||
##### include
|
||||
|
||||
Type: `array` of (`string`|`regex`)
|
||||
|
||||
Methods in a module to promisify. Remaining methods will be left untouched.
|
||||
|
||||
##### exclude
|
||||
|
||||
Type: `array` of (`string`|`regex`)
|
||||
Default: `[/.+Sync$/]`
|
||||
|
||||
Methods in a module **not** to promisify. Methods with names ending with `'Sync'` are excluded by default.
|
||||
|
||||
##### excludeMain
|
||||
|
||||
Type: `boolean`
|
||||
Default: `false`
|
||||
|
||||
By default, if given module is a function itself, this function will be promisified. Turn this option on if you want to promisify only methods of the module.
|
||||
|
||||
```js
|
||||
const pify = require('pify');
|
||||
|
||||
function fn() {
|
||||
return true;
|
||||
}
|
||||
|
||||
fn.method = (data, callback) => {
|
||||
setImmediate(() => {
|
||||
callback(data, null);
|
||||
});
|
||||
};
|
||||
|
||||
// promisify methods but not fn()
|
||||
const promiseFn = pify(fn, {excludeMain: true});
|
||||
|
||||
if (promiseFn()) {
|
||||
promiseFn.method('hi').then(data => {
|
||||
console.log(data);
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
47
node_modules/read-pkg-up/node_modules/read-pkg/index.js
generated
vendored
Normal file
47
node_modules/read-pkg-up/node_modules/read-pkg/index.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const loadJsonFile = require('load-json-file');
|
||||
const pathType = require('path-type');
|
||||
|
||||
module.exports = (fp, opts) => {
|
||||
if (typeof fp !== 'string') {
|
||||
opts = fp;
|
||||
fp = '.';
|
||||
}
|
||||
|
||||
opts = opts || {};
|
||||
|
||||
return pathType.dir(fp)
|
||||
.then(isDir => {
|
||||
if (isDir) {
|
||||
fp = path.join(fp, 'package.json');
|
||||
}
|
||||
|
||||
return loadJsonFile(fp);
|
||||
})
|
||||
.then(x => {
|
||||
if (opts.normalize !== false) {
|
||||
require('normalize-package-data')(x);
|
||||
}
|
||||
|
||||
return x;
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.sync = (fp, opts) => {
|
||||
if (typeof fp !== 'string') {
|
||||
opts = fp;
|
||||
fp = '.';
|
||||
}
|
||||
|
||||
opts = opts || {};
|
||||
fp = pathType.dirSync(fp) ? path.join(fp, 'package.json') : fp;
|
||||
|
||||
const x = loadJsonFile.sync(fp);
|
||||
|
||||
if (opts.normalize !== false) {
|
||||
require('normalize-package-data')(x);
|
||||
}
|
||||
|
||||
return x;
|
||||
};
|
||||
21
node_modules/read-pkg-up/node_modules/read-pkg/license
generated
vendored
Normal file
21
node_modules/read-pkg-up/node_modules/read-pkg/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
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.
|
||||
45
node_modules/read-pkg-up/node_modules/read-pkg/package.json
generated
vendored
Normal file
45
node_modules/read-pkg-up/node_modules/read-pkg/package.json
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"name": "read-pkg",
|
||||
"version": "2.0.0",
|
||||
"description": "Read a package.json file",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/read-pkg",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"json",
|
||||
"read",
|
||||
"parse",
|
||||
"file",
|
||||
"fs",
|
||||
"graceful",
|
||||
"load",
|
||||
"pkg",
|
||||
"package",
|
||||
"normalize"
|
||||
],
|
||||
"dependencies": {
|
||||
"load-json-file": "^2.0.0",
|
||||
"normalize-package-data": "^2.3.2",
|
||||
"path-type": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"xo": {
|
||||
"esnext": true
|
||||
}
|
||||
}
|
||||
79
node_modules/read-pkg-up/node_modules/read-pkg/readme.md
generated
vendored
Normal file
79
node_modules/read-pkg-up/node_modules/read-pkg/readme.md
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
# read-pkg [](https://travis-ci.org/sindresorhus/read-pkg)
|
||||
|
||||
> Read a package.json file
|
||||
|
||||
|
||||
## Why
|
||||
|
||||
- [Gracefully handles filesystem issues](https://github.com/isaacs/node-graceful-fs)
|
||||
- [Strips UTF-8 BOM](https://github.com/sindresorhus/strip-bom)
|
||||
- [Throws more helpful JSON errors](https://github.com/sindresorhus/parse-json)
|
||||
- [Normalizes the data](https://github.com/npm/normalize-package-data#what-normalization-currently-entails)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save read-pkg
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const readPkg = require('read-pkg');
|
||||
|
||||
readPkg().then(pkg => {
|
||||
console.log(pkg);
|
||||
//=> {name: 'read-pkg', ...}
|
||||
});
|
||||
|
||||
readPkg(__dirname).then(pkg => {
|
||||
console.log(pkg);
|
||||
//=> {name: 'read-pkg', ...}
|
||||
});
|
||||
|
||||
readPkg(path.join('unicorn', 'package.json')).then(pkg => {
|
||||
console.log(pkg);
|
||||
//=> {name: 'read-pkg', ...}
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### readPkg([path], [options])
|
||||
|
||||
Returns a `Promise` for the parsed JSON.
|
||||
|
||||
### readPkg.sync([path], [options])
|
||||
|
||||
Returns the parsed JSON.
|
||||
|
||||
#### path
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `.`
|
||||
|
||||
Path to a `package.json` file or its directory.
|
||||
|
||||
#### options
|
||||
|
||||
##### normalize
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
[Normalize](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) the package data.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [read-pkg-up](https://github.com/sindresorhus/read-pkg-up) - Read the closest package.json file
|
||||
- [write-pkg](https://github.com/sindresorhus/write-pkg) - Write a `package.json` file
|
||||
- [load-json-file](https://github.com/sindresorhus/load-json-file) - Read and parse a JSON file
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
Reference in New Issue
Block a user