first
This commit is contained in:
22
node_modules/default-gateway/LICENSE
generated
vendored
Normal file
22
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.
|
51
node_modules/default-gateway/README.md
generated
vendored
Normal file
51
node_modules/default-gateway/README.md
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
# default-gateway
|
||||
[](https://www.npmjs.org/package/default-gateway) [](https://www.npmjs.org/package/default-gateway)
|
||||
|
||||
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 Windows, `wmic` must be available.
|
||||
- On IBM i, the `db2util` command must be available (provided by the `db2util` package).
|
||||
- On Unix (and macOS), the `netstat` command must be available.
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
$ npm i default-gateway
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
const defaultGateway = require('default-gateway');
|
||||
|
||||
const {gateway, interface} = await defaultGateway.v4();
|
||||
// gateway = '1.2.3.4', interface = 'en1'
|
||||
|
||||
const {gateway, interface} = await defaultGateway.v6();
|
||||
// gateway = '2001:db8::1', interface = 'en2'
|
||||
|
||||
const {gateway, interface} = defaultGateway.v4.sync();
|
||||
// gateway = '1.2.3.4', interface = 'en1'
|
||||
|
||||
const {gateway, interface} = defaultGateway.v6.sync();
|
||||
// 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
|
43
node_modules/default-gateway/android.js
generated
vendored
Normal file
43
node_modules/default-gateway/android.js
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
|
||||
const {isIP} = 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 [_, gateway, iface] = /default via (.+?) dev (.+?)( |$)/.exec(line) || [];
|
||||
if (gateway && isIP(gateway)) {
|
||||
result = {gateway, interface: (iface ? iface : null)};
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if (!result) {
|
||||
throw new Error("Unable to determine default gateway");
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
const promise = async family => {
|
||||
const {stdout} = await execa("ip", args[family]);
|
||||
return parse(stdout, family);
|
||||
};
|
||||
|
||||
const sync = family => {
|
||||
const {stdout} = execa.sync("ip", args[family]);
|
||||
return parse(stdout);
|
||||
};
|
||||
|
||||
module.exports.v4 = () => promise("v4");
|
||||
module.exports.v6 = () => promise("v6");
|
||||
|
||||
module.exports.v4.sync = () => sync("v4");
|
||||
module.exports.v6.sync = () => sync("v6");
|
52
node_modules/default-gateway/darwin.js
generated
vendored
Normal file
52
node_modules/default-gateway/darwin.js
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
|
||||
const {isIP} = require("net");
|
||||
const {release} = require("os");
|
||||
const execa = require("execa");
|
||||
const dests = new Set(["default", "0.0.0.0", "0.0.0.0/0", "::", "::/0"]);
|
||||
|
||||
const args = {
|
||||
v4: ["-rn", "-f", "inet"],
|
||||
v6: ["-rn", "-f", "inet6"],
|
||||
};
|
||||
|
||||
// The IPv4 gateway is in column 3 in Darwin 19 (macOS 10.15 Catalina) and higher,
|
||||
// previously it was in column 5
|
||||
const v4IfaceColumn = parseInt(release()) >= 19 ? 3 : 5;
|
||||
|
||||
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" ? v4IfaceColumn : 3];
|
||||
if (dests.has(target) && gateway && isIP(gateway)) {
|
||||
result = {gateway, interface: (iface ? iface : null)};
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if (!result) {
|
||||
throw new Error("Unable to determine default gateway");
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
const promise = async family => {
|
||||
const {stdout} = await execa("netstat", args[family]);
|
||||
return parse(stdout, family);
|
||||
};
|
||||
|
||||
const sync = family => {
|
||||
const {stdout} = execa.sync("netstat", args[family]);
|
||||
return parse(stdout, family);
|
||||
};
|
||||
|
||||
module.exports.v4 = () => promise("v4");
|
||||
module.exports.v6 = () => promise("v6");
|
||||
|
||||
module.exports.v4.sync = () => sync("v4");
|
||||
module.exports.v6.sync = () => sync("v6");
|
44
node_modules/default-gateway/freebsd.js
generated
vendored
Normal file
44
node_modules/default-gateway/freebsd.js
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
|
||||
const {isIP} = require("net");
|
||||
const execa = require("execa");
|
||||
const dests = new Set(["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 [target, gateway, _, iface] = line.split(/ +/) || [];
|
||||
if (dests.has(target) && gateway && isIP(gateway)) {
|
||||
result = {gateway, interface: (iface ? iface : null)};
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if (!result) {
|
||||
throw new Error("Unable to determine default gateway");
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
const promise = async family => {
|
||||
const {stdout} = await execa("netstat", args[family]);
|
||||
return parse(stdout);
|
||||
};
|
||||
|
||||
const sync = family => {
|
||||
const {stdout} = execa.sync("netstat", args[family]);
|
||||
return parse(stdout);
|
||||
};
|
||||
|
||||
module.exports.v4 = () => promise("v4");
|
||||
module.exports.v6 = () => promise("v6");
|
||||
|
||||
module.exports.v4.sync = () => sync("v4");
|
||||
module.exports.v6.sync = () => sync("v6");
|
36
node_modules/default-gateway/ibmi.js
generated
vendored
Normal file
36
node_modules/default-gateway/ibmi.js
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
"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 {}
|
||||
if (!result) {
|
||||
throw new Error("Unable to determine default gateway");
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
const promise = async family => {
|
||||
const {stdout} = await execa(db2util, [sql, "-p", family, "-o", "json"]);
|
||||
return 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
node_modules/default-gateway/index.js
generated
vendored
Normal file
35
node_modules/default-gateway/index.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
|
||||
const {platform, type} = require("os");
|
||||
|
||||
const supportedPlatforms = new Set([
|
||||
"aix",
|
||||
"android",
|
||||
"darwin",
|
||||
"freebsd",
|
||||
"linux",
|
||||
"openbsd",
|
||||
"sunos",
|
||||
"win32"
|
||||
]);
|
||||
|
||||
const plat = platform();
|
||||
|
||||
if (supportedPlatforms.has(plat)) {
|
||||
let file = plat;
|
||||
if (plat === "aix") {
|
||||
file = type() === "OS400" ? "ibmi" : "sunos"; // AIX `netstat` output is compatible with Solaris
|
||||
}
|
||||
|
||||
const m = require(`./${file}.js`);
|
||||
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 err = new Error(`Unsupported Platform: ${plat}`);
|
||||
module.exports.v4 = () => Promise.reject(err);
|
||||
module.exports.v6 = () => Promise.reject(err);
|
||||
module.exports.v4.sync = () => { throw err; };
|
||||
module.exports.v6.sync = () => { throw err; };
|
||||
}
|
57
node_modules/default-gateway/linux.js
generated
vendored
Normal file
57
node_modules/default-gateway/linux.js
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
"use strict";
|
||||
|
||||
const {isIP} = require("net");
|
||||
const {networkInterfaces} = 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 && 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 = networkInterfaces();
|
||||
const addresses = interfaces[iface];
|
||||
if (!addresses || !addresses.length) return;
|
||||
|
||||
addresses.some(addr => {
|
||||
if (addr.family.substring(2) === family && 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 = async family => {
|
||||
const {stdout} = await execa("ip", args[family]);
|
||||
return parse(stdout, family);
|
||||
};
|
||||
|
||||
const sync = family => {
|
||||
const {stdout} = execa.sync("ip", args[family]);
|
||||
return parse(stdout, family);
|
||||
};
|
||||
|
||||
module.exports.v4 = () => promise("v4");
|
||||
module.exports.v6 = () => promise("v6");
|
||||
|
||||
module.exports.v4.sync = () => sync("v4");
|
||||
module.exports.v6.sync = () => sync("v6");
|
15
node_modules/default-gateway/node_modules/.bin/node-which
generated
vendored
Normal file
15
node_modules/default-gateway/node_modules/.bin/node-which
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../which/bin/node-which" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../which/bin/node-which" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
17
node_modules/default-gateway/node_modules/.bin/node-which.cmd
generated
vendored
Normal file
17
node_modules/default-gateway/node_modules/.bin/node-which.cmd
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
"%_prog%" "%dp0%\..\which\bin\node-which" %*
|
||||
ENDLOCAL
|
||||
EXIT /b %errorlevel%
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
18
node_modules/default-gateway/node_modules/.bin/node-which.ps1
generated
vendored
Normal file
18
node_modules/default-gateway/node_modules/.bin/node-which.ps1
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
& "$basedir/node$exe" "$basedir/../which/bin/node-which" $args
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
& "node$exe" "$basedir/../which/bin/node-which" $args
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
130
node_modules/default-gateway/node_modules/cross-spawn/CHANGELOG.md
generated
vendored
Normal file
130
node_modules/default-gateway/node_modules/cross-spawn/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,130 @@
|
||||
# Changelog
|
||||
|
||||
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.
|
||||
|
||||
### [7.0.3](https://github.com/moxystudio/node-cross-spawn/compare/v7.0.2...v7.0.3) (2020-05-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* detect path key based on correct environment ([#133](https://github.com/moxystudio/node-cross-spawn/issues/133)) ([159e7e9](https://github.com/moxystudio/node-cross-spawn/commit/159e7e9785e57451cba034ae51719f97135074ae))
|
||||
|
||||
### [7.0.2](https://github.com/moxystudio/node-cross-spawn/compare/v7.0.1...v7.0.2) (2020-04-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix worker threads in Node >=11.10.0 ([#132](https://github.com/moxystudio/node-cross-spawn/issues/132)) ([6c5b4f0](https://github.com/moxystudio/node-cross-spawn/commit/6c5b4f015814a6c4f6b33230dfd1a860aedc0aaf))
|
||||
|
||||
### [7.0.1](https://github.com/moxystudio/node-cross-spawn/compare/v7.0.0...v7.0.1) (2019-10-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **core:** support worker threads ([#127](https://github.com/moxystudio/node-cross-spawn/issues/127)) ([cfd49c9](https://github.com/moxystudio/node-cross-spawn/commit/cfd49c9))
|
||||
|
||||
## [7.0.0](https://github.com/moxystudio/node-cross-spawn/compare/v6.0.5...v7.0.0) (2019-09-03)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* drop support for Node.js < 8
|
||||
|
||||
* drop support for versions below Node.js 8 ([#125](https://github.com/moxystudio/node-cross-spawn/issues/125)) ([16feb53](https://github.com/moxystudio/node-cross-spawn/commit/16feb53))
|
||||
|
||||
<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
node_modules/default-gateway/node_modules/cross-spawn/LICENSE
generated
vendored
Normal file
21
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.
|
96
node_modules/default-gateway/node_modules/cross-spawn/README.md
generated
vendored
Normal file
96
node_modules/default-gateway/node_modules/cross-spawn/README.md
generated
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
# 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]
|
||||
|
||||
[npm-url]:https://npmjs.org/package/cross-spawn
|
||||
[downloads-image]:https://img.shields.io/npm/dm/cross-spawn.svg
|
||||
[npm-image]:https://img.shields.io/npm/v/cross-spawn.svg
|
||||
[travis-url]:https://travis-ci.org/moxystudio/node-cross-spawn
|
||||
[travis-image]:https://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
|
||||
|
||||
A cross platform solution to node's spawn and spawnSync.
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
Node.js version 8 and up:
|
||||
`$ npm install cross-spawn`
|
||||
|
||||
Node.js version 7 and under:
|
||||
`$ npm install cross-spawn@6`
|
||||
|
||||
## 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](https://www.opensource.org/licenses/mit-license.php).
|
39
node_modules/default-gateway/node_modules/cross-spawn/index.js
generated
vendored
Normal file
39
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
node_modules/default-gateway/node_modules/cross-spawn/lib/enoent.js
generated
vendored
Normal file
59
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,
|
||||
};
|
91
node_modules/default-gateway/node_modules/cross-spawn/lib/parse.js
generated
vendored
Normal file
91
node_modules/default-gateway/node_modules/cross-spawn/lib/parse.js
generated
vendored
Normal file
@ -0,0 +1,91 @@
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const resolveCommand = require('./util/resolveCommand');
|
||||
const escape = require('./util/escape');
|
||||
const readShebang = require('./util/readShebang');
|
||||
|
||||
const isWin = process.platform === 'win32';
|
||||
const isExecutableRegExp = /\.(?:com|exe)$/i;
|
||||
const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
||||
|
||||
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 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 ? parsed : parseNonShell(parsed);
|
||||
}
|
||||
|
||||
module.exports = parse;
|
45
node_modules/default-gateway/node_modules/cross-spawn/lib/util/escape.js
generated
vendored
Normal file
45
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;
|
23
node_modules/default-gateway/node_modules/cross-spawn/lib/util/readShebang.js
generated
vendored
Normal file
23
node_modules/default-gateway/node_modules/cross-spawn/lib/util/readShebang.js
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
'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;
|
||||
const buffer = Buffer.alloc(size);
|
||||
|
||||
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;
|
52
node_modules/default-gateway/node_modules/cross-spawn/lib/util/resolveCommand.js
generated
vendored
Normal file
52
node_modules/default-gateway/node_modules/cross-spawn/lib/util/resolveCommand.js
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const which = require('which');
|
||||
const getPathKey = require('path-key');
|
||||
|
||||
function resolveCommandAttempt(parsed, withoutPathExt) {
|
||||
const env = parsed.options.env || process.env;
|
||||
const cwd = process.cwd();
|
||||
const hasCustomCwd = parsed.options.cwd != null;
|
||||
// Worker threads do not have process.chdir()
|
||||
const shouldSwitchCwd = hasCustomCwd && process.chdir !== undefined && !process.chdir.disabled;
|
||||
|
||||
// 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 (shouldSwitchCwd) {
|
||||
try {
|
||||
process.chdir(parsed.options.cwd);
|
||||
} catch (err) {
|
||||
/* Empty */
|
||||
}
|
||||
}
|
||||
|
||||
let resolved;
|
||||
|
||||
try {
|
||||
resolved = which.sync(parsed.command, {
|
||||
path: env[getPathKey({ env })],
|
||||
pathExt: withoutPathExt ? path.delimiter : undefined,
|
||||
});
|
||||
} catch (e) {
|
||||
/* Empty */
|
||||
} finally {
|
||||
if (shouldSwitchCwd) {
|
||||
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;
|
104
node_modules/default-gateway/node_modules/cross-spawn/package.json
generated
vendored
Normal file
104
node_modules/default-gateway/node_modules/cross-spawn/package.json
generated
vendored
Normal file
@ -0,0 +1,104 @@
|
||||
{
|
||||
"_from": "cross-spawn@^7.0.3",
|
||||
"_id": "cross-spawn@7.0.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
|
||||
"_location": "/default-gateway/cross-spawn",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "cross-spawn@^7.0.3",
|
||||
"name": "cross-spawn",
|
||||
"escapedName": "cross-spawn",
|
||||
"rawSpec": "^7.0.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^7.0.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/default-gateway/execa"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
||||
"_shasum": "f73a85b9d5d41d045551c177e2882d4ac85728a6",
|
||||
"_spec": "cross-spawn@^7.0.3",
|
||||
"_where": "C:\\Users\\zhouxueli\\Desktop\\scheduling-app\\node_modules\\default-gateway\\node_modules\\execa",
|
||||
"author": {
|
||||
"name": "André Cruz",
|
||||
"email": "andre@moxy.studio"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/moxystudio/node-cross-spawn/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"commitlint": {
|
||||
"extends": [
|
||||
"@commitlint/config-conventional"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"path-key": "^3.1.0",
|
||||
"shebang-command": "^2.0.0",
|
||||
"which": "^2.0.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Cross platform child_process#spawn and child_process#spawnSync",
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^8.1.0",
|
||||
"@commitlint/config-conventional": "^8.1.0",
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-jest": "^24.9.0",
|
||||
"babel-preset-moxy": "^3.1.0",
|
||||
"eslint": "^5.16.0",
|
||||
"eslint-config-moxy": "^7.1.0",
|
||||
"husky": "^3.0.5",
|
||||
"jest": "^24.9.0",
|
||||
"lint-staged": "^9.2.5",
|
||||
"mkdirp": "^0.5.1",
|
||||
"rimraf": "^3.0.0",
|
||||
"standard-version": "^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"homepage": "https://github.com/moxystudio/node-cross-spawn",
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
|
||||
"pre-commit": "lint-staged"
|
||||
}
|
||||
},
|
||||
"keywords": [
|
||||
"spawn",
|
||||
"spawnSync",
|
||||
"windows",
|
||||
"cross-platform",
|
||||
"path-ext",
|
||||
"shebang",
|
||||
"cmd",
|
||||
"execute"
|
||||
],
|
||||
"license": "MIT",
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
"eslint --fix",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"main": "index.js",
|
||||
"name": "cross-spawn",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/moxystudio/node-cross-spawn.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"postrelease": "git push --follow-tags origin HEAD && npm publish",
|
||||
"prerelease": "npm t && npm run lint",
|
||||
"release": "standard-version",
|
||||
"test": "jest --env node --coverage"
|
||||
},
|
||||
"version": "7.0.3"
|
||||
}
|
564
node_modules/default-gateway/node_modules/execa/index.d.ts
generated
vendored
Normal file
564
node_modules/default-gateway/node_modules/execa/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,564 @@
|
||||
/// <reference types="node"/>
|
||||
import {ChildProcess} from 'child_process';
|
||||
import {Stream, Readable as ReadableStream} from 'stream';
|
||||
|
||||
declare namespace execa {
|
||||
type StdioOption =
|
||||
| 'pipe'
|
||||
| 'ipc'
|
||||
| 'ignore'
|
||||
| 'inherit'
|
||||
| Stream
|
||||
| number
|
||||
| undefined;
|
||||
|
||||
interface CommonOptions<EncodingType> {
|
||||
/**
|
||||
Kill the spawned process when the parent process exits unless either:
|
||||
- the spawned process is [`detached`](https://nodejs.org/api/child_process.html#child_process_options_detached)
|
||||
- the parent process is terminated abruptly, for example, with `SIGKILL` as opposed to `SIGTERM` or a normal exit
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly cleanup?: boolean;
|
||||
|
||||
/**
|
||||
Prefer locally installed binaries when looking for a binary to execute.
|
||||
|
||||
If you `$ npm install foo`, you can then `execa('foo')`.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly preferLocal?: boolean;
|
||||
|
||||
/**
|
||||
Preferred path to find locally installed binaries in (use with `preferLocal`).
|
||||
|
||||
@default process.cwd()
|
||||
*/
|
||||
readonly localDir?: string;
|
||||
|
||||
/**
|
||||
Path to the Node.js executable to use in child processes.
|
||||
|
||||
This can be either an absolute path or a path relative to the `cwd` option.
|
||||
|
||||
Requires `preferLocal` to be `true`.
|
||||
|
||||
For example, this can be used together with [`get-node`](https://github.com/ehmicky/get-node) to run a specific Node.js version in a child process.
|
||||
|
||||
@default process.execPath
|
||||
*/
|
||||
readonly execPath?: string;
|
||||
|
||||
/**
|
||||
Buffer the output from the spawned process. When set to `false`, you must read the output of `stdout` and `stderr` (or `all` if the `all` option is `true`). Otherwise the returned promise will not be resolved/rejected.
|
||||
|
||||
If the spawned process fails, `error.stdout`, `error.stderr`, and `error.all` will contain the buffered data.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly buffer?: boolean;
|
||||
|
||||
/**
|
||||
Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
|
||||
|
||||
@default 'pipe'
|
||||
*/
|
||||
readonly stdin?: StdioOption;
|
||||
|
||||
/**
|
||||
Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
|
||||
|
||||
@default 'pipe'
|
||||
*/
|
||||
readonly stdout?: StdioOption;
|
||||
|
||||
/**
|
||||
Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
|
||||
|
||||
@default 'pipe'
|
||||
*/
|
||||
readonly stderr?: StdioOption;
|
||||
|
||||
/**
|
||||
Setting this to `false` resolves the promise with the error instead of rejecting it.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly reject?: boolean;
|
||||
|
||||
/**
|
||||
Add an `.all` property on the promise and the resolved value. The property contains the output of the process with `stdout` and `stderr` interleaved.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly all?: boolean;
|
||||
|
||||
/**
|
||||
Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from the output.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly stripFinalNewline?: boolean;
|
||||
|
||||
/**
|
||||
Set to `false` if you don't want to extend the environment variables when providing the `env` property.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly extendEnv?: boolean;
|
||||
|
||||
/**
|
||||
Current working directory of the child process.
|
||||
|
||||
@default process.cwd()
|
||||
*/
|
||||
readonly cwd?: string;
|
||||
|
||||
/**
|
||||
Environment key-value pairs. Extends automatically from `process.env`. Set `extendEnv` to `false` if you don't want this.
|
||||
|
||||
@default process.env
|
||||
*/
|
||||
readonly env?: NodeJS.ProcessEnv;
|
||||
|
||||
/**
|
||||
Explicitly set the value of `argv[0]` sent to the child process. This will be set to `command` or `file` if not specified.
|
||||
*/
|
||||
readonly argv0?: string;
|
||||
|
||||
/**
|
||||
Child's [stdio](https://nodejs.org/api/child_process.html#child_process_options_stdio) configuration.
|
||||
|
||||
@default 'pipe'
|
||||
*/
|
||||
readonly stdio?: 'pipe' | 'ignore' | 'inherit' | readonly StdioOption[];
|
||||
|
||||
/**
|
||||
Specify the kind of serialization used for sending messages between processes when using the `stdio: 'ipc'` option or `execa.node()`:
|
||||
- `json`: Uses `JSON.stringify()` and `JSON.parse()`.
|
||||
- `advanced`: Uses [`v8.serialize()`](https://nodejs.org/api/v8.html#v8_v8_serialize_value)
|
||||
|
||||
Requires Node.js `13.2.0` or later.
|
||||
|
||||
[More info.](https://nodejs.org/api/child_process.html#child_process_advanced_serialization)
|
||||
|
||||
@default 'json'
|
||||
*/
|
||||
readonly serialization?: 'json' | 'advanced';
|
||||
|
||||
/**
|
||||
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).
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly detached?: boolean;
|
||||
|
||||
/**
|
||||
Sets the user identity of the process.
|
||||
*/
|
||||
readonly uid?: number;
|
||||
|
||||
/**
|
||||
Sets the group identity of the process.
|
||||
*/
|
||||
readonly gid?: number;
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
We recommend against using this option since it is:
|
||||
- not cross-platform, encouraging shell-specific syntax.
|
||||
- slower, because of the additional shell interpretation.
|
||||
- unsafe, potentially allowing command injection.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly shell?: boolean | string;
|
||||
|
||||
/**
|
||||
Specify the character encoding used to decode the `stdout` and `stderr` output. If set to `null`, then `stdout` and `stderr` will be a `Buffer` instead of a string.
|
||||
|
||||
@default 'utf8'
|
||||
*/
|
||||
readonly encoding?: EncodingType;
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
@default 0
|
||||
*/
|
||||
readonly timeout?: number;
|
||||
|
||||
/**
|
||||
Largest amount of data in bytes allowed on `stdout` or `stderr`. Default: 100 MB.
|
||||
|
||||
@default 100_000_000
|
||||
*/
|
||||
readonly maxBuffer?: number;
|
||||
|
||||
/**
|
||||
Signal value to be used when the spawned process will be killed.
|
||||
|
||||
@default 'SIGTERM'
|
||||
*/
|
||||
readonly killSignal?: string | number;
|
||||
|
||||
/**
|
||||
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`.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly windowsVerbatimArguments?: boolean;
|
||||
|
||||
/**
|
||||
On Windows, do not create a new console window. Please note this also prevents `CTRL-C` [from working](https://github.com/nodejs/node/issues/29837) on Windows.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly windowsHide?: boolean;
|
||||
}
|
||||
|
||||
interface Options<EncodingType = string> extends CommonOptions<EncodingType> {
|
||||
/**
|
||||
Write some input to the `stdin` of your binary.
|
||||
*/
|
||||
readonly input?: string | Buffer | ReadableStream;
|
||||
}
|
||||
|
||||
interface SyncOptions<EncodingType = string> extends CommonOptions<EncodingType> {
|
||||
/**
|
||||
Write some input to the `stdin` of your binary.
|
||||
*/
|
||||
readonly input?: string | Buffer;
|
||||
}
|
||||
|
||||
interface NodeOptions<EncodingType = string> extends Options<EncodingType> {
|
||||
/**
|
||||
The Node.js executable to use.
|
||||
|
||||
@default process.execPath
|
||||
*/
|
||||
readonly nodePath?: string;
|
||||
|
||||
/**
|
||||
List of [CLI options](https://nodejs.org/api/cli.html#cli_options) passed to the Node.js executable.
|
||||
|
||||
@default process.execArgv
|
||||
*/
|
||||
readonly nodeOptions?: string[];
|
||||
}
|
||||
|
||||
interface ExecaReturnBase<StdoutStderrType> {
|
||||
/**
|
||||
The file and arguments that were run, for logging purposes.
|
||||
|
||||
This is not escaped and should not be executed directly as a process, including using `execa()` or `execa.command()`.
|
||||
*/
|
||||
command: string;
|
||||
|
||||
/**
|
||||
Same as `command` but escaped.
|
||||
|
||||
This is meant to be copy and pasted into a shell, for debugging purposes.
|
||||
Since the escaping is fairly basic, this should not be executed directly as a process, including using `execa()` or `execa.command()`.
|
||||
*/
|
||||
escapedCommand: string;
|
||||
|
||||
/**
|
||||
The numeric exit code of the process that was run.
|
||||
*/
|
||||
exitCode: number;
|
||||
|
||||
/**
|
||||
The output of the process on stdout.
|
||||
*/
|
||||
stdout: StdoutStderrType;
|
||||
|
||||
/**
|
||||
The output of the process on stderr.
|
||||
*/
|
||||
stderr: StdoutStderrType;
|
||||
|
||||
/**
|
||||
Whether the process failed to run.
|
||||
*/
|
||||
failed: boolean;
|
||||
|
||||
/**
|
||||
Whether the process timed out.
|
||||
*/
|
||||
timedOut: boolean;
|
||||
|
||||
/**
|
||||
Whether the process was killed.
|
||||
*/
|
||||
killed: boolean;
|
||||
|
||||
/**
|
||||
The name of the signal that was used to terminate the process. For example, `SIGFPE`.
|
||||
|
||||
If a signal terminated the process, this property is defined and included in the error message. Otherwise it is `undefined`.
|
||||
*/
|
||||
signal?: string;
|
||||
|
||||
/**
|
||||
A human-friendly description of the signal that was used to terminate the process. For example, `Floating point arithmetic error`.
|
||||
|
||||
If a signal terminated the process, this property is defined and included in the error message. Otherwise it is `undefined`. It is also `undefined` when the signal is very uncommon which should seldomly happen.
|
||||
*/
|
||||
signalDescription?: string;
|
||||
}
|
||||
|
||||
interface ExecaSyncReturnValue<StdoutErrorType = string>
|
||||
extends ExecaReturnBase<StdoutErrorType> {
|
||||
}
|
||||
|
||||
/**
|
||||
Result of a child process execution. On success this is a plain object. On failure this is also an `Error` instance.
|
||||
|
||||
The child process fails when:
|
||||
- its exit code is not `0`
|
||||
- it was killed with a signal
|
||||
- timing out
|
||||
- being canceled
|
||||
- there's not enough memory or there are already too many child processes
|
||||
*/
|
||||
interface ExecaReturnValue<StdoutErrorType = string>
|
||||
extends ExecaSyncReturnValue<StdoutErrorType> {
|
||||
/**
|
||||
The output of the process with `stdout` and `stderr` interleaved.
|
||||
|
||||
This is `undefined` if either:
|
||||
- the `all` option is `false` (default value)
|
||||
- `execa.sync()` was used
|
||||
*/
|
||||
all?: StdoutErrorType;
|
||||
|
||||
/**
|
||||
Whether the process was canceled.
|
||||
*/
|
||||
isCanceled: boolean;
|
||||
}
|
||||
|
||||
interface ExecaSyncError<StdoutErrorType = string>
|
||||
extends Error,
|
||||
ExecaReturnBase<StdoutErrorType> {
|
||||
/**
|
||||
Error message when the child process failed to run. In addition to the underlying error message, it also contains some information related to why the child process errored.
|
||||
|
||||
The child process stderr then stdout are appended to the end, separated with newlines and not interleaved.
|
||||
*/
|
||||
message: string;
|
||||
|
||||
/**
|
||||
This is the same as the `message` property except it does not include the child process stdout/stderr.
|
||||
*/
|
||||
shortMessage: string;
|
||||
|
||||
/**
|
||||
Original error message. This is the same as the `message` property except it includes neither the child process stdout/stderr nor some additional information added by Execa.
|
||||
|
||||
This is `undefined` unless the child process exited due to an `error` event or a timeout.
|
||||
*/
|
||||
originalMessage?: string;
|
||||
}
|
||||
|
||||
interface ExecaError<StdoutErrorType = string>
|
||||
extends ExecaSyncError<StdoutErrorType> {
|
||||
/**
|
||||
The output of the process with `stdout` and `stderr` interleaved.
|
||||
|
||||
This is `undefined` if either:
|
||||
- the `all` option is `false` (default value)
|
||||
- `execa.sync()` was used
|
||||
*/
|
||||
all?: StdoutErrorType;
|
||||
|
||||
/**
|
||||
Whether the process was canceled.
|
||||
*/
|
||||
isCanceled: boolean;
|
||||
}
|
||||
|
||||
interface KillOptions {
|
||||
/**
|
||||
Milliseconds to wait for the child process to terminate before sending `SIGKILL`.
|
||||
|
||||
Can be disabled with `false`.
|
||||
|
||||
@default 5000
|
||||
*/
|
||||
forceKillAfterTimeout?: number | false;
|
||||
}
|
||||
|
||||
interface ExecaChildPromise<StdoutErrorType> {
|
||||
/**
|
||||
Stream combining/interleaving [`stdout`](https://nodejs.org/api/child_process.html#child_process_subprocess_stdout) and [`stderr`](https://nodejs.org/api/child_process.html#child_process_subprocess_stderr).
|
||||
|
||||
This is `undefined` if either:
|
||||
- the `all` option is `false` (the default value)
|
||||
- both `stdout` and `stderr` options are set to [`'inherit'`, `'ipc'`, `Stream` or `integer`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio)
|
||||
*/
|
||||
all?: ReadableStream;
|
||||
|
||||
catch<ResultType = never>(
|
||||
onRejected?: (reason: ExecaError<StdoutErrorType>) => ResultType | PromiseLike<ResultType>
|
||||
): Promise<ExecaReturnValue<StdoutErrorType> | ResultType>;
|
||||
|
||||
/**
|
||||
Same as the original [`child_process#kill()`](https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal), except if `signal` is `SIGTERM` (the default value) and the child process is not terminated after 5 seconds, force it by sending `SIGKILL`.
|
||||
*/
|
||||
kill(signal?: string, options?: KillOptions): void;
|
||||
|
||||
/**
|
||||
Similar to [`childProcess.kill()`](https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal). This is preferred when cancelling the child process execution as the error is more descriptive and [`childProcessResult.isCanceled`](#iscanceled) is set to `true`.
|
||||
*/
|
||||
cancel(): void;
|
||||
}
|
||||
|
||||
type ExecaChildProcess<StdoutErrorType = string> = ChildProcess &
|
||||
ExecaChildPromise<StdoutErrorType> &
|
||||
Promise<ExecaReturnValue<StdoutErrorType>>;
|
||||
}
|
||||
|
||||
declare const execa: {
|
||||
/**
|
||||
Execute a file.
|
||||
|
||||
Think of this as a mix of `child_process.execFile` and `child_process.spawn`.
|
||||
|
||||
@param file - The program/script to execute.
|
||||
@param arguments - Arguments to pass to `file` on execution.
|
||||
@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.
|
||||
|
||||
@example
|
||||
```
|
||||
import execa = require('execa');
|
||||
|
||||
(async () => {
|
||||
const {stdout} = await execa('echo', ['unicorns']);
|
||||
console.log(stdout);
|
||||
//=> 'unicorns'
|
||||
|
||||
// Cancelling a spawned process
|
||||
|
||||
const subprocess = execa('node');
|
||||
|
||||
setTimeout(() => {
|
||||
subprocess.cancel()
|
||||
}, 1000);
|
||||
|
||||
try {
|
||||
await subprocess;
|
||||
} catch (error) {
|
||||
console.log(subprocess.killed); // true
|
||||
console.log(error.isCanceled); // true
|
||||
}
|
||||
})();
|
||||
|
||||
// Pipe the child process stdout to the current stdout
|
||||
execa('echo', ['unicorns']).stdout.pipe(process.stdout);
|
||||
```
|
||||
*/
|
||||
(
|
||||
file: string,
|
||||
arguments?: readonly string[],
|
||||
options?: execa.Options
|
||||
): execa.ExecaChildProcess;
|
||||
(
|
||||
file: string,
|
||||
arguments?: readonly string[],
|
||||
options?: execa.Options<null>
|
||||
): execa.ExecaChildProcess<Buffer>;
|
||||
(file: string, options?: execa.Options): execa.ExecaChildProcess;
|
||||
(file: string, options?: execa.Options<null>): execa.ExecaChildProcess<
|
||||
Buffer
|
||||
>;
|
||||
|
||||
/**
|
||||
Execute a file synchronously.
|
||||
|
||||
This method throws an `Error` if the command fails.
|
||||
|
||||
@param file - The program/script to execute.
|
||||
@param arguments - Arguments to pass to `file` on execution.
|
||||
@returns A result `Object` with `stdout` and `stderr` properties.
|
||||
*/
|
||||
sync(
|
||||
file: string,
|
||||
arguments?: readonly string[],
|
||||
options?: execa.SyncOptions
|
||||
): execa.ExecaSyncReturnValue;
|
||||
sync(
|
||||
file: string,
|
||||
arguments?: readonly string[],
|
||||
options?: execa.SyncOptions<null>
|
||||
): execa.ExecaSyncReturnValue<Buffer>;
|
||||
sync(file: string, options?: execa.SyncOptions): execa.ExecaSyncReturnValue;
|
||||
sync(
|
||||
file: string,
|
||||
options?: execa.SyncOptions<null>
|
||||
): execa.ExecaSyncReturnValue<Buffer>;
|
||||
|
||||
/**
|
||||
Same as `execa()` except both file and arguments are specified in a single `command` string. For example, `execa('echo', ['unicorns'])` is the same as `execa.command('echo unicorns')`.
|
||||
|
||||
If the file or an argument contains spaces, they must be escaped with backslashes. This matters especially if `command` is not a constant but a variable, for example with `__dirname` or `process.cwd()`. Except for spaces, no escaping/quoting is needed.
|
||||
|
||||
The `shell` option must be used if the `command` uses shell-specific features (for example, `&&` or `||`), as opposed to being a simple `file` followed by its `arguments`.
|
||||
|
||||
@param command - The program/script to execute and its arguments.
|
||||
@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.
|
||||
|
||||
@example
|
||||
```
|
||||
import execa = require('execa');
|
||||
|
||||
(async () => {
|
||||
const {stdout} = await execa.command('echo unicorns');
|
||||
console.log(stdout);
|
||||
//=> 'unicorns'
|
||||
})();
|
||||
```
|
||||
*/
|
||||
command(command: string, options?: execa.Options): execa.ExecaChildProcess;
|
||||
command(command: string, options?: execa.Options<null>): execa.ExecaChildProcess<Buffer>;
|
||||
|
||||
/**
|
||||
Same as `execa.command()` but synchronous.
|
||||
|
||||
@param command - The program/script to execute and its arguments.
|
||||
@returns A result `Object` with `stdout` and `stderr` properties.
|
||||
*/
|
||||
commandSync(command: string, options?: execa.SyncOptions): execa.ExecaSyncReturnValue;
|
||||
commandSync(command: string, options?: execa.SyncOptions<null>): execa.ExecaSyncReturnValue<Buffer>;
|
||||
|
||||
/**
|
||||
Execute a Node.js script as a child process.
|
||||
|
||||
Same as `execa('node', [scriptPath, ...arguments], options)` except (like [`child_process#fork()`](https://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options)):
|
||||
- the current Node version and options are used. This can be overridden using the `nodePath` and `nodeArguments` options.
|
||||
- the `shell` option cannot be used
|
||||
- an extra channel [`ipc`](https://nodejs.org/api/child_process.html#child_process_options_stdio) is passed to [`stdio`](#stdio)
|
||||
|
||||
@param scriptPath - Node.js script to execute.
|
||||
@param arguments - Arguments to pass to `scriptPath` on execution.
|
||||
@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.
|
||||
*/
|
||||
node(
|
||||
scriptPath: string,
|
||||
arguments?: readonly string[],
|
||||
options?: execa.NodeOptions
|
||||
): execa.ExecaChildProcess;
|
||||
node(
|
||||
scriptPath: string,
|
||||
arguments?: readonly string[],
|
||||
options?: execa.Options<null>
|
||||
): execa.ExecaChildProcess<Buffer>;
|
||||
node(scriptPath: string, options?: execa.Options): execa.ExecaChildProcess;
|
||||
node(scriptPath: string, options?: execa.Options<null>): execa.ExecaChildProcess<Buffer>;
|
||||
};
|
||||
|
||||
export = execa;
|
268
node_modules/default-gateway/node_modules/execa/index.js
generated
vendored
Normal file
268
node_modules/default-gateway/node_modules/execa/index.js
generated
vendored
Normal file
@ -0,0 +1,268 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const childProcess = require('child_process');
|
||||
const crossSpawn = require('cross-spawn');
|
||||
const stripFinalNewline = require('strip-final-newline');
|
||||
const npmRunPath = require('npm-run-path');
|
||||
const onetime = require('onetime');
|
||||
const makeError = require('./lib/error');
|
||||
const normalizeStdio = require('./lib/stdio');
|
||||
const {spawnedKill, spawnedCancel, setupTimeout, validateTimeout, setExitHandler} = require('./lib/kill');
|
||||
const {handleInput, getSpawnedResult, makeAllStream, validateInputSync} = require('./lib/stream');
|
||||
const {mergePromise, getSpawnedPromise} = require('./lib/promise');
|
||||
const {joinCommand, parseCommand, getEscapedCommand} = require('./lib/command');
|
||||
|
||||
const DEFAULT_MAX_BUFFER = 1000 * 1000 * 100;
|
||||
|
||||
const getEnv = ({env: envOption, extendEnv, preferLocal, localDir, execPath}) => {
|
||||
const env = extendEnv ? {...process.env, ...envOption} : envOption;
|
||||
|
||||
if (preferLocal) {
|
||||
return npmRunPath.env({env, cwd: localDir, execPath});
|
||||
}
|
||||
|
||||
return env;
|
||||
};
|
||||
|
||||
const handleArguments = (file, args, options = {}) => {
|
||||
const parsed = crossSpawn._parse(file, args, options);
|
||||
file = parsed.command;
|
||||
args = parsed.args;
|
||||
options = parsed.options;
|
||||
|
||||
options = {
|
||||
maxBuffer: DEFAULT_MAX_BUFFER,
|
||||
buffer: true,
|
||||
stripFinalNewline: true,
|
||||
extendEnv: true,
|
||||
preferLocal: false,
|
||||
localDir: options.cwd || process.cwd(),
|
||||
execPath: process.execPath,
|
||||
encoding: 'utf8',
|
||||
reject: true,
|
||||
cleanup: true,
|
||||
all: false,
|
||||
windowsHide: true,
|
||||
...options
|
||||
};
|
||||
|
||||
options.env = getEnv(options);
|
||||
|
||||
options.stdio = normalizeStdio(options);
|
||||
|
||||
if (process.platform === 'win32' && path.basename(file, '.exe') === 'cmd') {
|
||||
// #116
|
||||
args.unshift('/q');
|
||||
}
|
||||
|
||||
return {file, args, options, parsed};
|
||||
};
|
||||
|
||||
const handleOutput = (options, value, error) => {
|
||||
if (typeof value !== 'string' && !Buffer.isBuffer(value)) {
|
||||
// When `execa.sync()` errors, we normalize it to '' to mimic `execa()`
|
||||
return error === undefined ? undefined : '';
|
||||
}
|
||||
|
||||
if (options.stripFinalNewline) {
|
||||
return stripFinalNewline(value);
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
|
||||
const execa = (file, args, options) => {
|
||||
const parsed = handleArguments(file, args, options);
|
||||
const command = joinCommand(file, args);
|
||||
const escapedCommand = getEscapedCommand(file, args);
|
||||
|
||||
validateTimeout(parsed.options);
|
||||
|
||||
let spawned;
|
||||
try {
|
||||
spawned = childProcess.spawn(parsed.file, parsed.args, parsed.options);
|
||||
} catch (error) {
|
||||
// Ensure the returned error is always both a promise and a child process
|
||||
const dummySpawned = new childProcess.ChildProcess();
|
||||
const errorPromise = Promise.reject(makeError({
|
||||
error,
|
||||
stdout: '',
|
||||
stderr: '',
|
||||
all: '',
|
||||
command,
|
||||
escapedCommand,
|
||||
parsed,
|
||||
timedOut: false,
|
||||
isCanceled: false,
|
||||
killed: false
|
||||
}));
|
||||
return mergePromise(dummySpawned, errorPromise);
|
||||
}
|
||||
|
||||
const spawnedPromise = getSpawnedPromise(spawned);
|
||||
const timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);
|
||||
const processDone = setExitHandler(spawned, parsed.options, timedPromise);
|
||||
|
||||
const context = {isCanceled: false};
|
||||
|
||||
spawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));
|
||||
spawned.cancel = spawnedCancel.bind(null, spawned, context);
|
||||
|
||||
const handlePromise = async () => {
|
||||
const [{error, exitCode, signal, timedOut}, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);
|
||||
const stdout = handleOutput(parsed.options, stdoutResult);
|
||||
const stderr = handleOutput(parsed.options, stderrResult);
|
||||
const all = handleOutput(parsed.options, allResult);
|
||||
|
||||
if (error || exitCode !== 0 || signal !== null) {
|
||||
const returnedError = makeError({
|
||||
error,
|
||||
exitCode,
|
||||
signal,
|
||||
stdout,
|
||||
stderr,
|
||||
all,
|
||||
command,
|
||||
escapedCommand,
|
||||
parsed,
|
||||
timedOut,
|
||||
isCanceled: context.isCanceled,
|
||||
killed: spawned.killed
|
||||
});
|
||||
|
||||
if (!parsed.options.reject) {
|
||||
return returnedError;
|
||||
}
|
||||
|
||||
throw returnedError;
|
||||
}
|
||||
|
||||
return {
|
||||
command,
|
||||
escapedCommand,
|
||||
exitCode: 0,
|
||||
stdout,
|
||||
stderr,
|
||||
all,
|
||||
failed: false,
|
||||
timedOut: false,
|
||||
isCanceled: false,
|
||||
killed: false
|
||||
};
|
||||
};
|
||||
|
||||
const handlePromiseOnce = onetime(handlePromise);
|
||||
|
||||
handleInput(spawned, parsed.options.input);
|
||||
|
||||
spawned.all = makeAllStream(spawned, parsed.options);
|
||||
|
||||
return mergePromise(spawned, handlePromiseOnce);
|
||||
};
|
||||
|
||||
module.exports = execa;
|
||||
|
||||
module.exports.sync = (file, args, options) => {
|
||||
const parsed = handleArguments(file, args, options);
|
||||
const command = joinCommand(file, args);
|
||||
const escapedCommand = getEscapedCommand(file, args);
|
||||
|
||||
validateInputSync(parsed.options);
|
||||
|
||||
let result;
|
||||
try {
|
||||
result = childProcess.spawnSync(parsed.file, parsed.args, parsed.options);
|
||||
} catch (error) {
|
||||
throw makeError({
|
||||
error,
|
||||
stdout: '',
|
||||
stderr: '',
|
||||
all: '',
|
||||
command,
|
||||
escapedCommand,
|
||||
parsed,
|
||||
timedOut: false,
|
||||
isCanceled: false,
|
||||
killed: false
|
||||
});
|
||||
}
|
||||
|
||||
const stdout = handleOutput(parsed.options, result.stdout, result.error);
|
||||
const stderr = handleOutput(parsed.options, result.stderr, result.error);
|
||||
|
||||
if (result.error || result.status !== 0 || result.signal !== null) {
|
||||
const error = makeError({
|
||||
stdout,
|
||||
stderr,
|
||||
error: result.error,
|
||||
signal: result.signal,
|
||||
exitCode: result.status,
|
||||
command,
|
||||
escapedCommand,
|
||||
parsed,
|
||||
timedOut: result.error && result.error.code === 'ETIMEDOUT',
|
||||
isCanceled: false,
|
||||
killed: result.signal !== null
|
||||
});
|
||||
|
||||
if (!parsed.options.reject) {
|
||||
return error;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
|
||||
return {
|
||||
command,
|
||||
escapedCommand,
|
||||
exitCode: 0,
|
||||
stdout,
|
||||
stderr,
|
||||
failed: false,
|
||||
timedOut: false,
|
||||
isCanceled: false,
|
||||
killed: false
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.command = (command, options) => {
|
||||
const [file, ...args] = parseCommand(command);
|
||||
return execa(file, args, options);
|
||||
};
|
||||
|
||||
module.exports.commandSync = (command, options) => {
|
||||
const [file, ...args] = parseCommand(command);
|
||||
return execa.sync(file, args, options);
|
||||
};
|
||||
|
||||
module.exports.node = (scriptPath, args, options = {}) => {
|
||||
if (args && !Array.isArray(args) && typeof args === 'object') {
|
||||
options = args;
|
||||
args = [];
|
||||
}
|
||||
|
||||
const stdio = normalizeStdio.node(options);
|
||||
const defaultExecArgv = process.execArgv.filter(arg => !arg.startsWith('--inspect'));
|
||||
|
||||
const {
|
||||
nodePath = process.execPath,
|
||||
nodeOptions = defaultExecArgv
|
||||
} = options;
|
||||
|
||||
return execa(
|
||||
nodePath,
|
||||
[
|
||||
...nodeOptions,
|
||||
scriptPath,
|
||||
...(Array.isArray(args) ? args : [])
|
||||
],
|
||||
{
|
||||
...options,
|
||||
stdin: undefined,
|
||||
stdout: undefined,
|
||||
stderr: undefined,
|
||||
stdio,
|
||||
shell: false
|
||||
}
|
||||
);
|
||||
};
|
52
node_modules/default-gateway/node_modules/execa/lib/command.js
generated
vendored
Normal file
52
node_modules/default-gateway/node_modules/execa/lib/command.js
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
'use strict';
|
||||
const normalizeArgs = (file, args = []) => {
|
||||
if (!Array.isArray(args)) {
|
||||
return [file];
|
||||
}
|
||||
|
||||
return [file, ...args];
|
||||
};
|
||||
|
||||
const NO_ESCAPE_REGEXP = /^[\w.-]+$/;
|
||||
const DOUBLE_QUOTES_REGEXP = /"/g;
|
||||
|
||||
const escapeArg = arg => {
|
||||
if (typeof arg !== 'string' || NO_ESCAPE_REGEXP.test(arg)) {
|
||||
return arg;
|
||||
}
|
||||
|
||||
return `"${arg.replace(DOUBLE_QUOTES_REGEXP, '\\"')}"`;
|
||||
};
|
||||
|
||||
const joinCommand = (file, args) => {
|
||||
return normalizeArgs(file, args).join(' ');
|
||||
};
|
||||
|
||||
const getEscapedCommand = (file, args) => {
|
||||
return normalizeArgs(file, args).map(arg => escapeArg(arg)).join(' ');
|
||||
};
|
||||
|
||||
const SPACES_REGEXP = / +/g;
|
||||
|
||||
// Handle `execa.command()`
|
||||
const parseCommand = command => {
|
||||
const tokens = [];
|
||||
for (const token of command.trim().split(SPACES_REGEXP)) {
|
||||
// Allow spaces to be escaped by a backslash if not meant as a delimiter
|
||||
const previousToken = tokens[tokens.length - 1];
|
||||
if (previousToken && previousToken.endsWith('\\')) {
|
||||
// Merge previous token with current one
|
||||
tokens[tokens.length - 1] = `${previousToken.slice(0, -1)} ${token}`;
|
||||
} else {
|
||||
tokens.push(token);
|
||||
}
|
||||
}
|
||||
|
||||
return tokens;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
joinCommand,
|
||||
getEscapedCommand,
|
||||
parseCommand
|
||||
};
|
88
node_modules/default-gateway/node_modules/execa/lib/error.js
generated
vendored
Normal file
88
node_modules/default-gateway/node_modules/execa/lib/error.js
generated
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
'use strict';
|
||||
const {signalsByName} = require('human-signals');
|
||||
|
||||
const getErrorPrefix = ({timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled}) => {
|
||||
if (timedOut) {
|
||||
return `timed out after ${timeout} milliseconds`;
|
||||
}
|
||||
|
||||
if (isCanceled) {
|
||||
return 'was canceled';
|
||||
}
|
||||
|
||||
if (errorCode !== undefined) {
|
||||
return `failed with ${errorCode}`;
|
||||
}
|
||||
|
||||
if (signal !== undefined) {
|
||||
return `was killed with ${signal} (${signalDescription})`;
|
||||
}
|
||||
|
||||
if (exitCode !== undefined) {
|
||||
return `failed with exit code ${exitCode}`;
|
||||
}
|
||||
|
||||
return 'failed';
|
||||
};
|
||||
|
||||
const makeError = ({
|
||||
stdout,
|
||||
stderr,
|
||||
all,
|
||||
error,
|
||||
signal,
|
||||
exitCode,
|
||||
command,
|
||||
escapedCommand,
|
||||
timedOut,
|
||||
isCanceled,
|
||||
killed,
|
||||
parsed: {options: {timeout}}
|
||||
}) => {
|
||||
// `signal` and `exitCode` emitted on `spawned.on('exit')` event can be `null`.
|
||||
// We normalize them to `undefined`
|
||||
exitCode = exitCode === null ? undefined : exitCode;
|
||||
signal = signal === null ? undefined : signal;
|
||||
const signalDescription = signal === undefined ? undefined : signalsByName[signal].description;
|
||||
|
||||
const errorCode = error && error.code;
|
||||
|
||||
const prefix = getErrorPrefix({timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled});
|
||||
const execaMessage = `Command ${prefix}: ${command}`;
|
||||
const isError = Object.prototype.toString.call(error) === '[object Error]';
|
||||
const shortMessage = isError ? `${execaMessage}\n${error.message}` : execaMessage;
|
||||
const message = [shortMessage, stderr, stdout].filter(Boolean).join('\n');
|
||||
|
||||
if (isError) {
|
||||
error.originalMessage = error.message;
|
||||
error.message = message;
|
||||
} else {
|
||||
error = new Error(message);
|
||||
}
|
||||
|
||||
error.shortMessage = shortMessage;
|
||||
error.command = command;
|
||||
error.escapedCommand = escapedCommand;
|
||||
error.exitCode = exitCode;
|
||||
error.signal = signal;
|
||||
error.signalDescription = signalDescription;
|
||||
error.stdout = stdout;
|
||||
error.stderr = stderr;
|
||||
|
||||
if (all !== undefined) {
|
||||
error.all = all;
|
||||
}
|
||||
|
||||
if ('bufferedData' in error) {
|
||||
delete error.bufferedData;
|
||||
}
|
||||
|
||||
error.failed = true;
|
||||
error.timedOut = Boolean(timedOut);
|
||||
error.isCanceled = isCanceled;
|
||||
error.killed = killed && !timedOut;
|
||||
|
||||
return error;
|
||||
};
|
||||
|
||||
module.exports = makeError;
|
115
node_modules/default-gateway/node_modules/execa/lib/kill.js
generated
vendored
Normal file
115
node_modules/default-gateway/node_modules/execa/lib/kill.js
generated
vendored
Normal file
@ -0,0 +1,115 @@
|
||||
'use strict';
|
||||
const os = require('os');
|
||||
const onExit = require('signal-exit');
|
||||
|
||||
const DEFAULT_FORCE_KILL_TIMEOUT = 1000 * 5;
|
||||
|
||||
// Monkey-patches `childProcess.kill()` to add `forceKillAfterTimeout` behavior
|
||||
const spawnedKill = (kill, signal = 'SIGTERM', options = {}) => {
|
||||
const killResult = kill(signal);
|
||||
setKillTimeout(kill, signal, options, killResult);
|
||||
return killResult;
|
||||
};
|
||||
|
||||
const setKillTimeout = (kill, signal, options, killResult) => {
|
||||
if (!shouldForceKill(signal, options, killResult)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const timeout = getForceKillAfterTimeout(options);
|
||||
const t = setTimeout(() => {
|
||||
kill('SIGKILL');
|
||||
}, timeout);
|
||||
|
||||
// Guarded because there's no `.unref()` when `execa` is used in the renderer
|
||||
// process in Electron. This cannot be tested since we don't run tests in
|
||||
// Electron.
|
||||
// istanbul ignore else
|
||||
if (t.unref) {
|
||||
t.unref();
|
||||
}
|
||||
};
|
||||
|
||||
const shouldForceKill = (signal, {forceKillAfterTimeout}, killResult) => {
|
||||
return isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
|
||||
};
|
||||
|
||||
const isSigterm = signal => {
|
||||
return signal === os.constants.signals.SIGTERM ||
|
||||
(typeof signal === 'string' && signal.toUpperCase() === 'SIGTERM');
|
||||
};
|
||||
|
||||
const getForceKillAfterTimeout = ({forceKillAfterTimeout = true}) => {
|
||||
if (forceKillAfterTimeout === true) {
|
||||
return DEFAULT_FORCE_KILL_TIMEOUT;
|
||||
}
|
||||
|
||||
if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {
|
||||
throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
|
||||
}
|
||||
|
||||
return forceKillAfterTimeout;
|
||||
};
|
||||
|
||||
// `childProcess.cancel()`
|
||||
const spawnedCancel = (spawned, context) => {
|
||||
const killResult = spawned.kill();
|
||||
|
||||
if (killResult) {
|
||||
context.isCanceled = true;
|
||||
}
|
||||
};
|
||||
|
||||
const timeoutKill = (spawned, signal, reject) => {
|
||||
spawned.kill(signal);
|
||||
reject(Object.assign(new Error('Timed out'), {timedOut: true, signal}));
|
||||
};
|
||||
|
||||
// `timeout` option handling
|
||||
const setupTimeout = (spawned, {timeout, killSignal = 'SIGTERM'}, spawnedPromise) => {
|
||||
if (timeout === 0 || timeout === undefined) {
|
||||
return spawnedPromise;
|
||||
}
|
||||
|
||||
let timeoutId;
|
||||
const timeoutPromise = new Promise((resolve, reject) => {
|
||||
timeoutId = setTimeout(() => {
|
||||
timeoutKill(spawned, killSignal, reject);
|
||||
}, timeout);
|
||||
});
|
||||
|
||||
const safeSpawnedPromise = spawnedPromise.finally(() => {
|
||||
clearTimeout(timeoutId);
|
||||
});
|
||||
|
||||
return Promise.race([timeoutPromise, safeSpawnedPromise]);
|
||||
};
|
||||
|
||||
const validateTimeout = ({timeout}) => {
|
||||
if (timeout !== undefined && (!Number.isFinite(timeout) || timeout < 0)) {
|
||||
throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
|
||||
}
|
||||
};
|
||||
|
||||
// `cleanup` option handling
|
||||
const setExitHandler = async (spawned, {cleanup, detached}, timedPromise) => {
|
||||
if (!cleanup || detached) {
|
||||
return timedPromise;
|
||||
}
|
||||
|
||||
const removeExitHandler = onExit(() => {
|
||||
spawned.kill();
|
||||
});
|
||||
|
||||
return timedPromise.finally(() => {
|
||||
removeExitHandler();
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
spawnedKill,
|
||||
spawnedCancel,
|
||||
setupTimeout,
|
||||
validateTimeout,
|
||||
setExitHandler
|
||||
};
|
46
node_modules/default-gateway/node_modules/execa/lib/promise.js
generated
vendored
Normal file
46
node_modules/default-gateway/node_modules/execa/lib/promise.js
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
'use strict';
|
||||
|
||||
const nativePromisePrototype = (async () => {})().constructor.prototype;
|
||||
const descriptors = ['then', 'catch', 'finally'].map(property => [
|
||||
property,
|
||||
Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property)
|
||||
]);
|
||||
|
||||
// The return value is a mixin of `childProcess` and `Promise`
|
||||
const mergePromise = (spawned, promise) => {
|
||||
for (const [property, descriptor] of descriptors) {
|
||||
// Starting the main `promise` is deferred to avoid consuming streams
|
||||
const value = typeof promise === 'function' ?
|
||||
(...args) => Reflect.apply(descriptor.value, promise(), args) :
|
||||
descriptor.value.bind(promise);
|
||||
|
||||
Reflect.defineProperty(spawned, property, {...descriptor, value});
|
||||
}
|
||||
|
||||
return spawned;
|
||||
};
|
||||
|
||||
// Use promises instead of `child_process` events
|
||||
const getSpawnedPromise = spawned => {
|
||||
return new Promise((resolve, reject) => {
|
||||
spawned.on('exit', (exitCode, signal) => {
|
||||
resolve({exitCode, signal});
|
||||
});
|
||||
|
||||
spawned.on('error', error => {
|
||||
reject(error);
|
||||
});
|
||||
|
||||
if (spawned.stdin) {
|
||||
spawned.stdin.on('error', error => {
|
||||
reject(error);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
mergePromise,
|
||||
getSpawnedPromise
|
||||
};
|
||||
|
52
node_modules/default-gateway/node_modules/execa/lib/stdio.js
generated
vendored
Normal file
52
node_modules/default-gateway/node_modules/execa/lib/stdio.js
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
'use strict';
|
||||
const aliases = ['stdin', 'stdout', 'stderr'];
|
||||
|
||||
const hasAlias = options => aliases.some(alias => options[alias] !== undefined);
|
||||
|
||||
const normalizeStdio = options => {
|
||||
if (!options) {
|
||||
return;
|
||||
}
|
||||
|
||||
const {stdio} = options;
|
||||
|
||||
if (stdio === undefined) {
|
||||
return aliases.map(alias => options[alias]);
|
||||
}
|
||||
|
||||
if (hasAlias(options)) {
|
||||
throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map(alias => `\`${alias}\``).join(', ')}`);
|
||||
}
|
||||
|
||||
if (typeof stdio === 'string') {
|
||||
return stdio;
|
||||
}
|
||||
|
||||
if (!Array.isArray(stdio)) {
|
||||
throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
|
||||
}
|
||||
|
||||
const length = Math.max(stdio.length, aliases.length);
|
||||
return Array.from({length}, (value, index) => stdio[index]);
|
||||
};
|
||||
|
||||
module.exports = normalizeStdio;
|
||||
|
||||
// `ipc` is pushed unless it is already present
|
||||
module.exports.node = options => {
|
||||
const stdio = normalizeStdio(options);
|
||||
|
||||
if (stdio === 'ipc') {
|
||||
return 'ipc';
|
||||
}
|
||||
|
||||
if (stdio === undefined || typeof stdio === 'string') {
|
||||
return [stdio, stdio, stdio, 'ipc'];
|
||||
}
|
||||
|
||||
if (stdio.includes('ipc')) {
|
||||
return stdio;
|
||||
}
|
||||
|
||||
return [...stdio, 'ipc'];
|
||||
};
|
97
node_modules/default-gateway/node_modules/execa/lib/stream.js
generated
vendored
Normal file
97
node_modules/default-gateway/node_modules/execa/lib/stream.js
generated
vendored
Normal file
@ -0,0 +1,97 @@
|
||||
'use strict';
|
||||
const isStream = require('is-stream');
|
||||
const getStream = require('get-stream');
|
||||
const mergeStream = require('merge-stream');
|
||||
|
||||
// `input` option
|
||||
const handleInput = (spawned, input) => {
|
||||
// Checking for stdin is workaround for https://github.com/nodejs/node/issues/26852
|
||||
// @todo remove `|| spawned.stdin === undefined` once we drop support for Node.js <=12.2.0
|
||||
if (input === undefined || spawned.stdin === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isStream(input)) {
|
||||
input.pipe(spawned.stdin);
|
||||
} else {
|
||||
spawned.stdin.end(input);
|
||||
}
|
||||
};
|
||||
|
||||
// `all` interleaves `stdout` and `stderr`
|
||||
const makeAllStream = (spawned, {all}) => {
|
||||
if (!all || (!spawned.stdout && !spawned.stderr)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const mixed = mergeStream();
|
||||
|
||||
if (spawned.stdout) {
|
||||
mixed.add(spawned.stdout);
|
||||
}
|
||||
|
||||
if (spawned.stderr) {
|
||||
mixed.add(spawned.stderr);
|
||||
}
|
||||
|
||||
return mixed;
|
||||
};
|
||||
|
||||
// On failure, `result.stdout|stderr|all` should contain the currently buffered stream
|
||||
const getBufferedData = async (stream, streamPromise) => {
|
||||
if (!stream) {
|
||||
return;
|
||||
}
|
||||
|
||||
stream.destroy();
|
||||
|
||||
try {
|
||||
return await streamPromise;
|
||||
} catch (error) {
|
||||
return error.bufferedData;
|
||||
}
|
||||
};
|
||||
|
||||
const getStreamPromise = (stream, {encoding, buffer, maxBuffer}) => {
|
||||
if (!stream || !buffer) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (encoding) {
|
||||
return getStream(stream, {encoding, maxBuffer});
|
||||
}
|
||||
|
||||
return getStream.buffer(stream, {maxBuffer});
|
||||
};
|
||||
|
||||
// Retrieve result of child process: exit code, signal, error, streams (stdout/stderr/all)
|
||||
const getSpawnedResult = async ({stdout, stderr, all}, {encoding, buffer, maxBuffer}, processDone) => {
|
||||
const stdoutPromise = getStreamPromise(stdout, {encoding, buffer, maxBuffer});
|
||||
const stderrPromise = getStreamPromise(stderr, {encoding, buffer, maxBuffer});
|
||||
const allPromise = getStreamPromise(all, {encoding, buffer, maxBuffer: maxBuffer * 2});
|
||||
|
||||
try {
|
||||
return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);
|
||||
} catch (error) {
|
||||
return Promise.all([
|
||||
{error, signal: error.signal, timedOut: error.timedOut},
|
||||
getBufferedData(stdout, stdoutPromise),
|
||||
getBufferedData(stderr, stderrPromise),
|
||||
getBufferedData(all, allPromise)
|
||||
]);
|
||||
}
|
||||
};
|
||||
|
||||
const validateInputSync = ({input}) => {
|
||||
if (isStream(input)) {
|
||||
throw new TypeError('The `input` option cannot be a stream in sync mode');
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
handleInput,
|
||||
makeAllStream,
|
||||
getSpawnedResult,
|
||||
validateInputSync
|
||||
};
|
||||
|
9
node_modules/default-gateway/node_modules/execa/license
generated
vendored
Normal file
9
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> (https://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.
|
106
node_modules/default-gateway/node_modules/execa/package.json
generated
vendored
Normal file
106
node_modules/default-gateway/node_modules/execa/package.json
generated
vendored
Normal file
@ -0,0 +1,106 @@
|
||||
{
|
||||
"_from": "execa@^5.0.0",
|
||||
"_id": "execa@5.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==",
|
||||
"_location": "/default-gateway/execa",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "execa@^5.0.0",
|
||||
"name": "execa",
|
||||
"escapedName": "execa",
|
||||
"rawSpec": "^5.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^5.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/default-gateway"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",
|
||||
"_shasum": "f80ad9cbf4298f7bd1d4c9555c21e93741c411dd",
|
||||
"_spec": "execa@^5.0.0",
|
||||
"_where": "C:\\Users\\zhouxueli\\Desktop\\scheduling-app\\node_modules\\default-gateway",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/execa/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"cross-spawn": "^7.0.3",
|
||||
"get-stream": "^6.0.0",
|
||||
"human-signals": "^2.1.0",
|
||||
"is-stream": "^2.0.0",
|
||||
"merge-stream": "^2.0.0",
|
||||
"npm-run-path": "^4.0.1",
|
||||
"onetime": "^5.1.2",
|
||||
"signal-exit": "^3.0.3",
|
||||
"strip-final-newline": "^2.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Process execution for humans",
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.14.10",
|
||||
"ava": "^2.4.0",
|
||||
"get-node": "^11.0.1",
|
||||
"is-running": "^2.1.0",
|
||||
"nyc": "^15.1.0",
|
||||
"p-event": "^4.2.0",
|
||||
"tempfile": "^3.0.0",
|
||||
"tsd": "^0.13.1",
|
||||
"xo": "^0.35.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts",
|
||||
"lib"
|
||||
],
|
||||
"funding": "https://github.com/sindresorhus/execa?sponsor=1",
|
||||
"homepage": "https://github.com/sindresorhus/execa#readme",
|
||||
"keywords": [
|
||||
"exec",
|
||||
"child",
|
||||
"process",
|
||||
"execute",
|
||||
"fork",
|
||||
"execfile",
|
||||
"spawn",
|
||||
"file",
|
||||
"shell",
|
||||
"bin",
|
||||
"binary",
|
||||
"binaries",
|
||||
"npm",
|
||||
"path",
|
||||
"local"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "execa",
|
||||
"nyc": {
|
||||
"reporter": [
|
||||
"text",
|
||||
"lcov"
|
||||
],
|
||||
"exclude": [
|
||||
"**/fixtures/**",
|
||||
"**/test.js",
|
||||
"**/test/**"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/execa.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && nyc ava && tsd"
|
||||
},
|
||||
"version": "5.1.1"
|
||||
}
|
663
node_modules/default-gateway/node_modules/execa/readme.md
generated
vendored
Normal file
663
node_modules/default-gateway/node_modules/execa/readme.md
generated
vendored
Normal file
@ -0,0 +1,663 @@
|
||||
<img src="media/logo.svg" width="400">
|
||||
<br>
|
||||
|
||||
[](https://codecov.io/gh/sindresorhus/execa)
|
||||
|
||||
> Process execution for humans
|
||||
|
||||
## Why
|
||||
|
||||
This package improves [`child_process`](https://nodejs.org/api/child_process.html) methods with:
|
||||
|
||||
- Promise interface.
|
||||
- [Strips the final newline](#stripfinalnewline) from the output so you don't have to do `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. 100 MB instead of 200 KB.
|
||||
- [Executes locally installed binaries by name.](#preferlocal)
|
||||
- [Cleans up spawned processes when the parent process dies.](#cleanup)
|
||||
- [Get interleaved output](#all) from `stdout` and `stderr` similar to what is printed on the terminal. [*(Async only)*](#execasyncfile-arguments-options)
|
||||
- [Can specify file and arguments as a single string without a shell](#execacommandcommand-options)
|
||||
- More descriptive errors.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install execa
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const execa = require('execa');
|
||||
|
||||
(async () => {
|
||||
const {stdout} = await execa('echo', ['unicorns']);
|
||||
console.log(stdout);
|
||||
//=> 'unicorns'
|
||||
})();
|
||||
```
|
||||
|
||||
### Pipe the child process stdout to the parent
|
||||
|
||||
```js
|
||||
const execa = require('execa');
|
||||
|
||||
execa('echo', ['unicorns']).stdout.pipe(process.stdout);
|
||||
```
|
||||
|
||||
### Handling Errors
|
||||
|
||||
```js
|
||||
const execa = require('execa');
|
||||
|
||||
(async () => {
|
||||
// Catching an error
|
||||
try {
|
||||
await execa('unknown', ['command']);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
/*
|
||||
{
|
||||
message: 'Command failed with ENOENT: unknown command spawn unknown ENOENT',
|
||||
errno: -2,
|
||||
code: 'ENOENT',
|
||||
syscall: 'spawn unknown',
|
||||
path: 'unknown',
|
||||
spawnargs: ['command'],
|
||||
originalMessage: 'spawn unknown ENOENT',
|
||||
shortMessage: 'Command failed with ENOENT: unknown command spawn unknown ENOENT',
|
||||
command: 'unknown command',
|
||||
escapedCommand: 'unknown command',
|
||||
stdout: '',
|
||||
stderr: '',
|
||||
all: '',
|
||||
failed: true,
|
||||
timedOut: false,
|
||||
isCanceled: false,
|
||||
killed: false
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
})();
|
||||
```
|
||||
|
||||
### Cancelling a spawned process
|
||||
|
||||
```js
|
||||
const execa = require('execa');
|
||||
|
||||
(async () => {
|
||||
const subprocess = execa('node');
|
||||
|
||||
setTimeout(() => {
|
||||
subprocess.cancel();
|
||||
}, 1000);
|
||||
|
||||
try {
|
||||
await subprocess;
|
||||
} catch (error) {
|
||||
console.log(subprocess.killed); // true
|
||||
console.log(error.isCanceled); // true
|
||||
}
|
||||
})()
|
||||
```
|
||||
|
||||
### Catching an error with the sync method
|
||||
|
||||
```js
|
||||
try {
|
||||
execa.sync('unknown', ['command']);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
/*
|
||||
{
|
||||
message: 'Command failed with ENOENT: unknown command spawnSync unknown ENOENT',
|
||||
errno: -2,
|
||||
code: 'ENOENT',
|
||||
syscall: 'spawnSync unknown',
|
||||
path: 'unknown',
|
||||
spawnargs: ['command'],
|
||||
originalMessage: 'spawnSync unknown ENOENT',
|
||||
shortMessage: 'Command failed with ENOENT: unknown command spawnSync unknown ENOENT',
|
||||
command: 'unknown command',
|
||||
escapedCommand: 'unknown command',
|
||||
stdout: '',
|
||||
stderr: '',
|
||||
all: '',
|
||||
failed: true,
|
||||
timedOut: false,
|
||||
isCanceled: false,
|
||||
killed: false
|
||||
}
|
||||
*/
|
||||
}
|
||||
```
|
||||
|
||||
### Kill a process
|
||||
|
||||
Using SIGTERM, and after 2 seconds, kill it with SIGKILL.
|
||||
|
||||
```js
|
||||
const subprocess = execa('node');
|
||||
|
||||
setTimeout(() => {
|
||||
subprocess.kill('SIGTERM', {
|
||||
forceKillAfterTimeout: 2000
|
||||
});
|
||||
}, 1000);
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### execa(file, arguments, options?)
|
||||
|
||||
Execute a file. Think of this as a mix of [`child_process.execFile()`](https://nodejs.org/api/child_process.html#child_process_child_process_execfile_file_args_options_callback) and [`child_process.spawn()`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options).
|
||||
|
||||
No escaping/quoting is needed.
|
||||
|
||||
Unless the [`shell`](#shell) option is used, no shell interpreter (Bash, `cmd.exe`, etc.) is used, so shell features such as variables substitution (`echo $PATH`) are not allowed.
|
||||
|
||||
Returns a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) which:
|
||||
- is also a `Promise` resolving or rejecting with a [`childProcessResult`](#childProcessResult).
|
||||
- exposes the following additional methods and properties.
|
||||
|
||||
#### kill(signal?, options?)
|
||||
|
||||
Same as the original [`child_process#kill()`](https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal) except: if `signal` is `SIGTERM` (the default value) and the child process is not terminated after 5 seconds, force it by sending `SIGKILL`.
|
||||
|
||||
##### options.forceKillAfterTimeout
|
||||
|
||||
Type: `number | false`\
|
||||
Default: `5000`
|
||||
|
||||
Milliseconds to wait for the child process to terminate before sending `SIGKILL`.
|
||||
|
||||
Can be disabled with `false`.
|
||||
|
||||
#### cancel()
|
||||
|
||||
Similar to [`childProcess.kill()`](https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal). This is preferred when cancelling the child process execution as the error is more descriptive and [`childProcessResult.isCanceled`](#iscanceled) is set to `true`.
|
||||
|
||||
#### all
|
||||
|
||||
Type: `ReadableStream | undefined`
|
||||
|
||||
Stream combining/interleaving [`stdout`](https://nodejs.org/api/child_process.html#child_process_subprocess_stdout) and [`stderr`](https://nodejs.org/api/child_process.html#child_process_subprocess_stderr).
|
||||
|
||||
This is `undefined` if either:
|
||||
- the [`all` option](#all-2) is `false` (the default value)
|
||||
- both [`stdout`](#stdout-1) and [`stderr`](#stderr-1) options are set to [`'inherit'`, `'ipc'`, `Stream` or `integer`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio)
|
||||
|
||||
### execa.sync(file, arguments?, options?)
|
||||
|
||||
Execute a file synchronously.
|
||||
|
||||
Returns or throws a [`childProcessResult`](#childProcessResult).
|
||||
|
||||
### execa.command(command, options?)
|
||||
|
||||
Same as [`execa()`](#execafile-arguments-options) except both file and arguments are specified in a single `command` string. For example, `execa('echo', ['unicorns'])` is the same as `execa.command('echo unicorns')`.
|
||||
|
||||
If the file or an argument contains spaces, they must be escaped with backslashes. This matters especially if `command` is not a constant but a variable, for example with `__dirname` or `process.cwd()`. Except for spaces, no escaping/quoting is needed.
|
||||
|
||||
The [`shell` option](#shell) must be used if the `command` uses shell-specific features (for example, `&&` or `||`), as opposed to being a simple `file` followed by its `arguments`.
|
||||
|
||||
### execa.commandSync(command, options?)
|
||||
|
||||
Same as [`execa.command()`](#execacommand-command-options) but synchronous.
|
||||
|
||||
Returns or throws a [`childProcessResult`](#childProcessResult).
|
||||
|
||||
### execa.node(scriptPath, arguments?, options?)
|
||||
|
||||
Execute a Node.js script as a child process.
|
||||
|
||||
Same as `execa('node', [scriptPath, ...arguments], options)` except (like [`child_process#fork()`](https://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options)):
|
||||
- the current Node version and options are used. This can be overridden using the [`nodePath`](#nodepath-for-node-only) and [`nodeOptions`](#nodeoptions-for-node-only) options.
|
||||
- the [`shell`](#shell) option cannot be used
|
||||
- an extra channel [`ipc`](https://nodejs.org/api/child_process.html#child_process_options_stdio) is passed to [`stdio`](#stdio)
|
||||
|
||||
### childProcessResult
|
||||
|
||||
Type: `object`
|
||||
|
||||
Result of a child process execution. On success this is a plain object. On failure this is also an `Error` instance.
|
||||
|
||||
The child process [fails](#failed) when:
|
||||
- its [exit code](#exitcode) is not `0`
|
||||
- it was [killed](#killed) with a [signal](#signal)
|
||||
- [timing out](#timedout)
|
||||
- [being canceled](#iscanceled)
|
||||
- there's not enough memory or there are already too many child processes
|
||||
|
||||
#### command
|
||||
|
||||
Type: `string`
|
||||
|
||||
The file and arguments that were run, for logging purposes.
|
||||
|
||||
This is not escaped and should not be executed directly as a process, including using [`execa()`](#execafile-arguments-options) or [`execa.command()`](#execacommandcommand-options).
|
||||
|
||||
#### escapedCommand
|
||||
|
||||
Type: `string`
|
||||
|
||||
Same as [`command`](#command) but escaped.
|
||||
|
||||
This is meant to be copy and pasted into a shell, for debugging purposes.
|
||||
Since the escaping is fairly basic, this should not be executed directly as a process, including using [`execa()`](#execafile-arguments-options) or [`execa.command()`](#execacommandcommand-options).
|
||||
|
||||
#### exitCode
|
||||
|
||||
Type: `number`
|
||||
|
||||
The numeric exit code of the process that was run.
|
||||
|
||||
#### stdout
|
||||
|
||||
Type: `string | Buffer`
|
||||
|
||||
The output of the process on stdout.
|
||||
|
||||
#### stderr
|
||||
|
||||
Type: `string | Buffer`
|
||||
|
||||
The output of the process on stderr.
|
||||
|
||||
#### all
|
||||
|
||||
Type: `string | Buffer | undefined`
|
||||
|
||||
The output of the process with `stdout` and `stderr` interleaved.
|
||||
|
||||
This is `undefined` if either:
|
||||
- the [`all` option](#all-2) is `false` (the default value)
|
||||
- `execa.sync()` was used
|
||||
|
||||
#### failed
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Whether the process failed to run.
|
||||
|
||||
#### timedOut
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Whether the process timed out.
|
||||
|
||||
#### isCanceled
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Whether the process was canceled.
|
||||
|
||||
#### killed
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Whether the process was killed.
|
||||
|
||||
#### signal
|
||||
|
||||
Type: `string | undefined`
|
||||
|
||||
The name of the signal that was used to terminate the process. For example, `SIGFPE`.
|
||||
|
||||
If a signal terminated the process, this property is defined and included in the error message. Otherwise it is `undefined`.
|
||||
|
||||
#### signalDescription
|
||||
|
||||
Type: `string | undefined`
|
||||
|
||||
A human-friendly description of the signal that was used to terminate the process. For example, `Floating point arithmetic error`.
|
||||
|
||||
If a signal terminated the process, this property is defined and included in the error message. Otherwise it is `undefined`. It is also `undefined` when the signal is very uncommon which should seldomly happen.
|
||||
|
||||
#### message
|
||||
|
||||
Type: `string`
|
||||
|
||||
Error message when the child process failed to run. In addition to the [underlying error message](#originalMessage), it also contains some information related to why the child process errored.
|
||||
|
||||
The child process [stderr](#stderr) then [stdout](#stdout) are appended to the end, separated with newlines and not interleaved.
|
||||
|
||||
#### shortMessage
|
||||
|
||||
Type: `string`
|
||||
|
||||
This is the same as the [`message` property](#message) except it does not include the child process stdout/stderr.
|
||||
|
||||
#### originalMessage
|
||||
|
||||
Type: `string | undefined`
|
||||
|
||||
Original error message. This is the same as the `message` property except it includes neither the child process stdout/stderr nor some additional information added by Execa.
|
||||
|
||||
This is `undefined` unless the child process exited due to an `error` event or a timeout.
|
||||
|
||||
### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
#### cleanup
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `true`
|
||||
|
||||
Kill the spawned process when the parent process exits unless either:
|
||||
- the spawned process is [`detached`](https://nodejs.org/api/child_process.html#child_process_options_detached)
|
||||
- the parent process is terminated abruptly, for example, with `SIGKILL` as opposed to `SIGTERM` or a normal exit
|
||||
|
||||
#### preferLocal
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `false`
|
||||
|
||||
Prefer locally installed binaries when looking for a binary to execute.\
|
||||
If you `$ npm install foo`, you can then `execa('foo')`.
|
||||
|
||||
#### localDir
|
||||
|
||||
Type: `string`\
|
||||
Default: `process.cwd()`
|
||||
|
||||
Preferred path to find locally installed binaries in (use with `preferLocal`).
|
||||
|
||||
#### execPath
|
||||
|
||||
Type: `string`\
|
||||
Default: `process.execPath` (Current Node.js executable)
|
||||
|
||||
Path to the Node.js executable to use in child processes.
|
||||
|
||||
This can be either an absolute path or a path relative to the [`cwd` option](#cwd).
|
||||
|
||||
Requires [`preferLocal`](#preferlocal) to be `true`.
|
||||
|
||||
For example, this can be used together with [`get-node`](https://github.com/ehmicky/get-node) to run a specific Node.js version in a child process.
|
||||
|
||||
#### buffer
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `true`
|
||||
|
||||
Buffer the output from the spawned process. When set to `false`, you must read the output of [`stdout`](#stdout-1) and [`stderr`](#stderr-1) (or [`all`](#all) if the [`all`](#all-2) option is `true`). Otherwise the returned promise will not be resolved/rejected.
|
||||
|
||||
If the spawned process fails, [`error.stdout`](#stdout), [`error.stderr`](#stderr), and [`error.all`](#all) will contain the buffered data.
|
||||
|
||||
#### input
|
||||
|
||||
Type: `string | Buffer | stream.Readable`
|
||||
|
||||
Write some input to the `stdin` of your binary.\
|
||||
Streams are not allowed when using the synchronous methods.
|
||||
|
||||
#### stdin
|
||||
|
||||
Type: `string | number | Stream | undefined`\
|
||||
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`\
|
||||
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`\
|
||||
Default: `pipe`
|
||||
|
||||
Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
|
||||
|
||||
#### all
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `false`
|
||||
|
||||
Add an `.all` property on the [promise](#all) and the [resolved value](#all-1). The property contains the output of the process with `stdout` and `stderr` interleaved.
|
||||
|
||||
#### reject
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `true`
|
||||
|
||||
Setting this to `false` resolves the promise with the error instead of rejecting it.
|
||||
|
||||
#### stripFinalNewline
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `true`
|
||||
|
||||
Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from the output.
|
||||
|
||||
#### extendEnv
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `true`
|
||||
|
||||
Set to `false` if you don't want to extend the environment variables when providing the `env` property.
|
||||
|
||||
---
|
||||
|
||||
Execa also accepts the below options which are the same as the options for [`child_process#spawn()`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options)/[`child_process#exec()`](https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback)
|
||||
|
||||
#### cwd
|
||||
|
||||
Type: `string`\
|
||||
Default: `process.cwd()`
|
||||
|
||||
Current working directory of the child process.
|
||||
|
||||
#### env
|
||||
|
||||
Type: `object`\
|
||||
Default: `process.env`
|
||||
|
||||
Environment key-value pairs. Extends automatically from `process.env`. Set [`extendEnv`](#extendenv) to `false` if you don't want this.
|
||||
|
||||
#### argv0
|
||||
|
||||
Type: `string`
|
||||
|
||||
Explicitly set the value of `argv[0]` sent to the child process. This will be set to `file` if not specified.
|
||||
|
||||
#### stdio
|
||||
|
||||
Type: `string | string[]`\
|
||||
Default: `pipe`
|
||||
|
||||
Child's [stdio](https://nodejs.org/api/child_process.html#child_process_options_stdio) configuration.
|
||||
|
||||
#### serialization
|
||||
|
||||
Type: `string`\
|
||||
Default: `'json'`
|
||||
|
||||
Specify the kind of serialization used for sending messages between processes when using the [`stdio: 'ipc'`](#stdio) option or [`execa.node()`](#execanodescriptpath-arguments-options):
|
||||
- `json`: Uses `JSON.stringify()` and `JSON.parse()`.
|
||||
- `advanced`: Uses [`v8.serialize()`](https://nodejs.org/api/v8.html#v8_v8_serialize_value)
|
||||
|
||||
Requires Node.js `13.2.0` or later.
|
||||
|
||||
[More info.](https://nodejs.org/api/child_process.html#child_process_advanced_serialization)
|
||||
|
||||
#### 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`\
|
||||
Default: `false`
|
||||
|
||||
If `true`, runs `file` 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.
|
||||
|
||||
We recommend against using this option since it is:
|
||||
- not cross-platform, encouraging shell-specific syntax.
|
||||
- slower, because of the additional shell interpretation.
|
||||
- unsafe, potentially allowing command injection.
|
||||
|
||||
#### encoding
|
||||
|
||||
Type: `string | null`\
|
||||
Default: `utf8`
|
||||
|
||||
Specify the character encoding used to decode the `stdout` and `stderr` output. If set to `null`, then `stdout` and `stderr` will be a `Buffer` instead of a string.
|
||||
|
||||
#### timeout
|
||||
|
||||
Type: `number`\
|
||||
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.
|
||||
|
||||
#### maxBuffer
|
||||
|
||||
Type: `number`\
|
||||
Default: `100_000_000` (100 MB)
|
||||
|
||||
Largest amount of data in bytes allowed on `stdout` or `stderr`.
|
||||
|
||||
#### killSignal
|
||||
|
||||
Type: `string | number`\
|
||||
Default: `SIGTERM`
|
||||
|
||||
Signal value to be used when the spawned process will be killed.
|
||||
|
||||
#### windowsVerbatimArguments
|
||||
|
||||
Type: `boolean`\
|
||||
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`.
|
||||
|
||||
#### windowsHide
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `true`
|
||||
|
||||
On Windows, do not create a new console window. Please note this also prevents `CTRL-C` [from working](https://github.com/nodejs/node/issues/29837) on Windows.
|
||||
|
||||
#### nodePath *(For `.node()` only)*
|
||||
|
||||
Type: `string`\
|
||||
Default: [`process.execPath`](https://nodejs.org/api/process.html#process_process_execpath)
|
||||
|
||||
Node.js executable used to create the child process.
|
||||
|
||||
#### nodeOptions *(For `.node()` only)*
|
||||
|
||||
Type: `string[]`\
|
||||
Default: [`process.execArgv`](https://nodejs.org/api/process.html#process_process_execargv)
|
||||
|
||||
List of [CLI options](https://nodejs.org/api/cli.html#cli_options) passed to the Node.js executable.
|
||||
|
||||
## Tips
|
||||
|
||||
### Retry on error
|
||||
|
||||
Gracefully handle failures by using automatic retries and exponential backoff with the [`p-retry`](https://github.com/sindresorhus/p-retry) package:
|
||||
|
||||
```js
|
||||
const pRetry = require('p-retry');
|
||||
|
||||
const run = async () => {
|
||||
const results = await execa('curl', ['-sSL', 'https://sindresorhus.com/unicorn']);
|
||||
return results;
|
||||
};
|
||||
|
||||
(async () => {
|
||||
console.log(await pRetry(run, {retries: 5}));
|
||||
})();
|
||||
```
|
||||
|
||||
### 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 subprocess = execa('echo', ['foo']);
|
||||
subprocess.stdout.pipe(process.stdout);
|
||||
|
||||
(async () => {
|
||||
const {stdout} = await subprocess;
|
||||
console.log('child output:', stdout);
|
||||
})();
|
||||
```
|
||||
|
||||
### Redirect output to a file
|
||||
|
||||
```js
|
||||
const execa = require('execa');
|
||||
|
||||
const subprocess = execa('echo', ['foo'])
|
||||
subprocess.stdout.pipe(fs.createWriteStream('stdout.txt'))
|
||||
```
|
||||
|
||||
### Redirect input from a file
|
||||
|
||||
```js
|
||||
const execa = require('execa');
|
||||
|
||||
const subprocess = execa('cat')
|
||||
fs.createReadStream('stdin.txt').pipe(subprocess.stdin)
|
||||
```
|
||||
|
||||
### Execute the current package's binary
|
||||
|
||||
```js
|
||||
const {getBinPathSync} = require('get-bin-path');
|
||||
|
||||
const binPath = getBinPathSync();
|
||||
const subprocess = execa(binPath);
|
||||
```
|
||||
|
||||
`execa` can be combined with [`get-bin-path`](https://github.com/ehmicky/get-bin-path) to test the current package's binary. As opposed to hard-coding the path to the binary, this validates that the `package.json` `bin` field is correctly set up.
|
||||
|
||||
## Related
|
||||
|
||||
- [gulp-execa](https://github.com/ehmicky/gulp-execa) - Gulp plugin for `execa`
|
||||
- [nvexeca](https://github.com/ehmicky/nvexeca) - Run `execa` using any Node.js version
|
||||
- [sudo-prompt](https://github.com/jorangreef/sudo-prompt) - Run commands with elevated privileges.
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [@ehmicky](https://github.com/ehmicky)
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-execa?utm_source=npm-execa&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
52
node_modules/default-gateway/node_modules/get-stream/buffer-stream.js
generated
vendored
Normal file
52
node_modules/default-gateway/node_modules/get-stream/buffer-stream.js
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
'use strict';
|
||||
const {PassThrough: PassThroughStream} = require('stream');
|
||||
|
||||
module.exports = options => {
|
||||
options = {...options};
|
||||
|
||||
const {array} = options;
|
||||
let {encoding} = options;
|
||||
const isBuffer = encoding === 'buffer';
|
||||
let objectMode = false;
|
||||
|
||||
if (array) {
|
||||
objectMode = !(encoding || isBuffer);
|
||||
} else {
|
||||
encoding = encoding || 'utf8';
|
||||
}
|
||||
|
||||
if (isBuffer) {
|
||||
encoding = null;
|
||||
}
|
||||
|
||||
const stream = new PassThroughStream({objectMode});
|
||||
|
||||
if (encoding) {
|
||||
stream.setEncoding(encoding);
|
||||
}
|
||||
|
||||
let length = 0;
|
||||
const chunks = [];
|
||||
|
||||
stream.on('data', chunk => {
|
||||
chunks.push(chunk);
|
||||
|
||||
if (objectMode) {
|
||||
length = chunks.length;
|
||||
} else {
|
||||
length += chunk.length;
|
||||
}
|
||||
});
|
||||
|
||||
stream.getBufferedValue = () => {
|
||||
if (array) {
|
||||
return chunks;
|
||||
}
|
||||
|
||||
return isBuffer ? Buffer.concat(chunks, length) : chunks.join('');
|
||||
};
|
||||
|
||||
stream.getBufferedLength = () => length;
|
||||
|
||||
return stream;
|
||||
};
|
105
node_modules/default-gateway/node_modules/get-stream/index.d.ts
generated
vendored
Normal file
105
node_modules/default-gateway/node_modules/get-stream/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,105 @@
|
||||
/// <reference types="node"/>
|
||||
import {Stream} from 'stream';
|
||||
|
||||
declare class MaxBufferErrorClass extends Error {
|
||||
readonly name: 'MaxBufferError';
|
||||
constructor();
|
||||
}
|
||||
|
||||
declare namespace getStream {
|
||||
interface Options {
|
||||
/**
|
||||
Maximum length of the returned string. If it exceeds this value before the stream ends, the promise will be rejected with a `MaxBufferError` error.
|
||||
|
||||
@default Infinity
|
||||
*/
|
||||
readonly maxBuffer?: number;
|
||||
}
|
||||
|
||||
interface OptionsWithEncoding<EncodingType = BufferEncoding> extends Options {
|
||||
/**
|
||||
[Encoding](https://nodejs.org/api/buffer.html#buffer_buffer) of the incoming stream.
|
||||
|
||||
@default 'utf8'
|
||||
*/
|
||||
readonly encoding?: EncodingType;
|
||||
}
|
||||
|
||||
type MaxBufferError = MaxBufferErrorClass;
|
||||
}
|
||||
|
||||
declare const getStream: {
|
||||
/**
|
||||
Get the `stream` as a string.
|
||||
|
||||
@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.
|
||||
|
||||
@example
|
||||
```
|
||||
import * as fs from 'fs';
|
||||
import getStream = require('get-stream');
|
||||
|
||||
(async () => {
|
||||
const stream = fs.createReadStream('unicorn.txt');
|
||||
|
||||
console.log(await getStream(stream));
|
||||
// ,,))))))));,
|
||||
// __)))))))))))))),
|
||||
// \|/ -\(((((''''((((((((.
|
||||
// -*-==//////(('' . `)))))),
|
||||
// /|\ ))| o ;-. '((((( ,(,
|
||||
// ( `| / ) ;))))' ,_))^;(~
|
||||
// | | | ,))((((_ _____------~~~-. %,;(;(>';'~
|
||||
// o_); ; )))(((` ~---~ `:: \ %%~~)(v;(`('~
|
||||
// ; ''''```` `: `:::|\,__,%% );`'; ~
|
||||
// | _ ) / `:|`----' `-'
|
||||
// ______/\/~ | / /
|
||||
// /~;;.____/;;' / ___--,-( `;;;/
|
||||
// / // _;______;'------~~~~~ /;;/\ /
|
||||
// // | | / ; \;;,\
|
||||
// (<_ | ; /',/-----' _>
|
||||
// \_| ||_ //~;~~~~~~~~~
|
||||
// `\_| (,~~
|
||||
// \~\
|
||||
// ~~
|
||||
})();
|
||||
```
|
||||
*/
|
||||
(stream: Stream, options?: getStream.OptionsWithEncoding): Promise<string>;
|
||||
|
||||
/**
|
||||
Get the `stream` as a buffer.
|
||||
|
||||
It honors the `maxBuffer` option as above, but it refers to byte length rather than string length.
|
||||
*/
|
||||
buffer(
|
||||
stream: Stream,
|
||||
options?: getStream.Options
|
||||
): Promise<Buffer>;
|
||||
|
||||
/**
|
||||
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.
|
||||
*/
|
||||
array<StreamObjectModeType>(
|
||||
stream: Stream,
|
||||
options?: getStream.Options
|
||||
): Promise<StreamObjectModeType[]>;
|
||||
array(
|
||||
stream: Stream,
|
||||
options: getStream.OptionsWithEncoding<'buffer'>
|
||||
): Promise<Buffer[]>;
|
||||
array(
|
||||
stream: Stream,
|
||||
options: getStream.OptionsWithEncoding<BufferEncoding>
|
||||
): Promise<string[]>;
|
||||
|
||||
MaxBufferError: typeof MaxBufferErrorClass;
|
||||
};
|
||||
|
||||
export = getStream;
|
61
node_modules/default-gateway/node_modules/get-stream/index.js
generated
vendored
Normal file
61
node_modules/default-gateway/node_modules/get-stream/index.js
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
'use strict';
|
||||
const {constants: BufferConstants} = require('buffer');
|
||||
const stream = require('stream');
|
||||
const {promisify} = require('util');
|
||||
const bufferStream = require('./buffer-stream');
|
||||
|
||||
const streamPipelinePromisified = promisify(stream.pipeline);
|
||||
|
||||
class MaxBufferError extends Error {
|
||||
constructor() {
|
||||
super('maxBuffer exceeded');
|
||||
this.name = 'MaxBufferError';
|
||||
}
|
||||
}
|
||||
|
||||
async function getStream(inputStream, options) {
|
||||
if (!inputStream) {
|
||||
throw new Error('Expected a stream');
|
||||
}
|
||||
|
||||
options = {
|
||||
maxBuffer: Infinity,
|
||||
...options
|
||||
};
|
||||
|
||||
const {maxBuffer} = options;
|
||||
const stream = bufferStream(options);
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
const rejectPromise = error => {
|
||||
// Don't retrieve an oversized buffer.
|
||||
if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
|
||||
error.bufferedData = stream.getBufferedValue();
|
||||
}
|
||||
|
||||
reject(error);
|
||||
};
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
await streamPipelinePromisified(inputStream, stream);
|
||||
resolve();
|
||||
} catch (error) {
|
||||
rejectPromise(error);
|
||||
}
|
||||
})();
|
||||
|
||||
stream.on('data', () => {
|
||||
if (stream.getBufferedLength() > maxBuffer) {
|
||||
rejectPromise(new MaxBufferError());
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return stream.getBufferedValue();
|
||||
}
|
||||
|
||||
module.exports = getStream;
|
||||
module.exports.buffer = (stream, options) => getStream(stream, {...options, encoding: 'buffer'});
|
||||
module.exports.array = (stream, options) => getStream(stream, {...options, array: true});
|
||||
module.exports.MaxBufferError = MaxBufferError;
|
9
node_modules/default-gateway/node_modules/get-stream/license
generated
vendored
Normal file
9
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> (https://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.
|
79
node_modules/default-gateway/node_modules/get-stream/package.json
generated
vendored
Normal file
79
node_modules/default-gateway/node_modules/get-stream/package.json
generated
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
{
|
||||
"_from": "get-stream@^6.0.0",
|
||||
"_id": "get-stream@6.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==",
|
||||
"_location": "/default-gateway/get-stream",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "get-stream@^6.0.0",
|
||||
"name": "get-stream",
|
||||
"escapedName": "get-stream",
|
||||
"rawSpec": "^6.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^6.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/default-gateway/execa"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",
|
||||
"_shasum": "a262d8eef67aced57c2852ad6167526a43cbf7b7",
|
||||
"_spec": "get-stream@^6.0.0",
|
||||
"_where": "C:\\Users\\zhouxueli\\Desktop\\scheduling-app\\node_modules\\default-gateway\\node_modules\\execa",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/get-stream/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Get a stream as a string, buffer, or array",
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.0.27",
|
||||
"ava": "^2.4.0",
|
||||
"into-stream": "^5.0.0",
|
||||
"tsd": "^0.13.1",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts",
|
||||
"buffer-stream.js"
|
||||
],
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"homepage": "https://github.com/sindresorhus/get-stream#readme",
|
||||
"keywords": [
|
||||
"get",
|
||||
"stream",
|
||||
"promise",
|
||||
"concat",
|
||||
"string",
|
||||
"text",
|
||||
"buffer",
|
||||
"read",
|
||||
"data",
|
||||
"consume",
|
||||
"readable",
|
||||
"readablestream",
|
||||
"array",
|
||||
"object"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "get-stream",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/get-stream.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"version": "6.0.1"
|
||||
}
|
124
node_modules/default-gateway/node_modules/get-stream/readme.md
generated
vendored
Normal file
124
node_modules/default-gateway/node_modules/get-stream/readme.md
generated
vendored
Normal file
@ -0,0 +1,124 @@
|
||||
# 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`\
|
||||
Default: `'utf8'`
|
||||
|
||||
[Encoding](https://nodejs.org/api/buffer.html#buffer_buffer) of the incoming stream.
|
||||
|
||||
##### maxBuffer
|
||||
|
||||
Type: `number`\
|
||||
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
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-get-stream?utm_source=npm-get-stream&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
79
node_modules/default-gateway/node_modules/is-stream/index.d.ts
generated
vendored
Normal file
79
node_modules/default-gateway/node_modules/is-stream/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
import * as stream from 'stream';
|
||||
|
||||
declare const isStream: {
|
||||
/**
|
||||
@returns Whether `stream` is a [`Stream`](https://nodejs.org/api/stream.html#stream_stream).
|
||||
|
||||
@example
|
||||
```
|
||||
import * as fs from 'fs';
|
||||
import isStream = require('is-stream');
|
||||
|
||||
isStream(fs.createReadStream('unicorn.png'));
|
||||
//=> true
|
||||
|
||||
isStream({});
|
||||
//=> false
|
||||
```
|
||||
*/
|
||||
(stream: unknown): stream is stream.Stream;
|
||||
|
||||
/**
|
||||
@returns Whether `stream` is a [`stream.Writable`](https://nodejs.org/api/stream.html#stream_class_stream_writable).
|
||||
|
||||
@example
|
||||
```
|
||||
import * as fs from 'fs';
|
||||
import isStream = require('is-stream');
|
||||
|
||||
isStream.writable(fs.createWriteStrem('unicorn.txt'));
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
writable(stream: unknown): stream is stream.Writable;
|
||||
|
||||
/**
|
||||
@returns Whether `stream` is a [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable).
|
||||
|
||||
@example
|
||||
```
|
||||
import * as fs from 'fs';
|
||||
import isStream = require('is-stream');
|
||||
|
||||
isStream.readable(fs.createReadStream('unicorn.png'));
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
readable(stream: unknown): stream is stream.Readable;
|
||||
|
||||
/**
|
||||
@returns Whether `stream` is a [`stream.Duplex`](https://nodejs.org/api/stream.html#stream_class_stream_duplex).
|
||||
|
||||
@example
|
||||
```
|
||||
import {Duplex} from 'stream';
|
||||
import isStream = require('is-stream');
|
||||
|
||||
isStream.duplex(new Duplex());
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
duplex(stream: unknown): stream is stream.Duplex;
|
||||
|
||||
/**
|
||||
@returns Whether `stream` is a [`stream.Transform`](https://nodejs.org/api/stream.html#stream_class_stream_transform).
|
||||
|
||||
@example
|
||||
```
|
||||
import * as fs from 'fs';
|
||||
import Stringify = require('streaming-json-stringify');
|
||||
import isStream = require('is-stream');
|
||||
|
||||
isStream.transform(Stringify());
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
transform(input: unknown): input is stream.Transform;
|
||||
};
|
||||
|
||||
export = isStream;
|
28
node_modules/default-gateway/node_modules/is-stream/index.js
generated
vendored
Normal file
28
node_modules/default-gateway/node_modules/is-stream/index.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
const isStream = stream =>
|
||||
stream !== null &&
|
||||
typeof stream === 'object' &&
|
||||
typeof stream.pipe === 'function';
|
||||
|
||||
isStream.writable = stream =>
|
||||
isStream(stream) &&
|
||||
stream.writable !== false &&
|
||||
typeof stream._write === 'function' &&
|
||||
typeof stream._writableState === 'object';
|
||||
|
||||
isStream.readable = stream =>
|
||||
isStream(stream) &&
|
||||
stream.readable !== false &&
|
||||
typeof stream._read === 'function' &&
|
||||
typeof stream._readableState === 'object';
|
||||
|
||||
isStream.duplex = stream =>
|
||||
isStream.writable(stream) &&
|
||||
isStream.readable(stream);
|
||||
|
||||
isStream.transform = stream =>
|
||||
isStream.duplex(stream) &&
|
||||
typeof stream._transform === 'function';
|
||||
|
||||
module.exports = isStream;
|
9
node_modules/default-gateway/node_modules/is-stream/license
generated
vendored
Normal file
9
node_modules/default-gateway/node_modules/is-stream/license
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://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.
|
74
node_modules/default-gateway/node_modules/is-stream/package.json
generated
vendored
Normal file
74
node_modules/default-gateway/node_modules/is-stream/package.json
generated
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
{
|
||||
"_from": "is-stream@^2.0.0",
|
||||
"_id": "is-stream@2.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
|
||||
"_location": "/default-gateway/is-stream",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "is-stream@^2.0.0",
|
||||
"name": "is-stream",
|
||||
"escapedName": "is-stream",
|
||||
"rawSpec": "^2.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/default-gateway/execa"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
|
||||
"_shasum": "fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077",
|
||||
"_spec": "is-stream@^2.0.0",
|
||||
"_where": "C:\\Users\\zhouxueli\\Desktop\\scheduling-app\\node_modules\\default-gateway\\node_modules\\execa",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/is-stream/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Check if something is a Node.js stream",
|
||||
"devDependencies": {
|
||||
"@types/node": "^11.13.6",
|
||||
"ava": "^1.4.1",
|
||||
"tempy": "^0.3.0",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"homepage": "https://github.com/sindresorhus/is-stream#readme",
|
||||
"keywords": [
|
||||
"stream",
|
||||
"type",
|
||||
"streams",
|
||||
"writable",
|
||||
"readable",
|
||||
"duplex",
|
||||
"transform",
|
||||
"check",
|
||||
"detect",
|
||||
"is"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "is-stream",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/is-stream.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"version": "2.0.1"
|
||||
}
|
60
node_modules/default-gateway/node_modules/is-stream/readme.md
generated
vendored
Normal file
60
node_modules/default-gateway/node_modules/is-stream/readme.md
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
# is-stream
|
||||
|
||||
> Check if something is a [Node.js stream](https://nodejs.org/api/stream.html)
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install is-stream
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const fs = require('fs');
|
||||
const isStream = require('is-stream');
|
||||
|
||||
isStream(fs.createReadStream('unicorn.png'));
|
||||
//=> true
|
||||
|
||||
isStream({});
|
||||
//=> false
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### isStream(stream)
|
||||
|
||||
Returns a `boolean` for whether it's a [`Stream`](https://nodejs.org/api/stream.html#stream_stream).
|
||||
|
||||
#### isStream.writable(stream)
|
||||
|
||||
Returns a `boolean` for whether it's a [`stream.Writable`](https://nodejs.org/api/stream.html#stream_class_stream_writable).
|
||||
|
||||
#### isStream.readable(stream)
|
||||
|
||||
Returns a `boolean` for whether it's a [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable).
|
||||
|
||||
#### isStream.duplex(stream)
|
||||
|
||||
Returns a `boolean` for whether it's a [`stream.Duplex`](https://nodejs.org/api/stream.html#stream_class_stream_duplex).
|
||||
|
||||
#### isStream.transform(stream)
|
||||
|
||||
Returns a `boolean` for whether it's a [`stream.Transform`](https://nodejs.org/api/stream.html#stream_class_stream_transform).
|
||||
|
||||
## Related
|
||||
|
||||
- [is-file-stream](https://github.com/jamestalmage/is-file-stream) - Detect if a stream is a file stream
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-is-stream?utm_source=npm-is-stream&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
89
node_modules/default-gateway/node_modules/npm-run-path/index.d.ts
generated
vendored
Normal file
89
node_modules/default-gateway/node_modules/npm-run-path/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
declare namespace npmRunPath {
|
||||
interface RunPathOptions {
|
||||
/**
|
||||
Working directory.
|
||||
|
||||
@default process.cwd()
|
||||
*/
|
||||
readonly cwd?: string;
|
||||
|
||||
/**
|
||||
PATH to be appended. Default: [`PATH`](https://github.com/sindresorhus/path-key).
|
||||
|
||||
Set it to an empty string to exclude the default PATH.
|
||||
*/
|
||||
readonly path?: string;
|
||||
|
||||
/**
|
||||
Path to the Node.js executable to use in child processes if that is different from the current one. Its directory is pushed to the front of PATH.
|
||||
|
||||
This can be either an absolute path or a path relative to the `cwd` option.
|
||||
|
||||
@default process.execPath
|
||||
*/
|
||||
readonly execPath?: string;
|
||||
}
|
||||
|
||||
interface ProcessEnv {
|
||||
[key: string]: string | undefined;
|
||||
}
|
||||
|
||||
interface EnvOptions {
|
||||
/**
|
||||
Working directory.
|
||||
|
||||
@default process.cwd()
|
||||
*/
|
||||
readonly cwd?: string;
|
||||
|
||||
/**
|
||||
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.
|
||||
*/
|
||||
readonly env?: ProcessEnv;
|
||||
|
||||
/**
|
||||
Path to the current Node.js executable. Its directory is pushed to the front of PATH.
|
||||
|
||||
This can be either an absolute path or a path relative to the `cwd` option.
|
||||
|
||||
@default process.execPath
|
||||
*/
|
||||
readonly execPath?: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare const npmRunPath: {
|
||||
/**
|
||||
Get your [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) prepended with locally installed binaries.
|
||||
|
||||
@returns The augmented path string.
|
||||
|
||||
@example
|
||||
```
|
||||
import * as childProcess from 'child_process';
|
||||
import 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()
|
||||
});
|
||||
```
|
||||
*/
|
||||
(options?: npmRunPath.RunPathOptions): string;
|
||||
|
||||
/**
|
||||
@returns The augmented [`process.env`](https://nodejs.org/api/process.html#process_process_env) object.
|
||||
*/
|
||||
env(options?: npmRunPath.EnvOptions): npmRunPath.ProcessEnv;
|
||||
|
||||
// TODO: Remove this for the next major release
|
||||
default: typeof npmRunPath;
|
||||
};
|
||||
|
||||
export = npmRunPath;
|
47
node_modules/default-gateway/node_modules/npm-run-path/index.js
generated
vendored
Normal file
47
node_modules/default-gateway/node_modules/npm-run-path/index.js
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const pathKey = require('path-key');
|
||||
|
||||
const npmRunPath = options => {
|
||||
options = {
|
||||
cwd: process.cwd(),
|
||||
path: process.env[pathKey()],
|
||||
execPath: process.execPath,
|
||||
...options
|
||||
};
|
||||
|
||||
let previous;
|
||||
let cwdPath = path.resolve(options.cwd);
|
||||
const result = [];
|
||||
|
||||
while (previous !== cwdPath) {
|
||||
result.push(path.join(cwdPath, 'node_modules/.bin'));
|
||||
previous = cwdPath;
|
||||
cwdPath = path.resolve(cwdPath, '..');
|
||||
}
|
||||
|
||||
// Ensure the running `node` binary is used
|
||||
const execPathDir = path.resolve(options.cwd, options.execPath, '..');
|
||||
result.push(execPathDir);
|
||||
|
||||
return result.concat(options.path).join(path.delimiter);
|
||||
};
|
||||
|
||||
module.exports = npmRunPath;
|
||||
// TODO: Remove this for the next major release
|
||||
module.exports.default = npmRunPath;
|
||||
|
||||
module.exports.env = options => {
|
||||
options = {
|
||||
env: process.env,
|
||||
...options
|
||||
};
|
||||
|
||||
const env = {...options.env};
|
||||
const path = pathKey({env});
|
||||
|
||||
options.path = env[path];
|
||||
env[path] = module.exports(options);
|
||||
|
||||
return env;
|
||||
};
|
9
node_modules/default-gateway/node_modules/npm-run-path/license
generated
vendored
Normal file
9
node_modules/default-gateway/node_modules/npm-run-path/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.
|
76
node_modules/default-gateway/node_modules/npm-run-path/package.json
generated
vendored
Normal file
76
node_modules/default-gateway/node_modules/npm-run-path/package.json
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
{
|
||||
"_from": "npm-run-path@^4.0.1",
|
||||
"_id": "npm-run-path@4.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
|
||||
"_location": "/default-gateway/npm-run-path",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "npm-run-path@^4.0.1",
|
||||
"name": "npm-run-path",
|
||||
"escapedName": "npm-run-path",
|
||||
"rawSpec": "^4.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^4.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/default-gateway/execa"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
|
||||
"_shasum": "b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea",
|
||||
"_spec": "npm-run-path@^4.0.1",
|
||||
"_where": "C:\\Users\\zhouxueli\\Desktop\\scheduling-app\\node_modules\\default-gateway\\node_modules\\execa",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/npm-run-path/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"path-key": "^3.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Get your PATH prepended with locally installed binaries",
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/npm-run-path#readme",
|
||||
"keywords": [
|
||||
"npm",
|
||||
"run",
|
||||
"path",
|
||||
"package",
|
||||
"bin",
|
||||
"binary",
|
||||
"binaries",
|
||||
"script",
|
||||
"cli",
|
||||
"command-line",
|
||||
"execute",
|
||||
"executable"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "npm-run-path",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/npm-run-path.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"version": "4.0.1"
|
||||
}
|
115
node_modules/default-gateway/node_modules/npm-run-path/readme.md
generated
vendored
Normal file
115
node_modules/default-gateway/node_modules/npm-run-path/readme.md
generated
vendored
Normal file
@ -0,0 +1,115 @@
|
||||
# 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 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?)
|
||||
|
||||
Returns the augmented path string.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### 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.
|
||||
|
||||
##### execPath
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `process.execPath`
|
||||
|
||||
Path to the current Node.js executable. Its directory is pushed to the front of PATH.
|
||||
|
||||
This can be either an absolute path or a path relative to the [`cwd` option](#cwd).
|
||||
|
||||
### npmRunPath.env(options?)
|
||||
|
||||
Returns the augmented [`process.env`](https://nodejs.org/api/process.html#process_process_env) object.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### 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.
|
||||
|
||||
##### execPath
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `process.execPath`
|
||||
|
||||
Path to the Node.js executable to use in child processes if that is different from the current one. Its directory is pushed to the front of PATH.
|
||||
|
||||
This can be either an absolute path or a path relative to the [`cwd` option](#cwd).
|
||||
|
||||
|
||||
## 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
|
||||
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-npm-run-path?utm_source=npm-npm-run-path&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
40
node_modules/default-gateway/node_modules/path-key/index.d.ts
generated
vendored
Normal file
40
node_modules/default-gateway/node_modules/path-key/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
declare namespace pathKey {
|
||||
interface Options {
|
||||
/**
|
||||
Use a custom environment variables object. Default: [`process.env`](https://nodejs.org/api/process.html#process_process_env).
|
||||
*/
|
||||
readonly env?: {[key: string]: string | undefined};
|
||||
|
||||
/**
|
||||
Get the PATH key for a specific platform. Default: [`process.platform`](https://nodejs.org/api/process.html#process_process_platform).
|
||||
*/
|
||||
readonly platform?: NodeJS.Platform;
|
||||
}
|
||||
}
|
||||
|
||||
declare const pathKey: {
|
||||
/**
|
||||
Get the [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) environment variable key cross-platform.
|
||||
|
||||
@example
|
||||
```
|
||||
import pathKey = require('path-key');
|
||||
|
||||
const key = pathKey();
|
||||
//=> 'PATH'
|
||||
|
||||
const PATH = process.env[key];
|
||||
//=> '/usr/local/bin:/usr/bin:/bin'
|
||||
```
|
||||
*/
|
||||
(options?: pathKey.Options): string;
|
||||
|
||||
// TODO: Remove this for the next major release, refactor the whole definition to:
|
||||
// declare function pathKey(options?: pathKey.Options): string;
|
||||
// export = pathKey;
|
||||
default: typeof pathKey;
|
||||
};
|
||||
|
||||
export = pathKey;
|
16
node_modules/default-gateway/node_modules/path-key/index.js
generated
vendored
Normal file
16
node_modules/default-gateway/node_modules/path-key/index.js
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
const pathKey = (options = {}) => {
|
||||
const environment = options.env || process.env;
|
||||
const platform = options.platform || process.platform;
|
||||
|
||||
if (platform !== 'win32') {
|
||||
return 'PATH';
|
||||
}
|
||||
|
||||
return Object.keys(environment).reverse().find(key => key.toUpperCase() === 'PATH') || 'Path';
|
||||
};
|
||||
|
||||
module.exports = pathKey;
|
||||
// TODO: Remove this for the next major release
|
||||
module.exports.default = pathKey;
|
9
node_modules/default-gateway/node_modules/path-key/license
generated
vendored
Normal file
9
node_modules/default-gateway/node_modules/path-key/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.
|
72
node_modules/default-gateway/node_modules/path-key/package.json
generated
vendored
Normal file
72
node_modules/default-gateway/node_modules/path-key/package.json
generated
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
{
|
||||
"_from": "path-key@^3.1.0",
|
||||
"_id": "path-key@3.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
|
||||
"_location": "/default-gateway/path-key",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "path-key@^3.1.0",
|
||||
"name": "path-key",
|
||||
"escapedName": "path-key",
|
||||
"rawSpec": "^3.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/default-gateway/cross-spawn",
|
||||
"/default-gateway/npm-run-path"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
|
||||
"_shasum": "581f6ade658cbba65a0d3380de7753295054f375",
|
||||
"_spec": "path-key@^3.1.0",
|
||||
"_where": "C:\\Users\\zhouxueli\\Desktop\\scheduling-app\\node_modules\\default-gateway\\node_modules\\cross-spawn",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/path-key/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Get the PATH environment variable key cross-platform",
|
||||
"devDependencies": {
|
||||
"@types/node": "^11.13.0",
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/path-key#readme",
|
||||
"keywords": [
|
||||
"path",
|
||||
"key",
|
||||
"environment",
|
||||
"env",
|
||||
"variable",
|
||||
"var",
|
||||
"get",
|
||||
"cross-platform",
|
||||
"windows"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "path-key",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/path-key.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"version": "3.1.1"
|
||||
}
|
61
node_modules/default-gateway/node_modules/path-key/readme.md
generated
vendored
Normal file
61
node_modules/default-gateway/node_modules/path-key/readme.md
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
# 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 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
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### 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.
|
||||
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-path-key?utm_source=npm-path-key&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
19
node_modules/default-gateway/node_modules/shebang-command/index.js
generated
vendored
Normal file
19
node_modules/default-gateway/node_modules/shebang-command/index.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
const shebangRegex = require('shebang-regex');
|
||||
|
||||
module.exports = (string = '') => {
|
||||
const match = string.match(shebangRegex);
|
||||
|
||||
if (!match) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const [path, argument] = match[0].replace(/#! ?/, '').split(' ');
|
||||
const binary = path.split('/').pop();
|
||||
|
||||
if (binary === 'env') {
|
||||
return argument;
|
||||
}
|
||||
|
||||
return argument ? `${binary} ${argument}` : binary;
|
||||
};
|
9
node_modules/default-gateway/node_modules/shebang-command/license
generated
vendored
Normal file
9
node_modules/default-gateway/node_modules/shebang-command/license
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Kevin Mårtensson <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.
|
66
node_modules/default-gateway/node_modules/shebang-command/package.json
generated
vendored
Normal file
66
node_modules/default-gateway/node_modules/shebang-command/package.json
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
{
|
||||
"_from": "shebang-command@^2.0.0",
|
||||
"_id": "shebang-command@2.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
|
||||
"_location": "/default-gateway/shebang-command",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "shebang-command@^2.0.0",
|
||||
"name": "shebang-command",
|
||||
"escapedName": "shebang-command",
|
||||
"rawSpec": "^2.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/default-gateway/cross-spawn"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
||||
"_shasum": "ccd0af4f8835fbdc265b82461aaf0c36663f34ea",
|
||||
"_spec": "shebang-command@^2.0.0",
|
||||
"_where": "C:\\Users\\zhouxueli\\Desktop\\scheduling-app\\node_modules\\default-gateway\\node_modules\\cross-spawn",
|
||||
"author": {
|
||||
"name": "Kevin Mårtensson",
|
||||
"email": "kevinmartensson@gmail.com",
|
||||
"url": "github.com/kevva"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/kevva/shebang-command/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"shebang-regex": "^3.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Get the command from a shebang",
|
||||
"devDependencies": {
|
||||
"ava": "^2.3.0",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/kevva/shebang-command#readme",
|
||||
"keywords": [
|
||||
"cmd",
|
||||
"command",
|
||||
"parse",
|
||||
"shebang"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "shebang-command",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/kevva/shebang-command.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "2.0.0"
|
||||
}
|
34
node_modules/default-gateway/node_modules/shebang-command/readme.md
generated
vendored
Normal file
34
node_modules/default-gateway/node_modules/shebang-command/readme.md
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
# shebang-command [](https://travis-ci.org/kevva/shebang-command)
|
||||
|
||||
> Get the command from a shebang
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install 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.
|
22
node_modules/default-gateway/node_modules/shebang-regex/index.d.ts
generated
vendored
Normal file
22
node_modules/default-gateway/node_modules/shebang-regex/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
Regular expression for matching a [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) line.
|
||||
|
||||
@example
|
||||
```
|
||||
import shebangRegex = require('shebang-regex');
|
||||
|
||||
const string = '#!/usr/bin/env node\nconsole.log("unicorns");';
|
||||
|
||||
shebangRegex.test(string);
|
||||
//=> true
|
||||
|
||||
shebangRegex.exec(string)[0];
|
||||
//=> '#!/usr/bin/env node'
|
||||
|
||||
shebangRegex.exec(string)[1];
|
||||
//=> '/usr/bin/env node'
|
||||
```
|
||||
*/
|
||||
declare const shebangRegex: RegExp;
|
||||
|
||||
export = shebangRegex;
|
2
node_modules/default-gateway/node_modules/shebang-regex/index.js
generated
vendored
Normal file
2
node_modules/default-gateway/node_modules/shebang-regex/index.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
module.exports = /^#!(.*)/;
|
9
node_modules/default-gateway/node_modules/shebang-regex/license
generated
vendored
Normal file
9
node_modules/default-gateway/node_modules/shebang-regex/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.
|
67
node_modules/default-gateway/node_modules/shebang-regex/package.json
generated
vendored
Normal file
67
node_modules/default-gateway/node_modules/shebang-regex/package.json
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
{
|
||||
"_from": "shebang-regex@^3.0.0",
|
||||
"_id": "shebang-regex@3.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
|
||||
"_location": "/default-gateway/shebang-regex",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "shebang-regex@^3.0.0",
|
||||
"name": "shebang-regex",
|
||||
"escapedName": "shebang-regex",
|
||||
"rawSpec": "^3.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/default-gateway/shebang-command"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
|
||||
"_shasum": "ae16f1644d873ecad843b0307b143362d4c42172",
|
||||
"_spec": "shebang-regex@^3.0.0",
|
||||
"_where": "C:\\Users\\zhouxueli\\Desktop\\scheduling-app\\node_modules\\default-gateway\\node_modules\\shebang-command",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/shebang-regex/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Regular expression for matching a shebang line",
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/shebang-regex#readme",
|
||||
"keywords": [
|
||||
"regex",
|
||||
"regexp",
|
||||
"shebang",
|
||||
"match",
|
||||
"test",
|
||||
"line"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "shebang-regex",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/shebang-regex.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"version": "3.0.0"
|
||||
}
|
33
node_modules/default-gateway/node_modules/shebang-regex/readme.md
generated
vendored
Normal file
33
node_modules/default-gateway/node_modules/shebang-regex/readme.md
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
# shebang-regex [](https://travis-ci.org/sindresorhus/shebang-regex)
|
||||
|
||||
> Regular expression for matching a [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) line
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install shebang-regex
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const shebangRegex = require('shebang-regex');
|
||||
|
||||
const string = '#!/usr/bin/env node\nconsole.log("unicorns");';
|
||||
|
||||
shebangRegex.test(string);
|
||||
//=> true
|
||||
|
||||
shebangRegex.exec(string)[0];
|
||||
//=> '#!/usr/bin/env node'
|
||||
|
||||
shebangRegex.exec(string)[1];
|
||||
//=> '/usr/bin/env node'
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
166
node_modules/default-gateway/node_modules/which/CHANGELOG.md
generated
vendored
Normal file
166
node_modules/default-gateway/node_modules/which/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,166 @@
|
||||
# Changes
|
||||
|
||||
|
||||
## 2.0.2
|
||||
|
||||
* Rename bin to `node-which`
|
||||
|
||||
## 2.0.1
|
||||
|
||||
* generate changelog and publish on version bump
|
||||
* enforce 100% test coverage
|
||||
* Promise interface
|
||||
|
||||
## 2.0.0
|
||||
|
||||
* Parallel tests, modern JavaScript, and drop support for node < 8
|
||||
|
||||
## 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
node_modules/default-gateway/node_modules/which/LICENSE
generated
vendored
Normal file
15
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.
|
54
node_modules/default-gateway/node_modules/which/README.md
generated
vendored
Normal file
54
node_modules/default-gateway/node_modules/which/README.md
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
# 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
|
||||
})
|
||||
|
||||
// or promise
|
||||
which('node').then(resolvedPath => { ... }).catch(er => { ... not found ... })
|
||||
|
||||
// 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
node_modules/default-gateway/node_modules/which/bin/node-which
generated
vendored
Normal file
52
node_modules/default-gateway/node_modules/which/bin/node-which
generated
vendored
Normal 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))
|
76
node_modules/default-gateway/node_modules/which/package.json
generated
vendored
Normal file
76
node_modules/default-gateway/node_modules/which/package.json
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
{
|
||||
"_from": "which@^2.0.1",
|
||||
"_id": "which@2.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
||||
"_location": "/default-gateway/which",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "which@^2.0.1",
|
||||
"name": "which",
|
||||
"escapedName": "which",
|
||||
"rawSpec": "^2.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/default-gateway/cross-spawn"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||
"_shasum": "7c6a8dd0a636a0327e10b59c9286eee93f3f51b1",
|
||||
"_spec": "which@^2.0.1",
|
||||
"_where": "C:\\Users\\zhouxueli\\Desktop\\scheduling-app\\node_modules\\default-gateway\\node_modules\\cross-spawn",
|
||||
"author": {
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"email": "i@izs.me",
|
||||
"url": "http://blog.izs.me"
|
||||
},
|
||||
"bin": {
|
||||
"node-which": "bin/node-which"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/isaacs/node-which/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"isexe": "^2.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Like which(1) unix command. Find the first instance of an executable in the PATH.",
|
||||
"devDependencies": {
|
||||
"mkdirp": "^0.5.0",
|
||||
"rimraf": "^2.6.2",
|
||||
"tap": "^14.6.9"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
},
|
||||
"files": [
|
||||
"which.js",
|
||||
"bin/node-which"
|
||||
],
|
||||
"homepage": "https://github.com/isaacs/node-which#readme",
|
||||
"license": "ISC",
|
||||
"main": "which.js",
|
||||
"name": "which",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/isaacs/node-which.git"
|
||||
},
|
||||
"scripts": {
|
||||
"changelog": "git add CHANGELOG.md",
|
||||
"postchangelog": "git commit -m 'update changelog - '${npm_package_version}",
|
||||
"postpublish": "git push origin --follow-tags",
|
||||
"postversion": "npm publish",
|
||||
"prechangelog": "bash gen-changelog.sh",
|
||||
"prepublish": "npm run changelog",
|
||||
"preversion": "npm test",
|
||||
"test": "tap"
|
||||
},
|
||||
"tap": {
|
||||
"check-coverage": true
|
||||
},
|
||||
"version": "2.0.2"
|
||||
}
|
125
node_modules/default-gateway/node_modules/which/which.js
generated
vendored
Normal file
125
node_modules/default-gateway/node_modules/which/which.js
generated
vendored
Normal file
@ -0,0 +1,125 @@
|
||||
const isWindows = process.platform === 'win32' ||
|
||||
process.env.OSTYPE === 'cygwin' ||
|
||||
process.env.OSTYPE === 'msys'
|
||||
|
||||
const path = require('path')
|
||||
const COLON = isWindows ? ';' : ':'
|
||||
const isexe = require('isexe')
|
||||
|
||||
const getNotFoundError = (cmd) =>
|
||||
Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' })
|
||||
|
||||
const getPathInfo = (cmd, opt) => {
|
||||
const colon = opt.colon || COLON
|
||||
|
||||
// If it has a slash, then we don't bother searching the pathenv.
|
||||
// just check the file itself, and that's it.
|
||||
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? ['']
|
||||
: (
|
||||
[
|
||||
// windows always checks the cwd first
|
||||
...(isWindows ? [process.cwd()] : []),
|
||||
...(opt.path || process.env.PATH ||
|
||||
/* istanbul ignore next: very unusual */ '').split(colon),
|
||||
]
|
||||
)
|
||||
const pathExtExe = isWindows
|
||||
? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM'
|
||||
: ''
|
||||
const pathExt = isWindows ? pathExtExe.split(colon) : ['']
|
||||
|
||||
if (isWindows) {
|
||||
if (cmd.indexOf('.') !== -1 && pathExt[0] !== '')
|
||||
pathExt.unshift('')
|
||||
}
|
||||
|
||||
return {
|
||||
pathEnv,
|
||||
pathExt,
|
||||
pathExtExe,
|
||||
}
|
||||
}
|
||||
|
||||
const which = (cmd, opt, cb) => {
|
||||
if (typeof opt === 'function') {
|
||||
cb = opt
|
||||
opt = {}
|
||||
}
|
||||
if (!opt)
|
||||
opt = {}
|
||||
|
||||
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)
|
||||
const found = []
|
||||
|
||||
const step = i => new Promise((resolve, reject) => {
|
||||
if (i === pathEnv.length)
|
||||
return opt.all && found.length ? resolve(found)
|
||||
: reject(getNotFoundError(cmd))
|
||||
|
||||
const ppRaw = pathEnv[i]
|
||||
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw
|
||||
|
||||
const pCmd = path.join(pathPart, cmd)
|
||||
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd
|
||||
: pCmd
|
||||
|
||||
resolve(subStep(p, i, 0))
|
||||
})
|
||||
|
||||
const subStep = (p, i, ii) => new Promise((resolve, reject) => {
|
||||
if (ii === pathExt.length)
|
||||
return resolve(step(i + 1))
|
||||
const ext = pathExt[ii]
|
||||
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
||||
if (!er && is) {
|
||||
if (opt.all)
|
||||
found.push(p + ext)
|
||||
else
|
||||
return resolve(p + ext)
|
||||
}
|
||||
return resolve(subStep(p, i, ii + 1))
|
||||
})
|
||||
})
|
||||
|
||||
return cb ? step(0).then(res => cb(null, res), cb) : step(0)
|
||||
}
|
||||
|
||||
const whichSync = (cmd, opt) => {
|
||||
opt = opt || {}
|
||||
|
||||
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)
|
||||
const found = []
|
||||
|
||||
for (let i = 0; i < pathEnv.length; i ++) {
|
||||
const ppRaw = pathEnv[i]
|
||||
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw
|
||||
|
||||
const pCmd = path.join(pathPart, cmd)
|
||||
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd
|
||||
: pCmd
|
||||
|
||||
for (let j = 0; j < pathExt.length; j ++) {
|
||||
const cur = p + pathExt[j]
|
||||
try {
|
||||
const 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)
|
||||
}
|
||||
|
||||
module.exports = which
|
||||
which.sync = whichSync
|
47
node_modules/default-gateway/openbsd.js
generated
vendored
Normal file
47
node_modules/default-gateway/openbsd.js
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
|
||||
const {isIP} = require("net");
|
||||
const execa = require("execa");
|
||||
const dests = new Set(["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.has(target) && gateway && isIP(gateway)) {
|
||||
result = {gateway, interface: (iface ? iface : null)};
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if (!result) {
|
||||
throw new Error("Unable to determine default gateway");
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
const promise = async family => {
|
||||
const {stdout} = await execa("netstat", args[family]);
|
||||
return parse(stdout);
|
||||
};
|
||||
|
||||
const sync = family => {
|
||||
const {stdout} = execa.sync("netstat", args[family]);
|
||||
return parse(stdout);
|
||||
};
|
||||
|
||||
module.exports.v4 = () => promise("v4");
|
||||
module.exports.v6 = () => promise("v6");
|
||||
|
||||
module.exports.v4.sync = () => sync("v4");
|
||||
module.exports.v6.sync = () => sync("v6");
|
83
node_modules/default-gateway/package.json
generated
vendored
Normal file
83
node_modules/default-gateway/package.json
generated
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
{
|
||||
"_from": "default-gateway@^6.0.3",
|
||||
"_id": "default-gateway@6.0.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-fwSOJsbbNzZ/CUFpqFBqYfYNLj1NbMPm8MMCIzHjC83iSJRBEGmDUxU+WP661BaBQImeC2yHwXtz+P/O9o+XEg==",
|
||||
"_location": "/default-gateway",
|
||||
"_phantomChildren": {
|
||||
"human-signals": "2.1.0",
|
||||
"isexe": "2.0.0",
|
||||
"merge-stream": "2.0.0",
|
||||
"onetime": "5.1.2",
|
||||
"signal-exit": "3.0.7",
|
||||
"strip-final-newline": "2.0.0"
|
||||
},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "default-gateway@^6.0.3",
|
||||
"name": "default-gateway",
|
||||
"escapedName": "default-gateway",
|
||||
"rawSpec": "^6.0.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^6.0.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@vue/cli-service",
|
||||
"/webpack-dev-server"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/default-gateway/-/default-gateway-6.0.3.tgz",
|
||||
"_shasum": "819494c888053bdb743edbf343d6cdf7f2943a71",
|
||||
"_spec": "default-gateway@^6.0.3",
|
||||
"_where": "C:\\Users\\zhouxueli\\Desktop\\scheduling-app\\node_modules\\@vue\\cli-service",
|
||||
"author": {
|
||||
"name": "silverwind"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/silverwind/default-gateway/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"execa": "^5.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Get the default network gateway, cross-platform.",
|
||||
"devDependencies": {
|
||||
"eslint": "7.17.0",
|
||||
"eslint-config-silverwind": "27.0.0",
|
||||
"jest": "26.6.3",
|
||||
"updates": "11.4.2",
|
||||
"versions": "8.4.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"android.js",
|
||||
"darwin.js",
|
||||
"freebsd.js",
|
||||
"linux.js",
|
||||
"openbsd.js",
|
||||
"sunos.js",
|
||||
"win32.js",
|
||||
"ibmi.js"
|
||||
],
|
||||
"homepage": "https://github.com/silverwind/default-gateway#readme",
|
||||
"keywords": [
|
||||
"default gateway",
|
||||
"network",
|
||||
"default",
|
||||
"gateway",
|
||||
"routing",
|
||||
"route"
|
||||
],
|
||||
"license": "BSD-2-Clause",
|
||||
"main": "index.js",
|
||||
"name": "default-gateway",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/silverwind/default-gateway.git"
|
||||
},
|
||||
"version": "6.0.3"
|
||||
}
|
47
node_modules/default-gateway/sunos.js
generated
vendored
Normal file
47
node_modules/default-gateway/sunos.js
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
|
||||
const {isIP} = require("net");
|
||||
const execa = require("execa");
|
||||
const dests = new Set(["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.has(target) && gateway && isIP(gateway)) {
|
||||
result = {gateway, interface: (iface ? iface : null)};
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if (!result) {
|
||||
throw new Error("Unable to determine default gateway");
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
const promise = async family => {
|
||||
const {stdout} = await execa("netstat", args[family]);
|
||||
return parse(stdout);
|
||||
};
|
||||
|
||||
const sync = family => {
|
||||
const {stdout} = execa.sync("netstat", args[family]);
|
||||
return parse(stdout);
|
||||
};
|
||||
|
||||
module.exports.v4 = () => promise("v4");
|
||||
module.exports.v6 = () => promise("v6");
|
||||
|
||||
module.exports.v4.sync = () => sync("v4");
|
||||
module.exports.v6.sync = () => sync("v6");
|
99
node_modules/default-gateway/win32.js
generated
vendored
Normal file
99
node_modules/default-gateway/win32.js
generated
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
"use strict";
|
||||
|
||||
const {isIP} = require("net");
|
||||
const {networkInterfaces} = require("os");
|
||||
const execa = require("execa");
|
||||
|
||||
const gwArgs = "path Win32_NetworkAdapterConfiguration where IPEnabled=true get DefaultIPGateway,GatewayCostMetric,IPConnectionMetric,Index /format:table".split(" ");
|
||||
const ifArgs = index => `path Win32_NetworkAdapter where Index=${index} get NetConnectionID,MACAddress /format:table`.split(" ");
|
||||
|
||||
const spawnOpts = {
|
||||
windowsHide: true,
|
||||
};
|
||||
|
||||
// Parsing tables like this. The final metric is GatewayCostMetric + IPConnectionMetric
|
||||
//
|
||||
// DefaultIPGateway GatewayCostMetric Index IPConnectionMetric
|
||||
// {"1.2.3.4", "2001:db8::1"} {0, 256} 12 25
|
||||
// {"2.3.4.5"} {25} 12 55
|
||||
function parseGwTable(gwTable, family) {
|
||||
let [bestGw, bestMetric, bestId] = [null, null, null];
|
||||
|
||||
for (let line of (gwTable || "").trim().split(/\r?\n/).splice(1)) {
|
||||
line = line.trim();
|
||||
const [_, gwArr, gwCostsArr, id, ipMetric] = /({.+?}) +?({.+?}) +?([0-9]+) +?([0-9]+)/g.exec(line) || [];
|
||||
if (!gwArr) continue;
|
||||
|
||||
const gateways = (gwArr.match(/"(.+?)"/g) || []).map(match => match.substring(1, match.length - 1));
|
||||
const gatewayCosts = (gwCostsArr.match(/[0-9]+/g) || []);
|
||||
|
||||
for (const [index, gateway] of Object.entries(gateways)) {
|
||||
if (!gateway || `v${isIP(gateway)}` !== family) continue;
|
||||
|
||||
const metric = parseInt(gatewayCosts[index]) + parseInt(ipMetric);
|
||||
if (!bestGw || metric < bestMetric) {
|
||||
[bestGw, bestMetric, bestId] = [gateway, metric, id];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bestGw) return [bestGw, bestId];
|
||||
}
|
||||
|
||||
function parseIfTable(ifTable) {
|
||||
const line = (ifTable || "").trim().split("\n")[1];
|
||||
|
||||
let [mac, name] = line.trim().split(/\s+/);
|
||||
mac = mac.toLowerCase();
|
||||
|
||||
// try to get the interface name by matching the mac to os.networkInterfaces to avoid wmic's encoding issues
|
||||
// https://github.com/silverwind/default-gateway/issues/14
|
||||
for (const [osname, addrs] of Object.entries(networkInterfaces())) {
|
||||
for (const addr of addrs) {
|
||||
if (addr && addr.mac && addr.mac.toLowerCase() === mac) {
|
||||
return osname;
|
||||
}
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
const promise = async family => {
|
||||
const {stdout} = await execa("wmic", gwArgs, spawnOpts);
|
||||
const [gateway, id] = parseGwTable(stdout, family) || [];
|
||||
|
||||
if (!gateway) {
|
||||
throw new Error("Unable to determine default gateway");
|
||||
}
|
||||
|
||||
let name;
|
||||
if (id) {
|
||||
const {stdout} = await execa("wmic", ifArgs(id), spawnOpts);
|
||||
name = parseIfTable(stdout);
|
||||
}
|
||||
|
||||
return {gateway, interface: name ? name : null};
|
||||
};
|
||||
|
||||
const sync = family => {
|
||||
const {stdout} = execa.sync("wmic", gwArgs, spawnOpts);
|
||||
const [gateway, id] = parseGwTable(stdout, family) || [];
|
||||
|
||||
if (!gateway) {
|
||||
throw new Error("Unable to determine default gateway");
|
||||
}
|
||||
|
||||
let name;
|
||||
if (id) {
|
||||
const {stdout} = execa.sync("wmic", ifArgs(id), spawnOpts);
|
||||
name = parseIfTable(stdout);
|
||||
}
|
||||
|
||||
return {gateway, interface: name ? name : null};
|
||||
};
|
||||
|
||||
module.exports.v4 = () => promise("v4");
|
||||
module.exports.v6 = () => promise("v6");
|
||||
|
||||
module.exports.v4.sync = () => sync("v4");
|
||||
module.exports.v6.sync = () => sync("v6");
|
Reference in New Issue
Block a user