mirror of
https://github.com/codecov/codecov-action.git
synced 2025-12-08 16:16:24 +00:00
try saving bash script as file
This commit is contained in:
47
index.js
47
index.js
@@ -4,9 +4,18 @@ const request = require('request');
|
|||||||
|
|
||||||
const exec = require('@actions/exec');
|
const exec = require('@actions/exec');
|
||||||
|
|
||||||
|
const tmp = require('tmp');
|
||||||
|
|
||||||
|
const temp = require('temp')
|
||||||
|
const fs = require('fs')
|
||||||
|
const util = require('util')
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//const execSh = require('./node_modules/exec-sh/lib/exec-sh');
|
//const execSh = require('./node_modules/exec-sh/lib/exec-sh');
|
||||||
const execFileSync = require('child_process').execFileSync;
|
//const execFileSync = require('child_process').execFileSync;
|
||||||
// import { execFileSync } from 'child_process'; // replace ^ if using ES modules
|
// import { execFileSync } from 'child_process'; // replace ^ if using ES modules
|
||||||
// the default is 'buffer'
|
// the default is 'buffer'
|
||||||
|
|
||||||
@@ -30,21 +39,7 @@ try {
|
|||||||
//const payload = JSON.stringify(github.context.payload, undefined, 2)
|
//const payload = JSON.stringify(github.context.payload, undefined, 2)
|
||||||
//console.log(`The event payload: ${payload}`);
|
//console.log(`The event payload: ${payload}`);
|
||||||
|
|
||||||
let myOutput = '';
|
|
||||||
let myError = '';
|
|
||||||
|
|
||||||
const options = {};
|
|
||||||
options.listeners = {
|
|
||||||
stdout: (data) => {
|
|
||||||
myOutput += data.toString();
|
|
||||||
},
|
|
||||||
stderr: (data) => {
|
|
||||||
myError += data.toString();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
options.env = {CODECOV_TOKEN: 'e0f9f29c-c2e4-4dd3-b440-0c2bc6937859', GITHUB_ACTION: process.env.GITHUB_ACTION, GITHUB_REF: process.env.GITHUB_REF, GITHUB_REPOSITORY: process.env.GITHUB_REPOSITORY, GITHUB_SHA: process.env.GITHUB_SHA};
|
|
||||||
|
|
||||||
exec.exec('bash', ['bash.sh'], options);
|
|
||||||
|
|
||||||
//execFileSync('bash',['bash.sh'], {shell: true, env:{CODECOV_TOKEN: 'e0f9f29c-c2e4-4dd3-b440-0c2bc6937859', GITHUB_ACTION: process.env.GITHUB_ACTION, GITHUB_REF: process.env.GITHUB_REF, GITHUB_REPOSITORY: process.env.GITHUB_REPOSITORY, GITHUB_SHA: process.env.GITHUB_SHA}});
|
//execFileSync('bash',['bash.sh'], {shell: true, env:{CODECOV_TOKEN: 'e0f9f29c-c2e4-4dd3-b440-0c2bc6937859', GITHUB_ACTION: process.env.GITHUB_ACTION, GITHUB_REF: process.env.GITHUB_REF, GITHUB_REPOSITORY: process.env.GITHUB_REPOSITORY, GITHUB_SHA: process.env.GITHUB_SHA}});
|
||||||
|
|
||||||
@@ -70,6 +65,26 @@ try {
|
|||||||
// })
|
// })
|
||||||
|
|
||||||
//body = body.replace("#!/usr/bin/env bash", "#!/bin/sh")
|
//body = body.replace("#!/usr/bin/env bash", "#!/bin/sh")
|
||||||
|
let myOutput = '';
|
||||||
|
let myError = '';
|
||||||
|
fs.writeFile('codecov.sh', body, function(err) {
|
||||||
|
if (err) throw err;
|
||||||
|
const options = {};
|
||||||
|
options.listeners = {
|
||||||
|
stdout: (data) => {
|
||||||
|
myOutput += data.toString();
|
||||||
|
},
|
||||||
|
stderr: (data) => {
|
||||||
|
myError += data.toString();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
options.env = {CODECOV_TOKEN: 'e0f9f29c-c2e4-4dd3-b440-0c2bc6937859', GITHUB_ACTION: process.env.GITHUB_ACTION, GITHUB_REF: process.env.GITHUB_REF, GITHUB_REPOSITORY: process.env.GITHUB_REPOSITORY, GITHUB_SHA: process.env.GITHUB_SHA};
|
||||||
|
|
||||||
|
exec.exec('bash', ['codecov.sh'], options);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
1
node_modules/.bin/rimraf
generated
vendored
Symbolic link
1
node_modules/.bin/rimraf
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../rimraf/bin.js
|
||||||
5
node_modules/balanced-match/.npmignore
generated
vendored
Normal file
5
node_modules/balanced-match/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
test
|
||||||
|
.gitignore
|
||||||
|
.travis.yml
|
||||||
|
Makefile
|
||||||
|
example.js
|
||||||
21
node_modules/balanced-match/LICENSE.md
generated
vendored
Normal file
21
node_modules/balanced-match/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
(MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2013 Julian Gruber <julian@juliangruber.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.
|
||||||
91
node_modules/balanced-match/README.md
generated
vendored
Normal file
91
node_modules/balanced-match/README.md
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
# balanced-match
|
||||||
|
|
||||||
|
Match balanced string pairs, like `{` and `}` or `<b>` and `</b>`. Supports regular expressions as well!
|
||||||
|
|
||||||
|
[](http://travis-ci.org/juliangruber/balanced-match)
|
||||||
|
[](https://www.npmjs.org/package/balanced-match)
|
||||||
|
|
||||||
|
[](https://ci.testling.com/juliangruber/balanced-match)
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
Get the first matching pair of braces:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var balanced = require('balanced-match');
|
||||||
|
|
||||||
|
console.log(balanced('{', '}', 'pre{in{nested}}post'));
|
||||||
|
console.log(balanced('{', '}', 'pre{first}between{second}post'));
|
||||||
|
console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post'));
|
||||||
|
```
|
||||||
|
|
||||||
|
The matches are:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ node example.js
|
||||||
|
{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' }
|
||||||
|
{ start: 3,
|
||||||
|
end: 9,
|
||||||
|
pre: 'pre',
|
||||||
|
body: 'first',
|
||||||
|
post: 'between{second}post' }
|
||||||
|
{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' }
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### var m = balanced(a, b, str)
|
||||||
|
|
||||||
|
For the first non-nested matching pair of `a` and `b` in `str`, return an
|
||||||
|
object with those keys:
|
||||||
|
|
||||||
|
* **start** the index of the first match of `a`
|
||||||
|
* **end** the index of the matching `b`
|
||||||
|
* **pre** the preamble, `a` and `b` not included
|
||||||
|
* **body** the match, `a` and `b` not included
|
||||||
|
* **post** the postscript, `a` and `b` not included
|
||||||
|
|
||||||
|
If there's no match, `undefined` will be returned.
|
||||||
|
|
||||||
|
If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`.
|
||||||
|
|
||||||
|
### var r = balanced.range(a, b, str)
|
||||||
|
|
||||||
|
For the first non-nested matching pair of `a` and `b` in `str`, return an
|
||||||
|
array with indexes: `[ <a index>, <b index> ]`.
|
||||||
|
|
||||||
|
If there's no match, `undefined` will be returned.
|
||||||
|
|
||||||
|
If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
With [npm](https://npmjs.org) do:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install balanced-match
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
(MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2013 Julian Gruber <julian@juliangruber.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.
|
||||||
59
node_modules/balanced-match/index.js
generated
vendored
Normal file
59
node_modules/balanced-match/index.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
'use strict';
|
||||||
|
module.exports = balanced;
|
||||||
|
function balanced(a, b, str) {
|
||||||
|
if (a instanceof RegExp) a = maybeMatch(a, str);
|
||||||
|
if (b instanceof RegExp) b = maybeMatch(b, str);
|
||||||
|
|
||||||
|
var r = range(a, b, str);
|
||||||
|
|
||||||
|
return r && {
|
||||||
|
start: r[0],
|
||||||
|
end: r[1],
|
||||||
|
pre: str.slice(0, r[0]),
|
||||||
|
body: str.slice(r[0] + a.length, r[1]),
|
||||||
|
post: str.slice(r[1] + b.length)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function maybeMatch(reg, str) {
|
||||||
|
var m = str.match(reg);
|
||||||
|
return m ? m[0] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
balanced.range = range;
|
||||||
|
function range(a, b, str) {
|
||||||
|
var begs, beg, left, right, result;
|
||||||
|
var ai = str.indexOf(a);
|
||||||
|
var bi = str.indexOf(b, ai + 1);
|
||||||
|
var i = ai;
|
||||||
|
|
||||||
|
if (ai >= 0 && bi > 0) {
|
||||||
|
begs = [];
|
||||||
|
left = str.length;
|
||||||
|
|
||||||
|
while (i >= 0 && !result) {
|
||||||
|
if (i == ai) {
|
||||||
|
begs.push(i);
|
||||||
|
ai = str.indexOf(a, i + 1);
|
||||||
|
} else if (begs.length == 1) {
|
||||||
|
result = [ begs.pop(), bi ];
|
||||||
|
} else {
|
||||||
|
beg = begs.pop();
|
||||||
|
if (beg < left) {
|
||||||
|
left = beg;
|
||||||
|
right = bi;
|
||||||
|
}
|
||||||
|
|
||||||
|
bi = str.indexOf(b, i + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
i = ai < bi && ai >= 0 ? ai : bi;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (begs.length) {
|
||||||
|
result = [ left, right ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
77
node_modules/balanced-match/package.json
generated
vendored
Normal file
77
node_modules/balanced-match/package.json
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
{
|
||||||
|
"_from": "balanced-match@^1.0.0",
|
||||||
|
"_id": "balanced-match@1.0.0",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
|
||||||
|
"_location": "/balanced-match",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "balanced-match@^1.0.0",
|
||||||
|
"name": "balanced-match",
|
||||||
|
"escapedName": "balanced-match",
|
||||||
|
"rawSpec": "^1.0.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^1.0.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/brace-expansion"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||||
|
"_shasum": "89b4d199ab2bee49de164ea02b89ce462d71b767",
|
||||||
|
"_spec": "balanced-match@^1.0.0",
|
||||||
|
"_where": "/Users/Ibrahim/Desktop/test2/node_modules/brace-expansion",
|
||||||
|
"author": {
|
||||||
|
"name": "Julian Gruber",
|
||||||
|
"email": "mail@juliangruber.com",
|
||||||
|
"url": "http://juliangruber.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/juliangruber/balanced-match/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Match balanced character pairs, like \"{\" and \"}\"",
|
||||||
|
"devDependencies": {
|
||||||
|
"matcha": "^0.7.0",
|
||||||
|
"tape": "^4.6.0"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/juliangruber/balanced-match",
|
||||||
|
"keywords": [
|
||||||
|
"match",
|
||||||
|
"regexp",
|
||||||
|
"test",
|
||||||
|
"balanced",
|
||||||
|
"parse"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "index.js",
|
||||||
|
"name": "balanced-match",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/juliangruber/balanced-match.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"bench": "make bench",
|
||||||
|
"test": "make test"
|
||||||
|
},
|
||||||
|
"testling": {
|
||||||
|
"files": "test/*.js",
|
||||||
|
"browsers": [
|
||||||
|
"ie/8..latest",
|
||||||
|
"firefox/20..latest",
|
||||||
|
"firefox/nightly",
|
||||||
|
"chrome/25..latest",
|
||||||
|
"chrome/canary",
|
||||||
|
"opera/12..latest",
|
||||||
|
"opera/next",
|
||||||
|
"safari/5.1..latest",
|
||||||
|
"ipad/6.0..latest",
|
||||||
|
"iphone/6.0..latest",
|
||||||
|
"android-browser/4.2..latest"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"version": "1.0.0"
|
||||||
|
}
|
||||||
21
node_modules/brace-expansion/LICENSE
generated
vendored
Normal file
21
node_modules/brace-expansion/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2013 Julian Gruber <julian@juliangruber.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.
|
||||||
129
node_modules/brace-expansion/README.md
generated
vendored
Normal file
129
node_modules/brace-expansion/README.md
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
# brace-expansion
|
||||||
|
|
||||||
|
[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html),
|
||||||
|
as known from sh/bash, in JavaScript.
|
||||||
|
|
||||||
|
[](http://travis-ci.org/juliangruber/brace-expansion)
|
||||||
|
[](https://www.npmjs.org/package/brace-expansion)
|
||||||
|
[](https://greenkeeper.io/)
|
||||||
|
|
||||||
|
[](https://ci.testling.com/juliangruber/brace-expansion)
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```js
|
||||||
|
var expand = require('brace-expansion');
|
||||||
|
|
||||||
|
expand('file-{a,b,c}.jpg')
|
||||||
|
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
|
||||||
|
|
||||||
|
expand('-v{,,}')
|
||||||
|
// => ['-v', '-v', '-v']
|
||||||
|
|
||||||
|
expand('file{0..2}.jpg')
|
||||||
|
// => ['file0.jpg', 'file1.jpg', 'file2.jpg']
|
||||||
|
|
||||||
|
expand('file-{a..c}.jpg')
|
||||||
|
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
|
||||||
|
|
||||||
|
expand('file{2..0}.jpg')
|
||||||
|
// => ['file2.jpg', 'file1.jpg', 'file0.jpg']
|
||||||
|
|
||||||
|
expand('file{0..4..2}.jpg')
|
||||||
|
// => ['file0.jpg', 'file2.jpg', 'file4.jpg']
|
||||||
|
|
||||||
|
expand('file-{a..e..2}.jpg')
|
||||||
|
// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg']
|
||||||
|
|
||||||
|
expand('file{00..10..5}.jpg')
|
||||||
|
// => ['file00.jpg', 'file05.jpg', 'file10.jpg']
|
||||||
|
|
||||||
|
expand('{{A..C},{a..c}}')
|
||||||
|
// => ['A', 'B', 'C', 'a', 'b', 'c']
|
||||||
|
|
||||||
|
expand('ppp{,config,oe{,conf}}')
|
||||||
|
// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf']
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
```js
|
||||||
|
var expand = require('brace-expansion');
|
||||||
|
```
|
||||||
|
|
||||||
|
### var expanded = expand(str)
|
||||||
|
|
||||||
|
Return an array of all possible and valid expansions of `str`. If none are
|
||||||
|
found, `[str]` is returned.
|
||||||
|
|
||||||
|
Valid expansions are:
|
||||||
|
|
||||||
|
```js
|
||||||
|
/^(.*,)+(.+)?$/
|
||||||
|
// {a,b,...}
|
||||||
|
```
|
||||||
|
|
||||||
|
A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
|
||||||
|
// {x..y[..incr]}
|
||||||
|
```
|
||||||
|
|
||||||
|
A numeric sequence from `x` to `y` inclusive, with optional increment.
|
||||||
|
If `x` or `y` start with a leading `0`, all the numbers will be padded
|
||||||
|
to have equal length. Negative numbers and backwards iteration work too.
|
||||||
|
|
||||||
|
```js
|
||||||
|
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
|
||||||
|
// {x..y[..incr]}
|
||||||
|
```
|
||||||
|
|
||||||
|
An alphabetic sequence from `x` to `y` inclusive, with optional increment.
|
||||||
|
`x` and `y` must be exactly one character, and if given, `incr` must be a
|
||||||
|
number.
|
||||||
|
|
||||||
|
For compatibility reasons, the string `${` is not eligible for brace expansion.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
With [npm](https://npmjs.org) do:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install brace-expansion
|
||||||
|
```
|
||||||
|
|
||||||
|
## Contributors
|
||||||
|
|
||||||
|
- [Julian Gruber](https://github.com/juliangruber)
|
||||||
|
- [Isaac Z. Schlueter](https://github.com/isaacs)
|
||||||
|
|
||||||
|
## Sponsors
|
||||||
|
|
||||||
|
This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)!
|
||||||
|
|
||||||
|
Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)!
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
(MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2013 Julian Gruber <julian@juliangruber.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.
|
||||||
201
node_modules/brace-expansion/index.js
generated
vendored
Normal file
201
node_modules/brace-expansion/index.js
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
|||||||
|
var concatMap = require('concat-map');
|
||||||
|
var balanced = require('balanced-match');
|
||||||
|
|
||||||
|
module.exports = expandTop;
|
||||||
|
|
||||||
|
var escSlash = '\0SLASH'+Math.random()+'\0';
|
||||||
|
var escOpen = '\0OPEN'+Math.random()+'\0';
|
||||||
|
var escClose = '\0CLOSE'+Math.random()+'\0';
|
||||||
|
var escComma = '\0COMMA'+Math.random()+'\0';
|
||||||
|
var escPeriod = '\0PERIOD'+Math.random()+'\0';
|
||||||
|
|
||||||
|
function numeric(str) {
|
||||||
|
return parseInt(str, 10) == str
|
||||||
|
? parseInt(str, 10)
|
||||||
|
: str.charCodeAt(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function escapeBraces(str) {
|
||||||
|
return str.split('\\\\').join(escSlash)
|
||||||
|
.split('\\{').join(escOpen)
|
||||||
|
.split('\\}').join(escClose)
|
||||||
|
.split('\\,').join(escComma)
|
||||||
|
.split('\\.').join(escPeriod);
|
||||||
|
}
|
||||||
|
|
||||||
|
function unescapeBraces(str) {
|
||||||
|
return str.split(escSlash).join('\\')
|
||||||
|
.split(escOpen).join('{')
|
||||||
|
.split(escClose).join('}')
|
||||||
|
.split(escComma).join(',')
|
||||||
|
.split(escPeriod).join('.');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Basically just str.split(","), but handling cases
|
||||||
|
// where we have nested braced sections, which should be
|
||||||
|
// treated as individual members, like {a,{b,c},d}
|
||||||
|
function parseCommaParts(str) {
|
||||||
|
if (!str)
|
||||||
|
return [''];
|
||||||
|
|
||||||
|
var parts = [];
|
||||||
|
var m = balanced('{', '}', str);
|
||||||
|
|
||||||
|
if (!m)
|
||||||
|
return str.split(',');
|
||||||
|
|
||||||
|
var pre = m.pre;
|
||||||
|
var body = m.body;
|
||||||
|
var post = m.post;
|
||||||
|
var p = pre.split(',');
|
||||||
|
|
||||||
|
p[p.length-1] += '{' + body + '}';
|
||||||
|
var postParts = parseCommaParts(post);
|
||||||
|
if (post.length) {
|
||||||
|
p[p.length-1] += postParts.shift();
|
||||||
|
p.push.apply(p, postParts);
|
||||||
|
}
|
||||||
|
|
||||||
|
parts.push.apply(parts, p);
|
||||||
|
|
||||||
|
return parts;
|
||||||
|
}
|
||||||
|
|
||||||
|
function expandTop(str) {
|
||||||
|
if (!str)
|
||||||
|
return [];
|
||||||
|
|
||||||
|
// I don't know why Bash 4.3 does this, but it does.
|
||||||
|
// Anything starting with {} will have the first two bytes preserved
|
||||||
|
// but *only* at the top level, so {},a}b will not expand to anything,
|
||||||
|
// but a{},b}c will be expanded to [a}c,abc].
|
||||||
|
// One could argue that this is a bug in Bash, but since the goal of
|
||||||
|
// this module is to match Bash's rules, we escape a leading {}
|
||||||
|
if (str.substr(0, 2) === '{}') {
|
||||||
|
str = '\\{\\}' + str.substr(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return expand(escapeBraces(str), true).map(unescapeBraces);
|
||||||
|
}
|
||||||
|
|
||||||
|
function identity(e) {
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
function embrace(str) {
|
||||||
|
return '{' + str + '}';
|
||||||
|
}
|
||||||
|
function isPadded(el) {
|
||||||
|
return /^-?0\d/.test(el);
|
||||||
|
}
|
||||||
|
|
||||||
|
function lte(i, y) {
|
||||||
|
return i <= y;
|
||||||
|
}
|
||||||
|
function gte(i, y) {
|
||||||
|
return i >= y;
|
||||||
|
}
|
||||||
|
|
||||||
|
function expand(str, isTop) {
|
||||||
|
var expansions = [];
|
||||||
|
|
||||||
|
var m = balanced('{', '}', str);
|
||||||
|
if (!m || /\$$/.test(m.pre)) return [str];
|
||||||
|
|
||||||
|
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
||||||
|
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
||||||
|
var isSequence = isNumericSequence || isAlphaSequence;
|
||||||
|
var isOptions = m.body.indexOf(',') >= 0;
|
||||||
|
if (!isSequence && !isOptions) {
|
||||||
|
// {a},b}
|
||||||
|
if (m.post.match(/,.*\}/)) {
|
||||||
|
str = m.pre + '{' + m.body + escClose + m.post;
|
||||||
|
return expand(str);
|
||||||
|
}
|
||||||
|
return [str];
|
||||||
|
}
|
||||||
|
|
||||||
|
var n;
|
||||||
|
if (isSequence) {
|
||||||
|
n = m.body.split(/\.\./);
|
||||||
|
} else {
|
||||||
|
n = parseCommaParts(m.body);
|
||||||
|
if (n.length === 1) {
|
||||||
|
// x{{a,b}}y ==> x{a}y x{b}y
|
||||||
|
n = expand(n[0], false).map(embrace);
|
||||||
|
if (n.length === 1) {
|
||||||
|
var post = m.post.length
|
||||||
|
? expand(m.post, false)
|
||||||
|
: [''];
|
||||||
|
return post.map(function(p) {
|
||||||
|
return m.pre + n[0] + p;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// at this point, n is the parts, and we know it's not a comma set
|
||||||
|
// with a single entry.
|
||||||
|
|
||||||
|
// no need to expand pre, since it is guaranteed to be free of brace-sets
|
||||||
|
var pre = m.pre;
|
||||||
|
var post = m.post.length
|
||||||
|
? expand(m.post, false)
|
||||||
|
: [''];
|
||||||
|
|
||||||
|
var N;
|
||||||
|
|
||||||
|
if (isSequence) {
|
||||||
|
var x = numeric(n[0]);
|
||||||
|
var y = numeric(n[1]);
|
||||||
|
var width = Math.max(n[0].length, n[1].length)
|
||||||
|
var incr = n.length == 3
|
||||||
|
? Math.abs(numeric(n[2]))
|
||||||
|
: 1;
|
||||||
|
var test = lte;
|
||||||
|
var reverse = y < x;
|
||||||
|
if (reverse) {
|
||||||
|
incr *= -1;
|
||||||
|
test = gte;
|
||||||
|
}
|
||||||
|
var pad = n.some(isPadded);
|
||||||
|
|
||||||
|
N = [];
|
||||||
|
|
||||||
|
for (var i = x; test(i, y); i += incr) {
|
||||||
|
var c;
|
||||||
|
if (isAlphaSequence) {
|
||||||
|
c = String.fromCharCode(i);
|
||||||
|
if (c === '\\')
|
||||||
|
c = '';
|
||||||
|
} else {
|
||||||
|
c = String(i);
|
||||||
|
if (pad) {
|
||||||
|
var need = width - c.length;
|
||||||
|
if (need > 0) {
|
||||||
|
var z = new Array(need + 1).join('0');
|
||||||
|
if (i < 0)
|
||||||
|
c = '-' + z + c.slice(1);
|
||||||
|
else
|
||||||
|
c = z + c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
N.push(c);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
N = concatMap(n, function(el) { return expand(el, false) });
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var j = 0; j < N.length; j++) {
|
||||||
|
for (var k = 0; k < post.length; k++) {
|
||||||
|
var expansion = pre + N[j] + post[k];
|
||||||
|
if (!isTop || isSequence || expansion)
|
||||||
|
expansions.push(expansion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return expansions;
|
||||||
|
}
|
||||||
|
|
||||||
75
node_modules/brace-expansion/package.json
generated
vendored
Normal file
75
node_modules/brace-expansion/package.json
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
{
|
||||||
|
"_from": "brace-expansion@^1.1.7",
|
||||||
|
"_id": "brace-expansion@1.1.11",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||||
|
"_location": "/brace-expansion",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "brace-expansion@^1.1.7",
|
||||||
|
"name": "brace-expansion",
|
||||||
|
"escapedName": "brace-expansion",
|
||||||
|
"rawSpec": "^1.1.7",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^1.1.7"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/minimatch"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||||
|
"_shasum": "3c7fcbf529d87226f3d2f52b966ff5271eb441dd",
|
||||||
|
"_spec": "brace-expansion@^1.1.7",
|
||||||
|
"_where": "/Users/Ibrahim/Desktop/test2/node_modules/minimatch",
|
||||||
|
"author": {
|
||||||
|
"name": "Julian Gruber",
|
||||||
|
"email": "mail@juliangruber.com",
|
||||||
|
"url": "http://juliangruber.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/juliangruber/brace-expansion/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {
|
||||||
|
"balanced-match": "^1.0.0",
|
||||||
|
"concat-map": "0.0.1"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Brace expansion as known from sh/bash",
|
||||||
|
"devDependencies": {
|
||||||
|
"matcha": "^0.7.0",
|
||||||
|
"tape": "^4.6.0"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/juliangruber/brace-expansion",
|
||||||
|
"keywords": [],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "index.js",
|
||||||
|
"name": "brace-expansion",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/juliangruber/brace-expansion.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"bench": "matcha test/perf/bench.js",
|
||||||
|
"gentest": "bash test/generate.sh",
|
||||||
|
"test": "tape test/*.js"
|
||||||
|
},
|
||||||
|
"testling": {
|
||||||
|
"files": "test/*.js",
|
||||||
|
"browsers": [
|
||||||
|
"ie/8..latest",
|
||||||
|
"firefox/20..latest",
|
||||||
|
"firefox/nightly",
|
||||||
|
"chrome/25..latest",
|
||||||
|
"chrome/canary",
|
||||||
|
"opera/12..latest",
|
||||||
|
"opera/next",
|
||||||
|
"safari/5.1..latest",
|
||||||
|
"ipad/6.0..latest",
|
||||||
|
"iphone/6.0..latest",
|
||||||
|
"android-browser/4.2..latest"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"version": "1.1.11"
|
||||||
|
}
|
||||||
4
node_modules/concat-map/.travis.yml
generated
vendored
Normal file
4
node_modules/concat-map/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
language: node_js
|
||||||
|
node_js:
|
||||||
|
- 0.4
|
||||||
|
- 0.6
|
||||||
18
node_modules/concat-map/LICENSE
generated
vendored
Normal file
18
node_modules/concat-map/LICENSE
generated
vendored
Normal 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.
|
||||||
62
node_modules/concat-map/README.markdown
generated
vendored
Normal file
62
node_modules/concat-map/README.markdown
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
concat-map
|
||||||
|
==========
|
||||||
|
|
||||||
|
Concatenative mapdashery.
|
||||||
|
|
||||||
|
[](http://ci.testling.com/substack/node-concat-map)
|
||||||
|
|
||||||
|
[](http://travis-ci.org/substack/node-concat-map)
|
||||||
|
|
||||||
|
example
|
||||||
|
=======
|
||||||
|
|
||||||
|
``` js
|
||||||
|
var concatMap = require('concat-map');
|
||||||
|
var xs = [ 1, 2, 3, 4, 5, 6 ];
|
||||||
|
var ys = concatMap(xs, function (x) {
|
||||||
|
return x % 2 ? [ x - 0.1, x, x + 0.1 ] : [];
|
||||||
|
});
|
||||||
|
console.dir(ys);
|
||||||
|
```
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
```
|
||||||
|
[ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]
|
||||||
|
```
|
||||||
|
|
||||||
|
methods
|
||||||
|
=======
|
||||||
|
|
||||||
|
``` js
|
||||||
|
var concatMap = require('concat-map')
|
||||||
|
```
|
||||||
|
|
||||||
|
concatMap(xs, fn)
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
Return an array of concatenated elements by calling `fn(x, i)` for each element
|
||||||
|
`x` and each index `i` in the array `xs`.
|
||||||
|
|
||||||
|
When `fn(x, i)` returns an array, its result will be concatenated with the
|
||||||
|
result array. If `fn(x, i)` returns anything else, that value will be pushed
|
||||||
|
onto the end of the result array.
|
||||||
|
|
||||||
|
install
|
||||||
|
=======
|
||||||
|
|
||||||
|
With [npm](http://npmjs.org) do:
|
||||||
|
|
||||||
|
```
|
||||||
|
npm install concat-map
|
||||||
|
```
|
||||||
|
|
||||||
|
license
|
||||||
|
=======
|
||||||
|
|
||||||
|
MIT
|
||||||
|
|
||||||
|
notes
|
||||||
|
=====
|
||||||
|
|
||||||
|
This module was written while sitting high above the ground in a tree.
|
||||||
6
node_modules/concat-map/example/map.js
generated
vendored
Normal file
6
node_modules/concat-map/example/map.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
var concatMap = require('../');
|
||||||
|
var xs = [ 1, 2, 3, 4, 5, 6 ];
|
||||||
|
var ys = concatMap(xs, function (x) {
|
||||||
|
return x % 2 ? [ x - 0.1, x, x + 0.1 ] : [];
|
||||||
|
});
|
||||||
|
console.dir(ys);
|
||||||
13
node_modules/concat-map/index.js
generated
vendored
Normal file
13
node_modules/concat-map/index.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
module.exports = function (xs, fn) {
|
||||||
|
var res = [];
|
||||||
|
for (var i = 0; i < xs.length; i++) {
|
||||||
|
var x = fn(xs[i], i);
|
||||||
|
if (isArray(x)) res.push.apply(res, x);
|
||||||
|
else res.push(x);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
};
|
||||||
|
|
||||||
|
var isArray = Array.isArray || function (xs) {
|
||||||
|
return Object.prototype.toString.call(xs) === '[object Array]';
|
||||||
|
};
|
||||||
88
node_modules/concat-map/package.json
generated
vendored
Normal file
88
node_modules/concat-map/package.json
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
{
|
||||||
|
"_from": "concat-map@0.0.1",
|
||||||
|
"_id": "concat-map@0.0.1",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
|
||||||
|
"_location": "/concat-map",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "concat-map@0.0.1",
|
||||||
|
"name": "concat-map",
|
||||||
|
"escapedName": "concat-map",
|
||||||
|
"rawSpec": "0.0.1",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "0.0.1"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/brace-expansion"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||||
|
"_shasum": "d8a96bd77fd68df7793a73036a3ba0d5405d477b",
|
||||||
|
"_spec": "concat-map@0.0.1",
|
||||||
|
"_where": "/Users/Ibrahim/Desktop/test2/node_modules/brace-expansion",
|
||||||
|
"author": {
|
||||||
|
"name": "James Halliday",
|
||||||
|
"email": "mail@substack.net",
|
||||||
|
"url": "http://substack.net"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/substack/node-concat-map/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "concatenative mapdashery",
|
||||||
|
"devDependencies": {
|
||||||
|
"tape": "~2.4.0"
|
||||||
|
},
|
||||||
|
"directories": {
|
||||||
|
"example": "example",
|
||||||
|
"test": "test"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/substack/node-concat-map#readme",
|
||||||
|
"keywords": [
|
||||||
|
"concat",
|
||||||
|
"concatMap",
|
||||||
|
"map",
|
||||||
|
"functional",
|
||||||
|
"higher-order"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "index.js",
|
||||||
|
"name": "concat-map",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/substack/node-concat-map.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "tape test/*.js"
|
||||||
|
},
|
||||||
|
"testling": {
|
||||||
|
"files": "test/*.js",
|
||||||
|
"browsers": {
|
||||||
|
"ie": [
|
||||||
|
6,
|
||||||
|
7,
|
||||||
|
8,
|
||||||
|
9
|
||||||
|
],
|
||||||
|
"ff": [
|
||||||
|
3.5,
|
||||||
|
10,
|
||||||
|
15
|
||||||
|
],
|
||||||
|
"chrome": [
|
||||||
|
10,
|
||||||
|
22
|
||||||
|
],
|
||||||
|
"safari": [
|
||||||
|
5.1
|
||||||
|
],
|
||||||
|
"opera": [
|
||||||
|
12
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"version": "0.0.1"
|
||||||
|
}
|
||||||
39
node_modules/concat-map/test/map.js
generated
vendored
Normal file
39
node_modules/concat-map/test/map.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
var concatMap = require('../');
|
||||||
|
var test = require('tape');
|
||||||
|
|
||||||
|
test('empty or not', function (t) {
|
||||||
|
var xs = [ 1, 2, 3, 4, 5, 6 ];
|
||||||
|
var ixes = [];
|
||||||
|
var ys = concatMap(xs, function (x, ix) {
|
||||||
|
ixes.push(ix);
|
||||||
|
return x % 2 ? [ x - 0.1, x, x + 0.1 ] : [];
|
||||||
|
});
|
||||||
|
t.same(ys, [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]);
|
||||||
|
t.same(ixes, [ 0, 1, 2, 3, 4, 5 ]);
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('always something', function (t) {
|
||||||
|
var xs = [ 'a', 'b', 'c', 'd' ];
|
||||||
|
var ys = concatMap(xs, function (x) {
|
||||||
|
return x === 'b' ? [ 'B', 'B', 'B' ] : [ x ];
|
||||||
|
});
|
||||||
|
t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]);
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('scalars', function (t) {
|
||||||
|
var xs = [ 'a', 'b', 'c', 'd' ];
|
||||||
|
var ys = concatMap(xs, function (x) {
|
||||||
|
return x === 'b' ? [ 'B', 'B', 'B' ] : x;
|
||||||
|
});
|
||||||
|
t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]);
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('undefs', function (t) {
|
||||||
|
var xs = [ 'a', 'b', 'c', 'd' ];
|
||||||
|
var ys = concatMap(xs, function () {});
|
||||||
|
t.same(ys, [ undefined, undefined, undefined, undefined ]);
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
43
node_modules/fs.realpath/LICENSE
generated
vendored
Normal file
43
node_modules/fs.realpath/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
The ISC License
|
||||||
|
|
||||||
|
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||||
|
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
This library bundles a version of the `fs.realpath` and `fs.realpathSync`
|
||||||
|
methods from Node.js v0.10 under the terms of the Node.js MIT license.
|
||||||
|
|
||||||
|
Node's license follows, also included at the header of `old.js` which contains
|
||||||
|
the licensed code:
|
||||||
|
|
||||||
|
Copyright Joyent, Inc. and other Node contributors.
|
||||||
|
|
||||||
|
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.
|
||||||
33
node_modules/fs.realpath/README.md
generated
vendored
Normal file
33
node_modules/fs.realpath/README.md
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# fs.realpath
|
||||||
|
|
||||||
|
A backwards-compatible fs.realpath for Node v6 and above
|
||||||
|
|
||||||
|
In Node v6, the JavaScript implementation of fs.realpath was replaced
|
||||||
|
with a faster (but less resilient) native implementation. That raises
|
||||||
|
new and platform-specific errors and cannot handle long or excessively
|
||||||
|
symlink-looping paths.
|
||||||
|
|
||||||
|
This module handles those cases by detecting the new errors and
|
||||||
|
falling back to the JavaScript implementation. On versions of Node
|
||||||
|
prior to v6, it has no effect.
|
||||||
|
|
||||||
|
## USAGE
|
||||||
|
|
||||||
|
```js
|
||||||
|
var rp = require('fs.realpath')
|
||||||
|
|
||||||
|
// async version
|
||||||
|
rp.realpath(someLongAndLoopingPath, function (er, real) {
|
||||||
|
// the ELOOP was handled, but it was a bit slower
|
||||||
|
})
|
||||||
|
|
||||||
|
// sync version
|
||||||
|
var real = rp.realpathSync(someLongAndLoopingPath)
|
||||||
|
|
||||||
|
// monkeypatch at your own risk!
|
||||||
|
// This replaces the fs.realpath/fs.realpathSync builtins
|
||||||
|
rp.monkeypatch()
|
||||||
|
|
||||||
|
// un-do the monkeypatching
|
||||||
|
rp.unmonkeypatch()
|
||||||
|
```
|
||||||
66
node_modules/fs.realpath/index.js
generated
vendored
Normal file
66
node_modules/fs.realpath/index.js
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
module.exports = realpath
|
||||||
|
realpath.realpath = realpath
|
||||||
|
realpath.sync = realpathSync
|
||||||
|
realpath.realpathSync = realpathSync
|
||||||
|
realpath.monkeypatch = monkeypatch
|
||||||
|
realpath.unmonkeypatch = unmonkeypatch
|
||||||
|
|
||||||
|
var fs = require('fs')
|
||||||
|
var origRealpath = fs.realpath
|
||||||
|
var origRealpathSync = fs.realpathSync
|
||||||
|
|
||||||
|
var version = process.version
|
||||||
|
var ok = /^v[0-5]\./.test(version)
|
||||||
|
var old = require('./old.js')
|
||||||
|
|
||||||
|
function newError (er) {
|
||||||
|
return er && er.syscall === 'realpath' && (
|
||||||
|
er.code === 'ELOOP' ||
|
||||||
|
er.code === 'ENOMEM' ||
|
||||||
|
er.code === 'ENAMETOOLONG'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function realpath (p, cache, cb) {
|
||||||
|
if (ok) {
|
||||||
|
return origRealpath(p, cache, cb)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof cache === 'function') {
|
||||||
|
cb = cache
|
||||||
|
cache = null
|
||||||
|
}
|
||||||
|
origRealpath(p, cache, function (er, result) {
|
||||||
|
if (newError(er)) {
|
||||||
|
old.realpath(p, cache, cb)
|
||||||
|
} else {
|
||||||
|
cb(er, result)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function realpathSync (p, cache) {
|
||||||
|
if (ok) {
|
||||||
|
return origRealpathSync(p, cache)
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return origRealpathSync(p, cache)
|
||||||
|
} catch (er) {
|
||||||
|
if (newError(er)) {
|
||||||
|
return old.realpathSync(p, cache)
|
||||||
|
} else {
|
||||||
|
throw er
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function monkeypatch () {
|
||||||
|
fs.realpath = realpath
|
||||||
|
fs.realpathSync = realpathSync
|
||||||
|
}
|
||||||
|
|
||||||
|
function unmonkeypatch () {
|
||||||
|
fs.realpath = origRealpath
|
||||||
|
fs.realpathSync = origRealpathSync
|
||||||
|
}
|
||||||
303
node_modules/fs.realpath/old.js
generated
vendored
Normal file
303
node_modules/fs.realpath/old.js
generated
vendored
Normal file
@@ -0,0 +1,303 @@
|
|||||||
|
// Copyright Joyent, Inc. and other Node contributors.
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
var pathModule = require('path');
|
||||||
|
var isWindows = process.platform === 'win32';
|
||||||
|
var fs = require('fs');
|
||||||
|
|
||||||
|
// JavaScript implementation of realpath, ported from node pre-v6
|
||||||
|
|
||||||
|
var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
|
||||||
|
|
||||||
|
function rethrow() {
|
||||||
|
// Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and
|
||||||
|
// is fairly slow to generate.
|
||||||
|
var callback;
|
||||||
|
if (DEBUG) {
|
||||||
|
var backtrace = new Error;
|
||||||
|
callback = debugCallback;
|
||||||
|
} else
|
||||||
|
callback = missingCallback;
|
||||||
|
|
||||||
|
return callback;
|
||||||
|
|
||||||
|
function debugCallback(err) {
|
||||||
|
if (err) {
|
||||||
|
backtrace.message = err.message;
|
||||||
|
err = backtrace;
|
||||||
|
missingCallback(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function missingCallback(err) {
|
||||||
|
if (err) {
|
||||||
|
if (process.throwDeprecation)
|
||||||
|
throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs
|
||||||
|
else if (!process.noDeprecation) {
|
||||||
|
var msg = 'fs: missing callback ' + (err.stack || err.message);
|
||||||
|
if (process.traceDeprecation)
|
||||||
|
console.trace(msg);
|
||||||
|
else
|
||||||
|
console.error(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function maybeCallback(cb) {
|
||||||
|
return typeof cb === 'function' ? cb : rethrow();
|
||||||
|
}
|
||||||
|
|
||||||
|
var normalize = pathModule.normalize;
|
||||||
|
|
||||||
|
// Regexp that finds the next partion of a (partial) path
|
||||||
|
// result is [base_with_slash, base], e.g. ['somedir/', 'somedir']
|
||||||
|
if (isWindows) {
|
||||||
|
var nextPartRe = /(.*?)(?:[\/\\]+|$)/g;
|
||||||
|
} else {
|
||||||
|
var nextPartRe = /(.*?)(?:[\/]+|$)/g;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Regex to find the device root, including trailing slash. E.g. 'c:\\'.
|
||||||
|
if (isWindows) {
|
||||||
|
var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;
|
||||||
|
} else {
|
||||||
|
var splitRootRe = /^[\/]*/;
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.realpathSync = function realpathSync(p, cache) {
|
||||||
|
// make p is absolute
|
||||||
|
p = pathModule.resolve(p);
|
||||||
|
|
||||||
|
if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
|
||||||
|
return cache[p];
|
||||||
|
}
|
||||||
|
|
||||||
|
var original = p,
|
||||||
|
seenLinks = {},
|
||||||
|
knownHard = {};
|
||||||
|
|
||||||
|
// current character position in p
|
||||||
|
var pos;
|
||||||
|
// the partial path so far, including a trailing slash if any
|
||||||
|
var current;
|
||||||
|
// the partial path without a trailing slash (except when pointing at a root)
|
||||||
|
var base;
|
||||||
|
// the partial path scanned in the previous round, with slash
|
||||||
|
var previous;
|
||||||
|
|
||||||
|
start();
|
||||||
|
|
||||||
|
function start() {
|
||||||
|
// Skip over roots
|
||||||
|
var m = splitRootRe.exec(p);
|
||||||
|
pos = m[0].length;
|
||||||
|
current = m[0];
|
||||||
|
base = m[0];
|
||||||
|
previous = '';
|
||||||
|
|
||||||
|
// On windows, check that the root exists. On unix there is no need.
|
||||||
|
if (isWindows && !knownHard[base]) {
|
||||||
|
fs.lstatSync(base);
|
||||||
|
knownHard[base] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// walk down the path, swapping out linked pathparts for their real
|
||||||
|
// values
|
||||||
|
// NB: p.length changes.
|
||||||
|
while (pos < p.length) {
|
||||||
|
// find the next part
|
||||||
|
nextPartRe.lastIndex = pos;
|
||||||
|
var result = nextPartRe.exec(p);
|
||||||
|
previous = current;
|
||||||
|
current += result[0];
|
||||||
|
base = previous + result[1];
|
||||||
|
pos = nextPartRe.lastIndex;
|
||||||
|
|
||||||
|
// continue if not a symlink
|
||||||
|
if (knownHard[base] || (cache && cache[base] === base)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var resolvedLink;
|
||||||
|
if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
|
||||||
|
// some known symbolic link. no need to stat again.
|
||||||
|
resolvedLink = cache[base];
|
||||||
|
} else {
|
||||||
|
var stat = fs.lstatSync(base);
|
||||||
|
if (!stat.isSymbolicLink()) {
|
||||||
|
knownHard[base] = true;
|
||||||
|
if (cache) cache[base] = base;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// read the link if it wasn't read before
|
||||||
|
// dev/ino always return 0 on windows, so skip the check.
|
||||||
|
var linkTarget = null;
|
||||||
|
if (!isWindows) {
|
||||||
|
var id = stat.dev.toString(32) + ':' + stat.ino.toString(32);
|
||||||
|
if (seenLinks.hasOwnProperty(id)) {
|
||||||
|
linkTarget = seenLinks[id];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (linkTarget === null) {
|
||||||
|
fs.statSync(base);
|
||||||
|
linkTarget = fs.readlinkSync(base);
|
||||||
|
}
|
||||||
|
resolvedLink = pathModule.resolve(previous, linkTarget);
|
||||||
|
// track this, if given a cache.
|
||||||
|
if (cache) cache[base] = resolvedLink;
|
||||||
|
if (!isWindows) seenLinks[id] = linkTarget;
|
||||||
|
}
|
||||||
|
|
||||||
|
// resolve the link, then start over
|
||||||
|
p = pathModule.resolve(resolvedLink, p.slice(pos));
|
||||||
|
start();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cache) cache[original] = p;
|
||||||
|
|
||||||
|
return p;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
exports.realpath = function realpath(p, cache, cb) {
|
||||||
|
if (typeof cb !== 'function') {
|
||||||
|
cb = maybeCallback(cache);
|
||||||
|
cache = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// make p is absolute
|
||||||
|
p = pathModule.resolve(p);
|
||||||
|
|
||||||
|
if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
|
||||||
|
return process.nextTick(cb.bind(null, null, cache[p]));
|
||||||
|
}
|
||||||
|
|
||||||
|
var original = p,
|
||||||
|
seenLinks = {},
|
||||||
|
knownHard = {};
|
||||||
|
|
||||||
|
// current character position in p
|
||||||
|
var pos;
|
||||||
|
// the partial path so far, including a trailing slash if any
|
||||||
|
var current;
|
||||||
|
// the partial path without a trailing slash (except when pointing at a root)
|
||||||
|
var base;
|
||||||
|
// the partial path scanned in the previous round, with slash
|
||||||
|
var previous;
|
||||||
|
|
||||||
|
start();
|
||||||
|
|
||||||
|
function start() {
|
||||||
|
// Skip over roots
|
||||||
|
var m = splitRootRe.exec(p);
|
||||||
|
pos = m[0].length;
|
||||||
|
current = m[0];
|
||||||
|
base = m[0];
|
||||||
|
previous = '';
|
||||||
|
|
||||||
|
// On windows, check that the root exists. On unix there is no need.
|
||||||
|
if (isWindows && !knownHard[base]) {
|
||||||
|
fs.lstat(base, function(err) {
|
||||||
|
if (err) return cb(err);
|
||||||
|
knownHard[base] = true;
|
||||||
|
LOOP();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
process.nextTick(LOOP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// walk down the path, swapping out linked pathparts for their real
|
||||||
|
// values
|
||||||
|
function LOOP() {
|
||||||
|
// stop if scanned past end of path
|
||||||
|
if (pos >= p.length) {
|
||||||
|
if (cache) cache[original] = p;
|
||||||
|
return cb(null, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
// find the next part
|
||||||
|
nextPartRe.lastIndex = pos;
|
||||||
|
var result = nextPartRe.exec(p);
|
||||||
|
previous = current;
|
||||||
|
current += result[0];
|
||||||
|
base = previous + result[1];
|
||||||
|
pos = nextPartRe.lastIndex;
|
||||||
|
|
||||||
|
// continue if not a symlink
|
||||||
|
if (knownHard[base] || (cache && cache[base] === base)) {
|
||||||
|
return process.nextTick(LOOP);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
|
||||||
|
// known symbolic link. no need to stat again.
|
||||||
|
return gotResolvedLink(cache[base]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return fs.lstat(base, gotStat);
|
||||||
|
}
|
||||||
|
|
||||||
|
function gotStat(err, stat) {
|
||||||
|
if (err) return cb(err);
|
||||||
|
|
||||||
|
// if not a symlink, skip to the next path part
|
||||||
|
if (!stat.isSymbolicLink()) {
|
||||||
|
knownHard[base] = true;
|
||||||
|
if (cache) cache[base] = base;
|
||||||
|
return process.nextTick(LOOP);
|
||||||
|
}
|
||||||
|
|
||||||
|
// stat & read the link if not read before
|
||||||
|
// call gotTarget as soon as the link target is known
|
||||||
|
// dev/ino always return 0 on windows, so skip the check.
|
||||||
|
if (!isWindows) {
|
||||||
|
var id = stat.dev.toString(32) + ':' + stat.ino.toString(32);
|
||||||
|
if (seenLinks.hasOwnProperty(id)) {
|
||||||
|
return gotTarget(null, seenLinks[id], base);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fs.stat(base, function(err) {
|
||||||
|
if (err) return cb(err);
|
||||||
|
|
||||||
|
fs.readlink(base, function(err, target) {
|
||||||
|
if (!isWindows) seenLinks[id] = target;
|
||||||
|
gotTarget(err, target);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function gotTarget(err, target, base) {
|
||||||
|
if (err) return cb(err);
|
||||||
|
|
||||||
|
var resolvedLink = pathModule.resolve(previous, target);
|
||||||
|
if (cache) cache[base] = resolvedLink;
|
||||||
|
gotResolvedLink(resolvedLink);
|
||||||
|
}
|
||||||
|
|
||||||
|
function gotResolvedLink(resolvedLink) {
|
||||||
|
// resolve the link, then start over
|
||||||
|
p = pathModule.resolve(resolvedLink, p.slice(pos));
|
||||||
|
start();
|
||||||
|
}
|
||||||
|
};
|
||||||
59
node_modules/fs.realpath/package.json
generated
vendored
Normal file
59
node_modules/fs.realpath/package.json
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
"_from": "fs.realpath@^1.0.0",
|
||||||
|
"_id": "fs.realpath@1.0.0",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
|
||||||
|
"_location": "/fs.realpath",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "fs.realpath@^1.0.0",
|
||||||
|
"name": "fs.realpath",
|
||||||
|
"escapedName": "fs.realpath",
|
||||||
|
"rawSpec": "^1.0.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^1.0.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/glob"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||||
|
"_shasum": "1504ad2523158caa40db4a2787cb01411994ea4f",
|
||||||
|
"_spec": "fs.realpath@^1.0.0",
|
||||||
|
"_where": "/Users/Ibrahim/Desktop/test2/node_modules/glob",
|
||||||
|
"author": {
|
||||||
|
"name": "Isaac Z. Schlueter",
|
||||||
|
"email": "i@izs.me",
|
||||||
|
"url": "http://blog.izs.me/"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/isaacs/fs.realpath/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Use node's fs.realpath, but fall back to the JS implementation if the native one fails",
|
||||||
|
"devDependencies": {},
|
||||||
|
"files": [
|
||||||
|
"old.js",
|
||||||
|
"index.js"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/isaacs/fs.realpath#readme",
|
||||||
|
"keywords": [
|
||||||
|
"realpath",
|
||||||
|
"fs",
|
||||||
|
"polyfill"
|
||||||
|
],
|
||||||
|
"license": "ISC",
|
||||||
|
"main": "index.js",
|
||||||
|
"name": "fs.realpath",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/isaacs/fs.realpath.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "tap test/*.js --cov"
|
||||||
|
},
|
||||||
|
"version": "1.0.0"
|
||||||
|
}
|
||||||
9
node_modules/fs/README.md
generated
vendored
Normal file
9
node_modules/fs/README.md
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# Security holding package
|
||||||
|
|
||||||
|
This package name is not currently in use, but was formerly occupied
|
||||||
|
by another package. To avoid malicious use, npm is hanging on to the
|
||||||
|
package name, but loosely, and we'll probably give it to you if you
|
||||||
|
want it.
|
||||||
|
|
||||||
|
You may adopt this package by contacting support@npmjs.com and
|
||||||
|
requesting the name.
|
||||||
46
node_modules/fs/package.json
generated
vendored
Normal file
46
node_modules/fs/package.json
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"_from": "fs",
|
||||||
|
"_id": "fs@0.0.1-security",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha1-invTcYa23d84E/I4WLV+yq9eQdQ=",
|
||||||
|
"_location": "/fs",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "tag",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "fs",
|
||||||
|
"name": "fs",
|
||||||
|
"escapedName": "fs",
|
||||||
|
"rawSpec": "",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "latest"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"#USER",
|
||||||
|
"/"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
|
||||||
|
"_shasum": "8a7bd37186b6dddf3813f23858b57ecaaf5e41d4",
|
||||||
|
"_spec": "fs",
|
||||||
|
"_where": "/Users/Ibrahim/Desktop/test2",
|
||||||
|
"author": "",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/npm/security-holder/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "This package name is not currently in use, but was formerly occupied by another package. To avoid malicious use, npm is hanging on to the package name, but loosely, and we'll probably give it to you if you want it.",
|
||||||
|
"homepage": "https://github.com/npm/security-holder#readme",
|
||||||
|
"keywords": [],
|
||||||
|
"license": "ISC",
|
||||||
|
"main": "index.js",
|
||||||
|
"name": "fs",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/npm/security-holder.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"version": "0.0.1-security"
|
||||||
|
}
|
||||||
21
node_modules/glob/LICENSE
generated
vendored
Normal file
21
node_modules/glob/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
The ISC License
|
||||||
|
|
||||||
|
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||||
|
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
## Glob Logo
|
||||||
|
|
||||||
|
Glob's logo created by Tanya Brassie <http://tanyabrassie.com/>, licensed
|
||||||
|
under a Creative Commons Attribution-ShareAlike 4.0 International License
|
||||||
|
https://creativecommons.org/licenses/by-sa/4.0/
|
||||||
375
node_modules/glob/README.md
generated
vendored
Normal file
375
node_modules/glob/README.md
generated
vendored
Normal file
@@ -0,0 +1,375 @@
|
|||||||
|
# Glob
|
||||||
|
|
||||||
|
Match files using the patterns the shell uses, like stars and stuff.
|
||||||
|
|
||||||
|
[](https://travis-ci.org/isaacs/node-glob/) [](https://ci.appveyor.com/project/isaacs/node-glob) [](https://coveralls.io/github/isaacs/node-glob?branch=master)
|
||||||
|
|
||||||
|
This is a glob implementation in JavaScript. It uses the `minimatch`
|
||||||
|
library to do its matching.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Install with npm
|
||||||
|
|
||||||
|
```
|
||||||
|
npm i glob
|
||||||
|
```
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var glob = require("glob")
|
||||||
|
|
||||||
|
// options is optional
|
||||||
|
glob("**/*.js", options, function (er, files) {
|
||||||
|
// files is an array of filenames.
|
||||||
|
// If the `nonull` option is set, and nothing
|
||||||
|
// was found, then files is ["**/*.js"]
|
||||||
|
// er is an error object or null.
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
## Glob Primer
|
||||||
|
|
||||||
|
"Globs" are the patterns you type when you do stuff like `ls *.js` on
|
||||||
|
the command line, or put `build/*` in a `.gitignore` file.
|
||||||
|
|
||||||
|
Before parsing the path part patterns, braced sections are expanded
|
||||||
|
into a set. Braced sections start with `{` and end with `}`, with any
|
||||||
|
number of comma-delimited sections within. Braced sections may contain
|
||||||
|
slash characters, so `a{/b/c,bcd}` would expand into `a/b/c` and `abcd`.
|
||||||
|
|
||||||
|
The following characters have special magic meaning when used in a
|
||||||
|
path portion:
|
||||||
|
|
||||||
|
* `*` Matches 0 or more characters in a single path portion
|
||||||
|
* `?` Matches 1 character
|
||||||
|
* `[...]` Matches a range of characters, similar to a RegExp range.
|
||||||
|
If the first character of the range is `!` or `^` then it matches
|
||||||
|
any character not in the range.
|
||||||
|
* `!(pattern|pattern|pattern)` Matches anything that does not match
|
||||||
|
any of the patterns provided.
|
||||||
|
* `?(pattern|pattern|pattern)` Matches zero or one occurrence of the
|
||||||
|
patterns provided.
|
||||||
|
* `+(pattern|pattern|pattern)` Matches one or more occurrences of the
|
||||||
|
patterns provided.
|
||||||
|
* `*(a|b|c)` Matches zero or more occurrences of the patterns provided
|
||||||
|
* `@(pattern|pat*|pat?erN)` Matches exactly one of the patterns
|
||||||
|
provided
|
||||||
|
* `**` If a "globstar" is alone in a path portion, then it matches
|
||||||
|
zero or more directories and subdirectories searching for matches.
|
||||||
|
It does not crawl symlinked directories.
|
||||||
|
|
||||||
|
### Dots
|
||||||
|
|
||||||
|
If a file or directory path portion has a `.` as the first character,
|
||||||
|
then it will not match any glob pattern unless that pattern's
|
||||||
|
corresponding path part also has a `.` as its first character.
|
||||||
|
|
||||||
|
For example, the pattern `a/.*/c` would match the file at `a/.b/c`.
|
||||||
|
However the pattern `a/*/c` would not, because `*` does not start with
|
||||||
|
a dot character.
|
||||||
|
|
||||||
|
You can make glob treat dots as normal characters by setting
|
||||||
|
`dot:true` in the options.
|
||||||
|
|
||||||
|
### Basename Matching
|
||||||
|
|
||||||
|
If you set `matchBase:true` in the options, and the pattern has no
|
||||||
|
slashes in it, then it will seek for any file anywhere in the tree
|
||||||
|
with a matching basename. For example, `*.js` would match
|
||||||
|
`test/simple/basic.js`.
|
||||||
|
|
||||||
|
### Empty Sets
|
||||||
|
|
||||||
|
If no matching files are found, then an empty array is returned. This
|
||||||
|
differs from the shell, where the pattern itself is returned. For
|
||||||
|
example:
|
||||||
|
|
||||||
|
$ echo a*s*d*f
|
||||||
|
a*s*d*f
|
||||||
|
|
||||||
|
To get the bash-style behavior, set the `nonull:true` in the options.
|
||||||
|
|
||||||
|
### See Also:
|
||||||
|
|
||||||
|
* `man sh`
|
||||||
|
* `man bash` (Search for "Pattern Matching")
|
||||||
|
* `man 3 fnmatch`
|
||||||
|
* `man 5 gitignore`
|
||||||
|
* [minimatch documentation](https://github.com/isaacs/minimatch)
|
||||||
|
|
||||||
|
## glob.hasMagic(pattern, [options])
|
||||||
|
|
||||||
|
Returns `true` if there are any special characters in the pattern, and
|
||||||
|
`false` otherwise.
|
||||||
|
|
||||||
|
Note that the options affect the results. If `noext:true` is set in
|
||||||
|
the options object, then `+(a|b)` will not be considered a magic
|
||||||
|
pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}`
|
||||||
|
then that is considered magical, unless `nobrace:true` is set in the
|
||||||
|
options.
|
||||||
|
|
||||||
|
## glob(pattern, [options], cb)
|
||||||
|
|
||||||
|
* `pattern` `{String}` Pattern to be matched
|
||||||
|
* `options` `{Object}`
|
||||||
|
* `cb` `{Function}`
|
||||||
|
* `err` `{Error | null}`
|
||||||
|
* `matches` `{Array<String>}` filenames found matching the pattern
|
||||||
|
|
||||||
|
Perform an asynchronous glob search.
|
||||||
|
|
||||||
|
## glob.sync(pattern, [options])
|
||||||
|
|
||||||
|
* `pattern` `{String}` Pattern to be matched
|
||||||
|
* `options` `{Object}`
|
||||||
|
* return: `{Array<String>}` filenames found matching the pattern
|
||||||
|
|
||||||
|
Perform a synchronous glob search.
|
||||||
|
|
||||||
|
## Class: glob.Glob
|
||||||
|
|
||||||
|
Create a Glob object by instantiating the `glob.Glob` class.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var Glob = require("glob").Glob
|
||||||
|
var mg = new Glob(pattern, options, cb)
|
||||||
|
```
|
||||||
|
|
||||||
|
It's an EventEmitter, and starts walking the filesystem to find matches
|
||||||
|
immediately.
|
||||||
|
|
||||||
|
### new glob.Glob(pattern, [options], [cb])
|
||||||
|
|
||||||
|
* `pattern` `{String}` pattern to search for
|
||||||
|
* `options` `{Object}`
|
||||||
|
* `cb` `{Function}` Called when an error occurs, or matches are found
|
||||||
|
* `err` `{Error | null}`
|
||||||
|
* `matches` `{Array<String>}` filenames found matching the pattern
|
||||||
|
|
||||||
|
Note that if the `sync` flag is set in the options, then matches will
|
||||||
|
be immediately available on the `g.found` member.
|
||||||
|
|
||||||
|
### Properties
|
||||||
|
|
||||||
|
* `minimatch` The minimatch object that the glob uses.
|
||||||
|
* `options` The options object passed in.
|
||||||
|
* `aborted` Boolean which is set to true when calling `abort()`. There
|
||||||
|
is no way at this time to continue a glob search after aborting, but
|
||||||
|
you can re-use the statCache to avoid having to duplicate syscalls.
|
||||||
|
* `cache` Convenience object. Each field has the following possible
|
||||||
|
values:
|
||||||
|
* `false` - Path does not exist
|
||||||
|
* `true` - Path exists
|
||||||
|
* `'FILE'` - Path exists, and is not a directory
|
||||||
|
* `'DIR'` - Path exists, and is a directory
|
||||||
|
* `[file, entries, ...]` - Path exists, is a directory, and the
|
||||||
|
array value is the results of `fs.readdir`
|
||||||
|
* `statCache` Cache of `fs.stat` results, to prevent statting the same
|
||||||
|
path multiple times.
|
||||||
|
* `symlinks` A record of which paths are symbolic links, which is
|
||||||
|
relevant in resolving `**` patterns.
|
||||||
|
* `realpathCache` An optional object which is passed to `fs.realpath`
|
||||||
|
to minimize unnecessary syscalls. It is stored on the instantiated
|
||||||
|
Glob object, and may be re-used.
|
||||||
|
|
||||||
|
### Events
|
||||||
|
|
||||||
|
* `end` When the matching is finished, this is emitted with all the
|
||||||
|
matches found. If the `nonull` option is set, and no match was found,
|
||||||
|
then the `matches` list contains the original pattern. The matches
|
||||||
|
are sorted, unless the `nosort` flag is set.
|
||||||
|
* `match` Every time a match is found, this is emitted with the specific
|
||||||
|
thing that matched. It is not deduplicated or resolved to a realpath.
|
||||||
|
* `error` Emitted when an unexpected error is encountered, or whenever
|
||||||
|
any fs error occurs if `options.strict` is set.
|
||||||
|
* `abort` When `abort()` is called, this event is raised.
|
||||||
|
|
||||||
|
### Methods
|
||||||
|
|
||||||
|
* `pause` Temporarily stop the search
|
||||||
|
* `resume` Resume the search
|
||||||
|
* `abort` Stop the search forever
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
All the options that can be passed to Minimatch can also be passed to
|
||||||
|
Glob to change pattern matching behavior. Also, some have been added,
|
||||||
|
or have glob-specific ramifications.
|
||||||
|
|
||||||
|
All options are false by default, unless otherwise noted.
|
||||||
|
|
||||||
|
All options are added to the Glob object, as well.
|
||||||
|
|
||||||
|
If you are running many `glob` operations, you can pass a Glob object
|
||||||
|
as the `options` argument to a subsequent operation to shortcut some
|
||||||
|
`stat` and `readdir` calls. At the very least, you may pass in shared
|
||||||
|
`symlinks`, `statCache`, `realpathCache`, and `cache` options, so that
|
||||||
|
parallel glob operations will be sped up by sharing information about
|
||||||
|
the filesystem.
|
||||||
|
|
||||||
|
* `cwd` The current working directory in which to search. Defaults
|
||||||
|
to `process.cwd()`.
|
||||||
|
* `root` The place where patterns starting with `/` will be mounted
|
||||||
|
onto. Defaults to `path.resolve(options.cwd, "/")` (`/` on Unix
|
||||||
|
systems, and `C:\` or some such on Windows.)
|
||||||
|
* `dot` Include `.dot` files in normal matches and `globstar` matches.
|
||||||
|
Note that an explicit dot in a portion of the pattern will always
|
||||||
|
match dot files.
|
||||||
|
* `nomount` By default, a pattern starting with a forward-slash will be
|
||||||
|
"mounted" onto the root setting, so that a valid filesystem path is
|
||||||
|
returned. Set this flag to disable that behavior.
|
||||||
|
* `mark` Add a `/` character to directory matches. Note that this
|
||||||
|
requires additional stat calls.
|
||||||
|
* `nosort` Don't sort the results.
|
||||||
|
* `stat` Set to true to stat *all* results. This reduces performance
|
||||||
|
somewhat, and is completely unnecessary, unless `readdir` is presumed
|
||||||
|
to be an untrustworthy indicator of file existence.
|
||||||
|
* `silent` When an unusual error is encountered when attempting to
|
||||||
|
read a directory, a warning will be printed to stderr. Set the
|
||||||
|
`silent` option to true to suppress these warnings.
|
||||||
|
* `strict` When an unusual error is encountered when attempting to
|
||||||
|
read a directory, the process will just continue on in search of
|
||||||
|
other matches. Set the `strict` option to raise an error in these
|
||||||
|
cases.
|
||||||
|
* `cache` See `cache` property above. Pass in a previously generated
|
||||||
|
cache object to save some fs calls.
|
||||||
|
* `statCache` A cache of results of filesystem information, to prevent
|
||||||
|
unnecessary stat calls. While it should not normally be necessary
|
||||||
|
to set this, you may pass the statCache from one glob() call to the
|
||||||
|
options object of another, if you know that the filesystem will not
|
||||||
|
change between calls. (See "Race Conditions" below.)
|
||||||
|
* `symlinks` A cache of known symbolic links. You may pass in a
|
||||||
|
previously generated `symlinks` object to save `lstat` calls when
|
||||||
|
resolving `**` matches.
|
||||||
|
* `sync` DEPRECATED: use `glob.sync(pattern, opts)` instead.
|
||||||
|
* `nounique` In some cases, brace-expanded patterns can result in the
|
||||||
|
same file showing up multiple times in the result set. By default,
|
||||||
|
this implementation prevents duplicates in the result set. Set this
|
||||||
|
flag to disable that behavior.
|
||||||
|
* `nonull` Set to never return an empty set, instead returning a set
|
||||||
|
containing the pattern itself. This is the default in glob(3).
|
||||||
|
* `debug` Set to enable debug logging in minimatch and glob.
|
||||||
|
* `nobrace` Do not expand `{a,b}` and `{1..3}` brace sets.
|
||||||
|
* `noglobstar` Do not match `**` against multiple filenames. (Ie,
|
||||||
|
treat it as a normal `*` instead.)
|
||||||
|
* `noext` Do not match `+(a|b)` "extglob" patterns.
|
||||||
|
* `nocase` Perform a case-insensitive match. Note: on
|
||||||
|
case-insensitive filesystems, non-magic patterns will match by
|
||||||
|
default, since `stat` and `readdir` will not raise errors.
|
||||||
|
* `matchBase` Perform a basename-only match if the pattern does not
|
||||||
|
contain any slash characters. That is, `*.js` would be treated as
|
||||||
|
equivalent to `**/*.js`, matching all js files in all directories.
|
||||||
|
* `nodir` Do not match directories, only files. (Note: to match
|
||||||
|
*only* directories, simply put a `/` at the end of the pattern.)
|
||||||
|
* `ignore` Add a pattern or an array of glob patterns to exclude matches.
|
||||||
|
Note: `ignore` patterns are *always* in `dot:true` mode, regardless
|
||||||
|
of any other settings.
|
||||||
|
* `follow` Follow symlinked directories when expanding `**` patterns.
|
||||||
|
Note that this can result in a lot of duplicate references in the
|
||||||
|
presence of cyclic links.
|
||||||
|
* `realpath` Set to true to call `fs.realpath` on all of the results.
|
||||||
|
In the case of a symlink that cannot be resolved, the full absolute
|
||||||
|
path to the matched entry is returned (though it will usually be a
|
||||||
|
broken symlink)
|
||||||
|
* `absolute` Set to true to always receive absolute paths for matched
|
||||||
|
files. Unlike `realpath`, this also affects the values returned in
|
||||||
|
the `match` event.
|
||||||
|
|
||||||
|
## Comparisons to other fnmatch/glob implementations
|
||||||
|
|
||||||
|
While strict compliance with the existing standards is a worthwhile
|
||||||
|
goal, some discrepancies exist between node-glob and other
|
||||||
|
implementations, and are intentional.
|
||||||
|
|
||||||
|
The double-star character `**` is supported by default, unless the
|
||||||
|
`noglobstar` flag is set. This is supported in the manner of bsdglob
|
||||||
|
and bash 4.3, where `**` only has special significance if it is the only
|
||||||
|
thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but
|
||||||
|
`a/**b` will not.
|
||||||
|
|
||||||
|
Note that symlinked directories are not crawled as part of a `**`,
|
||||||
|
though their contents may match against subsequent portions of the
|
||||||
|
pattern. This prevents infinite loops and duplicates and the like.
|
||||||
|
|
||||||
|
If an escaped pattern has no matches, and the `nonull` flag is set,
|
||||||
|
then glob returns the pattern as-provided, rather than
|
||||||
|
interpreting the character escapes. For example,
|
||||||
|
`glob.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than
|
||||||
|
`"*a?"`. This is akin to setting the `nullglob` option in bash, except
|
||||||
|
that it does not resolve escaped pattern characters.
|
||||||
|
|
||||||
|
If brace expansion is not disabled, then it is performed before any
|
||||||
|
other interpretation of the glob pattern. Thus, a pattern like
|
||||||
|
`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded
|
||||||
|
**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are
|
||||||
|
checked for validity. Since those two are valid, matching proceeds.
|
||||||
|
|
||||||
|
### Comments and Negation
|
||||||
|
|
||||||
|
Previously, this module let you mark a pattern as a "comment" if it
|
||||||
|
started with a `#` character, or a "negated" pattern if it started
|
||||||
|
with a `!` character.
|
||||||
|
|
||||||
|
These options were deprecated in version 5, and removed in version 6.
|
||||||
|
|
||||||
|
To specify things that should not match, use the `ignore` option.
|
||||||
|
|
||||||
|
## Windows
|
||||||
|
|
||||||
|
**Please only use forward-slashes in glob expressions.**
|
||||||
|
|
||||||
|
Though windows uses either `/` or `\` as its path separator, only `/`
|
||||||
|
characters are used by this glob implementation. You must use
|
||||||
|
forward-slashes **only** in glob expressions. Back-slashes will always
|
||||||
|
be interpreted as escape characters, not path separators.
|
||||||
|
|
||||||
|
Results from absolute patterns such as `/foo/*` are mounted onto the
|
||||||
|
root setting using `path.join`. On windows, this will by default result
|
||||||
|
in `/foo/*` matching `C:\foo\bar.txt`.
|
||||||
|
|
||||||
|
## Race Conditions
|
||||||
|
|
||||||
|
Glob searching, by its very nature, is susceptible to race conditions,
|
||||||
|
since it relies on directory walking and such.
|
||||||
|
|
||||||
|
As a result, it is possible that a file that exists when glob looks for
|
||||||
|
it may have been deleted or modified by the time it returns the result.
|
||||||
|
|
||||||
|
As part of its internal implementation, this program caches all stat
|
||||||
|
and readdir calls that it makes, in order to cut down on system
|
||||||
|
overhead. However, this also makes it even more susceptible to races,
|
||||||
|
especially if the cache or statCache objects are reused between glob
|
||||||
|
calls.
|
||||||
|
|
||||||
|
Users are thus advised not to use a glob result as a guarantee of
|
||||||
|
filesystem state in the face of rapid changes. For the vast majority
|
||||||
|
of operations, this is never a problem.
|
||||||
|
|
||||||
|
## Glob Logo
|
||||||
|
Glob's logo was created by [Tanya Brassie](http://tanyabrassie.com/). Logo files can be found [here](https://github.com/isaacs/node-glob/tree/master/logo).
|
||||||
|
|
||||||
|
The logo is licensed under a [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/).
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Any change to behavior (including bugfixes) must come with a test.
|
||||||
|
|
||||||
|
Patches that fail tests or reduce performance will be rejected.
|
||||||
|
|
||||||
|
```
|
||||||
|
# to run tests
|
||||||
|
npm test
|
||||||
|
|
||||||
|
# to re-generate test fixtures
|
||||||
|
npm run test-regen
|
||||||
|
|
||||||
|
# to benchmark against bash/zsh
|
||||||
|
npm run bench
|
||||||
|
|
||||||
|
# to profile javascript
|
||||||
|
npm run prof
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
67
node_modules/glob/changelog.md
generated
vendored
Normal file
67
node_modules/glob/changelog.md
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
## 7.0
|
||||||
|
|
||||||
|
- Raise error if `options.cwd` is specified, and not a directory
|
||||||
|
|
||||||
|
## 6.0
|
||||||
|
|
||||||
|
- Remove comment and negation pattern support
|
||||||
|
- Ignore patterns are always in `dot:true` mode
|
||||||
|
|
||||||
|
## 5.0
|
||||||
|
|
||||||
|
- Deprecate comment and negation patterns
|
||||||
|
- Fix regression in `mark` and `nodir` options from making all cache
|
||||||
|
keys absolute path.
|
||||||
|
- Abort if `fs.readdir` returns an error that's unexpected
|
||||||
|
- Don't emit `match` events for ignored items
|
||||||
|
- Treat ENOTSUP like ENOTDIR in readdir
|
||||||
|
|
||||||
|
## 4.5
|
||||||
|
|
||||||
|
- Add `options.follow` to always follow directory symlinks in globstar
|
||||||
|
- Add `options.realpath` to call `fs.realpath` on all results
|
||||||
|
- Always cache based on absolute path
|
||||||
|
|
||||||
|
## 4.4
|
||||||
|
|
||||||
|
- Add `options.ignore`
|
||||||
|
- Fix handling of broken symlinks
|
||||||
|
|
||||||
|
## 4.3
|
||||||
|
|
||||||
|
- Bump minimatch to 2.x
|
||||||
|
- Pass all tests on Windows
|
||||||
|
|
||||||
|
## 4.2
|
||||||
|
|
||||||
|
- Add `glob.hasMagic` function
|
||||||
|
- Add `options.nodir` flag
|
||||||
|
|
||||||
|
## 4.1
|
||||||
|
|
||||||
|
- Refactor sync and async implementations for performance
|
||||||
|
- Throw if callback provided to sync glob function
|
||||||
|
- Treat symbolic links in globstar results the same as Bash 4.3
|
||||||
|
|
||||||
|
## 4.0
|
||||||
|
|
||||||
|
- Use `^` for dependency versions (bumped major because this breaks
|
||||||
|
older npm versions)
|
||||||
|
- Ensure callbacks are only ever called once
|
||||||
|
- switch to ISC license
|
||||||
|
|
||||||
|
## 3.x
|
||||||
|
|
||||||
|
- Rewrite in JavaScript
|
||||||
|
- Add support for setting root, cwd, and windows support
|
||||||
|
- Cache many fs calls
|
||||||
|
- Add globstar support
|
||||||
|
- emit match events
|
||||||
|
|
||||||
|
## 2.x
|
||||||
|
|
||||||
|
- Use `glob.h` and `fnmatch.h` from NetBSD
|
||||||
|
|
||||||
|
## 1.x
|
||||||
|
|
||||||
|
- `glob.h` static binding.
|
||||||
240
node_modules/glob/common.js
generated
vendored
Normal file
240
node_modules/glob/common.js
generated
vendored
Normal file
@@ -0,0 +1,240 @@
|
|||||||
|
exports.alphasort = alphasort
|
||||||
|
exports.alphasorti = alphasorti
|
||||||
|
exports.setopts = setopts
|
||||||
|
exports.ownProp = ownProp
|
||||||
|
exports.makeAbs = makeAbs
|
||||||
|
exports.finish = finish
|
||||||
|
exports.mark = mark
|
||||||
|
exports.isIgnored = isIgnored
|
||||||
|
exports.childrenIgnored = childrenIgnored
|
||||||
|
|
||||||
|
function ownProp (obj, field) {
|
||||||
|
return Object.prototype.hasOwnProperty.call(obj, field)
|
||||||
|
}
|
||||||
|
|
||||||
|
var path = require("path")
|
||||||
|
var minimatch = require("minimatch")
|
||||||
|
var isAbsolute = require("path-is-absolute")
|
||||||
|
var Minimatch = minimatch.Minimatch
|
||||||
|
|
||||||
|
function alphasorti (a, b) {
|
||||||
|
return a.toLowerCase().localeCompare(b.toLowerCase())
|
||||||
|
}
|
||||||
|
|
||||||
|
function alphasort (a, b) {
|
||||||
|
return a.localeCompare(b)
|
||||||
|
}
|
||||||
|
|
||||||
|
function setupIgnores (self, options) {
|
||||||
|
self.ignore = options.ignore || []
|
||||||
|
|
||||||
|
if (!Array.isArray(self.ignore))
|
||||||
|
self.ignore = [self.ignore]
|
||||||
|
|
||||||
|
if (self.ignore.length) {
|
||||||
|
self.ignore = self.ignore.map(ignoreMap)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ignore patterns are always in dot:true mode.
|
||||||
|
function ignoreMap (pattern) {
|
||||||
|
var gmatcher = null
|
||||||
|
if (pattern.slice(-3) === '/**') {
|
||||||
|
var gpattern = pattern.replace(/(\/\*\*)+$/, '')
|
||||||
|
gmatcher = new Minimatch(gpattern, { dot: true })
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
matcher: new Minimatch(pattern, { dot: true }),
|
||||||
|
gmatcher: gmatcher
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setopts (self, pattern, options) {
|
||||||
|
if (!options)
|
||||||
|
options = {}
|
||||||
|
|
||||||
|
// base-matching: just use globstar for that.
|
||||||
|
if (options.matchBase && -1 === pattern.indexOf("/")) {
|
||||||
|
if (options.noglobstar) {
|
||||||
|
throw new Error("base matching requires globstar")
|
||||||
|
}
|
||||||
|
pattern = "**/" + pattern
|
||||||
|
}
|
||||||
|
|
||||||
|
self.silent = !!options.silent
|
||||||
|
self.pattern = pattern
|
||||||
|
self.strict = options.strict !== false
|
||||||
|
self.realpath = !!options.realpath
|
||||||
|
self.realpathCache = options.realpathCache || Object.create(null)
|
||||||
|
self.follow = !!options.follow
|
||||||
|
self.dot = !!options.dot
|
||||||
|
self.mark = !!options.mark
|
||||||
|
self.nodir = !!options.nodir
|
||||||
|
if (self.nodir)
|
||||||
|
self.mark = true
|
||||||
|
self.sync = !!options.sync
|
||||||
|
self.nounique = !!options.nounique
|
||||||
|
self.nonull = !!options.nonull
|
||||||
|
self.nosort = !!options.nosort
|
||||||
|
self.nocase = !!options.nocase
|
||||||
|
self.stat = !!options.stat
|
||||||
|
self.noprocess = !!options.noprocess
|
||||||
|
self.absolute = !!options.absolute
|
||||||
|
|
||||||
|
self.maxLength = options.maxLength || Infinity
|
||||||
|
self.cache = options.cache || Object.create(null)
|
||||||
|
self.statCache = options.statCache || Object.create(null)
|
||||||
|
self.symlinks = options.symlinks || Object.create(null)
|
||||||
|
|
||||||
|
setupIgnores(self, options)
|
||||||
|
|
||||||
|
self.changedCwd = false
|
||||||
|
var cwd = process.cwd()
|
||||||
|
if (!ownProp(options, "cwd"))
|
||||||
|
self.cwd = cwd
|
||||||
|
else {
|
||||||
|
self.cwd = path.resolve(options.cwd)
|
||||||
|
self.changedCwd = self.cwd !== cwd
|
||||||
|
}
|
||||||
|
|
||||||
|
self.root = options.root || path.resolve(self.cwd, "/")
|
||||||
|
self.root = path.resolve(self.root)
|
||||||
|
if (process.platform === "win32")
|
||||||
|
self.root = self.root.replace(/\\/g, "/")
|
||||||
|
|
||||||
|
// TODO: is an absolute `cwd` supposed to be resolved against `root`?
|
||||||
|
// e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test')
|
||||||
|
self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd)
|
||||||
|
if (process.platform === "win32")
|
||||||
|
self.cwdAbs = self.cwdAbs.replace(/\\/g, "/")
|
||||||
|
self.nomount = !!options.nomount
|
||||||
|
|
||||||
|
// disable comments and negation in Minimatch.
|
||||||
|
// Note that they are not supported in Glob itself anyway.
|
||||||
|
options.nonegate = true
|
||||||
|
options.nocomment = true
|
||||||
|
|
||||||
|
self.minimatch = new Minimatch(pattern, options)
|
||||||
|
self.options = self.minimatch.options
|
||||||
|
}
|
||||||
|
|
||||||
|
function finish (self) {
|
||||||
|
var nou = self.nounique
|
||||||
|
var all = nou ? [] : Object.create(null)
|
||||||
|
|
||||||
|
for (var i = 0, l = self.matches.length; i < l; i ++) {
|
||||||
|
var matches = self.matches[i]
|
||||||
|
if (!matches || Object.keys(matches).length === 0) {
|
||||||
|
if (self.nonull) {
|
||||||
|
// do like the shell, and spit out the literal glob
|
||||||
|
var literal = self.minimatch.globSet[i]
|
||||||
|
if (nou)
|
||||||
|
all.push(literal)
|
||||||
|
else
|
||||||
|
all[literal] = true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// had matches
|
||||||
|
var m = Object.keys(matches)
|
||||||
|
if (nou)
|
||||||
|
all.push.apply(all, m)
|
||||||
|
else
|
||||||
|
m.forEach(function (m) {
|
||||||
|
all[m] = true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!nou)
|
||||||
|
all = Object.keys(all)
|
||||||
|
|
||||||
|
if (!self.nosort)
|
||||||
|
all = all.sort(self.nocase ? alphasorti : alphasort)
|
||||||
|
|
||||||
|
// at *some* point we statted all of these
|
||||||
|
if (self.mark) {
|
||||||
|
for (var i = 0; i < all.length; i++) {
|
||||||
|
all[i] = self._mark(all[i])
|
||||||
|
}
|
||||||
|
if (self.nodir) {
|
||||||
|
all = all.filter(function (e) {
|
||||||
|
var notDir = !(/\/$/.test(e))
|
||||||
|
var c = self.cache[e] || self.cache[makeAbs(self, e)]
|
||||||
|
if (notDir && c)
|
||||||
|
notDir = c !== 'DIR' && !Array.isArray(c)
|
||||||
|
return notDir
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self.ignore.length)
|
||||||
|
all = all.filter(function(m) {
|
||||||
|
return !isIgnored(self, m)
|
||||||
|
})
|
||||||
|
|
||||||
|
self.found = all
|
||||||
|
}
|
||||||
|
|
||||||
|
function mark (self, p) {
|
||||||
|
var abs = makeAbs(self, p)
|
||||||
|
var c = self.cache[abs]
|
||||||
|
var m = p
|
||||||
|
if (c) {
|
||||||
|
var isDir = c === 'DIR' || Array.isArray(c)
|
||||||
|
var slash = p.slice(-1) === '/'
|
||||||
|
|
||||||
|
if (isDir && !slash)
|
||||||
|
m += '/'
|
||||||
|
else if (!isDir && slash)
|
||||||
|
m = m.slice(0, -1)
|
||||||
|
|
||||||
|
if (m !== p) {
|
||||||
|
var mabs = makeAbs(self, m)
|
||||||
|
self.statCache[mabs] = self.statCache[abs]
|
||||||
|
self.cache[mabs] = self.cache[abs]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return m
|
||||||
|
}
|
||||||
|
|
||||||
|
// lotta situps...
|
||||||
|
function makeAbs (self, f) {
|
||||||
|
var abs = f
|
||||||
|
if (f.charAt(0) === '/') {
|
||||||
|
abs = path.join(self.root, f)
|
||||||
|
} else if (isAbsolute(f) || f === '') {
|
||||||
|
abs = f
|
||||||
|
} else if (self.changedCwd) {
|
||||||
|
abs = path.resolve(self.cwd, f)
|
||||||
|
} else {
|
||||||
|
abs = path.resolve(f)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.platform === 'win32')
|
||||||
|
abs = abs.replace(/\\/g, '/')
|
||||||
|
|
||||||
|
return abs
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Return true, if pattern ends with globstar '**', for the accompanying parent directory.
|
||||||
|
// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents
|
||||||
|
function isIgnored (self, path) {
|
||||||
|
if (!self.ignore.length)
|
||||||
|
return false
|
||||||
|
|
||||||
|
return self.ignore.some(function(item) {
|
||||||
|
return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function childrenIgnored (self, path) {
|
||||||
|
if (!self.ignore.length)
|
||||||
|
return false
|
||||||
|
|
||||||
|
return self.ignore.some(function(item) {
|
||||||
|
return !!(item.gmatcher && item.gmatcher.match(path))
|
||||||
|
})
|
||||||
|
}
|
||||||
790
node_modules/glob/glob.js
generated
vendored
Normal file
790
node_modules/glob/glob.js
generated
vendored
Normal file
@@ -0,0 +1,790 @@
|
|||||||
|
// Approach:
|
||||||
|
//
|
||||||
|
// 1. Get the minimatch set
|
||||||
|
// 2. For each pattern in the set, PROCESS(pattern, false)
|
||||||
|
// 3. Store matches per-set, then uniq them
|
||||||
|
//
|
||||||
|
// PROCESS(pattern, inGlobStar)
|
||||||
|
// Get the first [n] items from pattern that are all strings
|
||||||
|
// Join these together. This is PREFIX.
|
||||||
|
// If there is no more remaining, then stat(PREFIX) and
|
||||||
|
// add to matches if it succeeds. END.
|
||||||
|
//
|
||||||
|
// If inGlobStar and PREFIX is symlink and points to dir
|
||||||
|
// set ENTRIES = []
|
||||||
|
// else readdir(PREFIX) as ENTRIES
|
||||||
|
// If fail, END
|
||||||
|
//
|
||||||
|
// with ENTRIES
|
||||||
|
// If pattern[n] is GLOBSTAR
|
||||||
|
// // handle the case where the globstar match is empty
|
||||||
|
// // by pruning it out, and testing the resulting pattern
|
||||||
|
// PROCESS(pattern[0..n] + pattern[n+1 .. $], false)
|
||||||
|
// // handle other cases.
|
||||||
|
// for ENTRY in ENTRIES (not dotfiles)
|
||||||
|
// // attach globstar + tail onto the entry
|
||||||
|
// // Mark that this entry is a globstar match
|
||||||
|
// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true)
|
||||||
|
//
|
||||||
|
// else // not globstar
|
||||||
|
// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot)
|
||||||
|
// Test ENTRY against pattern[n]
|
||||||
|
// If fails, continue
|
||||||
|
// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $])
|
||||||
|
//
|
||||||
|
// Caveat:
|
||||||
|
// Cache all stats and readdirs results to minimize syscall. Since all
|
||||||
|
// we ever care about is existence and directory-ness, we can just keep
|
||||||
|
// `true` for files, and [children,...] for directories, or `false` for
|
||||||
|
// things that don't exist.
|
||||||
|
|
||||||
|
module.exports = glob
|
||||||
|
|
||||||
|
var fs = require('fs')
|
||||||
|
var rp = require('fs.realpath')
|
||||||
|
var minimatch = require('minimatch')
|
||||||
|
var Minimatch = minimatch.Minimatch
|
||||||
|
var inherits = require('inherits')
|
||||||
|
var EE = require('events').EventEmitter
|
||||||
|
var path = require('path')
|
||||||
|
var assert = require('assert')
|
||||||
|
var isAbsolute = require('path-is-absolute')
|
||||||
|
var globSync = require('./sync.js')
|
||||||
|
var common = require('./common.js')
|
||||||
|
var alphasort = common.alphasort
|
||||||
|
var alphasorti = common.alphasorti
|
||||||
|
var setopts = common.setopts
|
||||||
|
var ownProp = common.ownProp
|
||||||
|
var inflight = require('inflight')
|
||||||
|
var util = require('util')
|
||||||
|
var childrenIgnored = common.childrenIgnored
|
||||||
|
var isIgnored = common.isIgnored
|
||||||
|
|
||||||
|
var once = require('once')
|
||||||
|
|
||||||
|
function glob (pattern, options, cb) {
|
||||||
|
if (typeof options === 'function') cb = options, options = {}
|
||||||
|
if (!options) options = {}
|
||||||
|
|
||||||
|
if (options.sync) {
|
||||||
|
if (cb)
|
||||||
|
throw new TypeError('callback provided to sync glob')
|
||||||
|
return globSync(pattern, options)
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Glob(pattern, options, cb)
|
||||||
|
}
|
||||||
|
|
||||||
|
glob.sync = globSync
|
||||||
|
var GlobSync = glob.GlobSync = globSync.GlobSync
|
||||||
|
|
||||||
|
// old api surface
|
||||||
|
glob.glob = glob
|
||||||
|
|
||||||
|
function extend (origin, add) {
|
||||||
|
if (add === null || typeof add !== 'object') {
|
||||||
|
return origin
|
||||||
|
}
|
||||||
|
|
||||||
|
var keys = Object.keys(add)
|
||||||
|
var i = keys.length
|
||||||
|
while (i--) {
|
||||||
|
origin[keys[i]] = add[keys[i]]
|
||||||
|
}
|
||||||
|
return origin
|
||||||
|
}
|
||||||
|
|
||||||
|
glob.hasMagic = function (pattern, options_) {
|
||||||
|
var options = extend({}, options_)
|
||||||
|
options.noprocess = true
|
||||||
|
|
||||||
|
var g = new Glob(pattern, options)
|
||||||
|
var set = g.minimatch.set
|
||||||
|
|
||||||
|
if (!pattern)
|
||||||
|
return false
|
||||||
|
|
||||||
|
if (set.length > 1)
|
||||||
|
return true
|
||||||
|
|
||||||
|
for (var j = 0; j < set[0].length; j++) {
|
||||||
|
if (typeof set[0][j] !== 'string')
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
glob.Glob = Glob
|
||||||
|
inherits(Glob, EE)
|
||||||
|
function Glob (pattern, options, cb) {
|
||||||
|
if (typeof options === 'function') {
|
||||||
|
cb = options
|
||||||
|
options = null
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options && options.sync) {
|
||||||
|
if (cb)
|
||||||
|
throw new TypeError('callback provided to sync glob')
|
||||||
|
return new GlobSync(pattern, options)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(this instanceof Glob))
|
||||||
|
return new Glob(pattern, options, cb)
|
||||||
|
|
||||||
|
setopts(this, pattern, options)
|
||||||
|
this._didRealPath = false
|
||||||
|
|
||||||
|
// process each pattern in the minimatch set
|
||||||
|
var n = this.minimatch.set.length
|
||||||
|
|
||||||
|
// The matches are stored as {<filename>: true,...} so that
|
||||||
|
// duplicates are automagically pruned.
|
||||||
|
// Later, we do an Object.keys() on these.
|
||||||
|
// Keep them as a list so we can fill in when nonull is set.
|
||||||
|
this.matches = new Array(n)
|
||||||
|
|
||||||
|
if (typeof cb === 'function') {
|
||||||
|
cb = once(cb)
|
||||||
|
this.on('error', cb)
|
||||||
|
this.on('end', function (matches) {
|
||||||
|
cb(null, matches)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
var self = this
|
||||||
|
this._processing = 0
|
||||||
|
|
||||||
|
this._emitQueue = []
|
||||||
|
this._processQueue = []
|
||||||
|
this.paused = false
|
||||||
|
|
||||||
|
if (this.noprocess)
|
||||||
|
return this
|
||||||
|
|
||||||
|
if (n === 0)
|
||||||
|
return done()
|
||||||
|
|
||||||
|
var sync = true
|
||||||
|
for (var i = 0; i < n; i ++) {
|
||||||
|
this._process(this.minimatch.set[i], i, false, done)
|
||||||
|
}
|
||||||
|
sync = false
|
||||||
|
|
||||||
|
function done () {
|
||||||
|
--self._processing
|
||||||
|
if (self._processing <= 0) {
|
||||||
|
if (sync) {
|
||||||
|
process.nextTick(function () {
|
||||||
|
self._finish()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
self._finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Glob.prototype._finish = function () {
|
||||||
|
assert(this instanceof Glob)
|
||||||
|
if (this.aborted)
|
||||||
|
return
|
||||||
|
|
||||||
|
if (this.realpath && !this._didRealpath)
|
||||||
|
return this._realpath()
|
||||||
|
|
||||||
|
common.finish(this)
|
||||||
|
this.emit('end', this.found)
|
||||||
|
}
|
||||||
|
|
||||||
|
Glob.prototype._realpath = function () {
|
||||||
|
if (this._didRealpath)
|
||||||
|
return
|
||||||
|
|
||||||
|
this._didRealpath = true
|
||||||
|
|
||||||
|
var n = this.matches.length
|
||||||
|
if (n === 0)
|
||||||
|
return this._finish()
|
||||||
|
|
||||||
|
var self = this
|
||||||
|
for (var i = 0; i < this.matches.length; i++)
|
||||||
|
this._realpathSet(i, next)
|
||||||
|
|
||||||
|
function next () {
|
||||||
|
if (--n === 0)
|
||||||
|
self._finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Glob.prototype._realpathSet = function (index, cb) {
|
||||||
|
var matchset = this.matches[index]
|
||||||
|
if (!matchset)
|
||||||
|
return cb()
|
||||||
|
|
||||||
|
var found = Object.keys(matchset)
|
||||||
|
var self = this
|
||||||
|
var n = found.length
|
||||||
|
|
||||||
|
if (n === 0)
|
||||||
|
return cb()
|
||||||
|
|
||||||
|
var set = this.matches[index] = Object.create(null)
|
||||||
|
found.forEach(function (p, i) {
|
||||||
|
// If there's a problem with the stat, then it means that
|
||||||
|
// one or more of the links in the realpath couldn't be
|
||||||
|
// resolved. just return the abs value in that case.
|
||||||
|
p = self._makeAbs(p)
|
||||||
|
rp.realpath(p, self.realpathCache, function (er, real) {
|
||||||
|
if (!er)
|
||||||
|
set[real] = true
|
||||||
|
else if (er.syscall === 'stat')
|
||||||
|
set[p] = true
|
||||||
|
else
|
||||||
|
self.emit('error', er) // srsly wtf right here
|
||||||
|
|
||||||
|
if (--n === 0) {
|
||||||
|
self.matches[index] = set
|
||||||
|
cb()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
Glob.prototype._mark = function (p) {
|
||||||
|
return common.mark(this, p)
|
||||||
|
}
|
||||||
|
|
||||||
|
Glob.prototype._makeAbs = function (f) {
|
||||||
|
return common.makeAbs(this, f)
|
||||||
|
}
|
||||||
|
|
||||||
|
Glob.prototype.abort = function () {
|
||||||
|
this.aborted = true
|
||||||
|
this.emit('abort')
|
||||||
|
}
|
||||||
|
|
||||||
|
Glob.prototype.pause = function () {
|
||||||
|
if (!this.paused) {
|
||||||
|
this.paused = true
|
||||||
|
this.emit('pause')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Glob.prototype.resume = function () {
|
||||||
|
if (this.paused) {
|
||||||
|
this.emit('resume')
|
||||||
|
this.paused = false
|
||||||
|
if (this._emitQueue.length) {
|
||||||
|
var eq = this._emitQueue.slice(0)
|
||||||
|
this._emitQueue.length = 0
|
||||||
|
for (var i = 0; i < eq.length; i ++) {
|
||||||
|
var e = eq[i]
|
||||||
|
this._emitMatch(e[0], e[1])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this._processQueue.length) {
|
||||||
|
var pq = this._processQueue.slice(0)
|
||||||
|
this._processQueue.length = 0
|
||||||
|
for (var i = 0; i < pq.length; i ++) {
|
||||||
|
var p = pq[i]
|
||||||
|
this._processing--
|
||||||
|
this._process(p[0], p[1], p[2], p[3])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Glob.prototype._process = function (pattern, index, inGlobStar, cb) {
|
||||||
|
assert(this instanceof Glob)
|
||||||
|
assert(typeof cb === 'function')
|
||||||
|
|
||||||
|
if (this.aborted)
|
||||||
|
return
|
||||||
|
|
||||||
|
this._processing++
|
||||||
|
if (this.paused) {
|
||||||
|
this._processQueue.push([pattern, index, inGlobStar, cb])
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//console.error('PROCESS %d', this._processing, pattern)
|
||||||
|
|
||||||
|
// Get the first [n] parts of pattern that are all strings.
|
||||||
|
var n = 0
|
||||||
|
while (typeof pattern[n] === 'string') {
|
||||||
|
n ++
|
||||||
|
}
|
||||||
|
// now n is the index of the first one that is *not* a string.
|
||||||
|
|
||||||
|
// see if there's anything else
|
||||||
|
var prefix
|
||||||
|
switch (n) {
|
||||||
|
// if not, then this is rather simple
|
||||||
|
case pattern.length:
|
||||||
|
this._processSimple(pattern.join('/'), index, cb)
|
||||||
|
return
|
||||||
|
|
||||||
|
case 0:
|
||||||
|
// pattern *starts* with some non-trivial item.
|
||||||
|
// going to readdir(cwd), but not include the prefix in matches.
|
||||||
|
prefix = null
|
||||||
|
break
|
||||||
|
|
||||||
|
default:
|
||||||
|
// pattern has some string bits in the front.
|
||||||
|
// whatever it starts with, whether that's 'absolute' like /foo/bar,
|
||||||
|
// or 'relative' like '../baz'
|
||||||
|
prefix = pattern.slice(0, n).join('/')
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
var remain = pattern.slice(n)
|
||||||
|
|
||||||
|
// get the list of entries.
|
||||||
|
var read
|
||||||
|
if (prefix === null)
|
||||||
|
read = '.'
|
||||||
|
else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) {
|
||||||
|
if (!prefix || !isAbsolute(prefix))
|
||||||
|
prefix = '/' + prefix
|
||||||
|
read = prefix
|
||||||
|
} else
|
||||||
|
read = prefix
|
||||||
|
|
||||||
|
var abs = this._makeAbs(read)
|
||||||
|
|
||||||
|
//if ignored, skip _processing
|
||||||
|
if (childrenIgnored(this, read))
|
||||||
|
return cb()
|
||||||
|
|
||||||
|
var isGlobStar = remain[0] === minimatch.GLOBSTAR
|
||||||
|
if (isGlobStar)
|
||||||
|
this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb)
|
||||||
|
else
|
||||||
|
this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb)
|
||||||
|
}
|
||||||
|
|
||||||
|
Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) {
|
||||||
|
var self = this
|
||||||
|
this._readdir(abs, inGlobStar, function (er, entries) {
|
||||||
|
return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
|
||||||
|
|
||||||
|
// if the abs isn't a dir, then nothing can match!
|
||||||
|
if (!entries)
|
||||||
|
return cb()
|
||||||
|
|
||||||
|
// It will only match dot entries if it starts with a dot, or if
|
||||||
|
// dot is set. Stuff like @(.foo|.bar) isn't allowed.
|
||||||
|
var pn = remain[0]
|
||||||
|
var negate = !!this.minimatch.negate
|
||||||
|
var rawGlob = pn._glob
|
||||||
|
var dotOk = this.dot || rawGlob.charAt(0) === '.'
|
||||||
|
|
||||||
|
var matchedEntries = []
|
||||||
|
for (var i = 0; i < entries.length; i++) {
|
||||||
|
var e = entries[i]
|
||||||
|
if (e.charAt(0) !== '.' || dotOk) {
|
||||||
|
var m
|
||||||
|
if (negate && !prefix) {
|
||||||
|
m = !e.match(pn)
|
||||||
|
} else {
|
||||||
|
m = e.match(pn)
|
||||||
|
}
|
||||||
|
if (m)
|
||||||
|
matchedEntries.push(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries)
|
||||||
|
|
||||||
|
var len = matchedEntries.length
|
||||||
|
// If there are no matched entries, then nothing matches.
|
||||||
|
if (len === 0)
|
||||||
|
return cb()
|
||||||
|
|
||||||
|
// if this is the last remaining pattern bit, then no need for
|
||||||
|
// an additional stat *unless* the user has specified mark or
|
||||||
|
// stat explicitly. We know they exist, since readdir returned
|
||||||
|
// them.
|
||||||
|
|
||||||
|
if (remain.length === 1 && !this.mark && !this.stat) {
|
||||||
|
if (!this.matches[index])
|
||||||
|
this.matches[index] = Object.create(null)
|
||||||
|
|
||||||
|
for (var i = 0; i < len; i ++) {
|
||||||
|
var e = matchedEntries[i]
|
||||||
|
if (prefix) {
|
||||||
|
if (prefix !== '/')
|
||||||
|
e = prefix + '/' + e
|
||||||
|
else
|
||||||
|
e = prefix + e
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.charAt(0) === '/' && !this.nomount) {
|
||||||
|
e = path.join(this.root, e)
|
||||||
|
}
|
||||||
|
this._emitMatch(index, e)
|
||||||
|
}
|
||||||
|
// This was the last one, and no stats were needed
|
||||||
|
return cb()
|
||||||
|
}
|
||||||
|
|
||||||
|
// now test all matched entries as stand-ins for that part
|
||||||
|
// of the pattern.
|
||||||
|
remain.shift()
|
||||||
|
for (var i = 0; i < len; i ++) {
|
||||||
|
var e = matchedEntries[i]
|
||||||
|
var newPattern
|
||||||
|
if (prefix) {
|
||||||
|
if (prefix !== '/')
|
||||||
|
e = prefix + '/' + e
|
||||||
|
else
|
||||||
|
e = prefix + e
|
||||||
|
}
|
||||||
|
this._process([e].concat(remain), index, inGlobStar, cb)
|
||||||
|
}
|
||||||
|
cb()
|
||||||
|
}
|
||||||
|
|
||||||
|
Glob.prototype._emitMatch = function (index, e) {
|
||||||
|
if (this.aborted)
|
||||||
|
return
|
||||||
|
|
||||||
|
if (isIgnored(this, e))
|
||||||
|
return
|
||||||
|
|
||||||
|
if (this.paused) {
|
||||||
|
this._emitQueue.push([index, e])
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var abs = isAbsolute(e) ? e : this._makeAbs(e)
|
||||||
|
|
||||||
|
if (this.mark)
|
||||||
|
e = this._mark(e)
|
||||||
|
|
||||||
|
if (this.absolute)
|
||||||
|
e = abs
|
||||||
|
|
||||||
|
if (this.matches[index][e])
|
||||||
|
return
|
||||||
|
|
||||||
|
if (this.nodir) {
|
||||||
|
var c = this.cache[abs]
|
||||||
|
if (c === 'DIR' || Array.isArray(c))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.matches[index][e] = true
|
||||||
|
|
||||||
|
var st = this.statCache[abs]
|
||||||
|
if (st)
|
||||||
|
this.emit('stat', e, st)
|
||||||
|
|
||||||
|
this.emit('match', e)
|
||||||
|
}
|
||||||
|
|
||||||
|
Glob.prototype._readdirInGlobStar = function (abs, cb) {
|
||||||
|
if (this.aborted)
|
||||||
|
return
|
||||||
|
|
||||||
|
// follow all symlinked directories forever
|
||||||
|
// just proceed as if this is a non-globstar situation
|
||||||
|
if (this.follow)
|
||||||
|
return this._readdir(abs, false, cb)
|
||||||
|
|
||||||
|
var lstatkey = 'lstat\0' + abs
|
||||||
|
var self = this
|
||||||
|
var lstatcb = inflight(lstatkey, lstatcb_)
|
||||||
|
|
||||||
|
if (lstatcb)
|
||||||
|
fs.lstat(abs, lstatcb)
|
||||||
|
|
||||||
|
function lstatcb_ (er, lstat) {
|
||||||
|
if (er && er.code === 'ENOENT')
|
||||||
|
return cb()
|
||||||
|
|
||||||
|
var isSym = lstat && lstat.isSymbolicLink()
|
||||||
|
self.symlinks[abs] = isSym
|
||||||
|
|
||||||
|
// If it's not a symlink or a dir, then it's definitely a regular file.
|
||||||
|
// don't bother doing a readdir in that case.
|
||||||
|
if (!isSym && lstat && !lstat.isDirectory()) {
|
||||||
|
self.cache[abs] = 'FILE'
|
||||||
|
cb()
|
||||||
|
} else
|
||||||
|
self._readdir(abs, false, cb)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Glob.prototype._readdir = function (abs, inGlobStar, cb) {
|
||||||
|
if (this.aborted)
|
||||||
|
return
|
||||||
|
|
||||||
|
cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb)
|
||||||
|
if (!cb)
|
||||||
|
return
|
||||||
|
|
||||||
|
//console.error('RD %j %j', +inGlobStar, abs)
|
||||||
|
if (inGlobStar && !ownProp(this.symlinks, abs))
|
||||||
|
return this._readdirInGlobStar(abs, cb)
|
||||||
|
|
||||||
|
if (ownProp(this.cache, abs)) {
|
||||||
|
var c = this.cache[abs]
|
||||||
|
if (!c || c === 'FILE')
|
||||||
|
return cb()
|
||||||
|
|
||||||
|
if (Array.isArray(c))
|
||||||
|
return cb(null, c)
|
||||||
|
}
|
||||||
|
|
||||||
|
var self = this
|
||||||
|
fs.readdir(abs, readdirCb(this, abs, cb))
|
||||||
|
}
|
||||||
|
|
||||||
|
function readdirCb (self, abs, cb) {
|
||||||
|
return function (er, entries) {
|
||||||
|
if (er)
|
||||||
|
self._readdirError(abs, er, cb)
|
||||||
|
else
|
||||||
|
self._readdirEntries(abs, entries, cb)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Glob.prototype._readdirEntries = function (abs, entries, cb) {
|
||||||
|
if (this.aborted)
|
||||||
|
return
|
||||||
|
|
||||||
|
// if we haven't asked to stat everything, then just
|
||||||
|
// assume that everything in there exists, so we can avoid
|
||||||
|
// having to stat it a second time.
|
||||||
|
if (!this.mark && !this.stat) {
|
||||||
|
for (var i = 0; i < entries.length; i ++) {
|
||||||
|
var e = entries[i]
|
||||||
|
if (abs === '/')
|
||||||
|
e = abs + e
|
||||||
|
else
|
||||||
|
e = abs + '/' + e
|
||||||
|
this.cache[e] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.cache[abs] = entries
|
||||||
|
return cb(null, entries)
|
||||||
|
}
|
||||||
|
|
||||||
|
Glob.prototype._readdirError = function (f, er, cb) {
|
||||||
|
if (this.aborted)
|
||||||
|
return
|
||||||
|
|
||||||
|
// handle errors, and cache the information
|
||||||
|
switch (er.code) {
|
||||||
|
case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
|
||||||
|
case 'ENOTDIR': // totally normal. means it *does* exist.
|
||||||
|
var abs = this._makeAbs(f)
|
||||||
|
this.cache[abs] = 'FILE'
|
||||||
|
if (abs === this.cwdAbs) {
|
||||||
|
var error = new Error(er.code + ' invalid cwd ' + this.cwd)
|
||||||
|
error.path = this.cwd
|
||||||
|
error.code = er.code
|
||||||
|
this.emit('error', error)
|
||||||
|
this.abort()
|
||||||
|
}
|
||||||
|
break
|
||||||
|
|
||||||
|
case 'ENOENT': // not terribly unusual
|
||||||
|
case 'ELOOP':
|
||||||
|
case 'ENAMETOOLONG':
|
||||||
|
case 'UNKNOWN':
|
||||||
|
this.cache[this._makeAbs(f)] = false
|
||||||
|
break
|
||||||
|
|
||||||
|
default: // some unusual error. Treat as failure.
|
||||||
|
this.cache[this._makeAbs(f)] = false
|
||||||
|
if (this.strict) {
|
||||||
|
this.emit('error', er)
|
||||||
|
// If the error is handled, then we abort
|
||||||
|
// if not, we threw out of here
|
||||||
|
this.abort()
|
||||||
|
}
|
||||||
|
if (!this.silent)
|
||||||
|
console.error('glob error', er)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return cb()
|
||||||
|
}
|
||||||
|
|
||||||
|
Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) {
|
||||||
|
var self = this
|
||||||
|
this._readdir(abs, inGlobStar, function (er, entries) {
|
||||||
|
self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
|
||||||
|
//console.error('pgs2', prefix, remain[0], entries)
|
||||||
|
|
||||||
|
// no entries means not a dir, so it can never have matches
|
||||||
|
// foo.txt/** doesn't match foo.txt
|
||||||
|
if (!entries)
|
||||||
|
return cb()
|
||||||
|
|
||||||
|
// test without the globstar, and with every child both below
|
||||||
|
// and replacing the globstar.
|
||||||
|
var remainWithoutGlobStar = remain.slice(1)
|
||||||
|
var gspref = prefix ? [ prefix ] : []
|
||||||
|
var noGlobStar = gspref.concat(remainWithoutGlobStar)
|
||||||
|
|
||||||
|
// the noGlobStar pattern exits the inGlobStar state
|
||||||
|
this._process(noGlobStar, index, false, cb)
|
||||||
|
|
||||||
|
var isSym = this.symlinks[abs]
|
||||||
|
var len = entries.length
|
||||||
|
|
||||||
|
// If it's a symlink, and we're in a globstar, then stop
|
||||||
|
if (isSym && inGlobStar)
|
||||||
|
return cb()
|
||||||
|
|
||||||
|
for (var i = 0; i < len; i++) {
|
||||||
|
var e = entries[i]
|
||||||
|
if (e.charAt(0) === '.' && !this.dot)
|
||||||
|
continue
|
||||||
|
|
||||||
|
// these two cases enter the inGlobStar state
|
||||||
|
var instead = gspref.concat(entries[i], remainWithoutGlobStar)
|
||||||
|
this._process(instead, index, true, cb)
|
||||||
|
|
||||||
|
var below = gspref.concat(entries[i], remain)
|
||||||
|
this._process(below, index, true, cb)
|
||||||
|
}
|
||||||
|
|
||||||
|
cb()
|
||||||
|
}
|
||||||
|
|
||||||
|
Glob.prototype._processSimple = function (prefix, index, cb) {
|
||||||
|
// XXX review this. Shouldn't it be doing the mounting etc
|
||||||
|
// before doing stat? kinda weird?
|
||||||
|
var self = this
|
||||||
|
this._stat(prefix, function (er, exists) {
|
||||||
|
self._processSimple2(prefix, index, er, exists, cb)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) {
|
||||||
|
|
||||||
|
//console.error('ps2', prefix, exists)
|
||||||
|
|
||||||
|
if (!this.matches[index])
|
||||||
|
this.matches[index] = Object.create(null)
|
||||||
|
|
||||||
|
// If it doesn't exist, then just mark the lack of results
|
||||||
|
if (!exists)
|
||||||
|
return cb()
|
||||||
|
|
||||||
|
if (prefix && isAbsolute(prefix) && !this.nomount) {
|
||||||
|
var trail = /[\/\\]$/.test(prefix)
|
||||||
|
if (prefix.charAt(0) === '/') {
|
||||||
|
prefix = path.join(this.root, prefix)
|
||||||
|
} else {
|
||||||
|
prefix = path.resolve(this.root, prefix)
|
||||||
|
if (trail)
|
||||||
|
prefix += '/'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.platform === 'win32')
|
||||||
|
prefix = prefix.replace(/\\/g, '/')
|
||||||
|
|
||||||
|
// Mark this as a match
|
||||||
|
this._emitMatch(index, prefix)
|
||||||
|
cb()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns either 'DIR', 'FILE', or false
|
||||||
|
Glob.prototype._stat = function (f, cb) {
|
||||||
|
var abs = this._makeAbs(f)
|
||||||
|
var needDir = f.slice(-1) === '/'
|
||||||
|
|
||||||
|
if (f.length > this.maxLength)
|
||||||
|
return cb()
|
||||||
|
|
||||||
|
if (!this.stat && ownProp(this.cache, abs)) {
|
||||||
|
var c = this.cache[abs]
|
||||||
|
|
||||||
|
if (Array.isArray(c))
|
||||||
|
c = 'DIR'
|
||||||
|
|
||||||
|
// It exists, but maybe not how we need it
|
||||||
|
if (!needDir || c === 'DIR')
|
||||||
|
return cb(null, c)
|
||||||
|
|
||||||
|
if (needDir && c === 'FILE')
|
||||||
|
return cb()
|
||||||
|
|
||||||
|
// otherwise we have to stat, because maybe c=true
|
||||||
|
// if we know it exists, but not what it is.
|
||||||
|
}
|
||||||
|
|
||||||
|
var exists
|
||||||
|
var stat = this.statCache[abs]
|
||||||
|
if (stat !== undefined) {
|
||||||
|
if (stat === false)
|
||||||
|
return cb(null, stat)
|
||||||
|
else {
|
||||||
|
var type = stat.isDirectory() ? 'DIR' : 'FILE'
|
||||||
|
if (needDir && type === 'FILE')
|
||||||
|
return cb()
|
||||||
|
else
|
||||||
|
return cb(null, type, stat)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var self = this
|
||||||
|
var statcb = inflight('stat\0' + abs, lstatcb_)
|
||||||
|
if (statcb)
|
||||||
|
fs.lstat(abs, statcb)
|
||||||
|
|
||||||
|
function lstatcb_ (er, lstat) {
|
||||||
|
if (lstat && lstat.isSymbolicLink()) {
|
||||||
|
// If it's a symlink, then treat it as the target, unless
|
||||||
|
// the target does not exist, then treat it as a file.
|
||||||
|
return fs.stat(abs, function (er, stat) {
|
||||||
|
if (er)
|
||||||
|
self._stat2(f, abs, null, lstat, cb)
|
||||||
|
else
|
||||||
|
self._stat2(f, abs, er, stat, cb)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
self._stat2(f, abs, er, lstat, cb)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Glob.prototype._stat2 = function (f, abs, er, stat, cb) {
|
||||||
|
if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
|
||||||
|
this.statCache[abs] = false
|
||||||
|
return cb()
|
||||||
|
}
|
||||||
|
|
||||||
|
var needDir = f.slice(-1) === '/'
|
||||||
|
this.statCache[abs] = stat
|
||||||
|
|
||||||
|
if (abs.slice(-1) === '/' && stat && !stat.isDirectory())
|
||||||
|
return cb(null, false, stat)
|
||||||
|
|
||||||
|
var c = true
|
||||||
|
if (stat)
|
||||||
|
c = stat.isDirectory() ? 'DIR' : 'FILE'
|
||||||
|
this.cache[abs] = this.cache[abs] || c
|
||||||
|
|
||||||
|
if (needDir && c === 'FILE')
|
||||||
|
return cb()
|
||||||
|
|
||||||
|
return cb(null, c, stat)
|
||||||
|
}
|
||||||
79
node_modules/glob/package.json
generated
vendored
Normal file
79
node_modules/glob/package.json
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
{
|
||||||
|
"_from": "glob@^7.1.3",
|
||||||
|
"_id": "glob@7.1.6",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
|
||||||
|
"_location": "/glob",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "glob@^7.1.3",
|
||||||
|
"name": "glob",
|
||||||
|
"escapedName": "glob",
|
||||||
|
"rawSpec": "^7.1.3",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^7.1.3"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/rimraf"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
|
||||||
|
"_shasum": "141f33b81a7c2492e125594307480c46679278a6",
|
||||||
|
"_spec": "glob@^7.1.3",
|
||||||
|
"_where": "/Users/Ibrahim/Desktop/test2/node_modules/rimraf",
|
||||||
|
"author": {
|
||||||
|
"name": "Isaac Z. Schlueter",
|
||||||
|
"email": "i@izs.me",
|
||||||
|
"url": "http://blog.izs.me/"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/isaacs/node-glob/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {
|
||||||
|
"fs.realpath": "^1.0.0",
|
||||||
|
"inflight": "^1.0.4",
|
||||||
|
"inherits": "2",
|
||||||
|
"minimatch": "^3.0.4",
|
||||||
|
"once": "^1.3.0",
|
||||||
|
"path-is-absolute": "^1.0.0"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "a little globber",
|
||||||
|
"devDependencies": {
|
||||||
|
"mkdirp": "0",
|
||||||
|
"rimraf": "^2.2.8",
|
||||||
|
"tap": "^12.0.1",
|
||||||
|
"tick": "0.0.6"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"glob.js",
|
||||||
|
"sync.js",
|
||||||
|
"common.js"
|
||||||
|
],
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/isaacs"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/isaacs/node-glob#readme",
|
||||||
|
"license": "ISC",
|
||||||
|
"main": "glob.js",
|
||||||
|
"name": "glob",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/isaacs/node-glob.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"bench": "bash benchmark.sh",
|
||||||
|
"benchclean": "node benchclean.js",
|
||||||
|
"prepublish": "npm run benchclean",
|
||||||
|
"prof": "bash prof.sh && cat profile.txt",
|
||||||
|
"profclean": "rm -f v8.log profile.txt",
|
||||||
|
"test": "tap test/*.js --cov",
|
||||||
|
"test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js"
|
||||||
|
},
|
||||||
|
"version": "7.1.6"
|
||||||
|
}
|
||||||
486
node_modules/glob/sync.js
generated
vendored
Normal file
486
node_modules/glob/sync.js
generated
vendored
Normal file
@@ -0,0 +1,486 @@
|
|||||||
|
module.exports = globSync
|
||||||
|
globSync.GlobSync = GlobSync
|
||||||
|
|
||||||
|
var fs = require('fs')
|
||||||
|
var rp = require('fs.realpath')
|
||||||
|
var minimatch = require('minimatch')
|
||||||
|
var Minimatch = minimatch.Minimatch
|
||||||
|
var Glob = require('./glob.js').Glob
|
||||||
|
var util = require('util')
|
||||||
|
var path = require('path')
|
||||||
|
var assert = require('assert')
|
||||||
|
var isAbsolute = require('path-is-absolute')
|
||||||
|
var common = require('./common.js')
|
||||||
|
var alphasort = common.alphasort
|
||||||
|
var alphasorti = common.alphasorti
|
||||||
|
var setopts = common.setopts
|
||||||
|
var ownProp = common.ownProp
|
||||||
|
var childrenIgnored = common.childrenIgnored
|
||||||
|
var isIgnored = common.isIgnored
|
||||||
|
|
||||||
|
function globSync (pattern, options) {
|
||||||
|
if (typeof options === 'function' || arguments.length === 3)
|
||||||
|
throw new TypeError('callback provided to sync glob\n'+
|
||||||
|
'See: https://github.com/isaacs/node-glob/issues/167')
|
||||||
|
|
||||||
|
return new GlobSync(pattern, options).found
|
||||||
|
}
|
||||||
|
|
||||||
|
function GlobSync (pattern, options) {
|
||||||
|
if (!pattern)
|
||||||
|
throw new Error('must provide pattern')
|
||||||
|
|
||||||
|
if (typeof options === 'function' || arguments.length === 3)
|
||||||
|
throw new TypeError('callback provided to sync glob\n'+
|
||||||
|
'See: https://github.com/isaacs/node-glob/issues/167')
|
||||||
|
|
||||||
|
if (!(this instanceof GlobSync))
|
||||||
|
return new GlobSync(pattern, options)
|
||||||
|
|
||||||
|
setopts(this, pattern, options)
|
||||||
|
|
||||||
|
if (this.noprocess)
|
||||||
|
return this
|
||||||
|
|
||||||
|
var n = this.minimatch.set.length
|
||||||
|
this.matches = new Array(n)
|
||||||
|
for (var i = 0; i < n; i ++) {
|
||||||
|
this._process(this.minimatch.set[i], i, false)
|
||||||
|
}
|
||||||
|
this._finish()
|
||||||
|
}
|
||||||
|
|
||||||
|
GlobSync.prototype._finish = function () {
|
||||||
|
assert(this instanceof GlobSync)
|
||||||
|
if (this.realpath) {
|
||||||
|
var self = this
|
||||||
|
this.matches.forEach(function (matchset, index) {
|
||||||
|
var set = self.matches[index] = Object.create(null)
|
||||||
|
for (var p in matchset) {
|
||||||
|
try {
|
||||||
|
p = self._makeAbs(p)
|
||||||
|
var real = rp.realpathSync(p, self.realpathCache)
|
||||||
|
set[real] = true
|
||||||
|
} catch (er) {
|
||||||
|
if (er.syscall === 'stat')
|
||||||
|
set[self._makeAbs(p)] = true
|
||||||
|
else
|
||||||
|
throw er
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
common.finish(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GlobSync.prototype._process = function (pattern, index, inGlobStar) {
|
||||||
|
assert(this instanceof GlobSync)
|
||||||
|
|
||||||
|
// Get the first [n] parts of pattern that are all strings.
|
||||||
|
var n = 0
|
||||||
|
while (typeof pattern[n] === 'string') {
|
||||||
|
n ++
|
||||||
|
}
|
||||||
|
// now n is the index of the first one that is *not* a string.
|
||||||
|
|
||||||
|
// See if there's anything else
|
||||||
|
var prefix
|
||||||
|
switch (n) {
|
||||||
|
// if not, then this is rather simple
|
||||||
|
case pattern.length:
|
||||||
|
this._processSimple(pattern.join('/'), index)
|
||||||
|
return
|
||||||
|
|
||||||
|
case 0:
|
||||||
|
// pattern *starts* with some non-trivial item.
|
||||||
|
// going to readdir(cwd), but not include the prefix in matches.
|
||||||
|
prefix = null
|
||||||
|
break
|
||||||
|
|
||||||
|
default:
|
||||||
|
// pattern has some string bits in the front.
|
||||||
|
// whatever it starts with, whether that's 'absolute' like /foo/bar,
|
||||||
|
// or 'relative' like '../baz'
|
||||||
|
prefix = pattern.slice(0, n).join('/')
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
var remain = pattern.slice(n)
|
||||||
|
|
||||||
|
// get the list of entries.
|
||||||
|
var read
|
||||||
|
if (prefix === null)
|
||||||
|
read = '.'
|
||||||
|
else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) {
|
||||||
|
if (!prefix || !isAbsolute(prefix))
|
||||||
|
prefix = '/' + prefix
|
||||||
|
read = prefix
|
||||||
|
} else
|
||||||
|
read = prefix
|
||||||
|
|
||||||
|
var abs = this._makeAbs(read)
|
||||||
|
|
||||||
|
//if ignored, skip processing
|
||||||
|
if (childrenIgnored(this, read))
|
||||||
|
return
|
||||||
|
|
||||||
|
var isGlobStar = remain[0] === minimatch.GLOBSTAR
|
||||||
|
if (isGlobStar)
|
||||||
|
this._processGlobStar(prefix, read, abs, remain, index, inGlobStar)
|
||||||
|
else
|
||||||
|
this._processReaddir(prefix, read, abs, remain, index, inGlobStar)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) {
|
||||||
|
var entries = this._readdir(abs, inGlobStar)
|
||||||
|
|
||||||
|
// if the abs isn't a dir, then nothing can match!
|
||||||
|
if (!entries)
|
||||||
|
return
|
||||||
|
|
||||||
|
// It will only match dot entries if it starts with a dot, or if
|
||||||
|
// dot is set. Stuff like @(.foo|.bar) isn't allowed.
|
||||||
|
var pn = remain[0]
|
||||||
|
var negate = !!this.minimatch.negate
|
||||||
|
var rawGlob = pn._glob
|
||||||
|
var dotOk = this.dot || rawGlob.charAt(0) === '.'
|
||||||
|
|
||||||
|
var matchedEntries = []
|
||||||
|
for (var i = 0; i < entries.length; i++) {
|
||||||
|
var e = entries[i]
|
||||||
|
if (e.charAt(0) !== '.' || dotOk) {
|
||||||
|
var m
|
||||||
|
if (negate && !prefix) {
|
||||||
|
m = !e.match(pn)
|
||||||
|
} else {
|
||||||
|
m = e.match(pn)
|
||||||
|
}
|
||||||
|
if (m)
|
||||||
|
matchedEntries.push(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var len = matchedEntries.length
|
||||||
|
// If there are no matched entries, then nothing matches.
|
||||||
|
if (len === 0)
|
||||||
|
return
|
||||||
|
|
||||||
|
// if this is the last remaining pattern bit, then no need for
|
||||||
|
// an additional stat *unless* the user has specified mark or
|
||||||
|
// stat explicitly. We know they exist, since readdir returned
|
||||||
|
// them.
|
||||||
|
|
||||||
|
if (remain.length === 1 && !this.mark && !this.stat) {
|
||||||
|
if (!this.matches[index])
|
||||||
|
this.matches[index] = Object.create(null)
|
||||||
|
|
||||||
|
for (var i = 0; i < len; i ++) {
|
||||||
|
var e = matchedEntries[i]
|
||||||
|
if (prefix) {
|
||||||
|
if (prefix.slice(-1) !== '/')
|
||||||
|
e = prefix + '/' + e
|
||||||
|
else
|
||||||
|
e = prefix + e
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.charAt(0) === '/' && !this.nomount) {
|
||||||
|
e = path.join(this.root, e)
|
||||||
|
}
|
||||||
|
this._emitMatch(index, e)
|
||||||
|
}
|
||||||
|
// This was the last one, and no stats were needed
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// now test all matched entries as stand-ins for that part
|
||||||
|
// of the pattern.
|
||||||
|
remain.shift()
|
||||||
|
for (var i = 0; i < len; i ++) {
|
||||||
|
var e = matchedEntries[i]
|
||||||
|
var newPattern
|
||||||
|
if (prefix)
|
||||||
|
newPattern = [prefix, e]
|
||||||
|
else
|
||||||
|
newPattern = [e]
|
||||||
|
this._process(newPattern.concat(remain), index, inGlobStar)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GlobSync.prototype._emitMatch = function (index, e) {
|
||||||
|
if (isIgnored(this, e))
|
||||||
|
return
|
||||||
|
|
||||||
|
var abs = this._makeAbs(e)
|
||||||
|
|
||||||
|
if (this.mark)
|
||||||
|
e = this._mark(e)
|
||||||
|
|
||||||
|
if (this.absolute) {
|
||||||
|
e = abs
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.matches[index][e])
|
||||||
|
return
|
||||||
|
|
||||||
|
if (this.nodir) {
|
||||||
|
var c = this.cache[abs]
|
||||||
|
if (c === 'DIR' || Array.isArray(c))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.matches[index][e] = true
|
||||||
|
|
||||||
|
if (this.stat)
|
||||||
|
this._stat(e)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GlobSync.prototype._readdirInGlobStar = function (abs) {
|
||||||
|
// follow all symlinked directories forever
|
||||||
|
// just proceed as if this is a non-globstar situation
|
||||||
|
if (this.follow)
|
||||||
|
return this._readdir(abs, false)
|
||||||
|
|
||||||
|
var entries
|
||||||
|
var lstat
|
||||||
|
var stat
|
||||||
|
try {
|
||||||
|
lstat = fs.lstatSync(abs)
|
||||||
|
} catch (er) {
|
||||||
|
if (er.code === 'ENOENT') {
|
||||||
|
// lstat failed, doesn't exist
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var isSym = lstat && lstat.isSymbolicLink()
|
||||||
|
this.symlinks[abs] = isSym
|
||||||
|
|
||||||
|
// If it's not a symlink or a dir, then it's definitely a regular file.
|
||||||
|
// don't bother doing a readdir in that case.
|
||||||
|
if (!isSym && lstat && !lstat.isDirectory())
|
||||||
|
this.cache[abs] = 'FILE'
|
||||||
|
else
|
||||||
|
entries = this._readdir(abs, false)
|
||||||
|
|
||||||
|
return entries
|
||||||
|
}
|
||||||
|
|
||||||
|
GlobSync.prototype._readdir = function (abs, inGlobStar) {
|
||||||
|
var entries
|
||||||
|
|
||||||
|
if (inGlobStar && !ownProp(this.symlinks, abs))
|
||||||
|
return this._readdirInGlobStar(abs)
|
||||||
|
|
||||||
|
if (ownProp(this.cache, abs)) {
|
||||||
|
var c = this.cache[abs]
|
||||||
|
if (!c || c === 'FILE')
|
||||||
|
return null
|
||||||
|
|
||||||
|
if (Array.isArray(c))
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return this._readdirEntries(abs, fs.readdirSync(abs))
|
||||||
|
} catch (er) {
|
||||||
|
this._readdirError(abs, er)
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GlobSync.prototype._readdirEntries = function (abs, entries) {
|
||||||
|
// if we haven't asked to stat everything, then just
|
||||||
|
// assume that everything in there exists, so we can avoid
|
||||||
|
// having to stat it a second time.
|
||||||
|
if (!this.mark && !this.stat) {
|
||||||
|
for (var i = 0; i < entries.length; i ++) {
|
||||||
|
var e = entries[i]
|
||||||
|
if (abs === '/')
|
||||||
|
e = abs + e
|
||||||
|
else
|
||||||
|
e = abs + '/' + e
|
||||||
|
this.cache[e] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.cache[abs] = entries
|
||||||
|
|
||||||
|
// mark and cache dir-ness
|
||||||
|
return entries
|
||||||
|
}
|
||||||
|
|
||||||
|
GlobSync.prototype._readdirError = function (f, er) {
|
||||||
|
// handle errors, and cache the information
|
||||||
|
switch (er.code) {
|
||||||
|
case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
|
||||||
|
case 'ENOTDIR': // totally normal. means it *does* exist.
|
||||||
|
var abs = this._makeAbs(f)
|
||||||
|
this.cache[abs] = 'FILE'
|
||||||
|
if (abs === this.cwdAbs) {
|
||||||
|
var error = new Error(er.code + ' invalid cwd ' + this.cwd)
|
||||||
|
error.path = this.cwd
|
||||||
|
error.code = er.code
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
break
|
||||||
|
|
||||||
|
case 'ENOENT': // not terribly unusual
|
||||||
|
case 'ELOOP':
|
||||||
|
case 'ENAMETOOLONG':
|
||||||
|
case 'UNKNOWN':
|
||||||
|
this.cache[this._makeAbs(f)] = false
|
||||||
|
break
|
||||||
|
|
||||||
|
default: // some unusual error. Treat as failure.
|
||||||
|
this.cache[this._makeAbs(f)] = false
|
||||||
|
if (this.strict)
|
||||||
|
throw er
|
||||||
|
if (!this.silent)
|
||||||
|
console.error('glob error', er)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) {
|
||||||
|
|
||||||
|
var entries = this._readdir(abs, inGlobStar)
|
||||||
|
|
||||||
|
// no entries means not a dir, so it can never have matches
|
||||||
|
// foo.txt/** doesn't match foo.txt
|
||||||
|
if (!entries)
|
||||||
|
return
|
||||||
|
|
||||||
|
// test without the globstar, and with every child both below
|
||||||
|
// and replacing the globstar.
|
||||||
|
var remainWithoutGlobStar = remain.slice(1)
|
||||||
|
var gspref = prefix ? [ prefix ] : []
|
||||||
|
var noGlobStar = gspref.concat(remainWithoutGlobStar)
|
||||||
|
|
||||||
|
// the noGlobStar pattern exits the inGlobStar state
|
||||||
|
this._process(noGlobStar, index, false)
|
||||||
|
|
||||||
|
var len = entries.length
|
||||||
|
var isSym = this.symlinks[abs]
|
||||||
|
|
||||||
|
// If it's a symlink, and we're in a globstar, then stop
|
||||||
|
if (isSym && inGlobStar)
|
||||||
|
return
|
||||||
|
|
||||||
|
for (var i = 0; i < len; i++) {
|
||||||
|
var e = entries[i]
|
||||||
|
if (e.charAt(0) === '.' && !this.dot)
|
||||||
|
continue
|
||||||
|
|
||||||
|
// these two cases enter the inGlobStar state
|
||||||
|
var instead = gspref.concat(entries[i], remainWithoutGlobStar)
|
||||||
|
this._process(instead, index, true)
|
||||||
|
|
||||||
|
var below = gspref.concat(entries[i], remain)
|
||||||
|
this._process(below, index, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GlobSync.prototype._processSimple = function (prefix, index) {
|
||||||
|
// XXX review this. Shouldn't it be doing the mounting etc
|
||||||
|
// before doing stat? kinda weird?
|
||||||
|
var exists = this._stat(prefix)
|
||||||
|
|
||||||
|
if (!this.matches[index])
|
||||||
|
this.matches[index] = Object.create(null)
|
||||||
|
|
||||||
|
// If it doesn't exist, then just mark the lack of results
|
||||||
|
if (!exists)
|
||||||
|
return
|
||||||
|
|
||||||
|
if (prefix && isAbsolute(prefix) && !this.nomount) {
|
||||||
|
var trail = /[\/\\]$/.test(prefix)
|
||||||
|
if (prefix.charAt(0) === '/') {
|
||||||
|
prefix = path.join(this.root, prefix)
|
||||||
|
} else {
|
||||||
|
prefix = path.resolve(this.root, prefix)
|
||||||
|
if (trail)
|
||||||
|
prefix += '/'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.platform === 'win32')
|
||||||
|
prefix = prefix.replace(/\\/g, '/')
|
||||||
|
|
||||||
|
// Mark this as a match
|
||||||
|
this._emitMatch(index, prefix)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns either 'DIR', 'FILE', or false
|
||||||
|
GlobSync.prototype._stat = function (f) {
|
||||||
|
var abs = this._makeAbs(f)
|
||||||
|
var needDir = f.slice(-1) === '/'
|
||||||
|
|
||||||
|
if (f.length > this.maxLength)
|
||||||
|
return false
|
||||||
|
|
||||||
|
if (!this.stat && ownProp(this.cache, abs)) {
|
||||||
|
var c = this.cache[abs]
|
||||||
|
|
||||||
|
if (Array.isArray(c))
|
||||||
|
c = 'DIR'
|
||||||
|
|
||||||
|
// It exists, but maybe not how we need it
|
||||||
|
if (!needDir || c === 'DIR')
|
||||||
|
return c
|
||||||
|
|
||||||
|
if (needDir && c === 'FILE')
|
||||||
|
return false
|
||||||
|
|
||||||
|
// otherwise we have to stat, because maybe c=true
|
||||||
|
// if we know it exists, but not what it is.
|
||||||
|
}
|
||||||
|
|
||||||
|
var exists
|
||||||
|
var stat = this.statCache[abs]
|
||||||
|
if (!stat) {
|
||||||
|
var lstat
|
||||||
|
try {
|
||||||
|
lstat = fs.lstatSync(abs)
|
||||||
|
} catch (er) {
|
||||||
|
if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
|
||||||
|
this.statCache[abs] = false
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lstat && lstat.isSymbolicLink()) {
|
||||||
|
try {
|
||||||
|
stat = fs.statSync(abs)
|
||||||
|
} catch (er) {
|
||||||
|
stat = lstat
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
stat = lstat
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.statCache[abs] = stat
|
||||||
|
|
||||||
|
var c = true
|
||||||
|
if (stat)
|
||||||
|
c = stat.isDirectory() ? 'DIR' : 'FILE'
|
||||||
|
|
||||||
|
this.cache[abs] = this.cache[abs] || c
|
||||||
|
|
||||||
|
if (needDir && c === 'FILE')
|
||||||
|
return false
|
||||||
|
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
GlobSync.prototype._mark = function (p) {
|
||||||
|
return common.mark(this, p)
|
||||||
|
}
|
||||||
|
|
||||||
|
GlobSync.prototype._makeAbs = function (f) {
|
||||||
|
return common.makeAbs(this, f)
|
||||||
|
}
|
||||||
15
node_modules/inflight/LICENSE
generated
vendored
Normal file
15
node_modules/inflight/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
The ISC License
|
||||||
|
|
||||||
|
Copyright (c) Isaac Z. Schlueter
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||||
|
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
37
node_modules/inflight/README.md
generated
vendored
Normal file
37
node_modules/inflight/README.md
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
# inflight
|
||||||
|
|
||||||
|
Add callbacks to requests in flight to avoid async duplication
|
||||||
|
|
||||||
|
## USAGE
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var inflight = require('inflight')
|
||||||
|
|
||||||
|
// some request that does some stuff
|
||||||
|
function req(key, callback) {
|
||||||
|
// key is any random string. like a url or filename or whatever.
|
||||||
|
//
|
||||||
|
// will return either a falsey value, indicating that the
|
||||||
|
// request for this key is already in flight, or a new callback
|
||||||
|
// which when called will call all callbacks passed to inflightk
|
||||||
|
// with the same key
|
||||||
|
callback = inflight(key, callback)
|
||||||
|
|
||||||
|
// If we got a falsey value back, then there's already a req going
|
||||||
|
if (!callback) return
|
||||||
|
|
||||||
|
// this is where you'd fetch the url or whatever
|
||||||
|
// callback is also once()-ified, so it can safely be assigned
|
||||||
|
// to multiple events etc. First call wins.
|
||||||
|
setTimeout(function() {
|
||||||
|
callback(null, key)
|
||||||
|
}, 100)
|
||||||
|
}
|
||||||
|
|
||||||
|
// only assigns a single setTimeout
|
||||||
|
// when it dings, all cbs get called
|
||||||
|
req('foo', cb1)
|
||||||
|
req('foo', cb2)
|
||||||
|
req('foo', cb3)
|
||||||
|
req('foo', cb4)
|
||||||
|
```
|
||||||
54
node_modules/inflight/inflight.js
generated
vendored
Normal file
54
node_modules/inflight/inflight.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
var wrappy = require('wrappy')
|
||||||
|
var reqs = Object.create(null)
|
||||||
|
var once = require('once')
|
||||||
|
|
||||||
|
module.exports = wrappy(inflight)
|
||||||
|
|
||||||
|
function inflight (key, cb) {
|
||||||
|
if (reqs[key]) {
|
||||||
|
reqs[key].push(cb)
|
||||||
|
return null
|
||||||
|
} else {
|
||||||
|
reqs[key] = [cb]
|
||||||
|
return makeres(key)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeres (key) {
|
||||||
|
return once(function RES () {
|
||||||
|
var cbs = reqs[key]
|
||||||
|
var len = cbs.length
|
||||||
|
var args = slice(arguments)
|
||||||
|
|
||||||
|
// XXX It's somewhat ambiguous whether a new callback added in this
|
||||||
|
// pass should be queued for later execution if something in the
|
||||||
|
// list of callbacks throws, or if it should just be discarded.
|
||||||
|
// However, it's such an edge case that it hardly matters, and either
|
||||||
|
// choice is likely as surprising as the other.
|
||||||
|
// As it happens, we do go ahead and schedule it for later execution.
|
||||||
|
try {
|
||||||
|
for (var i = 0; i < len; i++) {
|
||||||
|
cbs[i].apply(null, args)
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
if (cbs.length > len) {
|
||||||
|
// added more in the interim.
|
||||||
|
// de-zalgo, just in case, but don't call again.
|
||||||
|
cbs.splice(0, len)
|
||||||
|
process.nextTick(function () {
|
||||||
|
RES.apply(null, args)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
delete reqs[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function slice (args) {
|
||||||
|
var length = args.length
|
||||||
|
var array = []
|
||||||
|
|
||||||
|
for (var i = 0; i < length; i++) array[i] = args[i]
|
||||||
|
return array
|
||||||
|
}
|
||||||
58
node_modules/inflight/package.json
generated
vendored
Normal file
58
node_modules/inflight/package.json
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
{
|
||||||
|
"_from": "inflight@^1.0.4",
|
||||||
|
"_id": "inflight@1.0.6",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
||||||
|
"_location": "/inflight",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "inflight@^1.0.4",
|
||||||
|
"name": "inflight",
|
||||||
|
"escapedName": "inflight",
|
||||||
|
"rawSpec": "^1.0.4",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^1.0.4"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/glob"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||||
|
"_shasum": "49bd6331d7d02d0c09bc910a1075ba8165b56df9",
|
||||||
|
"_spec": "inflight@^1.0.4",
|
||||||
|
"_where": "/Users/Ibrahim/Desktop/test2/node_modules/glob",
|
||||||
|
"author": {
|
||||||
|
"name": "Isaac Z. Schlueter",
|
||||||
|
"email": "i@izs.me",
|
||||||
|
"url": "http://blog.izs.me/"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/isaacs/inflight/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {
|
||||||
|
"once": "^1.3.0",
|
||||||
|
"wrappy": "1"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Add callbacks to requests in flight to avoid async duplication",
|
||||||
|
"devDependencies": {
|
||||||
|
"tap": "^7.1.2"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"inflight.js"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/isaacs/inflight",
|
||||||
|
"license": "ISC",
|
||||||
|
"main": "inflight.js",
|
||||||
|
"name": "inflight",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/npm/inflight.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "tap test.js --100"
|
||||||
|
},
|
||||||
|
"version": "1.0.6"
|
||||||
|
}
|
||||||
16
node_modules/inherits/LICENSE
generated
vendored
Normal file
16
node_modules/inherits/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
The ISC License
|
||||||
|
|
||||||
|
Copyright (c) Isaac Z. Schlueter
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
42
node_modules/inherits/README.md
generated
vendored
Normal file
42
node_modules/inherits/README.md
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
Browser-friendly inheritance fully compatible with standard node.js
|
||||||
|
[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor).
|
||||||
|
|
||||||
|
This package exports standard `inherits` from node.js `util` module in
|
||||||
|
node environment, but also provides alternative browser-friendly
|
||||||
|
implementation through [browser
|
||||||
|
field](https://gist.github.com/shtylman/4339901). Alternative
|
||||||
|
implementation is a literal copy of standard one located in standalone
|
||||||
|
module to avoid requiring of `util`. It also has a shim for old
|
||||||
|
browsers with no `Object.create` support.
|
||||||
|
|
||||||
|
While keeping you sure you are using standard `inherits`
|
||||||
|
implementation in node.js environment, it allows bundlers such as
|
||||||
|
[browserify](https://github.com/substack/node-browserify) to not
|
||||||
|
include full `util` package to your client code if all you need is
|
||||||
|
just `inherits` function. It worth, because browser shim for `util`
|
||||||
|
package is large and `inherits` is often the single function you need
|
||||||
|
from it.
|
||||||
|
|
||||||
|
It's recommended to use this package instead of
|
||||||
|
`require('util').inherits` for any code that has chances to be used
|
||||||
|
not only in node.js but in browser too.
|
||||||
|
|
||||||
|
## usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
var inherits = require('inherits');
|
||||||
|
// then use exactly as the standard one
|
||||||
|
```
|
||||||
|
|
||||||
|
## note on version ~1.0
|
||||||
|
|
||||||
|
Version ~1.0 had completely different motivation and is not compatible
|
||||||
|
neither with 2.0 nor with standard node.js `inherits`.
|
||||||
|
|
||||||
|
If you are using version ~1.0 and planning to switch to ~2.0, be
|
||||||
|
careful:
|
||||||
|
|
||||||
|
* new version uses `super_` instead of `super` for referencing
|
||||||
|
superclass
|
||||||
|
* new version overwrites current prototype while old one preserves any
|
||||||
|
existing fields on it
|
||||||
9
node_modules/inherits/inherits.js
generated
vendored
Normal file
9
node_modules/inherits/inherits.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
try {
|
||||||
|
var util = require('util');
|
||||||
|
/* istanbul ignore next */
|
||||||
|
if (typeof util.inherits !== 'function') throw '';
|
||||||
|
module.exports = util.inherits;
|
||||||
|
} catch (e) {
|
||||||
|
/* istanbul ignore next */
|
||||||
|
module.exports = require('./inherits_browser.js');
|
||||||
|
}
|
||||||
27
node_modules/inherits/inherits_browser.js
generated
vendored
Normal file
27
node_modules/inherits/inherits_browser.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
if (typeof Object.create === 'function') {
|
||||||
|
// implementation from standard node.js 'util' module
|
||||||
|
module.exports = function inherits(ctor, superCtor) {
|
||||||
|
if (superCtor) {
|
||||||
|
ctor.super_ = superCtor
|
||||||
|
ctor.prototype = Object.create(superCtor.prototype, {
|
||||||
|
constructor: {
|
||||||
|
value: ctor,
|
||||||
|
enumerable: false,
|
||||||
|
writable: true,
|
||||||
|
configurable: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
// old school shim for old browsers
|
||||||
|
module.exports = function inherits(ctor, superCtor) {
|
||||||
|
if (superCtor) {
|
||||||
|
ctor.super_ = superCtor
|
||||||
|
var TempCtor = function () {}
|
||||||
|
TempCtor.prototype = superCtor.prototype
|
||||||
|
ctor.prototype = new TempCtor()
|
||||||
|
ctor.prototype.constructor = ctor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
61
node_modules/inherits/package.json
generated
vendored
Normal file
61
node_modules/inherits/package.json
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
{
|
||||||
|
"_from": "inherits@2",
|
||||||
|
"_id": "inherits@2.0.4",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
||||||
|
"_location": "/inherits",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "inherits@2",
|
||||||
|
"name": "inherits",
|
||||||
|
"escapedName": "inherits",
|
||||||
|
"rawSpec": "2",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "2"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/glob"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||||
|
"_shasum": "0fa2c64f932917c3433a0ded55363aae37416b7c",
|
||||||
|
"_spec": "inherits@2",
|
||||||
|
"_where": "/Users/Ibrahim/Desktop/test2/node_modules/glob",
|
||||||
|
"browser": "./inherits_browser.js",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/isaacs/inherits/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Browser-friendly inheritance fully compatible with standard node.js inherits()",
|
||||||
|
"devDependencies": {
|
||||||
|
"tap": "^14.2.4"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"inherits.js",
|
||||||
|
"inherits_browser.js"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/isaacs/inherits#readme",
|
||||||
|
"keywords": [
|
||||||
|
"inheritance",
|
||||||
|
"class",
|
||||||
|
"klass",
|
||||||
|
"oop",
|
||||||
|
"object-oriented",
|
||||||
|
"inherits",
|
||||||
|
"browser",
|
||||||
|
"browserify"
|
||||||
|
],
|
||||||
|
"license": "ISC",
|
||||||
|
"main": "./inherits.js",
|
||||||
|
"name": "inherits",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/isaacs/inherits.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "tap"
|
||||||
|
},
|
||||||
|
"version": "2.0.4"
|
||||||
|
}
|
||||||
15
node_modules/minimatch/LICENSE
generated
vendored
Normal file
15
node_modules/minimatch/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
The ISC License
|
||||||
|
|
||||||
|
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||||
|
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
209
node_modules/minimatch/README.md
generated
vendored
Normal file
209
node_modules/minimatch/README.md
generated
vendored
Normal file
@@ -0,0 +1,209 @@
|
|||||||
|
# minimatch
|
||||||
|
|
||||||
|
A minimal matching utility.
|
||||||
|
|
||||||
|
[](http://travis-ci.org/isaacs/minimatch)
|
||||||
|
|
||||||
|
|
||||||
|
This is the matching library used internally by npm.
|
||||||
|
|
||||||
|
It works by converting glob expressions into JavaScript `RegExp`
|
||||||
|
objects.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var minimatch = require("minimatch")
|
||||||
|
|
||||||
|
minimatch("bar.foo", "*.foo") // true!
|
||||||
|
minimatch("bar.foo", "*.bar") // false!
|
||||||
|
minimatch("bar.foo", "*.+(bar|foo)", { debug: true }) // true, and noisy!
|
||||||
|
```
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
Supports these glob features:
|
||||||
|
|
||||||
|
* Brace Expansion
|
||||||
|
* Extended glob matching
|
||||||
|
* "Globstar" `**` matching
|
||||||
|
|
||||||
|
See:
|
||||||
|
|
||||||
|
* `man sh`
|
||||||
|
* `man bash`
|
||||||
|
* `man 3 fnmatch`
|
||||||
|
* `man 5 gitignore`
|
||||||
|
|
||||||
|
## Minimatch Class
|
||||||
|
|
||||||
|
Create a minimatch object by instantiating the `minimatch.Minimatch` class.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var Minimatch = require("minimatch").Minimatch
|
||||||
|
var mm = new Minimatch(pattern, options)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Properties
|
||||||
|
|
||||||
|
* `pattern` The original pattern the minimatch object represents.
|
||||||
|
* `options` The options supplied to the constructor.
|
||||||
|
* `set` A 2-dimensional array of regexp or string expressions.
|
||||||
|
Each row in the
|
||||||
|
array corresponds to a brace-expanded pattern. Each item in the row
|
||||||
|
corresponds to a single path-part. For example, the pattern
|
||||||
|
`{a,b/c}/d` would expand to a set of patterns like:
|
||||||
|
|
||||||
|
[ [ a, d ]
|
||||||
|
, [ b, c, d ] ]
|
||||||
|
|
||||||
|
If a portion of the pattern doesn't have any "magic" in it
|
||||||
|
(that is, it's something like `"foo"` rather than `fo*o?`), then it
|
||||||
|
will be left as a string rather than converted to a regular
|
||||||
|
expression.
|
||||||
|
|
||||||
|
* `regexp` Created by the `makeRe` method. A single regular expression
|
||||||
|
expressing the entire pattern. This is useful in cases where you wish
|
||||||
|
to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled.
|
||||||
|
* `negate` True if the pattern is negated.
|
||||||
|
* `comment` True if the pattern is a comment.
|
||||||
|
* `empty` True if the pattern is `""`.
|
||||||
|
|
||||||
|
### Methods
|
||||||
|
|
||||||
|
* `makeRe` Generate the `regexp` member if necessary, and return it.
|
||||||
|
Will return `false` if the pattern is invalid.
|
||||||
|
* `match(fname)` Return true if the filename matches the pattern, or
|
||||||
|
false otherwise.
|
||||||
|
* `matchOne(fileArray, patternArray, partial)` Take a `/`-split
|
||||||
|
filename, and match it against a single row in the `regExpSet`. This
|
||||||
|
method is mainly for internal use, but is exposed so that it can be
|
||||||
|
used by a glob-walker that needs to avoid excessive filesystem calls.
|
||||||
|
|
||||||
|
All other methods are internal, and will be called as necessary.
|
||||||
|
|
||||||
|
### minimatch(path, pattern, options)
|
||||||
|
|
||||||
|
Main export. Tests a path against the pattern using the options.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var isJS = minimatch(file, "*.js", { matchBase: true })
|
||||||
|
```
|
||||||
|
|
||||||
|
### minimatch.filter(pattern, options)
|
||||||
|
|
||||||
|
Returns a function that tests its
|
||||||
|
supplied argument, suitable for use with `Array.filter`. Example:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var javascripts = fileList.filter(minimatch.filter("*.js", {matchBase: true}))
|
||||||
|
```
|
||||||
|
|
||||||
|
### minimatch.match(list, pattern, options)
|
||||||
|
|
||||||
|
Match against the list of
|
||||||
|
files, in the style of fnmatch or glob. If nothing is matched, and
|
||||||
|
options.nonull is set, then return a list containing the pattern itself.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var javascripts = minimatch.match(fileList, "*.js", {matchBase: true}))
|
||||||
|
```
|
||||||
|
|
||||||
|
### minimatch.makeRe(pattern, options)
|
||||||
|
|
||||||
|
Make a regular expression object from the pattern.
|
||||||
|
|
||||||
|
## Options
|
||||||
|
|
||||||
|
All options are `false` by default.
|
||||||
|
|
||||||
|
### debug
|
||||||
|
|
||||||
|
Dump a ton of stuff to stderr.
|
||||||
|
|
||||||
|
### nobrace
|
||||||
|
|
||||||
|
Do not expand `{a,b}` and `{1..3}` brace sets.
|
||||||
|
|
||||||
|
### noglobstar
|
||||||
|
|
||||||
|
Disable `**` matching against multiple folder names.
|
||||||
|
|
||||||
|
### dot
|
||||||
|
|
||||||
|
Allow patterns to match filenames starting with a period, even if
|
||||||
|
the pattern does not explicitly have a period in that spot.
|
||||||
|
|
||||||
|
Note that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot`
|
||||||
|
is set.
|
||||||
|
|
||||||
|
### noext
|
||||||
|
|
||||||
|
Disable "extglob" style patterns like `+(a|b)`.
|
||||||
|
|
||||||
|
### nocase
|
||||||
|
|
||||||
|
Perform a case-insensitive match.
|
||||||
|
|
||||||
|
### nonull
|
||||||
|
|
||||||
|
When a match is not found by `minimatch.match`, return a list containing
|
||||||
|
the pattern itself if this option is set. When not set, an empty list
|
||||||
|
is returned if there are no matches.
|
||||||
|
|
||||||
|
### matchBase
|
||||||
|
|
||||||
|
If set, then patterns without slashes will be matched
|
||||||
|
against the basename of the path if it contains slashes. For example,
|
||||||
|
`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`.
|
||||||
|
|
||||||
|
### nocomment
|
||||||
|
|
||||||
|
Suppress the behavior of treating `#` at the start of a pattern as a
|
||||||
|
comment.
|
||||||
|
|
||||||
|
### nonegate
|
||||||
|
|
||||||
|
Suppress the behavior of treating a leading `!` character as negation.
|
||||||
|
|
||||||
|
### flipNegate
|
||||||
|
|
||||||
|
Returns from negate expressions the same as if they were not negated.
|
||||||
|
(Ie, true on a hit, false on a miss.)
|
||||||
|
|
||||||
|
|
||||||
|
## Comparisons to other fnmatch/glob implementations
|
||||||
|
|
||||||
|
While strict compliance with the existing standards is a worthwhile
|
||||||
|
goal, some discrepancies exist between minimatch and other
|
||||||
|
implementations, and are intentional.
|
||||||
|
|
||||||
|
If the pattern starts with a `!` character, then it is negated. Set the
|
||||||
|
`nonegate` flag to suppress this behavior, and treat leading `!`
|
||||||
|
characters normally. This is perhaps relevant if you wish to start the
|
||||||
|
pattern with a negative extglob pattern like `!(a|B)`. Multiple `!`
|
||||||
|
characters at the start of a pattern will negate the pattern multiple
|
||||||
|
times.
|
||||||
|
|
||||||
|
If a pattern starts with `#`, then it is treated as a comment, and
|
||||||
|
will not match anything. Use `\#` to match a literal `#` at the
|
||||||
|
start of a line, or set the `nocomment` flag to suppress this behavior.
|
||||||
|
|
||||||
|
The double-star character `**` is supported by default, unless the
|
||||||
|
`noglobstar` flag is set. This is supported in the manner of bsdglob
|
||||||
|
and bash 4.1, where `**` only has special significance if it is the only
|
||||||
|
thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but
|
||||||
|
`a/**b` will not.
|
||||||
|
|
||||||
|
If an escaped pattern has no matches, and the `nonull` flag is set,
|
||||||
|
then minimatch.match returns the pattern as-provided, rather than
|
||||||
|
interpreting the character escapes. For example,
|
||||||
|
`minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than
|
||||||
|
`"*a?"`. This is akin to setting the `nullglob` option in bash, except
|
||||||
|
that it does not resolve escaped pattern characters.
|
||||||
|
|
||||||
|
If brace expansion is not disabled, then it is performed before any
|
||||||
|
other interpretation of the glob pattern. Thus, a pattern like
|
||||||
|
`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded
|
||||||
|
**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are
|
||||||
|
checked for validity. Since those two are valid, matching proceeds.
|
||||||
923
node_modules/minimatch/minimatch.js
generated
vendored
Normal file
923
node_modules/minimatch/minimatch.js
generated
vendored
Normal file
@@ -0,0 +1,923 @@
|
|||||||
|
module.exports = minimatch
|
||||||
|
minimatch.Minimatch = Minimatch
|
||||||
|
|
||||||
|
var path = { sep: '/' }
|
||||||
|
try {
|
||||||
|
path = require('path')
|
||||||
|
} catch (er) {}
|
||||||
|
|
||||||
|
var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
|
||||||
|
var expand = require('brace-expansion')
|
||||||
|
|
||||||
|
var plTypes = {
|
||||||
|
'!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
|
||||||
|
'?': { open: '(?:', close: ')?' },
|
||||||
|
'+': { open: '(?:', close: ')+' },
|
||||||
|
'*': { open: '(?:', close: ')*' },
|
||||||
|
'@': { open: '(?:', close: ')' }
|
||||||
|
}
|
||||||
|
|
||||||
|
// any single thing other than /
|
||||||
|
// don't need to escape / when using new RegExp()
|
||||||
|
var qmark = '[^/]'
|
||||||
|
|
||||||
|
// * => any number of characters
|
||||||
|
var star = qmark + '*?'
|
||||||
|
|
||||||
|
// ** when dots are allowed. Anything goes, except .. and .
|
||||||
|
// not (^ or / followed by one or two dots followed by $ or /),
|
||||||
|
// followed by anything, any number of times.
|
||||||
|
var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?'
|
||||||
|
|
||||||
|
// not a ^ or / followed by a dot,
|
||||||
|
// followed by anything, any number of times.
|
||||||
|
var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?'
|
||||||
|
|
||||||
|
// characters that need to be escaped in RegExp.
|
||||||
|
var reSpecials = charSet('().*{}+?[]^$\\!')
|
||||||
|
|
||||||
|
// "abc" -> { a:true, b:true, c:true }
|
||||||
|
function charSet (s) {
|
||||||
|
return s.split('').reduce(function (set, c) {
|
||||||
|
set[c] = true
|
||||||
|
return set
|
||||||
|
}, {})
|
||||||
|
}
|
||||||
|
|
||||||
|
// normalizes slashes.
|
||||||
|
var slashSplit = /\/+/
|
||||||
|
|
||||||
|
minimatch.filter = filter
|
||||||
|
function filter (pattern, options) {
|
||||||
|
options = options || {}
|
||||||
|
return function (p, i, list) {
|
||||||
|
return minimatch(p, pattern, options)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ext (a, b) {
|
||||||
|
a = a || {}
|
||||||
|
b = b || {}
|
||||||
|
var t = {}
|
||||||
|
Object.keys(b).forEach(function (k) {
|
||||||
|
t[k] = b[k]
|
||||||
|
})
|
||||||
|
Object.keys(a).forEach(function (k) {
|
||||||
|
t[k] = a[k]
|
||||||
|
})
|
||||||
|
return t
|
||||||
|
}
|
||||||
|
|
||||||
|
minimatch.defaults = function (def) {
|
||||||
|
if (!def || !Object.keys(def).length) return minimatch
|
||||||
|
|
||||||
|
var orig = minimatch
|
||||||
|
|
||||||
|
var m = function minimatch (p, pattern, options) {
|
||||||
|
return orig.minimatch(p, pattern, ext(def, options))
|
||||||
|
}
|
||||||
|
|
||||||
|
m.Minimatch = function Minimatch (pattern, options) {
|
||||||
|
return new orig.Minimatch(pattern, ext(def, options))
|
||||||
|
}
|
||||||
|
|
||||||
|
return m
|
||||||
|
}
|
||||||
|
|
||||||
|
Minimatch.defaults = function (def) {
|
||||||
|
if (!def || !Object.keys(def).length) return Minimatch
|
||||||
|
return minimatch.defaults(def).Minimatch
|
||||||
|
}
|
||||||
|
|
||||||
|
function minimatch (p, pattern, options) {
|
||||||
|
if (typeof pattern !== 'string') {
|
||||||
|
throw new TypeError('glob pattern string required')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!options) options = {}
|
||||||
|
|
||||||
|
// shortcut: comments match nothing.
|
||||||
|
if (!options.nocomment && pattern.charAt(0) === '#') {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// "" only matches ""
|
||||||
|
if (pattern.trim() === '') return p === ''
|
||||||
|
|
||||||
|
return new Minimatch(pattern, options).match(p)
|
||||||
|
}
|
||||||
|
|
||||||
|
function Minimatch (pattern, options) {
|
||||||
|
if (!(this instanceof Minimatch)) {
|
||||||
|
return new Minimatch(pattern, options)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof pattern !== 'string') {
|
||||||
|
throw new TypeError('glob pattern string required')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!options) options = {}
|
||||||
|
pattern = pattern.trim()
|
||||||
|
|
||||||
|
// windows support: need to use /, not \
|
||||||
|
if (path.sep !== '/') {
|
||||||
|
pattern = pattern.split(path.sep).join('/')
|
||||||
|
}
|
||||||
|
|
||||||
|
this.options = options
|
||||||
|
this.set = []
|
||||||
|
this.pattern = pattern
|
||||||
|
this.regexp = null
|
||||||
|
this.negate = false
|
||||||
|
this.comment = false
|
||||||
|
this.empty = false
|
||||||
|
|
||||||
|
// make the set of regexps etc.
|
||||||
|
this.make()
|
||||||
|
}
|
||||||
|
|
||||||
|
Minimatch.prototype.debug = function () {}
|
||||||
|
|
||||||
|
Minimatch.prototype.make = make
|
||||||
|
function make () {
|
||||||
|
// don't do it more than once.
|
||||||
|
if (this._made) return
|
||||||
|
|
||||||
|
var pattern = this.pattern
|
||||||
|
var options = this.options
|
||||||
|
|
||||||
|
// empty patterns and comments match nothing.
|
||||||
|
if (!options.nocomment && pattern.charAt(0) === '#') {
|
||||||
|
this.comment = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!pattern) {
|
||||||
|
this.empty = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// step 1: figure out negation, etc.
|
||||||
|
this.parseNegate()
|
||||||
|
|
||||||
|
// step 2: expand braces
|
||||||
|
var set = this.globSet = this.braceExpand()
|
||||||
|
|
||||||
|
if (options.debug) this.debug = console.error
|
||||||
|
|
||||||
|
this.debug(this.pattern, set)
|
||||||
|
|
||||||
|
// step 3: now we have a set, so turn each one into a series of path-portion
|
||||||
|
// matching patterns.
|
||||||
|
// These will be regexps, except in the case of "**", which is
|
||||||
|
// set to the GLOBSTAR object for globstar behavior,
|
||||||
|
// and will not contain any / characters
|
||||||
|
set = this.globParts = set.map(function (s) {
|
||||||
|
return s.split(slashSplit)
|
||||||
|
})
|
||||||
|
|
||||||
|
this.debug(this.pattern, set)
|
||||||
|
|
||||||
|
// glob --> regexps
|
||||||
|
set = set.map(function (s, si, set) {
|
||||||
|
return s.map(this.parse, this)
|
||||||
|
}, this)
|
||||||
|
|
||||||
|
this.debug(this.pattern, set)
|
||||||
|
|
||||||
|
// filter out everything that didn't compile properly.
|
||||||
|
set = set.filter(function (s) {
|
||||||
|
return s.indexOf(false) === -1
|
||||||
|
})
|
||||||
|
|
||||||
|
this.debug(this.pattern, set)
|
||||||
|
|
||||||
|
this.set = set
|
||||||
|
}
|
||||||
|
|
||||||
|
Minimatch.prototype.parseNegate = parseNegate
|
||||||
|
function parseNegate () {
|
||||||
|
var pattern = this.pattern
|
||||||
|
var negate = false
|
||||||
|
var options = this.options
|
||||||
|
var negateOffset = 0
|
||||||
|
|
||||||
|
if (options.nonegate) return
|
||||||
|
|
||||||
|
for (var i = 0, l = pattern.length
|
||||||
|
; i < l && pattern.charAt(i) === '!'
|
||||||
|
; i++) {
|
||||||
|
negate = !negate
|
||||||
|
negateOffset++
|
||||||
|
}
|
||||||
|
|
||||||
|
if (negateOffset) this.pattern = pattern.substr(negateOffset)
|
||||||
|
this.negate = negate
|
||||||
|
}
|
||||||
|
|
||||||
|
// Brace expansion:
|
||||||
|
// a{b,c}d -> abd acd
|
||||||
|
// a{b,}c -> abc ac
|
||||||
|
// a{0..3}d -> a0d a1d a2d a3d
|
||||||
|
// a{b,c{d,e}f}g -> abg acdfg acefg
|
||||||
|
// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
|
||||||
|
//
|
||||||
|
// Invalid sets are not expanded.
|
||||||
|
// a{2..}b -> a{2..}b
|
||||||
|
// a{b}c -> a{b}c
|
||||||
|
minimatch.braceExpand = function (pattern, options) {
|
||||||
|
return braceExpand(pattern, options)
|
||||||
|
}
|
||||||
|
|
||||||
|
Minimatch.prototype.braceExpand = braceExpand
|
||||||
|
|
||||||
|
function braceExpand (pattern, options) {
|
||||||
|
if (!options) {
|
||||||
|
if (this instanceof Minimatch) {
|
||||||
|
options = this.options
|
||||||
|
} else {
|
||||||
|
options = {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pattern = typeof pattern === 'undefined'
|
||||||
|
? this.pattern : pattern
|
||||||
|
|
||||||
|
if (typeof pattern === 'undefined') {
|
||||||
|
throw new TypeError('undefined pattern')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.nobrace ||
|
||||||
|
!pattern.match(/\{.*\}/)) {
|
||||||
|
// shortcut. no need to expand.
|
||||||
|
return [pattern]
|
||||||
|
}
|
||||||
|
|
||||||
|
return expand(pattern)
|
||||||
|
}
|
||||||
|
|
||||||
|
// parse a component of the expanded set.
|
||||||
|
// At this point, no pattern may contain "/" in it
|
||||||
|
// so we're going to return a 2d array, where each entry is the full
|
||||||
|
// pattern, split on '/', and then turned into a regular expression.
|
||||||
|
// A regexp is made at the end which joins each array with an
|
||||||
|
// escaped /, and another full one which joins each regexp with |.
|
||||||
|
//
|
||||||
|
// Following the lead of Bash 4.1, note that "**" only has special meaning
|
||||||
|
// when it is the *only* thing in a path portion. Otherwise, any series
|
||||||
|
// of * is equivalent to a single *. Globstar behavior is enabled by
|
||||||
|
// default, and can be disabled by setting options.noglobstar.
|
||||||
|
Minimatch.prototype.parse = parse
|
||||||
|
var SUBPARSE = {}
|
||||||
|
function parse (pattern, isSub) {
|
||||||
|
if (pattern.length > 1024 * 64) {
|
||||||
|
throw new TypeError('pattern is too long')
|
||||||
|
}
|
||||||
|
|
||||||
|
var options = this.options
|
||||||
|
|
||||||
|
// shortcuts
|
||||||
|
if (!options.noglobstar && pattern === '**') return GLOBSTAR
|
||||||
|
if (pattern === '') return ''
|
||||||
|
|
||||||
|
var re = ''
|
||||||
|
var hasMagic = !!options.nocase
|
||||||
|
var escaping = false
|
||||||
|
// ? => one single character
|
||||||
|
var patternListStack = []
|
||||||
|
var negativeLists = []
|
||||||
|
var stateChar
|
||||||
|
var inClass = false
|
||||||
|
var reClassStart = -1
|
||||||
|
var classStart = -1
|
||||||
|
// . and .. never match anything that doesn't start with .,
|
||||||
|
// even when options.dot is set.
|
||||||
|
var patternStart = pattern.charAt(0) === '.' ? '' // anything
|
||||||
|
// not (start or / followed by . or .. followed by / or end)
|
||||||
|
: options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))'
|
||||||
|
: '(?!\\.)'
|
||||||
|
var self = this
|
||||||
|
|
||||||
|
function clearStateChar () {
|
||||||
|
if (stateChar) {
|
||||||
|
// we had some state-tracking character
|
||||||
|
// that wasn't consumed by this pass.
|
||||||
|
switch (stateChar) {
|
||||||
|
case '*':
|
||||||
|
re += star
|
||||||
|
hasMagic = true
|
||||||
|
break
|
||||||
|
case '?':
|
||||||
|
re += qmark
|
||||||
|
hasMagic = true
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
re += '\\' + stateChar
|
||||||
|
break
|
||||||
|
}
|
||||||
|
self.debug('clearStateChar %j %j', stateChar, re)
|
||||||
|
stateChar = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0, len = pattern.length, c
|
||||||
|
; (i < len) && (c = pattern.charAt(i))
|
||||||
|
; i++) {
|
||||||
|
this.debug('%s\t%s %s %j', pattern, i, re, c)
|
||||||
|
|
||||||
|
// skip over any that are escaped.
|
||||||
|
if (escaping && reSpecials[c]) {
|
||||||
|
re += '\\' + c
|
||||||
|
escaping = false
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (c) {
|
||||||
|
case '/':
|
||||||
|
// completely not allowed, even escaped.
|
||||||
|
// Should already be path-split by now.
|
||||||
|
return false
|
||||||
|
|
||||||
|
case '\\':
|
||||||
|
clearStateChar()
|
||||||
|
escaping = true
|
||||||
|
continue
|
||||||
|
|
||||||
|
// the various stateChar values
|
||||||
|
// for the "extglob" stuff.
|
||||||
|
case '?':
|
||||||
|
case '*':
|
||||||
|
case '+':
|
||||||
|
case '@':
|
||||||
|
case '!':
|
||||||
|
this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c)
|
||||||
|
|
||||||
|
// all of those are literals inside a class, except that
|
||||||
|
// the glob [!a] means [^a] in regexp
|
||||||
|
if (inClass) {
|
||||||
|
this.debug(' in class')
|
||||||
|
if (c === '!' && i === classStart + 1) c = '^'
|
||||||
|
re += c
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// if we already have a stateChar, then it means
|
||||||
|
// that there was something like ** or +? in there.
|
||||||
|
// Handle the stateChar, then proceed with this one.
|
||||||
|
self.debug('call clearStateChar %j', stateChar)
|
||||||
|
clearStateChar()
|
||||||
|
stateChar = c
|
||||||
|
// if extglob is disabled, then +(asdf|foo) isn't a thing.
|
||||||
|
// just clear the statechar *now*, rather than even diving into
|
||||||
|
// the patternList stuff.
|
||||||
|
if (options.noext) clearStateChar()
|
||||||
|
continue
|
||||||
|
|
||||||
|
case '(':
|
||||||
|
if (inClass) {
|
||||||
|
re += '('
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!stateChar) {
|
||||||
|
re += '\\('
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
patternListStack.push({
|
||||||
|
type: stateChar,
|
||||||
|
start: i - 1,
|
||||||
|
reStart: re.length,
|
||||||
|
open: plTypes[stateChar].open,
|
||||||
|
close: plTypes[stateChar].close
|
||||||
|
})
|
||||||
|
// negation is (?:(?!js)[^/]*)
|
||||||
|
re += stateChar === '!' ? '(?:(?!(?:' : '(?:'
|
||||||
|
this.debug('plType %j %j', stateChar, re)
|
||||||
|
stateChar = false
|
||||||
|
continue
|
||||||
|
|
||||||
|
case ')':
|
||||||
|
if (inClass || !patternListStack.length) {
|
||||||
|
re += '\\)'
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
clearStateChar()
|
||||||
|
hasMagic = true
|
||||||
|
var pl = patternListStack.pop()
|
||||||
|
// negation is (?:(?!js)[^/]*)
|
||||||
|
// The others are (?:<pattern>)<type>
|
||||||
|
re += pl.close
|
||||||
|
if (pl.type === '!') {
|
||||||
|
negativeLists.push(pl)
|
||||||
|
}
|
||||||
|
pl.reEnd = re.length
|
||||||
|
continue
|
||||||
|
|
||||||
|
case '|':
|
||||||
|
if (inClass || !patternListStack.length || escaping) {
|
||||||
|
re += '\\|'
|
||||||
|
escaping = false
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
clearStateChar()
|
||||||
|
re += '|'
|
||||||
|
continue
|
||||||
|
|
||||||
|
// these are mostly the same in regexp and glob
|
||||||
|
case '[':
|
||||||
|
// swallow any state-tracking char before the [
|
||||||
|
clearStateChar()
|
||||||
|
|
||||||
|
if (inClass) {
|
||||||
|
re += '\\' + c
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
inClass = true
|
||||||
|
classStart = i
|
||||||
|
reClassStart = re.length
|
||||||
|
re += c
|
||||||
|
continue
|
||||||
|
|
||||||
|
case ']':
|
||||||
|
// a right bracket shall lose its special
|
||||||
|
// meaning and represent itself in
|
||||||
|
// a bracket expression if it occurs
|
||||||
|
// first in the list. -- POSIX.2 2.8.3.2
|
||||||
|
if (i === classStart + 1 || !inClass) {
|
||||||
|
re += '\\' + c
|
||||||
|
escaping = false
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// handle the case where we left a class open.
|
||||||
|
// "[z-a]" is valid, equivalent to "\[z-a\]"
|
||||||
|
if (inClass) {
|
||||||
|
// split where the last [ was, make sure we don't have
|
||||||
|
// an invalid re. if so, re-walk the contents of the
|
||||||
|
// would-be class to re-translate any characters that
|
||||||
|
// were passed through as-is
|
||||||
|
// TODO: It would probably be faster to determine this
|
||||||
|
// without a try/catch and a new RegExp, but it's tricky
|
||||||
|
// to do safely. For now, this is safe and works.
|
||||||
|
var cs = pattern.substring(classStart + 1, i)
|
||||||
|
try {
|
||||||
|
RegExp('[' + cs + ']')
|
||||||
|
} catch (er) {
|
||||||
|
// not a valid class!
|
||||||
|
var sp = this.parse(cs, SUBPARSE)
|
||||||
|
re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
|
||||||
|
hasMagic = hasMagic || sp[1]
|
||||||
|
inClass = false
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// finish up the class.
|
||||||
|
hasMagic = true
|
||||||
|
inClass = false
|
||||||
|
re += c
|
||||||
|
continue
|
||||||
|
|
||||||
|
default:
|
||||||
|
// swallow any state char that wasn't consumed
|
||||||
|
clearStateChar()
|
||||||
|
|
||||||
|
if (escaping) {
|
||||||
|
// no need
|
||||||
|
escaping = false
|
||||||
|
} else if (reSpecials[c]
|
||||||
|
&& !(c === '^' && inClass)) {
|
||||||
|
re += '\\'
|
||||||
|
}
|
||||||
|
|
||||||
|
re += c
|
||||||
|
|
||||||
|
} // switch
|
||||||
|
} // for
|
||||||
|
|
||||||
|
// handle the case where we left a class open.
|
||||||
|
// "[abc" is valid, equivalent to "\[abc"
|
||||||
|
if (inClass) {
|
||||||
|
// split where the last [ was, and escape it
|
||||||
|
// this is a huge pita. We now have to re-walk
|
||||||
|
// the contents of the would-be class to re-translate
|
||||||
|
// any characters that were passed through as-is
|
||||||
|
cs = pattern.substr(classStart + 1)
|
||||||
|
sp = this.parse(cs, SUBPARSE)
|
||||||
|
re = re.substr(0, reClassStart) + '\\[' + sp[0]
|
||||||
|
hasMagic = hasMagic || sp[1]
|
||||||
|
}
|
||||||
|
|
||||||
|
// handle the case where we had a +( thing at the *end*
|
||||||
|
// of the pattern.
|
||||||
|
// each pattern list stack adds 3 chars, and we need to go through
|
||||||
|
// and escape any | chars that were passed through as-is for the regexp.
|
||||||
|
// Go through and escape them, taking care not to double-escape any
|
||||||
|
// | chars that were already escaped.
|
||||||
|
for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
|
||||||
|
var tail = re.slice(pl.reStart + pl.open.length)
|
||||||
|
this.debug('setting tail', re, pl)
|
||||||
|
// maybe some even number of \, then maybe 1 \, followed by a |
|
||||||
|
tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) {
|
||||||
|
if (!$2) {
|
||||||
|
// the | isn't already escaped, so escape it.
|
||||||
|
$2 = '\\'
|
||||||
|
}
|
||||||
|
|
||||||
|
// need to escape all those slashes *again*, without escaping the
|
||||||
|
// one that we need for escaping the | character. As it works out,
|
||||||
|
// escaping an even number of slashes can be done by simply repeating
|
||||||
|
// it exactly after itself. That's why this trick works.
|
||||||
|
//
|
||||||
|
// I am sorry that you have to see this.
|
||||||
|
return $1 + $1 + $2 + '|'
|
||||||
|
})
|
||||||
|
|
||||||
|
this.debug('tail=%j\n %s', tail, tail, pl, re)
|
||||||
|
var t = pl.type === '*' ? star
|
||||||
|
: pl.type === '?' ? qmark
|
||||||
|
: '\\' + pl.type
|
||||||
|
|
||||||
|
hasMagic = true
|
||||||
|
re = re.slice(0, pl.reStart) + t + '\\(' + tail
|
||||||
|
}
|
||||||
|
|
||||||
|
// handle trailing things that only matter at the very end.
|
||||||
|
clearStateChar()
|
||||||
|
if (escaping) {
|
||||||
|
// trailing \\
|
||||||
|
re += '\\\\'
|
||||||
|
}
|
||||||
|
|
||||||
|
// only need to apply the nodot start if the re starts with
|
||||||
|
// something that could conceivably capture a dot
|
||||||
|
var addPatternStart = false
|
||||||
|
switch (re.charAt(0)) {
|
||||||
|
case '.':
|
||||||
|
case '[':
|
||||||
|
case '(': addPatternStart = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hack to work around lack of negative lookbehind in JS
|
||||||
|
// A pattern like: *.!(x).!(y|z) needs to ensure that a name
|
||||||
|
// like 'a.xyz.yz' doesn't match. So, the first negative
|
||||||
|
// lookahead, has to look ALL the way ahead, to the end of
|
||||||
|
// the pattern.
|
||||||
|
for (var n = negativeLists.length - 1; n > -1; n--) {
|
||||||
|
var nl = negativeLists[n]
|
||||||
|
|
||||||
|
var nlBefore = re.slice(0, nl.reStart)
|
||||||
|
var nlFirst = re.slice(nl.reStart, nl.reEnd - 8)
|
||||||
|
var nlLast = re.slice(nl.reEnd - 8, nl.reEnd)
|
||||||
|
var nlAfter = re.slice(nl.reEnd)
|
||||||
|
|
||||||
|
nlLast += nlAfter
|
||||||
|
|
||||||
|
// Handle nested stuff like *(*.js|!(*.json)), where open parens
|
||||||
|
// mean that we should *not* include the ) in the bit that is considered
|
||||||
|
// "after" the negated section.
|
||||||
|
var openParensBefore = nlBefore.split('(').length - 1
|
||||||
|
var cleanAfter = nlAfter
|
||||||
|
for (i = 0; i < openParensBefore; i++) {
|
||||||
|
cleanAfter = cleanAfter.replace(/\)[+*?]?/, '')
|
||||||
|
}
|
||||||
|
nlAfter = cleanAfter
|
||||||
|
|
||||||
|
var dollar = ''
|
||||||
|
if (nlAfter === '' && isSub !== SUBPARSE) {
|
||||||
|
dollar = '$'
|
||||||
|
}
|
||||||
|
var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast
|
||||||
|
re = newRe
|
||||||
|
}
|
||||||
|
|
||||||
|
// if the re is not "" at this point, then we need to make sure
|
||||||
|
// it doesn't match against an empty path part.
|
||||||
|
// Otherwise a/* will match a/, which it should not.
|
||||||
|
if (re !== '' && hasMagic) {
|
||||||
|
re = '(?=.)' + re
|
||||||
|
}
|
||||||
|
|
||||||
|
if (addPatternStart) {
|
||||||
|
re = patternStart + re
|
||||||
|
}
|
||||||
|
|
||||||
|
// parsing just a piece of a larger pattern.
|
||||||
|
if (isSub === SUBPARSE) {
|
||||||
|
return [re, hasMagic]
|
||||||
|
}
|
||||||
|
|
||||||
|
// skip the regexp for non-magical patterns
|
||||||
|
// unescape anything in it, though, so that it'll be
|
||||||
|
// an exact match against a file etc.
|
||||||
|
if (!hasMagic) {
|
||||||
|
return globUnescape(pattern)
|
||||||
|
}
|
||||||
|
|
||||||
|
var flags = options.nocase ? 'i' : ''
|
||||||
|
try {
|
||||||
|
var regExp = new RegExp('^' + re + '$', flags)
|
||||||
|
} catch (er) {
|
||||||
|
// If it was an invalid regular expression, then it can't match
|
||||||
|
// anything. This trick looks for a character after the end of
|
||||||
|
// the string, which is of course impossible, except in multi-line
|
||||||
|
// mode, but it's not a /m regex.
|
||||||
|
return new RegExp('$.')
|
||||||
|
}
|
||||||
|
|
||||||
|
regExp._glob = pattern
|
||||||
|
regExp._src = re
|
||||||
|
|
||||||
|
return regExp
|
||||||
|
}
|
||||||
|
|
||||||
|
minimatch.makeRe = function (pattern, options) {
|
||||||
|
return new Minimatch(pattern, options || {}).makeRe()
|
||||||
|
}
|
||||||
|
|
||||||
|
Minimatch.prototype.makeRe = makeRe
|
||||||
|
function makeRe () {
|
||||||
|
if (this.regexp || this.regexp === false) return this.regexp
|
||||||
|
|
||||||
|
// at this point, this.set is a 2d array of partial
|
||||||
|
// pattern strings, or "**".
|
||||||
|
//
|
||||||
|
// It's better to use .match(). This function shouldn't
|
||||||
|
// be used, really, but it's pretty convenient sometimes,
|
||||||
|
// when you just want to work with a regex.
|
||||||
|
var set = this.set
|
||||||
|
|
||||||
|
if (!set.length) {
|
||||||
|
this.regexp = false
|
||||||
|
return this.regexp
|
||||||
|
}
|
||||||
|
var options = this.options
|
||||||
|
|
||||||
|
var twoStar = options.noglobstar ? star
|
||||||
|
: options.dot ? twoStarDot
|
||||||
|
: twoStarNoDot
|
||||||
|
var flags = options.nocase ? 'i' : ''
|
||||||
|
|
||||||
|
var re = set.map(function (pattern) {
|
||||||
|
return pattern.map(function (p) {
|
||||||
|
return (p === GLOBSTAR) ? twoStar
|
||||||
|
: (typeof p === 'string') ? regExpEscape(p)
|
||||||
|
: p._src
|
||||||
|
}).join('\\\/')
|
||||||
|
}).join('|')
|
||||||
|
|
||||||
|
// must match entire pattern
|
||||||
|
// ending in a * or ** will make it less strict.
|
||||||
|
re = '^(?:' + re + ')$'
|
||||||
|
|
||||||
|
// can match anything, as long as it's not this.
|
||||||
|
if (this.negate) re = '^(?!' + re + ').*$'
|
||||||
|
|
||||||
|
try {
|
||||||
|
this.regexp = new RegExp(re, flags)
|
||||||
|
} catch (ex) {
|
||||||
|
this.regexp = false
|
||||||
|
}
|
||||||
|
return this.regexp
|
||||||
|
}
|
||||||
|
|
||||||
|
minimatch.match = function (list, pattern, options) {
|
||||||
|
options = options || {}
|
||||||
|
var mm = new Minimatch(pattern, options)
|
||||||
|
list = list.filter(function (f) {
|
||||||
|
return mm.match(f)
|
||||||
|
})
|
||||||
|
if (mm.options.nonull && !list.length) {
|
||||||
|
list.push(pattern)
|
||||||
|
}
|
||||||
|
return list
|
||||||
|
}
|
||||||
|
|
||||||
|
Minimatch.prototype.match = match
|
||||||
|
function match (f, partial) {
|
||||||
|
this.debug('match', f, this.pattern)
|
||||||
|
// short-circuit in the case of busted things.
|
||||||
|
// comments, etc.
|
||||||
|
if (this.comment) return false
|
||||||
|
if (this.empty) return f === ''
|
||||||
|
|
||||||
|
if (f === '/' && partial) return true
|
||||||
|
|
||||||
|
var options = this.options
|
||||||
|
|
||||||
|
// windows: need to use /, not \
|
||||||
|
if (path.sep !== '/') {
|
||||||
|
f = f.split(path.sep).join('/')
|
||||||
|
}
|
||||||
|
|
||||||
|
// treat the test path as a set of pathparts.
|
||||||
|
f = f.split(slashSplit)
|
||||||
|
this.debug(this.pattern, 'split', f)
|
||||||
|
|
||||||
|
// just ONE of the pattern sets in this.set needs to match
|
||||||
|
// in order for it to be valid. If negating, then just one
|
||||||
|
// match means that we have failed.
|
||||||
|
// Either way, return on the first hit.
|
||||||
|
|
||||||
|
var set = this.set
|
||||||
|
this.debug(this.pattern, 'set', set)
|
||||||
|
|
||||||
|
// Find the basename of the path by looking for the last non-empty segment
|
||||||
|
var filename
|
||||||
|
var i
|
||||||
|
for (i = f.length - 1; i >= 0; i--) {
|
||||||
|
filename = f[i]
|
||||||
|
if (filename) break
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < set.length; i++) {
|
||||||
|
var pattern = set[i]
|
||||||
|
var file = f
|
||||||
|
if (options.matchBase && pattern.length === 1) {
|
||||||
|
file = [filename]
|
||||||
|
}
|
||||||
|
var hit = this.matchOne(file, pattern, partial)
|
||||||
|
if (hit) {
|
||||||
|
if (options.flipNegate) return true
|
||||||
|
return !this.negate
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// didn't get any hits. this is success if it's a negative
|
||||||
|
// pattern, failure otherwise.
|
||||||
|
if (options.flipNegate) return false
|
||||||
|
return this.negate
|
||||||
|
}
|
||||||
|
|
||||||
|
// set partial to true to test if, for example,
|
||||||
|
// "/a/b" matches the start of "/*/b/*/d"
|
||||||
|
// Partial means, if you run out of file before you run
|
||||||
|
// out of pattern, then that's fine, as long as all
|
||||||
|
// the parts match.
|
||||||
|
Minimatch.prototype.matchOne = function (file, pattern, partial) {
|
||||||
|
var options = this.options
|
||||||
|
|
||||||
|
this.debug('matchOne',
|
||||||
|
{ 'this': this, file: file, pattern: pattern })
|
||||||
|
|
||||||
|
this.debug('matchOne', file.length, pattern.length)
|
||||||
|
|
||||||
|
for (var fi = 0,
|
||||||
|
pi = 0,
|
||||||
|
fl = file.length,
|
||||||
|
pl = pattern.length
|
||||||
|
; (fi < fl) && (pi < pl)
|
||||||
|
; fi++, pi++) {
|
||||||
|
this.debug('matchOne loop')
|
||||||
|
var p = pattern[pi]
|
||||||
|
var f = file[fi]
|
||||||
|
|
||||||
|
this.debug(pattern, p, f)
|
||||||
|
|
||||||
|
// should be impossible.
|
||||||
|
// some invalid regexp stuff in the set.
|
||||||
|
if (p === false) return false
|
||||||
|
|
||||||
|
if (p === GLOBSTAR) {
|
||||||
|
this.debug('GLOBSTAR', [pattern, p, f])
|
||||||
|
|
||||||
|
// "**"
|
||||||
|
// a/**/b/**/c would match the following:
|
||||||
|
// a/b/x/y/z/c
|
||||||
|
// a/x/y/z/b/c
|
||||||
|
// a/b/x/b/x/c
|
||||||
|
// a/b/c
|
||||||
|
// To do this, take the rest of the pattern after
|
||||||
|
// the **, and see if it would match the file remainder.
|
||||||
|
// If so, return success.
|
||||||
|
// If not, the ** "swallows" a segment, and try again.
|
||||||
|
// This is recursively awful.
|
||||||
|
//
|
||||||
|
// a/**/b/**/c matching a/b/x/y/z/c
|
||||||
|
// - a matches a
|
||||||
|
// - doublestar
|
||||||
|
// - matchOne(b/x/y/z/c, b/**/c)
|
||||||
|
// - b matches b
|
||||||
|
// - doublestar
|
||||||
|
// - matchOne(x/y/z/c, c) -> no
|
||||||
|
// - matchOne(y/z/c, c) -> no
|
||||||
|
// - matchOne(z/c, c) -> no
|
||||||
|
// - matchOne(c, c) yes, hit
|
||||||
|
var fr = fi
|
||||||
|
var pr = pi + 1
|
||||||
|
if (pr === pl) {
|
||||||
|
this.debug('** at the end')
|
||||||
|
// a ** at the end will just swallow the rest.
|
||||||
|
// We have found a match.
|
||||||
|
// however, it will not swallow /.x, unless
|
||||||
|
// options.dot is set.
|
||||||
|
// . and .. are *never* matched by **, for explosively
|
||||||
|
// exponential reasons.
|
||||||
|
for (; fi < fl; fi++) {
|
||||||
|
if (file[fi] === '.' || file[fi] === '..' ||
|
||||||
|
(!options.dot && file[fi].charAt(0) === '.')) return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// ok, let's see if we can swallow whatever we can.
|
||||||
|
while (fr < fl) {
|
||||||
|
var swallowee = file[fr]
|
||||||
|
|
||||||
|
this.debug('\nglobstar while', file, fr, pattern, pr, swallowee)
|
||||||
|
|
||||||
|
// XXX remove this slice. Just pass the start index.
|
||||||
|
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
||||||
|
this.debug('globstar found match!', fr, fl, swallowee)
|
||||||
|
// found a match.
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
// can't swallow "." or ".." ever.
|
||||||
|
// can only swallow ".foo" when explicitly asked.
|
||||||
|
if (swallowee === '.' || swallowee === '..' ||
|
||||||
|
(!options.dot && swallowee.charAt(0) === '.')) {
|
||||||
|
this.debug('dot detected!', file, fr, pattern, pr)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
// ** swallows a segment, and continue.
|
||||||
|
this.debug('globstar swallow a segment, and continue')
|
||||||
|
fr++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// no match was found.
|
||||||
|
// However, in partial mode, we can't say this is necessarily over.
|
||||||
|
// If there's more *pattern* left, then
|
||||||
|
if (partial) {
|
||||||
|
// ran out of file
|
||||||
|
this.debug('\n>>> no match, partial?', file, fr, pattern, pr)
|
||||||
|
if (fr === fl) return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// something other than **
|
||||||
|
// non-magic patterns just have to match exactly
|
||||||
|
// patterns with magic have been turned into regexps.
|
||||||
|
var hit
|
||||||
|
if (typeof p === 'string') {
|
||||||
|
if (options.nocase) {
|
||||||
|
hit = f.toLowerCase() === p.toLowerCase()
|
||||||
|
} else {
|
||||||
|
hit = f === p
|
||||||
|
}
|
||||||
|
this.debug('string match', p, f, hit)
|
||||||
|
} else {
|
||||||
|
hit = f.match(p)
|
||||||
|
this.debug('pattern match', p, f, hit)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hit) return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Note: ending in / means that we'll get a final ""
|
||||||
|
// at the end of the pattern. This can only match a
|
||||||
|
// corresponding "" at the end of the file.
|
||||||
|
// If the file ends in /, then it can only match a
|
||||||
|
// a pattern that ends in /, unless the pattern just
|
||||||
|
// doesn't have any more for it. But, a/b/ should *not*
|
||||||
|
// match "a/b/*", even though "" matches against the
|
||||||
|
// [^/]*? pattern, except in partial mode, where it might
|
||||||
|
// simply not be reached yet.
|
||||||
|
// However, a/b/ should still satisfy a/*
|
||||||
|
|
||||||
|
// now either we fell off the end of the pattern, or we're done.
|
||||||
|
if (fi === fl && pi === pl) {
|
||||||
|
// ran out of pattern and filename at the same time.
|
||||||
|
// an exact hit!
|
||||||
|
return true
|
||||||
|
} else if (fi === fl) {
|
||||||
|
// ran out of file, but still had pattern left.
|
||||||
|
// this is ok if we're doing the match as part of
|
||||||
|
// a glob fs traversal.
|
||||||
|
return partial
|
||||||
|
} else if (pi === pl) {
|
||||||
|
// ran out of pattern, still have file left.
|
||||||
|
// this is only acceptable if we're on the very last
|
||||||
|
// empty segment of a file with a trailing slash.
|
||||||
|
// a/* should match a/b/
|
||||||
|
var emptyFileEnd = (fi === fl - 1) && (file[fi] === '')
|
||||||
|
return emptyFileEnd
|
||||||
|
}
|
||||||
|
|
||||||
|
// should be unreachable.
|
||||||
|
throw new Error('wtf?')
|
||||||
|
}
|
||||||
|
|
||||||
|
// replace stuff like \* with *
|
||||||
|
function globUnescape (s) {
|
||||||
|
return s.replace(/\\(.)/g, '$1')
|
||||||
|
}
|
||||||
|
|
||||||
|
function regExpEscape (s) {
|
||||||
|
return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
|
||||||
|
}
|
||||||
63
node_modules/minimatch/package.json
generated
vendored
Normal file
63
node_modules/minimatch/package.json
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
{
|
||||||
|
"_from": "minimatch@^3.0.4",
|
||||||
|
"_id": "minimatch@3.0.4",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||||
|
"_location": "/minimatch",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "minimatch@^3.0.4",
|
||||||
|
"name": "minimatch",
|
||||||
|
"escapedName": "minimatch",
|
||||||
|
"rawSpec": "^3.0.4",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^3.0.4"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/glob"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||||
|
"_shasum": "5166e286457f03306064be5497e8dbb0c3d32083",
|
||||||
|
"_spec": "minimatch@^3.0.4",
|
||||||
|
"_where": "/Users/Ibrahim/Desktop/test2/node_modules/glob",
|
||||||
|
"author": {
|
||||||
|
"name": "Isaac Z. Schlueter",
|
||||||
|
"email": "i@izs.me",
|
||||||
|
"url": "http://blog.izs.me"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/isaacs/minimatch/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {
|
||||||
|
"brace-expansion": "^1.1.7"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "a glob matcher in javascript",
|
||||||
|
"devDependencies": {
|
||||||
|
"tap": "^10.3.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"minimatch.js"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/isaacs/minimatch#readme",
|
||||||
|
"license": "ISC",
|
||||||
|
"main": "minimatch.js",
|
||||||
|
"name": "minimatch",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/isaacs/minimatch.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"postpublish": "git push origin --all; git push origin --tags",
|
||||||
|
"postversion": "npm publish",
|
||||||
|
"preversion": "npm test",
|
||||||
|
"test": "tap test/*.js --cov"
|
||||||
|
},
|
||||||
|
"version": "3.0.4"
|
||||||
|
}
|
||||||
20
node_modules/path-is-absolute/index.js
generated
vendored
Normal file
20
node_modules/path-is-absolute/index.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
function posix(path) {
|
||||||
|
return path.charAt(0) === '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
function win32(path) {
|
||||||
|
// https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56
|
||||||
|
var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
|
||||||
|
var result = splitDeviceRe.exec(path);
|
||||||
|
var device = result[1] || '';
|
||||||
|
var isUnc = Boolean(device && device.charAt(1) !== ':');
|
||||||
|
|
||||||
|
// UNC paths are always absolute
|
||||||
|
return Boolean(result[2] || isUnc);
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = process.platform === 'win32' ? win32 : posix;
|
||||||
|
module.exports.posix = posix;
|
||||||
|
module.exports.win32 = win32;
|
||||||
21
node_modules/path-is-absolute/license
generated
vendored
Normal file
21
node_modules/path-is-absolute/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.
|
||||||
75
node_modules/path-is-absolute/package.json
generated
vendored
Normal file
75
node_modules/path-is-absolute/package.json
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
{
|
||||||
|
"_from": "path-is-absolute@^1.0.0",
|
||||||
|
"_id": "path-is-absolute@1.0.1",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
|
||||||
|
"_location": "/path-is-absolute",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "path-is-absolute@^1.0.0",
|
||||||
|
"name": "path-is-absolute",
|
||||||
|
"escapedName": "path-is-absolute",
|
||||||
|
"rawSpec": "^1.0.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^1.0.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/glob"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||||
|
"_shasum": "174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f",
|
||||||
|
"_spec": "path-is-absolute@^1.0.0",
|
||||||
|
"_where": "/Users/Ibrahim/Desktop/test2/node_modules/glob",
|
||||||
|
"author": {
|
||||||
|
"name": "Sindre Sorhus",
|
||||||
|
"email": "sindresorhus@gmail.com",
|
||||||
|
"url": "sindresorhus.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/sindresorhus/path-is-absolute/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Node.js 0.12 path.isAbsolute() ponyfill",
|
||||||
|
"devDependencies": {
|
||||||
|
"xo": "^0.16.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/sindresorhus/path-is-absolute#readme",
|
||||||
|
"keywords": [
|
||||||
|
"path",
|
||||||
|
"paths",
|
||||||
|
"file",
|
||||||
|
"dir",
|
||||||
|
"absolute",
|
||||||
|
"isabsolute",
|
||||||
|
"is-absolute",
|
||||||
|
"built-in",
|
||||||
|
"util",
|
||||||
|
"utils",
|
||||||
|
"core",
|
||||||
|
"ponyfill",
|
||||||
|
"polyfill",
|
||||||
|
"shim",
|
||||||
|
"is",
|
||||||
|
"detect",
|
||||||
|
"check"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"name": "path-is-absolute",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/sindresorhus/path-is-absolute.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "xo && node test.js"
|
||||||
|
},
|
||||||
|
"version": "1.0.1"
|
||||||
|
}
|
||||||
59
node_modules/path-is-absolute/readme.md
generated
vendored
Normal file
59
node_modules/path-is-absolute/readme.md
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
# path-is-absolute [](https://travis-ci.org/sindresorhus/path-is-absolute)
|
||||||
|
|
||||||
|
> Node.js 0.12 [`path.isAbsolute()`](http://nodejs.org/api/path.html#path_path_isabsolute_path) [ponyfill](https://ponyfill.com)
|
||||||
|
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm install --save path-is-absolute
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
const pathIsAbsolute = require('path-is-absolute');
|
||||||
|
|
||||||
|
// Running on Linux
|
||||||
|
pathIsAbsolute('/home/foo');
|
||||||
|
//=> true
|
||||||
|
pathIsAbsolute('C:/Users/foo');
|
||||||
|
//=> false
|
||||||
|
|
||||||
|
// Running on Windows
|
||||||
|
pathIsAbsolute('C:/Users/foo');
|
||||||
|
//=> true
|
||||||
|
pathIsAbsolute('/home/foo');
|
||||||
|
//=> false
|
||||||
|
|
||||||
|
// Running on any OS
|
||||||
|
pathIsAbsolute.posix('/home/foo');
|
||||||
|
//=> true
|
||||||
|
pathIsAbsolute.posix('C:/Users/foo');
|
||||||
|
//=> false
|
||||||
|
pathIsAbsolute.win32('C:/Users/foo');
|
||||||
|
//=> true
|
||||||
|
pathIsAbsolute.win32('/home/foo');
|
||||||
|
//=> false
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
See the [`path.isAbsolute()` docs](http://nodejs.org/api/path.html#path_path_isabsolute_path).
|
||||||
|
|
||||||
|
### pathIsAbsolute(path)
|
||||||
|
|
||||||
|
### pathIsAbsolute.posix(path)
|
||||||
|
|
||||||
|
POSIX specific version.
|
||||||
|
|
||||||
|
### pathIsAbsolute.win32(path)
|
||||||
|
|
||||||
|
Windows specific version.
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||||
1
node_modules/path/.npmignore
generated
vendored
Normal file
1
node_modules/path/.npmignore
generated
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
node_modules
|
||||||
18
node_modules/path/LICENSE
generated
vendored
Normal file
18
node_modules/path/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
||||||
|
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.
|
||||||
15
node_modules/path/README.md
generated
vendored
Normal file
15
node_modules/path/README.md
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# path
|
||||||
|
|
||||||
|
This is an exact copy of the NodeJS ’path’ module published to the NPM registry.
|
||||||
|
|
||||||
|
[Documentation](http://nodejs.org/docs/latest/api/path.html)
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ npm install --save path
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT
|
||||||
53
node_modules/path/package.json
generated
vendored
Normal file
53
node_modules/path/package.json
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
"_from": "path@^0.12.7",
|
||||||
|
"_id": "path@0.12.7",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha1-1NwqUGxM4hl+tIHr/NWzbAFAsQ8=",
|
||||||
|
"_location": "/path",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "path@^0.12.7",
|
||||||
|
"name": "path",
|
||||||
|
"escapedName": "path",
|
||||||
|
"rawSpec": "^0.12.7",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^0.12.7"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"#USER",
|
||||||
|
"/"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz",
|
||||||
|
"_shasum": "d4dc2a506c4ce2197eb481ebfcd5b36c0140b10f",
|
||||||
|
"_spec": "path@^0.12.7",
|
||||||
|
"_where": "/Users/Ibrahim/Desktop/test2",
|
||||||
|
"author": {
|
||||||
|
"name": "Joyent",
|
||||||
|
"url": "http://www.joyent.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/jinder/path/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {
|
||||||
|
"process": "^0.11.1",
|
||||||
|
"util": "^0.10.3"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Node.JS path module",
|
||||||
|
"homepage": "http://nodejs.org/docs/latest/api/path.html",
|
||||||
|
"keywords": [
|
||||||
|
"ender",
|
||||||
|
"path"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "./path.js",
|
||||||
|
"name": "path",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/jinder/path.git"
|
||||||
|
},
|
||||||
|
"version": "0.12.7"
|
||||||
|
}
|
||||||
628
node_modules/path/path.js
generated
vendored
Normal file
628
node_modules/path/path.js
generated
vendored
Normal file
@@ -0,0 +1,628 @@
|
|||||||
|
// Copyright Joyent, Inc. and other Node contributors.
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
|
||||||
|
var isWindows = process.platform === 'win32';
|
||||||
|
var util = require('util');
|
||||||
|
|
||||||
|
|
||||||
|
// resolves . and .. elements in a path array with directory names there
|
||||||
|
// must be no slashes or device names (c:\) in the array
|
||||||
|
// (so also no leading and trailing slashes - it does not distinguish
|
||||||
|
// relative and absolute paths)
|
||||||
|
function normalizeArray(parts, allowAboveRoot) {
|
||||||
|
var res = [];
|
||||||
|
for (var i = 0; i < parts.length; i++) {
|
||||||
|
var p = parts[i];
|
||||||
|
|
||||||
|
// ignore empty parts
|
||||||
|
if (!p || p === '.')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (p === '..') {
|
||||||
|
if (res.length && res[res.length - 1] !== '..') {
|
||||||
|
res.pop();
|
||||||
|
} else if (allowAboveRoot) {
|
||||||
|
res.push('..');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
res.push(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
// returns an array with empty elements removed from either end of the input
|
||||||
|
// array or the original array if no elements need to be removed
|
||||||
|
function trimArray(arr) {
|
||||||
|
var lastIndex = arr.length - 1;
|
||||||
|
var start = 0;
|
||||||
|
for (; start <= lastIndex; start++) {
|
||||||
|
if (arr[start])
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
var end = lastIndex;
|
||||||
|
for (; end >= 0; end--) {
|
||||||
|
if (arr[end])
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (start === 0 && end === lastIndex)
|
||||||
|
return arr;
|
||||||
|
if (start > end)
|
||||||
|
return [];
|
||||||
|
return arr.slice(start, end + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Regex to split a windows path into three parts: [*, device, slash,
|
||||||
|
// tail] windows-only
|
||||||
|
var splitDeviceRe =
|
||||||
|
/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
|
||||||
|
|
||||||
|
// Regex to split the tail part of the above into [*, dir, basename, ext]
|
||||||
|
var splitTailRe =
|
||||||
|
/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/;
|
||||||
|
|
||||||
|
var win32 = {};
|
||||||
|
|
||||||
|
// Function to split a filename into [root, dir, basename, ext]
|
||||||
|
function win32SplitPath(filename) {
|
||||||
|
// Separate device+slash from tail
|
||||||
|
var result = splitDeviceRe.exec(filename),
|
||||||
|
device = (result[1] || '') + (result[2] || ''),
|
||||||
|
tail = result[3] || '';
|
||||||
|
// Split the tail into dir, basename and extension
|
||||||
|
var result2 = splitTailRe.exec(tail),
|
||||||
|
dir = result2[1],
|
||||||
|
basename = result2[2],
|
||||||
|
ext = result2[3];
|
||||||
|
return [device, dir, basename, ext];
|
||||||
|
}
|
||||||
|
|
||||||
|
function win32StatPath(path) {
|
||||||
|
var result = splitDeviceRe.exec(path),
|
||||||
|
device = result[1] || '',
|
||||||
|
isUnc = !!device && device[1] !== ':';
|
||||||
|
return {
|
||||||
|
device: device,
|
||||||
|
isUnc: isUnc,
|
||||||
|
isAbsolute: isUnc || !!result[2], // UNC paths are always absolute
|
||||||
|
tail: result[3]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeUNCRoot(device) {
|
||||||
|
return '\\\\' + device.replace(/^[\\\/]+/, '').replace(/[\\\/]+/g, '\\');
|
||||||
|
}
|
||||||
|
|
||||||
|
// path.resolve([from ...], to)
|
||||||
|
win32.resolve = function() {
|
||||||
|
var resolvedDevice = '',
|
||||||
|
resolvedTail = '',
|
||||||
|
resolvedAbsolute = false;
|
||||||
|
|
||||||
|
for (var i = arguments.length - 1; i >= -1; i--) {
|
||||||
|
var path;
|
||||||
|
if (i >= 0) {
|
||||||
|
path = arguments[i];
|
||||||
|
} else if (!resolvedDevice) {
|
||||||
|
path = process.cwd();
|
||||||
|
} else {
|
||||||
|
// Windows has the concept of drive-specific current working
|
||||||
|
// directories. If we've resolved a drive letter but not yet an
|
||||||
|
// absolute path, get cwd for that drive. We're sure the device is not
|
||||||
|
// an unc path at this points, because unc paths are always absolute.
|
||||||
|
path = process.env['=' + resolvedDevice];
|
||||||
|
// Verify that a drive-local cwd was found and that it actually points
|
||||||
|
// to our drive. If not, default to the drive's root.
|
||||||
|
if (!path || path.substr(0, 3).toLowerCase() !==
|
||||||
|
resolvedDevice.toLowerCase() + '\\') {
|
||||||
|
path = resolvedDevice + '\\';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Skip empty and invalid entries
|
||||||
|
if (!util.isString(path)) {
|
||||||
|
throw new TypeError('Arguments to path.resolve must be strings');
|
||||||
|
} else if (!path) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = win32StatPath(path),
|
||||||
|
device = result.device,
|
||||||
|
isUnc = result.isUnc,
|
||||||
|
isAbsolute = result.isAbsolute,
|
||||||
|
tail = result.tail;
|
||||||
|
|
||||||
|
if (device &&
|
||||||
|
resolvedDevice &&
|
||||||
|
device.toLowerCase() !== resolvedDevice.toLowerCase()) {
|
||||||
|
// This path points to another device so it is not applicable
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!resolvedDevice) {
|
||||||
|
resolvedDevice = device;
|
||||||
|
}
|
||||||
|
if (!resolvedAbsolute) {
|
||||||
|
resolvedTail = tail + '\\' + resolvedTail;
|
||||||
|
resolvedAbsolute = isAbsolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resolvedDevice && resolvedAbsolute) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert slashes to backslashes when `resolvedDevice` points to an UNC
|
||||||
|
// root. Also squash multiple slashes into a single one where appropriate.
|
||||||
|
if (isUnc) {
|
||||||
|
resolvedDevice = normalizeUNCRoot(resolvedDevice);
|
||||||
|
}
|
||||||
|
|
||||||
|
// At this point the path should be resolved to a full absolute path,
|
||||||
|
// but handle relative paths to be safe (might happen when process.cwd()
|
||||||
|
// fails)
|
||||||
|
|
||||||
|
// Normalize the tail path
|
||||||
|
resolvedTail = normalizeArray(resolvedTail.split(/[\\\/]+/),
|
||||||
|
!resolvedAbsolute).join('\\');
|
||||||
|
|
||||||
|
return (resolvedDevice + (resolvedAbsolute ? '\\' : '') + resolvedTail) ||
|
||||||
|
'.';
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
win32.normalize = function(path) {
|
||||||
|
var result = win32StatPath(path),
|
||||||
|
device = result.device,
|
||||||
|
isUnc = result.isUnc,
|
||||||
|
isAbsolute = result.isAbsolute,
|
||||||
|
tail = result.tail,
|
||||||
|
trailingSlash = /[\\\/]$/.test(tail);
|
||||||
|
|
||||||
|
// Normalize the tail path
|
||||||
|
tail = normalizeArray(tail.split(/[\\\/]+/), !isAbsolute).join('\\');
|
||||||
|
|
||||||
|
if (!tail && !isAbsolute) {
|
||||||
|
tail = '.';
|
||||||
|
}
|
||||||
|
if (tail && trailingSlash) {
|
||||||
|
tail += '\\';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert slashes to backslashes when `device` points to an UNC root.
|
||||||
|
// Also squash multiple slashes into a single one where appropriate.
|
||||||
|
if (isUnc) {
|
||||||
|
device = normalizeUNCRoot(device);
|
||||||
|
}
|
||||||
|
|
||||||
|
return device + (isAbsolute ? '\\' : '') + tail;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
win32.isAbsolute = function(path) {
|
||||||
|
return win32StatPath(path).isAbsolute;
|
||||||
|
};
|
||||||
|
|
||||||
|
win32.join = function() {
|
||||||
|
var paths = [];
|
||||||
|
for (var i = 0; i < arguments.length; i++) {
|
||||||
|
var arg = arguments[i];
|
||||||
|
if (!util.isString(arg)) {
|
||||||
|
throw new TypeError('Arguments to path.join must be strings');
|
||||||
|
}
|
||||||
|
if (arg) {
|
||||||
|
paths.push(arg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var joined = paths.join('\\');
|
||||||
|
|
||||||
|
// Make sure that the joined path doesn't start with two slashes, because
|
||||||
|
// normalize() will mistake it for an UNC path then.
|
||||||
|
//
|
||||||
|
// This step is skipped when it is very clear that the user actually
|
||||||
|
// intended to point at an UNC path. This is assumed when the first
|
||||||
|
// non-empty string arguments starts with exactly two slashes followed by
|
||||||
|
// at least one more non-slash character.
|
||||||
|
//
|
||||||
|
// Note that for normalize() to treat a path as an UNC path it needs to
|
||||||
|
// have at least 2 components, so we don't filter for that here.
|
||||||
|
// This means that the user can use join to construct UNC paths from
|
||||||
|
// a server name and a share name; for example:
|
||||||
|
// path.join('//server', 'share') -> '\\\\server\\share\')
|
||||||
|
if (!/^[\\\/]{2}[^\\\/]/.test(paths[0])) {
|
||||||
|
joined = joined.replace(/^[\\\/]{2,}/, '\\');
|
||||||
|
}
|
||||||
|
|
||||||
|
return win32.normalize(joined);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// path.relative(from, to)
|
||||||
|
// it will solve the relative path from 'from' to 'to', for instance:
|
||||||
|
// from = 'C:\\orandea\\test\\aaa'
|
||||||
|
// to = 'C:\\orandea\\impl\\bbb'
|
||||||
|
// The output of the function should be: '..\\..\\impl\\bbb'
|
||||||
|
win32.relative = function(from, to) {
|
||||||
|
from = win32.resolve(from);
|
||||||
|
to = win32.resolve(to);
|
||||||
|
|
||||||
|
// windows is not case sensitive
|
||||||
|
var lowerFrom = from.toLowerCase();
|
||||||
|
var lowerTo = to.toLowerCase();
|
||||||
|
|
||||||
|
var toParts = trimArray(to.split('\\'));
|
||||||
|
|
||||||
|
var lowerFromParts = trimArray(lowerFrom.split('\\'));
|
||||||
|
var lowerToParts = trimArray(lowerTo.split('\\'));
|
||||||
|
|
||||||
|
var length = Math.min(lowerFromParts.length, lowerToParts.length);
|
||||||
|
var samePartsLength = length;
|
||||||
|
for (var i = 0; i < length; i++) {
|
||||||
|
if (lowerFromParts[i] !== lowerToParts[i]) {
|
||||||
|
samePartsLength = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (samePartsLength == 0) {
|
||||||
|
return to;
|
||||||
|
}
|
||||||
|
|
||||||
|
var outputParts = [];
|
||||||
|
for (var i = samePartsLength; i < lowerFromParts.length; i++) {
|
||||||
|
outputParts.push('..');
|
||||||
|
}
|
||||||
|
|
||||||
|
outputParts = outputParts.concat(toParts.slice(samePartsLength));
|
||||||
|
|
||||||
|
return outputParts.join('\\');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
win32._makeLong = function(path) {
|
||||||
|
// Note: this will *probably* throw somewhere.
|
||||||
|
if (!util.isString(path))
|
||||||
|
return path;
|
||||||
|
|
||||||
|
if (!path) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
var resolvedPath = win32.resolve(path);
|
||||||
|
|
||||||
|
if (/^[a-zA-Z]\:\\/.test(resolvedPath)) {
|
||||||
|
// path is local filesystem path, which needs to be converted
|
||||||
|
// to long UNC path.
|
||||||
|
return '\\\\?\\' + resolvedPath;
|
||||||
|
} else if (/^\\\\[^?.]/.test(resolvedPath)) {
|
||||||
|
// path is network UNC path, which needs to be converted
|
||||||
|
// to long UNC path.
|
||||||
|
return '\\\\?\\UNC\\' + resolvedPath.substring(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
win32.dirname = function(path) {
|
||||||
|
var result = win32SplitPath(path),
|
||||||
|
root = result[0],
|
||||||
|
dir = result[1];
|
||||||
|
|
||||||
|
if (!root && !dir) {
|
||||||
|
// No dirname whatsoever
|
||||||
|
return '.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dir) {
|
||||||
|
// It has a dirname, strip trailing slash
|
||||||
|
dir = dir.substr(0, dir.length - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return root + dir;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
win32.basename = function(path, ext) {
|
||||||
|
var f = win32SplitPath(path)[2];
|
||||||
|
// TODO: make this comparison case-insensitive on windows?
|
||||||
|
if (ext && f.substr(-1 * ext.length) === ext) {
|
||||||
|
f = f.substr(0, f.length - ext.length);
|
||||||
|
}
|
||||||
|
return f;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
win32.extname = function(path) {
|
||||||
|
return win32SplitPath(path)[3];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
win32.format = function(pathObject) {
|
||||||
|
if (!util.isObject(pathObject)) {
|
||||||
|
throw new TypeError(
|
||||||
|
"Parameter 'pathObject' must be an object, not " + typeof pathObject
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
var root = pathObject.root || '';
|
||||||
|
|
||||||
|
if (!util.isString(root)) {
|
||||||
|
throw new TypeError(
|
||||||
|
"'pathObject.root' must be a string or undefined, not " +
|
||||||
|
typeof pathObject.root
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
var dir = pathObject.dir;
|
||||||
|
var base = pathObject.base || '';
|
||||||
|
if (!dir) {
|
||||||
|
return base;
|
||||||
|
}
|
||||||
|
if (dir[dir.length - 1] === win32.sep) {
|
||||||
|
return dir + base;
|
||||||
|
}
|
||||||
|
return dir + win32.sep + base;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
win32.parse = function(pathString) {
|
||||||
|
if (!util.isString(pathString)) {
|
||||||
|
throw new TypeError(
|
||||||
|
"Parameter 'pathString' must be a string, not " + typeof pathString
|
||||||
|
);
|
||||||
|
}
|
||||||
|
var allParts = win32SplitPath(pathString);
|
||||||
|
if (!allParts || allParts.length !== 4) {
|
||||||
|
throw new TypeError("Invalid path '" + pathString + "'");
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
root: allParts[0],
|
||||||
|
dir: allParts[0] + allParts[1].slice(0, -1),
|
||||||
|
base: allParts[2],
|
||||||
|
ext: allParts[3],
|
||||||
|
name: allParts[2].slice(0, allParts[2].length - allParts[3].length)
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
win32.sep = '\\';
|
||||||
|
win32.delimiter = ';';
|
||||||
|
|
||||||
|
|
||||||
|
// Split a filename into [root, dir, basename, ext], unix version
|
||||||
|
// 'root' is just a slash, or nothing.
|
||||||
|
var splitPathRe =
|
||||||
|
/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
|
||||||
|
var posix = {};
|
||||||
|
|
||||||
|
|
||||||
|
function posixSplitPath(filename) {
|
||||||
|
return splitPathRe.exec(filename).slice(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// path.resolve([from ...], to)
|
||||||
|
// posix version
|
||||||
|
posix.resolve = function() {
|
||||||
|
var resolvedPath = '',
|
||||||
|
resolvedAbsolute = false;
|
||||||
|
|
||||||
|
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
||||||
|
var path = (i >= 0) ? arguments[i] : process.cwd();
|
||||||
|
|
||||||
|
// Skip empty and invalid entries
|
||||||
|
if (!util.isString(path)) {
|
||||||
|
throw new TypeError('Arguments to path.resolve must be strings');
|
||||||
|
} else if (!path) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
resolvedPath = path + '/' + resolvedPath;
|
||||||
|
resolvedAbsolute = path[0] === '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
// At this point the path should be resolved to a full absolute path, but
|
||||||
|
// handle relative paths to be safe (might happen when process.cwd() fails)
|
||||||
|
|
||||||
|
// Normalize the path
|
||||||
|
resolvedPath = normalizeArray(resolvedPath.split('/'),
|
||||||
|
!resolvedAbsolute).join('/');
|
||||||
|
|
||||||
|
return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
|
||||||
|
};
|
||||||
|
|
||||||
|
// path.normalize(path)
|
||||||
|
// posix version
|
||||||
|
posix.normalize = function(path) {
|
||||||
|
var isAbsolute = posix.isAbsolute(path),
|
||||||
|
trailingSlash = path && path[path.length - 1] === '/';
|
||||||
|
|
||||||
|
// Normalize the path
|
||||||
|
path = normalizeArray(path.split('/'), !isAbsolute).join('/');
|
||||||
|
|
||||||
|
if (!path && !isAbsolute) {
|
||||||
|
path = '.';
|
||||||
|
}
|
||||||
|
if (path && trailingSlash) {
|
||||||
|
path += '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
return (isAbsolute ? '/' : '') + path;
|
||||||
|
};
|
||||||
|
|
||||||
|
// posix version
|
||||||
|
posix.isAbsolute = function(path) {
|
||||||
|
return path.charAt(0) === '/';
|
||||||
|
};
|
||||||
|
|
||||||
|
// posix version
|
||||||
|
posix.join = function() {
|
||||||
|
var path = '';
|
||||||
|
for (var i = 0; i < arguments.length; i++) {
|
||||||
|
var segment = arguments[i];
|
||||||
|
if (!util.isString(segment)) {
|
||||||
|
throw new TypeError('Arguments to path.join must be strings');
|
||||||
|
}
|
||||||
|
if (segment) {
|
||||||
|
if (!path) {
|
||||||
|
path += segment;
|
||||||
|
} else {
|
||||||
|
path += '/' + segment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return posix.normalize(path);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// path.relative(from, to)
|
||||||
|
// posix version
|
||||||
|
posix.relative = function(from, to) {
|
||||||
|
from = posix.resolve(from).substr(1);
|
||||||
|
to = posix.resolve(to).substr(1);
|
||||||
|
|
||||||
|
var fromParts = trimArray(from.split('/'));
|
||||||
|
var toParts = trimArray(to.split('/'));
|
||||||
|
|
||||||
|
var length = Math.min(fromParts.length, toParts.length);
|
||||||
|
var samePartsLength = length;
|
||||||
|
for (var i = 0; i < length; i++) {
|
||||||
|
if (fromParts[i] !== toParts[i]) {
|
||||||
|
samePartsLength = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var outputParts = [];
|
||||||
|
for (var i = samePartsLength; i < fromParts.length; i++) {
|
||||||
|
outputParts.push('..');
|
||||||
|
}
|
||||||
|
|
||||||
|
outputParts = outputParts.concat(toParts.slice(samePartsLength));
|
||||||
|
|
||||||
|
return outputParts.join('/');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
posix._makeLong = function(path) {
|
||||||
|
return path;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
posix.dirname = function(path) {
|
||||||
|
var result = posixSplitPath(path),
|
||||||
|
root = result[0],
|
||||||
|
dir = result[1];
|
||||||
|
|
||||||
|
if (!root && !dir) {
|
||||||
|
// No dirname whatsoever
|
||||||
|
return '.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dir) {
|
||||||
|
// It has a dirname, strip trailing slash
|
||||||
|
dir = dir.substr(0, dir.length - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return root + dir;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
posix.basename = function(path, ext) {
|
||||||
|
var f = posixSplitPath(path)[2];
|
||||||
|
// TODO: make this comparison case-insensitive on windows?
|
||||||
|
if (ext && f.substr(-1 * ext.length) === ext) {
|
||||||
|
f = f.substr(0, f.length - ext.length);
|
||||||
|
}
|
||||||
|
return f;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
posix.extname = function(path) {
|
||||||
|
return posixSplitPath(path)[3];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
posix.format = function(pathObject) {
|
||||||
|
if (!util.isObject(pathObject)) {
|
||||||
|
throw new TypeError(
|
||||||
|
"Parameter 'pathObject' must be an object, not " + typeof pathObject
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
var root = pathObject.root || '';
|
||||||
|
|
||||||
|
if (!util.isString(root)) {
|
||||||
|
throw new TypeError(
|
||||||
|
"'pathObject.root' must be a string or undefined, not " +
|
||||||
|
typeof pathObject.root
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
var dir = pathObject.dir ? pathObject.dir + posix.sep : '';
|
||||||
|
var base = pathObject.base || '';
|
||||||
|
return dir + base;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
posix.parse = function(pathString) {
|
||||||
|
if (!util.isString(pathString)) {
|
||||||
|
throw new TypeError(
|
||||||
|
"Parameter 'pathString' must be a string, not " + typeof pathString
|
||||||
|
);
|
||||||
|
}
|
||||||
|
var allParts = posixSplitPath(pathString);
|
||||||
|
if (!allParts || allParts.length !== 4) {
|
||||||
|
throw new TypeError("Invalid path '" + pathString + "'");
|
||||||
|
}
|
||||||
|
allParts[1] = allParts[1] || '';
|
||||||
|
allParts[2] = allParts[2] || '';
|
||||||
|
allParts[3] = allParts[3] || '';
|
||||||
|
|
||||||
|
return {
|
||||||
|
root: allParts[0],
|
||||||
|
dir: allParts[0] + allParts[1].slice(0, -1),
|
||||||
|
base: allParts[2],
|
||||||
|
ext: allParts[3],
|
||||||
|
name: allParts[2].slice(0, allParts[2].length - allParts[3].length)
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
posix.sep = '/';
|
||||||
|
posix.delimiter = ':';
|
||||||
|
|
||||||
|
|
||||||
|
if (isWindows)
|
||||||
|
module.exports = win32;
|
||||||
|
else /* posix */
|
||||||
|
module.exports = posix;
|
||||||
|
|
||||||
|
module.exports.posix = posix;
|
||||||
|
module.exports.win32 = win32;
|
||||||
21
node_modules/process/.eslintrc
generated
vendored
Normal file
21
node_modules/process/.eslintrc
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
extends: "eslint:recommended",
|
||||||
|
"env": {
|
||||||
|
"node": true,
|
||||||
|
"browser": true,
|
||||||
|
"es6" : true,
|
||||||
|
"mocha": true
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"indent": [2, 4],
|
||||||
|
"brace-style": [2, "1tbs"],
|
||||||
|
"quotes": [2, "single"],
|
||||||
|
"no-console": 0,
|
||||||
|
"no-shadow": 0,
|
||||||
|
"no-use-before-define": [2, "nofunc"],
|
||||||
|
"no-underscore-dangle": 0,
|
||||||
|
"no-constant-condition": 0,
|
||||||
|
"space-after-function-name": 0,
|
||||||
|
"consistent-return": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
22
node_modules/process/LICENSE
generated
vendored
Normal file
22
node_modules/process/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2013 Roman Shtylman <shtylman@gmail.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.
|
||||||
26
node_modules/process/README.md
generated
vendored
Normal file
26
node_modules/process/README.md
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# process
|
||||||
|
|
||||||
|
```require('process');``` just like any other module.
|
||||||
|
|
||||||
|
Works in node.js and browsers via the browser.js shim provided with the module.
|
||||||
|
|
||||||
|
## browser implementation
|
||||||
|
|
||||||
|
The goal of this module is not to be a full-fledged alternative to the builtin process module. This module mostly exists to provide the nextTick functionality and little more. We keep this module lean because it will often be included by default by tools like browserify when it detects a module has used the `process` global.
|
||||||
|
|
||||||
|
It also exposes a "browser" member (i.e. `process.browser`) which is `true` in this implementation but `undefined` in node. This can be used in isomorphic code that adjusts it's behavior depending on which environment it's running in.
|
||||||
|
|
||||||
|
If you are looking to provide other process methods, I suggest you monkey patch them onto the process global in your app. A list of user created patches is below.
|
||||||
|
|
||||||
|
* [hrtime](https://github.com/kumavis/browser-process-hrtime)
|
||||||
|
* [stdout](https://github.com/kumavis/browser-stdout)
|
||||||
|
|
||||||
|
## package manager notes
|
||||||
|
|
||||||
|
If you are writing a bundler to package modules for client side use, make sure you use the ```browser``` field hint in package.json.
|
||||||
|
|
||||||
|
See https://gist.github.com/4339901 for details.
|
||||||
|
|
||||||
|
The [browserify](https://github.com/substack/node-browserify) module will properly handle this field when bundling your files.
|
||||||
|
|
||||||
|
|
||||||
184
node_modules/process/browser.js
generated
vendored
Normal file
184
node_modules/process/browser.js
generated
vendored
Normal file
@@ -0,0 +1,184 @@
|
|||||||
|
// shim for using process in browser
|
||||||
|
var process = module.exports = {};
|
||||||
|
|
||||||
|
// cached from whatever global is present so that test runners that stub it
|
||||||
|
// don't break things. But we need to wrap it in a try catch in case it is
|
||||||
|
// wrapped in strict mode code which doesn't define any globals. It's inside a
|
||||||
|
// function because try/catches deoptimize in certain engines.
|
||||||
|
|
||||||
|
var cachedSetTimeout;
|
||||||
|
var cachedClearTimeout;
|
||||||
|
|
||||||
|
function defaultSetTimout() {
|
||||||
|
throw new Error('setTimeout has not been defined');
|
||||||
|
}
|
||||||
|
function defaultClearTimeout () {
|
||||||
|
throw new Error('clearTimeout has not been defined');
|
||||||
|
}
|
||||||
|
(function () {
|
||||||
|
try {
|
||||||
|
if (typeof setTimeout === 'function') {
|
||||||
|
cachedSetTimeout = setTimeout;
|
||||||
|
} else {
|
||||||
|
cachedSetTimeout = defaultSetTimout;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
cachedSetTimeout = defaultSetTimout;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (typeof clearTimeout === 'function') {
|
||||||
|
cachedClearTimeout = clearTimeout;
|
||||||
|
} else {
|
||||||
|
cachedClearTimeout = defaultClearTimeout;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
cachedClearTimeout = defaultClearTimeout;
|
||||||
|
}
|
||||||
|
} ())
|
||||||
|
function runTimeout(fun) {
|
||||||
|
if (cachedSetTimeout === setTimeout) {
|
||||||
|
//normal enviroments in sane situations
|
||||||
|
return setTimeout(fun, 0);
|
||||||
|
}
|
||||||
|
// if setTimeout wasn't available but was latter defined
|
||||||
|
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
||||||
|
cachedSetTimeout = setTimeout;
|
||||||
|
return setTimeout(fun, 0);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
// when when somebody has screwed with setTimeout but no I.E. maddness
|
||||||
|
return cachedSetTimeout(fun, 0);
|
||||||
|
} catch(e){
|
||||||
|
try {
|
||||||
|
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
||||||
|
return cachedSetTimeout.call(null, fun, 0);
|
||||||
|
} catch(e){
|
||||||
|
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
||||||
|
return cachedSetTimeout.call(this, fun, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
function runClearTimeout(marker) {
|
||||||
|
if (cachedClearTimeout === clearTimeout) {
|
||||||
|
//normal enviroments in sane situations
|
||||||
|
return clearTimeout(marker);
|
||||||
|
}
|
||||||
|
// if clearTimeout wasn't available but was latter defined
|
||||||
|
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
||||||
|
cachedClearTimeout = clearTimeout;
|
||||||
|
return clearTimeout(marker);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
// when when somebody has screwed with setTimeout but no I.E. maddness
|
||||||
|
return cachedClearTimeout(marker);
|
||||||
|
} catch (e){
|
||||||
|
try {
|
||||||
|
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
||||||
|
return cachedClearTimeout.call(null, marker);
|
||||||
|
} catch (e){
|
||||||
|
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
||||||
|
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
||||||
|
return cachedClearTimeout.call(this, marker);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
var queue = [];
|
||||||
|
var draining = false;
|
||||||
|
var currentQueue;
|
||||||
|
var queueIndex = -1;
|
||||||
|
|
||||||
|
function cleanUpNextTick() {
|
||||||
|
if (!draining || !currentQueue) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
draining = false;
|
||||||
|
if (currentQueue.length) {
|
||||||
|
queue = currentQueue.concat(queue);
|
||||||
|
} else {
|
||||||
|
queueIndex = -1;
|
||||||
|
}
|
||||||
|
if (queue.length) {
|
||||||
|
drainQueue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function drainQueue() {
|
||||||
|
if (draining) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var timeout = runTimeout(cleanUpNextTick);
|
||||||
|
draining = true;
|
||||||
|
|
||||||
|
var len = queue.length;
|
||||||
|
while(len) {
|
||||||
|
currentQueue = queue;
|
||||||
|
queue = [];
|
||||||
|
while (++queueIndex < len) {
|
||||||
|
if (currentQueue) {
|
||||||
|
currentQueue[queueIndex].run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
queueIndex = -1;
|
||||||
|
len = queue.length;
|
||||||
|
}
|
||||||
|
currentQueue = null;
|
||||||
|
draining = false;
|
||||||
|
runClearTimeout(timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
process.nextTick = function (fun) {
|
||||||
|
var args = new Array(arguments.length - 1);
|
||||||
|
if (arguments.length > 1) {
|
||||||
|
for (var i = 1; i < arguments.length; i++) {
|
||||||
|
args[i - 1] = arguments[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
queue.push(new Item(fun, args));
|
||||||
|
if (queue.length === 1 && !draining) {
|
||||||
|
runTimeout(drainQueue);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// v8 likes predictible objects
|
||||||
|
function Item(fun, array) {
|
||||||
|
this.fun = fun;
|
||||||
|
this.array = array;
|
||||||
|
}
|
||||||
|
Item.prototype.run = function () {
|
||||||
|
this.fun.apply(null, this.array);
|
||||||
|
};
|
||||||
|
process.title = 'browser';
|
||||||
|
process.browser = true;
|
||||||
|
process.env = {};
|
||||||
|
process.argv = [];
|
||||||
|
process.version = ''; // empty string to avoid regexp issues
|
||||||
|
process.versions = {};
|
||||||
|
|
||||||
|
function noop() {}
|
||||||
|
|
||||||
|
process.on = noop;
|
||||||
|
process.addListener = noop;
|
||||||
|
process.once = noop;
|
||||||
|
process.off = noop;
|
||||||
|
process.removeListener = noop;
|
||||||
|
process.removeAllListeners = noop;
|
||||||
|
process.emit = noop;
|
||||||
|
process.prependListener = noop;
|
||||||
|
process.prependOnceListener = noop;
|
||||||
|
|
||||||
|
process.listeners = function (name) { return [] }
|
||||||
|
|
||||||
|
process.binding = function (name) {
|
||||||
|
throw new Error('process.binding is not supported');
|
||||||
|
};
|
||||||
|
|
||||||
|
process.cwd = function () { return '/' };
|
||||||
|
process.chdir = function (dir) {
|
||||||
|
throw new Error('process.chdir is not supported');
|
||||||
|
};
|
||||||
|
process.umask = function() { return 0; };
|
||||||
2
node_modules/process/index.js
generated
vendored
Normal file
2
node_modules/process/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
// for now just expose the builtin process global from node.js
|
||||||
|
module.exports = global.process;
|
||||||
59
node_modules/process/package.json
generated
vendored
Normal file
59
node_modules/process/package.json
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
"_from": "process@^0.11.1",
|
||||||
|
"_id": "process@0.11.10",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=",
|
||||||
|
"_location": "/process",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "process@^0.11.1",
|
||||||
|
"name": "process",
|
||||||
|
"escapedName": "process",
|
||||||
|
"rawSpec": "^0.11.1",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^0.11.1"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/path"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
|
||||||
|
"_shasum": "7332300e840161bda3e69a1d1d91a7d4bc16f182",
|
||||||
|
"_spec": "process@^0.11.1",
|
||||||
|
"_where": "/Users/Ibrahim/Desktop/test2/node_modules/path",
|
||||||
|
"author": {
|
||||||
|
"name": "Roman Shtylman",
|
||||||
|
"email": "shtylman@gmail.com"
|
||||||
|
},
|
||||||
|
"browser": "./browser.js",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/shtylman/node-process/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "process information for node.js and browsers",
|
||||||
|
"devDependencies": {
|
||||||
|
"mocha": "2.2.1",
|
||||||
|
"zuul": "^3.10.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6.0"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/shtylman/node-process#readme",
|
||||||
|
"keywords": [
|
||||||
|
"process"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "./index.js",
|
||||||
|
"name": "process",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/shtylman/node-process.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"browser": "zuul --no-coverage --ui mocha-bdd --local 8080 -- test.js",
|
||||||
|
"test": "mocha test.js"
|
||||||
|
},
|
||||||
|
"version": "0.11.10"
|
||||||
|
}
|
||||||
199
node_modules/process/test.js
generated
vendored
Normal file
199
node_modules/process/test.js
generated
vendored
Normal file
@@ -0,0 +1,199 @@
|
|||||||
|
var assert = require('assert');
|
||||||
|
var ourProcess = require('./browser');
|
||||||
|
describe('test against our process', function () {
|
||||||
|
test(ourProcess);
|
||||||
|
});
|
||||||
|
if (!process.browser) {
|
||||||
|
describe('test against node', function () {
|
||||||
|
test(process);
|
||||||
|
});
|
||||||
|
vmtest();
|
||||||
|
}
|
||||||
|
function test (ourProcess) {
|
||||||
|
describe('test arguments', function () {
|
||||||
|
it ('works', function (done) {
|
||||||
|
var order = 0;
|
||||||
|
|
||||||
|
|
||||||
|
ourProcess.nextTick(function (num) {
|
||||||
|
assert.equal(num, order++, 'first one works');
|
||||||
|
ourProcess.nextTick(function (num) {
|
||||||
|
assert.equal(num, order++, 'recursive one is 4th');
|
||||||
|
}, 3);
|
||||||
|
}, 0);
|
||||||
|
ourProcess.nextTick(function (num) {
|
||||||
|
assert.equal(num, order++, 'second one starts');
|
||||||
|
ourProcess.nextTick(function (num) {
|
||||||
|
assert.equal(num, order++, 'this is third');
|
||||||
|
ourProcess.nextTick(function (num) {
|
||||||
|
assert.equal(num, order++, 'this is last');
|
||||||
|
done();
|
||||||
|
}, 5);
|
||||||
|
}, 4);
|
||||||
|
}, 1);
|
||||||
|
ourProcess.nextTick(function (num) {
|
||||||
|
|
||||||
|
assert.equal(num, order++, '3rd schedualed happens after the error');
|
||||||
|
}, 2);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
if (!process.browser) {
|
||||||
|
describe('test errors', function (t) {
|
||||||
|
it ('works', function (done) {
|
||||||
|
var order = 0;
|
||||||
|
process.removeAllListeners('uncaughtException');
|
||||||
|
process.once('uncaughtException', function(err) {
|
||||||
|
assert.equal(2, order++, 'error is third');
|
||||||
|
ourProcess.nextTick(function () {
|
||||||
|
assert.equal(5, order++, 'schedualed in error is last');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
ourProcess.nextTick(function () {
|
||||||
|
assert.equal(0, order++, 'first one works');
|
||||||
|
ourProcess.nextTick(function () {
|
||||||
|
assert.equal(4, order++, 'recursive one is 4th');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
ourProcess.nextTick(function () {
|
||||||
|
assert.equal(1, order++, 'second one starts');
|
||||||
|
throw(new Error('an error is thrown'));
|
||||||
|
});
|
||||||
|
ourProcess.nextTick(function () {
|
||||||
|
assert.equal(3, order++, '3rd schedualed happens after the error');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
describe('rename globals', function (t) {
|
||||||
|
var oldTimeout = setTimeout;
|
||||||
|
var oldClear = clearTimeout;
|
||||||
|
|
||||||
|
it('clearTimeout', function (done){
|
||||||
|
|
||||||
|
var ok = true;
|
||||||
|
clearTimeout = function () {
|
||||||
|
ok = false;
|
||||||
|
}
|
||||||
|
var ran = false;
|
||||||
|
function cleanup() {
|
||||||
|
clearTimeout = oldClear;
|
||||||
|
var err;
|
||||||
|
try {
|
||||||
|
assert.ok(ok, 'fake clearTimeout ran');
|
||||||
|
assert.ok(ran, 'should have run');
|
||||||
|
} catch (e) {
|
||||||
|
err = e;
|
||||||
|
}
|
||||||
|
done(err);
|
||||||
|
}
|
||||||
|
setTimeout(cleanup, 1000);
|
||||||
|
ourProcess.nextTick(function () {
|
||||||
|
ran = true;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('just setTimeout', function (done){
|
||||||
|
|
||||||
|
|
||||||
|
setTimeout = function () {
|
||||||
|
setTimeout = oldTimeout;
|
||||||
|
try {
|
||||||
|
assert.ok(false, 'fake setTimeout called')
|
||||||
|
} catch (e) {
|
||||||
|
done(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ourProcess.nextTick(function () {
|
||||||
|
setTimeout = oldTimeout;
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function vmtest() {
|
||||||
|
var vm = require('vm');
|
||||||
|
var fs = require('fs');
|
||||||
|
var process = fs.readFileSync('./browser.js', {encoding: 'utf8'});
|
||||||
|
|
||||||
|
|
||||||
|
describe('should work in vm in strict mode with no globals', function () {
|
||||||
|
it('should parse', function (done) {
|
||||||
|
var str = '"use strict";var module = {exports:{}};';
|
||||||
|
str += process;
|
||||||
|
str += 'this.works = process.browser;';
|
||||||
|
var script = new vm.Script(str);
|
||||||
|
var context = {
|
||||||
|
works: false
|
||||||
|
};
|
||||||
|
script.runInNewContext(context);
|
||||||
|
assert.ok(context.works);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
it('setTimeout throws error', function (done) {
|
||||||
|
var str = '"use strict";var module = {exports:{}};';
|
||||||
|
str += process;
|
||||||
|
str += 'try {process.nextTick(function () {})} catch (e){this.works = e;}';
|
||||||
|
var script = new vm.Script(str);
|
||||||
|
var context = {
|
||||||
|
works: false
|
||||||
|
};
|
||||||
|
script.runInNewContext(context);
|
||||||
|
assert.ok(context.works);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
it('should generally work', function (done) {
|
||||||
|
var str = '"use strict";var module = {exports:{}};';
|
||||||
|
str += process;
|
||||||
|
str += 'process.nextTick(function () {assert.ok(true);done();})';
|
||||||
|
var script = new vm.Script(str);
|
||||||
|
var context = {
|
||||||
|
clearTimeout: clearTimeout,
|
||||||
|
setTimeout: setTimeout,
|
||||||
|
done: done,
|
||||||
|
assert: assert
|
||||||
|
};
|
||||||
|
script.runInNewContext(context);
|
||||||
|
});
|
||||||
|
it('late defs setTimeout', function (done) {
|
||||||
|
var str = '"use strict";var module = {exports:{}};';
|
||||||
|
str += process;
|
||||||
|
str += 'var setTimeout = hiddenSetTimeout;process.nextTick(function () {assert.ok(true);done();})';
|
||||||
|
var script = new vm.Script(str);
|
||||||
|
var context = {
|
||||||
|
clearTimeout: clearTimeout,
|
||||||
|
hiddenSetTimeout: setTimeout,
|
||||||
|
done: done,
|
||||||
|
assert: assert
|
||||||
|
};
|
||||||
|
script.runInNewContext(context);
|
||||||
|
});
|
||||||
|
it('late defs clearTimeout', function (done) {
|
||||||
|
var str = '"use strict";var module = {exports:{}};';
|
||||||
|
str += process;
|
||||||
|
str += 'var clearTimeout = hiddenClearTimeout;process.nextTick(function () {assert.ok(true);done();})';
|
||||||
|
var script = new vm.Script(str);
|
||||||
|
var context = {
|
||||||
|
hiddenClearTimeout: clearTimeout,
|
||||||
|
setTimeout: setTimeout,
|
||||||
|
done: done,
|
||||||
|
assert: assert
|
||||||
|
};
|
||||||
|
script.runInNewContext(context);
|
||||||
|
});
|
||||||
|
it('late defs setTimeout and then redefine', function (done) {
|
||||||
|
var str = '"use strict";var module = {exports:{}};';
|
||||||
|
str += process;
|
||||||
|
str += 'var setTimeout = hiddenSetTimeout;process.nextTick(function () {setTimeout = function (){throw new Error("foo")};hiddenSetTimeout(function(){process.nextTick(function (){assert.ok(true);done();});});});';
|
||||||
|
var script = new vm.Script(str);
|
||||||
|
var context = {
|
||||||
|
clearTimeout: clearTimeout,
|
||||||
|
hiddenSetTimeout: setTimeout,
|
||||||
|
done: done,
|
||||||
|
assert: assert
|
||||||
|
};
|
||||||
|
script.runInNewContext(context);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
15
node_modules/rimraf/LICENSE
generated
vendored
Normal file
15
node_modules/rimraf/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
The ISC License
|
||||||
|
|
||||||
|
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||||
|
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
101
node_modules/rimraf/README.md
generated
vendored
Normal file
101
node_modules/rimraf/README.md
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
[](https://travis-ci.org/isaacs/rimraf) [](https://david-dm.org/isaacs/rimraf) [](https://david-dm.org/isaacs/rimraf#info=devDependencies)
|
||||||
|
|
||||||
|
The [UNIX command](http://en.wikipedia.org/wiki/Rm_(Unix)) `rm -rf` for node.
|
||||||
|
|
||||||
|
Install with `npm install rimraf`, or just drop rimraf.js somewhere.
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
`rimraf(f, [opts], callback)`
|
||||||
|
|
||||||
|
The first parameter will be interpreted as a globbing pattern for files. If you
|
||||||
|
want to disable globbing you can do so with `opts.disableGlob` (defaults to
|
||||||
|
`false`). This might be handy, for instance, if you have filenames that contain
|
||||||
|
globbing wildcard characters.
|
||||||
|
|
||||||
|
The callback will be called with an error if there is one. Certain
|
||||||
|
errors are handled for you:
|
||||||
|
|
||||||
|
* Windows: `EBUSY` and `ENOTEMPTY` - rimraf will back off a maximum of
|
||||||
|
`opts.maxBusyTries` times before giving up, adding 100ms of wait
|
||||||
|
between each attempt. The default `maxBusyTries` is 3.
|
||||||
|
* `ENOENT` - If the file doesn't exist, rimraf will return
|
||||||
|
successfully, since your desired outcome is already the case.
|
||||||
|
* `EMFILE` - Since `readdir` requires opening a file descriptor, it's
|
||||||
|
possible to hit `EMFILE` if too many file descriptors are in use.
|
||||||
|
In the sync case, there's nothing to be done for this. But in the
|
||||||
|
async case, rimraf will gradually back off with timeouts up to
|
||||||
|
`opts.emfileWait` ms, which defaults to 1000.
|
||||||
|
|
||||||
|
## options
|
||||||
|
|
||||||
|
* unlink, chmod, stat, lstat, rmdir, readdir,
|
||||||
|
unlinkSync, chmodSync, statSync, lstatSync, rmdirSync, readdirSync
|
||||||
|
|
||||||
|
In order to use a custom file system library, you can override
|
||||||
|
specific fs functions on the options object.
|
||||||
|
|
||||||
|
If any of these functions are present on the options object, then
|
||||||
|
the supplied function will be used instead of the default fs
|
||||||
|
method.
|
||||||
|
|
||||||
|
Sync methods are only relevant for `rimraf.sync()`, of course.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var myCustomFS = require('some-custom-fs')
|
||||||
|
|
||||||
|
rimraf('some-thing', myCustomFS, callback)
|
||||||
|
```
|
||||||
|
|
||||||
|
* maxBusyTries
|
||||||
|
|
||||||
|
If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error code is encountered
|
||||||
|
on Windows systems, then rimraf will retry with a linear backoff
|
||||||
|
wait of 100ms longer on each try. The default maxBusyTries is 3.
|
||||||
|
|
||||||
|
Only relevant for async usage.
|
||||||
|
|
||||||
|
* emfileWait
|
||||||
|
|
||||||
|
If an `EMFILE` error is encountered, then rimraf will retry
|
||||||
|
repeatedly with a linear backoff of 1ms longer on each try, until
|
||||||
|
the timeout counter hits this max. The default limit is 1000.
|
||||||
|
|
||||||
|
If you repeatedly encounter `EMFILE` errors, then consider using
|
||||||
|
[graceful-fs](http://npm.im/graceful-fs) in your program.
|
||||||
|
|
||||||
|
Only relevant for async usage.
|
||||||
|
|
||||||
|
* glob
|
||||||
|
|
||||||
|
Set to `false` to disable [glob](http://npm.im/glob) pattern
|
||||||
|
matching.
|
||||||
|
|
||||||
|
Set to an object to pass options to the glob module. The default
|
||||||
|
glob options are `{ nosort: true, silent: true }`.
|
||||||
|
|
||||||
|
Glob version 6 is used in this module.
|
||||||
|
|
||||||
|
Relevant for both sync and async usage.
|
||||||
|
|
||||||
|
* disableGlob
|
||||||
|
|
||||||
|
Set to any non-falsey value to disable globbing entirely.
|
||||||
|
(Equivalent to setting `glob: false`.)
|
||||||
|
|
||||||
|
## rimraf.sync
|
||||||
|
|
||||||
|
It can remove stuff synchronously, too. But that's not so good. Use
|
||||||
|
the async API. It's better.
|
||||||
|
|
||||||
|
## CLI
|
||||||
|
|
||||||
|
If installed with `npm install rimraf -g` it can be used as a global
|
||||||
|
command `rimraf <path> [<path> ...]` which is useful for cross platform support.
|
||||||
|
|
||||||
|
## mkdirp
|
||||||
|
|
||||||
|
If you need to create a directory recursively, check out
|
||||||
|
[mkdirp](https://github.com/substack/node-mkdirp).
|
||||||
50
node_modules/rimraf/bin.js
generated
vendored
Executable file
50
node_modules/rimraf/bin.js
generated
vendored
Executable file
@@ -0,0 +1,50 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
var rimraf = require('./')
|
||||||
|
|
||||||
|
var help = false
|
||||||
|
var dashdash = false
|
||||||
|
var noglob = false
|
||||||
|
var args = process.argv.slice(2).filter(function(arg) {
|
||||||
|
if (dashdash)
|
||||||
|
return !!arg
|
||||||
|
else if (arg === '--')
|
||||||
|
dashdash = true
|
||||||
|
else if (arg === '--no-glob' || arg === '-G')
|
||||||
|
noglob = true
|
||||||
|
else if (arg === '--glob' || arg === '-g')
|
||||||
|
noglob = false
|
||||||
|
else if (arg.match(/^(-+|\/)(h(elp)?|\?)$/))
|
||||||
|
help = true
|
||||||
|
else
|
||||||
|
return !!arg
|
||||||
|
})
|
||||||
|
|
||||||
|
if (help || args.length === 0) {
|
||||||
|
// If they didn't ask for help, then this is not a "success"
|
||||||
|
var log = help ? console.log : console.error
|
||||||
|
log('Usage: rimraf <path> [<path> ...]')
|
||||||
|
log('')
|
||||||
|
log(' Deletes all files and folders at "path" recursively.')
|
||||||
|
log('')
|
||||||
|
log('Options:')
|
||||||
|
log('')
|
||||||
|
log(' -h, --help Display this usage info')
|
||||||
|
log(' -G, --no-glob Do not expand glob patterns in arguments')
|
||||||
|
log(' -g, --glob Expand glob patterns in arguments (default)')
|
||||||
|
process.exit(help ? 0 : 1)
|
||||||
|
} else
|
||||||
|
go(0)
|
||||||
|
|
||||||
|
function go (n) {
|
||||||
|
if (n >= args.length)
|
||||||
|
return
|
||||||
|
var options = {}
|
||||||
|
if (noglob)
|
||||||
|
options = { glob: false }
|
||||||
|
rimraf(args[n], options, function (er) {
|
||||||
|
if (er)
|
||||||
|
throw er
|
||||||
|
go(n+1)
|
||||||
|
})
|
||||||
|
}
|
||||||
67
node_modules/rimraf/package.json
generated
vendored
Normal file
67
node_modules/rimraf/package.json
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
{
|
||||||
|
"_from": "rimraf@^2.6.3",
|
||||||
|
"_id": "rimraf@2.7.1",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
|
||||||
|
"_location": "/rimraf",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "rimraf@^2.6.3",
|
||||||
|
"name": "rimraf",
|
||||||
|
"escapedName": "rimraf",
|
||||||
|
"rawSpec": "^2.6.3",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^2.6.3"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/tmp"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
|
||||||
|
"_shasum": "35797f13a7fdadc566142c29d4f07ccad483e3ec",
|
||||||
|
"_spec": "rimraf@^2.6.3",
|
||||||
|
"_where": "/Users/Ibrahim/Desktop/test2/node_modules/tmp",
|
||||||
|
"author": {
|
||||||
|
"name": "Isaac Z. Schlueter",
|
||||||
|
"email": "i@izs.me",
|
||||||
|
"url": "http://blog.izs.me/"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"rimraf": "./bin.js"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/isaacs/rimraf/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {
|
||||||
|
"glob": "^7.1.3"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "A deep deletion module for node (like `rm -rf`)",
|
||||||
|
"devDependencies": {
|
||||||
|
"mkdirp": "^0.5.1",
|
||||||
|
"tap": "^12.1.1"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"LICENSE",
|
||||||
|
"README.md",
|
||||||
|
"bin.js",
|
||||||
|
"rimraf.js"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/isaacs/rimraf#readme",
|
||||||
|
"license": "ISC",
|
||||||
|
"main": "rimraf.js",
|
||||||
|
"name": "rimraf",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/isaacs/rimraf.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"postpublish": "git push origin --all; git push origin --tags",
|
||||||
|
"postversion": "npm publish",
|
||||||
|
"preversion": "npm test",
|
||||||
|
"test": "tap test/*.js"
|
||||||
|
},
|
||||||
|
"version": "2.7.1"
|
||||||
|
}
|
||||||
372
node_modules/rimraf/rimraf.js
generated
vendored
Normal file
372
node_modules/rimraf/rimraf.js
generated
vendored
Normal file
@@ -0,0 +1,372 @@
|
|||||||
|
module.exports = rimraf
|
||||||
|
rimraf.sync = rimrafSync
|
||||||
|
|
||||||
|
var assert = require("assert")
|
||||||
|
var path = require("path")
|
||||||
|
var fs = require("fs")
|
||||||
|
var glob = undefined
|
||||||
|
try {
|
||||||
|
glob = require("glob")
|
||||||
|
} catch (_err) {
|
||||||
|
// treat glob as optional.
|
||||||
|
}
|
||||||
|
var _0666 = parseInt('666', 8)
|
||||||
|
|
||||||
|
var defaultGlobOpts = {
|
||||||
|
nosort: true,
|
||||||
|
silent: true
|
||||||
|
}
|
||||||
|
|
||||||
|
// for EMFILE handling
|
||||||
|
var timeout = 0
|
||||||
|
|
||||||
|
var isWindows = (process.platform === "win32")
|
||||||
|
|
||||||
|
function defaults (options) {
|
||||||
|
var methods = [
|
||||||
|
'unlink',
|
||||||
|
'chmod',
|
||||||
|
'stat',
|
||||||
|
'lstat',
|
||||||
|
'rmdir',
|
||||||
|
'readdir'
|
||||||
|
]
|
||||||
|
methods.forEach(function(m) {
|
||||||
|
options[m] = options[m] || fs[m]
|
||||||
|
m = m + 'Sync'
|
||||||
|
options[m] = options[m] || fs[m]
|
||||||
|
})
|
||||||
|
|
||||||
|
options.maxBusyTries = options.maxBusyTries || 3
|
||||||
|
options.emfileWait = options.emfileWait || 1000
|
||||||
|
if (options.glob === false) {
|
||||||
|
options.disableGlob = true
|
||||||
|
}
|
||||||
|
if (options.disableGlob !== true && glob === undefined) {
|
||||||
|
throw Error('glob dependency not found, set `options.disableGlob = true` if intentional')
|
||||||
|
}
|
||||||
|
options.disableGlob = options.disableGlob || false
|
||||||
|
options.glob = options.glob || defaultGlobOpts
|
||||||
|
}
|
||||||
|
|
||||||
|
function rimraf (p, options, cb) {
|
||||||
|
if (typeof options === 'function') {
|
||||||
|
cb = options
|
||||||
|
options = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(p, 'rimraf: missing path')
|
||||||
|
assert.equal(typeof p, 'string', 'rimraf: path should be a string')
|
||||||
|
assert.equal(typeof cb, 'function', 'rimraf: callback function required')
|
||||||
|
assert(options, 'rimraf: invalid options argument provided')
|
||||||
|
assert.equal(typeof options, 'object', 'rimraf: options should be object')
|
||||||
|
|
||||||
|
defaults(options)
|
||||||
|
|
||||||
|
var busyTries = 0
|
||||||
|
var errState = null
|
||||||
|
var n = 0
|
||||||
|
|
||||||
|
if (options.disableGlob || !glob.hasMagic(p))
|
||||||
|
return afterGlob(null, [p])
|
||||||
|
|
||||||
|
options.lstat(p, function (er, stat) {
|
||||||
|
if (!er)
|
||||||
|
return afterGlob(null, [p])
|
||||||
|
|
||||||
|
glob(p, options.glob, afterGlob)
|
||||||
|
})
|
||||||
|
|
||||||
|
function next (er) {
|
||||||
|
errState = errState || er
|
||||||
|
if (--n === 0)
|
||||||
|
cb(errState)
|
||||||
|
}
|
||||||
|
|
||||||
|
function afterGlob (er, results) {
|
||||||
|
if (er)
|
||||||
|
return cb(er)
|
||||||
|
|
||||||
|
n = results.length
|
||||||
|
if (n === 0)
|
||||||
|
return cb()
|
||||||
|
|
||||||
|
results.forEach(function (p) {
|
||||||
|
rimraf_(p, options, function CB (er) {
|
||||||
|
if (er) {
|
||||||
|
if ((er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") &&
|
||||||
|
busyTries < options.maxBusyTries) {
|
||||||
|
busyTries ++
|
||||||
|
var time = busyTries * 100
|
||||||
|
// try again, with the same exact callback as this one.
|
||||||
|
return setTimeout(function () {
|
||||||
|
rimraf_(p, options, CB)
|
||||||
|
}, time)
|
||||||
|
}
|
||||||
|
|
||||||
|
// this one won't happen if graceful-fs is used.
|
||||||
|
if (er.code === "EMFILE" && timeout < options.emfileWait) {
|
||||||
|
return setTimeout(function () {
|
||||||
|
rimraf_(p, options, CB)
|
||||||
|
}, timeout ++)
|
||||||
|
}
|
||||||
|
|
||||||
|
// already gone
|
||||||
|
if (er.code === "ENOENT") er = null
|
||||||
|
}
|
||||||
|
|
||||||
|
timeout = 0
|
||||||
|
next(er)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Two possible strategies.
|
||||||
|
// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR
|
||||||
|
// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR
|
||||||
|
//
|
||||||
|
// Both result in an extra syscall when you guess wrong. However, there
|
||||||
|
// are likely far more normal files in the world than directories. This
|
||||||
|
// is based on the assumption that a the average number of files per
|
||||||
|
// directory is >= 1.
|
||||||
|
//
|
||||||
|
// If anyone ever complains about this, then I guess the strategy could
|
||||||
|
// be made configurable somehow. But until then, YAGNI.
|
||||||
|
function rimraf_ (p, options, cb) {
|
||||||
|
assert(p)
|
||||||
|
assert(options)
|
||||||
|
assert(typeof cb === 'function')
|
||||||
|
|
||||||
|
// sunos lets the root user unlink directories, which is... weird.
|
||||||
|
// so we have to lstat here and make sure it's not a dir.
|
||||||
|
options.lstat(p, function (er, st) {
|
||||||
|
if (er && er.code === "ENOENT")
|
||||||
|
return cb(null)
|
||||||
|
|
||||||
|
// Windows can EPERM on stat. Life is suffering.
|
||||||
|
if (er && er.code === "EPERM" && isWindows)
|
||||||
|
fixWinEPERM(p, options, er, cb)
|
||||||
|
|
||||||
|
if (st && st.isDirectory())
|
||||||
|
return rmdir(p, options, er, cb)
|
||||||
|
|
||||||
|
options.unlink(p, function (er) {
|
||||||
|
if (er) {
|
||||||
|
if (er.code === "ENOENT")
|
||||||
|
return cb(null)
|
||||||
|
if (er.code === "EPERM")
|
||||||
|
return (isWindows)
|
||||||
|
? fixWinEPERM(p, options, er, cb)
|
||||||
|
: rmdir(p, options, er, cb)
|
||||||
|
if (er.code === "EISDIR")
|
||||||
|
return rmdir(p, options, er, cb)
|
||||||
|
}
|
||||||
|
return cb(er)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function fixWinEPERM (p, options, er, cb) {
|
||||||
|
assert(p)
|
||||||
|
assert(options)
|
||||||
|
assert(typeof cb === 'function')
|
||||||
|
if (er)
|
||||||
|
assert(er instanceof Error)
|
||||||
|
|
||||||
|
options.chmod(p, _0666, function (er2) {
|
||||||
|
if (er2)
|
||||||
|
cb(er2.code === "ENOENT" ? null : er)
|
||||||
|
else
|
||||||
|
options.stat(p, function(er3, stats) {
|
||||||
|
if (er3)
|
||||||
|
cb(er3.code === "ENOENT" ? null : er)
|
||||||
|
else if (stats.isDirectory())
|
||||||
|
rmdir(p, options, er, cb)
|
||||||
|
else
|
||||||
|
options.unlink(p, cb)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function fixWinEPERMSync (p, options, er) {
|
||||||
|
assert(p)
|
||||||
|
assert(options)
|
||||||
|
if (er)
|
||||||
|
assert(er instanceof Error)
|
||||||
|
|
||||||
|
try {
|
||||||
|
options.chmodSync(p, _0666)
|
||||||
|
} catch (er2) {
|
||||||
|
if (er2.code === "ENOENT")
|
||||||
|
return
|
||||||
|
else
|
||||||
|
throw er
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
var stats = options.statSync(p)
|
||||||
|
} catch (er3) {
|
||||||
|
if (er3.code === "ENOENT")
|
||||||
|
return
|
||||||
|
else
|
||||||
|
throw er
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stats.isDirectory())
|
||||||
|
rmdirSync(p, options, er)
|
||||||
|
else
|
||||||
|
options.unlinkSync(p)
|
||||||
|
}
|
||||||
|
|
||||||
|
function rmdir (p, options, originalEr, cb) {
|
||||||
|
assert(p)
|
||||||
|
assert(options)
|
||||||
|
if (originalEr)
|
||||||
|
assert(originalEr instanceof Error)
|
||||||
|
assert(typeof cb === 'function')
|
||||||
|
|
||||||
|
// try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS)
|
||||||
|
// if we guessed wrong, and it's not a directory, then
|
||||||
|
// raise the original error.
|
||||||
|
options.rmdir(p, function (er) {
|
||||||
|
if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM"))
|
||||||
|
rmkids(p, options, cb)
|
||||||
|
else if (er && er.code === "ENOTDIR")
|
||||||
|
cb(originalEr)
|
||||||
|
else
|
||||||
|
cb(er)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function rmkids(p, options, cb) {
|
||||||
|
assert(p)
|
||||||
|
assert(options)
|
||||||
|
assert(typeof cb === 'function')
|
||||||
|
|
||||||
|
options.readdir(p, function (er, files) {
|
||||||
|
if (er)
|
||||||
|
return cb(er)
|
||||||
|
var n = files.length
|
||||||
|
if (n === 0)
|
||||||
|
return options.rmdir(p, cb)
|
||||||
|
var errState
|
||||||
|
files.forEach(function (f) {
|
||||||
|
rimraf(path.join(p, f), options, function (er) {
|
||||||
|
if (errState)
|
||||||
|
return
|
||||||
|
if (er)
|
||||||
|
return cb(errState = er)
|
||||||
|
if (--n === 0)
|
||||||
|
options.rmdir(p, cb)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// this looks simpler, and is strictly *faster*, but will
|
||||||
|
// tie up the JavaScript thread and fail on excessively
|
||||||
|
// deep directory trees.
|
||||||
|
function rimrafSync (p, options) {
|
||||||
|
options = options || {}
|
||||||
|
defaults(options)
|
||||||
|
|
||||||
|
assert(p, 'rimraf: missing path')
|
||||||
|
assert.equal(typeof p, 'string', 'rimraf: path should be a string')
|
||||||
|
assert(options, 'rimraf: missing options')
|
||||||
|
assert.equal(typeof options, 'object', 'rimraf: options should be object')
|
||||||
|
|
||||||
|
var results
|
||||||
|
|
||||||
|
if (options.disableGlob || !glob.hasMagic(p)) {
|
||||||
|
results = [p]
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
options.lstatSync(p)
|
||||||
|
results = [p]
|
||||||
|
} catch (er) {
|
||||||
|
results = glob.sync(p, options.glob)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!results.length)
|
||||||
|
return
|
||||||
|
|
||||||
|
for (var i = 0; i < results.length; i++) {
|
||||||
|
var p = results[i]
|
||||||
|
|
||||||
|
try {
|
||||||
|
var st = options.lstatSync(p)
|
||||||
|
} catch (er) {
|
||||||
|
if (er.code === "ENOENT")
|
||||||
|
return
|
||||||
|
|
||||||
|
// Windows can EPERM on stat. Life is suffering.
|
||||||
|
if (er.code === "EPERM" && isWindows)
|
||||||
|
fixWinEPERMSync(p, options, er)
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// sunos lets the root user unlink directories, which is... weird.
|
||||||
|
if (st && st.isDirectory())
|
||||||
|
rmdirSync(p, options, null)
|
||||||
|
else
|
||||||
|
options.unlinkSync(p)
|
||||||
|
} catch (er) {
|
||||||
|
if (er.code === "ENOENT")
|
||||||
|
return
|
||||||
|
if (er.code === "EPERM")
|
||||||
|
return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er)
|
||||||
|
if (er.code !== "EISDIR")
|
||||||
|
throw er
|
||||||
|
|
||||||
|
rmdirSync(p, options, er)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function rmdirSync (p, options, originalEr) {
|
||||||
|
assert(p)
|
||||||
|
assert(options)
|
||||||
|
if (originalEr)
|
||||||
|
assert(originalEr instanceof Error)
|
||||||
|
|
||||||
|
try {
|
||||||
|
options.rmdirSync(p)
|
||||||
|
} catch (er) {
|
||||||
|
if (er.code === "ENOENT")
|
||||||
|
return
|
||||||
|
if (er.code === "ENOTDIR")
|
||||||
|
throw originalEr
|
||||||
|
if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")
|
||||||
|
rmkidsSync(p, options)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function rmkidsSync (p, options) {
|
||||||
|
assert(p)
|
||||||
|
assert(options)
|
||||||
|
options.readdirSync(p).forEach(function (f) {
|
||||||
|
rimrafSync(path.join(p, f), options)
|
||||||
|
})
|
||||||
|
|
||||||
|
// We only end up here once we got ENOTEMPTY at least once, and
|
||||||
|
// at this point, we are guaranteed to have removed all the kids.
|
||||||
|
// So, we know that it won't be ENOENT or ENOTDIR or anything else.
|
||||||
|
// try really hard to delete stuff on windows, because it has a
|
||||||
|
// PROFOUNDLY annoying habit of not closing handles promptly when
|
||||||
|
// files are deleted, resulting in spurious ENOTEMPTY errors.
|
||||||
|
var retries = isWindows ? 100 : 1
|
||||||
|
var i = 0
|
||||||
|
do {
|
||||||
|
var threw = true
|
||||||
|
try {
|
||||||
|
var ret = options.rmdirSync(p, options)
|
||||||
|
threw = false
|
||||||
|
return ret
|
||||||
|
} finally {
|
||||||
|
if (++i < retries && threw)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
} while (true)
|
||||||
|
}
|
||||||
20
node_modules/temp/LICENSE
generated
vendored
Normal file
20
node_modules/temp/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2010-2014 Bruce Williams
|
||||||
|
|
||||||
|
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.
|
||||||
295
node_modules/temp/README.md
generated
vendored
Normal file
295
node_modules/temp/README.md
generated
vendored
Normal file
@@ -0,0 +1,295 @@
|
|||||||
|
node-temp
|
||||||
|
=========
|
||||||
|
|
||||||
|
Temporary files, directories, and streams for Node.js.
|
||||||
|
|
||||||
|
Handles generating a unique file/directory name under the appropriate
|
||||||
|
system temporary directory, changing the file to an appropriate mode,
|
||||||
|
and supports automatic removal (if asked)
|
||||||
|
|
||||||
|
`temp` has a similar API to the `fs` module.
|
||||||
|
|
||||||
|
Node.js Compatibility
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
Supports v4.0.0+.
|
||||||
|
|
||||||
|
[](https://travis-ci.org/bruce/node-temp)
|
||||||
|
|
||||||
|
Please let me know if you have problems running it on a later version of Node.js or
|
||||||
|
have platform-specific problems.
|
||||||
|
|
||||||
|
Installation
|
||||||
|
------------
|
||||||
|
|
||||||
|
Install it using [npm](http://github.com/isaacs/npm):
|
||||||
|
|
||||||
|
$ npm install temp
|
||||||
|
|
||||||
|
Or get it directly from:
|
||||||
|
http://github.com/bruce/node-temp
|
||||||
|
|
||||||
|
Synopsis
|
||||||
|
--------
|
||||||
|
|
||||||
|
You can create temporary files with `open` and `openSync`, temporary
|
||||||
|
directories with `mkdir` and `mkdirSync`, or you can get a unique name
|
||||||
|
in the system temporary directory with `path`.
|
||||||
|
|
||||||
|
Working copies of the following examples can be found under the
|
||||||
|
`examples` directory.
|
||||||
|
|
||||||
|
### Temporary Files
|
||||||
|
|
||||||
|
To create a temporary file use `open` or `openSync`, passing
|
||||||
|
them an optional prefix, suffix, or both (see below for details on
|
||||||
|
affixes). The object passed to the callback (or returned) has
|
||||||
|
`path` and `fd` keys:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
{ path: "/path/to/file",
|
||||||
|
, fd: theFileDescriptor
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
In this example we write to a temporary file and call out to `grep` and
|
||||||
|
`wc -l` to determine the number of time `foo` occurs in the text. The
|
||||||
|
temporary file is chmod'd `0600` and cleaned up automatically when the
|
||||||
|
process at exit (because `temp.track()` is called):
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var temp = require('temp'),
|
||||||
|
fs = require('fs'),
|
||||||
|
util = require('util'),
|
||||||
|
exec = require('child_process').exec;
|
||||||
|
|
||||||
|
// Automatically track and cleanup files at exit
|
||||||
|
temp.track();
|
||||||
|
|
||||||
|
// Fake data
|
||||||
|
var myData = "foo\nbar\nfoo\nbaz";
|
||||||
|
|
||||||
|
// Process the data (note: error handling omitted)
|
||||||
|
temp.open('myprefix', function(err, info) {
|
||||||
|
if (!err) {
|
||||||
|
fs.write(info.fd, myData);
|
||||||
|
fs.close(info.fd, function(err) {
|
||||||
|
exec("grep foo '" + info.path + "' | wc -l", function(err, stdout) {
|
||||||
|
util.puts(stdout.trim());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Want Cleanup? Make sure you ask for it.
|
||||||
|
|
||||||
|
As noted in the example above, if you want temp to track the files and
|
||||||
|
directories it creates and handle removing those files and directories
|
||||||
|
on exit, you must call `track()`. The `track()` function is chainable,
|
||||||
|
and it's recommended that you call it when requiring the module.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var temp = require("temp").track();
|
||||||
|
```
|
||||||
|
|
||||||
|
Why is this necessary? In pre-0.6 versions of temp, tracking was
|
||||||
|
automatic. While this works great for scripts and
|
||||||
|
[Grunt tasks](http://gruntjs.com/), it's not so great for long-running
|
||||||
|
server processes. Since that's arguably what Node.js is _for_, you
|
||||||
|
have to opt-in to tracking.
|
||||||
|
|
||||||
|
But it's easy.
|
||||||
|
|
||||||
|
#### Cleanup anytime
|
||||||
|
|
||||||
|
When tracking, you can run `cleanup()` and `cleanupSync()` anytime
|
||||||
|
(`cleanupSync()` will be run for you on process exit). An object will
|
||||||
|
be returned (or passed to the callback) with cleanup counts and
|
||||||
|
the file/directory tracking lists will be reset.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
> temp.cleanupSync();
|
||||||
|
{ files: 1,
|
||||||
|
dirs: 0 }
|
||||||
|
```
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
> temp.cleanup(function(err, stats) {
|
||||||
|
console.log(stats);
|
||||||
|
});
|
||||||
|
{ files: 1,
|
||||||
|
dirs: 0 }
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: If you're not tracking, an error ("not tracking") will be passed
|
||||||
|
to the callback.
|
||||||
|
|
||||||
|
### Temporary Directories
|
||||||
|
|
||||||
|
To create a temporary directory, use `mkdir` or `mkdirSync`, passing
|
||||||
|
it an optional prefix, suffix, or both (see below for details on affixes).
|
||||||
|
|
||||||
|
In this example we create a temporary directory, write to a file
|
||||||
|
within it, call out to an external program to create a PDF, and read
|
||||||
|
the result. While the external process creates a lot of additional
|
||||||
|
files, the temporary directory is removed automatically at exit (because
|
||||||
|
`temp.track()` is called):
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var temp = require('temp'),
|
||||||
|
fs = require('fs'),
|
||||||
|
util = require('util'),
|
||||||
|
path = require('path'),
|
||||||
|
exec = require('child_process').exec;
|
||||||
|
|
||||||
|
// Automatically track and cleanup files at exit
|
||||||
|
temp.track();
|
||||||
|
|
||||||
|
// For use with ConTeXt, http://wiki.contextgarden.net
|
||||||
|
var myData = "\\starttext\nHello World\n\\stoptext";
|
||||||
|
|
||||||
|
temp.mkdir('pdfcreator', function(err, dirPath) {
|
||||||
|
var inputPath = path.join(dirPath, 'input.tex')
|
||||||
|
fs.writeFile(inputPath, myData, function(err) {
|
||||||
|
if (err) throw err;
|
||||||
|
process.chdir(dirPath);
|
||||||
|
exec("texexec '" + inputPath + "'", function(err) {
|
||||||
|
if (err) throw err;
|
||||||
|
fs.readFile(path.join(dirPath, 'input.pdf'), function(err, data) {
|
||||||
|
if (err) throw err;
|
||||||
|
sys.print(data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Temporary Streams
|
||||||
|
|
||||||
|
To create a temporary WriteStream, use 'createWriteStream', which sits
|
||||||
|
on top of `fs.createWriteStream`. The return value is a
|
||||||
|
`fs.WriteStream` with a `path` property containing the temporary file
|
||||||
|
path for the stream. The `path` is registered for removal when
|
||||||
|
`temp.cleanup` is called (because `temp.track()` is called).
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var temp = require('temp');
|
||||||
|
|
||||||
|
// Automatically track and cleanup files at exit
|
||||||
|
temp.track();
|
||||||
|
|
||||||
|
var stream = temp.createWriteStream();
|
||||||
|
// stream.path contains the temporary file path for the stream
|
||||||
|
stream.write("Some data");
|
||||||
|
// Maybe do some other things
|
||||||
|
stream.end();
|
||||||
|
```
|
||||||
|
|
||||||
|
### Affixes
|
||||||
|
|
||||||
|
You can provide custom prefixes and suffixes when creating temporary
|
||||||
|
files and directories. If you provide a string, it is used as the prefix
|
||||||
|
for the temporary name. If you provide an object with `prefix`,
|
||||||
|
`suffix` and `dir` keys, they are used for the temporary name.
|
||||||
|
|
||||||
|
Here are some examples:
|
||||||
|
|
||||||
|
* `"aprefix"`: A simple prefix, prepended to the filename; this is
|
||||||
|
shorthand for:
|
||||||
|
* `{prefix: "aprefix"}`: A simple prefix, prepended to the filename
|
||||||
|
* `{suffix: ".asuffix"}`: A suffix, appended to the filename
|
||||||
|
(especially useful when the file needs to be named with specific
|
||||||
|
extension for use with an external program).
|
||||||
|
* `{prefix: "myprefix", suffix: "mysuffix"}`: Customize both affixes
|
||||||
|
* `{dir: path.join(os.tmpdir(), "myapp")}`: default prefix and suffix
|
||||||
|
within a new temporary directory.
|
||||||
|
* `null`: Use the defaults for files and directories (prefixes `"f-"`
|
||||||
|
and `"d-"`, respectively, no suffixes).
|
||||||
|
|
||||||
|
In this simple example we read a `pdf`, write it to a temporary file with
|
||||||
|
a `.pdf` extension, and close it.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var fs = require('fs'),
|
||||||
|
temp = require('temp');
|
||||||
|
|
||||||
|
fs.readFile('/path/to/source.pdf', function(err, data) {
|
||||||
|
temp.open({suffix: '.pdf'}, function(err, info) {
|
||||||
|
if (err) throw err;
|
||||||
|
fs.write(info.fd, data);
|
||||||
|
fs.close(info.fd, function(err) {
|
||||||
|
if (err) throw err;
|
||||||
|
// Do something with the file
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Just a path, please
|
||||||
|
|
||||||
|
If you just want a unique name in your temporary directory, use
|
||||||
|
`path`:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var fs = require('fs');
|
||||||
|
var tempName = temp.path({suffix: '.pdf'});
|
||||||
|
// Do something with tempName
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: The file isn't created for you, and the mode is not changed -- and it
|
||||||
|
will not be removed automatically at exit. If you use `path`, it's
|
||||||
|
all up to you.
|
||||||
|
|
||||||
|
Using it with Grunt
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
If you want to use the module with [Grunt](http://gruntjs.com/), make sure you
|
||||||
|
use `async()` in your Gruntfile:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
module.exports = function (grunt) {
|
||||||
|
var temp = require("temp");
|
||||||
|
temp.track(); // Cleanup files, please
|
||||||
|
grunt.registerTask("temptest", "Testing temp", function() {
|
||||||
|
|
||||||
|
var done = this.async(); // Don't forget this!
|
||||||
|
|
||||||
|
grunt.log.writeln("About to write a file...");
|
||||||
|
temp.open('tempfile', function(err, info) {
|
||||||
|
// File writing shenanigans here
|
||||||
|
grunt.log.writeln("Wrote a file!")
|
||||||
|
|
||||||
|
done(); // REALLY don't forget this!
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
For more information, see the [Grunt FAQ](http://gruntjs.com/frequently-asked-questions#why-doesn-t-my-asynchronous-task-complete).
|
||||||
|
|
||||||
|
Testing
|
||||||
|
-------
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ npm test
|
||||||
|
```
|
||||||
|
|
||||||
|
Contributing
|
||||||
|
------------
|
||||||
|
|
||||||
|
You can find the repository at:
|
||||||
|
http://github.com/bruce/node-temp
|
||||||
|
|
||||||
|
Issues/Feature Requests can be submitted at:
|
||||||
|
http://github.com/bruce/node-temp/issues
|
||||||
|
|
||||||
|
I'd really like to hear your feedback, and I'd love to receive your
|
||||||
|
pull-requests!
|
||||||
|
|
||||||
|
Copyright
|
||||||
|
---------
|
||||||
|
|
||||||
|
Copyright (c) 2010-2014 Bruce Williams. This software is licensed
|
||||||
|
under the MIT License, see LICENSE for details.
|
||||||
314
node_modules/temp/lib/temp.js
generated
vendored
Normal file
314
node_modules/temp/lib/temp.js
generated
vendored
Normal file
@@ -0,0 +1,314 @@
|
|||||||
|
var fs = require('fs'),
|
||||||
|
path = require('path'),
|
||||||
|
cnst = require('constants');
|
||||||
|
|
||||||
|
var rimraf = require('rimraf'),
|
||||||
|
os = require('os'),
|
||||||
|
rimrafSync = rimraf.sync;
|
||||||
|
|
||||||
|
/* HELPERS */
|
||||||
|
|
||||||
|
var dir = path.resolve(os.tmpdir());
|
||||||
|
|
||||||
|
var RDWR_EXCL = cnst.O_CREAT | cnst.O_TRUNC | cnst.O_RDWR | cnst.O_EXCL;
|
||||||
|
|
||||||
|
var promisify = function(callback) {
|
||||||
|
if (typeof callback === 'function') {
|
||||||
|
return [undefined, callback];
|
||||||
|
}
|
||||||
|
|
||||||
|
var promiseCallback;
|
||||||
|
var promise = new Promise(function(resolve, reject) {
|
||||||
|
promiseCallback = function() {
|
||||||
|
var args = Array.from(arguments);
|
||||||
|
var err = args.shift();
|
||||||
|
|
||||||
|
process.nextTick(function() {
|
||||||
|
if (err) {
|
||||||
|
reject(err);
|
||||||
|
} else if (args.length === 1) {
|
||||||
|
resolve(args[0]);
|
||||||
|
} else {
|
||||||
|
resolve(args);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
return [promise, promiseCallback];
|
||||||
|
};
|
||||||
|
|
||||||
|
var generateName = function(rawAffixes, defaultPrefix) {
|
||||||
|
var affixes = parseAffixes(rawAffixes, defaultPrefix);
|
||||||
|
var now = new Date();
|
||||||
|
var name = [affixes.prefix,
|
||||||
|
now.getFullYear(), now.getMonth(), now.getDate(),
|
||||||
|
'-',
|
||||||
|
process.pid,
|
||||||
|
'-',
|
||||||
|
(Math.random() * 0x100000000 + 1).toString(36),
|
||||||
|
affixes.suffix].join('');
|
||||||
|
return path.join(affixes.dir || dir, name);
|
||||||
|
};
|
||||||
|
|
||||||
|
var parseAffixes = function(rawAffixes, defaultPrefix) {
|
||||||
|
var affixes = {prefix: null, suffix: null};
|
||||||
|
if(rawAffixes) {
|
||||||
|
switch (typeof(rawAffixes)) {
|
||||||
|
case 'string':
|
||||||
|
affixes.prefix = rawAffixes;
|
||||||
|
break;
|
||||||
|
case 'object':
|
||||||
|
affixes = rawAffixes;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Error("Unknown affix declaration: " + affixes);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
affixes.prefix = defaultPrefix;
|
||||||
|
}
|
||||||
|
return affixes;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------
|
||||||
|
* Don't forget to call track() if you want file tracking and exit handlers!
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
* When any temp file or directory is created, it is added to filesToDelete
|
||||||
|
* or dirsToDelete. The first time any temp file is created, a listener is
|
||||||
|
* added to remove all temp files and directories at exit.
|
||||||
|
*/
|
||||||
|
var tracking = false;
|
||||||
|
var track = function(value) {
|
||||||
|
tracking = (value !== false);
|
||||||
|
return module.exports; // chainable
|
||||||
|
};
|
||||||
|
var exitListenerAttached = false;
|
||||||
|
var filesToDelete = [];
|
||||||
|
var dirsToDelete = [];
|
||||||
|
|
||||||
|
function deleteFileOnExit(filePath) {
|
||||||
|
if (!tracking) return false;
|
||||||
|
attachExitListener();
|
||||||
|
filesToDelete.push(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteDirOnExit(dirPath) {
|
||||||
|
if (!tracking) return false;
|
||||||
|
attachExitListener();
|
||||||
|
dirsToDelete.push(dirPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
function attachExitListener() {
|
||||||
|
if (!tracking) return false;
|
||||||
|
if (!exitListenerAttached) {
|
||||||
|
process.addListener('exit', cleanupSync);
|
||||||
|
exitListenerAttached = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function cleanupFilesSync() {
|
||||||
|
if (!tracking) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var count = 0;
|
||||||
|
var toDelete;
|
||||||
|
while ((toDelete = filesToDelete.shift()) !== undefined) {
|
||||||
|
rimrafSync(toDelete);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
function cleanupFiles(callback) {
|
||||||
|
var p = promisify(callback);
|
||||||
|
var promise = p[0];
|
||||||
|
callback = p[1];
|
||||||
|
|
||||||
|
if (!tracking) {
|
||||||
|
callback(new Error("not tracking"));
|
||||||
|
return promise;
|
||||||
|
}
|
||||||
|
var count = 0;
|
||||||
|
var left = filesToDelete.length;
|
||||||
|
if (!left) {
|
||||||
|
callback(null, count);
|
||||||
|
return promise;
|
||||||
|
}
|
||||||
|
var toDelete;
|
||||||
|
var rimrafCallback = function(err) {
|
||||||
|
if (!left) {
|
||||||
|
// Prevent processing if aborted
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (err) {
|
||||||
|
// This shouldn't happen; pass error to callback and abort
|
||||||
|
// processing
|
||||||
|
callback(err);
|
||||||
|
left = 0;
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
left--;
|
||||||
|
if (!left) {
|
||||||
|
callback(null, count);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
while ((toDelete = filesToDelete.shift()) !== undefined) {
|
||||||
|
rimraf(toDelete, rimrafCallback);
|
||||||
|
}
|
||||||
|
return promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
function cleanupDirsSync() {
|
||||||
|
if (!tracking) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var count = 0;
|
||||||
|
var toDelete;
|
||||||
|
while ((toDelete = dirsToDelete.shift()) !== undefined) {
|
||||||
|
rimrafSync(toDelete);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
function cleanupDirs(callback) {
|
||||||
|
var p = promisify(callback);
|
||||||
|
var promise = p[0];
|
||||||
|
callback = p[1];
|
||||||
|
|
||||||
|
if (!tracking) {
|
||||||
|
callback(new Error("not tracking"));
|
||||||
|
return promise;
|
||||||
|
}
|
||||||
|
var count = 0;
|
||||||
|
var left = dirsToDelete.length;
|
||||||
|
if (!left) {
|
||||||
|
callback(null, count);
|
||||||
|
return promise;
|
||||||
|
}
|
||||||
|
var toDelete;
|
||||||
|
var rimrafCallback = function (err) {
|
||||||
|
if (!left) {
|
||||||
|
// Prevent processing if aborted
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (err) {
|
||||||
|
// rimraf handles most "normal" errors; pass the error to the
|
||||||
|
// callback and abort processing
|
||||||
|
callback(err, count);
|
||||||
|
left = 0;
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
left--;
|
||||||
|
if (!left) {
|
||||||
|
callback(null, count);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
while ((toDelete = dirsToDelete.shift()) !== undefined) {
|
||||||
|
rimraf(toDelete, rimrafCallback);
|
||||||
|
}
|
||||||
|
return promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
function cleanupSync() {
|
||||||
|
if (!tracking) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var fileCount = cleanupFilesSync();
|
||||||
|
var dirCount = cleanupDirsSync();
|
||||||
|
return {files: fileCount, dirs: dirCount};
|
||||||
|
}
|
||||||
|
|
||||||
|
function cleanup(callback) {
|
||||||
|
var p = promisify(callback);
|
||||||
|
var promise = p[0];
|
||||||
|
callback = p[1];
|
||||||
|
|
||||||
|
if (!tracking) {
|
||||||
|
callback(new Error("not tracking"));
|
||||||
|
return promise;
|
||||||
|
}
|
||||||
|
cleanupFiles(function(fileErr, fileCount) {
|
||||||
|
if (fileErr) {
|
||||||
|
callback(fileErr, {files: fileCount});
|
||||||
|
} else {
|
||||||
|
cleanupDirs(function(dirErr, dirCount) {
|
||||||
|
callback(dirErr, {files: fileCount, dirs: dirCount});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DIRECTORIES */
|
||||||
|
|
||||||
|
function mkdir(affixes, callback) {
|
||||||
|
var p = promisify(callback);
|
||||||
|
var promise = p[0];
|
||||||
|
callback = p[1];
|
||||||
|
|
||||||
|
var dirPath = generateName(affixes, 'd-');
|
||||||
|
fs.mkdir(dirPath, parseInt('0700', 8), function(err) {
|
||||||
|
if (!err) {
|
||||||
|
deleteDirOnExit(dirPath);
|
||||||
|
}
|
||||||
|
callback(err, dirPath);
|
||||||
|
});
|
||||||
|
return promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
function mkdirSync(affixes) {
|
||||||
|
var dirPath = generateName(affixes, 'd-');
|
||||||
|
fs.mkdirSync(dirPath, parseInt('0700', 8));
|
||||||
|
deleteDirOnExit(dirPath);
|
||||||
|
return dirPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FILES */
|
||||||
|
|
||||||
|
function open(affixes, callback) {
|
||||||
|
var p = promisify(callback);
|
||||||
|
var promise = p[0];
|
||||||
|
callback = p[1];
|
||||||
|
|
||||||
|
var filePath = generateName(affixes, 'f-');
|
||||||
|
fs.open(filePath, RDWR_EXCL, parseInt('0600', 8), function(err, fd) {
|
||||||
|
if (!err) {
|
||||||
|
deleteFileOnExit(filePath);
|
||||||
|
}
|
||||||
|
callback(err, {path: filePath, fd: fd});
|
||||||
|
});
|
||||||
|
return promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
function openSync(affixes) {
|
||||||
|
var filePath = generateName(affixes, 'f-');
|
||||||
|
var fd = fs.openSync(filePath, RDWR_EXCL, parseInt('0600', 8));
|
||||||
|
deleteFileOnExit(filePath);
|
||||||
|
return {path: filePath, fd: fd};
|
||||||
|
}
|
||||||
|
|
||||||
|
function createWriteStream(affixes) {
|
||||||
|
var filePath = generateName(affixes, 's-');
|
||||||
|
var stream = fs.createWriteStream(filePath, {flags: RDWR_EXCL, mode: parseInt('0600', 8)});
|
||||||
|
deleteFileOnExit(filePath);
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* EXPORTS */
|
||||||
|
// Settings
|
||||||
|
exports.dir = dir;
|
||||||
|
exports.track = track;
|
||||||
|
// Functions
|
||||||
|
exports.mkdir = mkdir;
|
||||||
|
exports.mkdirSync = mkdirSync;
|
||||||
|
exports.open = open;
|
||||||
|
exports.openSync = openSync;
|
||||||
|
exports.path = generateName;
|
||||||
|
exports.cleanup = cleanup;
|
||||||
|
exports.cleanupSync = cleanupSync;
|
||||||
|
exports.createWriteStream = createWriteStream;
|
||||||
1
node_modules/temp/node_modules/.bin/rimraf
generated
vendored
Symbolic link
1
node_modules/temp/node_modules/.bin/rimraf
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../rimraf/bin.js
|
||||||
15
node_modules/temp/node_modules/rimraf/LICENSE
generated
vendored
Normal file
15
node_modules/temp/node_modules/rimraf/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
The ISC License
|
||||||
|
|
||||||
|
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||||
|
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
101
node_modules/temp/node_modules/rimraf/README.md
generated
vendored
Normal file
101
node_modules/temp/node_modules/rimraf/README.md
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
[](https://travis-ci.org/isaacs/rimraf) [](https://david-dm.org/isaacs/rimraf) [](https://david-dm.org/isaacs/rimraf#info=devDependencies)
|
||||||
|
|
||||||
|
The [UNIX command](http://en.wikipedia.org/wiki/Rm_(Unix)) `rm -rf` for node.
|
||||||
|
|
||||||
|
Install with `npm install rimraf`, or just drop rimraf.js somewhere.
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
`rimraf(f, [opts], callback)`
|
||||||
|
|
||||||
|
The first parameter will be interpreted as a globbing pattern for files. If you
|
||||||
|
want to disable globbing you can do so with `opts.disableGlob` (defaults to
|
||||||
|
`false`). This might be handy, for instance, if you have filenames that contain
|
||||||
|
globbing wildcard characters.
|
||||||
|
|
||||||
|
The callback will be called with an error if there is one. Certain
|
||||||
|
errors are handled for you:
|
||||||
|
|
||||||
|
* Windows: `EBUSY` and `ENOTEMPTY` - rimraf will back off a maximum of
|
||||||
|
`opts.maxBusyTries` times before giving up, adding 100ms of wait
|
||||||
|
between each attempt. The default `maxBusyTries` is 3.
|
||||||
|
* `ENOENT` - If the file doesn't exist, rimraf will return
|
||||||
|
successfully, since your desired outcome is already the case.
|
||||||
|
* `EMFILE` - Since `readdir` requires opening a file descriptor, it's
|
||||||
|
possible to hit `EMFILE` if too many file descriptors are in use.
|
||||||
|
In the sync case, there's nothing to be done for this. But in the
|
||||||
|
async case, rimraf will gradually back off with timeouts up to
|
||||||
|
`opts.emfileWait` ms, which defaults to 1000.
|
||||||
|
|
||||||
|
## options
|
||||||
|
|
||||||
|
* unlink, chmod, stat, lstat, rmdir, readdir,
|
||||||
|
unlinkSync, chmodSync, statSync, lstatSync, rmdirSync, readdirSync
|
||||||
|
|
||||||
|
In order to use a custom file system library, you can override
|
||||||
|
specific fs functions on the options object.
|
||||||
|
|
||||||
|
If any of these functions are present on the options object, then
|
||||||
|
the supplied function will be used instead of the default fs
|
||||||
|
method.
|
||||||
|
|
||||||
|
Sync methods are only relevant for `rimraf.sync()`, of course.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var myCustomFS = require('some-custom-fs')
|
||||||
|
|
||||||
|
rimraf('some-thing', myCustomFS, callback)
|
||||||
|
```
|
||||||
|
|
||||||
|
* maxBusyTries
|
||||||
|
|
||||||
|
If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error code is encountered
|
||||||
|
on Windows systems, then rimraf will retry with a linear backoff
|
||||||
|
wait of 100ms longer on each try. The default maxBusyTries is 3.
|
||||||
|
|
||||||
|
Only relevant for async usage.
|
||||||
|
|
||||||
|
* emfileWait
|
||||||
|
|
||||||
|
If an `EMFILE` error is encountered, then rimraf will retry
|
||||||
|
repeatedly with a linear backoff of 1ms longer on each try, until
|
||||||
|
the timeout counter hits this max. The default limit is 1000.
|
||||||
|
|
||||||
|
If you repeatedly encounter `EMFILE` errors, then consider using
|
||||||
|
[graceful-fs](http://npm.im/graceful-fs) in your program.
|
||||||
|
|
||||||
|
Only relevant for async usage.
|
||||||
|
|
||||||
|
* glob
|
||||||
|
|
||||||
|
Set to `false` to disable [glob](http://npm.im/glob) pattern
|
||||||
|
matching.
|
||||||
|
|
||||||
|
Set to an object to pass options to the glob module. The default
|
||||||
|
glob options are `{ nosort: true, silent: true }`.
|
||||||
|
|
||||||
|
Glob version 6 is used in this module.
|
||||||
|
|
||||||
|
Relevant for both sync and async usage.
|
||||||
|
|
||||||
|
* disableGlob
|
||||||
|
|
||||||
|
Set to any non-falsey value to disable globbing entirely.
|
||||||
|
(Equivalent to setting `glob: false`.)
|
||||||
|
|
||||||
|
## rimraf.sync
|
||||||
|
|
||||||
|
It can remove stuff synchronously, too. But that's not so good. Use
|
||||||
|
the async API. It's better.
|
||||||
|
|
||||||
|
## CLI
|
||||||
|
|
||||||
|
If installed with `npm install rimraf -g` it can be used as a global
|
||||||
|
command `rimraf <path> [<path> ...]` which is useful for cross platform support.
|
||||||
|
|
||||||
|
## mkdirp
|
||||||
|
|
||||||
|
If you need to create a directory recursively, check out
|
||||||
|
[mkdirp](https://github.com/substack/node-mkdirp).
|
||||||
50
node_modules/temp/node_modules/rimraf/bin.js
generated
vendored
Executable file
50
node_modules/temp/node_modules/rimraf/bin.js
generated
vendored
Executable file
@@ -0,0 +1,50 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
var rimraf = require('./')
|
||||||
|
|
||||||
|
var help = false
|
||||||
|
var dashdash = false
|
||||||
|
var noglob = false
|
||||||
|
var args = process.argv.slice(2).filter(function(arg) {
|
||||||
|
if (dashdash)
|
||||||
|
return !!arg
|
||||||
|
else if (arg === '--')
|
||||||
|
dashdash = true
|
||||||
|
else if (arg === '--no-glob' || arg === '-G')
|
||||||
|
noglob = true
|
||||||
|
else if (arg === '--glob' || arg === '-g')
|
||||||
|
noglob = false
|
||||||
|
else if (arg.match(/^(-+|\/)(h(elp)?|\?)$/))
|
||||||
|
help = true
|
||||||
|
else
|
||||||
|
return !!arg
|
||||||
|
})
|
||||||
|
|
||||||
|
if (help || args.length === 0) {
|
||||||
|
// If they didn't ask for help, then this is not a "success"
|
||||||
|
var log = help ? console.log : console.error
|
||||||
|
log('Usage: rimraf <path> [<path> ...]')
|
||||||
|
log('')
|
||||||
|
log(' Deletes all files and folders at "path" recursively.')
|
||||||
|
log('')
|
||||||
|
log('Options:')
|
||||||
|
log('')
|
||||||
|
log(' -h, --help Display this usage info')
|
||||||
|
log(' -G, --no-glob Do not expand glob patterns in arguments')
|
||||||
|
log(' -g, --glob Expand glob patterns in arguments (default)')
|
||||||
|
process.exit(help ? 0 : 1)
|
||||||
|
} else
|
||||||
|
go(0)
|
||||||
|
|
||||||
|
function go (n) {
|
||||||
|
if (n >= args.length)
|
||||||
|
return
|
||||||
|
var options = {}
|
||||||
|
if (noglob)
|
||||||
|
options = { glob: false }
|
||||||
|
rimraf(args[n], options, function (er) {
|
||||||
|
if (er)
|
||||||
|
throw er
|
||||||
|
go(n+1)
|
||||||
|
})
|
||||||
|
}
|
||||||
67
node_modules/temp/node_modules/rimraf/package.json
generated
vendored
Normal file
67
node_modules/temp/node_modules/rimraf/package.json
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
{
|
||||||
|
"_from": "rimraf@~2.6.2",
|
||||||
|
"_id": "rimraf@2.6.3",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==",
|
||||||
|
"_location": "/temp/rimraf",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "rimraf@~2.6.2",
|
||||||
|
"name": "rimraf",
|
||||||
|
"escapedName": "rimraf",
|
||||||
|
"rawSpec": "~2.6.2",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "~2.6.2"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/temp"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz",
|
||||||
|
"_shasum": "b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab",
|
||||||
|
"_spec": "rimraf@~2.6.2",
|
||||||
|
"_where": "/Users/Ibrahim/Desktop/test2/node_modules/temp",
|
||||||
|
"author": {
|
||||||
|
"name": "Isaac Z. Schlueter",
|
||||||
|
"email": "i@izs.me",
|
||||||
|
"url": "http://blog.izs.me/"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"rimraf": "./bin.js"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/isaacs/rimraf/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {
|
||||||
|
"glob": "^7.1.3"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "A deep deletion module for node (like `rm -rf`)",
|
||||||
|
"devDependencies": {
|
||||||
|
"mkdirp": "^0.5.1",
|
||||||
|
"tap": "^12.1.1"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"LICENSE",
|
||||||
|
"README.md",
|
||||||
|
"bin.js",
|
||||||
|
"rimraf.js"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/isaacs/rimraf#readme",
|
||||||
|
"license": "ISC",
|
||||||
|
"main": "rimraf.js",
|
||||||
|
"name": "rimraf",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/isaacs/rimraf.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"postpublish": "git push origin --all; git push origin --tags",
|
||||||
|
"postversion": "npm publish",
|
||||||
|
"preversion": "npm test",
|
||||||
|
"test": "tap test/*.js"
|
||||||
|
},
|
||||||
|
"version": "2.6.3"
|
||||||
|
}
|
||||||
364
node_modules/temp/node_modules/rimraf/rimraf.js
generated
vendored
Normal file
364
node_modules/temp/node_modules/rimraf/rimraf.js
generated
vendored
Normal file
@@ -0,0 +1,364 @@
|
|||||||
|
module.exports = rimraf
|
||||||
|
rimraf.sync = rimrafSync
|
||||||
|
|
||||||
|
var assert = require("assert")
|
||||||
|
var path = require("path")
|
||||||
|
var fs = require("fs")
|
||||||
|
var glob = require("glob")
|
||||||
|
var _0666 = parseInt('666', 8)
|
||||||
|
|
||||||
|
var defaultGlobOpts = {
|
||||||
|
nosort: true,
|
||||||
|
silent: true
|
||||||
|
}
|
||||||
|
|
||||||
|
// for EMFILE handling
|
||||||
|
var timeout = 0
|
||||||
|
|
||||||
|
var isWindows = (process.platform === "win32")
|
||||||
|
|
||||||
|
function defaults (options) {
|
||||||
|
var methods = [
|
||||||
|
'unlink',
|
||||||
|
'chmod',
|
||||||
|
'stat',
|
||||||
|
'lstat',
|
||||||
|
'rmdir',
|
||||||
|
'readdir'
|
||||||
|
]
|
||||||
|
methods.forEach(function(m) {
|
||||||
|
options[m] = options[m] || fs[m]
|
||||||
|
m = m + 'Sync'
|
||||||
|
options[m] = options[m] || fs[m]
|
||||||
|
})
|
||||||
|
|
||||||
|
options.maxBusyTries = options.maxBusyTries || 3
|
||||||
|
options.emfileWait = options.emfileWait || 1000
|
||||||
|
if (options.glob === false) {
|
||||||
|
options.disableGlob = true
|
||||||
|
}
|
||||||
|
options.disableGlob = options.disableGlob || false
|
||||||
|
options.glob = options.glob || defaultGlobOpts
|
||||||
|
}
|
||||||
|
|
||||||
|
function rimraf (p, options, cb) {
|
||||||
|
if (typeof options === 'function') {
|
||||||
|
cb = options
|
||||||
|
options = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(p, 'rimraf: missing path')
|
||||||
|
assert.equal(typeof p, 'string', 'rimraf: path should be a string')
|
||||||
|
assert.equal(typeof cb, 'function', 'rimraf: callback function required')
|
||||||
|
assert(options, 'rimraf: invalid options argument provided')
|
||||||
|
assert.equal(typeof options, 'object', 'rimraf: options should be object')
|
||||||
|
|
||||||
|
defaults(options)
|
||||||
|
|
||||||
|
var busyTries = 0
|
||||||
|
var errState = null
|
||||||
|
var n = 0
|
||||||
|
|
||||||
|
if (options.disableGlob || !glob.hasMagic(p))
|
||||||
|
return afterGlob(null, [p])
|
||||||
|
|
||||||
|
options.lstat(p, function (er, stat) {
|
||||||
|
if (!er)
|
||||||
|
return afterGlob(null, [p])
|
||||||
|
|
||||||
|
glob(p, options.glob, afterGlob)
|
||||||
|
})
|
||||||
|
|
||||||
|
function next (er) {
|
||||||
|
errState = errState || er
|
||||||
|
if (--n === 0)
|
||||||
|
cb(errState)
|
||||||
|
}
|
||||||
|
|
||||||
|
function afterGlob (er, results) {
|
||||||
|
if (er)
|
||||||
|
return cb(er)
|
||||||
|
|
||||||
|
n = results.length
|
||||||
|
if (n === 0)
|
||||||
|
return cb()
|
||||||
|
|
||||||
|
results.forEach(function (p) {
|
||||||
|
rimraf_(p, options, function CB (er) {
|
||||||
|
if (er) {
|
||||||
|
if ((er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") &&
|
||||||
|
busyTries < options.maxBusyTries) {
|
||||||
|
busyTries ++
|
||||||
|
var time = busyTries * 100
|
||||||
|
// try again, with the same exact callback as this one.
|
||||||
|
return setTimeout(function () {
|
||||||
|
rimraf_(p, options, CB)
|
||||||
|
}, time)
|
||||||
|
}
|
||||||
|
|
||||||
|
// this one won't happen if graceful-fs is used.
|
||||||
|
if (er.code === "EMFILE" && timeout < options.emfileWait) {
|
||||||
|
return setTimeout(function () {
|
||||||
|
rimraf_(p, options, CB)
|
||||||
|
}, timeout ++)
|
||||||
|
}
|
||||||
|
|
||||||
|
// already gone
|
||||||
|
if (er.code === "ENOENT") er = null
|
||||||
|
}
|
||||||
|
|
||||||
|
timeout = 0
|
||||||
|
next(er)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Two possible strategies.
|
||||||
|
// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR
|
||||||
|
// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR
|
||||||
|
//
|
||||||
|
// Both result in an extra syscall when you guess wrong. However, there
|
||||||
|
// are likely far more normal files in the world than directories. This
|
||||||
|
// is based on the assumption that a the average number of files per
|
||||||
|
// directory is >= 1.
|
||||||
|
//
|
||||||
|
// If anyone ever complains about this, then I guess the strategy could
|
||||||
|
// be made configurable somehow. But until then, YAGNI.
|
||||||
|
function rimraf_ (p, options, cb) {
|
||||||
|
assert(p)
|
||||||
|
assert(options)
|
||||||
|
assert(typeof cb === 'function')
|
||||||
|
|
||||||
|
// sunos lets the root user unlink directories, which is... weird.
|
||||||
|
// so we have to lstat here and make sure it's not a dir.
|
||||||
|
options.lstat(p, function (er, st) {
|
||||||
|
if (er && er.code === "ENOENT")
|
||||||
|
return cb(null)
|
||||||
|
|
||||||
|
// Windows can EPERM on stat. Life is suffering.
|
||||||
|
if (er && er.code === "EPERM" && isWindows)
|
||||||
|
fixWinEPERM(p, options, er, cb)
|
||||||
|
|
||||||
|
if (st && st.isDirectory())
|
||||||
|
return rmdir(p, options, er, cb)
|
||||||
|
|
||||||
|
options.unlink(p, function (er) {
|
||||||
|
if (er) {
|
||||||
|
if (er.code === "ENOENT")
|
||||||
|
return cb(null)
|
||||||
|
if (er.code === "EPERM")
|
||||||
|
return (isWindows)
|
||||||
|
? fixWinEPERM(p, options, er, cb)
|
||||||
|
: rmdir(p, options, er, cb)
|
||||||
|
if (er.code === "EISDIR")
|
||||||
|
return rmdir(p, options, er, cb)
|
||||||
|
}
|
||||||
|
return cb(er)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function fixWinEPERM (p, options, er, cb) {
|
||||||
|
assert(p)
|
||||||
|
assert(options)
|
||||||
|
assert(typeof cb === 'function')
|
||||||
|
if (er)
|
||||||
|
assert(er instanceof Error)
|
||||||
|
|
||||||
|
options.chmod(p, _0666, function (er2) {
|
||||||
|
if (er2)
|
||||||
|
cb(er2.code === "ENOENT" ? null : er)
|
||||||
|
else
|
||||||
|
options.stat(p, function(er3, stats) {
|
||||||
|
if (er3)
|
||||||
|
cb(er3.code === "ENOENT" ? null : er)
|
||||||
|
else if (stats.isDirectory())
|
||||||
|
rmdir(p, options, er, cb)
|
||||||
|
else
|
||||||
|
options.unlink(p, cb)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function fixWinEPERMSync (p, options, er) {
|
||||||
|
assert(p)
|
||||||
|
assert(options)
|
||||||
|
if (er)
|
||||||
|
assert(er instanceof Error)
|
||||||
|
|
||||||
|
try {
|
||||||
|
options.chmodSync(p, _0666)
|
||||||
|
} catch (er2) {
|
||||||
|
if (er2.code === "ENOENT")
|
||||||
|
return
|
||||||
|
else
|
||||||
|
throw er
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
var stats = options.statSync(p)
|
||||||
|
} catch (er3) {
|
||||||
|
if (er3.code === "ENOENT")
|
||||||
|
return
|
||||||
|
else
|
||||||
|
throw er
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stats.isDirectory())
|
||||||
|
rmdirSync(p, options, er)
|
||||||
|
else
|
||||||
|
options.unlinkSync(p)
|
||||||
|
}
|
||||||
|
|
||||||
|
function rmdir (p, options, originalEr, cb) {
|
||||||
|
assert(p)
|
||||||
|
assert(options)
|
||||||
|
if (originalEr)
|
||||||
|
assert(originalEr instanceof Error)
|
||||||
|
assert(typeof cb === 'function')
|
||||||
|
|
||||||
|
// try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS)
|
||||||
|
// if we guessed wrong, and it's not a directory, then
|
||||||
|
// raise the original error.
|
||||||
|
options.rmdir(p, function (er) {
|
||||||
|
if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM"))
|
||||||
|
rmkids(p, options, cb)
|
||||||
|
else if (er && er.code === "ENOTDIR")
|
||||||
|
cb(originalEr)
|
||||||
|
else
|
||||||
|
cb(er)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function rmkids(p, options, cb) {
|
||||||
|
assert(p)
|
||||||
|
assert(options)
|
||||||
|
assert(typeof cb === 'function')
|
||||||
|
|
||||||
|
options.readdir(p, function (er, files) {
|
||||||
|
if (er)
|
||||||
|
return cb(er)
|
||||||
|
var n = files.length
|
||||||
|
if (n === 0)
|
||||||
|
return options.rmdir(p, cb)
|
||||||
|
var errState
|
||||||
|
files.forEach(function (f) {
|
||||||
|
rimraf(path.join(p, f), options, function (er) {
|
||||||
|
if (errState)
|
||||||
|
return
|
||||||
|
if (er)
|
||||||
|
return cb(errState = er)
|
||||||
|
if (--n === 0)
|
||||||
|
options.rmdir(p, cb)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// this looks simpler, and is strictly *faster*, but will
|
||||||
|
// tie up the JavaScript thread and fail on excessively
|
||||||
|
// deep directory trees.
|
||||||
|
function rimrafSync (p, options) {
|
||||||
|
options = options || {}
|
||||||
|
defaults(options)
|
||||||
|
|
||||||
|
assert(p, 'rimraf: missing path')
|
||||||
|
assert.equal(typeof p, 'string', 'rimraf: path should be a string')
|
||||||
|
assert(options, 'rimraf: missing options')
|
||||||
|
assert.equal(typeof options, 'object', 'rimraf: options should be object')
|
||||||
|
|
||||||
|
var results
|
||||||
|
|
||||||
|
if (options.disableGlob || !glob.hasMagic(p)) {
|
||||||
|
results = [p]
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
options.lstatSync(p)
|
||||||
|
results = [p]
|
||||||
|
} catch (er) {
|
||||||
|
results = glob.sync(p, options.glob)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!results.length)
|
||||||
|
return
|
||||||
|
|
||||||
|
for (var i = 0; i < results.length; i++) {
|
||||||
|
var p = results[i]
|
||||||
|
|
||||||
|
try {
|
||||||
|
var st = options.lstatSync(p)
|
||||||
|
} catch (er) {
|
||||||
|
if (er.code === "ENOENT")
|
||||||
|
return
|
||||||
|
|
||||||
|
// Windows can EPERM on stat. Life is suffering.
|
||||||
|
if (er.code === "EPERM" && isWindows)
|
||||||
|
fixWinEPERMSync(p, options, er)
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// sunos lets the root user unlink directories, which is... weird.
|
||||||
|
if (st && st.isDirectory())
|
||||||
|
rmdirSync(p, options, null)
|
||||||
|
else
|
||||||
|
options.unlinkSync(p)
|
||||||
|
} catch (er) {
|
||||||
|
if (er.code === "ENOENT")
|
||||||
|
return
|
||||||
|
if (er.code === "EPERM")
|
||||||
|
return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er)
|
||||||
|
if (er.code !== "EISDIR")
|
||||||
|
throw er
|
||||||
|
|
||||||
|
rmdirSync(p, options, er)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function rmdirSync (p, options, originalEr) {
|
||||||
|
assert(p)
|
||||||
|
assert(options)
|
||||||
|
if (originalEr)
|
||||||
|
assert(originalEr instanceof Error)
|
||||||
|
|
||||||
|
try {
|
||||||
|
options.rmdirSync(p)
|
||||||
|
} catch (er) {
|
||||||
|
if (er.code === "ENOENT")
|
||||||
|
return
|
||||||
|
if (er.code === "ENOTDIR")
|
||||||
|
throw originalEr
|
||||||
|
if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")
|
||||||
|
rmkidsSync(p, options)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function rmkidsSync (p, options) {
|
||||||
|
assert(p)
|
||||||
|
assert(options)
|
||||||
|
options.readdirSync(p).forEach(function (f) {
|
||||||
|
rimrafSync(path.join(p, f), options)
|
||||||
|
})
|
||||||
|
|
||||||
|
// We only end up here once we got ENOTEMPTY at least once, and
|
||||||
|
// at this point, we are guaranteed to have removed all the kids.
|
||||||
|
// So, we know that it won't be ENOENT or ENOTDIR or anything else.
|
||||||
|
// try really hard to delete stuff on windows, because it has a
|
||||||
|
// PROFOUNDLY annoying habit of not closing handles promptly when
|
||||||
|
// files are deleted, resulting in spurious ENOTEMPTY errors.
|
||||||
|
var retries = isWindows ? 100 : 1
|
||||||
|
var i = 0
|
||||||
|
do {
|
||||||
|
var threw = true
|
||||||
|
try {
|
||||||
|
var ret = options.rmdirSync(p, options)
|
||||||
|
threw = false
|
||||||
|
return ret
|
||||||
|
} finally {
|
||||||
|
if (++i < retries && threw)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
} while (true)
|
||||||
|
}
|
||||||
83
node_modules/temp/package.json
generated
vendored
Normal file
83
node_modules/temp/package.json
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
{
|
||||||
|
"_from": "temp",
|
||||||
|
"_id": "temp@0.9.1",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-WMuOgiua1xb5R56lE0eH6ivpVmg/lq2OHm4+LtT/xtEtPQ+sz6N3bBM6WZ5FvO1lO4IKIOb43qnhoc4qxP5OeA==",
|
||||||
|
"_location": "/temp",
|
||||||
|
"_phantomChildren": {
|
||||||
|
"glob": "7.1.6"
|
||||||
|
},
|
||||||
|
"_requested": {
|
||||||
|
"type": "tag",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "temp",
|
||||||
|
"name": "temp",
|
||||||
|
"escapedName": "temp",
|
||||||
|
"rawSpec": "",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "latest"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"#USER",
|
||||||
|
"/"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/temp/-/temp-0.9.1.tgz",
|
||||||
|
"_shasum": "2d666114fafa26966cd4065996d7ceedd4dd4697",
|
||||||
|
"_spec": "temp",
|
||||||
|
"_where": "/Users/Ibrahim/Desktop/test2",
|
||||||
|
"author": {
|
||||||
|
"name": "Bruce Williams",
|
||||||
|
"email": "brwcodes@gmail.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/bruce/node-temp/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {
|
||||||
|
"rimraf": "~2.6.2"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Temporary files and directories",
|
||||||
|
"devDependencies": {
|
||||||
|
"mocha": "6.2.2"
|
||||||
|
},
|
||||||
|
"directories": {
|
||||||
|
"lib": "lib"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.0.0"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"lib"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/bruce/node-temp#readme",
|
||||||
|
"keywords": [
|
||||||
|
"temporary",
|
||||||
|
"tmp",
|
||||||
|
"temp",
|
||||||
|
"tempdir",
|
||||||
|
"tempfile",
|
||||||
|
"tmpdir",
|
||||||
|
"tmpfile"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "./lib/temp",
|
||||||
|
"name": "temp",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/bruce/node-temp.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "mocha test/temp-test.js"
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
"temporary",
|
||||||
|
"temp",
|
||||||
|
"tempfile",
|
||||||
|
"tempdir",
|
||||||
|
"tmpfile",
|
||||||
|
"tmpdir",
|
||||||
|
"security"
|
||||||
|
],
|
||||||
|
"version": "0.9.1"
|
||||||
|
}
|
||||||
21
node_modules/tmp/LICENSE
generated
vendored
Normal file
21
node_modules/tmp/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2014 KARASZI István
|
||||||
|
|
||||||
|
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.
|
||||||
358
node_modules/tmp/README.md
generated
vendored
Normal file
358
node_modules/tmp/README.md
generated
vendored
Normal file
@@ -0,0 +1,358 @@
|
|||||||
|
# Tmp
|
||||||
|
|
||||||
|
A simple temporary file and directory creator for [node.js.][1]
|
||||||
|
|
||||||
|
[](https://travis-ci.org/raszi/node-tmp)
|
||||||
|
[](https://david-dm.org/raszi/node-tmp)
|
||||||
|
[](https://badge.fury.io/js/tmp)
|
||||||
|
[](https://raszi.github.io/node-tmp/)
|
||||||
|
[](https://snyk.io/test/npm/tmp)
|
||||||
|
|
||||||
|
## About
|
||||||
|
|
||||||
|
This is a [widely used library][2] to create temporary files and directories
|
||||||
|
in a [node.js][1] environment.
|
||||||
|
|
||||||
|
Tmp offers both an asynchronous and a synchronous API. For all API calls, all
|
||||||
|
the parameters are optional. There also exists a promisified version of the
|
||||||
|
API, see [tmp-promise][5].
|
||||||
|
|
||||||
|
Tmp uses crypto for determining random file names, or, when using templates,
|
||||||
|
a six letter random identifier. And just in case that you do not have that much
|
||||||
|
entropy left on your system, Tmp will fall back to pseudo random numbers.
|
||||||
|
|
||||||
|
You can set whether you want to remove the temporary file on process exit or
|
||||||
|
not.
|
||||||
|
|
||||||
|
If you do not want to store your temporary directories and files in the
|
||||||
|
standard OS temporary directory, then you are free to override that as well.
|
||||||
|
|
||||||
|
## An Important Note on Compatibility
|
||||||
|
|
||||||
|
### Version 0.1.0
|
||||||
|
|
||||||
|
Since version 0.1.0, all support for node versions < 0.10.0 has been dropped.
|
||||||
|
|
||||||
|
Most importantly, any support for earlier versions of node-tmp was also dropped.
|
||||||
|
|
||||||
|
If you still require node versions < 0.10.0, then you must limit your node-tmp
|
||||||
|
dependency to versions below 0.1.0.
|
||||||
|
|
||||||
|
### Version 0.0.33
|
||||||
|
|
||||||
|
Since version 0.0.33, all support for node versions < 0.8 has been dropped.
|
||||||
|
|
||||||
|
If you still require node version 0.8, then you must limit your node-tmp
|
||||||
|
dependency to version 0.0.33.
|
||||||
|
|
||||||
|
For node versions < 0.8 you must limit your node-tmp dependency to
|
||||||
|
versions < 0.0.33.
|
||||||
|
|
||||||
|
### Node Versions < 8.12.0
|
||||||
|
|
||||||
|
The SIGINT handler will not work correctly with versions of NodeJS < 8.12.0.
|
||||||
|
|
||||||
|
### Windows
|
||||||
|
|
||||||
|
Signal handlers for SIGINT will not work. Pressing CTRL-C will leave behind
|
||||||
|
temporary files and directories.
|
||||||
|
|
||||||
|
## How to install
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install tmp
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Please also check [API docs][4].
|
||||||
|
|
||||||
|
### Asynchronous file creation
|
||||||
|
|
||||||
|
Simple temporary file creation, the file will be closed and unlinked on process exit.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var tmp = require('tmp');
|
||||||
|
|
||||||
|
tmp.file(function _tempFileCreated(err, path, fd, cleanupCallback) {
|
||||||
|
if (err) throw err;
|
||||||
|
|
||||||
|
console.log('File: ', path);
|
||||||
|
console.log('Filedescriptor: ', fd);
|
||||||
|
|
||||||
|
// If we don't need the file anymore we could manually call the cleanupCallback
|
||||||
|
// But that is not necessary if we didn't pass the keep option because the library
|
||||||
|
// will clean after itself.
|
||||||
|
cleanupCallback();
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Synchronous file creation
|
||||||
|
|
||||||
|
A synchronous version of the above.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var tmp = require('tmp');
|
||||||
|
|
||||||
|
var tmpobj = tmp.fileSync();
|
||||||
|
console.log('File: ', tmpobj.name);
|
||||||
|
console.log('Filedescriptor: ', tmpobj.fd);
|
||||||
|
|
||||||
|
// If we don't need the file anymore we could manually call the removeCallback
|
||||||
|
// But that is not necessary if we didn't pass the keep option because the library
|
||||||
|
// will clean after itself.
|
||||||
|
tmpobj.removeCallback();
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that this might throw an exception if either the maximum limit of retries
|
||||||
|
for creating a temporary name fails, or, in case that you do not have the permission
|
||||||
|
to write to the directory where the temporary file should be created in.
|
||||||
|
|
||||||
|
### Asynchronous directory creation
|
||||||
|
|
||||||
|
Simple temporary directory creation, it will be removed on process exit.
|
||||||
|
|
||||||
|
If the directory still contains items on process exit, then it won't be removed.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var tmp = require('tmp');
|
||||||
|
|
||||||
|
tmp.dir(function _tempDirCreated(err, path, cleanupCallback) {
|
||||||
|
if (err) throw err;
|
||||||
|
|
||||||
|
console.log('Dir: ', path);
|
||||||
|
|
||||||
|
// Manual cleanup
|
||||||
|
cleanupCallback();
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
If you want to cleanup the directory even when there are entries in it, then
|
||||||
|
you can pass the `unsafeCleanup` option when creating it.
|
||||||
|
|
||||||
|
### Synchronous directory creation
|
||||||
|
|
||||||
|
A synchronous version of the above.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var tmp = require('tmp');
|
||||||
|
|
||||||
|
var tmpobj = tmp.dirSync();
|
||||||
|
console.log('Dir: ', tmpobj.name);
|
||||||
|
// Manual cleanup
|
||||||
|
tmpobj.removeCallback();
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that this might throw an exception if either the maximum limit of retries
|
||||||
|
for creating a temporary name fails, or, in case that you do not have the permission
|
||||||
|
to write to the directory where the temporary directory should be created in.
|
||||||
|
|
||||||
|
### Asynchronous filename generation
|
||||||
|
|
||||||
|
It is possible with this library to generate a unique filename in the specified
|
||||||
|
directory.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var tmp = require('tmp');
|
||||||
|
|
||||||
|
tmp.tmpName(function _tempNameGenerated(err, path) {
|
||||||
|
if (err) throw err;
|
||||||
|
|
||||||
|
console.log('Created temporary filename: ', path);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Synchronous filename generation
|
||||||
|
|
||||||
|
A synchronous version of the above.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var tmp = require('tmp');
|
||||||
|
|
||||||
|
var name = tmp.tmpNameSync();
|
||||||
|
console.log('Created temporary filename: ', name);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Advanced usage
|
||||||
|
|
||||||
|
### Asynchronous file creation
|
||||||
|
|
||||||
|
Creates a file with mode `0644`, prefix will be `prefix-` and postfix will be `.txt`.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var tmp = require('tmp');
|
||||||
|
|
||||||
|
tmp.file({ mode: 0644, prefix: 'prefix-', postfix: '.txt' }, function _tempFileCreated(err, path, fd) {
|
||||||
|
if (err) throw err;
|
||||||
|
|
||||||
|
console.log('File: ', path);
|
||||||
|
console.log('Filedescriptor: ', fd);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Synchronous file creation
|
||||||
|
|
||||||
|
A synchronous version of the above.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var tmp = require('tmp');
|
||||||
|
|
||||||
|
var tmpobj = tmp.fileSync({ mode: 0644, prefix: 'prefix-', postfix: '.txt' });
|
||||||
|
console.log('File: ', tmpobj.name);
|
||||||
|
console.log('Filedescriptor: ', tmpobj.fd);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Controlling the Descriptor
|
||||||
|
|
||||||
|
As a side effect of creating a unique file `tmp` gets a file descriptor that is
|
||||||
|
returned to the user as the `fd` parameter. The descriptor may be used by the
|
||||||
|
application and is closed when the `removeCallback` is invoked.
|
||||||
|
|
||||||
|
In some use cases the application does not need the descriptor, needs to close it
|
||||||
|
without removing the file, or needs to remove the file without closing the
|
||||||
|
descriptor. Two options control how the descriptor is managed:
|
||||||
|
|
||||||
|
* `discardDescriptor` - if `true` causes `tmp` to close the descriptor after the file
|
||||||
|
is created. In this case the `fd` parameter is undefined.
|
||||||
|
* `detachDescriptor` - if `true` causes `tmp` to return the descriptor in the `fd`
|
||||||
|
parameter, but it is the application's responsibility to close it when it is no
|
||||||
|
longer needed.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var tmp = require('tmp');
|
||||||
|
|
||||||
|
tmp.file({ discardDescriptor: true }, function _tempFileCreated(err, path, fd, cleanupCallback) {
|
||||||
|
if (err) throw err;
|
||||||
|
// fd will be undefined, allowing application to use fs.createReadStream(path)
|
||||||
|
// without holding an unused descriptor open.
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var tmp = require('tmp');
|
||||||
|
|
||||||
|
tmp.file({ detachDescriptor: true }, function _tempFileCreated(err, path, fd, cleanupCallback) {
|
||||||
|
if (err) throw err;
|
||||||
|
|
||||||
|
cleanupCallback();
|
||||||
|
// Application can store data through fd here; the space used will automatically
|
||||||
|
// be reclaimed by the operating system when the descriptor is closed or program
|
||||||
|
// terminates.
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Asynchronous directory creation
|
||||||
|
|
||||||
|
Creates a directory with mode `0755`, prefix will be `myTmpDir_`.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var tmp = require('tmp');
|
||||||
|
|
||||||
|
tmp.dir({ mode: 0750, prefix: 'myTmpDir_' }, function _tempDirCreated(err, path) {
|
||||||
|
if (err) throw err;
|
||||||
|
|
||||||
|
console.log('Dir: ', path);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Synchronous directory creation
|
||||||
|
|
||||||
|
Again, a synchronous version of the above.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var tmp = require('tmp');
|
||||||
|
|
||||||
|
var tmpobj = tmp.dirSync({ mode: 0750, prefix: 'myTmpDir_' });
|
||||||
|
console.log('Dir: ', tmpobj.name);
|
||||||
|
```
|
||||||
|
|
||||||
|
### mkstemp like, asynchronously
|
||||||
|
|
||||||
|
Creates a new temporary directory with mode `0700` and filename like `/tmp/tmp-nk2J1u`.
|
||||||
|
|
||||||
|
IMPORTANT NOTE: template no longer accepts a path. Use the dir option instead if you
|
||||||
|
require tmp to create your temporary filesystem object in a different place than the
|
||||||
|
default `tmp.tmpdir`.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var tmp = require('tmp');
|
||||||
|
|
||||||
|
tmp.dir({ template: 'tmp-XXXXXX' }, function _tempDirCreated(err, path) {
|
||||||
|
if (err) throw err;
|
||||||
|
|
||||||
|
console.log('Dir: ', path);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### mkstemp like, synchronously
|
||||||
|
|
||||||
|
This will behave similarly to the asynchronous version.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var tmp = require('tmp');
|
||||||
|
|
||||||
|
var tmpobj = tmp.dirSync({ template: 'tmp-XXXXXX' });
|
||||||
|
console.log('Dir: ', tmpobj.name);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Asynchronous filename generation
|
||||||
|
|
||||||
|
Using `tmpName()` you can create temporary file names asynchronously.
|
||||||
|
The function accepts all standard options, e.g. `prefix`, `postfix`, `dir`, and so on.
|
||||||
|
|
||||||
|
You can also leave out the options altogether and just call the function with a callback as first parameter.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var tmp = require('tmp');
|
||||||
|
|
||||||
|
var options = {};
|
||||||
|
|
||||||
|
tmp.tmpName(options, function _tempNameGenerated(err, path) {
|
||||||
|
if (err) throw err;
|
||||||
|
|
||||||
|
console.log('Created temporary filename: ', path);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Synchronous filename generation
|
||||||
|
|
||||||
|
The `tmpNameSync()` function works similarly to `tmpName()`.
|
||||||
|
Again, you can leave out the options altogether and just invoke the function without any parameters.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var tmp = require('tmp');
|
||||||
|
var options = {};
|
||||||
|
var tmpname = tmp.tmpNameSync(options);
|
||||||
|
console.log('Created temporary filename: ', tmpname);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Graceful cleanup
|
||||||
|
|
||||||
|
One may want to cleanup the temporary files even when an uncaught exception
|
||||||
|
occurs. To enforce this, you can call the `setGracefulCleanup()` method:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var tmp = require('tmp');
|
||||||
|
|
||||||
|
tmp.setGracefulCleanup();
|
||||||
|
```
|
||||||
|
|
||||||
|
## Options
|
||||||
|
|
||||||
|
All options are optional :)
|
||||||
|
|
||||||
|
* `mode`: the file mode to create with, it fallbacks to `0600` on file creation and `0700` on directory creation
|
||||||
|
* `prefix`: the optional prefix, fallbacks to `tmp-` if not provided
|
||||||
|
* `postfix`: the optional postfix, fallbacks to `.tmp` on file creation
|
||||||
|
* `template`: [`mkstemp`][3] like filename template, no default
|
||||||
|
* `dir`: the optional temporary directory, fallbacks to system default (guesses from environment)
|
||||||
|
* `tries`: how many times should the function try to get a unique filename before giving up, default `3`
|
||||||
|
* `keep`: signals that the temporary file or directory should not be deleted on exit, default is `false`
|
||||||
|
* In order to clean up, you will have to call the provided `cleanupCallback` function manually.
|
||||||
|
* `unsafeCleanup`: recursively removes the created temporary directory, even when it's not empty. default is `false`
|
||||||
|
|
||||||
|
[1]: http://nodejs.org/
|
||||||
|
[2]: https://www.npmjs.com/browse/depended/tmp
|
||||||
|
[3]: http://www.kernel.org/doc/man-pages/online/pages/man3/mkstemp.3.html
|
||||||
|
[4]: https://raszi.github.io/node-tmp/
|
||||||
|
[5]: https://github.com/benjamingr/tmp-promise
|
||||||
762
node_modules/tmp/lib/tmp.js
generated
vendored
Normal file
762
node_modules/tmp/lib/tmp.js
generated
vendored
Normal file
@@ -0,0 +1,762 @@
|
|||||||
|
/*!
|
||||||
|
* Tmp
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011-2017 KARASZI Istvan <github@spam.raszi.hu>
|
||||||
|
*
|
||||||
|
* MIT Licensed
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Module dependencies.
|
||||||
|
*/
|
||||||
|
const fs = require('fs');
|
||||||
|
const os = require('os');
|
||||||
|
const path = require('path');
|
||||||
|
const crypto = require('crypto');
|
||||||
|
const _c = fs.constants && os.constants ?
|
||||||
|
{ fs: fs.constants, os: os.constants } :
|
||||||
|
process.binding('constants');
|
||||||
|
const rimraf = require('rimraf');
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The working inner variables.
|
||||||
|
*/
|
||||||
|
const
|
||||||
|
// the random characters to choose from
|
||||||
|
RANDOM_CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',
|
||||||
|
|
||||||
|
TEMPLATE_PATTERN = /XXXXXX/,
|
||||||
|
|
||||||
|
DEFAULT_TRIES = 3,
|
||||||
|
|
||||||
|
CREATE_FLAGS = (_c.O_CREAT || _c.fs.O_CREAT) | (_c.O_EXCL || _c.fs.O_EXCL) | (_c.O_RDWR || _c.fs.O_RDWR),
|
||||||
|
|
||||||
|
EBADF = _c.EBADF || _c.os.errno.EBADF,
|
||||||
|
ENOENT = _c.ENOENT || _c.os.errno.ENOENT,
|
||||||
|
|
||||||
|
DIR_MODE = 448 /* 0o700 */,
|
||||||
|
FILE_MODE = 384 /* 0o600 */,
|
||||||
|
|
||||||
|
EXIT = 'exit',
|
||||||
|
|
||||||
|
SIGINT = 'SIGINT',
|
||||||
|
|
||||||
|
// this will hold the objects need to be removed on exit
|
||||||
|
_removeObjects = [];
|
||||||
|
|
||||||
|
var
|
||||||
|
_gracefulCleanup = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Random name generator based on crypto.
|
||||||
|
* Adapted from http://blog.tompawlak.org/how-to-generate-random-values-nodejs-javascript
|
||||||
|
*
|
||||||
|
* @param {number} howMany
|
||||||
|
* @returns {string} the generated random name
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
function _randomChars(howMany) {
|
||||||
|
var
|
||||||
|
value = [],
|
||||||
|
rnd = null;
|
||||||
|
|
||||||
|
// make sure that we do not fail because we ran out of entropy
|
||||||
|
try {
|
||||||
|
rnd = crypto.randomBytes(howMany);
|
||||||
|
} catch (e) {
|
||||||
|
rnd = crypto.pseudoRandomBytes(howMany);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < howMany; i++) {
|
||||||
|
value.push(RANDOM_CHARS[rnd[i] % RANDOM_CHARS.length]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value.join('');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the `obj` parameter is defined or not.
|
||||||
|
*
|
||||||
|
* @param {Object} obj
|
||||||
|
* @returns {boolean} true if the object is undefined
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
function _isUndefined(obj) {
|
||||||
|
return typeof obj === 'undefined';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses the function arguments.
|
||||||
|
*
|
||||||
|
* This function helps to have optional arguments.
|
||||||
|
*
|
||||||
|
* @param {(Options|Function)} options
|
||||||
|
* @param {Function} callback
|
||||||
|
* @returns {Array} parsed arguments
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
function _parseArguments(options, callback) {
|
||||||
|
/* istanbul ignore else */
|
||||||
|
if (typeof options === 'function') {
|
||||||
|
return [{}, options];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* istanbul ignore else */
|
||||||
|
if (_isUndefined(options)) {
|
||||||
|
return [{}, callback];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [options, callback];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a new temporary name.
|
||||||
|
*
|
||||||
|
* @param {Object} opts
|
||||||
|
* @returns {string} the new random name according to opts
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
function _generateTmpName(opts) {
|
||||||
|
|
||||||
|
const tmpDir = _getTmpDir();
|
||||||
|
|
||||||
|
// fail early on missing tmp dir
|
||||||
|
if (isBlank(opts.dir) && isBlank(tmpDir)) {
|
||||||
|
throw new Error('No tmp dir specified');
|
||||||
|
}
|
||||||
|
|
||||||
|
/* istanbul ignore else */
|
||||||
|
if (!isBlank(opts.name)) {
|
||||||
|
return path.join(opts.dir || tmpDir, opts.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
// mkstemps like template
|
||||||
|
// opts.template has already been guarded in tmpName() below
|
||||||
|
/* istanbul ignore else */
|
||||||
|
if (opts.template) {
|
||||||
|
var template = opts.template;
|
||||||
|
// make sure that we prepend the tmp path if none was given
|
||||||
|
/* istanbul ignore else */
|
||||||
|
if (path.basename(template) === template)
|
||||||
|
template = path.join(opts.dir || tmpDir, template);
|
||||||
|
return template.replace(TEMPLATE_PATTERN, _randomChars(6));
|
||||||
|
}
|
||||||
|
|
||||||
|
// prefix and postfix
|
||||||
|
const name = [
|
||||||
|
(isBlank(opts.prefix) ? 'tmp-' : opts.prefix),
|
||||||
|
process.pid,
|
||||||
|
_randomChars(12),
|
||||||
|
(opts.postfix ? opts.postfix : '')
|
||||||
|
].join('');
|
||||||
|
|
||||||
|
return path.join(opts.dir || tmpDir, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a temporary file name.
|
||||||
|
*
|
||||||
|
* @param {(Options|tmpNameCallback)} options options or callback
|
||||||
|
* @param {?tmpNameCallback} callback the callback function
|
||||||
|
*/
|
||||||
|
function tmpName(options, callback) {
|
||||||
|
var
|
||||||
|
args = _parseArguments(options, callback),
|
||||||
|
opts = args[0],
|
||||||
|
cb = args[1],
|
||||||
|
tries = !isBlank(opts.name) ? 1 : opts.tries || DEFAULT_TRIES;
|
||||||
|
|
||||||
|
/* istanbul ignore else */
|
||||||
|
if (isNaN(tries) || tries < 0)
|
||||||
|
return cb(new Error('Invalid tries'));
|
||||||
|
|
||||||
|
/* istanbul ignore else */
|
||||||
|
if (opts.template && !opts.template.match(TEMPLATE_PATTERN))
|
||||||
|
return cb(new Error('Invalid template provided'));
|
||||||
|
|
||||||
|
(function _getUniqueName() {
|
||||||
|
try {
|
||||||
|
const name = _generateTmpName(opts);
|
||||||
|
|
||||||
|
// check whether the path exists then retry if needed
|
||||||
|
fs.stat(name, function (err) {
|
||||||
|
/* istanbul ignore else */
|
||||||
|
if (!err) {
|
||||||
|
/* istanbul ignore else */
|
||||||
|
if (tries-- > 0) return _getUniqueName();
|
||||||
|
|
||||||
|
return cb(new Error('Could not get a unique tmp filename, max tries reached ' + name));
|
||||||
|
}
|
||||||
|
|
||||||
|
cb(null, name);
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
cb(err);
|
||||||
|
}
|
||||||
|
}());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Synchronous version of tmpName.
|
||||||
|
*
|
||||||
|
* @param {Object} options
|
||||||
|
* @returns {string} the generated random name
|
||||||
|
* @throws {Error} if the options are invalid or could not generate a filename
|
||||||
|
*/
|
||||||
|
function tmpNameSync(options) {
|
||||||
|
var
|
||||||
|
args = _parseArguments(options),
|
||||||
|
opts = args[0],
|
||||||
|
tries = !isBlank(opts.name) ? 1 : opts.tries || DEFAULT_TRIES;
|
||||||
|
|
||||||
|
/* istanbul ignore else */
|
||||||
|
if (isNaN(tries) || tries < 0)
|
||||||
|
throw new Error('Invalid tries');
|
||||||
|
|
||||||
|
/* istanbul ignore else */
|
||||||
|
if (opts.template && !opts.template.match(TEMPLATE_PATTERN))
|
||||||
|
throw new Error('Invalid template provided');
|
||||||
|
|
||||||
|
do {
|
||||||
|
const name = _generateTmpName(opts);
|
||||||
|
try {
|
||||||
|
fs.statSync(name);
|
||||||
|
} catch (e) {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
} while (tries-- > 0);
|
||||||
|
|
||||||
|
throw new Error('Could not get a unique tmp filename, max tries reached');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates and opens a temporary file.
|
||||||
|
*
|
||||||
|
* @param {(Options|fileCallback)} options the config options or the callback function
|
||||||
|
* @param {?fileCallback} callback
|
||||||
|
*/
|
||||||
|
function file(options, callback) {
|
||||||
|
var
|
||||||
|
args = _parseArguments(options, callback),
|
||||||
|
opts = args[0],
|
||||||
|
cb = args[1];
|
||||||
|
|
||||||
|
// gets a temporary filename
|
||||||
|
tmpName(opts, function _tmpNameCreated(err, name) {
|
||||||
|
/* istanbul ignore else */
|
||||||
|
if (err) return cb(err);
|
||||||
|
|
||||||
|
// create and open the file
|
||||||
|
fs.open(name, CREATE_FLAGS, opts.mode || FILE_MODE, function _fileCreated(err, fd) {
|
||||||
|
/* istanbul ignore else */
|
||||||
|
if (err) return cb(err);
|
||||||
|
|
||||||
|
if (opts.discardDescriptor) {
|
||||||
|
return fs.close(fd, function _discardCallback(err) {
|
||||||
|
/* istanbul ignore else */
|
||||||
|
if (err) {
|
||||||
|
// Low probability, and the file exists, so this could be
|
||||||
|
// ignored. If it isn't we certainly need to unlink the
|
||||||
|
// file, and if that fails too its error is more
|
||||||
|
// important.
|
||||||
|
try {
|
||||||
|
fs.unlinkSync(name);
|
||||||
|
} catch (e) {
|
||||||
|
if (!isENOENT(e)) {
|
||||||
|
err = e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cb(err);
|
||||||
|
}
|
||||||
|
cb(null, name, undefined, _prepareTmpFileRemoveCallback(name, -1, opts));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/* istanbul ignore else */
|
||||||
|
if (opts.detachDescriptor) {
|
||||||
|
return cb(null, name, fd, _prepareTmpFileRemoveCallback(name, -1, opts));
|
||||||
|
}
|
||||||
|
cb(null, name, fd, _prepareTmpFileRemoveCallback(name, fd, opts));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Synchronous version of file.
|
||||||
|
*
|
||||||
|
* @param {Options} options
|
||||||
|
* @returns {FileSyncObject} object consists of name, fd and removeCallback
|
||||||
|
* @throws {Error} if cannot create a file
|
||||||
|
*/
|
||||||
|
function fileSync(options) {
|
||||||
|
var
|
||||||
|
args = _parseArguments(options),
|
||||||
|
opts = args[0];
|
||||||
|
|
||||||
|
const discardOrDetachDescriptor = opts.discardDescriptor || opts.detachDescriptor;
|
||||||
|
const name = tmpNameSync(opts);
|
||||||
|
var fd = fs.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE);
|
||||||
|
/* istanbul ignore else */
|
||||||
|
if (opts.discardDescriptor) {
|
||||||
|
fs.closeSync(fd);
|
||||||
|
fd = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
name: name,
|
||||||
|
fd: fd,
|
||||||
|
removeCallback: _prepareTmpFileRemoveCallback(name, discardOrDetachDescriptor ? -1 : fd, opts)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a temporary directory.
|
||||||
|
*
|
||||||
|
* @param {(Options|dirCallback)} options the options or the callback function
|
||||||
|
* @param {?dirCallback} callback
|
||||||
|
*/
|
||||||
|
function dir(options, callback) {
|
||||||
|
var
|
||||||
|
args = _parseArguments(options, callback),
|
||||||
|
opts = args[0],
|
||||||
|
cb = args[1];
|
||||||
|
|
||||||
|
// gets a temporary filename
|
||||||
|
tmpName(opts, function _tmpNameCreated(err, name) {
|
||||||
|
/* istanbul ignore else */
|
||||||
|
if (err) return cb(err);
|
||||||
|
|
||||||
|
// create the directory
|
||||||
|
fs.mkdir(name, opts.mode || DIR_MODE, function _dirCreated(err) {
|
||||||
|
/* istanbul ignore else */
|
||||||
|
if (err) return cb(err);
|
||||||
|
|
||||||
|
cb(null, name, _prepareTmpDirRemoveCallback(name, opts));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Synchronous version of dir.
|
||||||
|
*
|
||||||
|
* @param {Options} options
|
||||||
|
* @returns {DirSyncObject} object consists of name and removeCallback
|
||||||
|
* @throws {Error} if it cannot create a directory
|
||||||
|
*/
|
||||||
|
function dirSync(options) {
|
||||||
|
var
|
||||||
|
args = _parseArguments(options),
|
||||||
|
opts = args[0];
|
||||||
|
|
||||||
|
const name = tmpNameSync(opts);
|
||||||
|
fs.mkdirSync(name, opts.mode || DIR_MODE);
|
||||||
|
|
||||||
|
return {
|
||||||
|
name: name,
|
||||||
|
removeCallback: _prepareTmpDirRemoveCallback(name, opts)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes files asynchronously.
|
||||||
|
*
|
||||||
|
* @param {Object} fdPath
|
||||||
|
* @param {Function} next
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
function _removeFileAsync(fdPath, next) {
|
||||||
|
const _handler = function (err) {
|
||||||
|
if (err && !isENOENT(err)) {
|
||||||
|
// reraise any unanticipated error
|
||||||
|
return next(err);
|
||||||
|
}
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 <= fdPath[0])
|
||||||
|
fs.close(fdPath[0], function (err) {
|
||||||
|
fs.unlink(fdPath[1], _handler);
|
||||||
|
});
|
||||||
|
else fs.unlink(fdPath[1], _handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes files synchronously.
|
||||||
|
*
|
||||||
|
* @param {Object} fdPath
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
function _removeFileSync(fdPath) {
|
||||||
|
try {
|
||||||
|
if (0 <= fdPath[0]) fs.closeSync(fdPath[0]);
|
||||||
|
} catch (e) {
|
||||||
|
// reraise any unanticipated error
|
||||||
|
if (!isEBADF(e) && !isENOENT(e)) throw e;
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
fs.unlinkSync(fdPath[1]);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
// reraise any unanticipated error
|
||||||
|
if (!isENOENT(e)) throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepares the callback for removal of the temporary file.
|
||||||
|
*
|
||||||
|
* @param {string} name the path of the file
|
||||||
|
* @param {number} fd file descriptor
|
||||||
|
* @param {Object} opts
|
||||||
|
* @returns {fileCallback}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
function _prepareTmpFileRemoveCallback(name, fd, opts) {
|
||||||
|
const removeCallbackSync = _prepareRemoveCallback(_removeFileSync, [fd, name]);
|
||||||
|
const removeCallback = _prepareRemoveCallback(_removeFileAsync, [fd, name], removeCallbackSync);
|
||||||
|
|
||||||
|
if (!opts.keep) _removeObjects.unshift(removeCallbackSync);
|
||||||
|
|
||||||
|
return removeCallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple wrapper for rimraf.
|
||||||
|
*
|
||||||
|
* @param {string} dirPath
|
||||||
|
* @param {Function} next
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
function _rimrafRemoveDirWrapper(dirPath, next) {
|
||||||
|
rimraf(dirPath, next);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple wrapper for rimraf.sync.
|
||||||
|
*
|
||||||
|
* @param {string} dirPath
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
function _rimrafRemoveDirSyncWrapper(dirPath, next) {
|
||||||
|
try {
|
||||||
|
return next(null, rimraf.sync(dirPath));
|
||||||
|
} catch (err) {
|
||||||
|
return next(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepares the callback for removal of the temporary directory.
|
||||||
|
*
|
||||||
|
* @param {string} name
|
||||||
|
* @param {Object} opts
|
||||||
|
* @returns {Function} the callback
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
function _prepareTmpDirRemoveCallback(name, opts) {
|
||||||
|
const removeFunction = opts.unsafeCleanup ? _rimrafRemoveDirWrapper : fs.rmdir.bind(fs);
|
||||||
|
const removeFunctionSync = opts.unsafeCleanup ? _rimrafRemoveDirSyncWrapper : fs.rmdirSync.bind(fs);
|
||||||
|
const removeCallbackSync = _prepareRemoveCallback(removeFunctionSync, name);
|
||||||
|
const removeCallback = _prepareRemoveCallback(removeFunction, name, removeCallbackSync);
|
||||||
|
if (!opts.keep) _removeObjects.unshift(removeCallbackSync);
|
||||||
|
|
||||||
|
return removeCallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a guarded function wrapping the removeFunction call.
|
||||||
|
*
|
||||||
|
* @param {Function} removeFunction
|
||||||
|
* @param {Object} arg
|
||||||
|
* @returns {Function}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
function _prepareRemoveCallback(removeFunction, arg, cleanupCallbackSync) {
|
||||||
|
var called = false;
|
||||||
|
|
||||||
|
return function _cleanupCallback(next) {
|
||||||
|
next = next || function () {};
|
||||||
|
if (!called) {
|
||||||
|
const toRemove = cleanupCallbackSync || _cleanupCallback;
|
||||||
|
const index = _removeObjects.indexOf(toRemove);
|
||||||
|
/* istanbul ignore else */
|
||||||
|
if (index >= 0) _removeObjects.splice(index, 1);
|
||||||
|
|
||||||
|
called = true;
|
||||||
|
// sync?
|
||||||
|
if (removeFunction.length === 1) {
|
||||||
|
try {
|
||||||
|
removeFunction(arg);
|
||||||
|
return next(null);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
// if no next is provided and since we are
|
||||||
|
// in silent cleanup mode on process exit,
|
||||||
|
// we will ignore the error
|
||||||
|
return next(err);
|
||||||
|
}
|
||||||
|
} else return removeFunction(arg, next);
|
||||||
|
} else return next(new Error('cleanup callback has already been called'));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The garbage collector.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
function _garbageCollector() {
|
||||||
|
/* istanbul ignore else */
|
||||||
|
if (!_gracefulCleanup) return;
|
||||||
|
|
||||||
|
// the function being called removes itself from _removeObjects,
|
||||||
|
// loop until _removeObjects is empty
|
||||||
|
while (_removeObjects.length) {
|
||||||
|
try {
|
||||||
|
_removeObjects[0]();
|
||||||
|
} catch (e) {
|
||||||
|
// already removed?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper for testing against EBADF to compensate changes made to Node 7.x under Windows.
|
||||||
|
*/
|
||||||
|
function isEBADF(error) {
|
||||||
|
return isExpectedError(error, -EBADF, 'EBADF');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper for testing against ENOENT to compensate changes made to Node 7.x under Windows.
|
||||||
|
*/
|
||||||
|
function isENOENT(error) {
|
||||||
|
return isExpectedError(error, -ENOENT, 'ENOENT');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper to determine whether the expected error code matches the actual code and errno,
|
||||||
|
* which will differ between the supported node versions.
|
||||||
|
*
|
||||||
|
* - Node >= 7.0:
|
||||||
|
* error.code {string}
|
||||||
|
* error.errno {string|number} any numerical value will be negated
|
||||||
|
*
|
||||||
|
* - Node >= 6.0 < 7.0:
|
||||||
|
* error.code {string}
|
||||||
|
* error.errno {number} negated
|
||||||
|
*
|
||||||
|
* - Node >= 4.0 < 6.0: introduces SystemError
|
||||||
|
* error.code {string}
|
||||||
|
* error.errno {number} negated
|
||||||
|
*
|
||||||
|
* - Node >= 0.10 < 4.0:
|
||||||
|
* error.code {number} negated
|
||||||
|
* error.errno n/a
|
||||||
|
*/
|
||||||
|
function isExpectedError(error, code, errno) {
|
||||||
|
return error.code === code || error.code === errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper which determines whether a string s is blank, that is undefined, or empty or null.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {string} s
|
||||||
|
* @returns {Boolean} true whether the string s is blank, false otherwise
|
||||||
|
*/
|
||||||
|
function isBlank(s) {
|
||||||
|
return s === null || s === undefined || !s.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the graceful cleanup.
|
||||||
|
*/
|
||||||
|
function setGracefulCleanup() {
|
||||||
|
_gracefulCleanup = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the currently configured tmp dir from os.tmpdir().
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @returns {string} the currently configured tmp dir
|
||||||
|
*/
|
||||||
|
function _getTmpDir() {
|
||||||
|
return os.tmpdir();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If there are multiple different versions of tmp in place, make sure that
|
||||||
|
* we recognize the old listeners.
|
||||||
|
*
|
||||||
|
* @param {Function} listener
|
||||||
|
* @private
|
||||||
|
* @returns {Boolean} true whether listener is a legacy listener
|
||||||
|
*/
|
||||||
|
function _is_legacy_listener(listener) {
|
||||||
|
return (listener.name === '_exit' || listener.name === '_uncaughtExceptionThrown')
|
||||||
|
&& listener.toString().indexOf('_garbageCollector();') > -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Safely install SIGINT listener.
|
||||||
|
*
|
||||||
|
* NOTE: this will only work on OSX and Linux.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
function _safely_install_sigint_listener() {
|
||||||
|
|
||||||
|
const listeners = process.listeners(SIGINT);
|
||||||
|
const existingListeners = [];
|
||||||
|
for (let i = 0, length = listeners.length; i < length; i++) {
|
||||||
|
const lstnr = listeners[i];
|
||||||
|
/* istanbul ignore else */
|
||||||
|
if (lstnr.name === '_tmp$sigint_listener') {
|
||||||
|
existingListeners.push(lstnr);
|
||||||
|
process.removeListener(SIGINT, lstnr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
process.on(SIGINT, function _tmp$sigint_listener(doExit) {
|
||||||
|
for (let i = 0, length = existingListeners.length; i < length; i++) {
|
||||||
|
// let the existing listener do the garbage collection (e.g. jest sandbox)
|
||||||
|
try {
|
||||||
|
existingListeners[i](false);
|
||||||
|
} catch (err) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
// force the garbage collector even it is called again in the exit listener
|
||||||
|
_garbageCollector();
|
||||||
|
} finally {
|
||||||
|
if (!!doExit) {
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Safely install process exit listener.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
function _safely_install_exit_listener() {
|
||||||
|
const listeners = process.listeners(EXIT);
|
||||||
|
|
||||||
|
// collect any existing listeners
|
||||||
|
const existingListeners = [];
|
||||||
|
for (let i = 0, length = listeners.length; i < length; i++) {
|
||||||
|
const lstnr = listeners[i];
|
||||||
|
/* istanbul ignore else */
|
||||||
|
// TODO: remove support for legacy listeners once release 1.0.0 is out
|
||||||
|
if (lstnr.name === '_tmp$safe_listener' || _is_legacy_listener(lstnr)) {
|
||||||
|
// we must forget about the uncaughtException listener, hopefully it is ours
|
||||||
|
if (lstnr.name !== '_uncaughtExceptionThrown') {
|
||||||
|
existingListeners.push(lstnr);
|
||||||
|
}
|
||||||
|
process.removeListener(EXIT, lstnr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// TODO: what was the data parameter good for?
|
||||||
|
process.addListener(EXIT, function _tmp$safe_listener(data) {
|
||||||
|
for (let i = 0, length = existingListeners.length; i < length; i++) {
|
||||||
|
// let the existing listener do the garbage collection (e.g. jest sandbox)
|
||||||
|
try {
|
||||||
|
existingListeners[i](data);
|
||||||
|
} catch (err) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_garbageCollector();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
_safely_install_exit_listener();
|
||||||
|
_safely_install_sigint_listener();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configuration options.
|
||||||
|
*
|
||||||
|
* @typedef {Object} Options
|
||||||
|
* @property {?number} tries the number of tries before give up the name generation
|
||||||
|
* @property {?string} template the "mkstemp" like filename template
|
||||||
|
* @property {?string} name fix name
|
||||||
|
* @property {?string} dir the tmp directory to use
|
||||||
|
* @property {?string} prefix prefix for the generated name
|
||||||
|
* @property {?string} postfix postfix for the generated name
|
||||||
|
* @property {?boolean} unsafeCleanup recursively removes the created temporary directory, even when it's not empty
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} FileSyncObject
|
||||||
|
* @property {string} name the name of the file
|
||||||
|
* @property {string} fd the file descriptor
|
||||||
|
* @property {fileCallback} removeCallback the callback function to remove the file
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} DirSyncObject
|
||||||
|
* @property {string} name the name of the directory
|
||||||
|
* @property {fileCallback} removeCallback the callback function to remove the directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @callback tmpNameCallback
|
||||||
|
* @param {?Error} err the error object if anything goes wrong
|
||||||
|
* @param {string} name the temporary file name
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @callback fileCallback
|
||||||
|
* @param {?Error} err the error object if anything goes wrong
|
||||||
|
* @param {string} name the temporary file name
|
||||||
|
* @param {number} fd the file descriptor
|
||||||
|
* @param {cleanupCallback} fn the cleanup callback function
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @callback dirCallback
|
||||||
|
* @param {?Error} err the error object if anything goes wrong
|
||||||
|
* @param {string} name the temporary file name
|
||||||
|
* @param {cleanupCallback} fn the cleanup callback function
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the temporary created file or directory.
|
||||||
|
*
|
||||||
|
* @callback cleanupCallback
|
||||||
|
* @param {simpleCallback} [next] function to call after entry was removed
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback function for function composition.
|
||||||
|
* @see {@link https://github.com/raszi/node-tmp/issues/57|raszi/node-tmp#57}
|
||||||
|
*
|
||||||
|
* @callback simpleCallback
|
||||||
|
*/
|
||||||
|
|
||||||
|
// exporting all the needed methods
|
||||||
|
|
||||||
|
// evaluate os.tmpdir() lazily, mainly for simplifying testing but it also will
|
||||||
|
// allow users to reconfigure the temporary directory
|
||||||
|
Object.defineProperty(module.exports, 'tmpdir', {
|
||||||
|
enumerable: true,
|
||||||
|
configurable: false,
|
||||||
|
get: function () {
|
||||||
|
return _getTmpDir();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports.dir = dir;
|
||||||
|
module.exports.dirSync = dirSync;
|
||||||
|
|
||||||
|
module.exports.file = file;
|
||||||
|
module.exports.fileSync = fileSync;
|
||||||
|
|
||||||
|
module.exports.tmpName = tmpName;
|
||||||
|
module.exports.tmpNameSync = tmpNameSync;
|
||||||
|
|
||||||
|
module.exports.setGracefulCleanup = setGracefulCleanup;
|
||||||
76
node_modules/tmp/package.json
generated
vendored
Normal file
76
node_modules/tmp/package.json
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
{
|
||||||
|
"_from": "tmp",
|
||||||
|
"_id": "tmp@0.1.0",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-J7Z2K08jbGcdA1kkQpJSqLF6T0tdQqpR2pnSUXsIchbPdTI9v3e85cLW0d6WDhwuAleOV71j2xWs8qMPfK7nKw==",
|
||||||
|
"_location": "/tmp",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "tag",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "tmp",
|
||||||
|
"name": "tmp",
|
||||||
|
"escapedName": "tmp",
|
||||||
|
"rawSpec": "",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "latest"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"#USER",
|
||||||
|
"/"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/tmp/-/tmp-0.1.0.tgz",
|
||||||
|
"_shasum": "ee434a4e22543082e294ba6201dcc6eafefa2877",
|
||||||
|
"_spec": "tmp",
|
||||||
|
"_where": "/Users/Ibrahim/Desktop/test2",
|
||||||
|
"author": {
|
||||||
|
"name": "KARASZI István",
|
||||||
|
"email": "github@spam.raszi.hu",
|
||||||
|
"url": "http://raszi.hu/"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "http://github.com/raszi/node-tmp/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {
|
||||||
|
"rimraf": "^2.6.3"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Temporary file and directory creator",
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "^4.19.1",
|
||||||
|
"eslint-plugin-mocha": "^5.0.0",
|
||||||
|
"istanbul": "^0.4.5",
|
||||||
|
"mocha": "^5.1.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"lib/"
|
||||||
|
],
|
||||||
|
"homepage": "http://github.com/raszi/node-tmp",
|
||||||
|
"keywords": [
|
||||||
|
"temporary",
|
||||||
|
"tmp",
|
||||||
|
"temp",
|
||||||
|
"tempdir",
|
||||||
|
"tempfile",
|
||||||
|
"tmpdir",
|
||||||
|
"tmpfile"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "lib/tmp.js",
|
||||||
|
"name": "tmp",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/raszi/node-tmp.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"clean": "rm -Rf ./coverage",
|
||||||
|
"doc": "jsdoc -c .jsdoc.json",
|
||||||
|
"lint": "eslint lib --env mocha test",
|
||||||
|
"test": "npm run clean && istanbul cover ./node_modules/mocha/bin/_mocha --report none --print none --dir ./coverage/json -u exports -R test/*-test.js && istanbul report --root ./coverage/json html && istanbul report text-summary"
|
||||||
|
},
|
||||||
|
"version": "0.1.0"
|
||||||
|
}
|
||||||
18
node_modules/util/LICENSE
generated
vendored
Normal file
18
node_modules/util/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
||||||
|
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.
|
||||||
15
node_modules/util/README.md
generated
vendored
Normal file
15
node_modules/util/README.md
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# util
|
||||||
|
|
||||||
|
[](https://travis-ci.org/defunctzombie/node-util)
|
||||||
|
|
||||||
|
node.js [util](http://nodejs.org/api/util.html) module as a module
|
||||||
|
|
||||||
|
## install via [npm](npmjs.org)
|
||||||
|
|
||||||
|
```shell
|
||||||
|
npm install util
|
||||||
|
```
|
||||||
|
|
||||||
|
## browser support
|
||||||
|
|
||||||
|
This module also works in modern browsers. If you need legacy browser support you will need to polyfill ES5 features.
|
||||||
16
node_modules/util/node_modules/inherits/LICENSE
generated
vendored
Normal file
16
node_modules/util/node_modules/inherits/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
The ISC License
|
||||||
|
|
||||||
|
Copyright (c) Isaac Z. Schlueter
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
42
node_modules/util/node_modules/inherits/README.md
generated
vendored
Normal file
42
node_modules/util/node_modules/inherits/README.md
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
Browser-friendly inheritance fully compatible with standard node.js
|
||||||
|
[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor).
|
||||||
|
|
||||||
|
This package exports standard `inherits` from node.js `util` module in
|
||||||
|
node environment, but also provides alternative browser-friendly
|
||||||
|
implementation through [browser
|
||||||
|
field](https://gist.github.com/shtylman/4339901). Alternative
|
||||||
|
implementation is a literal copy of standard one located in standalone
|
||||||
|
module to avoid requiring of `util`. It also has a shim for old
|
||||||
|
browsers with no `Object.create` support.
|
||||||
|
|
||||||
|
While keeping you sure you are using standard `inherits`
|
||||||
|
implementation in node.js environment, it allows bundlers such as
|
||||||
|
[browserify](https://github.com/substack/node-browserify) to not
|
||||||
|
include full `util` package to your client code if all you need is
|
||||||
|
just `inherits` function. It worth, because browser shim for `util`
|
||||||
|
package is large and `inherits` is often the single function you need
|
||||||
|
from it.
|
||||||
|
|
||||||
|
It's recommended to use this package instead of
|
||||||
|
`require('util').inherits` for any code that has chances to be used
|
||||||
|
not only in node.js but in browser too.
|
||||||
|
|
||||||
|
## usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
var inherits = require('inherits');
|
||||||
|
// then use exactly as the standard one
|
||||||
|
```
|
||||||
|
|
||||||
|
## note on version ~1.0
|
||||||
|
|
||||||
|
Version ~1.0 had completely different motivation and is not compatible
|
||||||
|
neither with 2.0 nor with standard node.js `inherits`.
|
||||||
|
|
||||||
|
If you are using version ~1.0 and planning to switch to ~2.0, be
|
||||||
|
careful:
|
||||||
|
|
||||||
|
* new version uses `super_` instead of `super` for referencing
|
||||||
|
superclass
|
||||||
|
* new version overwrites current prototype while old one preserves any
|
||||||
|
existing fields on it
|
||||||
7
node_modules/util/node_modules/inherits/inherits.js
generated
vendored
Normal file
7
node_modules/util/node_modules/inherits/inherits.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
try {
|
||||||
|
var util = require('util');
|
||||||
|
if (typeof util.inherits !== 'function') throw '';
|
||||||
|
module.exports = util.inherits;
|
||||||
|
} catch (e) {
|
||||||
|
module.exports = require('./inherits_browser.js');
|
||||||
|
}
|
||||||
23
node_modules/util/node_modules/inherits/inherits_browser.js
generated
vendored
Normal file
23
node_modules/util/node_modules/inherits/inherits_browser.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
if (typeof Object.create === 'function') {
|
||||||
|
// implementation from standard node.js 'util' module
|
||||||
|
module.exports = function inherits(ctor, superCtor) {
|
||||||
|
ctor.super_ = superCtor
|
||||||
|
ctor.prototype = Object.create(superCtor.prototype, {
|
||||||
|
constructor: {
|
||||||
|
value: ctor,
|
||||||
|
enumerable: false,
|
||||||
|
writable: true,
|
||||||
|
configurable: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
// old school shim for old browsers
|
||||||
|
module.exports = function inherits(ctor, superCtor) {
|
||||||
|
ctor.super_ = superCtor
|
||||||
|
var TempCtor = function () {}
|
||||||
|
TempCtor.prototype = superCtor.prototype
|
||||||
|
ctor.prototype = new TempCtor()
|
||||||
|
ctor.prototype.constructor = ctor
|
||||||
|
}
|
||||||
|
}
|
||||||
61
node_modules/util/node_modules/inherits/package.json
generated
vendored
Normal file
61
node_modules/util/node_modules/inherits/package.json
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
{
|
||||||
|
"_from": "inherits@2.0.3",
|
||||||
|
"_id": "inherits@2.0.3",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
|
||||||
|
"_location": "/util/inherits",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "inherits@2.0.3",
|
||||||
|
"name": "inherits",
|
||||||
|
"escapedName": "inherits",
|
||||||
|
"rawSpec": "2.0.3",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "2.0.3"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/util"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
||||||
|
"_shasum": "633c2c83e3da42a502f52466022480f4208261de",
|
||||||
|
"_spec": "inherits@2.0.3",
|
||||||
|
"_where": "/Users/Ibrahim/Desktop/test2/node_modules/util",
|
||||||
|
"browser": "./inherits_browser.js",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/isaacs/inherits/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Browser-friendly inheritance fully compatible with standard node.js inherits()",
|
||||||
|
"devDependencies": {
|
||||||
|
"tap": "^7.1.0"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"inherits.js",
|
||||||
|
"inherits_browser.js"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/isaacs/inherits#readme",
|
||||||
|
"keywords": [
|
||||||
|
"inheritance",
|
||||||
|
"class",
|
||||||
|
"klass",
|
||||||
|
"oop",
|
||||||
|
"object-oriented",
|
||||||
|
"inherits",
|
||||||
|
"browser",
|
||||||
|
"browserify"
|
||||||
|
],
|
||||||
|
"license": "ISC",
|
||||||
|
"main": "./inherits.js",
|
||||||
|
"name": "inherits",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/isaacs/inherits.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "node test"
|
||||||
|
},
|
||||||
|
"version": "2.0.3"
|
||||||
|
}
|
||||||
63
node_modules/util/package.json
generated
vendored
Normal file
63
node_modules/util/package.json
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
{
|
||||||
|
"_from": "util@^0.10.3",
|
||||||
|
"_id": "util@0.10.4",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==",
|
||||||
|
"_location": "/util",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "util@^0.10.3",
|
||||||
|
"name": "util",
|
||||||
|
"escapedName": "util",
|
||||||
|
"rawSpec": "^0.10.3",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^0.10.3"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/path"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz",
|
||||||
|
"_shasum": "3aa0125bfe668a4672de58857d3ace27ecb76901",
|
||||||
|
"_spec": "util@^0.10.3",
|
||||||
|
"_where": "/Users/Ibrahim/Desktop/test2/node_modules/path",
|
||||||
|
"author": {
|
||||||
|
"name": "Joyent",
|
||||||
|
"url": "http://www.joyent.com"
|
||||||
|
},
|
||||||
|
"browser": {
|
||||||
|
"./support/isBuffer.js": "./support/isBufferBrowser.js"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/defunctzombie/node-util/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {
|
||||||
|
"inherits": "2.0.3"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Node.JS util module",
|
||||||
|
"devDependencies": {
|
||||||
|
"zuul": "~1.0.9"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"util.js",
|
||||||
|
"support"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/defunctzombie/node-util",
|
||||||
|
"keywords": [
|
||||||
|
"util"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "./util.js",
|
||||||
|
"name": "util",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/defunctzombie/node-util.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "node test/node/*.js && zuul test/browser/*.js"
|
||||||
|
},
|
||||||
|
"version": "0.10.4"
|
||||||
|
}
|
||||||
3
node_modules/util/support/isBuffer.js
generated
vendored
Normal file
3
node_modules/util/support/isBuffer.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
module.exports = function isBuffer(arg) {
|
||||||
|
return arg instanceof Buffer;
|
||||||
|
}
|
||||||
6
node_modules/util/support/isBufferBrowser.js
generated
vendored
Normal file
6
node_modules/util/support/isBufferBrowser.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
module.exports = function isBuffer(arg) {
|
||||||
|
return arg && typeof arg === 'object'
|
||||||
|
&& typeof arg.copy === 'function'
|
||||||
|
&& typeof arg.fill === 'function'
|
||||||
|
&& typeof arg.readUInt8 === 'function';
|
||||||
|
}
|
||||||
586
node_modules/util/util.js
generated
vendored
Normal file
586
node_modules/util/util.js
generated
vendored
Normal file
@@ -0,0 +1,586 @@
|
|||||||
|
// Copyright Joyent, Inc. and other Node contributors.
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
var formatRegExp = /%[sdj%]/g;
|
||||||
|
exports.format = function(f) {
|
||||||
|
if (!isString(f)) {
|
||||||
|
var objects = [];
|
||||||
|
for (var i = 0; i < arguments.length; i++) {
|
||||||
|
objects.push(inspect(arguments[i]));
|
||||||
|
}
|
||||||
|
return objects.join(' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
var i = 1;
|
||||||
|
var args = arguments;
|
||||||
|
var len = args.length;
|
||||||
|
var str = String(f).replace(formatRegExp, function(x) {
|
||||||
|
if (x === '%%') return '%';
|
||||||
|
if (i >= len) return x;
|
||||||
|
switch (x) {
|
||||||
|
case '%s': return String(args[i++]);
|
||||||
|
case '%d': return Number(args[i++]);
|
||||||
|
case '%j':
|
||||||
|
try {
|
||||||
|
return JSON.stringify(args[i++]);
|
||||||
|
} catch (_) {
|
||||||
|
return '[Circular]';
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
for (var x = args[i]; i < len; x = args[++i]) {
|
||||||
|
if (isNull(x) || !isObject(x)) {
|
||||||
|
str += ' ' + x;
|
||||||
|
} else {
|
||||||
|
str += ' ' + inspect(x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Mark that a method should not be used.
|
||||||
|
// Returns a modified function which warns once by default.
|
||||||
|
// If --no-deprecation is set, then it is a no-op.
|
||||||
|
exports.deprecate = function(fn, msg) {
|
||||||
|
// Allow for deprecating things in the process of starting up.
|
||||||
|
if (isUndefined(global.process)) {
|
||||||
|
return function() {
|
||||||
|
return exports.deprecate(fn, msg).apply(this, arguments);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.noDeprecation === true) {
|
||||||
|
return fn;
|
||||||
|
}
|
||||||
|
|
||||||
|
var warned = false;
|
||||||
|
function deprecated() {
|
||||||
|
if (!warned) {
|
||||||
|
if (process.throwDeprecation) {
|
||||||
|
throw new Error(msg);
|
||||||
|
} else if (process.traceDeprecation) {
|
||||||
|
console.trace(msg);
|
||||||
|
} else {
|
||||||
|
console.error(msg);
|
||||||
|
}
|
||||||
|
warned = true;
|
||||||
|
}
|
||||||
|
return fn.apply(this, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
return deprecated;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var debugs = {};
|
||||||
|
var debugEnviron;
|
||||||
|
exports.debuglog = function(set) {
|
||||||
|
if (isUndefined(debugEnviron))
|
||||||
|
debugEnviron = process.env.NODE_DEBUG || '';
|
||||||
|
set = set.toUpperCase();
|
||||||
|
if (!debugs[set]) {
|
||||||
|
if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
|
||||||
|
var pid = process.pid;
|
||||||
|
debugs[set] = function() {
|
||||||
|
var msg = exports.format.apply(exports, arguments);
|
||||||
|
console.error('%s %d: %s', set, pid, msg);
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
debugs[set] = function() {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return debugs[set];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Echos the value of a value. Trys to print the value out
|
||||||
|
* in the best way possible given the different types.
|
||||||
|
*
|
||||||
|
* @param {Object} obj The object to print out.
|
||||||
|
* @param {Object} opts Optional options object that alters the output.
|
||||||
|
*/
|
||||||
|
/* legacy: obj, showHidden, depth, colors*/
|
||||||
|
function inspect(obj, opts) {
|
||||||
|
// default options
|
||||||
|
var ctx = {
|
||||||
|
seen: [],
|
||||||
|
stylize: stylizeNoColor
|
||||||
|
};
|
||||||
|
// legacy...
|
||||||
|
if (arguments.length >= 3) ctx.depth = arguments[2];
|
||||||
|
if (arguments.length >= 4) ctx.colors = arguments[3];
|
||||||
|
if (isBoolean(opts)) {
|
||||||
|
// legacy...
|
||||||
|
ctx.showHidden = opts;
|
||||||
|
} else if (opts) {
|
||||||
|
// got an "options" object
|
||||||
|
exports._extend(ctx, opts);
|
||||||
|
}
|
||||||
|
// set default options
|
||||||
|
if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
|
||||||
|
if (isUndefined(ctx.depth)) ctx.depth = 2;
|
||||||
|
if (isUndefined(ctx.colors)) ctx.colors = false;
|
||||||
|
if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
|
||||||
|
if (ctx.colors) ctx.stylize = stylizeWithColor;
|
||||||
|
return formatValue(ctx, obj, ctx.depth);
|
||||||
|
}
|
||||||
|
exports.inspect = inspect;
|
||||||
|
|
||||||
|
|
||||||
|
// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
|
||||||
|
inspect.colors = {
|
||||||
|
'bold' : [1, 22],
|
||||||
|
'italic' : [3, 23],
|
||||||
|
'underline' : [4, 24],
|
||||||
|
'inverse' : [7, 27],
|
||||||
|
'white' : [37, 39],
|
||||||
|
'grey' : [90, 39],
|
||||||
|
'black' : [30, 39],
|
||||||
|
'blue' : [34, 39],
|
||||||
|
'cyan' : [36, 39],
|
||||||
|
'green' : [32, 39],
|
||||||
|
'magenta' : [35, 39],
|
||||||
|
'red' : [31, 39],
|
||||||
|
'yellow' : [33, 39]
|
||||||
|
};
|
||||||
|
|
||||||
|
// Don't use 'blue' not visible on cmd.exe
|
||||||
|
inspect.styles = {
|
||||||
|
'special': 'cyan',
|
||||||
|
'number': 'yellow',
|
||||||
|
'boolean': 'yellow',
|
||||||
|
'undefined': 'grey',
|
||||||
|
'null': 'bold',
|
||||||
|
'string': 'green',
|
||||||
|
'date': 'magenta',
|
||||||
|
// "name": intentionally not styling
|
||||||
|
'regexp': 'red'
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
function stylizeWithColor(str, styleType) {
|
||||||
|
var style = inspect.styles[styleType];
|
||||||
|
|
||||||
|
if (style) {
|
||||||
|
return '\u001b[' + inspect.colors[style][0] + 'm' + str +
|
||||||
|
'\u001b[' + inspect.colors[style][1] + 'm';
|
||||||
|
} else {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function stylizeNoColor(str, styleType) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function arrayToHash(array) {
|
||||||
|
var hash = {};
|
||||||
|
|
||||||
|
array.forEach(function(val, idx) {
|
||||||
|
hash[val] = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function formatValue(ctx, value, recurseTimes) {
|
||||||
|
// Provide a hook for user-specified inspect functions.
|
||||||
|
// Check that value is an object with an inspect function on it
|
||||||
|
if (ctx.customInspect &&
|
||||||
|
value &&
|
||||||
|
isFunction(value.inspect) &&
|
||||||
|
// Filter out the util module, it's inspect function is special
|
||||||
|
value.inspect !== exports.inspect &&
|
||||||
|
// Also filter out any prototype objects using the circular check.
|
||||||
|
!(value.constructor && value.constructor.prototype === value)) {
|
||||||
|
var ret = value.inspect(recurseTimes, ctx);
|
||||||
|
if (!isString(ret)) {
|
||||||
|
ret = formatValue(ctx, ret, recurseTimes);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Primitive types cannot have properties
|
||||||
|
var primitive = formatPrimitive(ctx, value);
|
||||||
|
if (primitive) {
|
||||||
|
return primitive;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Look up the keys of the object.
|
||||||
|
var keys = Object.keys(value);
|
||||||
|
var visibleKeys = arrayToHash(keys);
|
||||||
|
|
||||||
|
if (ctx.showHidden) {
|
||||||
|
keys = Object.getOwnPropertyNames(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// IE doesn't make error fields non-enumerable
|
||||||
|
// http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
|
||||||
|
if (isError(value)
|
||||||
|
&& (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
|
||||||
|
return formatError(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Some type of object without properties can be shortcutted.
|
||||||
|
if (keys.length === 0) {
|
||||||
|
if (isFunction(value)) {
|
||||||
|
var name = value.name ? ': ' + value.name : '';
|
||||||
|
return ctx.stylize('[Function' + name + ']', 'special');
|
||||||
|
}
|
||||||
|
if (isRegExp(value)) {
|
||||||
|
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
||||||
|
}
|
||||||
|
if (isDate(value)) {
|
||||||
|
return ctx.stylize(Date.prototype.toString.call(value), 'date');
|
||||||
|
}
|
||||||
|
if (isError(value)) {
|
||||||
|
return formatError(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var base = '', array = false, braces = ['{', '}'];
|
||||||
|
|
||||||
|
// Make Array say that they are Array
|
||||||
|
if (isArray(value)) {
|
||||||
|
array = true;
|
||||||
|
braces = ['[', ']'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make functions say that they are functions
|
||||||
|
if (isFunction(value)) {
|
||||||
|
var n = value.name ? ': ' + value.name : '';
|
||||||
|
base = ' [Function' + n + ']';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make RegExps say that they are RegExps
|
||||||
|
if (isRegExp(value)) {
|
||||||
|
base = ' ' + RegExp.prototype.toString.call(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make dates with properties first say the date
|
||||||
|
if (isDate(value)) {
|
||||||
|
base = ' ' + Date.prototype.toUTCString.call(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make error with message first say the error
|
||||||
|
if (isError(value)) {
|
||||||
|
base = ' ' + formatError(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keys.length === 0 && (!array || value.length == 0)) {
|
||||||
|
return braces[0] + base + braces[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (recurseTimes < 0) {
|
||||||
|
if (isRegExp(value)) {
|
||||||
|
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
||||||
|
} else {
|
||||||
|
return ctx.stylize('[Object]', 'special');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.seen.push(value);
|
||||||
|
|
||||||
|
var output;
|
||||||
|
if (array) {
|
||||||
|
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
|
||||||
|
} else {
|
||||||
|
output = keys.map(function(key) {
|
||||||
|
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.seen.pop();
|
||||||
|
|
||||||
|
return reduceToSingleString(output, base, braces);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function formatPrimitive(ctx, value) {
|
||||||
|
if (isUndefined(value))
|
||||||
|
return ctx.stylize('undefined', 'undefined');
|
||||||
|
if (isString(value)) {
|
||||||
|
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
|
||||||
|
.replace(/'/g, "\\'")
|
||||||
|
.replace(/\\"/g, '"') + '\'';
|
||||||
|
return ctx.stylize(simple, 'string');
|
||||||
|
}
|
||||||
|
if (isNumber(value))
|
||||||
|
return ctx.stylize('' + value, 'number');
|
||||||
|
if (isBoolean(value))
|
||||||
|
return ctx.stylize('' + value, 'boolean');
|
||||||
|
// For some reason typeof null is "object", so special case here.
|
||||||
|
if (isNull(value))
|
||||||
|
return ctx.stylize('null', 'null');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function formatError(value) {
|
||||||
|
return '[' + Error.prototype.toString.call(value) + ']';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
|
||||||
|
var output = [];
|
||||||
|
for (var i = 0, l = value.length; i < l; ++i) {
|
||||||
|
if (hasOwnProperty(value, String(i))) {
|
||||||
|
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
||||||
|
String(i), true));
|
||||||
|
} else {
|
||||||
|
output.push('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
keys.forEach(function(key) {
|
||||||
|
if (!key.match(/^\d+$/)) {
|
||||||
|
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
||||||
|
key, true));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
|
||||||
|
var name, str, desc;
|
||||||
|
desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
|
||||||
|
if (desc.get) {
|
||||||
|
if (desc.set) {
|
||||||
|
str = ctx.stylize('[Getter/Setter]', 'special');
|
||||||
|
} else {
|
||||||
|
str = ctx.stylize('[Getter]', 'special');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (desc.set) {
|
||||||
|
str = ctx.stylize('[Setter]', 'special');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!hasOwnProperty(visibleKeys, key)) {
|
||||||
|
name = '[' + key + ']';
|
||||||
|
}
|
||||||
|
if (!str) {
|
||||||
|
if (ctx.seen.indexOf(desc.value) < 0) {
|
||||||
|
if (isNull(recurseTimes)) {
|
||||||
|
str = formatValue(ctx, desc.value, null);
|
||||||
|
} else {
|
||||||
|
str = formatValue(ctx, desc.value, recurseTimes - 1);
|
||||||
|
}
|
||||||
|
if (str.indexOf('\n') > -1) {
|
||||||
|
if (array) {
|
||||||
|
str = str.split('\n').map(function(line) {
|
||||||
|
return ' ' + line;
|
||||||
|
}).join('\n').substr(2);
|
||||||
|
} else {
|
||||||
|
str = '\n' + str.split('\n').map(function(line) {
|
||||||
|
return ' ' + line;
|
||||||
|
}).join('\n');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
str = ctx.stylize('[Circular]', 'special');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isUndefined(name)) {
|
||||||
|
if (array && key.match(/^\d+$/)) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
name = JSON.stringify('' + key);
|
||||||
|
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
|
||||||
|
name = name.substr(1, name.length - 2);
|
||||||
|
name = ctx.stylize(name, 'name');
|
||||||
|
} else {
|
||||||
|
name = name.replace(/'/g, "\\'")
|
||||||
|
.replace(/\\"/g, '"')
|
||||||
|
.replace(/(^"|"$)/g, "'");
|
||||||
|
name = ctx.stylize(name, 'string');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return name + ': ' + str;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function reduceToSingleString(output, base, braces) {
|
||||||
|
var numLinesEst = 0;
|
||||||
|
var length = output.reduce(function(prev, cur) {
|
||||||
|
numLinesEst++;
|
||||||
|
if (cur.indexOf('\n') >= 0) numLinesEst++;
|
||||||
|
return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
|
||||||
|
}, 0);
|
||||||
|
|
||||||
|
if (length > 60) {
|
||||||
|
return braces[0] +
|
||||||
|
(base === '' ? '' : base + '\n ') +
|
||||||
|
' ' +
|
||||||
|
output.join(',\n ') +
|
||||||
|
' ' +
|
||||||
|
braces[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// NOTE: These type checking functions intentionally don't use `instanceof`
|
||||||
|
// because it is fragile and can be easily faked with `Object.create()`.
|
||||||
|
function isArray(ar) {
|
||||||
|
return Array.isArray(ar);
|
||||||
|
}
|
||||||
|
exports.isArray = isArray;
|
||||||
|
|
||||||
|
function isBoolean(arg) {
|
||||||
|
return typeof arg === 'boolean';
|
||||||
|
}
|
||||||
|
exports.isBoolean = isBoolean;
|
||||||
|
|
||||||
|
function isNull(arg) {
|
||||||
|
return arg === null;
|
||||||
|
}
|
||||||
|
exports.isNull = isNull;
|
||||||
|
|
||||||
|
function isNullOrUndefined(arg) {
|
||||||
|
return arg == null;
|
||||||
|
}
|
||||||
|
exports.isNullOrUndefined = isNullOrUndefined;
|
||||||
|
|
||||||
|
function isNumber(arg) {
|
||||||
|
return typeof arg === 'number';
|
||||||
|
}
|
||||||
|
exports.isNumber = isNumber;
|
||||||
|
|
||||||
|
function isString(arg) {
|
||||||
|
return typeof arg === 'string';
|
||||||
|
}
|
||||||
|
exports.isString = isString;
|
||||||
|
|
||||||
|
function isSymbol(arg) {
|
||||||
|
return typeof arg === 'symbol';
|
||||||
|
}
|
||||||
|
exports.isSymbol = isSymbol;
|
||||||
|
|
||||||
|
function isUndefined(arg) {
|
||||||
|
return arg === void 0;
|
||||||
|
}
|
||||||
|
exports.isUndefined = isUndefined;
|
||||||
|
|
||||||
|
function isRegExp(re) {
|
||||||
|
return isObject(re) && objectToString(re) === '[object RegExp]';
|
||||||
|
}
|
||||||
|
exports.isRegExp = isRegExp;
|
||||||
|
|
||||||
|
function isObject(arg) {
|
||||||
|
return typeof arg === 'object' && arg !== null;
|
||||||
|
}
|
||||||
|
exports.isObject = isObject;
|
||||||
|
|
||||||
|
function isDate(d) {
|
||||||
|
return isObject(d) && objectToString(d) === '[object Date]';
|
||||||
|
}
|
||||||
|
exports.isDate = isDate;
|
||||||
|
|
||||||
|
function isError(e) {
|
||||||
|
return isObject(e) &&
|
||||||
|
(objectToString(e) === '[object Error]' || e instanceof Error);
|
||||||
|
}
|
||||||
|
exports.isError = isError;
|
||||||
|
|
||||||
|
function isFunction(arg) {
|
||||||
|
return typeof arg === 'function';
|
||||||
|
}
|
||||||
|
exports.isFunction = isFunction;
|
||||||
|
|
||||||
|
function isPrimitive(arg) {
|
||||||
|
return arg === null ||
|
||||||
|
typeof arg === 'boolean' ||
|
||||||
|
typeof arg === 'number' ||
|
||||||
|
typeof arg === 'string' ||
|
||||||
|
typeof arg === 'symbol' || // ES6 symbol
|
||||||
|
typeof arg === 'undefined';
|
||||||
|
}
|
||||||
|
exports.isPrimitive = isPrimitive;
|
||||||
|
|
||||||
|
exports.isBuffer = require('./support/isBuffer');
|
||||||
|
|
||||||
|
function objectToString(o) {
|
||||||
|
return Object.prototype.toString.call(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function pad(n) {
|
||||||
|
return n < 10 ? '0' + n.toString(10) : n.toString(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
|
||||||
|
'Oct', 'Nov', 'Dec'];
|
||||||
|
|
||||||
|
// 26 Feb 16:19:34
|
||||||
|
function timestamp() {
|
||||||
|
var d = new Date();
|
||||||
|
var time = [pad(d.getHours()),
|
||||||
|
pad(d.getMinutes()),
|
||||||
|
pad(d.getSeconds())].join(':');
|
||||||
|
return [d.getDate(), months[d.getMonth()], time].join(' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// log is just a thin wrapper to console.log that prepends a timestamp
|
||||||
|
exports.log = function() {
|
||||||
|
console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inherit the prototype methods from one constructor into another.
|
||||||
|
*
|
||||||
|
* The Function.prototype.inherits from lang.js rewritten as a standalone
|
||||||
|
* function (not on Function.prototype). NOTE: If this file is to be loaded
|
||||||
|
* during bootstrapping this function needs to be rewritten using some native
|
||||||
|
* functions as prototype setup using normal JavaScript does not work as
|
||||||
|
* expected during bootstrapping (see mirror.js in r114903).
|
||||||
|
*
|
||||||
|
* @param {function} ctor Constructor function which needs to inherit the
|
||||||
|
* prototype.
|
||||||
|
* @param {function} superCtor Constructor function to inherit prototype from.
|
||||||
|
*/
|
||||||
|
exports.inherits = require('inherits');
|
||||||
|
|
||||||
|
exports._extend = function(origin, add) {
|
||||||
|
// Don't do anything if add isn't an object
|
||||||
|
if (!add || !isObject(add)) return origin;
|
||||||
|
|
||||||
|
var keys = Object.keys(add);
|
||||||
|
var i = keys.length;
|
||||||
|
while (i--) {
|
||||||
|
origin[keys[i]] = add[keys[i]];
|
||||||
|
}
|
||||||
|
return origin;
|
||||||
|
};
|
||||||
|
|
||||||
|
function hasOwnProperty(obj, prop) {
|
||||||
|
return Object.prototype.hasOwnProperty.call(obj, prop);
|
||||||
|
}
|
||||||
132
package-lock.json
generated
132
package-lock.json
generated
@@ -173,6 +173,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz",
|
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz",
|
||||||
"integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ=="
|
"integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ=="
|
||||||
},
|
},
|
||||||
|
"balanced-match": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
|
||||||
|
},
|
||||||
"bcrypt-pbkdf": {
|
"bcrypt-pbkdf": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
|
||||||
@@ -186,6 +191,15 @@
|
|||||||
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.1.0.tgz",
|
||||||
"integrity": "sha512-IWIbu7pMqyw3EAJHzzHbWa85b6oud/yfKYg5rqB5hNE8CeMi3nX+2C2sj0HswfblST86hpVEOAb9x34NZd6P7A=="
|
"integrity": "sha512-IWIbu7pMqyw3EAJHzzHbWa85b6oud/yfKYg5rqB5hNE8CeMi3nX+2C2sj0HswfblST86hpVEOAb9x34NZd6P7A=="
|
||||||
},
|
},
|
||||||
|
"brace-expansion": {
|
||||||
|
"version": "1.1.11",
|
||||||
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||||
|
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||||
|
"requires": {
|
||||||
|
"balanced-match": "^1.0.0",
|
||||||
|
"concat-map": "0.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"btoa-lite": {
|
"btoa-lite": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/btoa-lite/-/btoa-lite-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/btoa-lite/-/btoa-lite-1.0.0.tgz",
|
||||||
@@ -204,6 +218,11 @@
|
|||||||
"delayed-stream": "~1.0.0"
|
"delayed-stream": "~1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"concat-map": {
|
||||||
|
"version": "0.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||||
|
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
|
||||||
|
},
|
||||||
"core-util-is": {
|
"core-util-is": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
|
||||||
@@ -310,6 +329,16 @@
|
|||||||
"mime-types": "^2.1.12"
|
"mime-types": "^2.1.12"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"fs": {
|
||||||
|
"version": "0.0.1-security",
|
||||||
|
"resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
|
||||||
|
"integrity": "sha1-invTcYa23d84E/I4WLV+yq9eQdQ="
|
||||||
|
},
|
||||||
|
"fs.realpath": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
|
||||||
|
},
|
||||||
"get-stream": {
|
"get-stream": {
|
||||||
"version": "4.1.0",
|
"version": "4.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
|
||||||
@@ -326,6 +355,19 @@
|
|||||||
"assert-plus": "^1.0.0"
|
"assert-plus": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"glob": {
|
||||||
|
"version": "7.1.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
|
||||||
|
"integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
|
||||||
|
"requires": {
|
||||||
|
"fs.realpath": "^1.0.0",
|
||||||
|
"inflight": "^1.0.4",
|
||||||
|
"inherits": "2",
|
||||||
|
"minimatch": "^3.0.4",
|
||||||
|
"once": "^1.3.0",
|
||||||
|
"path-is-absolute": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"har-schema": {
|
"har-schema": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
|
||||||
@@ -350,6 +392,20 @@
|
|||||||
"sshpk": "^1.7.0"
|
"sshpk": "^1.7.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"inflight": {
|
||||||
|
"version": "1.0.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||||
|
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
||||||
|
"requires": {
|
||||||
|
"once": "^1.3.0",
|
||||||
|
"wrappy": "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"inherits": {
|
||||||
|
"version": "2.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||||
|
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||||
|
},
|
||||||
"is-plain-object": {
|
"is-plain-object": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-3.0.0.tgz",
|
||||||
@@ -447,6 +503,14 @@
|
|||||||
"mime-db": "1.42.0"
|
"mime-db": "1.42.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"minimatch": {
|
||||||
|
"version": "3.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||||
|
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||||
|
"requires": {
|
||||||
|
"brace-expansion": "^1.1.7"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nice-try": {
|
"nice-try": {
|
||||||
"version": "1.0.5",
|
"version": "1.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
|
||||||
@@ -497,6 +561,20 @@
|
|||||||
"resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
|
||||||
"integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4="
|
"integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4="
|
||||||
},
|
},
|
||||||
|
"path": {
|
||||||
|
"version": "0.12.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz",
|
||||||
|
"integrity": "sha1-1NwqUGxM4hl+tIHr/NWzbAFAsQ8=",
|
||||||
|
"requires": {
|
||||||
|
"process": "^0.11.1",
|
||||||
|
"util": "^0.10.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"path-is-absolute": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||||
|
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
|
||||||
|
},
|
||||||
"path-key": {
|
"path-key": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
|
||||||
@@ -507,6 +585,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
|
||||||
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
|
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
|
||||||
},
|
},
|
||||||
|
"process": {
|
||||||
|
"version": "0.11.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
|
||||||
|
"integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI="
|
||||||
|
},
|
||||||
"psl": {
|
"psl": {
|
||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/psl/-/psl-1.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/psl/-/psl-1.4.0.tgz",
|
||||||
@@ -558,6 +641,14 @@
|
|||||||
"uuid": "^3.3.2"
|
"uuid": "^3.3.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"rimraf": {
|
||||||
|
"version": "2.7.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
|
||||||
|
"integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
|
||||||
|
"requires": {
|
||||||
|
"glob": "^7.1.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
"safe-buffer": {
|
"safe-buffer": {
|
||||||
"version": "5.2.0",
|
"version": "5.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz",
|
||||||
@@ -612,6 +703,32 @@
|
|||||||
"resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
|
||||||
"integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8="
|
"integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8="
|
||||||
},
|
},
|
||||||
|
"temp": {
|
||||||
|
"version": "0.9.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/temp/-/temp-0.9.1.tgz",
|
||||||
|
"integrity": "sha512-WMuOgiua1xb5R56lE0eH6ivpVmg/lq2OHm4+LtT/xtEtPQ+sz6N3bBM6WZ5FvO1lO4IKIOb43qnhoc4qxP5OeA==",
|
||||||
|
"requires": {
|
||||||
|
"rimraf": "~2.6.2"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"rimraf": {
|
||||||
|
"version": "2.6.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz",
|
||||||
|
"integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==",
|
||||||
|
"requires": {
|
||||||
|
"glob": "^7.1.3"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tmp": {
|
||||||
|
"version": "0.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.1.0.tgz",
|
||||||
|
"integrity": "sha512-J7Z2K08jbGcdA1kkQpJSqLF6T0tdQqpR2pnSUXsIchbPdTI9v3e85cLW0d6WDhwuAleOV71j2xWs8qMPfK7nKw==",
|
||||||
|
"requires": {
|
||||||
|
"rimraf": "^2.6.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
"tough-cookie": {
|
"tough-cookie": {
|
||||||
"version": "2.4.3",
|
"version": "2.4.3",
|
||||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz",
|
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz",
|
||||||
@@ -657,6 +774,21 @@
|
|||||||
"punycode": "^2.1.0"
|
"punycode": "^2.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"util": {
|
||||||
|
"version": "0.10.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz",
|
||||||
|
"integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==",
|
||||||
|
"requires": {
|
||||||
|
"inherits": "2.0.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"inherits": {
|
||||||
|
"version": "2.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
||||||
|
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"uuid": {
|
"uuid": {
|
||||||
"version": "3.3.3",
|
"version": "3.3.3",
|
||||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
|
||||||
|
|||||||
@@ -23,6 +23,10 @@
|
|||||||
"@actions/github": "^1.1.0",
|
"@actions/github": "^1.1.0",
|
||||||
"core-util-is": "^1.0.2",
|
"core-util-is": "^1.0.2",
|
||||||
"exec-sh": "^0.3.4",
|
"exec-sh": "^0.3.4",
|
||||||
"request": "^2.88.0"
|
"fs": "0.0.1-security",
|
||||||
|
"path": "^0.12.7",
|
||||||
|
"request": "^2.88.0",
|
||||||
|
"temp": "^0.9.1",
|
||||||
|
"tmp": "^0.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user