mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 13:42:20 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
22
web/node_modules/default-gateway/LICENSE
generated
vendored
Normal file
22
web/node_modules/default-gateway/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
Copyright (c) silverwind
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
50
web/node_modules/default-gateway/README.md
generated
vendored
Normal file
50
web/node_modules/default-gateway/README.md
generated
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
# default-gateway
|
||||
[](https://www.npmjs.org/package/default-gateway) [](https://www.npmjs.org/package/default-gateway) [](https://travis-ci.org/silverwind/default-gateway)
|
||||
|
||||
> Get the default network gateway, cross-platform.
|
||||
|
||||
Obtains the machine's default gateway through `exec` calls to OS routing interfaces. On Linux and Android, the `ip` command must be available (usually provided by the `iproute2` package). On IBM i, the `db2util` command must be available (provided by the `db2util` package).
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
$ npm install default-gateway
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
const defaultGateway = require('default-gateway');
|
||||
|
||||
defaultGateway.v4().then(result => {
|
||||
// result = {gateway: '1.2.3.4', interface: 'en1'}
|
||||
});
|
||||
|
||||
defaultGateway.v6().then(result => {
|
||||
// result = {gateway: '2001:db8::1', interface: 'en2'}
|
||||
});
|
||||
|
||||
const result = defaultGateway.v4.sync();
|
||||
// result = {gateway: '1.2.3.4', interface: 'en1'}
|
||||
|
||||
const result = defaultGateway.v6.sync();
|
||||
// result = {gateway: '2001:db8::1', interface: 'en2'}
|
||||
```
|
||||
|
||||
## API
|
||||
### defaultGateway.v4()
|
||||
### defaultGateway.v6()
|
||||
### defaultGateway.v4.sync()
|
||||
### defaultGateway.v6.sync()
|
||||
|
||||
Returns: `result` *Object*
|
||||
- `gateway`: The IP address of the default gateway.
|
||||
- `interface`: The name of the interface. On Windows, this is the network adapter name.
|
||||
|
||||
The `.v{4,6}()` methods return a Promise while the `.v{4,6}.sync()` variants will return the result synchronously.
|
||||
|
||||
The `gateway` property will always be defined on success, while `interface` can be `null` if it cannot be determined. All methods reject/throw on unexpected conditions.
|
||||
|
||||
## License
|
||||
|
||||
© [silverwind](https://github.com/silverwind), distributed under BSD licence
|
46
web/node_modules/default-gateway/android.js
generated
vendored
Normal file
46
web/node_modules/default-gateway/android.js
generated
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
"use strict";
|
||||
|
||||
const net = require("net");
|
||||
const execa = require("execa");
|
||||
|
||||
const args = {
|
||||
v4: ["-4", "r"],
|
||||
v6: ["-6", "r"],
|
||||
};
|
||||
|
||||
const parse = stdout => {
|
||||
let result;
|
||||
|
||||
(stdout || "").trim().split("\n").some(line => {
|
||||
const results = /default via (.+?) dev (.+?)( |$)/.exec(line) || [];
|
||||
const gateway = results[1];
|
||||
const iface = results[2];
|
||||
if (gateway && net.isIP(gateway)) {
|
||||
result = {gateway, interface: (iface ? iface : null)};
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if (!result) {
|
||||
throw new Error("Unable to determine default gateway");
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
const promise = family => {
|
||||
return execa.stdout("ip", args[family]).then(stdout => {
|
||||
return parse(stdout);
|
||||
});
|
||||
};
|
||||
|
||||
const sync = family => {
|
||||
const result = execa.sync("ip", args[family]);
|
||||
return parse(result.stdout);
|
||||
};
|
||||
|
||||
module.exports.v4 = () => promise("v4");
|
||||
module.exports.v6 = () => promise("v6");
|
||||
|
||||
module.exports.v4.sync = () => sync("v4");
|
||||
module.exports.v6.sync = () => sync("v6");
|
48
web/node_modules/default-gateway/darwin.js
generated
vendored
Normal file
48
web/node_modules/default-gateway/darwin.js
generated
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
"use strict";
|
||||
|
||||
const net = require("net");
|
||||
const execa = require("execa");
|
||||
const dests = ["default", "0.0.0.0", "0.0.0.0/0", "::", "::/0"];
|
||||
|
||||
const args = {
|
||||
v4: ["-rn", "-f", "inet"],
|
||||
v6: ["-rn", "-f", "inet6"],
|
||||
};
|
||||
|
||||
const parse = (stdout, family) => {
|
||||
let result;
|
||||
|
||||
(stdout || "").trim().split("\n").some(line => {
|
||||
const results = line.split(/ +/) || [];
|
||||
const target = results[0];
|
||||
const gateway = results[1];
|
||||
const iface = results[family === "v4" ? 5 : 3];
|
||||
if (dests.indexOf(target) !== -1 && gateway && net.isIP(gateway)) {
|
||||
result = {gateway, interface: (iface ? iface : null)};
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if (!result) {
|
||||
throw new Error("Unable to determine default gateway");
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
const promise = family => {
|
||||
return execa.stdout("netstat", args[family]).then(stdout => {
|
||||
return parse(stdout, family);
|
||||
});
|
||||
};
|
||||
|
||||
const sync = family => {
|
||||
const result = execa.sync("netstat", args[family]);
|
||||
return parse(result.stdout, family);
|
||||
};
|
||||
|
||||
module.exports.v4 = () => promise("v4");
|
||||
module.exports.v6 = () => promise("v6");
|
||||
|
||||
module.exports.v4.sync = () => sync("v4");
|
||||
module.exports.v6.sync = () => sync("v6");
|
48
web/node_modules/default-gateway/freebsd.js
generated
vendored
Normal file
48
web/node_modules/default-gateway/freebsd.js
generated
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
"use strict";
|
||||
|
||||
const net = require("net");
|
||||
const execa = require("execa");
|
||||
const dests = ["default", "0.0.0.0", "0.0.0.0/0", "::", "::/0"];
|
||||
|
||||
const args = {
|
||||
v4: ["-rn", "-f", "inet"],
|
||||
v6: ["-rn", "-f", "inet6"],
|
||||
};
|
||||
|
||||
const parse = stdout => {
|
||||
let result;
|
||||
|
||||
(stdout || "").trim().split("\n").some(line => {
|
||||
const results = line.split(/ +/) || [];
|
||||
const target = results[0];
|
||||
const gateway = results[1];
|
||||
const iface = results[3];
|
||||
if (dests.indexOf(target) !== -1 && gateway && net.isIP(gateway)) {
|
||||
result = {gateway, interface: (iface ? iface : null)};
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if (!result) {
|
||||
throw new Error("Unable to determine default gateway");
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
const promise = family => {
|
||||
return execa.stdout("netstat", args[family]).then(stdout => {
|
||||
return parse(stdout);
|
||||
});
|
||||
};
|
||||
|
||||
const sync = family => {
|
||||
const result = execa.sync("netstat", args[family]);
|
||||
return parse(result.stdout);
|
||||
};
|
||||
|
||||
module.exports.v4 = () => promise("v4");
|
||||
module.exports.v6 = () => promise("v6");
|
||||
|
||||
module.exports.v4.sync = () => sync("v4");
|
||||
module.exports.v6.sync = () => sync("v6");
|
35
web/node_modules/default-gateway/ibmi.js
generated
vendored
Normal file
35
web/node_modules/default-gateway/ibmi.js
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
"use strict";
|
||||
|
||||
const execa = require("execa");
|
||||
|
||||
const db2util = "/QOpenSys/pkgs/bin/db2util";
|
||||
const sql = "select NEXT_HOP, LOCAL_BINDING_INTERFACE from QSYS2.NETSTAT_ROUTE_INFO where ROUTE_TYPE='DFTROUTE' and NEXT_HOP!='*DIRECT' and CONNECTION_TYPE=?";
|
||||
|
||||
const parse = stdout => {
|
||||
let result;
|
||||
try {
|
||||
const resultObj = JSON.parse(stdout);
|
||||
const gateway = resultObj.records[0].NEXT_HOP;
|
||||
const iface = resultObj.records[0].LOCAL_BINDING_INTERFACE;
|
||||
result = {gateway, iface};
|
||||
} catch (err) {}
|
||||
if (!result) {
|
||||
throw new Error("Unable to determine default gateway");
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
const promise = family => {
|
||||
return execa.stdout(db2util, [sql, "-p", family, "-o", "json"]).then(stdout => parse(stdout));
|
||||
};
|
||||
|
||||
const sync = family => {
|
||||
const {stdout} = execa.sync(db2util, [sql, "-p", family, "-o", "json"]);
|
||||
return parse(stdout);
|
||||
};
|
||||
|
||||
module.exports.v4 = () => promise("IPV4");
|
||||
module.exports.v6 = () => promise("IPV6");
|
||||
|
||||
module.exports.v4.sync = () => sync("IPV4");
|
||||
module.exports.v6.sync = () => sync("IPV6");
|
35
web/node_modules/default-gateway/index.js
generated
vendored
Normal file
35
web/node_modules/default-gateway/index.js
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
"use strict";
|
||||
|
||||
const os = require("os");
|
||||
const platform = os.platform();
|
||||
|
||||
if ([
|
||||
"android",
|
||||
"darwin",
|
||||
"freebsd",
|
||||
"linux",
|
||||
"openbsd",
|
||||
"sunos",
|
||||
"win32",
|
||||
"aix",
|
||||
].indexOf(platform) !== -1) {
|
||||
let file;
|
||||
if (platform === "aix") {
|
||||
// AIX `netstat` output is compatible with Solaris
|
||||
file = `${os.type() === "OS400" ? "ibmi" : "sunos"}.js`;
|
||||
} else {
|
||||
file = `${platform}.js`;
|
||||
}
|
||||
|
||||
const m = require(`./${file}`);
|
||||
module.exports.v4 = () => m.v4();
|
||||
module.exports.v6 = () => m.v6();
|
||||
module.exports.v4.sync = () => m.v4.sync();
|
||||
module.exports.v6.sync = () => m.v6.sync();
|
||||
} else {
|
||||
const unsupported = () => { throw new Error(`Unsupported Platform: ${platform}`); };
|
||||
module.exports.v4 = unsupported;
|
||||
module.exports.v6 = unsupported;
|
||||
module.exports.v4.sync = unsupported;
|
||||
module.exports.v6.sync = unsupported;
|
||||
}
|
58
web/node_modules/default-gateway/linux.js
generated
vendored
Normal file
58
web/node_modules/default-gateway/linux.js
generated
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
"use strict";
|
||||
|
||||
const net = require("net");
|
||||
const os = require("os");
|
||||
const execa = require("execa");
|
||||
|
||||
const args = {
|
||||
v4: ["-4", "r"],
|
||||
v6: ["-6", "r"],
|
||||
};
|
||||
|
||||
const parse = (stdout, family) => {
|
||||
let result;
|
||||
|
||||
(stdout || "").trim().split("\n").some(line => {
|
||||
const results = /default( via .+?)?( dev .+?)( |$)/.exec(line) || [];
|
||||
const gateway = (results[1] || "").substring(5);
|
||||
const iface = (results[2] || "").substring(5);
|
||||
if (gateway && net.isIP(gateway)) { // default via 1.2.3.4 dev en0
|
||||
result = {gateway, interface: (iface ? iface : null)};
|
||||
return true;
|
||||
} else if (iface && !gateway) { // default via dev en0
|
||||
const interfaces = os.networkInterfaces();
|
||||
const addresses = interfaces[iface];
|
||||
if (!addresses || !addresses.length) return;
|
||||
|
||||
addresses.some(addr => {
|
||||
if (addr.family.substring(2) === family && net.isIP(addr.address)) {
|
||||
result = {gateway: addr.address, interface: (iface ? iface : null)};
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (!result) {
|
||||
throw new Error("Unable to determine default gateway");
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
const promise = family => {
|
||||
return execa.stdout("ip", args[family]).then(stdout => {
|
||||
return parse(stdout, family);
|
||||
});
|
||||
};
|
||||
|
||||
const sync = family => {
|
||||
const result = execa.sync("ip", args[family]);
|
||||
return parse(result.stdout, family);
|
||||
};
|
||||
|
||||
module.exports.v4 = () => promise("v4");
|
||||
module.exports.v6 = () => promise("v6");
|
||||
|
||||
module.exports.v4.sync = () => sync("v4");
|
||||
module.exports.v6.sync = () => sync("v6");
|
1
web/node_modules/default-gateway/node_modules/.bin/semver
generated
vendored
Symbolic link
1
web/node_modules/default-gateway/node_modules/.bin/semver
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
|||
../semver/bin/semver
|
1
web/node_modules/default-gateway/node_modules/.bin/which
generated
vendored
Symbolic link
1
web/node_modules/default-gateway/node_modules/.bin/which
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
|||
../which/bin/which
|
100
web/node_modules/default-gateway/node_modules/cross-spawn/CHANGELOG.md
generated
vendored
Normal file
100
web/node_modules/default-gateway/node_modules/cross-spawn/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,100 @@
|
|||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
<a name="6.0.5"></a>
|
||||
## [6.0.5](https://github.com/moxystudio/node-cross-spawn/compare/v6.0.4...v6.0.5) (2018-03-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* avoid using deprecated Buffer constructor ([#94](https://github.com/moxystudio/node-cross-spawn/issues/94)) ([d5770df](https://github.com/moxystudio/node-cross-spawn/commit/d5770df)), closes [/nodejs.org/api/deprecations.html#deprecations_dep0005](https://github.com//nodejs.org/api/deprecations.html/issues/deprecations_dep0005)
|
||||
|
||||
|
||||
|
||||
<a name="6.0.4"></a>
|
||||
## [6.0.4](https://github.com/moxystudio/node-cross-spawn/compare/v6.0.3...v6.0.4) (2018-01-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix paths being incorrectly normalized on unix ([06ee3c6](https://github.com/moxystudio/node-cross-spawn/commit/06ee3c6)), closes [#90](https://github.com/moxystudio/node-cross-spawn/issues/90)
|
||||
|
||||
|
||||
|
||||
<a name="6.0.3"></a>
|
||||
## [6.0.3](https://github.com/moxystudio/node-cross-spawn/compare/v6.0.2...v6.0.3) (2018-01-23)
|
||||
|
||||
|
||||
|
||||
<a name="6.0.2"></a>
|
||||
## [6.0.2](https://github.com/moxystudio/node-cross-spawn/compare/v6.0.1...v6.0.2) (2018-01-23)
|
||||
|
||||
|
||||
|
||||
<a name="6.0.1"></a>
|
||||
## [6.0.1](https://github.com/moxystudio/node-cross-spawn/compare/v6.0.0...v6.0.1) (2018-01-23)
|
||||
|
||||
|
||||
|
||||
<a name="6.0.0"></a>
|
||||
# [6.0.0](https://github.com/moxystudio/node-cross-spawn/compare/5.1.0...6.0.0) (2018-01-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix certain arguments not being correctly escaped or causing batch syntax error ([900cf10](https://github.com/moxystudio/node-cross-spawn/commit/900cf10)), closes [#82](https://github.com/moxystudio/node-cross-spawn/issues/82) [#51](https://github.com/moxystudio/node-cross-spawn/issues/51)
|
||||
* fix commands as posix relatixe paths not working correctly, e.g.: `./my-command` ([900cf10](https://github.com/moxystudio/node-cross-spawn/commit/900cf10))
|
||||
* fix `options` argument being mutated ([900cf10](https://github.com/moxystudio/node-cross-spawn/commit/900cf10))
|
||||
* fix commands resolution when PATH was actually Path ([900cf10](https://github.com/moxystudio/node-cross-spawn/commit/900cf10))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* improve compliance with node's ENOENT errors ([900cf10](https://github.com/moxystudio/node-cross-spawn/commit/900cf10))
|
||||
* improve detection of node's shell option support ([900cf10](https://github.com/moxystudio/node-cross-spawn/commit/900cf10))
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* upgrade tooling
|
||||
* upgrate project to es6 (node v4)
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* remove support for older nodejs versions, only `node >= 4` is supported
|
||||
|
||||
|
||||
<a name="5.1.0"></a>
|
||||
## [5.1.0](https://github.com/moxystudio/node-cross-spawn/compare/5.0.1...5.1.0) (2017-02-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix `options.shell` support for NodeJS [v4.8](https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V4.md#4.8.0)
|
||||
|
||||
|
||||
<a name="5.0.1"></a>
|
||||
## [5.0.1](https://github.com/moxystudio/node-cross-spawn/compare/5.0.0...5.0.1) (2016-11-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix `options.shell` support for NodeJS v7
|
||||
|
||||
|
||||
<a name="5.0.0"></a>
|
||||
# [5.0.0](https://github.com/moxystudio/node-cross-spawn/compare/4.0.2...5.0.0) (2016-10-30)
|
||||
|
||||
|
||||
## Features
|
||||
|
||||
* add support for `options.shell`
|
||||
* improve parsing of shebangs by using [`shebang-command`](https://github.com/kevva/shebang-command) module
|
||||
|
||||
|
||||
## Chores
|
||||
|
||||
* refactor some code to make it more clear
|
||||
* update README caveats
|
21
web/node_modules/default-gateway/node_modules/cross-spawn/LICENSE
generated
vendored
Normal file
21
web/node_modules/default-gateway/node_modules/cross-spawn/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 Made With MOXY Lda <hello@moxy.studio>
|
||||
|
||||
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.
|
94
web/node_modules/default-gateway/node_modules/cross-spawn/README.md
generated
vendored
Normal file
94
web/node_modules/default-gateway/node_modules/cross-spawn/README.md
generated
vendored
Normal file
|
@ -0,0 +1,94 @@
|
|||
# cross-spawn
|
||||
|
||||
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Build status][appveyor-image]][appveyor-url] [![Coverage Status][codecov-image]][codecov-url] [![Dependency status][david-dm-image]][david-dm-url] [![Dev Dependency status][david-dm-dev-image]][david-dm-dev-url] [![Greenkeeper badge][greenkeeper-image]][greenkeeper-url]
|
||||
|
||||
[npm-url]:https://npmjs.org/package/cross-spawn
|
||||
[downloads-image]:http://img.shields.io/npm/dm/cross-spawn.svg
|
||||
[npm-image]:http://img.shields.io/npm/v/cross-spawn.svg
|
||||
[travis-url]:https://travis-ci.org/moxystudio/node-cross-spawn
|
||||
[travis-image]:http://img.shields.io/travis/moxystudio/node-cross-spawn/master.svg
|
||||
[appveyor-url]:https://ci.appveyor.com/project/satazor/node-cross-spawn
|
||||
[appveyor-image]:https://img.shields.io/appveyor/ci/satazor/node-cross-spawn/master.svg
|
||||
[codecov-url]:https://codecov.io/gh/moxystudio/node-cross-spawn
|
||||
[codecov-image]:https://img.shields.io/codecov/c/github/moxystudio/node-cross-spawn/master.svg
|
||||
[david-dm-url]:https://david-dm.org/moxystudio/node-cross-spawn
|
||||
[david-dm-image]:https://img.shields.io/david/moxystudio/node-cross-spawn.svg
|
||||
[david-dm-dev-url]:https://david-dm.org/moxystudio/node-cross-spawn?type=dev
|
||||
[david-dm-dev-image]:https://img.shields.io/david/dev/moxystudio/node-cross-spawn.svg
|
||||
[greenkeeper-image]:https://badges.greenkeeper.io/moxystudio/node-cross-spawn.svg
|
||||
[greenkeeper-url]:https://greenkeeper.io/
|
||||
|
||||
A cross platform solution to node's spawn and spawnSync.
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
`$ npm install cross-spawn`
|
||||
|
||||
|
||||
## Why
|
||||
|
||||
Node has issues when using spawn on Windows:
|
||||
|
||||
- It ignores [PATHEXT](https://github.com/joyent/node/issues/2318)
|
||||
- It does not support [shebangs](https://en.wikipedia.org/wiki/Shebang_(Unix))
|
||||
- Has problems running commands with [spaces](https://github.com/nodejs/node/issues/7367)
|
||||
- Has problems running commands with posix relative paths (e.g.: `./my-folder/my-executable`)
|
||||
- Has an [issue](https://github.com/moxystudio/node-cross-spawn/issues/82) with command shims (files in `node_modules/.bin/`), where arguments with quotes and parenthesis would result in [invalid syntax error](https://github.com/moxystudio/node-cross-spawn/blob/e77b8f22a416db46b6196767bcd35601d7e11d54/test/index.test.js#L149)
|
||||
- No `options.shell` support on node `<v4.8`
|
||||
|
||||
All these issues are handled correctly by `cross-spawn`.
|
||||
There are some known modules, such as [win-spawn](https://github.com/ForbesLindesay/win-spawn), that try to solve this but they are either broken or provide faulty escaping of shell arguments.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Exactly the same way as node's [`spawn`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options) or [`spawnSync`](https://nodejs.org/api/child_process.html#child_process_child_process_spawnsync_command_args_options), so it's a drop in replacement.
|
||||
|
||||
|
||||
```js
|
||||
const spawn = require('cross-spawn');
|
||||
|
||||
// Spawn NPM asynchronously
|
||||
const child = spawn('npm', ['list', '-g', '-depth', '0'], { stdio: 'inherit' });
|
||||
|
||||
// Spawn NPM synchronously
|
||||
const result = spawn.sync('npm', ['list', '-g', '-depth', '0'], { stdio: 'inherit' });
|
||||
```
|
||||
|
||||
|
||||
## Caveats
|
||||
|
||||
### Using `options.shell` as an alternative to `cross-spawn`
|
||||
|
||||
Starting from node `v4.8`, `spawn` has a `shell` option that allows you run commands from within a shell. This new option solves
|
||||
the [PATHEXT](https://github.com/joyent/node/issues/2318) issue but:
|
||||
|
||||
- It's not supported in node `<v4.8`
|
||||
- You must manually escape the command and arguments which is very error prone, specially when passing user input
|
||||
- There are a lot of other unresolved issues from the [Why](#why) section that you must take into account
|
||||
|
||||
If you are using the `shell` option to spawn a command in a cross platform way, consider using `cross-spawn` instead. You have been warned.
|
||||
|
||||
### `options.shell` support
|
||||
|
||||
While `cross-spawn` adds support for `options.shell` in node `<v4.8`, all of its enhancements are disabled.
|
||||
|
||||
This mimics the Node.js behavior. More specifically, the command and its arguments will not be automatically escaped nor shebang support will be offered. This is by design because if you are using `options.shell` you are probably targeting a specific platform anyway and you don't want things to get into your way.
|
||||
|
||||
### Shebangs support
|
||||
|
||||
While `cross-spawn` handles shebangs on Windows, its support is limited. More specifically, it just supports `#!/usr/bin/env <program>` where `<program>` must not contain any arguments.
|
||||
If you would like to have the shebang support improved, feel free to contribute via a pull-request.
|
||||
|
||||
Remember to always test your code on Windows!
|
||||
|
||||
|
||||
## Tests
|
||||
|
||||
`$ npm test`
|
||||
`$ npm test -- --watch` during development
|
||||
|
||||
## License
|
||||
|
||||
Released under the [MIT License](http://www.opensource.org/licenses/mit-license.php).
|
39
web/node_modules/default-gateway/node_modules/cross-spawn/index.js
generated
vendored
Normal file
39
web/node_modules/default-gateway/node_modules/cross-spawn/index.js
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
'use strict';
|
||||
|
||||
const cp = require('child_process');
|
||||
const parse = require('./lib/parse');
|
||||
const enoent = require('./lib/enoent');
|
||||
|
||||
function spawn(command, args, options) {
|
||||
// Parse the arguments
|
||||
const parsed = parse(command, args, options);
|
||||
|
||||
// Spawn the child process
|
||||
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
||||
|
||||
// Hook into child process "exit" event to emit an error if the command
|
||||
// does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
||||
enoent.hookChildProcess(spawned, parsed);
|
||||
|
||||
return spawned;
|
||||
}
|
||||
|
||||
function spawnSync(command, args, options) {
|
||||
// Parse the arguments
|
||||
const parsed = parse(command, args, options);
|
||||
|
||||
// Spawn the child process
|
||||
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
||||
|
||||
// Analyze if the command does not exist, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
||||
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = spawn;
|
||||
module.exports.spawn = spawn;
|
||||
module.exports.sync = spawnSync;
|
||||
|
||||
module.exports._parse = parse;
|
||||
module.exports._enoent = enoent;
|
59
web/node_modules/default-gateway/node_modules/cross-spawn/lib/enoent.js
generated
vendored
Normal file
59
web/node_modules/default-gateway/node_modules/cross-spawn/lib/enoent.js
generated
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
'use strict';
|
||||
|
||||
const isWin = process.platform === 'win32';
|
||||
|
||||
function notFoundError(original, syscall) {
|
||||
return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
|
||||
code: 'ENOENT',
|
||||
errno: 'ENOENT',
|
||||
syscall: `${syscall} ${original.command}`,
|
||||
path: original.command,
|
||||
spawnargs: original.args,
|
||||
});
|
||||
}
|
||||
|
||||
function hookChildProcess(cp, parsed) {
|
||||
if (!isWin) {
|
||||
return;
|
||||
}
|
||||
|
||||
const originalEmit = cp.emit;
|
||||
|
||||
cp.emit = function (name, arg1) {
|
||||
// If emitting "exit" event and exit code is 1, we need to check if
|
||||
// the command exists and emit an "error" instead
|
||||
// See https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
||||
if (name === 'exit') {
|
||||
const err = verifyENOENT(arg1, parsed, 'spawn');
|
||||
|
||||
if (err) {
|
||||
return originalEmit.call(cp, 'error', err);
|
||||
}
|
||||
}
|
||||
|
||||
return originalEmit.apply(cp, arguments); // eslint-disable-line prefer-rest-params
|
||||
};
|
||||
}
|
||||
|
||||
function verifyENOENT(status, parsed) {
|
||||
if (isWin && status === 1 && !parsed.file) {
|
||||
return notFoundError(parsed.original, 'spawn');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function verifyENOENTSync(status, parsed) {
|
||||
if (isWin && status === 1 && !parsed.file) {
|
||||
return notFoundError(parsed.original, 'spawnSync');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
hookChildProcess,
|
||||
verifyENOENT,
|
||||
verifyENOENTSync,
|
||||
notFoundError,
|
||||
};
|
125
web/node_modules/default-gateway/node_modules/cross-spawn/lib/parse.js
generated
vendored
Normal file
125
web/node_modules/default-gateway/node_modules/cross-spawn/lib/parse.js
generated
vendored
Normal file
|
@ -0,0 +1,125 @@
|
|||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const niceTry = require('nice-try');
|
||||
const resolveCommand = require('./util/resolveCommand');
|
||||
const escape = require('./util/escape');
|
||||
const readShebang = require('./util/readShebang');
|
||||
const semver = require('semver');
|
||||
|
||||
const isWin = process.platform === 'win32';
|
||||
const isExecutableRegExp = /\.(?:com|exe)$/i;
|
||||
const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
||||
|
||||
// `options.shell` is supported in Node ^4.8.0, ^5.7.0 and >= 6.0.0
|
||||
const supportsShellOption = niceTry(() => semver.satisfies(process.version, '^4.8.0 || ^5.7.0 || >= 6.0.0', true)) || false;
|
||||
|
||||
function detectShebang(parsed) {
|
||||
parsed.file = resolveCommand(parsed);
|
||||
|
||||
const shebang = parsed.file && readShebang(parsed.file);
|
||||
|
||||
if (shebang) {
|
||||
parsed.args.unshift(parsed.file);
|
||||
parsed.command = shebang;
|
||||
|
||||
return resolveCommand(parsed);
|
||||
}
|
||||
|
||||
return parsed.file;
|
||||
}
|
||||
|
||||
function parseNonShell(parsed) {
|
||||
if (!isWin) {
|
||||
return parsed;
|
||||
}
|
||||
|
||||
// Detect & add support for shebangs
|
||||
const commandFile = detectShebang(parsed);
|
||||
|
||||
// We don't need a shell if the command filename is an executable
|
||||
const needsShell = !isExecutableRegExp.test(commandFile);
|
||||
|
||||
// If a shell is required, use cmd.exe and take care of escaping everything correctly
|
||||
// Note that `forceShell` is an hidden option used only in tests
|
||||
if (parsed.options.forceShell || needsShell) {
|
||||
// Need to double escape meta chars if the command is a cmd-shim located in `node_modules/.bin/`
|
||||
// The cmd-shim simply calls execute the package bin file with NodeJS, proxying any argument
|
||||
// Because the escape of metachars with ^ gets interpreted when the cmd.exe is first called,
|
||||
// we need to double escape them
|
||||
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
||||
|
||||
// Normalize posix paths into OS compatible paths (e.g.: foo/bar -> foo\bar)
|
||||
// This is necessary otherwise it will always fail with ENOENT in those cases
|
||||
parsed.command = path.normalize(parsed.command);
|
||||
|
||||
// Escape command & arguments
|
||||
parsed.command = escape.command(parsed.command);
|
||||
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
|
||||
|
||||
const shellCommand = [parsed.command].concat(parsed.args).join(' ');
|
||||
|
||||
parsed.args = ['/d', '/s', '/c', `"${shellCommand}"`];
|
||||
parsed.command = process.env.comspec || 'cmd.exe';
|
||||
parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped
|
||||
}
|
||||
|
||||
return parsed;
|
||||
}
|
||||
|
||||
function parseShell(parsed) {
|
||||
// If node supports the shell option, there's no need to mimic its behavior
|
||||
if (supportsShellOption) {
|
||||
return parsed;
|
||||
}
|
||||
|
||||
// Mimic node shell option
|
||||
// See https://github.com/nodejs/node/blob/b9f6a2dc059a1062776133f3d4fd848c4da7d150/lib/child_process.js#L335
|
||||
const shellCommand = [parsed.command].concat(parsed.args).join(' ');
|
||||
|
||||
if (isWin) {
|
||||
parsed.command = typeof parsed.options.shell === 'string' ? parsed.options.shell : process.env.comspec || 'cmd.exe';
|
||||
parsed.args = ['/d', '/s', '/c', `"${shellCommand}"`];
|
||||
parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped
|
||||
} else {
|
||||
if (typeof parsed.options.shell === 'string') {
|
||||
parsed.command = parsed.options.shell;
|
||||
} else if (process.platform === 'android') {
|
||||
parsed.command = '/system/bin/sh';
|
||||
} else {
|
||||
parsed.command = '/bin/sh';
|
||||
}
|
||||
|
||||
parsed.args = ['-c', shellCommand];
|
||||
}
|
||||
|
||||
return parsed;
|
||||
}
|
||||
|
||||
function parse(command, args, options) {
|
||||
// Normalize arguments, similar to nodejs
|
||||
if (args && !Array.isArray(args)) {
|
||||
options = args;
|
||||
args = null;
|
||||
}
|
||||
|
||||
args = args ? args.slice(0) : []; // Clone array to avoid changing the original
|
||||
options = Object.assign({}, options); // Clone object to avoid changing the original
|
||||
|
||||
// Build our parsed object
|
||||
const parsed = {
|
||||
command,
|
||||
args,
|
||||
options,
|
||||
file: undefined,
|
||||
original: {
|
||||
command,
|
||||
args,
|
||||
},
|
||||
};
|
||||
|
||||
// Delegate further parsing to shell or non-shell
|
||||
return options.shell ? parseShell(parsed) : parseNonShell(parsed);
|
||||
}
|
||||
|
||||
module.exports = parse;
|
45
web/node_modules/default-gateway/node_modules/cross-spawn/lib/util/escape.js
generated
vendored
Normal file
45
web/node_modules/default-gateway/node_modules/cross-spawn/lib/util/escape.js
generated
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
'use strict';
|
||||
|
||||
// See http://www.robvanderwoude.com/escapechars.php
|
||||
const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
||||
|
||||
function escapeCommand(arg) {
|
||||
// Escape meta chars
|
||||
arg = arg.replace(metaCharsRegExp, '^$1');
|
||||
|
||||
return arg;
|
||||
}
|
||||
|
||||
function escapeArgument(arg, doubleEscapeMetaChars) {
|
||||
// Convert to string
|
||||
arg = `${arg}`;
|
||||
|
||||
// Algorithm below is based on https://qntm.org/cmd
|
||||
|
||||
// Sequence of backslashes followed by a double quote:
|
||||
// double up all the backslashes and escape the double quote
|
||||
arg = arg.replace(/(\\*)"/g, '$1$1\\"');
|
||||
|
||||
// Sequence of backslashes followed by the end of the string
|
||||
// (which will become a double quote later):
|
||||
// double up all the backslashes
|
||||
arg = arg.replace(/(\\*)$/, '$1$1');
|
||||
|
||||
// All other backslashes occur literally
|
||||
|
||||
// Quote the whole thing:
|
||||
arg = `"${arg}"`;
|
||||
|
||||
// Escape meta chars
|
||||
arg = arg.replace(metaCharsRegExp, '^$1');
|
||||
|
||||
// Double escape meta chars if necessary
|
||||
if (doubleEscapeMetaChars) {
|
||||
arg = arg.replace(metaCharsRegExp, '^$1');
|
||||
}
|
||||
|
||||
return arg;
|
||||
}
|
||||
|
||||
module.exports.command = escapeCommand;
|
||||
module.exports.argument = escapeArgument;
|
32
web/node_modules/default-gateway/node_modules/cross-spawn/lib/util/readShebang.js
generated
vendored
Normal file
32
web/node_modules/default-gateway/node_modules/cross-spawn/lib/util/readShebang.js
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const shebangCommand = require('shebang-command');
|
||||
|
||||
function readShebang(command) {
|
||||
// Read the first 150 bytes from the file
|
||||
const size = 150;
|
||||
let buffer;
|
||||
|
||||
if (Buffer.alloc) {
|
||||
// Node.js v4.5+ / v5.10+
|
||||
buffer = Buffer.alloc(size);
|
||||
} else {
|
||||
// Old Node.js API
|
||||
buffer = new Buffer(size);
|
||||
buffer.fill(0); // zero-fill
|
||||
}
|
||||
|
||||
let fd;
|
||||
|
||||
try {
|
||||
fd = fs.openSync(command, 'r');
|
||||
fs.readSync(fd, buffer, 0, size, 0);
|
||||
fs.closeSync(fd);
|
||||
} catch (e) { /* Empty */ }
|
||||
|
||||
// Attempt to extract shebang (null is returned if not a shebang)
|
||||
return shebangCommand(buffer.toString());
|
||||
}
|
||||
|
||||
module.exports = readShebang;
|
47
web/node_modules/default-gateway/node_modules/cross-spawn/lib/util/resolveCommand.js
generated
vendored
Normal file
47
web/node_modules/default-gateway/node_modules/cross-spawn/lib/util/resolveCommand.js
generated
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const which = require('which');
|
||||
const pathKey = require('path-key')();
|
||||
|
||||
function resolveCommandAttempt(parsed, withoutPathExt) {
|
||||
const cwd = process.cwd();
|
||||
const hasCustomCwd = parsed.options.cwd != null;
|
||||
|
||||
// If a custom `cwd` was specified, we need to change the process cwd
|
||||
// because `which` will do stat calls but does not support a custom cwd
|
||||
if (hasCustomCwd) {
|
||||
try {
|
||||
process.chdir(parsed.options.cwd);
|
||||
} catch (err) {
|
||||
/* Empty */
|
||||
}
|
||||
}
|
||||
|
||||
let resolved;
|
||||
|
||||
try {
|
||||
resolved = which.sync(parsed.command, {
|
||||
path: (parsed.options.env || process.env)[pathKey],
|
||||
pathExt: withoutPathExt ? path.delimiter : undefined,
|
||||
});
|
||||
} catch (e) {
|
||||
/* Empty */
|
||||
} finally {
|
||||
process.chdir(cwd);
|
||||
}
|
||||
|
||||
// If we successfully resolved, ensure that an absolute path is returned
|
||||
// Note that when a custom `cwd` was used, we need to resolve to an absolute path based on it
|
||||
if (resolved) {
|
||||
resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved);
|
||||
}
|
||||
|
||||
return resolved;
|
||||
}
|
||||
|
||||
function resolveCommand(parsed) {
|
||||
return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
|
||||
}
|
||||
|
||||
module.exports = resolveCommand;
|
76
web/node_modules/default-gateway/node_modules/cross-spawn/package.json
generated
vendored
Normal file
76
web/node_modules/default-gateway/node_modules/cross-spawn/package.json
generated
vendored
Normal file
|
@ -0,0 +1,76 @@
|
|||
{
|
||||
"name": "cross-spawn",
|
||||
"version": "6.0.5",
|
||||
"description": "Cross platform child_process#spawn and child_process#spawnSync",
|
||||
"keywords": [
|
||||
"spawn",
|
||||
"spawnSync",
|
||||
"windows",
|
||||
"cross-platform",
|
||||
"path-ext",
|
||||
"shebang",
|
||||
"cmd",
|
||||
"execute"
|
||||
],
|
||||
"author": "André Cruz <andre@moxy.studio>",
|
||||
"homepage": "https://github.com/moxystudio/node-cross-spawn",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:moxystudio/node-cross-spawn.git"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"test": "jest --env node --coverage",
|
||||
"prerelease": "npm t && npm run lint",
|
||||
"release": "standard-version",
|
||||
"precommit": "lint-staged",
|
||||
"commitmsg": "commitlint -e $GIT_PARAMS"
|
||||
},
|
||||
"standard-version": {
|
||||
"scripts": {
|
||||
"posttag": "git push --follow-tags origin master && npm publish"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
"eslint --fix",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"commitlint": {
|
||||
"extends": [
|
||||
"@commitlint/config-conventional"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"nice-try": "^1.0.4",
|
||||
"path-key": "^2.0.1",
|
||||
"semver": "^5.5.0",
|
||||
"shebang-command": "^1.2.0",
|
||||
"which": "^1.2.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^6.0.0",
|
||||
"@commitlint/config-conventional": "^6.0.2",
|
||||
"babel-core": "^6.26.0",
|
||||
"babel-jest": "^22.1.0",
|
||||
"babel-preset-moxy": "^2.2.1",
|
||||
"eslint": "^4.3.0",
|
||||
"eslint-config-moxy": "^5.0.0",
|
||||
"husky": "^0.14.3",
|
||||
"jest": "^22.0.0",
|
||||
"lint-staged": "^7.0.0",
|
||||
"mkdirp": "^0.5.1",
|
||||
"regenerator-runtime": "^0.11.1",
|
||||
"rimraf": "^2.6.2",
|
||||
"standard-version": "^4.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.8"
|
||||
}
|
||||
}
|
361
web/node_modules/default-gateway/node_modules/execa/index.js
generated
vendored
Normal file
361
web/node_modules/default-gateway/node_modules/execa/index.js
generated
vendored
Normal file
|
@ -0,0 +1,361 @@
|
|||
'use strict';
|
||||
const path = require('path');
|
||||
const childProcess = require('child_process');
|
||||
const crossSpawn = require('cross-spawn');
|
||||
const stripEof = require('strip-eof');
|
||||
const npmRunPath = require('npm-run-path');
|
||||
const isStream = require('is-stream');
|
||||
const _getStream = require('get-stream');
|
||||
const pFinally = require('p-finally');
|
||||
const onExit = require('signal-exit');
|
||||
const errname = require('./lib/errname');
|
||||
const stdio = require('./lib/stdio');
|
||||
|
||||
const TEN_MEGABYTES = 1000 * 1000 * 10;
|
||||
|
||||
function handleArgs(cmd, args, opts) {
|
||||
let parsed;
|
||||
|
||||
opts = Object.assign({
|
||||
extendEnv: true,
|
||||
env: {}
|
||||
}, opts);
|
||||
|
||||
if (opts.extendEnv) {
|
||||
opts.env = Object.assign({}, process.env, opts.env);
|
||||
}
|
||||
|
||||
if (opts.__winShell === true) {
|
||||
delete opts.__winShell;
|
||||
parsed = {
|
||||
command: cmd,
|
||||
args,
|
||||
options: opts,
|
||||
file: cmd,
|
||||
original: {
|
||||
cmd,
|
||||
args
|
||||
}
|
||||
};
|
||||
} else {
|
||||
parsed = crossSpawn._parse(cmd, args, opts);
|
||||
}
|
||||
|
||||
opts = Object.assign({
|
||||
maxBuffer: TEN_MEGABYTES,
|
||||
buffer: true,
|
||||
stripEof: true,
|
||||
preferLocal: true,
|
||||
localDir: parsed.options.cwd || process.cwd(),
|
||||
encoding: 'utf8',
|
||||
reject: true,
|
||||
cleanup: true
|
||||
}, parsed.options);
|
||||
|
||||
opts.stdio = stdio(opts);
|
||||
|
||||
if (opts.preferLocal) {
|
||||
opts.env = npmRunPath.env(Object.assign({}, opts, {cwd: opts.localDir}));
|
||||
}
|
||||
|
||||
if (opts.detached) {
|
||||
// #115
|
||||
opts.cleanup = false;
|
||||
}
|
||||
|
||||
if (process.platform === 'win32' && path.basename(parsed.command) === 'cmd.exe') {
|
||||
// #116
|
||||
parsed.args.unshift('/q');
|
||||
}
|
||||
|
||||
return {
|
||||
cmd: parsed.command,
|
||||
args: parsed.args,
|
||||
opts,
|
||||
parsed
|
||||
};
|
||||
}
|
||||
|
||||
function handleInput(spawned, input) {
|
||||
if (input === null || input === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isStream(input)) {
|
||||
input.pipe(spawned.stdin);
|
||||
} else {
|
||||
spawned.stdin.end(input);
|
||||
}
|
||||
}
|
||||
|
||||
function handleOutput(opts, val) {
|
||||
if (val && opts.stripEof) {
|
||||
val = stripEof(val);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
function handleShell(fn, cmd, opts) {
|
||||
let file = '/bin/sh';
|
||||
let args = ['-c', cmd];
|
||||
|
||||
opts = Object.assign({}, opts);
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
opts.__winShell = true;
|
||||
file = process.env.comspec || 'cmd.exe';
|
||||
args = ['/s', '/c', `"${cmd}"`];
|
||||
opts.windowsVerbatimArguments = true;
|
||||
}
|
||||
|
||||
if (opts.shell) {
|
||||
file = opts.shell;
|
||||
delete opts.shell;
|
||||
}
|
||||
|
||||
return fn(file, args, opts);
|
||||
}
|
||||
|
||||
function getStream(process, stream, {encoding, buffer, maxBuffer}) {
|
||||
if (!process[stream]) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let ret;
|
||||
|
||||
if (!buffer) {
|
||||
// TODO: Use `ret = util.promisify(stream.finished)(process[stream]);` when targeting Node.js 10
|
||||
ret = new Promise((resolve, reject) => {
|
||||
process[stream]
|
||||
.once('end', resolve)
|
||||
.once('error', reject);
|
||||
});
|
||||
} else if (encoding) {
|
||||
ret = _getStream(process[stream], {
|
||||
encoding,
|
||||
maxBuffer
|
||||
});
|
||||
} else {
|
||||
ret = _getStream.buffer(process[stream], {maxBuffer});
|
||||
}
|
||||
|
||||
return ret.catch(err => {
|
||||
err.stream = stream;
|
||||
err.message = `${stream} ${err.message}`;
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
|
||||
function makeError(result, options) {
|
||||
const {stdout, stderr} = result;
|
||||
|
||||
let err = result.error;
|
||||
const {code, signal} = result;
|
||||
|
||||
const {parsed, joinedCmd} = options;
|
||||
const timedOut = options.timedOut || false;
|
||||
|
||||
if (!err) {
|
||||
let output = '';
|
||||
|
||||
if (Array.isArray(parsed.opts.stdio)) {
|
||||
if (parsed.opts.stdio[2] !== 'inherit') {
|
||||
output += output.length > 0 ? stderr : `\n${stderr}`;
|
||||
}
|
||||
|
||||
if (parsed.opts.stdio[1] !== 'inherit') {
|
||||
output += `\n${stdout}`;
|
||||
}
|
||||
} else if (parsed.opts.stdio !== 'inherit') {
|
||||
output = `\n${stderr}${stdout}`;
|
||||
}
|
||||
|
||||
err = new Error(`Command failed: ${joinedCmd}${output}`);
|
||||
err.code = code < 0 ? errname(code) : code;
|
||||
}
|
||||
|
||||
err.stdout = stdout;
|
||||
err.stderr = stderr;
|
||||
err.failed = true;
|
||||
err.signal = signal || null;
|
||||
err.cmd = joinedCmd;
|
||||
err.timedOut = timedOut;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
function joinCmd(cmd, args) {
|
||||
let joinedCmd = cmd;
|
||||
|
||||
if (Array.isArray(args) && args.length > 0) {
|
||||
joinedCmd += ' ' + args.join(' ');
|
||||
}
|
||||
|
||||
return joinedCmd;
|
||||
}
|
||||
|
||||
module.exports = (cmd, args, opts) => {
|
||||
const parsed = handleArgs(cmd, args, opts);
|
||||
const {encoding, buffer, maxBuffer} = parsed.opts;
|
||||
const joinedCmd = joinCmd(cmd, args);
|
||||
|
||||
let spawned;
|
||||
try {
|
||||
spawned = childProcess.spawn(parsed.cmd, parsed.args, parsed.opts);
|
||||
} catch (err) {
|
||||
return Promise.reject(err);
|
||||
}
|
||||
|
||||
let removeExitHandler;
|
||||
if (parsed.opts.cleanup) {
|
||||
removeExitHandler = onExit(() => {
|
||||
spawned.kill();
|
||||
});
|
||||
}
|
||||
|
||||
let timeoutId = null;
|
||||
let timedOut = false;
|
||||
|
||||
const cleanup = () => {
|
||||
if (timeoutId) {
|
||||
clearTimeout(timeoutId);
|
||||
timeoutId = null;
|
||||
}
|
||||
|
||||
if (removeExitHandler) {
|
||||
removeExitHandler();
|
||||
}
|
||||
};
|
||||
|
||||
if (parsed.opts.timeout > 0) {
|
||||
timeoutId = setTimeout(() => {
|
||||
timeoutId = null;
|
||||
timedOut = true;
|
||||
spawned.kill(parsed.opts.killSignal);
|
||||
}, parsed.opts.timeout);
|
||||
}
|
||||
|
||||
const processDone = new Promise(resolve => {
|
||||
spawned.on('exit', (code, signal) => {
|
||||
cleanup();
|
||||
resolve({code, signal});
|
||||
});
|
||||
|
||||
spawned.on('error', err => {
|
||||
cleanup();
|
||||
resolve({error: err});
|
||||
});
|
||||
|
||||
if (spawned.stdin) {
|
||||
spawned.stdin.on('error', err => {
|
||||
cleanup();
|
||||
resolve({error: err});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function destroy() {
|
||||
if (spawned.stdout) {
|
||||
spawned.stdout.destroy();
|
||||
}
|
||||
|
||||
if (spawned.stderr) {
|
||||
spawned.stderr.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
const handlePromise = () => pFinally(Promise.all([
|
||||
processDone,
|
||||
getStream(spawned, 'stdout', {encoding, buffer, maxBuffer}),
|
||||
getStream(spawned, 'stderr', {encoding, buffer, maxBuffer})
|
||||
]).then(arr => {
|
||||
const result = arr[0];
|
||||
result.stdout = arr[1];
|
||||
result.stderr = arr[2];
|
||||
|
||||
if (result.error || result.code !== 0 || result.signal !== null) {
|
||||
const err = makeError(result, {
|
||||
joinedCmd,
|
||||
parsed,
|
||||
timedOut
|
||||
});
|
||||
|
||||
// TODO: missing some timeout logic for killed
|
||||
// https://github.com/nodejs/node/blob/master/lib/child_process.js#L203
|
||||
// err.killed = spawned.killed || killed;
|
||||
err.killed = err.killed || spawned.killed;
|
||||
|
||||
if (!parsed.opts.reject) {
|
||||
return err;
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
|
||||
return {
|
||||
stdout: handleOutput(parsed.opts, result.stdout),
|
||||
stderr: handleOutput(parsed.opts, result.stderr),
|
||||
code: 0,
|
||||
failed: false,
|
||||
killed: false,
|
||||
signal: null,
|
||||
cmd: joinedCmd,
|
||||
timedOut: false
|
||||
};
|
||||
}), destroy);
|
||||
|
||||
crossSpawn._enoent.hookChildProcess(spawned, parsed.parsed);
|
||||
|
||||
handleInput(spawned, parsed.opts.input);
|
||||
|
||||
spawned.then = (onfulfilled, onrejected) => handlePromise().then(onfulfilled, onrejected);
|
||||
spawned.catch = onrejected => handlePromise().catch(onrejected);
|
||||
|
||||
return spawned;
|
||||
};
|
||||
|
||||
// TODO: set `stderr: 'ignore'` when that option is implemented
|
||||
module.exports.stdout = (...args) => module.exports(...args).then(x => x.stdout);
|
||||
|
||||
// TODO: set `stdout: 'ignore'` when that option is implemented
|
||||
module.exports.stderr = (...args) => module.exports(...args).then(x => x.stderr);
|
||||
|
||||
module.exports.shell = (cmd, opts) => handleShell(module.exports, cmd, opts);
|
||||
|
||||
module.exports.sync = (cmd, args, opts) => {
|
||||
const parsed = handleArgs(cmd, args, opts);
|
||||
const joinedCmd = joinCmd(cmd, args);
|
||||
|
||||
if (isStream(parsed.opts.input)) {
|
||||
throw new TypeError('The `input` option cannot be a stream in sync mode');
|
||||
}
|
||||
|
||||
const result = childProcess.spawnSync(parsed.cmd, parsed.args, parsed.opts);
|
||||
result.code = result.status;
|
||||
|
||||
if (result.error || result.status !== 0 || result.signal !== null) {
|
||||
const err = makeError(result, {
|
||||
joinedCmd,
|
||||
parsed
|
||||
});
|
||||
|
||||
if (!parsed.opts.reject) {
|
||||
return err;
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
|
||||
return {
|
||||
stdout: handleOutput(parsed.opts, result.stdout),
|
||||
stderr: handleOutput(parsed.opts, result.stderr),
|
||||
code: 0,
|
||||
failed: false,
|
||||
signal: null,
|
||||
cmd: joinedCmd,
|
||||
timedOut: false
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.shellSync = (cmd, opts) => handleShell(module.exports.sync, cmd, opts);
|
39
web/node_modules/default-gateway/node_modules/execa/lib/errname.js
generated
vendored
Normal file
39
web/node_modules/default-gateway/node_modules/execa/lib/errname.js
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
'use strict';
|
||||
// Older verions of Node.js might not have `util.getSystemErrorName()`.
|
||||
// In that case, fall back to a deprecated internal.
|
||||
const util = require('util');
|
||||
|
||||
let uv;
|
||||
|
||||
if (typeof util.getSystemErrorName === 'function') {
|
||||
module.exports = util.getSystemErrorName;
|
||||
} else {
|
||||
try {
|
||||
uv = process.binding('uv');
|
||||
|
||||
if (typeof uv.errname !== 'function') {
|
||||
throw new TypeError('uv.errname is not a function');
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('execa/lib/errname: unable to establish process.binding(\'uv\')', err);
|
||||
uv = null;
|
||||
}
|
||||
|
||||
module.exports = code => errname(uv, code);
|
||||
}
|
||||
|
||||
// Used for testing the fallback behavior
|
||||
module.exports.__test__ = errname;
|
||||
|
||||
function errname(uv, code) {
|
||||
if (uv) {
|
||||
return uv.errname(code);
|
||||
}
|
||||
|
||||
if (!(code < 0)) {
|
||||
throw new Error('err >= 0');
|
||||
}
|
||||
|
||||
return `Unknown system error ${code}`;
|
||||
}
|
||||
|
41
web/node_modules/default-gateway/node_modules/execa/lib/stdio.js
generated
vendored
Normal file
41
web/node_modules/default-gateway/node_modules/execa/lib/stdio.js
generated
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
'use strict';
|
||||
const alias = ['stdin', 'stdout', 'stderr'];
|
||||
|
||||
const hasAlias = opts => alias.some(x => Boolean(opts[x]));
|
||||
|
||||
module.exports = opts => {
|
||||
if (!opts) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (opts.stdio && hasAlias(opts)) {
|
||||
throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${alias.map(x => `\`${x}\``).join(', ')}`);
|
||||
}
|
||||
|
||||
if (typeof opts.stdio === 'string') {
|
||||
return opts.stdio;
|
||||
}
|
||||
|
||||
const stdio = opts.stdio || [];
|
||||
|
||||
if (!Array.isArray(stdio)) {
|
||||
throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
|
||||
}
|
||||
|
||||
const result = [];
|
||||
const len = Math.max(stdio.length, alias.length);
|
||||
|
||||
for (let i = 0; i < len; i++) {
|
||||
let value = null;
|
||||
|
||||
if (stdio[i] !== undefined) {
|
||||
value = stdio[i];
|
||||
} else if (opts[alias[i]] !== undefined) {
|
||||
value = opts[alias[i]];
|
||||
}
|
||||
|
||||
result[i] = value;
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
9
web/node_modules/default-gateway/node_modules/execa/license
generated
vendored
Normal file
9
web/node_modules/default-gateway/node_modules/execa/license
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
69
web/node_modules/default-gateway/node_modules/execa/package.json
generated
vendored
Normal file
69
web/node_modules/default-gateway/node_modules/execa/package.json
generated
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
{
|
||||
"name": "execa",
|
||||
"version": "1.0.0",
|
||||
"description": "A better `child_process`",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/execa",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && nyc ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"lib"
|
||||
],
|
||||
"keywords": [
|
||||
"exec",
|
||||
"child",
|
||||
"process",
|
||||
"execute",
|
||||
"fork",
|
||||
"execfile",
|
||||
"spawn",
|
||||
"file",
|
||||
"shell",
|
||||
"bin",
|
||||
"binary",
|
||||
"binaries",
|
||||
"npm",
|
||||
"path",
|
||||
"local"
|
||||
],
|
||||
"dependencies": {
|
||||
"cross-spawn": "^6.0.0",
|
||||
"get-stream": "^4.0.0",
|
||||
"is-stream": "^1.1.0",
|
||||
"npm-run-path": "^2.0.0",
|
||||
"p-finally": "^1.0.0",
|
||||
"signal-exit": "^3.0.0",
|
||||
"strip-eof": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"cat-names": "^1.0.2",
|
||||
"coveralls": "^3.0.1",
|
||||
"delay": "^3.0.0",
|
||||
"is-running": "^2.0.0",
|
||||
"nyc": "^13.0.1",
|
||||
"tempfile": "^2.0.0",
|
||||
"xo": "*"
|
||||
},
|
||||
"nyc": {
|
||||
"reporter": [
|
||||
"text",
|
||||
"lcov"
|
||||
],
|
||||
"exclude": [
|
||||
"**/fixtures/**",
|
||||
"**/test.js",
|
||||
"**/test/**"
|
||||
]
|
||||
}
|
||||
}
|
327
web/node_modules/default-gateway/node_modules/execa/readme.md
generated
vendored
Normal file
327
web/node_modules/default-gateway/node_modules/execa/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,327 @@
|
|||
# execa [](https://travis-ci.org/sindresorhus/execa) [](https://ci.appveyor.com/project/sindresorhus/execa/branch/master) [](https://coveralls.io/github/sindresorhus/execa?branch=master)
|
||||
|
||||
> A better [`child_process`](https://nodejs.org/api/child_process.html)
|
||||
|
||||
|
||||
## Why
|
||||
|
||||
- Promise interface.
|
||||
- [Strips EOF](https://github.com/sindresorhus/strip-eof) from the output so you don't have to `stdout.trim()`.
|
||||
- Supports [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) binaries cross-platform.
|
||||
- [Improved Windows support.](https://github.com/IndigoUnited/node-cross-spawn#why)
|
||||
- Higher max buffer. 10 MB instead of 200 KB.
|
||||
- [Executes locally installed binaries by name.](#preferlocal)
|
||||
- [Cleans up spawned processes when the parent process dies.](#cleanup)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install execa
|
||||
```
|
||||
|
||||
<a href="https://www.patreon.com/sindresorhus">
|
||||
<img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="160">
|
||||
</a>
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const execa = require('execa');
|
||||
|
||||
(async () => {
|
||||
const {stdout} = await execa('echo', ['unicorns']);
|
||||
console.log(stdout);
|
||||
//=> 'unicorns'
|
||||
})();
|
||||
```
|
||||
|
||||
Additional examples:
|
||||
|
||||
```js
|
||||
const execa = require('execa');
|
||||
|
||||
(async () => {
|
||||
// Pipe the child process stdout to the current stdout
|
||||
execa('echo', ['unicorns']).stdout.pipe(process.stdout);
|
||||
|
||||
|
||||
// Run a shell command
|
||||
const {stdout} = await execa.shell('echo unicorns');
|
||||
//=> 'unicorns'
|
||||
|
||||
|
||||
// Catching an error
|
||||
try {
|
||||
await execa.shell('exit 3');
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
/*
|
||||
{
|
||||
message: 'Command failed: /bin/sh -c exit 3'
|
||||
killed: false,
|
||||
code: 3,
|
||||
signal: null,
|
||||
cmd: '/bin/sh -c exit 3',
|
||||
stdout: '',
|
||||
stderr: '',
|
||||
timedOut: false
|
||||
}
|
||||
*/
|
||||
}
|
||||
})();
|
||||
|
||||
// Catching an error with a sync method
|
||||
try {
|
||||
execa.shellSync('exit 3');
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
/*
|
||||
{
|
||||
message: 'Command failed: /bin/sh -c exit 3'
|
||||
code: 3,
|
||||
signal: null,
|
||||
cmd: '/bin/sh -c exit 3',
|
||||
stdout: '',
|
||||
stderr: '',
|
||||
timedOut: false
|
||||
}
|
||||
*/
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### execa(file, [arguments], [options])
|
||||
|
||||
Execute a file.
|
||||
|
||||
Think of this as a mix of `child_process.execFile` and `child_process.spawn`.
|
||||
|
||||
Returns a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess), which is enhanced to also be a `Promise` for a result `Object` with `stdout` and `stderr` properties.
|
||||
|
||||
### execa.stdout(file, [arguments], [options])
|
||||
|
||||
Same as `execa()`, but returns only `stdout`.
|
||||
|
||||
### execa.stderr(file, [arguments], [options])
|
||||
|
||||
Same as `execa()`, but returns only `stderr`.
|
||||
|
||||
### execa.shell(command, [options])
|
||||
|
||||
Execute a command through the system shell. Prefer `execa()` whenever possible, as it's both faster and safer.
|
||||
|
||||
Returns a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess).
|
||||
|
||||
The `child_process` instance is enhanced to also be promise for a result object with `stdout` and `stderr` properties.
|
||||
|
||||
### execa.sync(file, [arguments], [options])
|
||||
|
||||
Execute a file synchronously.
|
||||
|
||||
Returns the same result object as [`child_process.spawnSync`](https://nodejs.org/api/child_process.html#child_process_child_process_spawnsync_command_args_options).
|
||||
|
||||
This method throws an `Error` if the command fails.
|
||||
|
||||
### execa.shellSync(file, [options])
|
||||
|
||||
Execute a command synchronously through the system shell.
|
||||
|
||||
Returns the same result object as [`child_process.spawnSync`](https://nodejs.org/api/child_process.html#child_process_child_process_spawnsync_command_args_options).
|
||||
|
||||
### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
#### cwd
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `process.cwd()`
|
||||
|
||||
Current working directory of the child process.
|
||||
|
||||
#### env
|
||||
|
||||
Type: `Object`<br>
|
||||
Default: `process.env`
|
||||
|
||||
Environment key-value pairs. Extends automatically from `process.env`. Set `extendEnv` to `false` if you don't want this.
|
||||
|
||||
#### extendEnv
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
Set to `false` if you don't want to extend the environment variables when providing the `env` property.
|
||||
|
||||
#### argv0
|
||||
|
||||
Type: `string`
|
||||
|
||||
Explicitly set the value of `argv[0]` sent to the child process. This will be set to `command` or `file` if not specified.
|
||||
|
||||
#### stdio
|
||||
|
||||
Type: `string[]` `string`<br>
|
||||
Default: `pipe`
|
||||
|
||||
Child's [stdio](https://nodejs.org/api/child_process.html#child_process_options_stdio) configuration.
|
||||
|
||||
#### detached
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Prepare child to run independently of its parent process. Specific behavior [depends on the platform](https://nodejs.org/api/child_process.html#child_process_options_detached).
|
||||
|
||||
#### uid
|
||||
|
||||
Type: `number`
|
||||
|
||||
Sets the user identity of the process.
|
||||
|
||||
#### gid
|
||||
|
||||
Type: `number`
|
||||
|
||||
Sets the group identity of the process.
|
||||
|
||||
#### shell
|
||||
|
||||
Type: `boolean` `string`<br>
|
||||
Default: `false`
|
||||
|
||||
If `true`, runs `command` inside of a shell. Uses `/bin/sh` on UNIX and `cmd.exe` on Windows. A different shell can be specified as a string. The shell should understand the `-c` switch on UNIX or `/d /s /c` on Windows.
|
||||
|
||||
#### stripEof
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
[Strip EOF](https://github.com/sindresorhus/strip-eof) (last newline) from the output.
|
||||
|
||||
#### preferLocal
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
Prefer locally installed binaries when looking for a binary to execute.<br>
|
||||
If you `$ npm install foo`, you can then `execa('foo')`.
|
||||
|
||||
#### localDir
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `process.cwd()`
|
||||
|
||||
Preferred path to find locally installed binaries in (use with `preferLocal`).
|
||||
|
||||
#### input
|
||||
|
||||
Type: `string` `Buffer` `stream.Readable`
|
||||
|
||||
Write some input to the `stdin` of your binary.<br>
|
||||
Streams are not allowed when using the synchronous methods.
|
||||
|
||||
#### reject
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
Setting this to `false` resolves the promise with the error instead of rejecting it.
|
||||
|
||||
#### cleanup
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
Keep track of the spawned process and `kill` it when the parent process exits.
|
||||
|
||||
#### encoding
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `utf8`
|
||||
|
||||
Specify the character encoding used to decode the `stdout` and `stderr` output.
|
||||
|
||||
#### timeout
|
||||
|
||||
Type: `number`<br>
|
||||
Default: `0`
|
||||
|
||||
If timeout is greater than `0`, the parent will send the signal identified by the `killSignal` property (the default is `SIGTERM`) if the child runs longer than timeout milliseconds.
|
||||
|
||||
#### buffer
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
Buffer the output from the spawned process. When buffering is disabled you must consume the output of the `stdout` and `stderr` streams because the promise will not be resolved/rejected until they have completed.
|
||||
|
||||
#### maxBuffer
|
||||
|
||||
Type: `number`<br>
|
||||
Default: `10000000` (10MB)
|
||||
|
||||
Largest amount of data in bytes allowed on `stdout` or `stderr`.
|
||||
|
||||
#### killSignal
|
||||
|
||||
Type: `string` `number`<br>
|
||||
Default: `SIGTERM`
|
||||
|
||||
Signal value to be used when the spawned process will be killed.
|
||||
|
||||
#### stdin
|
||||
|
||||
Type: `string` `number` `Stream` `undefined` `null`<br>
|
||||
Default: `pipe`
|
||||
|
||||
Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
|
||||
|
||||
#### stdout
|
||||
|
||||
Type: `string` `number` `Stream` `undefined` `null`<br>
|
||||
Default: `pipe`
|
||||
|
||||
Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
|
||||
|
||||
#### stderr
|
||||
|
||||
Type: `string` `number` `Stream` `undefined` `null`<br>
|
||||
Default: `pipe`
|
||||
|
||||
Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
|
||||
|
||||
#### windowsVerbatimArguments
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `false`
|
||||
|
||||
If `true`, no quoting or escaping of arguments is done on Windows. Ignored on other platforms. This is set to `true` automatically when the `shell` option is `true`.
|
||||
|
||||
|
||||
## Tips
|
||||
|
||||
### Save and pipe output from a child process
|
||||
|
||||
Let's say you want to show the output of a child process in real-time while also saving it to a variable.
|
||||
|
||||
```js
|
||||
const execa = require('execa');
|
||||
const getStream = require('get-stream');
|
||||
|
||||
const stream = execa('echo', ['foo']).stdout;
|
||||
|
||||
stream.pipe(process.stdout);
|
||||
|
||||
getStream(stream).then(value => {
|
||||
console.log('child output:', value);
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
51
web/node_modules/default-gateway/node_modules/get-stream/buffer-stream.js
generated
vendored
Normal file
51
web/node_modules/default-gateway/node_modules/get-stream/buffer-stream.js
generated
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
'use strict';
|
||||
const {PassThrough} = require('stream');
|
||||
|
||||
module.exports = options => {
|
||||
options = Object.assign({}, options);
|
||||
|
||||
const {array} = options;
|
||||
let {encoding} = options;
|
||||
const buffer = encoding === 'buffer';
|
||||
let objectMode = false;
|
||||
|
||||
if (array) {
|
||||
objectMode = !(encoding || buffer);
|
||||
} else {
|
||||
encoding = encoding || 'utf8';
|
||||
}
|
||||
|
||||
if (buffer) {
|
||||
encoding = null;
|
||||
}
|
||||
|
||||
let len = 0;
|
||||
const ret = [];
|
||||
const stream = new PassThrough({objectMode});
|
||||
|
||||
if (encoding) {
|
||||
stream.setEncoding(encoding);
|
||||
}
|
||||
|
||||
stream.on('data', chunk => {
|
||||
ret.push(chunk);
|
||||
|
||||
if (objectMode) {
|
||||
len = ret.length;
|
||||
} else {
|
||||
len += chunk.length;
|
||||
}
|
||||
});
|
||||
|
||||
stream.getBufferedValue = () => {
|
||||
if (array) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return buffer ? Buffer.concat(ret, len) : ret.join('');
|
||||
};
|
||||
|
||||
stream.getBufferedLength = () => len;
|
||||
|
||||
return stream;
|
||||
};
|
50
web/node_modules/default-gateway/node_modules/get-stream/index.js
generated
vendored
Normal file
50
web/node_modules/default-gateway/node_modules/get-stream/index.js
generated
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
'use strict';
|
||||
const pump = require('pump');
|
||||
const bufferStream = require('./buffer-stream');
|
||||
|
||||
class MaxBufferError extends Error {
|
||||
constructor() {
|
||||
super('maxBuffer exceeded');
|
||||
this.name = 'MaxBufferError';
|
||||
}
|
||||
}
|
||||
|
||||
function getStream(inputStream, options) {
|
||||
if (!inputStream) {
|
||||
return Promise.reject(new Error('Expected a stream'));
|
||||
}
|
||||
|
||||
options = Object.assign({maxBuffer: Infinity}, options);
|
||||
|
||||
const {maxBuffer} = options;
|
||||
|
||||
let stream;
|
||||
return new Promise((resolve, reject) => {
|
||||
const rejectPromise = error => {
|
||||
if (error) { // A null check
|
||||
error.bufferedData = stream.getBufferedValue();
|
||||
}
|
||||
reject(error);
|
||||
};
|
||||
|
||||
stream = pump(inputStream, bufferStream(options), error => {
|
||||
if (error) {
|
||||
rejectPromise(error);
|
||||
return;
|
||||
}
|
||||
|
||||
resolve();
|
||||
});
|
||||
|
||||
stream.on('data', () => {
|
||||
if (stream.getBufferedLength() > maxBuffer) {
|
||||
rejectPromise(new MaxBufferError());
|
||||
}
|
||||
});
|
||||
}).then(() => stream.getBufferedValue());
|
||||
}
|
||||
|
||||
module.exports = getStream;
|
||||
module.exports.buffer = (stream, options) => getStream(stream, Object.assign({}, options, {encoding: 'buffer'}));
|
||||
module.exports.array = (stream, options) => getStream(stream, Object.assign({}, options, {array: true}));
|
||||
module.exports.MaxBufferError = MaxBufferError;
|
9
web/node_modules/default-gateway/node_modules/get-stream/license
generated
vendored
Normal file
9
web/node_modules/default-gateway/node_modules/get-stream/license
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
46
web/node_modules/default-gateway/node_modules/get-stream/package.json
generated
vendored
Normal file
46
web/node_modules/default-gateway/node_modules/get-stream/package.json
generated
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
"name": "get-stream",
|
||||
"version": "4.1.0",
|
||||
"description": "Get a stream as a string, buffer, or array",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/get-stream",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"buffer-stream.js"
|
||||
],
|
||||
"keywords": [
|
||||
"get",
|
||||
"stream",
|
||||
"promise",
|
||||
"concat",
|
||||
"string",
|
||||
"text",
|
||||
"buffer",
|
||||
"read",
|
||||
"data",
|
||||
"consume",
|
||||
"readable",
|
||||
"readablestream",
|
||||
"array",
|
||||
"object"
|
||||
],
|
||||
"dependencies": {
|
||||
"pump": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"into-stream": "^3.0.0",
|
||||
"xo": "*"
|
||||
}
|
||||
}
|
123
web/node_modules/default-gateway/node_modules/get-stream/readme.md
generated
vendored
Normal file
123
web/node_modules/default-gateway/node_modules/get-stream/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,123 @@
|
|||
# get-stream [](https://travis-ci.org/sindresorhus/get-stream)
|
||||
|
||||
> Get a stream as a string, buffer, or array
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install get-stream
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const fs = require('fs');
|
||||
const getStream = require('get-stream');
|
||||
|
||||
(async () => {
|
||||
const stream = fs.createReadStream('unicorn.txt');
|
||||
|
||||
console.log(await getStream(stream));
|
||||
/*
|
||||
,,))))))));,
|
||||
__)))))))))))))),
|
||||
\|/ -\(((((''''((((((((.
|
||||
-*-==//////(('' . `)))))),
|
||||
/|\ ))| o ;-. '((((( ,(,
|
||||
( `| / ) ;))))' ,_))^;(~
|
||||
| | | ,))((((_ _____------~~~-. %,;(;(>';'~
|
||||
o_); ; )))(((` ~---~ `:: \ %%~~)(v;(`('~
|
||||
; ''''```` `: `:::|\,__,%% );`'; ~
|
||||
| _ ) / `:|`----' `-'
|
||||
______/\/~ | / /
|
||||
/~;;.____/;;' / ___--,-( `;;;/
|
||||
/ // _;______;'------~~~~~ /;;/\ /
|
||||
// | | / ; \;;,\
|
||||
(<_ | ; /',/-----' _>
|
||||
\_| ||_ //~;~~~~~~~~~
|
||||
`\_| (,~~
|
||||
\~\
|
||||
~~
|
||||
*/
|
||||
})();
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
The methods returns a promise that resolves when the `end` event fires on the stream, indicating that there is no more data to be read. The stream is switched to flowing mode.
|
||||
|
||||
### getStream(stream, [options])
|
||||
|
||||
Get the `stream` as a string.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### encoding
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `utf8`
|
||||
|
||||
[Encoding](https://nodejs.org/api/buffer.html#buffer_buffer) of the incoming stream.
|
||||
|
||||
##### maxBuffer
|
||||
|
||||
Type: `number`<br>
|
||||
Default: `Infinity`
|
||||
|
||||
Maximum length of the returned string. If it exceeds this value before the stream ends, the promise will be rejected with a `getStream.MaxBufferError` error.
|
||||
|
||||
### getStream.buffer(stream, [options])
|
||||
|
||||
Get the `stream` as a buffer.
|
||||
|
||||
It honors the `maxBuffer` option as above, but it refers to byte length rather than string length.
|
||||
|
||||
### getStream.array(stream, [options])
|
||||
|
||||
Get the `stream` as an array of values.
|
||||
|
||||
It honors both the `maxBuffer` and `encoding` options. The behavior changes slightly based on the encoding chosen:
|
||||
|
||||
- When `encoding` is unset, it assumes an [object mode stream](https://nodesource.com/blog/understanding-object-streams/) and collects values emitted from `stream` unmodified. In this case `maxBuffer` refers to the number of items in the array (not the sum of their sizes).
|
||||
|
||||
- When `encoding` is set to `buffer`, it collects an array of buffers. `maxBuffer` refers to the summed byte lengths of every buffer in the array.
|
||||
|
||||
- When `encoding` is set to anything else, it collects an array of strings. `maxBuffer` refers to the summed character lengths of every string in the array.
|
||||
|
||||
|
||||
## Errors
|
||||
|
||||
If the input stream emits an `error` event, the promise will be rejected with the error. The buffered data will be attached to the `bufferedData` property of the error.
|
||||
|
||||
```js
|
||||
(async () => {
|
||||
try {
|
||||
await getStream(streamThatErrorsAtTheEnd('unicorn'));
|
||||
} catch (error) {
|
||||
console.log(error.bufferedData);
|
||||
//=> 'unicorn'
|
||||
}
|
||||
})()
|
||||
```
|
||||
|
||||
|
||||
## FAQ
|
||||
|
||||
### How is this different from [`concat-stream`](https://github.com/maxogden/concat-stream)?
|
||||
|
||||
This module accepts a stream instead of being one and returns a promise instead of using a callback. The API is simpler and it only supports returning a string, buffer, or array. It doesn't have a fragile type inference. You explicitly choose what you want. And it doesn't depend on the huge `readable-stream` package.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [get-stdin](https://github.com/sindresorhus/get-stdin) - Get stdin as a string or buffer
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
21
web/node_modules/default-gateway/node_modules/is-stream/index.js
generated
vendored
Normal file
21
web/node_modules/default-gateway/node_modules/is-stream/index.js
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
'use strict';
|
||||
|
||||
var isStream = module.exports = function (stream) {
|
||||
return stream !== null && typeof stream === 'object' && typeof stream.pipe === 'function';
|
||||
};
|
||||
|
||||
isStream.writable = function (stream) {
|
||||
return isStream(stream) && stream.writable !== false && typeof stream._write === 'function' && typeof stream._writableState === 'object';
|
||||
};
|
||||
|
||||
isStream.readable = function (stream) {
|
||||
return isStream(stream) && stream.readable !== false && typeof stream._read === 'function' && typeof stream._readableState === 'object';
|
||||
};
|
||||
|
||||
isStream.duplex = function (stream) {
|
||||
return isStream.writable(stream) && isStream.readable(stream);
|
||||
};
|
||||
|
||||
isStream.transform = function (stream) {
|
||||
return isStream.duplex(stream) && typeof stream._transform === 'function' && typeof stream._transformState === 'object';
|
||||
};
|
21
web/node_modules/default-gateway/node_modules/is-stream/license
generated
vendored
Normal file
21
web/node_modules/default-gateway/node_modules/is-stream/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.
|
38
web/node_modules/default-gateway/node_modules/is-stream/package.json
generated
vendored
Normal file
38
web/node_modules/default-gateway/node_modules/is-stream/package.json
generated
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"name": "is-stream",
|
||||
"version": "1.1.0",
|
||||
"description": "Check if something is a Node.js stream",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/is-stream",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"stream",
|
||||
"type",
|
||||
"streams",
|
||||
"writable",
|
||||
"readable",
|
||||
"duplex",
|
||||
"transform",
|
||||
"check",
|
||||
"detect",
|
||||
"is"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"tempfile": "^1.1.0",
|
||||
"xo": "*"
|
||||
}
|
||||
}
|
42
web/node_modules/default-gateway/node_modules/is-stream/readme.md
generated
vendored
Normal file
42
web/node_modules/default-gateway/node_modules/is-stream/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
# is-stream [](https://travis-ci.org/sindresorhus/is-stream)
|
||||
|
||||
> Check if something is a [Node.js stream](https://nodejs.org/api/stream.html)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save is-stream
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const fs = require('fs');
|
||||
const isStream = require('is-stream');
|
||||
|
||||
isStream(fs.createReadStream('unicorn.png'));
|
||||
//=> true
|
||||
|
||||
isStream({});
|
||||
//=> false
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### isStream(stream)
|
||||
|
||||
#### isStream.writable(stream)
|
||||
|
||||
#### isStream.readable(stream)
|
||||
|
||||
#### isStream.duplex(stream)
|
||||
|
||||
#### isStream.transform(stream)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
39
web/node_modules/default-gateway/node_modules/npm-run-path/index.js
generated
vendored
Normal file
39
web/node_modules/default-gateway/node_modules/npm-run-path/index.js
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
'use strict';
|
||||
const path = require('path');
|
||||
const pathKey = require('path-key');
|
||||
|
||||
module.exports = opts => {
|
||||
opts = Object.assign({
|
||||
cwd: process.cwd(),
|
||||
path: process.env[pathKey()]
|
||||
}, opts);
|
||||
|
||||
let prev;
|
||||
let pth = path.resolve(opts.cwd);
|
||||
const ret = [];
|
||||
|
||||
while (prev !== pth) {
|
||||
ret.push(path.join(pth, 'node_modules/.bin'));
|
||||
prev = pth;
|
||||
pth = path.resolve(pth, '..');
|
||||
}
|
||||
|
||||
// ensure the running `node` binary is used
|
||||
ret.push(path.dirname(process.execPath));
|
||||
|
||||
return ret.concat(opts.path).join(path.delimiter);
|
||||
};
|
||||
|
||||
module.exports.env = opts => {
|
||||
opts = Object.assign({
|
||||
env: process.env
|
||||
}, opts);
|
||||
|
||||
const env = Object.assign({}, opts.env);
|
||||
const path = pathKey({env});
|
||||
|
||||
opts.path = env[path];
|
||||
env[path] = module.exports(opts);
|
||||
|
||||
return env;
|
||||
};
|
21
web/node_modules/default-gateway/node_modules/npm-run-path/license
generated
vendored
Normal file
21
web/node_modules/default-gateway/node_modules/npm-run-path/license
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
45
web/node_modules/default-gateway/node_modules/npm-run-path/package.json
generated
vendored
Normal file
45
web/node_modules/default-gateway/node_modules/npm-run-path/package.json
generated
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"name": "npm-run-path",
|
||||
"version": "2.0.2",
|
||||
"description": "Get your PATH prepended with locally installed binaries",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/npm-run-path",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"npm",
|
||||
"run",
|
||||
"path",
|
||||
"package",
|
||||
"bin",
|
||||
"binary",
|
||||
"binaries",
|
||||
"script",
|
||||
"cli",
|
||||
"command-line",
|
||||
"execute",
|
||||
"executable"
|
||||
],
|
||||
"dependencies": {
|
||||
"path-key": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"xo": {
|
||||
"esnext": true
|
||||
}
|
||||
}
|
81
web/node_modules/default-gateway/node_modules/npm-run-path/readme.md
generated
vendored
Normal file
81
web/node_modules/default-gateway/node_modules/npm-run-path/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,81 @@
|
|||
# npm-run-path [](https://travis-ci.org/sindresorhus/npm-run-path)
|
||||
|
||||
> Get your [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) prepended with locally installed binaries
|
||||
|
||||
In [npm run scripts](https://docs.npmjs.com/cli/run-script) you can execute locally installed binaries by name. This enables the same outside npm.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save npm-run-path
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const childProcess = require('child_process');
|
||||
const npmRunPath = require('npm-run-path');
|
||||
|
||||
console.log(process.env.PATH);
|
||||
//=> '/usr/local/bin'
|
||||
|
||||
console.log(npmRunPath());
|
||||
//=> '/Users/sindresorhus/dev/foo/node_modules/.bin:/Users/sindresorhus/dev/node_modules/.bin:/Users/sindresorhus/node_modules/.bin:/Users/node_modules/.bin:/node_modules/.bin:/usr/local/bin'
|
||||
|
||||
// `foo` is a locally installed binary
|
||||
childProcess.execFileSync('foo', {
|
||||
env: npmRunPath.env()
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### npmRunPath([options])
|
||||
|
||||
#### options
|
||||
|
||||
##### cwd
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `process.cwd()`
|
||||
|
||||
Working directory.
|
||||
|
||||
##### path
|
||||
|
||||
Type: `string`<br>
|
||||
Default: [`PATH`](https://github.com/sindresorhus/path-key)
|
||||
|
||||
PATH to be appended.<br>
|
||||
Set it to an empty string to exclude the default PATH.
|
||||
|
||||
### npmRunPath.env([options])
|
||||
|
||||
#### options
|
||||
|
||||
##### cwd
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `process.cwd()`
|
||||
|
||||
Working directory.
|
||||
|
||||
##### env
|
||||
|
||||
Type: `Object`
|
||||
|
||||
Accepts an object of environment variables, like `process.env`, and modifies the PATH using the correct [PATH key](https://github.com/sindresorhus/path-key). Use this if you're modifying the PATH for use in the `child_process` options.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [npm-run-path-cli](https://github.com/sindresorhus/npm-run-path-cli) - CLI for this module
|
||||
- [execa](https://github.com/sindresorhus/execa) - Execute a locally installed binary
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
13
web/node_modules/default-gateway/node_modules/path-key/index.js
generated
vendored
Normal file
13
web/node_modules/default-gateway/node_modules/path-key/index.js
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
'use strict';
|
||||
module.exports = opts => {
|
||||
opts = opts || {};
|
||||
|
||||
const env = opts.env || process.env;
|
||||
const platform = opts.platform || process.platform;
|
||||
|
||||
if (platform !== 'win32') {
|
||||
return 'PATH';
|
||||
}
|
||||
|
||||
return Object.keys(env).find(x => x.toUpperCase() === 'PATH') || 'Path';
|
||||
};
|
21
web/node_modules/default-gateway/node_modules/path-key/license
generated
vendored
Normal file
21
web/node_modules/default-gateway/node_modules/path-key/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.
|
39
web/node_modules/default-gateway/node_modules/path-key/package.json
generated
vendored
Normal file
39
web/node_modules/default-gateway/node_modules/path-key/package.json
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"name": "path-key",
|
||||
"version": "2.0.1",
|
||||
"description": "Get the PATH environment variable key cross-platform",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/path-key",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"path",
|
||||
"key",
|
||||
"environment",
|
||||
"env",
|
||||
"variable",
|
||||
"var",
|
||||
"get",
|
||||
"cross-platform",
|
||||
"windows"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"xo": {
|
||||
"esnext": true
|
||||
}
|
||||
}
|
51
web/node_modules/default-gateway/node_modules/path-key/readme.md
generated
vendored
Normal file
51
web/node_modules/default-gateway/node_modules/path-key/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
# path-key [](https://travis-ci.org/sindresorhus/path-key)
|
||||
|
||||
> Get the [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) environment variable key cross-platform
|
||||
|
||||
It's usually `PATH`, but on Windows it can be any casing like `Path`...
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save path-key
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const pathKey = require('path-key');
|
||||
|
||||
const key = pathKey();
|
||||
//=> 'PATH'
|
||||
|
||||
const PATH = process.env[key];
|
||||
//=> '/usr/local/bin:/usr/bin:/bin'
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### pathKey([options])
|
||||
|
||||
#### options
|
||||
|
||||
##### env
|
||||
|
||||
Type: `Object`<br>
|
||||
Default: [`process.env`](https://nodejs.org/api/process.html#process_process_env)
|
||||
|
||||
Use a custom environment variables object.
|
||||
|
||||
#### platform
|
||||
|
||||
Type: `string`<br>
|
||||
Default: [`process.platform`](https://nodejs.org/api/process.html#process_process_platform)
|
||||
|
||||
Get the PATH key for a specific platform.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
39
web/node_modules/default-gateway/node_modules/semver/CHANGELOG.md
generated
vendored
Normal file
39
web/node_modules/default-gateway/node_modules/semver/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
# changes log
|
||||
|
||||
## 5.7
|
||||
|
||||
* Add `minVersion` method
|
||||
|
||||
## 5.6
|
||||
|
||||
* Move boolean `loose` param to an options object, with
|
||||
backwards-compatibility protection.
|
||||
* Add ability to opt out of special prerelease version handling with
|
||||
the `includePrerelease` option flag.
|
||||
|
||||
## 5.5
|
||||
|
||||
* Add version coercion capabilities
|
||||
|
||||
## 5.4
|
||||
|
||||
* Add intersection checking
|
||||
|
||||
## 5.3
|
||||
|
||||
* Add `minSatisfying` method
|
||||
|
||||
## 5.2
|
||||
|
||||
* Add `prerelease(v)` that returns prerelease components
|
||||
|
||||
## 5.1
|
||||
|
||||
* Add Backus-Naur for ranges
|
||||
* Remove excessively cute inspection methods
|
||||
|
||||
## 5.0
|
||||
|
||||
* Remove AMD/Browserified build artifacts
|
||||
* Fix ltr and gtr when using the `*` range
|
||||
* Fix for range `*` with a prerelease identifier
|
15
web/node_modules/default-gateway/node_modules/semver/LICENSE
generated
vendored
Normal file
15
web/node_modules/default-gateway/node_modules/semver/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.
|
412
web/node_modules/default-gateway/node_modules/semver/README.md
generated
vendored
Normal file
412
web/node_modules/default-gateway/node_modules/semver/README.md
generated
vendored
Normal file
|
@ -0,0 +1,412 @@
|
|||
semver(1) -- The semantic versioner for npm
|
||||
===========================================
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm install --save semver
|
||||
````
|
||||
|
||||
## Usage
|
||||
|
||||
As a node module:
|
||||
|
||||
```js
|
||||
const semver = require('semver')
|
||||
|
||||
semver.valid('1.2.3') // '1.2.3'
|
||||
semver.valid('a.b.c') // null
|
||||
semver.clean(' =v1.2.3 ') // '1.2.3'
|
||||
semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true
|
||||
semver.gt('1.2.3', '9.8.7') // false
|
||||
semver.lt('1.2.3', '9.8.7') // true
|
||||
semver.minVersion('>=1.0.0') // '1.0.0'
|
||||
semver.valid(semver.coerce('v2')) // '2.0.0'
|
||||
semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7'
|
||||
```
|
||||
|
||||
As a command-line utility:
|
||||
|
||||
```
|
||||
$ semver -h
|
||||
|
||||
A JavaScript implementation of the https://semver.org/ specification
|
||||
Copyright Isaac Z. Schlueter
|
||||
|
||||
Usage: semver [options] <version> [<version> [...]]
|
||||
Prints valid versions sorted by SemVer precedence
|
||||
|
||||
Options:
|
||||
-r --range <range>
|
||||
Print versions that match the specified range.
|
||||
|
||||
-i --increment [<level>]
|
||||
Increment a version by the specified level. Level can
|
||||
be one of: major, minor, patch, premajor, preminor,
|
||||
prepatch, or prerelease. Default level is 'patch'.
|
||||
Only one version may be specified.
|
||||
|
||||
--preid <identifier>
|
||||
Identifier to be used to prefix premajor, preminor,
|
||||
prepatch or prerelease version increments.
|
||||
|
||||
-l --loose
|
||||
Interpret versions and ranges loosely
|
||||
|
||||
-p --include-prerelease
|
||||
Always include prerelease versions in range matching
|
||||
|
||||
-c --coerce
|
||||
Coerce a string into SemVer if possible
|
||||
(does not imply --loose)
|
||||
|
||||
Program exits successfully if any valid version satisfies
|
||||
all supplied ranges, and prints all satisfying versions.
|
||||
|
||||
If no satisfying versions are found, then exits failure.
|
||||
|
||||
Versions are printed in ascending order, so supplying
|
||||
multiple versions to the utility will just sort them.
|
||||
```
|
||||
|
||||
## Versions
|
||||
|
||||
A "version" is described by the `v2.0.0` specification found at
|
||||
<https://semver.org/>.
|
||||
|
||||
A leading `"="` or `"v"` character is stripped off and ignored.
|
||||
|
||||
## Ranges
|
||||
|
||||
A `version range` is a set of `comparators` which specify versions
|
||||
that satisfy the range.
|
||||
|
||||
A `comparator` is composed of an `operator` and a `version`. The set
|
||||
of primitive `operators` is:
|
||||
|
||||
* `<` Less than
|
||||
* `<=` Less than or equal to
|
||||
* `>` Greater than
|
||||
* `>=` Greater than or equal to
|
||||
* `=` Equal. If no operator is specified, then equality is assumed,
|
||||
so this operator is optional, but MAY be included.
|
||||
|
||||
For example, the comparator `>=1.2.7` would match the versions
|
||||
`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6`
|
||||
or `1.1.0`.
|
||||
|
||||
Comparators can be joined by whitespace to form a `comparator set`,
|
||||
which is satisfied by the **intersection** of all of the comparators
|
||||
it includes.
|
||||
|
||||
A range is composed of one or more comparator sets, joined by `||`. A
|
||||
version matches a range if and only if every comparator in at least
|
||||
one of the `||`-separated comparator sets is satisfied by the version.
|
||||
|
||||
For example, the range `>=1.2.7 <1.3.0` would match the versions
|
||||
`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`,
|
||||
or `1.1.0`.
|
||||
|
||||
The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`,
|
||||
`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`.
|
||||
|
||||
### Prerelease Tags
|
||||
|
||||
If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then
|
||||
it will only be allowed to satisfy comparator sets if at least one
|
||||
comparator with the same `[major, minor, patch]` tuple also has a
|
||||
prerelease tag.
|
||||
|
||||
For example, the range `>1.2.3-alpha.3` would be allowed to match the
|
||||
version `1.2.3-alpha.7`, but it would *not* be satisfied by
|
||||
`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater
|
||||
than" `1.2.3-alpha.3` according to the SemVer sort rules. The version
|
||||
range only accepts prerelease tags on the `1.2.3` version. The
|
||||
version `3.4.5` *would* satisfy the range, because it does not have a
|
||||
prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`.
|
||||
|
||||
The purpose for this behavior is twofold. First, prerelease versions
|
||||
frequently are updated very quickly, and contain many breaking changes
|
||||
that are (by the author's design) not yet fit for public consumption.
|
||||
Therefore, by default, they are excluded from range matching
|
||||
semantics.
|
||||
|
||||
Second, a user who has opted into using a prerelease version has
|
||||
clearly indicated the intent to use *that specific* set of
|
||||
alpha/beta/rc versions. By including a prerelease tag in the range,
|
||||
the user is indicating that they are aware of the risk. However, it
|
||||
is still not appropriate to assume that they have opted into taking a
|
||||
similar risk on the *next* set of prerelease versions.
|
||||
|
||||
Note that this behavior can be suppressed (treating all prerelease
|
||||
versions as if they were normal versions, for the purpose of range
|
||||
matching) by setting the `includePrerelease` flag on the options
|
||||
object to any
|
||||
[functions](https://github.com/npm/node-semver#functions) that do
|
||||
range matching.
|
||||
|
||||
#### Prerelease Identifiers
|
||||
|
||||
The method `.inc` takes an additional `identifier` string argument that
|
||||
will append the value of the string as a prerelease identifier:
|
||||
|
||||
```javascript
|
||||
semver.inc('1.2.3', 'prerelease', 'beta')
|
||||
// '1.2.4-beta.0'
|
||||
```
|
||||
|
||||
command-line example:
|
||||
|
||||
```bash
|
||||
$ semver 1.2.3 -i prerelease --preid beta
|
||||
1.2.4-beta.0
|
||||
```
|
||||
|
||||
Which then can be used to increment further:
|
||||
|
||||
```bash
|
||||
$ semver 1.2.4-beta.0 -i prerelease
|
||||
1.2.4-beta.1
|
||||
```
|
||||
|
||||
### Advanced Range Syntax
|
||||
|
||||
Advanced range syntax desugars to primitive comparators in
|
||||
deterministic ways.
|
||||
|
||||
Advanced ranges may be combined in the same way as primitive
|
||||
comparators using white space or `||`.
|
||||
|
||||
#### Hyphen Ranges `X.Y.Z - A.B.C`
|
||||
|
||||
Specifies an inclusive set.
|
||||
|
||||
* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4`
|
||||
|
||||
If a partial version is provided as the first version in the inclusive
|
||||
range, then the missing pieces are replaced with zeroes.
|
||||
|
||||
* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4`
|
||||
|
||||
If a partial version is provided as the second version in the
|
||||
inclusive range, then all versions that start with the supplied parts
|
||||
of the tuple are accepted, but nothing that would be greater than the
|
||||
provided tuple parts.
|
||||
|
||||
* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0`
|
||||
* `1.2.3 - 2` := `>=1.2.3 <3.0.0`
|
||||
|
||||
#### X-Ranges `1.2.x` `1.X` `1.2.*` `*`
|
||||
|
||||
Any of `X`, `x`, or `*` may be used to "stand in" for one of the
|
||||
numeric values in the `[major, minor, patch]` tuple.
|
||||
|
||||
* `*` := `>=0.0.0` (Any version satisfies)
|
||||
* `1.x` := `>=1.0.0 <2.0.0` (Matching major version)
|
||||
* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions)
|
||||
|
||||
A partial version range is treated as an X-Range, so the special
|
||||
character is in fact optional.
|
||||
|
||||
* `""` (empty string) := `*` := `>=0.0.0`
|
||||
* `1` := `1.x.x` := `>=1.0.0 <2.0.0`
|
||||
* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0`
|
||||
|
||||
#### Tilde Ranges `~1.2.3` `~1.2` `~1`
|
||||
|
||||
Allows patch-level changes if a minor version is specified on the
|
||||
comparator. Allows minor-level changes if not.
|
||||
|
||||
* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0`
|
||||
* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`)
|
||||
* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`)
|
||||
* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0`
|
||||
* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`)
|
||||
* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`)
|
||||
* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in
|
||||
the `1.2.3` version will be allowed, if they are greater than or
|
||||
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
|
||||
`1.2.4-beta.2` would not, because it is a prerelease of a
|
||||
different `[major, minor, patch]` tuple.
|
||||
|
||||
#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4`
|
||||
|
||||
Allows changes that do not modify the left-most non-zero digit in the
|
||||
`[major, minor, patch]` tuple. In other words, this allows patch and
|
||||
minor updates for versions `1.0.0` and above, patch updates for
|
||||
versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`.
|
||||
|
||||
Many authors treat a `0.x` version as if the `x` were the major
|
||||
"breaking-change" indicator.
|
||||
|
||||
Caret ranges are ideal when an author may make breaking changes
|
||||
between `0.2.4` and `0.3.0` releases, which is a common practice.
|
||||
However, it presumes that there will *not* be breaking changes between
|
||||
`0.2.4` and `0.2.5`. It allows for changes that are presumed to be
|
||||
additive (but non-breaking), according to commonly observed practices.
|
||||
|
||||
* `^1.2.3` := `>=1.2.3 <2.0.0`
|
||||
* `^0.2.3` := `>=0.2.3 <0.3.0`
|
||||
* `^0.0.3` := `>=0.0.3 <0.0.4`
|
||||
* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in
|
||||
the `1.2.3` version will be allowed, if they are greater than or
|
||||
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
|
||||
`1.2.4-beta.2` would not, because it is a prerelease of a
|
||||
different `[major, minor, patch]` tuple.
|
||||
* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the
|
||||
`0.0.3` version *only* will be allowed, if they are greater than or
|
||||
equal to `beta`. So, `0.0.3-pr.2` would be allowed.
|
||||
|
||||
When parsing caret ranges, a missing `patch` value desugars to the
|
||||
number `0`, but will allow flexibility within that value, even if the
|
||||
major and minor versions are both `0`.
|
||||
|
||||
* `^1.2.x` := `>=1.2.0 <2.0.0`
|
||||
* `^0.0.x` := `>=0.0.0 <0.1.0`
|
||||
* `^0.0` := `>=0.0.0 <0.1.0`
|
||||
|
||||
A missing `minor` and `patch` values will desugar to zero, but also
|
||||
allow flexibility within those values, even if the major version is
|
||||
zero.
|
||||
|
||||
* `^1.x` := `>=1.0.0 <2.0.0`
|
||||
* `^0.x` := `>=0.0.0 <1.0.0`
|
||||
|
||||
### Range Grammar
|
||||
|
||||
Putting all this together, here is a Backus-Naur grammar for ranges,
|
||||
for the benefit of parser authors:
|
||||
|
||||
```bnf
|
||||
range-set ::= range ( logical-or range ) *
|
||||
logical-or ::= ( ' ' ) * '||' ( ' ' ) *
|
||||
range ::= hyphen | simple ( ' ' simple ) * | ''
|
||||
hyphen ::= partial ' - ' partial
|
||||
simple ::= primitive | partial | tilde | caret
|
||||
primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
|
||||
partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
|
||||
xr ::= 'x' | 'X' | '*' | nr
|
||||
nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) *
|
||||
tilde ::= '~' partial
|
||||
caret ::= '^' partial
|
||||
qualifier ::= ( '-' pre )? ( '+' build )?
|
||||
pre ::= parts
|
||||
build ::= parts
|
||||
parts ::= part ( '.' part ) *
|
||||
part ::= nr | [-0-9A-Za-z]+
|
||||
```
|
||||
|
||||
## Functions
|
||||
|
||||
All methods and classes take a final `options` object argument. All
|
||||
options in this object are `false` by default. The options supported
|
||||
are:
|
||||
|
||||
- `loose` Be more forgiving about not-quite-valid semver strings.
|
||||
(Any resulting output will always be 100% strict compliant, of
|
||||
course.) For backwards compatibility reasons, if the `options`
|
||||
argument is a boolean value instead of an object, it is interpreted
|
||||
to be the `loose` param.
|
||||
- `includePrerelease` Set to suppress the [default
|
||||
behavior](https://github.com/npm/node-semver#prerelease-tags) of
|
||||
excluding prerelease tagged versions from ranges unless they are
|
||||
explicitly opted into.
|
||||
|
||||
Strict-mode Comparators and Ranges will be strict about the SemVer
|
||||
strings that they parse.
|
||||
|
||||
* `valid(v)`: Return the parsed version, or null if it's not valid.
|
||||
* `inc(v, release)`: Return the version incremented by the release
|
||||
type (`major`, `premajor`, `minor`, `preminor`, `patch`,
|
||||
`prepatch`, or `prerelease`), or null if it's not valid
|
||||
* `premajor` in one call will bump the version up to the next major
|
||||
version and down to a prerelease of that major version.
|
||||
`preminor`, and `prepatch` work the same way.
|
||||
* If called from a non-prerelease version, the `prerelease` will work the
|
||||
same as `prepatch`. It increments the patch version, then makes a
|
||||
prerelease. If the input version is already a prerelease it simply
|
||||
increments it.
|
||||
* `prerelease(v)`: Returns an array of prerelease components, or null
|
||||
if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]`
|
||||
* `major(v)`: Return the major version number.
|
||||
* `minor(v)`: Return the minor version number.
|
||||
* `patch(v)`: Return the patch version number.
|
||||
* `intersects(r1, r2, loose)`: Return true if the two supplied ranges
|
||||
or comparators intersect.
|
||||
* `parse(v)`: Attempt to parse a string as a semantic version, returning either
|
||||
a `SemVer` object or `null`.
|
||||
|
||||
### Comparison
|
||||
|
||||
* `gt(v1, v2)`: `v1 > v2`
|
||||
* `gte(v1, v2)`: `v1 >= v2`
|
||||
* `lt(v1, v2)`: `v1 < v2`
|
||||
* `lte(v1, v2)`: `v1 <= v2`
|
||||
* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent,
|
||||
even if they're not the exact same string. You already know how to
|
||||
compare strings.
|
||||
* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`.
|
||||
* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call
|
||||
the corresponding function above. `"==="` and `"!=="` do simple
|
||||
string comparison, but are included for completeness. Throws if an
|
||||
invalid comparison string is provided.
|
||||
* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if
|
||||
`v2` is greater. Sorts in ascending order if passed to `Array.sort()`.
|
||||
* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions
|
||||
in descending order when passed to `Array.sort()`.
|
||||
* `diff(v1, v2)`: Returns difference between two versions by the release type
|
||||
(`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`),
|
||||
or null if the versions are the same.
|
||||
|
||||
### Comparators
|
||||
|
||||
* `intersects(comparator)`: Return true if the comparators intersect
|
||||
|
||||
### Ranges
|
||||
|
||||
* `validRange(range)`: Return the valid range or null if it's not valid
|
||||
* `satisfies(version, range)`: Return true if the version satisfies the
|
||||
range.
|
||||
* `maxSatisfying(versions, range)`: Return the highest version in the list
|
||||
that satisfies the range, or `null` if none of them do.
|
||||
* `minSatisfying(versions, range)`: Return the lowest version in the list
|
||||
that satisfies the range, or `null` if none of them do.
|
||||
* `minVersion(range)`: Return the lowest version that can possibly match
|
||||
the given range.
|
||||
* `gtr(version, range)`: Return `true` if version is greater than all the
|
||||
versions possible in the range.
|
||||
* `ltr(version, range)`: Return `true` if version is less than all the
|
||||
versions possible in the range.
|
||||
* `outside(version, range, hilo)`: Return true if the version is outside
|
||||
the bounds of the range in either the high or low direction. The
|
||||
`hilo` argument must be either the string `'>'` or `'<'`. (This is
|
||||
the function called by `gtr` and `ltr`.)
|
||||
* `intersects(range)`: Return true if any of the ranges comparators intersect
|
||||
|
||||
Note that, since ranges may be non-contiguous, a version might not be
|
||||
greater than a range, less than a range, *or* satisfy a range! For
|
||||
example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9`
|
||||
until `2.0.0`, so the version `1.2.10` would not be greater than the
|
||||
range (because `2.0.1` satisfies, which is higher), nor less than the
|
||||
range (since `1.2.8` satisfies, which is lower), and it also does not
|
||||
satisfy the range.
|
||||
|
||||
If you want to know if a version satisfies or does not satisfy a
|
||||
range, use the `satisfies(version, range)` function.
|
||||
|
||||
### Coercion
|
||||
|
||||
* `coerce(version)`: Coerces a string to semver if possible
|
||||
|
||||
This aims to provide a very forgiving translation of a non-semver string to
|
||||
semver. It looks for the first digit in a string, and consumes all
|
||||
remaining characters which satisfy at least a partial semver (e.g., `1`,
|
||||
`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer
|
||||
versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All
|
||||
surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes
|
||||
`3.4.0`). Only text which lacks digits will fail coercion (`version one`
|
||||
is not valid). The maximum length for any semver component considered for
|
||||
coercion is 16 characters; longer components will be ignored
|
||||
(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any
|
||||
semver component is `Number.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value
|
||||
components are invalid (`9999999999999999.4.7.4` is likely invalid).
|
160
web/node_modules/default-gateway/node_modules/semver/bin/semver
generated
vendored
Executable file
160
web/node_modules/default-gateway/node_modules/semver/bin/semver
generated
vendored
Executable file
|
@ -0,0 +1,160 @@
|
|||
#!/usr/bin/env node
|
||||
// Standalone semver comparison program.
|
||||
// Exits successfully and prints matching version(s) if
|
||||
// any supplied version is valid and passes all tests.
|
||||
|
||||
var argv = process.argv.slice(2)
|
||||
|
||||
var versions = []
|
||||
|
||||
var range = []
|
||||
|
||||
var inc = null
|
||||
|
||||
var version = require('../package.json').version
|
||||
|
||||
var loose = false
|
||||
|
||||
var includePrerelease = false
|
||||
|
||||
var coerce = false
|
||||
|
||||
var identifier
|
||||
|
||||
var semver = require('../semver')
|
||||
|
||||
var reverse = false
|
||||
|
||||
var options = {}
|
||||
|
||||
main()
|
||||
|
||||
function main () {
|
||||
if (!argv.length) return help()
|
||||
while (argv.length) {
|
||||
var a = argv.shift()
|
||||
var indexOfEqualSign = a.indexOf('=')
|
||||
if (indexOfEqualSign !== -1) {
|
||||
a = a.slice(0, indexOfEqualSign)
|
||||
argv.unshift(a.slice(indexOfEqualSign + 1))
|
||||
}
|
||||
switch (a) {
|
||||
case '-rv': case '-rev': case '--rev': case '--reverse':
|
||||
reverse = true
|
||||
break
|
||||
case '-l': case '--loose':
|
||||
loose = true
|
||||
break
|
||||
case '-p': case '--include-prerelease':
|
||||
includePrerelease = true
|
||||
break
|
||||
case '-v': case '--version':
|
||||
versions.push(argv.shift())
|
||||
break
|
||||
case '-i': case '--inc': case '--increment':
|
||||
switch (argv[0]) {
|
||||
case 'major': case 'minor': case 'patch': case 'prerelease':
|
||||
case 'premajor': case 'preminor': case 'prepatch':
|
||||
inc = argv.shift()
|
||||
break
|
||||
default:
|
||||
inc = 'patch'
|
||||
break
|
||||
}
|
||||
break
|
||||
case '--preid':
|
||||
identifier = argv.shift()
|
||||
break
|
||||
case '-r': case '--range':
|
||||
range.push(argv.shift())
|
||||
break
|
||||
case '-c': case '--coerce':
|
||||
coerce = true
|
||||
break
|
||||
case '-h': case '--help': case '-?':
|
||||
return help()
|
||||
default:
|
||||
versions.push(a)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
var options = { loose: loose, includePrerelease: includePrerelease }
|
||||
|
||||
versions = versions.map(function (v) {
|
||||
return coerce ? (semver.coerce(v) || { version: v }).version : v
|
||||
}).filter(function (v) {
|
||||
return semver.valid(v)
|
||||
})
|
||||
if (!versions.length) return fail()
|
||||
if (inc && (versions.length !== 1 || range.length)) { return failInc() }
|
||||
|
||||
for (var i = 0, l = range.length; i < l; i++) {
|
||||
versions = versions.filter(function (v) {
|
||||
return semver.satisfies(v, range[i], options)
|
||||
})
|
||||
if (!versions.length) return fail()
|
||||
}
|
||||
return success(versions)
|
||||
}
|
||||
|
||||
function failInc () {
|
||||
console.error('--inc can only be used on a single version with no range')
|
||||
fail()
|
||||
}
|
||||
|
||||
function fail () { process.exit(1) }
|
||||
|
||||
function success () {
|
||||
var compare = reverse ? 'rcompare' : 'compare'
|
||||
versions.sort(function (a, b) {
|
||||
return semver[compare](a, b, options)
|
||||
}).map(function (v) {
|
||||
return semver.clean(v, options)
|
||||
}).map(function (v) {
|
||||
return inc ? semver.inc(v, inc, options, identifier) : v
|
||||
}).forEach(function (v, i, _) { console.log(v) })
|
||||
}
|
||||
|
||||
function help () {
|
||||
console.log(['SemVer ' + version,
|
||||
'',
|
||||
'A JavaScript implementation of the https://semver.org/ specification',
|
||||
'Copyright Isaac Z. Schlueter',
|
||||
'',
|
||||
'Usage: semver [options] <version> [<version> [...]]',
|
||||
'Prints valid versions sorted by SemVer precedence',
|
||||
'',
|
||||
'Options:',
|
||||
'-r --range <range>',
|
||||
' Print versions that match the specified range.',
|
||||
'',
|
||||
'-i --increment [<level>]',
|
||||
' Increment a version by the specified level. Level can',
|
||||
' be one of: major, minor, patch, premajor, preminor,',
|
||||
" prepatch, or prerelease. Default level is 'patch'.",
|
||||
' Only one version may be specified.',
|
||||
'',
|
||||
'--preid <identifier>',
|
||||
' Identifier to be used to prefix premajor, preminor,',
|
||||
' prepatch or prerelease version increments.',
|
||||
'',
|
||||
'-l --loose',
|
||||
' Interpret versions and ranges loosely',
|
||||
'',
|
||||
'-p --include-prerelease',
|
||||
' Always include prerelease versions in range matching',
|
||||
'',
|
||||
'-c --coerce',
|
||||
' Coerce a string into SemVer if possible',
|
||||
' (does not imply --loose)',
|
||||
'',
|
||||
'Program exits successfully if any valid version satisfies',
|
||||
'all supplied ranges, and prints all satisfying versions.',
|
||||
'',
|
||||
'If no satisfying versions are found, then exits failure.',
|
||||
'',
|
||||
'Versions are printed in ascending order, so supplying',
|
||||
'multiple versions to the utility will just sort them.'
|
||||
].join('\n'))
|
||||
}
|
28
web/node_modules/default-gateway/node_modules/semver/package.json
generated
vendored
Normal file
28
web/node_modules/default-gateway/node_modules/semver/package.json
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"name": "semver",
|
||||
"version": "5.7.1",
|
||||
"description": "The semantic version parser used by npm.",
|
||||
"main": "semver.js",
|
||||
"scripts": {
|
||||
"test": "tap",
|
||||
"preversion": "npm test",
|
||||
"postversion": "npm publish",
|
||||
"postpublish": "git push origin --all; git push origin --tags"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tap": "^13.0.0-rc.18"
|
||||
},
|
||||
"license": "ISC",
|
||||
"repository": "https://github.com/npm/node-semver",
|
||||
"bin": {
|
||||
"semver": "./bin/semver"
|
||||
},
|
||||
"files": [
|
||||
"bin",
|
||||
"range.bnf",
|
||||
"semver.js"
|
||||
],
|
||||
"tap": {
|
||||
"check-coverage": true
|
||||
}
|
||||
}
|
16
web/node_modules/default-gateway/node_modules/semver/range.bnf
generated
vendored
Normal file
16
web/node_modules/default-gateway/node_modules/semver/range.bnf
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
range-set ::= range ( logical-or range ) *
|
||||
logical-or ::= ( ' ' ) * '||' ( ' ' ) *
|
||||
range ::= hyphen | simple ( ' ' simple ) * | ''
|
||||
hyphen ::= partial ' - ' partial
|
||||
simple ::= primitive | partial | tilde | caret
|
||||
primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
|
||||
partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
|
||||
xr ::= 'x' | 'X' | '*' | nr
|
||||
nr ::= '0' | [1-9] ( [0-9] ) *
|
||||
tilde ::= '~' partial
|
||||
caret ::= '^' partial
|
||||
qualifier ::= ( '-' pre )? ( '+' build )?
|
||||
pre ::= parts
|
||||
build ::= parts
|
||||
parts ::= part ( '.' part ) *
|
||||
part ::= nr | [-0-9A-Za-z]+
|
1483
web/node_modules/default-gateway/node_modules/semver/semver.js
generated
vendored
Normal file
1483
web/node_modules/default-gateway/node_modules/semver/semver.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
19
web/node_modules/default-gateway/node_modules/shebang-command/index.js
generated
vendored
Normal file
19
web/node_modules/default-gateway/node_modules/shebang-command/index.js
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
'use strict';
|
||||
var shebangRegex = require('shebang-regex');
|
||||
|
||||
module.exports = function (str) {
|
||||
var match = str.match(shebangRegex);
|
||||
|
||||
if (!match) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var arr = match[0].replace(/#! ?/, '').split(' ');
|
||||
var bin = arr[0].split('/').pop();
|
||||
var arg = arr[1];
|
||||
|
||||
return (bin === 'env' ?
|
||||
arg :
|
||||
bin + (arg ? ' ' + arg : '')
|
||||
);
|
||||
};
|
21
web/node_modules/default-gateway/node_modules/shebang-command/license
generated
vendored
Normal file
21
web/node_modules/default-gateway/node_modules/shebang-command/license
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Kevin Martensson <kevinmartensson@gmail.com> (github.com/kevva)
|
||||
|
||||
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.
|
39
web/node_modules/default-gateway/node_modules/shebang-command/package.json
generated
vendored
Normal file
39
web/node_modules/default-gateway/node_modules/shebang-command/package.json
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"name": "shebang-command",
|
||||
"version": "1.2.0",
|
||||
"description": "Get the command from a shebang",
|
||||
"license": "MIT",
|
||||
"repository": "kevva/shebang-command",
|
||||
"author": {
|
||||
"name": "Kevin Martensson",
|
||||
"email": "kevinmartensson@gmail.com",
|
||||
"url": "github.com/kevva"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"cmd",
|
||||
"command",
|
||||
"parse",
|
||||
"shebang"
|
||||
],
|
||||
"dependencies": {
|
||||
"shebang-regex": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"xo": {
|
||||
"ignores": [
|
||||
"test.js"
|
||||
]
|
||||
}
|
||||
}
|
39
web/node_modules/default-gateway/node_modules/shebang-command/readme.md
generated
vendored
Normal file
39
web/node_modules/default-gateway/node_modules/shebang-command/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
# shebang-command [](https://travis-ci.org/kevva/shebang-command)
|
||||
|
||||
> Get the command from a shebang
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save shebang-command
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const shebangCommand = require('shebang-command');
|
||||
|
||||
shebangCommand('#!/usr/bin/env node');
|
||||
//=> 'node'
|
||||
|
||||
shebangCommand('#!/bin/bash');
|
||||
//=> 'bash'
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### shebangCommand(string)
|
||||
|
||||
#### string
|
||||
|
||||
Type: `string`
|
||||
|
||||
String containing a shebang.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Kevin Martensson](http://github.com/kevva)
|
2
web/node_modules/default-gateway/node_modules/shebang-regex/index.js
generated
vendored
Normal file
2
web/node_modules/default-gateway/node_modules/shebang-regex/index.js
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
'use strict';
|
||||
module.exports = /^#!.*/;
|
21
web/node_modules/default-gateway/node_modules/shebang-regex/license
generated
vendored
Normal file
21
web/node_modules/default-gateway/node_modules/shebang-regex/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.
|
32
web/node_modules/default-gateway/node_modules/shebang-regex/package.json
generated
vendored
Normal file
32
web/node_modules/default-gateway/node_modules/shebang-regex/package.json
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"name": "shebang-regex",
|
||||
"version": "1.0.0",
|
||||
"description": "Regular expression for matching a shebang",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/shebang-regex",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test.js"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"re",
|
||||
"regex",
|
||||
"regexp",
|
||||
"shebang",
|
||||
"match",
|
||||
"test"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "0.0.4"
|
||||
}
|
||||
}
|
29
web/node_modules/default-gateway/node_modules/shebang-regex/readme.md
generated
vendored
Normal file
29
web/node_modules/default-gateway/node_modules/shebang-regex/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
# shebang-regex [](https://travis-ci.org/sindresorhus/shebang-regex)
|
||||
|
||||
> Regular expression for matching a [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix))
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save shebang-regex
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var shebangRegex = require('shebang-regex');
|
||||
var str = '#!/usr/bin/env node\nconsole.log("unicorns");';
|
||||
|
||||
shebangRegex.test(str);
|
||||
//=> true
|
||||
|
||||
shebangRegex.exec(str)[0];
|
||||
//=> '#!/usr/bin/env node'
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
152
web/node_modules/default-gateway/node_modules/which/CHANGELOG.md
generated
vendored
Normal file
152
web/node_modules/default-gateway/node_modules/which/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,152 @@
|
|||
# Changes
|
||||
|
||||
|
||||
## 1.3.1
|
||||
|
||||
* update deps
|
||||
* update travis
|
||||
|
||||
## v1.3.0
|
||||
|
||||
* Add nothrow option to which.sync
|
||||
* update tap
|
||||
|
||||
## v1.2.14
|
||||
|
||||
* appveyor: drop node 5 and 0.x
|
||||
* travis-ci: add node 6, drop 0.x
|
||||
|
||||
## v1.2.13
|
||||
|
||||
* test: Pass missing option to pass on windows
|
||||
* update tap
|
||||
* update isexe to 2.0.0
|
||||
* neveragain.tech pledge request
|
||||
|
||||
## v1.2.12
|
||||
|
||||
* Removed unused require
|
||||
|
||||
## v1.2.11
|
||||
|
||||
* Prevent changelog script from being included in package
|
||||
|
||||
## v1.2.10
|
||||
|
||||
* Use env.PATH only, not env.Path
|
||||
|
||||
## v1.2.9
|
||||
|
||||
* fix for paths starting with ../
|
||||
* Remove unused `is-absolute` module
|
||||
|
||||
## v1.2.8
|
||||
|
||||
* bullet items in changelog that contain (but don't start with) #
|
||||
|
||||
## v1.2.7
|
||||
|
||||
* strip 'update changelog' changelog entries out of changelog
|
||||
|
||||
## v1.2.6
|
||||
|
||||
* make the changelog bulleted
|
||||
|
||||
## v1.2.5
|
||||
|
||||
* make a changelog, and keep it up to date
|
||||
* don't include tests in package
|
||||
* Properly handle relative-path executables
|
||||
* appveyor
|
||||
* Attach error code to Not Found error
|
||||
* Make tests pass on Windows
|
||||
|
||||
## v1.2.4
|
||||
|
||||
* Fix typo
|
||||
|
||||
## v1.2.3
|
||||
|
||||
* update isexe, fix regression in pathExt handling
|
||||
|
||||
## v1.2.2
|
||||
|
||||
* update deps, use isexe module, test windows
|
||||
|
||||
## v1.2.1
|
||||
|
||||
* Sometimes windows PATH entries are quoted
|
||||
* Fixed a bug in the check for group and user mode bits. This bug was introduced during refactoring for supporting strict mode.
|
||||
* doc cli
|
||||
|
||||
## v1.2.0
|
||||
|
||||
* Add support for opt.all and -as cli flags
|
||||
* test the bin
|
||||
* update travis
|
||||
* Allow checking for multiple programs in bin/which
|
||||
* tap 2
|
||||
|
||||
## v1.1.2
|
||||
|
||||
* travis
|
||||
* Refactored and fixed undefined error on Windows
|
||||
* Support strict mode
|
||||
|
||||
## v1.1.1
|
||||
|
||||
* test +g exes against secondary groups, if available
|
||||
* Use windows exe semantics on cygwin & msys
|
||||
* cwd should be first in path on win32, not last
|
||||
* Handle lower-case 'env.Path' on Windows
|
||||
* Update docs
|
||||
* use single-quotes
|
||||
|
||||
## v1.1.0
|
||||
|
||||
* Add tests, depend on is-absolute
|
||||
|
||||
## v1.0.9
|
||||
|
||||
* which.js: root is allowed to execute files owned by anyone
|
||||
|
||||
## v1.0.8
|
||||
|
||||
* don't use graceful-fs
|
||||
|
||||
## v1.0.7
|
||||
|
||||
* add license to package.json
|
||||
|
||||
## v1.0.6
|
||||
|
||||
* isc license
|
||||
|
||||
## 1.0.5
|
||||
|
||||
* Awful typo
|
||||
|
||||
## 1.0.4
|
||||
|
||||
* Test for path absoluteness properly
|
||||
* win: Allow '' as a pathext if cmd has a . in it
|
||||
|
||||
## 1.0.3
|
||||
|
||||
* Remove references to execPath
|
||||
* Make `which.sync()` work on Windows by honoring the PATHEXT variable.
|
||||
* Make `isExe()` always return true on Windows.
|
||||
* MIT
|
||||
|
||||
## 1.0.2
|
||||
|
||||
* Only files can be exes
|
||||
|
||||
## 1.0.1
|
||||
|
||||
* Respect the PATHEXT env for win32 support
|
||||
* should 0755 the bin
|
||||
* binary
|
||||
* guts
|
||||
* package
|
||||
* 1st
|
15
web/node_modules/default-gateway/node_modules/which/LICENSE
generated
vendored
Normal file
15
web/node_modules/default-gateway/node_modules/which/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.
|
51
web/node_modules/default-gateway/node_modules/which/README.md
generated
vendored
Normal file
51
web/node_modules/default-gateway/node_modules/which/README.md
generated
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
# which
|
||||
|
||||
Like the unix `which` utility.
|
||||
|
||||
Finds the first instance of a specified executable in the PATH
|
||||
environment variable. Does not cache the results, so `hash -r` is not
|
||||
needed when the PATH changes.
|
||||
|
||||
## USAGE
|
||||
|
||||
```javascript
|
||||
var which = require('which')
|
||||
|
||||
// async usage
|
||||
which('node', function (er, resolvedPath) {
|
||||
// er is returned if no "node" is found on the PATH
|
||||
// if it is found, then the absolute path to the exec is returned
|
||||
})
|
||||
|
||||
// sync usage
|
||||
// throws if not found
|
||||
var resolved = which.sync('node')
|
||||
|
||||
// if nothrow option is used, returns null if not found
|
||||
resolved = which.sync('node', {nothrow: true})
|
||||
|
||||
// Pass options to override the PATH and PATHEXT environment vars.
|
||||
which('node', { path: someOtherPath }, function (er, resolved) {
|
||||
if (er)
|
||||
throw er
|
||||
console.log('found at %j', resolved)
|
||||
})
|
||||
```
|
||||
|
||||
## CLI USAGE
|
||||
|
||||
Same as the BSD `which(1)` binary.
|
||||
|
||||
```
|
||||
usage: which [-as] program ...
|
||||
```
|
||||
|
||||
## OPTIONS
|
||||
|
||||
You may pass an options object as the second argument.
|
||||
|
||||
- `path`: Use instead of the `PATH` environment variable.
|
||||
- `pathExt`: Use instead of the `PATHEXT` environment variable.
|
||||
- `all`: Return all matches, instead of just the first one. Note that
|
||||
this means the function returns an array of strings instead of a
|
||||
single string.
|
52
web/node_modules/default-gateway/node_modules/which/bin/which
generated
vendored
Executable file
52
web/node_modules/default-gateway/node_modules/which/bin/which
generated
vendored
Executable file
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/env node
|
||||
var which = require("../")
|
||||
if (process.argv.length < 3)
|
||||
usage()
|
||||
|
||||
function usage () {
|
||||
console.error('usage: which [-as] program ...')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
var all = false
|
||||
var silent = false
|
||||
var dashdash = false
|
||||
var args = process.argv.slice(2).filter(function (arg) {
|
||||
if (dashdash || !/^-/.test(arg))
|
||||
return true
|
||||
|
||||
if (arg === '--') {
|
||||
dashdash = true
|
||||
return false
|
||||
}
|
||||
|
||||
var flags = arg.substr(1).split('')
|
||||
for (var f = 0; f < flags.length; f++) {
|
||||
var flag = flags[f]
|
||||
switch (flag) {
|
||||
case 's':
|
||||
silent = true
|
||||
break
|
||||
case 'a':
|
||||
all = true
|
||||
break
|
||||
default:
|
||||
console.error('which: illegal option -- ' + flag)
|
||||
usage()
|
||||
}
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
||||
process.exit(args.reduce(function (pv, current) {
|
||||
try {
|
||||
var f = which.sync(current, { all: all })
|
||||
if (all)
|
||||
f = f.join('\n')
|
||||
if (!silent)
|
||||
console.log(f)
|
||||
return pv;
|
||||
} catch (e) {
|
||||
return 1;
|
||||
}
|
||||
}, 0))
|
30
web/node_modules/default-gateway/node_modules/which/package.json
generated
vendored
Normal file
30
web/node_modules/default-gateway/node_modules/which/package.json
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)",
|
||||
"name": "which",
|
||||
"description": "Like which(1) unix command. Find the first instance of an executable in the PATH.",
|
||||
"version": "1.3.1",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/isaacs/node-which.git"
|
||||
},
|
||||
"main": "which.js",
|
||||
"bin": "./bin/which",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"isexe": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mkdirp": "^0.5.0",
|
||||
"rimraf": "^2.6.2",
|
||||
"tap": "^12.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js --cov",
|
||||
"changelog": "bash gen-changelog.sh",
|
||||
"postversion": "npm run changelog && git add CHANGELOG.md && git commit -m 'update changelog - '${npm_package_version}"
|
||||
},
|
||||
"files": [
|
||||
"which.js",
|
||||
"bin/which"
|
||||
]
|
||||
}
|
135
web/node_modules/default-gateway/node_modules/which/which.js
generated
vendored
Normal file
135
web/node_modules/default-gateway/node_modules/which/which.js
generated
vendored
Normal file
|
@ -0,0 +1,135 @@
|
|||
module.exports = which
|
||||
which.sync = whichSync
|
||||
|
||||
var isWindows = process.platform === 'win32' ||
|
||||
process.env.OSTYPE === 'cygwin' ||
|
||||
process.env.OSTYPE === 'msys'
|
||||
|
||||
var path = require('path')
|
||||
var COLON = isWindows ? ';' : ':'
|
||||
var isexe = require('isexe')
|
||||
|
||||
function getNotFoundError (cmd) {
|
||||
var er = new Error('not found: ' + cmd)
|
||||
er.code = 'ENOENT'
|
||||
|
||||
return er
|
||||
}
|
||||
|
||||
function getPathInfo (cmd, opt) {
|
||||
var colon = opt.colon || COLON
|
||||
var pathEnv = opt.path || process.env.PATH || ''
|
||||
var pathExt = ['']
|
||||
|
||||
pathEnv = pathEnv.split(colon)
|
||||
|
||||
var pathExtExe = ''
|
||||
if (isWindows) {
|
||||
pathEnv.unshift(process.cwd())
|
||||
pathExtExe = (opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM')
|
||||
pathExt = pathExtExe.split(colon)
|
||||
|
||||
|
||||
// Always test the cmd itself first. isexe will check to make sure
|
||||
// it's found in the pathExt set.
|
||||
if (cmd.indexOf('.') !== -1 && pathExt[0] !== '')
|
||||
pathExt.unshift('')
|
||||
}
|
||||
|
||||
// If it has a slash, then we don't bother searching the pathenv.
|
||||
// just check the file itself, and that's it.
|
||||
if (cmd.match(/\//) || isWindows && cmd.match(/\\/))
|
||||
pathEnv = ['']
|
||||
|
||||
return {
|
||||
env: pathEnv,
|
||||
ext: pathExt,
|
||||
extExe: pathExtExe
|
||||
}
|
||||
}
|
||||
|
||||
function which (cmd, opt, cb) {
|
||||
if (typeof opt === 'function') {
|
||||
cb = opt
|
||||
opt = {}
|
||||
}
|
||||
|
||||
var info = getPathInfo(cmd, opt)
|
||||
var pathEnv = info.env
|
||||
var pathExt = info.ext
|
||||
var pathExtExe = info.extExe
|
||||
var found = []
|
||||
|
||||
;(function F (i, l) {
|
||||
if (i === l) {
|
||||
if (opt.all && found.length)
|
||||
return cb(null, found)
|
||||
else
|
||||
return cb(getNotFoundError(cmd))
|
||||
}
|
||||
|
||||
var pathPart = pathEnv[i]
|
||||
if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"')
|
||||
pathPart = pathPart.slice(1, -1)
|
||||
|
||||
var p = path.join(pathPart, cmd)
|
||||
if (!pathPart && (/^\.[\\\/]/).test(cmd)) {
|
||||
p = cmd.slice(0, 2) + p
|
||||
}
|
||||
;(function E (ii, ll) {
|
||||
if (ii === ll) return F(i + 1, l)
|
||||
var ext = pathExt[ii]
|
||||
isexe(p + ext, { pathExt: pathExtExe }, function (er, is) {
|
||||
if (!er && is) {
|
||||
if (opt.all)
|
||||
found.push(p + ext)
|
||||
else
|
||||
return cb(null, p + ext)
|
||||
}
|
||||
return E(ii + 1, ll)
|
||||
})
|
||||
})(0, pathExt.length)
|
||||
})(0, pathEnv.length)
|
||||
}
|
||||
|
||||
function whichSync (cmd, opt) {
|
||||
opt = opt || {}
|
||||
|
||||
var info = getPathInfo(cmd, opt)
|
||||
var pathEnv = info.env
|
||||
var pathExt = info.ext
|
||||
var pathExtExe = info.extExe
|
||||
var found = []
|
||||
|
||||
for (var i = 0, l = pathEnv.length; i < l; i ++) {
|
||||
var pathPart = pathEnv[i]
|
||||
if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"')
|
||||
pathPart = pathPart.slice(1, -1)
|
||||
|
||||
var p = path.join(pathPart, cmd)
|
||||
if (!pathPart && /^\.[\\\/]/.test(cmd)) {
|
||||
p = cmd.slice(0, 2) + p
|
||||
}
|
||||
for (var j = 0, ll = pathExt.length; j < ll; j ++) {
|
||||
var cur = p + pathExt[j]
|
||||
var is
|
||||
try {
|
||||
is = isexe.sync(cur, { pathExt: pathExtExe })
|
||||
if (is) {
|
||||
if (opt.all)
|
||||
found.push(cur)
|
||||
else
|
||||
return cur
|
||||
}
|
||||
} catch (ex) {}
|
||||
}
|
||||
}
|
||||
|
||||
if (opt.all && found.length)
|
||||
return found
|
||||
|
||||
if (opt.nothrow)
|
||||
return null
|
||||
|
||||
throw getNotFoundError(cmd)
|
||||
}
|
48
web/node_modules/default-gateway/openbsd.js
generated
vendored
Normal file
48
web/node_modules/default-gateway/openbsd.js
generated
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
"use strict";
|
||||
|
||||
const net = require("net");
|
||||
const execa = require("execa");
|
||||
const dests = ["default", "0.0.0.0", "0.0.0.0/0", "::", "::/0"];
|
||||
|
||||
const args = {
|
||||
v4: ["-rn", "-f", "inet"],
|
||||
v6: ["-rn", "-f", "inet6"],
|
||||
};
|
||||
|
||||
const parse = stdout => {
|
||||
let result;
|
||||
|
||||
(stdout || "").trim().split("\n").some(line => {
|
||||
const results = line.split(/ +/) || [];
|
||||
const target = results[0];
|
||||
const gateway = results[1];
|
||||
const iface = results[7];
|
||||
if (dests.indexOf(target) !== -1 && gateway && net.isIP(gateway)) {
|
||||
result = {gateway, interface: (iface ? iface : null)};
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if (!result) {
|
||||
throw new Error("Unable to determine default gateway");
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
const promise = family => {
|
||||
return execa.stdout("netstat", args[family]).then(stdout => {
|
||||
return parse(stdout);
|
||||
});
|
||||
};
|
||||
|
||||
const sync = family => {
|
||||
const result = execa.sync("netstat", args[family]);
|
||||
return parse(result.stdout);
|
||||
};
|
||||
|
||||
module.exports.v4 = () => promise("v4");
|
||||
module.exports.v6 = () => promise("v6");
|
||||
|
||||
module.exports.v4.sync = () => sync("v4");
|
||||
module.exports.v6.sync = () => sync("v6");
|
43
web/node_modules/default-gateway/package.json
generated
vendored
Normal file
43
web/node_modules/default-gateway/package.json
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"name": "default-gateway",
|
||||
"version": "4.2.0",
|
||||
"description": "Get the default network gateway, cross-platform.",
|
||||
"author": "silverwind <me@silverwind.io>",
|
||||
"repository": "silverwind/default-gateway",
|
||||
"license": "BSD-2-Clause",
|
||||
"scripts": {
|
||||
"test": "eslint *.js && node --pending-deprecation --trace-deprecation --throw-deprecation --trace-warnings test.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"dependencies": {
|
||||
"execa": "^1.0.0",
|
||||
"ip-regex": "^2.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^5.15.1",
|
||||
"eslint-config-silverwind": "^2.1.0",
|
||||
"updates": "^7.2.0",
|
||||
"ver": "4.0.1"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"android.js",
|
||||
"darwin.js",
|
||||
"freebsd.js",
|
||||
"linux.js",
|
||||
"openbsd.js",
|
||||
"sunos.js",
|
||||
"win32.js",
|
||||
"ibmi.js"
|
||||
],
|
||||
"keywords": [
|
||||
"default gateway",
|
||||
"network",
|
||||
"default",
|
||||
"gateway",
|
||||
"routing",
|
||||
"route"
|
||||
]
|
||||
}
|
48
web/node_modules/default-gateway/sunos.js
generated
vendored
Normal file
48
web/node_modules/default-gateway/sunos.js
generated
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
"use strict";
|
||||
|
||||
const net = require("net");
|
||||
const execa = require("execa");
|
||||
const dests = ["default", "0.0.0.0", "0.0.0.0/0", "::", "::/0"];
|
||||
|
||||
const args = {
|
||||
v4: ["-rn", "-f", "inet"],
|
||||
v6: ["-rn", "-f", "inet6"],
|
||||
};
|
||||
|
||||
const parse = stdout => {
|
||||
let result;
|
||||
|
||||
(stdout || "").trim().split("\n").some(line => {
|
||||
const results = line.split(/ +/) || [];
|
||||
const target = results[0];
|
||||
const gateway = results[1];
|
||||
const iface = results[5];
|
||||
if (dests.indexOf(target) !== -1 && gateway && net.isIP(gateway)) {
|
||||
result = {gateway, interface: (iface ? iface : null)};
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if (!result) {
|
||||
throw new Error("Unable to determine default gateway");
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
const promise = family => {
|
||||
return execa.stdout("netstat", args[family]).then(stdout => {
|
||||
return parse(stdout);
|
||||
});
|
||||
};
|
||||
|
||||
const sync = family => {
|
||||
const result = execa.sync("netstat", args[family]);
|
||||
return parse(result.stdout);
|
||||
};
|
||||
|
||||
module.exports.v4 = () => promise("v4");
|
||||
module.exports.v6 = () => promise("v6");
|
||||
|
||||
module.exports.v4.sync = () => sync("v4");
|
||||
module.exports.v6.sync = () => sync("v6");
|
67
web/node_modules/default-gateway/win32.js
generated
vendored
Normal file
67
web/node_modules/default-gateway/win32.js
generated
vendored
Normal file
|
@ -0,0 +1,67 @@
|
|||
"use strict";
|
||||
|
||||
const execa = require("execa");
|
||||
const ipRegex = require("ip-regex");
|
||||
|
||||
const gwArgs = "path Win32_NetworkAdapterConfiguration where IPEnabled=true get DefaultIPGateway,Index /format:table".split(" ");
|
||||
const ifArgs = "path Win32_NetworkAdapter get Index,NetConnectionID /format:table".split(" ");
|
||||
|
||||
const parse = (gwTable, ifTable, family) => {
|
||||
let gateway, gwid, result;
|
||||
|
||||
(gwTable || "").trim().split("\n").splice(1).some(line => {
|
||||
const results = line.trim().split(/} +/) || [];
|
||||
const gw = results[0];
|
||||
const id = results[1];
|
||||
gateway = (ipRegex[family]().exec((gw || "").trim()) || [])[0];
|
||||
if (gateway) {
|
||||
gwid = id;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
(ifTable || "").trim().split("\n").splice(1).some(line => {
|
||||
const i = line.indexOf(" ");
|
||||
const id = line.substr(0, i).trim();
|
||||
const name = line.substr(i + 1).trim();
|
||||
if (id === gwid) {
|
||||
result = {gateway, interface: name ? name : null};
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if (!result) {
|
||||
throw new Error("Unable to determine default gateway");
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
const spawnOpts = {
|
||||
windowsHide: true,
|
||||
};
|
||||
|
||||
const promise = family => {
|
||||
return Promise.all([
|
||||
execa.stdout("wmic", gwArgs, spawnOpts),
|
||||
execa.stdout("wmic", ifArgs, spawnOpts),
|
||||
]).then(results => {
|
||||
const gwTable = results[0];
|
||||
const ifTable = results[1];
|
||||
|
||||
return parse(gwTable, ifTable, family);
|
||||
});
|
||||
};
|
||||
|
||||
const sync = family => {
|
||||
const gwTable = execa.sync("wmic", gwArgs, spawnOpts).stdout;
|
||||
const ifTable = execa.sync("wmic", ifArgs, spawnOpts).stdout;
|
||||
|
||||
return parse(gwTable, ifTable, family);
|
||||
};
|
||||
|
||||
module.exports.v4 = () => promise("v4");
|
||||
module.exports.v6 = () => promise("v6");
|
||||
|
||||
module.exports.v4.sync = () => sync("v4");
|
||||
module.exports.v6.sync = () => sync("v6");
|
Loading…
Add table
Add a link
Reference in a new issue