npm install + git add -a
All checks were successful
Lint / pre-commit Linting (push) Successful in 1m15s
All checks were successful
Lint / pre-commit Linting (push) Successful in 1m15s
This commit is contained in:
12
node_modules/.bin/node-gyp-build
generated
vendored
Normal file
12
node_modules/.bin/node-gyp-build
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/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
|
||||||
|
exec "$basedir/node" "$basedir/../node-gyp-build/bin.js" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../node-gyp-build/bin.js" "$@"
|
||||||
|
fi
|
||||||
12
node_modules/.bin/node-gyp-build-optional
generated
vendored
Normal file
12
node_modules/.bin/node-gyp-build-optional
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/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
|
||||||
|
exec "$basedir/node" "$basedir/../node-gyp-build/optional.js" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../node-gyp-build/optional.js" "$@"
|
||||||
|
fi
|
||||||
17
node_modules/.bin/node-gyp-build-optional.cmd
generated
vendored
Normal file
17
node_modules/.bin/node-gyp-build-optional.cmd
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
@ECHO off
|
||||||
|
GOTO start
|
||||||
|
:find_dp0
|
||||||
|
SET dp0=%~dp0
|
||||||
|
EXIT /b
|
||||||
|
:start
|
||||||
|
SETLOCAL
|
||||||
|
CALL :find_dp0
|
||||||
|
|
||||||
|
IF EXIST "%dp0%\node.exe" (
|
||||||
|
SET "_prog=%dp0%\node.exe"
|
||||||
|
) ELSE (
|
||||||
|
SET "_prog=node"
|
||||||
|
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
|
)
|
||||||
|
|
||||||
|
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\node-gyp-build\optional.js" %*
|
||||||
28
node_modules/.bin/node-gyp-build-optional.ps1
generated
vendored
Normal file
28
node_modules/.bin/node-gyp-build-optional.ps1
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/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") {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "$basedir/node$exe" "$basedir/../node-gyp-build/optional.js" $args
|
||||||
|
} else {
|
||||||
|
& "$basedir/node$exe" "$basedir/../node-gyp-build/optional.js" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "node$exe" "$basedir/../node-gyp-build/optional.js" $args
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../node-gyp-build/optional.js" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
exit $ret
|
||||||
12
node_modules/.bin/node-gyp-build-test
generated
vendored
Normal file
12
node_modules/.bin/node-gyp-build-test
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/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
|
||||||
|
exec "$basedir/node" "$basedir/../node-gyp-build/build-test.js" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../node-gyp-build/build-test.js" "$@"
|
||||||
|
fi
|
||||||
17
node_modules/.bin/node-gyp-build-test.cmd
generated
vendored
Normal file
17
node_modules/.bin/node-gyp-build-test.cmd
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
@ECHO off
|
||||||
|
GOTO start
|
||||||
|
:find_dp0
|
||||||
|
SET dp0=%~dp0
|
||||||
|
EXIT /b
|
||||||
|
:start
|
||||||
|
SETLOCAL
|
||||||
|
CALL :find_dp0
|
||||||
|
|
||||||
|
IF EXIST "%dp0%\node.exe" (
|
||||||
|
SET "_prog=%dp0%\node.exe"
|
||||||
|
) ELSE (
|
||||||
|
SET "_prog=node"
|
||||||
|
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
|
)
|
||||||
|
|
||||||
|
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\node-gyp-build\build-test.js" %*
|
||||||
28
node_modules/.bin/node-gyp-build-test.ps1
generated
vendored
Normal file
28
node_modules/.bin/node-gyp-build-test.ps1
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/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") {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "$basedir/node$exe" "$basedir/../node-gyp-build/build-test.js" $args
|
||||||
|
} else {
|
||||||
|
& "$basedir/node$exe" "$basedir/../node-gyp-build/build-test.js" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "node$exe" "$basedir/../node-gyp-build/build-test.js" $args
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../node-gyp-build/build-test.js" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
exit $ret
|
||||||
17
node_modules/.bin/node-gyp-build.cmd
generated
vendored
Normal file
17
node_modules/.bin/node-gyp-build.cmd
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
@ECHO off
|
||||||
|
GOTO start
|
||||||
|
:find_dp0
|
||||||
|
SET dp0=%~dp0
|
||||||
|
EXIT /b
|
||||||
|
:start
|
||||||
|
SETLOCAL
|
||||||
|
CALL :find_dp0
|
||||||
|
|
||||||
|
IF EXIST "%dp0%\node.exe" (
|
||||||
|
SET "_prog=%dp0%\node.exe"
|
||||||
|
) ELSE (
|
||||||
|
SET "_prog=node"
|
||||||
|
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
|
)
|
||||||
|
|
||||||
|
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\node-gyp-build\bin.js" %*
|
||||||
28
node_modules/.bin/node-gyp-build.ps1
generated
vendored
Normal file
28
node_modules/.bin/node-gyp-build.ps1
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/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") {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "$basedir/node$exe" "$basedir/../node-gyp-build/bin.js" $args
|
||||||
|
} else {
|
||||||
|
& "$basedir/node$exe" "$basedir/../node-gyp-build/bin.js" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "node$exe" "$basedir/../node-gyp-build/bin.js" $args
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../node-gyp-build/bin.js" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
exit $ret
|
||||||
23
node_modules/@isaacs/balanced-match/LICENSE.md
generated
vendored
Normal file
23
node_modules/@isaacs/balanced-match/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
(MIT)
|
||||||
|
|
||||||
|
Original code Copyright Julian Gruber <julian@juliangruber.com>
|
||||||
|
|
||||||
|
Port to TypeScript Copyright Isaac Z. Schlueter <i@izs.me>
|
||||||
|
|
||||||
|
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.
|
||||||
60
node_modules/@isaacs/balanced-match/README.md
generated
vendored
Normal file
60
node_modules/@isaacs/balanced-match/README.md
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
# @isaacs/balanced-match
|
||||||
|
|
||||||
|
A hybrid CJS/ESM TypeScript fork of
|
||||||
|
[balanced-match](http://npm.im/balanced-match).
|
||||||
|
|
||||||
|
Match balanced string pairs, like `{` and `}` or `<b>` and `</b>`. Supports regular expressions as well!
|
||||||
|
|
||||||
|
[](https://github.com/juliangruber/balanced-match/actions/workflows/ci.yml)
|
||||||
|
[](https://www.npmjs.org/package/balanced-match)
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
Get the first matching pair of braces:
|
||||||
|
|
||||||
|
```js
|
||||||
|
import { balanced } from '@isaacs/balanced-match'
|
||||||
|
|
||||||
|
console.log(balanced('{', '}', 'pre{in{nested}}post'))
|
||||||
|
console.log(balanced('{', '}', 'pre{first}between{second}post'))
|
||||||
|
console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post'))
|
||||||
|
```
|
||||||
|
|
||||||
|
The matches are:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ node example.js
|
||||||
|
{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' }
|
||||||
|
{ start: 3,
|
||||||
|
end: 9,
|
||||||
|
pre: 'pre',
|
||||||
|
body: 'first',
|
||||||
|
post: 'between{second}post' }
|
||||||
|
{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' }
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### const m = balanced(a, b, str)
|
||||||
|
|
||||||
|
For the first non-nested matching pair of `a` and `b` in `str`, return an
|
||||||
|
object with those keys:
|
||||||
|
|
||||||
|
- **start** the index of the first match of `a`
|
||||||
|
- **end** the index of the matching `b`
|
||||||
|
- **pre** the preamble, `a` and `b` not included
|
||||||
|
- **body** the match, `a` and `b` not included
|
||||||
|
- **post** the postscript, `a` and `b` not included
|
||||||
|
|
||||||
|
If there's no match, `undefined` will be returned.
|
||||||
|
|
||||||
|
If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`.
|
||||||
|
|
||||||
|
### const r = balanced.range(a, b, str)
|
||||||
|
|
||||||
|
For the first non-nested matching pair of `a` and `b` in `str`, return an
|
||||||
|
array with indexes: `[ <a index>, <b index> ]`.
|
||||||
|
|
||||||
|
If there's no match, `undefined` will be returned.
|
||||||
|
|
||||||
|
If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`.
|
||||||
9
node_modules/@isaacs/balanced-match/dist/commonjs/index.d.ts
generated
vendored
Normal file
9
node_modules/@isaacs/balanced-match/dist/commonjs/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
export declare const balanced: (a: string | RegExp, b: string | RegExp, str: string) => false | {
|
||||||
|
start: number;
|
||||||
|
end: number;
|
||||||
|
pre: string;
|
||||||
|
body: string;
|
||||||
|
post: string;
|
||||||
|
} | undefined;
|
||||||
|
export declare const range: (a: string, b: string, str: string) => undefined | [number, number];
|
||||||
|
//# sourceMappingURL=index.d.ts.map
|
||||||
1
node_modules/@isaacs/balanced-match/dist/commonjs/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@isaacs/balanced-match/dist/commonjs/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,GACnB,GAAG,MAAM,GAAG,MAAM,EAClB,GAAG,MAAM,GAAG,MAAM,EAClB,KAAK,MAAM;;;;;;aAgBZ,CAAA;AAOD,eAAO,MAAM,KAAK,GAChB,GAAG,MAAM,EACT,GAAG,MAAM,EACT,KAAK,MAAM,KACV,SAAS,GAAG,CAAC,MAAM,EAAE,MAAM,CA2C7B,CAAA"}
|
||||||
59
node_modules/@isaacs/balanced-match/dist/commonjs/index.js
generated
vendored
Normal file
59
node_modules/@isaacs/balanced-match/dist/commonjs/index.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.range = exports.balanced = void 0;
|
||||||
|
const balanced = (a, b, str) => {
|
||||||
|
const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
|
||||||
|
const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
|
||||||
|
const r = ma !== null && mb != null && (0, exports.range)(ma, mb, str);
|
||||||
|
return (r && {
|
||||||
|
start: r[0],
|
||||||
|
end: r[1],
|
||||||
|
pre: str.slice(0, r[0]),
|
||||||
|
body: str.slice(r[0] + ma.length, r[1]),
|
||||||
|
post: str.slice(r[1] + mb.length),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
exports.balanced = balanced;
|
||||||
|
const maybeMatch = (reg, str) => {
|
||||||
|
const m = str.match(reg);
|
||||||
|
return m ? m[0] : null;
|
||||||
|
};
|
||||||
|
const range = (a, b, str) => {
|
||||||
|
let begs, beg, left, right = undefined, result;
|
||||||
|
let ai = str.indexOf(a);
|
||||||
|
let bi = str.indexOf(b, ai + 1);
|
||||||
|
let i = ai;
|
||||||
|
if (ai >= 0 && bi > 0) {
|
||||||
|
if (a === b) {
|
||||||
|
return [ai, bi];
|
||||||
|
}
|
||||||
|
begs = [];
|
||||||
|
left = str.length;
|
||||||
|
while (i >= 0 && !result) {
|
||||||
|
if (i === ai) {
|
||||||
|
begs.push(i);
|
||||||
|
ai = str.indexOf(a, i + 1);
|
||||||
|
}
|
||||||
|
else if (begs.length === 1) {
|
||||||
|
const r = begs.pop();
|
||||||
|
if (r !== undefined)
|
||||||
|
result = [r, bi];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
beg = begs.pop();
|
||||||
|
if (beg !== undefined && beg < left) {
|
||||||
|
left = beg;
|
||||||
|
right = bi;
|
||||||
|
}
|
||||||
|
bi = str.indexOf(b, i + 1);
|
||||||
|
}
|
||||||
|
i = ai < bi && ai >= 0 ? ai : bi;
|
||||||
|
}
|
||||||
|
if (begs.length && right !== undefined) {
|
||||||
|
result = [left, right];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
exports.range = range;
|
||||||
|
//# sourceMappingURL=index.js.map
|
||||||
1
node_modules/@isaacs/balanced-match/dist/commonjs/index.js.map
generated
vendored
Normal file
1
node_modules/@isaacs/balanced-match/dist/commonjs/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAO,MAAM,QAAQ,GAAG,CACtB,CAAkB,EAClB,CAAkB,EAClB,GAAW,EACX,EAAE;IACF,MAAM,EAAE,GAAG,CAAC,YAAY,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACvD,MAAM,EAAE,GAAG,CAAC,YAAY,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAEvD,MAAM,CAAC,GAAG,EAAE,KAAK,IAAI,IAAI,EAAE,IAAI,IAAI,IAAI,IAAA,aAAK,EAAC,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAA;IAEzD,OAAO,CACL,CAAC,IAAI;QACH,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;QACX,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;QACT,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACvB,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACvC,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC;KAClC,CACF,CAAA;AACH,CAAC,CAAA;AAnBY,QAAA,QAAQ,YAmBpB;AAED,MAAM,UAAU,GAAG,CAAC,GAAW,EAAE,GAAW,EAAE,EAAE;IAC9C,MAAM,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACxB,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AACxB,CAAC,CAAA;AAEM,MAAM,KAAK,GAAG,CACnB,CAAS,EACT,CAAS,EACT,GAAW,EACmB,EAAE;IAChC,IAAI,IAAc,EAChB,GAAuB,EACvB,IAAY,EACZ,KAAK,GAAuB,SAAS,EACrC,MAAoC,CAAA;IACtC,IAAI,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IACvB,IAAI,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAA;IAC/B,IAAI,CAAC,GAAG,EAAE,CAAA;IAEV,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;QACtB,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YACZ,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;QACjB,CAAC;QACD,IAAI,GAAG,EAAE,CAAA;QACT,IAAI,GAAG,GAAG,CAAC,MAAM,CAAA;QAEjB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACzB,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;gBACb,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;gBACZ,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;YAC5B,CAAC;iBAAM,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC7B,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;gBACpB,IAAI,CAAC,KAAK,SAAS;oBAAE,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;YACvC,CAAC;iBAAM,CAAC;gBACN,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;gBAChB,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,GAAG,IAAI,EAAE,CAAC;oBACpC,IAAI,GAAG,GAAG,CAAA;oBACV,KAAK,GAAG,EAAE,CAAA;gBACZ,CAAC;gBAED,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;YAC5B,CAAC;YAED,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;QAClC,CAAC;QAED,IAAI,IAAI,CAAC,MAAM,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACvC,MAAM,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QACxB,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AA/CY,QAAA,KAAK,SA+CjB","sourcesContent":["export const balanced = (\n a: string | RegExp,\n b: string | RegExp,\n str: string,\n) => {\n const ma = a instanceof RegExp ? maybeMatch(a, str) : a\n const mb = b instanceof RegExp ? maybeMatch(b, str) : b\n\n const r = ma !== null && mb != null && range(ma, mb, str)\n\n return (\n r && {\n start: r[0],\n end: r[1],\n pre: str.slice(0, r[0]),\n body: str.slice(r[0] + ma.length, r[1]),\n post: str.slice(r[1] + mb.length),\n }\n )\n}\n\nconst maybeMatch = (reg: RegExp, str: string) => {\n const m = str.match(reg)\n return m ? m[0] : null\n}\n\nexport const range = (\n a: string,\n b: string,\n str: string,\n): undefined | [number, number] => {\n let begs: number[],\n beg: number | undefined,\n left: number,\n right: number | undefined = undefined,\n result: undefined | [number, number]\n let ai = str.indexOf(a)\n let bi = str.indexOf(b, ai + 1)\n let i = ai\n\n if (ai >= 0 && bi > 0) {\n if (a === b) {\n return [ai, bi]\n }\n begs = []\n left = str.length\n\n while (i >= 0 && !result) {\n if (i === ai) {\n begs.push(i)\n ai = str.indexOf(a, i + 1)\n } else if (begs.length === 1) {\n const r = begs.pop()\n if (r !== undefined) result = [r, bi]\n } else {\n beg = begs.pop()\n if (beg !== undefined && beg < left) {\n left = beg\n right = bi\n }\n\n bi = str.indexOf(b, i + 1)\n }\n\n i = ai < bi && ai >= 0 ? ai : bi\n }\n\n if (begs.length && right !== undefined) {\n result = [left, right]\n }\n }\n\n return result\n}\n"]}
|
||||||
3
node_modules/@isaacs/balanced-match/dist/commonjs/package.json
generated
vendored
Normal file
3
node_modules/@isaacs/balanced-match/dist/commonjs/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"type": "commonjs"
|
||||||
|
}
|
||||||
9
node_modules/@isaacs/balanced-match/dist/esm/index.d.ts
generated
vendored
Normal file
9
node_modules/@isaacs/balanced-match/dist/esm/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
export declare const balanced: (a: string | RegExp, b: string | RegExp, str: string) => false | {
|
||||||
|
start: number;
|
||||||
|
end: number;
|
||||||
|
pre: string;
|
||||||
|
body: string;
|
||||||
|
post: string;
|
||||||
|
} | undefined;
|
||||||
|
export declare const range: (a: string, b: string, str: string) => undefined | [number, number];
|
||||||
|
//# sourceMappingURL=index.d.ts.map
|
||||||
1
node_modules/@isaacs/balanced-match/dist/esm/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@isaacs/balanced-match/dist/esm/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,GACnB,GAAG,MAAM,GAAG,MAAM,EAClB,GAAG,MAAM,GAAG,MAAM,EAClB,KAAK,MAAM;;;;;;aAgBZ,CAAA;AAOD,eAAO,MAAM,KAAK,GAChB,GAAG,MAAM,EACT,GAAG,MAAM,EACT,KAAK,MAAM,KACV,SAAS,GAAG,CAAC,MAAM,EAAE,MAAM,CA2C7B,CAAA"}
|
||||||
54
node_modules/@isaacs/balanced-match/dist/esm/index.js
generated
vendored
Normal file
54
node_modules/@isaacs/balanced-match/dist/esm/index.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
export const balanced = (a, b, str) => {
|
||||||
|
const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
|
||||||
|
const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
|
||||||
|
const r = ma !== null && mb != null && range(ma, mb, str);
|
||||||
|
return (r && {
|
||||||
|
start: r[0],
|
||||||
|
end: r[1],
|
||||||
|
pre: str.slice(0, r[0]),
|
||||||
|
body: str.slice(r[0] + ma.length, r[1]),
|
||||||
|
post: str.slice(r[1] + mb.length),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const maybeMatch = (reg, str) => {
|
||||||
|
const m = str.match(reg);
|
||||||
|
return m ? m[0] : null;
|
||||||
|
};
|
||||||
|
export const range = (a, b, str) => {
|
||||||
|
let begs, beg, left, right = undefined, result;
|
||||||
|
let ai = str.indexOf(a);
|
||||||
|
let bi = str.indexOf(b, ai + 1);
|
||||||
|
let i = ai;
|
||||||
|
if (ai >= 0 && bi > 0) {
|
||||||
|
if (a === b) {
|
||||||
|
return [ai, bi];
|
||||||
|
}
|
||||||
|
begs = [];
|
||||||
|
left = str.length;
|
||||||
|
while (i >= 0 && !result) {
|
||||||
|
if (i === ai) {
|
||||||
|
begs.push(i);
|
||||||
|
ai = str.indexOf(a, i + 1);
|
||||||
|
}
|
||||||
|
else if (begs.length === 1) {
|
||||||
|
const r = begs.pop();
|
||||||
|
if (r !== undefined)
|
||||||
|
result = [r, bi];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
beg = begs.pop();
|
||||||
|
if (beg !== undefined && beg < left) {
|
||||||
|
left = beg;
|
||||||
|
right = bi;
|
||||||
|
}
|
||||||
|
bi = str.indexOf(b, i + 1);
|
||||||
|
}
|
||||||
|
i = ai < bi && ai >= 0 ? ai : bi;
|
||||||
|
}
|
||||||
|
if (begs.length && right !== undefined) {
|
||||||
|
result = [left, right];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
//# sourceMappingURL=index.js.map
|
||||||
1
node_modules/@isaacs/balanced-match/dist/esm/index.js.map
generated
vendored
Normal file
1
node_modules/@isaacs/balanced-match/dist/esm/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,CAAkB,EAClB,CAAkB,EAClB,GAAW,EACX,EAAE;IACF,MAAM,EAAE,GAAG,CAAC,YAAY,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACvD,MAAM,EAAE,GAAG,CAAC,YAAY,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAEvD,MAAM,CAAC,GAAG,EAAE,KAAK,IAAI,IAAI,EAAE,IAAI,IAAI,IAAI,KAAK,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAA;IAEzD,OAAO,CACL,CAAC,IAAI;QACH,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;QACX,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;QACT,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACvB,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACvC,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC;KAClC,CACF,CAAA;AACH,CAAC,CAAA;AAED,MAAM,UAAU,GAAG,CAAC,GAAW,EAAE,GAAW,EAAE,EAAE;IAC9C,MAAM,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACxB,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AACxB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,CAAS,EACT,CAAS,EACT,GAAW,EACmB,EAAE;IAChC,IAAI,IAAc,EAChB,GAAuB,EACvB,IAAY,EACZ,KAAK,GAAuB,SAAS,EACrC,MAAoC,CAAA;IACtC,IAAI,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IACvB,IAAI,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAA;IAC/B,IAAI,CAAC,GAAG,EAAE,CAAA;IAEV,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;QACtB,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YACZ,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;QACjB,CAAC;QACD,IAAI,GAAG,EAAE,CAAA;QACT,IAAI,GAAG,GAAG,CAAC,MAAM,CAAA;QAEjB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACzB,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;gBACb,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;gBACZ,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;YAC5B,CAAC;iBAAM,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC7B,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;gBACpB,IAAI,CAAC,KAAK,SAAS;oBAAE,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;YACvC,CAAC;iBAAM,CAAC;gBACN,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;gBAChB,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,GAAG,IAAI,EAAE,CAAC;oBACpC,IAAI,GAAG,GAAG,CAAA;oBACV,KAAK,GAAG,EAAE,CAAA;gBACZ,CAAC;gBAED,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;YAC5B,CAAC;YAED,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;QAClC,CAAC;QAED,IAAI,IAAI,CAAC,MAAM,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACvC,MAAM,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QACxB,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA","sourcesContent":["export const balanced = (\n a: string | RegExp,\n b: string | RegExp,\n str: string,\n) => {\n const ma = a instanceof RegExp ? maybeMatch(a, str) : a\n const mb = b instanceof RegExp ? maybeMatch(b, str) : b\n\n const r = ma !== null && mb != null && range(ma, mb, str)\n\n return (\n r && {\n start: r[0],\n end: r[1],\n pre: str.slice(0, r[0]),\n body: str.slice(r[0] + ma.length, r[1]),\n post: str.slice(r[1] + mb.length),\n }\n )\n}\n\nconst maybeMatch = (reg: RegExp, str: string) => {\n const m = str.match(reg)\n return m ? m[0] : null\n}\n\nexport const range = (\n a: string,\n b: string,\n str: string,\n): undefined | [number, number] => {\n let begs: number[],\n beg: number | undefined,\n left: number,\n right: number | undefined = undefined,\n result: undefined | [number, number]\n let ai = str.indexOf(a)\n let bi = str.indexOf(b, ai + 1)\n let i = ai\n\n if (ai >= 0 && bi > 0) {\n if (a === b) {\n return [ai, bi]\n }\n begs = []\n left = str.length\n\n while (i >= 0 && !result) {\n if (i === ai) {\n begs.push(i)\n ai = str.indexOf(a, i + 1)\n } else if (begs.length === 1) {\n const r = begs.pop()\n if (r !== undefined) result = [r, bi]\n } else {\n beg = begs.pop()\n if (beg !== undefined && beg < left) {\n left = beg\n right = bi\n }\n\n bi = str.indexOf(b, i + 1)\n }\n\n i = ai < bi && ai >= 0 ? ai : bi\n }\n\n if (begs.length && right !== undefined) {\n result = [left, right]\n }\n }\n\n return result\n}\n"]}
|
||||||
3
node_modules/@isaacs/balanced-match/dist/esm/package.json
generated
vendored
Normal file
3
node_modules/@isaacs/balanced-match/dist/esm/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"type": "module"
|
||||||
|
}
|
||||||
79
node_modules/@isaacs/balanced-match/package.json
generated
vendored
Normal file
79
node_modules/@isaacs/balanced-match/package.json
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
{
|
||||||
|
"name": "@isaacs/balanced-match",
|
||||||
|
"description": "Match balanced character pairs, like \"{\" and \"}\"",
|
||||||
|
"version": "4.0.1",
|
||||||
|
"files": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/isaacs/balanced-match.git"
|
||||||
|
},
|
||||||
|
"exports": {
|
||||||
|
"./package.json": "./package.json",
|
||||||
|
".": {
|
||||||
|
"import": {
|
||||||
|
"types": "./dist/esm/index.d.ts",
|
||||||
|
"default": "./dist/esm/index.js"
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"types": "./dist/commonjs/index.d.ts",
|
||||||
|
"default": "./dist/commonjs/index.js"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"preversion": "npm test",
|
||||||
|
"postversion": "npm publish",
|
||||||
|
"prepublishOnly": "git push origin --follow-tags",
|
||||||
|
"prepare": "tshy",
|
||||||
|
"pretest": "npm run prepare",
|
||||||
|
"presnap": "npm run prepare",
|
||||||
|
"test": "tap",
|
||||||
|
"snap": "tap",
|
||||||
|
"format": "prettier --write . --loglevel warn",
|
||||||
|
"benchmark": "node benchmark/index.js",
|
||||||
|
"typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts"
|
||||||
|
},
|
||||||
|
"prettier": {
|
||||||
|
"semi": false,
|
||||||
|
"printWidth": 80,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"useTabs": false,
|
||||||
|
"singleQuote": true,
|
||||||
|
"jsxSingleQuote": false,
|
||||||
|
"bracketSameLine": true,
|
||||||
|
"arrowParens": "avoid",
|
||||||
|
"endOfLine": "lf"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/brace-expansion": "^1.1.2",
|
||||||
|
"@types/node": "^24.0.0",
|
||||||
|
"mkdirp": "^3.0.1",
|
||||||
|
"prettier": "^3.3.2",
|
||||||
|
"tap": "^21.1.0",
|
||||||
|
"tshy": "^3.0.2",
|
||||||
|
"typedoc": "^0.28.5"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"match",
|
||||||
|
"regexp",
|
||||||
|
"test",
|
||||||
|
"balanced",
|
||||||
|
"parse"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": "20 || >=22"
|
||||||
|
},
|
||||||
|
"tshy": {
|
||||||
|
"exports": {
|
||||||
|
"./package.json": "./package.json",
|
||||||
|
".": "./src/index.ts"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"main": "./dist/commonjs/index.js",
|
||||||
|
"types": "./dist/commonjs/index.d.ts",
|
||||||
|
"module": "./dist/esm/index.js"
|
||||||
|
}
|
||||||
23
node_modules/@isaacs/brace-expansion/LICENSE
generated
vendored
Normal file
23
node_modules/@isaacs/brace-expansion/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright Julian Gruber <julian@juliangruber.com>
|
||||||
|
|
||||||
|
TypeScript port Copyright Isaac Z. Schlueter <i@izs.me>
|
||||||
|
|
||||||
|
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.
|
||||||
86
node_modules/@isaacs/brace-expansion/README.md
generated
vendored
Normal file
86
node_modules/@isaacs/brace-expansion/README.md
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
# @isaacs/brace-expansion
|
||||||
|
|
||||||
|
A hybrid CJS/ESM TypeScript fork of
|
||||||
|
[brace-expansion](http://npm.im/brace-expansion).
|
||||||
|
|
||||||
|
[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html),
|
||||||
|
as known from sh/bash, in JavaScript.
|
||||||
|
|
||||||
|
[](https://github.com/juliangruber/brace-expansion/actions/workflows/ci.yml)
|
||||||
|
[](https://www.npmjs.org/package/brace-expansion)
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```js
|
||||||
|
import { expand } from '@isaacs/brace-expansion'
|
||||||
|
|
||||||
|
expand('file-{a,b,c}.jpg')
|
||||||
|
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
|
||||||
|
|
||||||
|
expand('-v{,,}')
|
||||||
|
// => ['-v', '-v', '-v']
|
||||||
|
|
||||||
|
expand('file{0..2}.jpg')
|
||||||
|
// => ['file0.jpg', 'file1.jpg', 'file2.jpg']
|
||||||
|
|
||||||
|
expand('file-{a..c}.jpg')
|
||||||
|
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
|
||||||
|
|
||||||
|
expand('file{2..0}.jpg')
|
||||||
|
// => ['file2.jpg', 'file1.jpg', 'file0.jpg']
|
||||||
|
|
||||||
|
expand('file{0..4..2}.jpg')
|
||||||
|
// => ['file0.jpg', 'file2.jpg', 'file4.jpg']
|
||||||
|
|
||||||
|
expand('file-{a..e..2}.jpg')
|
||||||
|
// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg']
|
||||||
|
|
||||||
|
expand('file{00..10..5}.jpg')
|
||||||
|
// => ['file00.jpg', 'file05.jpg', 'file10.jpg']
|
||||||
|
|
||||||
|
expand('{{A..C},{a..c}}')
|
||||||
|
// => ['A', 'B', 'C', 'a', 'b', 'c']
|
||||||
|
|
||||||
|
expand('ppp{,config,oe{,conf}}')
|
||||||
|
// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf']
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
```js
|
||||||
|
import { expand } from '@isaacs/brace-expansion'
|
||||||
|
```
|
||||||
|
|
||||||
|
### const expanded = expand(str)
|
||||||
|
|
||||||
|
Return an array of all possible and valid expansions of `str`. If none are
|
||||||
|
found, `[str]` is returned.
|
||||||
|
|
||||||
|
Valid expansions are:
|
||||||
|
|
||||||
|
```js
|
||||||
|
/^(.*,)+(.+)?$/
|
||||||
|
// {a,b,...}
|
||||||
|
```
|
||||||
|
|
||||||
|
A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
|
||||||
|
// {x..y[..incr]}
|
||||||
|
```
|
||||||
|
|
||||||
|
A numeric sequence from `x` to `y` inclusive, with optional increment.
|
||||||
|
If `x` or `y` start with a leading `0`, all the numbers will be padded
|
||||||
|
to have equal length. Negative numbers and backwards iteration work too.
|
||||||
|
|
||||||
|
```js
|
||||||
|
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
|
||||||
|
// {x..y[..incr]}
|
||||||
|
```
|
||||||
|
|
||||||
|
An alphabetic sequence from `x` to `y` inclusive, with optional increment.
|
||||||
|
`x` and `y` must be exactly one character, and if given, `incr` must be a
|
||||||
|
number.
|
||||||
|
|
||||||
|
For compatibility reasons, the string `${` is not eligible for brace expansion.
|
||||||
2
node_modules/@isaacs/brace-expansion/dist/commonjs/index.d.ts
generated
vendored
Normal file
2
node_modules/@isaacs/brace-expansion/dist/commonjs/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
export declare function expand(str: string): string[];
|
||||||
|
//# sourceMappingURL=index.d.ts.map
|
||||||
1
node_modules/@isaacs/brace-expansion/dist/commonjs/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@isaacs/brace-expansion/dist/commonjs/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAwEA,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,YAgBjC"}
|
||||||
196
node_modules/@isaacs/brace-expansion/dist/commonjs/index.js
generated
vendored
Normal file
196
node_modules/@isaacs/brace-expansion/dist/commonjs/index.js
generated
vendored
Normal file
@@ -0,0 +1,196 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.expand = expand;
|
||||||
|
const balanced_match_1 = require("@isaacs/balanced-match");
|
||||||
|
const escSlash = '\0SLASH' + Math.random() + '\0';
|
||||||
|
const escOpen = '\0OPEN' + Math.random() + '\0';
|
||||||
|
const escClose = '\0CLOSE' + Math.random() + '\0';
|
||||||
|
const escComma = '\0COMMA' + Math.random() + '\0';
|
||||||
|
const escPeriod = '\0PERIOD' + Math.random() + '\0';
|
||||||
|
const escSlashPattern = new RegExp(escSlash, 'g');
|
||||||
|
const escOpenPattern = new RegExp(escOpen, 'g');
|
||||||
|
const escClosePattern = new RegExp(escClose, 'g');
|
||||||
|
const escCommaPattern = new RegExp(escComma, 'g');
|
||||||
|
const escPeriodPattern = new RegExp(escPeriod, 'g');
|
||||||
|
const slashPattern = /\\\\/g;
|
||||||
|
const openPattern = /\\{/g;
|
||||||
|
const closePattern = /\\}/g;
|
||||||
|
const commaPattern = /\\,/g;
|
||||||
|
const periodPattern = /\\./g;
|
||||||
|
function numeric(str) {
|
||||||
|
return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
|
||||||
|
}
|
||||||
|
function escapeBraces(str) {
|
||||||
|
return str
|
||||||
|
.replace(slashPattern, escSlash)
|
||||||
|
.replace(openPattern, escOpen)
|
||||||
|
.replace(closePattern, escClose)
|
||||||
|
.replace(commaPattern, escComma)
|
||||||
|
.replace(periodPattern, escPeriod);
|
||||||
|
}
|
||||||
|
function unescapeBraces(str) {
|
||||||
|
return str
|
||||||
|
.replace(escSlashPattern, '\\')
|
||||||
|
.replace(escOpenPattern, '{')
|
||||||
|
.replace(escClosePattern, '}')
|
||||||
|
.replace(escCommaPattern, ',')
|
||||||
|
.replace(escPeriodPattern, '.');
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Basically just str.split(","), but handling cases
|
||||||
|
* where we have nested braced sections, which should be
|
||||||
|
* treated as individual members, like {a,{b,c},d}
|
||||||
|
*/
|
||||||
|
function parseCommaParts(str) {
|
||||||
|
if (!str) {
|
||||||
|
return [''];
|
||||||
|
}
|
||||||
|
const parts = [];
|
||||||
|
const m = (0, balanced_match_1.balanced)('{', '}', str);
|
||||||
|
if (!m) {
|
||||||
|
return str.split(',');
|
||||||
|
}
|
||||||
|
const { pre, body, post } = m;
|
||||||
|
const p = pre.split(',');
|
||||||
|
p[p.length - 1] += '{' + body + '}';
|
||||||
|
const postParts = parseCommaParts(post);
|
||||||
|
if (post.length) {
|
||||||
|
;
|
||||||
|
p[p.length - 1] += postParts.shift();
|
||||||
|
p.push.apply(p, postParts);
|
||||||
|
}
|
||||||
|
parts.push.apply(parts, p);
|
||||||
|
return parts;
|
||||||
|
}
|
||||||
|
function expand(str) {
|
||||||
|
if (!str) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
// I don't know why Bash 4.3 does this, but it does.
|
||||||
|
// Anything starting with {} will have the first two bytes preserved
|
||||||
|
// but *only* at the top level, so {},a}b will not expand to anything,
|
||||||
|
// but a{},b}c will be expanded to [a}c,abc].
|
||||||
|
// One could argue that this is a bug in Bash, but since the goal of
|
||||||
|
// this module is to match Bash's rules, we escape a leading {}
|
||||||
|
if (str.slice(0, 2) === '{}') {
|
||||||
|
str = '\\{\\}' + str.slice(2);
|
||||||
|
}
|
||||||
|
return expand_(escapeBraces(str), true).map(unescapeBraces);
|
||||||
|
}
|
||||||
|
function embrace(str) {
|
||||||
|
return '{' + str + '}';
|
||||||
|
}
|
||||||
|
function isPadded(el) {
|
||||||
|
return /^-?0\d/.test(el);
|
||||||
|
}
|
||||||
|
function lte(i, y) {
|
||||||
|
return i <= y;
|
||||||
|
}
|
||||||
|
function gte(i, y) {
|
||||||
|
return i >= y;
|
||||||
|
}
|
||||||
|
function expand_(str, isTop) {
|
||||||
|
/** @type {string[]} */
|
||||||
|
const expansions = [];
|
||||||
|
const m = (0, balanced_match_1.balanced)('{', '}', str);
|
||||||
|
if (!m)
|
||||||
|
return [str];
|
||||||
|
// no need to expand pre, since it is guaranteed to be free of brace-sets
|
||||||
|
const pre = m.pre;
|
||||||
|
const post = m.post.length ? expand_(m.post, false) : [''];
|
||||||
|
if (/\$$/.test(m.pre)) {
|
||||||
|
for (let k = 0; k < post.length; k++) {
|
||||||
|
const expansion = pre + '{' + m.body + '}' + post[k];
|
||||||
|
expansions.push(expansion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
||||||
|
const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
||||||
|
const isSequence = isNumericSequence || isAlphaSequence;
|
||||||
|
const isOptions = m.body.indexOf(',') >= 0;
|
||||||
|
if (!isSequence && !isOptions) {
|
||||||
|
// {a},b}
|
||||||
|
if (m.post.match(/,(?!,).*\}/)) {
|
||||||
|
str = m.pre + '{' + m.body + escClose + m.post;
|
||||||
|
return expand_(str);
|
||||||
|
}
|
||||||
|
return [str];
|
||||||
|
}
|
||||||
|
let n;
|
||||||
|
if (isSequence) {
|
||||||
|
n = m.body.split(/\.\./);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
n = parseCommaParts(m.body);
|
||||||
|
if (n.length === 1 && n[0] !== undefined) {
|
||||||
|
// x{{a,b}}y ==> x{a}y x{b}y
|
||||||
|
n = expand_(n[0], false).map(embrace);
|
||||||
|
//XXX is this necessary? Can't seem to hit it in tests.
|
||||||
|
/* c8 ignore start */
|
||||||
|
if (n.length === 1) {
|
||||||
|
return post.map(p => m.pre + n[0] + p);
|
||||||
|
}
|
||||||
|
/* c8 ignore stop */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// at this point, n is the parts, and we know it's not a comma set
|
||||||
|
// with a single entry.
|
||||||
|
let N;
|
||||||
|
if (isSequence && n[0] !== undefined && n[1] !== undefined) {
|
||||||
|
const x = numeric(n[0]);
|
||||||
|
const y = numeric(n[1]);
|
||||||
|
const width = Math.max(n[0].length, n[1].length);
|
||||||
|
let incr = n.length === 3 && n[2] !== undefined ? Math.abs(numeric(n[2])) : 1;
|
||||||
|
let test = lte;
|
||||||
|
const reverse = y < x;
|
||||||
|
if (reverse) {
|
||||||
|
incr *= -1;
|
||||||
|
test = gte;
|
||||||
|
}
|
||||||
|
const pad = n.some(isPadded);
|
||||||
|
N = [];
|
||||||
|
for (let i = x; test(i, y); i += incr) {
|
||||||
|
let c;
|
||||||
|
if (isAlphaSequence) {
|
||||||
|
c = String.fromCharCode(i);
|
||||||
|
if (c === '\\') {
|
||||||
|
c = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
c = String(i);
|
||||||
|
if (pad) {
|
||||||
|
const need = width - c.length;
|
||||||
|
if (need > 0) {
|
||||||
|
const z = new Array(need + 1).join('0');
|
||||||
|
if (i < 0) {
|
||||||
|
c = '-' + z + c.slice(1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
c = z + c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
N.push(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
N = [];
|
||||||
|
for (let j = 0; j < n.length; j++) {
|
||||||
|
N.push.apply(N, expand_(n[j], false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let j = 0; j < N.length; j++) {
|
||||||
|
for (let k = 0; k < post.length; k++) {
|
||||||
|
const expansion = pre + N[j] + post[k];
|
||||||
|
if (!isTop || isSequence || expansion) {
|
||||||
|
expansions.push(expansion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return expansions;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=index.js.map
|
||||||
1
node_modules/@isaacs/brace-expansion/dist/commonjs/index.js.map
generated
vendored
Normal file
1
node_modules/@isaacs/brace-expansion/dist/commonjs/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/@isaacs/brace-expansion/dist/commonjs/package.json
generated
vendored
Normal file
3
node_modules/@isaacs/brace-expansion/dist/commonjs/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"type": "commonjs"
|
||||||
|
}
|
||||||
2
node_modules/@isaacs/brace-expansion/dist/esm/index.d.ts
generated
vendored
Normal file
2
node_modules/@isaacs/brace-expansion/dist/esm/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
export declare function expand(str: string): string[];
|
||||||
|
//# sourceMappingURL=index.d.ts.map
|
||||||
1
node_modules/@isaacs/brace-expansion/dist/esm/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@isaacs/brace-expansion/dist/esm/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAwEA,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,YAgBjC"}
|
||||||
193
node_modules/@isaacs/brace-expansion/dist/esm/index.js
generated
vendored
Normal file
193
node_modules/@isaacs/brace-expansion/dist/esm/index.js
generated
vendored
Normal file
@@ -0,0 +1,193 @@
|
|||||||
|
import { balanced } from '@isaacs/balanced-match';
|
||||||
|
const escSlash = '\0SLASH' + Math.random() + '\0';
|
||||||
|
const escOpen = '\0OPEN' + Math.random() + '\0';
|
||||||
|
const escClose = '\0CLOSE' + Math.random() + '\0';
|
||||||
|
const escComma = '\0COMMA' + Math.random() + '\0';
|
||||||
|
const escPeriod = '\0PERIOD' + Math.random() + '\0';
|
||||||
|
const escSlashPattern = new RegExp(escSlash, 'g');
|
||||||
|
const escOpenPattern = new RegExp(escOpen, 'g');
|
||||||
|
const escClosePattern = new RegExp(escClose, 'g');
|
||||||
|
const escCommaPattern = new RegExp(escComma, 'g');
|
||||||
|
const escPeriodPattern = new RegExp(escPeriod, 'g');
|
||||||
|
const slashPattern = /\\\\/g;
|
||||||
|
const openPattern = /\\{/g;
|
||||||
|
const closePattern = /\\}/g;
|
||||||
|
const commaPattern = /\\,/g;
|
||||||
|
const periodPattern = /\\./g;
|
||||||
|
function numeric(str) {
|
||||||
|
return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
|
||||||
|
}
|
||||||
|
function escapeBraces(str) {
|
||||||
|
return str
|
||||||
|
.replace(slashPattern, escSlash)
|
||||||
|
.replace(openPattern, escOpen)
|
||||||
|
.replace(closePattern, escClose)
|
||||||
|
.replace(commaPattern, escComma)
|
||||||
|
.replace(periodPattern, escPeriod);
|
||||||
|
}
|
||||||
|
function unescapeBraces(str) {
|
||||||
|
return str
|
||||||
|
.replace(escSlashPattern, '\\')
|
||||||
|
.replace(escOpenPattern, '{')
|
||||||
|
.replace(escClosePattern, '}')
|
||||||
|
.replace(escCommaPattern, ',')
|
||||||
|
.replace(escPeriodPattern, '.');
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Basically just str.split(","), but handling cases
|
||||||
|
* where we have nested braced sections, which should be
|
||||||
|
* treated as individual members, like {a,{b,c},d}
|
||||||
|
*/
|
||||||
|
function parseCommaParts(str) {
|
||||||
|
if (!str) {
|
||||||
|
return [''];
|
||||||
|
}
|
||||||
|
const parts = [];
|
||||||
|
const m = balanced('{', '}', str);
|
||||||
|
if (!m) {
|
||||||
|
return str.split(',');
|
||||||
|
}
|
||||||
|
const { pre, body, post } = m;
|
||||||
|
const p = pre.split(',');
|
||||||
|
p[p.length - 1] += '{' + body + '}';
|
||||||
|
const postParts = parseCommaParts(post);
|
||||||
|
if (post.length) {
|
||||||
|
;
|
||||||
|
p[p.length - 1] += postParts.shift();
|
||||||
|
p.push.apply(p, postParts);
|
||||||
|
}
|
||||||
|
parts.push.apply(parts, p);
|
||||||
|
return parts;
|
||||||
|
}
|
||||||
|
export function expand(str) {
|
||||||
|
if (!str) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
// I don't know why Bash 4.3 does this, but it does.
|
||||||
|
// Anything starting with {} will have the first two bytes preserved
|
||||||
|
// but *only* at the top level, so {},a}b will not expand to anything,
|
||||||
|
// but a{},b}c will be expanded to [a}c,abc].
|
||||||
|
// One could argue that this is a bug in Bash, but since the goal of
|
||||||
|
// this module is to match Bash's rules, we escape a leading {}
|
||||||
|
if (str.slice(0, 2) === '{}') {
|
||||||
|
str = '\\{\\}' + str.slice(2);
|
||||||
|
}
|
||||||
|
return expand_(escapeBraces(str), true).map(unescapeBraces);
|
||||||
|
}
|
||||||
|
function embrace(str) {
|
||||||
|
return '{' + str + '}';
|
||||||
|
}
|
||||||
|
function isPadded(el) {
|
||||||
|
return /^-?0\d/.test(el);
|
||||||
|
}
|
||||||
|
function lte(i, y) {
|
||||||
|
return i <= y;
|
||||||
|
}
|
||||||
|
function gte(i, y) {
|
||||||
|
return i >= y;
|
||||||
|
}
|
||||||
|
function expand_(str, isTop) {
|
||||||
|
/** @type {string[]} */
|
||||||
|
const expansions = [];
|
||||||
|
const m = balanced('{', '}', str);
|
||||||
|
if (!m)
|
||||||
|
return [str];
|
||||||
|
// no need to expand pre, since it is guaranteed to be free of brace-sets
|
||||||
|
const pre = m.pre;
|
||||||
|
const post = m.post.length ? expand_(m.post, false) : [''];
|
||||||
|
if (/\$$/.test(m.pre)) {
|
||||||
|
for (let k = 0; k < post.length; k++) {
|
||||||
|
const expansion = pre + '{' + m.body + '}' + post[k];
|
||||||
|
expansions.push(expansion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
||||||
|
const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
||||||
|
const isSequence = isNumericSequence || isAlphaSequence;
|
||||||
|
const isOptions = m.body.indexOf(',') >= 0;
|
||||||
|
if (!isSequence && !isOptions) {
|
||||||
|
// {a},b}
|
||||||
|
if (m.post.match(/,(?!,).*\}/)) {
|
||||||
|
str = m.pre + '{' + m.body + escClose + m.post;
|
||||||
|
return expand_(str);
|
||||||
|
}
|
||||||
|
return [str];
|
||||||
|
}
|
||||||
|
let n;
|
||||||
|
if (isSequence) {
|
||||||
|
n = m.body.split(/\.\./);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
n = parseCommaParts(m.body);
|
||||||
|
if (n.length === 1 && n[0] !== undefined) {
|
||||||
|
// x{{a,b}}y ==> x{a}y x{b}y
|
||||||
|
n = expand_(n[0], false).map(embrace);
|
||||||
|
//XXX is this necessary? Can't seem to hit it in tests.
|
||||||
|
/* c8 ignore start */
|
||||||
|
if (n.length === 1) {
|
||||||
|
return post.map(p => m.pre + n[0] + p);
|
||||||
|
}
|
||||||
|
/* c8 ignore stop */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// at this point, n is the parts, and we know it's not a comma set
|
||||||
|
// with a single entry.
|
||||||
|
let N;
|
||||||
|
if (isSequence && n[0] !== undefined && n[1] !== undefined) {
|
||||||
|
const x = numeric(n[0]);
|
||||||
|
const y = numeric(n[1]);
|
||||||
|
const width = Math.max(n[0].length, n[1].length);
|
||||||
|
let incr = n.length === 3 && n[2] !== undefined ? Math.abs(numeric(n[2])) : 1;
|
||||||
|
let test = lte;
|
||||||
|
const reverse = y < x;
|
||||||
|
if (reverse) {
|
||||||
|
incr *= -1;
|
||||||
|
test = gte;
|
||||||
|
}
|
||||||
|
const pad = n.some(isPadded);
|
||||||
|
N = [];
|
||||||
|
for (let i = x; test(i, y); i += incr) {
|
||||||
|
let c;
|
||||||
|
if (isAlphaSequence) {
|
||||||
|
c = String.fromCharCode(i);
|
||||||
|
if (c === '\\') {
|
||||||
|
c = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
c = String(i);
|
||||||
|
if (pad) {
|
||||||
|
const need = width - c.length;
|
||||||
|
if (need > 0) {
|
||||||
|
const z = new Array(need + 1).join('0');
|
||||||
|
if (i < 0) {
|
||||||
|
c = '-' + z + c.slice(1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
c = z + c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
N.push(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
N = [];
|
||||||
|
for (let j = 0; j < n.length; j++) {
|
||||||
|
N.push.apply(N, expand_(n[j], false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let j = 0; j < N.length; j++) {
|
||||||
|
for (let k = 0; k < post.length; k++) {
|
||||||
|
const expansion = pre + N[j] + post[k];
|
||||||
|
if (!isTop || isSequence || expansion) {
|
||||||
|
expansions.push(expansion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return expansions;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=index.js.map
|
||||||
1
node_modules/@isaacs/brace-expansion/dist/esm/index.js.map
generated
vendored
Normal file
1
node_modules/@isaacs/brace-expansion/dist/esm/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/@isaacs/brace-expansion/dist/esm/package.json
generated
vendored
Normal file
3
node_modules/@isaacs/brace-expansion/dist/esm/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"type": "module"
|
||||||
|
}
|
||||||
71
node_modules/@isaacs/brace-expansion/package.json
generated
vendored
Normal file
71
node_modules/@isaacs/brace-expansion/package.json
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
{
|
||||||
|
"name": "@isaacs/brace-expansion",
|
||||||
|
"description": "Brace expansion as known from sh/bash",
|
||||||
|
"version": "5.0.0",
|
||||||
|
"files": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"exports": {
|
||||||
|
"./package.json": "./package.json",
|
||||||
|
".": {
|
||||||
|
"import": {
|
||||||
|
"types": "./dist/esm/index.d.ts",
|
||||||
|
"default": "./dist/esm/index.js"
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"types": "./dist/commonjs/index.d.ts",
|
||||||
|
"default": "./dist/commonjs/index.js"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"preversion": "npm test",
|
||||||
|
"postversion": "npm publish",
|
||||||
|
"prepublishOnly": "git push origin --follow-tags",
|
||||||
|
"prepare": "tshy",
|
||||||
|
"pretest": "npm run prepare",
|
||||||
|
"presnap": "npm run prepare",
|
||||||
|
"test": "tap",
|
||||||
|
"snap": "tap",
|
||||||
|
"format": "prettier --write . --loglevel warn",
|
||||||
|
"benchmark": "node benchmark/index.js",
|
||||||
|
"typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts"
|
||||||
|
},
|
||||||
|
"prettier": {
|
||||||
|
"semi": false,
|
||||||
|
"printWidth": 80,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"useTabs": false,
|
||||||
|
"singleQuote": true,
|
||||||
|
"jsxSingleQuote": false,
|
||||||
|
"bracketSameLine": true,
|
||||||
|
"arrowParens": "avoid",
|
||||||
|
"endOfLine": "lf"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/brace-expansion": "^1.1.2",
|
||||||
|
"@types/node": "^24.0.0",
|
||||||
|
"mkdirp": "^3.0.1",
|
||||||
|
"prettier": "^3.3.2",
|
||||||
|
"tap": "^21.1.0",
|
||||||
|
"tshy": "^3.0.2",
|
||||||
|
"typedoc": "^0.28.5"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@isaacs/balanced-match": "^4.0.1"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": "20 || >=22"
|
||||||
|
},
|
||||||
|
"tshy": {
|
||||||
|
"exports": {
|
||||||
|
"./package.json": "./package.json",
|
||||||
|
".": "./src/index.ts"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"main": "./dist/commonjs/index.js",
|
||||||
|
"types": "./dist/commonjs/index.d.ts",
|
||||||
|
"module": "./dist/esm/index.js"
|
||||||
|
}
|
||||||
21
node_modules/asynckit/LICENSE
generated
vendored
Normal file
21
node_modules/asynckit/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2016 Alex Indigo
|
||||||
|
|
||||||
|
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.
|
||||||
233
node_modules/asynckit/README.md
generated
vendored
Normal file
233
node_modules/asynckit/README.md
generated
vendored
Normal file
@@ -0,0 +1,233 @@
|
|||||||
|
# asynckit [](https://www.npmjs.com/package/asynckit)
|
||||||
|
|
||||||
|
Minimal async jobs utility library, with streams support.
|
||||||
|
|
||||||
|
[](https://travis-ci.org/alexindigo/asynckit)
|
||||||
|
[](https://travis-ci.org/alexindigo/asynckit)
|
||||||
|
[](https://ci.appveyor.com/project/alexindigo/asynckit)
|
||||||
|
|
||||||
|
[](https://coveralls.io/github/alexindigo/asynckit?branch=master)
|
||||||
|
[](https://david-dm.org/alexindigo/asynckit)
|
||||||
|
[](https://www.bithound.io/github/alexindigo/asynckit)
|
||||||
|
|
||||||
|
<!-- [](https://www.npmjs.com/package/reamde) -->
|
||||||
|
|
||||||
|
AsyncKit provides harness for `parallel` and `serial` iterators over list of items represented by arrays or objects.
|
||||||
|
Optionally it accepts abort function (should be synchronously return by iterator for each item), and terminates left over jobs upon an error event. For specific iteration order built-in (`ascending` and `descending`) and custom sort helpers also supported, via `asynckit.serialOrdered` method.
|
||||||
|
|
||||||
|
It ensures async operations to keep behavior more stable and prevent `Maximum call stack size exceeded` errors, from sync iterators.
|
||||||
|
|
||||||
|
| compression | size |
|
||||||
|
| :----------------- | -------: |
|
||||||
|
| asynckit.js | 12.34 kB |
|
||||||
|
| asynckit.min.js | 4.11 kB |
|
||||||
|
| asynckit.min.js.gz | 1.47 kB |
|
||||||
|
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ npm install --save asynckit
|
||||||
|
```
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
### Parallel Jobs
|
||||||
|
|
||||||
|
Runs iterator over provided array in parallel. Stores output in the `result` array,
|
||||||
|
on the matching positions. In unlikely event of an error from one of the jobs,
|
||||||
|
will terminate rest of the active jobs (if abort function is provided)
|
||||||
|
and return error along with salvaged data to the main callback function.
|
||||||
|
|
||||||
|
#### Input Array
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var parallel = require('asynckit').parallel
|
||||||
|
, assert = require('assert')
|
||||||
|
;
|
||||||
|
|
||||||
|
var source = [ 1, 1, 4, 16, 64, 32, 8, 2 ]
|
||||||
|
, expectedResult = [ 2, 2, 8, 32, 128, 64, 16, 4 ]
|
||||||
|
, expectedTarget = [ 1, 1, 2, 4, 8, 16, 32, 64 ]
|
||||||
|
, target = []
|
||||||
|
;
|
||||||
|
|
||||||
|
parallel(source, asyncJob, function(err, result)
|
||||||
|
{
|
||||||
|
assert.deepEqual(result, expectedResult);
|
||||||
|
assert.deepEqual(target, expectedTarget);
|
||||||
|
});
|
||||||
|
|
||||||
|
// async job accepts one element from the array
|
||||||
|
// and a callback function
|
||||||
|
function asyncJob(item, cb)
|
||||||
|
{
|
||||||
|
// different delays (in ms) per item
|
||||||
|
var delay = item * 25;
|
||||||
|
|
||||||
|
// pretend different jobs take different time to finish
|
||||||
|
// and not in consequential order
|
||||||
|
var timeoutId = setTimeout(function() {
|
||||||
|
target.push(item);
|
||||||
|
cb(null, item * 2);
|
||||||
|
}, delay);
|
||||||
|
|
||||||
|
// allow to cancel "leftover" jobs upon error
|
||||||
|
// return function, invoking of which will abort this job
|
||||||
|
return clearTimeout.bind(null, timeoutId);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
More examples could be found in [test/test-parallel-array.js](test/test-parallel-array.js).
|
||||||
|
|
||||||
|
#### Input Object
|
||||||
|
|
||||||
|
Also it supports named jobs, listed via object.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var parallel = require('asynckit/parallel')
|
||||||
|
, assert = require('assert')
|
||||||
|
;
|
||||||
|
|
||||||
|
var source = { first: 1, one: 1, four: 4, sixteen: 16, sixtyFour: 64, thirtyTwo: 32, eight: 8, two: 2 }
|
||||||
|
, expectedResult = { first: 2, one: 2, four: 8, sixteen: 32, sixtyFour: 128, thirtyTwo: 64, eight: 16, two: 4 }
|
||||||
|
, expectedTarget = [ 1, 1, 2, 4, 8, 16, 32, 64 ]
|
||||||
|
, expectedKeys = [ 'first', 'one', 'two', 'four', 'eight', 'sixteen', 'thirtyTwo', 'sixtyFour' ]
|
||||||
|
, target = []
|
||||||
|
, keys = []
|
||||||
|
;
|
||||||
|
|
||||||
|
parallel(source, asyncJob, function(err, result)
|
||||||
|
{
|
||||||
|
assert.deepEqual(result, expectedResult);
|
||||||
|
assert.deepEqual(target, expectedTarget);
|
||||||
|
assert.deepEqual(keys, expectedKeys);
|
||||||
|
});
|
||||||
|
|
||||||
|
// supports full value, key, callback (shortcut) interface
|
||||||
|
function asyncJob(item, key, cb)
|
||||||
|
{
|
||||||
|
// different delays (in ms) per item
|
||||||
|
var delay = item * 25;
|
||||||
|
|
||||||
|
// pretend different jobs take different time to finish
|
||||||
|
// and not in consequential order
|
||||||
|
var timeoutId = setTimeout(function() {
|
||||||
|
keys.push(key);
|
||||||
|
target.push(item);
|
||||||
|
cb(null, item * 2);
|
||||||
|
}, delay);
|
||||||
|
|
||||||
|
// allow to cancel "leftover" jobs upon error
|
||||||
|
// return function, invoking of which will abort this job
|
||||||
|
return clearTimeout.bind(null, timeoutId);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
More examples could be found in [test/test-parallel-object.js](test/test-parallel-object.js).
|
||||||
|
|
||||||
|
### Serial Jobs
|
||||||
|
|
||||||
|
Runs iterator over provided array sequentially. Stores output in the `result` array,
|
||||||
|
on the matching positions. In unlikely event of an error from one of the jobs,
|
||||||
|
will not proceed to the rest of the items in the list
|
||||||
|
and return error along with salvaged data to the main callback function.
|
||||||
|
|
||||||
|
#### Input Array
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var serial = require('asynckit/serial')
|
||||||
|
, assert = require('assert')
|
||||||
|
;
|
||||||
|
|
||||||
|
var source = [ 1, 1, 4, 16, 64, 32, 8, 2 ]
|
||||||
|
, expectedResult = [ 2, 2, 8, 32, 128, 64, 16, 4 ]
|
||||||
|
, expectedTarget = [ 0, 1, 2, 3, 4, 5, 6, 7 ]
|
||||||
|
, target = []
|
||||||
|
;
|
||||||
|
|
||||||
|
serial(source, asyncJob, function(err, result)
|
||||||
|
{
|
||||||
|
assert.deepEqual(result, expectedResult);
|
||||||
|
assert.deepEqual(target, expectedTarget);
|
||||||
|
});
|
||||||
|
|
||||||
|
// extended interface (item, key, callback)
|
||||||
|
// also supported for arrays
|
||||||
|
function asyncJob(item, key, cb)
|
||||||
|
{
|
||||||
|
target.push(key);
|
||||||
|
|
||||||
|
// it will be automatically made async
|
||||||
|
// even it iterator "returns" in the same event loop
|
||||||
|
cb(null, item * 2);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
More examples could be found in [test/test-serial-array.js](test/test-serial-array.js).
|
||||||
|
|
||||||
|
#### Input Object
|
||||||
|
|
||||||
|
Also it supports named jobs, listed via object.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var serial = require('asynckit').serial
|
||||||
|
, assert = require('assert')
|
||||||
|
;
|
||||||
|
|
||||||
|
var source = [ 1, 1, 4, 16, 64, 32, 8, 2 ]
|
||||||
|
, expectedResult = [ 2, 2, 8, 32, 128, 64, 16, 4 ]
|
||||||
|
, expectedTarget = [ 0, 1, 2, 3, 4, 5, 6, 7 ]
|
||||||
|
, target = []
|
||||||
|
;
|
||||||
|
|
||||||
|
var source = { first: 1, one: 1, four: 4, sixteen: 16, sixtyFour: 64, thirtyTwo: 32, eight: 8, two: 2 }
|
||||||
|
, expectedResult = { first: 2, one: 2, four: 8, sixteen: 32, sixtyFour: 128, thirtyTwo: 64, eight: 16, two: 4 }
|
||||||
|
, expectedTarget = [ 1, 1, 4, 16, 64, 32, 8, 2 ]
|
||||||
|
, target = []
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
serial(source, asyncJob, function(err, result)
|
||||||
|
{
|
||||||
|
assert.deepEqual(result, expectedResult);
|
||||||
|
assert.deepEqual(target, expectedTarget);
|
||||||
|
});
|
||||||
|
|
||||||
|
// shortcut interface (item, callback)
|
||||||
|
// works for object as well as for the arrays
|
||||||
|
function asyncJob(item, cb)
|
||||||
|
{
|
||||||
|
target.push(item);
|
||||||
|
|
||||||
|
// it will be automatically made async
|
||||||
|
// even it iterator "returns" in the same event loop
|
||||||
|
cb(null, item * 2);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
More examples could be found in [test/test-serial-object.js](test/test-serial-object.js).
|
||||||
|
|
||||||
|
_Note: Since _object_ is an _unordered_ collection of properties,
|
||||||
|
it may produce unexpected results with sequential iterations.
|
||||||
|
Whenever order of the jobs' execution is important please use `serialOrdered` method._
|
||||||
|
|
||||||
|
### Ordered Serial Iterations
|
||||||
|
|
||||||
|
TBD
|
||||||
|
|
||||||
|
For example [compare-property](compare-property) package.
|
||||||
|
|
||||||
|
### Streaming interface
|
||||||
|
|
||||||
|
TBD
|
||||||
|
|
||||||
|
## Want to Know More?
|
||||||
|
|
||||||
|
More examples can be found in [test folder](test/).
|
||||||
|
|
||||||
|
Or open an [issue](https://github.com/alexindigo/asynckit/issues) with questions and/or suggestions.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
AsyncKit is licensed under the MIT license.
|
||||||
76
node_modules/asynckit/bench.js
generated
vendored
Normal file
76
node_modules/asynckit/bench.js
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
/* eslint no-console: "off" */
|
||||||
|
|
||||||
|
var asynckit = require('./')
|
||||||
|
, async = require('async')
|
||||||
|
, assert = require('assert')
|
||||||
|
, expected = 0
|
||||||
|
;
|
||||||
|
|
||||||
|
var Benchmark = require('benchmark');
|
||||||
|
var suite = new Benchmark.Suite;
|
||||||
|
|
||||||
|
var source = [];
|
||||||
|
for (var z = 1; z < 100; z++)
|
||||||
|
{
|
||||||
|
source.push(z);
|
||||||
|
expected += z;
|
||||||
|
}
|
||||||
|
|
||||||
|
suite
|
||||||
|
// add tests
|
||||||
|
|
||||||
|
.add('async.map', function(deferred)
|
||||||
|
{
|
||||||
|
var total = 0;
|
||||||
|
|
||||||
|
async.map(source,
|
||||||
|
function(i, cb)
|
||||||
|
{
|
||||||
|
setImmediate(function()
|
||||||
|
{
|
||||||
|
total += i;
|
||||||
|
cb(null, total);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
function(err, result)
|
||||||
|
{
|
||||||
|
assert.ifError(err);
|
||||||
|
assert.equal(result[result.length - 1], expected);
|
||||||
|
deferred.resolve();
|
||||||
|
});
|
||||||
|
}, {'defer': true})
|
||||||
|
|
||||||
|
|
||||||
|
.add('asynckit.parallel', function(deferred)
|
||||||
|
{
|
||||||
|
var total = 0;
|
||||||
|
|
||||||
|
asynckit.parallel(source,
|
||||||
|
function(i, cb)
|
||||||
|
{
|
||||||
|
setImmediate(function()
|
||||||
|
{
|
||||||
|
total += i;
|
||||||
|
cb(null, total);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
function(err, result)
|
||||||
|
{
|
||||||
|
assert.ifError(err);
|
||||||
|
assert.equal(result[result.length - 1], expected);
|
||||||
|
deferred.resolve();
|
||||||
|
});
|
||||||
|
}, {'defer': true})
|
||||||
|
|
||||||
|
|
||||||
|
// add listeners
|
||||||
|
.on('cycle', function(ev)
|
||||||
|
{
|
||||||
|
console.log(String(ev.target));
|
||||||
|
})
|
||||||
|
.on('complete', function()
|
||||||
|
{
|
||||||
|
console.log('Fastest is ' + this.filter('fastest').map('name'));
|
||||||
|
})
|
||||||
|
// run async
|
||||||
|
.run({ 'async': true });
|
||||||
6
node_modules/asynckit/index.js
generated
vendored
Normal file
6
node_modules/asynckit/index.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
module.exports =
|
||||||
|
{
|
||||||
|
parallel : require('./parallel.js'),
|
||||||
|
serial : require('./serial.js'),
|
||||||
|
serialOrdered : require('./serialOrdered.js')
|
||||||
|
};
|
||||||
29
node_modules/asynckit/lib/abort.js
generated
vendored
Normal file
29
node_modules/asynckit/lib/abort.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
// API
|
||||||
|
module.exports = abort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Aborts leftover active jobs
|
||||||
|
*
|
||||||
|
* @param {object} state - current state object
|
||||||
|
*/
|
||||||
|
function abort(state)
|
||||||
|
{
|
||||||
|
Object.keys(state.jobs).forEach(clean.bind(state));
|
||||||
|
|
||||||
|
// reset leftover jobs
|
||||||
|
state.jobs = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cleans up leftover job by invoking abort function for the provided job id
|
||||||
|
*
|
||||||
|
* @this state
|
||||||
|
* @param {string|number} key - job id to abort
|
||||||
|
*/
|
||||||
|
function clean(key)
|
||||||
|
{
|
||||||
|
if (typeof this.jobs[key] == 'function')
|
||||||
|
{
|
||||||
|
this.jobs[key]();
|
||||||
|
}
|
||||||
|
}
|
||||||
34
node_modules/asynckit/lib/async.js
generated
vendored
Normal file
34
node_modules/asynckit/lib/async.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
var defer = require('./defer.js');
|
||||||
|
|
||||||
|
// API
|
||||||
|
module.exports = async;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs provided callback asynchronously
|
||||||
|
* even if callback itself is not
|
||||||
|
*
|
||||||
|
* @param {function} callback - callback to invoke
|
||||||
|
* @returns {function} - augmented callback
|
||||||
|
*/
|
||||||
|
function async(callback)
|
||||||
|
{
|
||||||
|
var isAsync = false;
|
||||||
|
|
||||||
|
// check if async happened
|
||||||
|
defer(function() { isAsync = true; });
|
||||||
|
|
||||||
|
return function async_callback(err, result)
|
||||||
|
{
|
||||||
|
if (isAsync)
|
||||||
|
{
|
||||||
|
callback(err, result);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
defer(function nextTick_callback()
|
||||||
|
{
|
||||||
|
callback(err, result);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
26
node_modules/asynckit/lib/defer.js
generated
vendored
Normal file
26
node_modules/asynckit/lib/defer.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
module.exports = defer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs provided function on next iteration of the event loop
|
||||||
|
*
|
||||||
|
* @param {function} fn - function to run
|
||||||
|
*/
|
||||||
|
function defer(fn)
|
||||||
|
{
|
||||||
|
var nextTick = typeof setImmediate == 'function'
|
||||||
|
? setImmediate
|
||||||
|
: (
|
||||||
|
typeof process == 'object' && typeof process.nextTick == 'function'
|
||||||
|
? process.nextTick
|
||||||
|
: null
|
||||||
|
);
|
||||||
|
|
||||||
|
if (nextTick)
|
||||||
|
{
|
||||||
|
nextTick(fn);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setTimeout(fn, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
75
node_modules/asynckit/lib/iterate.js
generated
vendored
Normal file
75
node_modules/asynckit/lib/iterate.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
var async = require('./async.js')
|
||||||
|
, abort = require('./abort.js')
|
||||||
|
;
|
||||||
|
|
||||||
|
// API
|
||||||
|
module.exports = iterate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Iterates over each job object
|
||||||
|
*
|
||||||
|
* @param {array|object} list - array or object (named list) to iterate over
|
||||||
|
* @param {function} iterator - iterator to run
|
||||||
|
* @param {object} state - current job status
|
||||||
|
* @param {function} callback - invoked when all elements processed
|
||||||
|
*/
|
||||||
|
function iterate(list, iterator, state, callback)
|
||||||
|
{
|
||||||
|
// store current index
|
||||||
|
var key = state['keyedList'] ? state['keyedList'][state.index] : state.index;
|
||||||
|
|
||||||
|
state.jobs[key] = runJob(iterator, key, list[key], function(error, output)
|
||||||
|
{
|
||||||
|
// don't repeat yourself
|
||||||
|
// skip secondary callbacks
|
||||||
|
if (!(key in state.jobs))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// clean up jobs
|
||||||
|
delete state.jobs[key];
|
||||||
|
|
||||||
|
if (error)
|
||||||
|
{
|
||||||
|
// don't process rest of the results
|
||||||
|
// stop still active jobs
|
||||||
|
// and reset the list
|
||||||
|
abort(state);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
state.results[key] = output;
|
||||||
|
}
|
||||||
|
|
||||||
|
// return salvaged results
|
||||||
|
callback(error, state.results);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs iterator over provided job element
|
||||||
|
*
|
||||||
|
* @param {function} iterator - iterator to invoke
|
||||||
|
* @param {string|number} key - key/index of the element in the list of jobs
|
||||||
|
* @param {mixed} item - job description
|
||||||
|
* @param {function} callback - invoked after iterator is done with the job
|
||||||
|
* @returns {function|mixed} - job abort function or something else
|
||||||
|
*/
|
||||||
|
function runJob(iterator, key, item, callback)
|
||||||
|
{
|
||||||
|
var aborter;
|
||||||
|
|
||||||
|
// allow shortcut if iterator expects only two arguments
|
||||||
|
if (iterator.length == 2)
|
||||||
|
{
|
||||||
|
aborter = iterator(item, async(callback));
|
||||||
|
}
|
||||||
|
// otherwise go with full three arguments
|
||||||
|
else
|
||||||
|
{
|
||||||
|
aborter = iterator(item, key, async(callback));
|
||||||
|
}
|
||||||
|
|
||||||
|
return aborter;
|
||||||
|
}
|
||||||
91
node_modules/asynckit/lib/readable_asynckit.js
generated
vendored
Normal file
91
node_modules/asynckit/lib/readable_asynckit.js
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
var streamify = require('./streamify.js')
|
||||||
|
, defer = require('./defer.js')
|
||||||
|
;
|
||||||
|
|
||||||
|
// API
|
||||||
|
module.exports = ReadableAsyncKit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base constructor for all streams
|
||||||
|
* used to hold properties/methods
|
||||||
|
*/
|
||||||
|
function ReadableAsyncKit()
|
||||||
|
{
|
||||||
|
ReadableAsyncKit.super_.apply(this, arguments);
|
||||||
|
|
||||||
|
// list of active jobs
|
||||||
|
this.jobs = {};
|
||||||
|
|
||||||
|
// add stream methods
|
||||||
|
this.destroy = destroy;
|
||||||
|
this._start = _start;
|
||||||
|
this._read = _read;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroys readable stream,
|
||||||
|
* by aborting outstanding jobs
|
||||||
|
*
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
function destroy()
|
||||||
|
{
|
||||||
|
if (this.destroyed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.destroyed = true;
|
||||||
|
|
||||||
|
if (typeof this.terminator == 'function')
|
||||||
|
{
|
||||||
|
this.terminator();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts provided jobs in async manner
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
function _start()
|
||||||
|
{
|
||||||
|
// first argument – runner function
|
||||||
|
var runner = arguments[0]
|
||||||
|
// take away first argument
|
||||||
|
, args = Array.prototype.slice.call(arguments, 1)
|
||||||
|
// second argument - input data
|
||||||
|
, input = args[0]
|
||||||
|
// last argument - result callback
|
||||||
|
, endCb = streamify.callback.call(this, args[args.length - 1])
|
||||||
|
;
|
||||||
|
|
||||||
|
args[args.length - 1] = endCb;
|
||||||
|
// third argument - iterator
|
||||||
|
args[1] = streamify.iterator.call(this, args[1]);
|
||||||
|
|
||||||
|
// allow time for proper setup
|
||||||
|
defer(function()
|
||||||
|
{
|
||||||
|
if (!this.destroyed)
|
||||||
|
{
|
||||||
|
this.terminator = runner.apply(null, args);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
endCb(null, Array.isArray(input) ? [] : {});
|
||||||
|
}
|
||||||
|
}.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implement _read to comply with Readable streams
|
||||||
|
* Doesn't really make sense for flowing object mode
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
function _read()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
25
node_modules/asynckit/lib/readable_parallel.js
generated
vendored
Normal file
25
node_modules/asynckit/lib/readable_parallel.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
var parallel = require('../parallel.js');
|
||||||
|
|
||||||
|
// API
|
||||||
|
module.exports = ReadableParallel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Streaming wrapper to `asynckit.parallel`
|
||||||
|
*
|
||||||
|
* @param {array|object} list - array or object (named list) to iterate over
|
||||||
|
* @param {function} iterator - iterator to run
|
||||||
|
* @param {function} callback - invoked when all elements processed
|
||||||
|
* @returns {stream.Readable#}
|
||||||
|
*/
|
||||||
|
function ReadableParallel(list, iterator, callback)
|
||||||
|
{
|
||||||
|
if (!(this instanceof ReadableParallel))
|
||||||
|
{
|
||||||
|
return new ReadableParallel(list, iterator, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
// turn on object mode
|
||||||
|
ReadableParallel.super_.call(this, {objectMode: true});
|
||||||
|
|
||||||
|
this._start(parallel, list, iterator, callback);
|
||||||
|
}
|
||||||
25
node_modules/asynckit/lib/readable_serial.js
generated
vendored
Normal file
25
node_modules/asynckit/lib/readable_serial.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
var serial = require('../serial.js');
|
||||||
|
|
||||||
|
// API
|
||||||
|
module.exports = ReadableSerial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Streaming wrapper to `asynckit.serial`
|
||||||
|
*
|
||||||
|
* @param {array|object} list - array or object (named list) to iterate over
|
||||||
|
* @param {function} iterator - iterator to run
|
||||||
|
* @param {function} callback - invoked when all elements processed
|
||||||
|
* @returns {stream.Readable#}
|
||||||
|
*/
|
||||||
|
function ReadableSerial(list, iterator, callback)
|
||||||
|
{
|
||||||
|
if (!(this instanceof ReadableSerial))
|
||||||
|
{
|
||||||
|
return new ReadableSerial(list, iterator, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
// turn on object mode
|
||||||
|
ReadableSerial.super_.call(this, {objectMode: true});
|
||||||
|
|
||||||
|
this._start(serial, list, iterator, callback);
|
||||||
|
}
|
||||||
29
node_modules/asynckit/lib/readable_serial_ordered.js
generated
vendored
Normal file
29
node_modules/asynckit/lib/readable_serial_ordered.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
var serialOrdered = require('../serialOrdered.js');
|
||||||
|
|
||||||
|
// API
|
||||||
|
module.exports = ReadableSerialOrdered;
|
||||||
|
// expose sort helpers
|
||||||
|
module.exports.ascending = serialOrdered.ascending;
|
||||||
|
module.exports.descending = serialOrdered.descending;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Streaming wrapper to `asynckit.serialOrdered`
|
||||||
|
*
|
||||||
|
* @param {array|object} list - array or object (named list) to iterate over
|
||||||
|
* @param {function} iterator - iterator to run
|
||||||
|
* @param {function} sortMethod - custom sort function
|
||||||
|
* @param {function} callback - invoked when all elements processed
|
||||||
|
* @returns {stream.Readable#}
|
||||||
|
*/
|
||||||
|
function ReadableSerialOrdered(list, iterator, sortMethod, callback)
|
||||||
|
{
|
||||||
|
if (!(this instanceof ReadableSerialOrdered))
|
||||||
|
{
|
||||||
|
return new ReadableSerialOrdered(list, iterator, sortMethod, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
// turn on object mode
|
||||||
|
ReadableSerialOrdered.super_.call(this, {objectMode: true});
|
||||||
|
|
||||||
|
this._start(serialOrdered, list, iterator, sortMethod, callback);
|
||||||
|
}
|
||||||
37
node_modules/asynckit/lib/state.js
generated
vendored
Normal file
37
node_modules/asynckit/lib/state.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
// API
|
||||||
|
module.exports = state;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates initial state object
|
||||||
|
* for iteration over list
|
||||||
|
*
|
||||||
|
* @param {array|object} list - list to iterate over
|
||||||
|
* @param {function|null} sortMethod - function to use for keys sort,
|
||||||
|
* or `null` to keep them as is
|
||||||
|
* @returns {object} - initial state object
|
||||||
|
*/
|
||||||
|
function state(list, sortMethod)
|
||||||
|
{
|
||||||
|
var isNamedList = !Array.isArray(list)
|
||||||
|
, initState =
|
||||||
|
{
|
||||||
|
index : 0,
|
||||||
|
keyedList: isNamedList || sortMethod ? Object.keys(list) : null,
|
||||||
|
jobs : {},
|
||||||
|
results : isNamedList ? {} : [],
|
||||||
|
size : isNamedList ? Object.keys(list).length : list.length
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
if (sortMethod)
|
||||||
|
{
|
||||||
|
// sort array keys based on it's values
|
||||||
|
// sort object's keys just on own merit
|
||||||
|
initState.keyedList.sort(isNamedList ? sortMethod : function(a, b)
|
||||||
|
{
|
||||||
|
return sortMethod(list[a], list[b]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return initState;
|
||||||
|
}
|
||||||
141
node_modules/asynckit/lib/streamify.js
generated
vendored
Normal file
141
node_modules/asynckit/lib/streamify.js
generated
vendored
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
var async = require('./async.js');
|
||||||
|
|
||||||
|
// API
|
||||||
|
module.exports = {
|
||||||
|
iterator: wrapIterator,
|
||||||
|
callback: wrapCallback
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wraps iterators with long signature
|
||||||
|
*
|
||||||
|
* @this ReadableAsyncKit#
|
||||||
|
* @param {function} iterator - function to wrap
|
||||||
|
* @returns {function} - wrapped function
|
||||||
|
*/
|
||||||
|
function wrapIterator(iterator)
|
||||||
|
{
|
||||||
|
var stream = this;
|
||||||
|
|
||||||
|
return function(item, key, cb)
|
||||||
|
{
|
||||||
|
var aborter
|
||||||
|
, wrappedCb = async(wrapIteratorCallback.call(stream, cb, key))
|
||||||
|
;
|
||||||
|
|
||||||
|
stream.jobs[key] = wrappedCb;
|
||||||
|
|
||||||
|
// it's either shortcut (item, cb)
|
||||||
|
if (iterator.length == 2)
|
||||||
|
{
|
||||||
|
aborter = iterator(item, wrappedCb);
|
||||||
|
}
|
||||||
|
// or long format (item, key, cb)
|
||||||
|
else
|
||||||
|
{
|
||||||
|
aborter = iterator(item, key, wrappedCb);
|
||||||
|
}
|
||||||
|
|
||||||
|
return aborter;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wraps provided callback function
|
||||||
|
* allowing to execute snitch function before
|
||||||
|
* real callback
|
||||||
|
*
|
||||||
|
* @this ReadableAsyncKit#
|
||||||
|
* @param {function} callback - function to wrap
|
||||||
|
* @returns {function} - wrapped function
|
||||||
|
*/
|
||||||
|
function wrapCallback(callback)
|
||||||
|
{
|
||||||
|
var stream = this;
|
||||||
|
|
||||||
|
var wrapped = function(error, result)
|
||||||
|
{
|
||||||
|
return finisher.call(stream, error, result, callback);
|
||||||
|
};
|
||||||
|
|
||||||
|
return wrapped;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wraps provided iterator callback function
|
||||||
|
* makes sure snitch only called once,
|
||||||
|
* but passes secondary calls to the original callback
|
||||||
|
*
|
||||||
|
* @this ReadableAsyncKit#
|
||||||
|
* @param {function} callback - callback to wrap
|
||||||
|
* @param {number|string} key - iteration key
|
||||||
|
* @returns {function} wrapped callback
|
||||||
|
*/
|
||||||
|
function wrapIteratorCallback(callback, key)
|
||||||
|
{
|
||||||
|
var stream = this;
|
||||||
|
|
||||||
|
return function(error, output)
|
||||||
|
{
|
||||||
|
// don't repeat yourself
|
||||||
|
if (!(key in stream.jobs))
|
||||||
|
{
|
||||||
|
callback(error, output);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// clean up jobs
|
||||||
|
delete stream.jobs[key];
|
||||||
|
|
||||||
|
return streamer.call(stream, error, {key: key, value: output}, callback);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stream wrapper for iterator callback
|
||||||
|
*
|
||||||
|
* @this ReadableAsyncKit#
|
||||||
|
* @param {mixed} error - error response
|
||||||
|
* @param {mixed} output - iterator output
|
||||||
|
* @param {function} callback - callback that expects iterator results
|
||||||
|
*/
|
||||||
|
function streamer(error, output, callback)
|
||||||
|
{
|
||||||
|
if (error && !this.error)
|
||||||
|
{
|
||||||
|
this.error = error;
|
||||||
|
this.pause();
|
||||||
|
this.emit('error', error);
|
||||||
|
// send back value only, as expected
|
||||||
|
callback(error, output && output.value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// stream stuff
|
||||||
|
this.push(output);
|
||||||
|
|
||||||
|
// back to original track
|
||||||
|
// send back value only, as expected
|
||||||
|
callback(error, output && output.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stream wrapper for finishing callback
|
||||||
|
*
|
||||||
|
* @this ReadableAsyncKit#
|
||||||
|
* @param {mixed} error - error response
|
||||||
|
* @param {mixed} output - iterator output
|
||||||
|
* @param {function} callback - callback that expects final results
|
||||||
|
*/
|
||||||
|
function finisher(error, output, callback)
|
||||||
|
{
|
||||||
|
// signal end of the stream
|
||||||
|
// only for successfully finished streams
|
||||||
|
if (!error)
|
||||||
|
{
|
||||||
|
this.push(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// back to original track
|
||||||
|
callback(error, output);
|
||||||
|
}
|
||||||
29
node_modules/asynckit/lib/terminator.js
generated
vendored
Normal file
29
node_modules/asynckit/lib/terminator.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
var abort = require('./abort.js')
|
||||||
|
, async = require('./async.js')
|
||||||
|
;
|
||||||
|
|
||||||
|
// API
|
||||||
|
module.exports = terminator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Terminates jobs in the attached state context
|
||||||
|
*
|
||||||
|
* @this AsyncKitState#
|
||||||
|
* @param {function} callback - final callback to invoke after termination
|
||||||
|
*/
|
||||||
|
function terminator(callback)
|
||||||
|
{
|
||||||
|
if (!Object.keys(this.jobs).length)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// fast forward iteration index
|
||||||
|
this.index = this.size;
|
||||||
|
|
||||||
|
// abort jobs
|
||||||
|
abort(this);
|
||||||
|
|
||||||
|
// send back results we have so far
|
||||||
|
async(callback)(null, this.results);
|
||||||
|
}
|
||||||
63
node_modules/asynckit/package.json
generated
vendored
Normal file
63
node_modules/asynckit/package.json
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
{
|
||||||
|
"name": "asynckit",
|
||||||
|
"version": "0.4.0",
|
||||||
|
"description": "Minimal async jobs utility library, with streams support",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"clean": "rimraf coverage",
|
||||||
|
"lint": "eslint *.js lib/*.js test/*.js",
|
||||||
|
"test": "istanbul cover --reporter=json tape -- 'test/test-*.js' | tap-spec",
|
||||||
|
"win-test": "tape test/test-*.js",
|
||||||
|
"browser": "browserify -t browserify-istanbul test/lib/browserify_adjustment.js test/test-*.js | obake --coverage | tap-spec",
|
||||||
|
"report": "istanbul report",
|
||||||
|
"size": "browserify index.js | size-table asynckit",
|
||||||
|
"debug": "tape test/test-*.js"
|
||||||
|
},
|
||||||
|
"pre-commit": [
|
||||||
|
"clean",
|
||||||
|
"lint",
|
||||||
|
"test",
|
||||||
|
"browser",
|
||||||
|
"report",
|
||||||
|
"size"
|
||||||
|
],
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/alexindigo/asynckit.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"async",
|
||||||
|
"jobs",
|
||||||
|
"parallel",
|
||||||
|
"serial",
|
||||||
|
"iterator",
|
||||||
|
"array",
|
||||||
|
"object",
|
||||||
|
"stream",
|
||||||
|
"destroy",
|
||||||
|
"terminate",
|
||||||
|
"abort"
|
||||||
|
],
|
||||||
|
"author": "Alex Indigo <iam@alexindigo.com>",
|
||||||
|
"license": "MIT",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/alexindigo/asynckit/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/alexindigo/asynckit#readme",
|
||||||
|
"devDependencies": {
|
||||||
|
"browserify": "^13.0.0",
|
||||||
|
"browserify-istanbul": "^2.0.0",
|
||||||
|
"coveralls": "^2.11.9",
|
||||||
|
"eslint": "^2.9.0",
|
||||||
|
"istanbul": "^0.4.3",
|
||||||
|
"obake": "^0.1.2",
|
||||||
|
"phantomjs-prebuilt": "^2.1.7",
|
||||||
|
"pre-commit": "^1.1.3",
|
||||||
|
"reamde": "^1.1.0",
|
||||||
|
"rimraf": "^2.5.2",
|
||||||
|
"size-table": "^0.2.0",
|
||||||
|
"tap-spec": "^4.1.1",
|
||||||
|
"tape": "^4.5.1"
|
||||||
|
},
|
||||||
|
"dependencies": {}
|
||||||
|
}
|
||||||
43
node_modules/asynckit/parallel.js
generated
vendored
Normal file
43
node_modules/asynckit/parallel.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
var iterate = require('./lib/iterate.js')
|
||||||
|
, initState = require('./lib/state.js')
|
||||||
|
, terminator = require('./lib/terminator.js')
|
||||||
|
;
|
||||||
|
|
||||||
|
// Public API
|
||||||
|
module.exports = parallel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs iterator over provided array elements in parallel
|
||||||
|
*
|
||||||
|
* @param {array|object} list - array or object (named list) to iterate over
|
||||||
|
* @param {function} iterator - iterator to run
|
||||||
|
* @param {function} callback - invoked when all elements processed
|
||||||
|
* @returns {function} - jobs terminator
|
||||||
|
*/
|
||||||
|
function parallel(list, iterator, callback)
|
||||||
|
{
|
||||||
|
var state = initState(list);
|
||||||
|
|
||||||
|
while (state.index < (state['keyedList'] || list).length)
|
||||||
|
{
|
||||||
|
iterate(list, iterator, state, function(error, result)
|
||||||
|
{
|
||||||
|
if (error)
|
||||||
|
{
|
||||||
|
callback(error, result);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// looks like it's the last one
|
||||||
|
if (Object.keys(state.jobs).length === 0)
|
||||||
|
{
|
||||||
|
callback(null, state.results);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
state.index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return terminator.bind(state, callback);
|
||||||
|
}
|
||||||
17
node_modules/asynckit/serial.js
generated
vendored
Normal file
17
node_modules/asynckit/serial.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
var serialOrdered = require('./serialOrdered.js');
|
||||||
|
|
||||||
|
// Public API
|
||||||
|
module.exports = serial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs iterator over provided array elements in series
|
||||||
|
*
|
||||||
|
* @param {array|object} list - array or object (named list) to iterate over
|
||||||
|
* @param {function} iterator - iterator to run
|
||||||
|
* @param {function} callback - invoked when all elements processed
|
||||||
|
* @returns {function} - jobs terminator
|
||||||
|
*/
|
||||||
|
function serial(list, iterator, callback)
|
||||||
|
{
|
||||||
|
return serialOrdered(list, iterator, null, callback);
|
||||||
|
}
|
||||||
75
node_modules/asynckit/serialOrdered.js
generated
vendored
Normal file
75
node_modules/asynckit/serialOrdered.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
var iterate = require('./lib/iterate.js')
|
||||||
|
, initState = require('./lib/state.js')
|
||||||
|
, terminator = require('./lib/terminator.js')
|
||||||
|
;
|
||||||
|
|
||||||
|
// Public API
|
||||||
|
module.exports = serialOrdered;
|
||||||
|
// sorting helpers
|
||||||
|
module.exports.ascending = ascending;
|
||||||
|
module.exports.descending = descending;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs iterator over provided sorted array elements in series
|
||||||
|
*
|
||||||
|
* @param {array|object} list - array or object (named list) to iterate over
|
||||||
|
* @param {function} iterator - iterator to run
|
||||||
|
* @param {function} sortMethod - custom sort function
|
||||||
|
* @param {function} callback - invoked when all elements processed
|
||||||
|
* @returns {function} - jobs terminator
|
||||||
|
*/
|
||||||
|
function serialOrdered(list, iterator, sortMethod, callback)
|
||||||
|
{
|
||||||
|
var state = initState(list, sortMethod);
|
||||||
|
|
||||||
|
iterate(list, iterator, state, function iteratorHandler(error, result)
|
||||||
|
{
|
||||||
|
if (error)
|
||||||
|
{
|
||||||
|
callback(error, result);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
state.index++;
|
||||||
|
|
||||||
|
// are we there yet?
|
||||||
|
if (state.index < (state['keyedList'] || list).length)
|
||||||
|
{
|
||||||
|
iterate(list, iterator, state, iteratorHandler);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// done here
|
||||||
|
callback(null, state.results);
|
||||||
|
});
|
||||||
|
|
||||||
|
return terminator.bind(state, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* -- Sort methods
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sort helper to sort array elements in ascending order
|
||||||
|
*
|
||||||
|
* @param {mixed} a - an item to compare
|
||||||
|
* @param {mixed} b - an item to compare
|
||||||
|
* @returns {number} - comparison result
|
||||||
|
*/
|
||||||
|
function ascending(a, b)
|
||||||
|
{
|
||||||
|
return a < b ? -1 : a > b ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sort helper to sort array elements in descending order
|
||||||
|
*
|
||||||
|
* @param {mixed} a - an item to compare
|
||||||
|
* @param {mixed} b - an item to compare
|
||||||
|
* @returns {number} - comparison result
|
||||||
|
*/
|
||||||
|
function descending(a, b)
|
||||||
|
{
|
||||||
|
return -1 * ascending(a, b);
|
||||||
|
}
|
||||||
21
node_modules/asynckit/stream.js
generated
vendored
Normal file
21
node_modules/asynckit/stream.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
var inherits = require('util').inherits
|
||||||
|
, Readable = require('stream').Readable
|
||||||
|
, ReadableAsyncKit = require('./lib/readable_asynckit.js')
|
||||||
|
, ReadableParallel = require('./lib/readable_parallel.js')
|
||||||
|
, ReadableSerial = require('./lib/readable_serial.js')
|
||||||
|
, ReadableSerialOrdered = require('./lib/readable_serial_ordered.js')
|
||||||
|
;
|
||||||
|
|
||||||
|
// API
|
||||||
|
module.exports =
|
||||||
|
{
|
||||||
|
parallel : ReadableParallel,
|
||||||
|
serial : ReadableSerial,
|
||||||
|
serialOrdered : ReadableSerialOrdered,
|
||||||
|
};
|
||||||
|
|
||||||
|
inherits(ReadableAsyncKit, Readable);
|
||||||
|
|
||||||
|
inherits(ReadableParallel, ReadableAsyncKit);
|
||||||
|
inherits(ReadableSerial, ReadableAsyncKit);
|
||||||
|
inherits(ReadableSerialOrdered, ReadableAsyncKit);
|
||||||
1014
node_modules/axios/CHANGELOG.md
generated
vendored
Normal file
1014
node_modules/axios/CHANGELOG.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
19
node_modules/axios/LICENSE
generated
vendored
Normal file
19
node_modules/axios/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
Copyright (c) 2014-present Matt Zabriskie
|
||||||
|
|
||||||
|
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.
|
||||||
1182
node_modules/axios/README.md
generated
vendored
Normal file
1182
node_modules/axios/README.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
5
node_modules/axios/SECURITY.md
generated
vendored
Normal file
5
node_modules/axios/SECURITY.md
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# Reporting a Vulnerability
|
||||||
|
|
||||||
|
If you discover a security vulnerability within axios, please submit a report via [huntr.dev](https://huntr.dev/bounties/?target=https%3A%2F%2Fgithub.com%2Faxios%2Faxios). Bounties and CVEs are automatically managed and allocated via the platform.
|
||||||
|
|
||||||
|
All security vulnerabilities will be promptly addressed.
|
||||||
169
node_modules/axios/UPGRADE_GUIDE.md
generated
vendored
Normal file
169
node_modules/axios/UPGRADE_GUIDE.md
generated
vendored
Normal file
@@ -0,0 +1,169 @@
|
|||||||
|
# Upgrade Guide
|
||||||
|
|
||||||
|
## 0.18.x -> 0.19.0
|
||||||
|
|
||||||
|
### HTTPS Proxies
|
||||||
|
|
||||||
|
Routing through an https proxy now requires setting the `protocol` attribute of the proxy configuration to `https`
|
||||||
|
|
||||||
|
## 0.15.x -> 0.16.0
|
||||||
|
|
||||||
|
### `Promise` Type Declarations
|
||||||
|
|
||||||
|
The `Promise` type declarations have been removed from the axios typings in favor of the built-in type declarations. If you use axios in a TypeScript project that targets `ES5`, please make sure to include the `es2015.promise` lib. Please see [this post](https://blog.mariusschulz.com/2016/11/25/typescript-2-0-built-in-type-declarations) for details.
|
||||||
|
|
||||||
|
## 0.13.x -> 0.14.0
|
||||||
|
|
||||||
|
### TypeScript Definitions
|
||||||
|
|
||||||
|
The axios TypeScript definitions have been updated to match the axios API and use the ES2015 module syntax.
|
||||||
|
|
||||||
|
Please use the following `import` statement to import axios in TypeScript:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
axios.get('/foo')
|
||||||
|
.then(response => console.log(response))
|
||||||
|
.catch(error => console.log(error));
|
||||||
|
```
|
||||||
|
|
||||||
|
### `agent` Config Option
|
||||||
|
|
||||||
|
The `agent` config option has been replaced with two new options: `httpAgent` and `httpsAgent`. Please use them instead.
|
||||||
|
|
||||||
|
```js
|
||||||
|
{
|
||||||
|
// Define a custom agent for HTTP
|
||||||
|
httpAgent: new http.Agent({ keepAlive: true }),
|
||||||
|
// Define a custom agent for HTTPS
|
||||||
|
httpsAgent: new https.Agent({ keepAlive: true })
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### `progress` Config Option
|
||||||
|
|
||||||
|
The `progress` config option has been replaced with the `onUploadProgress` and `onDownloadProgress` options.
|
||||||
|
|
||||||
|
```js
|
||||||
|
{
|
||||||
|
// Define a handler for upload progress events
|
||||||
|
onUploadProgress: function (progressEvent) {
|
||||||
|
// ...
|
||||||
|
},
|
||||||
|
|
||||||
|
// Define a handler for download progress events
|
||||||
|
onDownloadProgress: function (progressEvent) {
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 0.12.x -> 0.13.0
|
||||||
|
|
||||||
|
The `0.13.0` release contains several changes to custom adapters and error handling.
|
||||||
|
|
||||||
|
### Error Handling
|
||||||
|
|
||||||
|
Previous to this release an error could either be a server response with bad status code or an actual `Error`. With this release Promise will always reject with an `Error`. In the case that a response was received, the `Error` will also include the response.
|
||||||
|
|
||||||
|
```js
|
||||||
|
axios.get('/user/12345')
|
||||||
|
.catch((error) => {
|
||||||
|
console.log(error.message);
|
||||||
|
console.log(error.code); // Not always specified
|
||||||
|
console.log(error.config); // The config that was used to make the request
|
||||||
|
console.log(error.response); // Only available if response was received from the server
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Request Adapters
|
||||||
|
|
||||||
|
This release changes a few things about how request adapters work. Please take note if you are using your own custom adapter.
|
||||||
|
|
||||||
|
1. Response transformer is now called outside of adapter.
|
||||||
|
2. Request adapter returns a `Promise`.
|
||||||
|
|
||||||
|
This means that you no longer need to invoke `transformData` on response data. You will also no longer receive `resolve` and `reject` as arguments in your adapter.
|
||||||
|
|
||||||
|
Previous code:
|
||||||
|
|
||||||
|
```js
|
||||||
|
function myAdapter(resolve, reject, config) {
|
||||||
|
var response = {
|
||||||
|
data: transformData(
|
||||||
|
responseData,
|
||||||
|
responseHeaders,
|
||||||
|
config.transformResponse
|
||||||
|
),
|
||||||
|
status: request.status,
|
||||||
|
statusText: request.statusText,
|
||||||
|
headers: responseHeaders
|
||||||
|
};
|
||||||
|
settle(resolve, reject, response);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
New code:
|
||||||
|
|
||||||
|
```js
|
||||||
|
function myAdapter(config) {
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
var response = {
|
||||||
|
data: responseData,
|
||||||
|
status: request.status,
|
||||||
|
statusText: request.statusText,
|
||||||
|
headers: responseHeaders
|
||||||
|
};
|
||||||
|
settle(resolve, reject, response);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
See the related commits for more details:
|
||||||
|
|
||||||
|
- [Response transformers](https://github.com/axios/axios/commit/10eb23865101f9347570552c04e9d6211376e25e)
|
||||||
|
- [Request adapter Promise](https://github.com/axios/axios/commit/157efd5615890301824e3121cc6c9d2f9b21f94a)
|
||||||
|
|
||||||
|
## 0.5.x -> 0.6.0
|
||||||
|
|
||||||
|
The `0.6.0` release contains mostly bug fixes, but there are a couple things to be aware of when upgrading.
|
||||||
|
|
||||||
|
### ES6 Promise Polyfill
|
||||||
|
|
||||||
|
Up until the `0.6.0` release ES6 `Promise` was being polyfilled using [es6-promise](https://github.com/jakearchibald/es6-promise). With this release, the polyfill has been removed, and you will need to supply it yourself if your environment needs it.
|
||||||
|
|
||||||
|
```js
|
||||||
|
require('es6-promise').polyfill();
|
||||||
|
var axios = require('axios');
|
||||||
|
```
|
||||||
|
|
||||||
|
This will polyfill the global environment, and only needs to be done once.
|
||||||
|
|
||||||
|
### `axios.success`/`axios.error`
|
||||||
|
|
||||||
|
The `success`, and `error` aliases were deprecated in [0.4.0](https://github.com/axios/axios/blob/master/CHANGELOG.md#040-oct-03-2014). As of this release they have been removed entirely. Instead please use `axios.then`, and `axios.catch` respectively.
|
||||||
|
|
||||||
|
```js
|
||||||
|
axios.get('some/url')
|
||||||
|
.then(function (res) {
|
||||||
|
/* ... */
|
||||||
|
})
|
||||||
|
.catch(function (err) {
|
||||||
|
/* ... */
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### UMD
|
||||||
|
|
||||||
|
Previous versions of axios shipped with an AMD, CommonJS, and Global build. This has all been rolled into a single UMD build.
|
||||||
|
|
||||||
|
```js
|
||||||
|
// AMD
|
||||||
|
require(['bower_components/axios/dist/axios'], function (axios) {
|
||||||
|
/* ... */
|
||||||
|
});
|
||||||
|
|
||||||
|
// CommonJS
|
||||||
|
var axios = require('axios/dist/axios');
|
||||||
|
```
|
||||||
19
node_modules/axios/bin/check-build-version.js
generated
vendored
Normal file
19
node_modules/axios/bin/check-build-version.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
const fs = require('fs');
|
||||||
|
const assert = require('assert');
|
||||||
|
const axios = require('../index.js');
|
||||||
|
|
||||||
|
const {version} = JSON.parse(fs.readFileSync('./package.json'));
|
||||||
|
|
||||||
|
console.log('Checking versions...\n----------------------------')
|
||||||
|
|
||||||
|
console.log(`Package version: v${version}`);
|
||||||
|
console.log(`Axios version: v${axios.VERSION}`);
|
||||||
|
console.log(`----------------------------`);
|
||||||
|
|
||||||
|
assert.strictEqual(
|
||||||
|
version,
|
||||||
|
axios.VERSION,
|
||||||
|
`Version mismatch between package and Axios ${version} != ${axios.VERSION}`
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log('✔️ PASSED\n');
|
||||||
22
node_modules/axios/bin/ssl_hotfix.js
generated
vendored
Normal file
22
node_modules/axios/bin/ssl_hotfix.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
const {spawn} = require('child_process');
|
||||||
|
|
||||||
|
const args = process.argv.slice(2);
|
||||||
|
|
||||||
|
console.log(`Running ${args.join(' ')} on ${process.version}\n`);
|
||||||
|
|
||||||
|
const match = /v(\d+)/.exec(process.version);
|
||||||
|
|
||||||
|
const isHotfixNeeded = match && match[1] > 16;
|
||||||
|
|
||||||
|
isHotfixNeeded && console.warn('Setting --openssl-legacy-provider as ssl hotfix');
|
||||||
|
|
||||||
|
const test = spawn('cross-env',
|
||||||
|
isHotfixNeeded ? ['NODE_OPTIONS=--openssl-legacy-provider', ...args] : args, {
|
||||||
|
shell: true,
|
||||||
|
stdio: 'inherit'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
test.on('exit', function (code) {
|
||||||
|
process.exit(code)
|
||||||
|
})
|
||||||
2377
node_modules/axios/dist/axios.js
generated
vendored
Normal file
2377
node_modules/axios/dist/axios.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/axios/dist/axios.js.map
generated
vendored
Normal file
1
node_modules/axios/dist/axios.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
node_modules/axios/dist/axios.min.js
generated
vendored
Normal file
2
node_modules/axios/dist/axios.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/axios/dist/axios.min.js.map
generated
vendored
Normal file
1
node_modules/axios/dist/axios.min.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2369
node_modules/axios/dist/esm/axios.js
generated
vendored
Normal file
2369
node_modules/axios/dist/esm/axios.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/axios/dist/esm/axios.js.map
generated
vendored
Normal file
1
node_modules/axios/dist/esm/axios.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
node_modules/axios/dist/esm/axios.min.js
generated
vendored
Normal file
2
node_modules/axios/dist/esm/axios.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/axios/dist/esm/axios.min.js.map
generated
vendored
Normal file
1
node_modules/axios/dist/esm/axios.min.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
340
node_modules/axios/index.d.ts
generated
vendored
Normal file
340
node_modules/axios/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,340 @@
|
|||||||
|
// TypeScript Version: 4.1
|
||||||
|
type HeaderValue = string | string[] | number | boolean;
|
||||||
|
|
||||||
|
type AxiosHeaders = Record<string, HeaderValue | Record<Method & CommonHeaders, HeaderValue>>;
|
||||||
|
|
||||||
|
type MethodsHeaders = {
|
||||||
|
[Key in Method as Lowercase<Key>]: AxiosHeaders;
|
||||||
|
};
|
||||||
|
|
||||||
|
interface CommonHeaders {
|
||||||
|
common: AxiosHeaders;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type AxiosRequestHeaders = Partial<AxiosHeaders & MethodsHeaders & CommonHeaders>;
|
||||||
|
|
||||||
|
export type AxiosResponseHeaders = Partial<Record<string, string>> & {
|
||||||
|
"set-cookie"?: string[]
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface AxiosRequestTransformer {
|
||||||
|
(data: any, headers: AxiosRequestHeaders): any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosResponseTransformer {
|
||||||
|
(data: any, headers?: AxiosResponseHeaders, status?: number): any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosAdapter {
|
||||||
|
(config: AxiosRequestConfig): AxiosPromise;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosBasicCredentials {
|
||||||
|
username: string;
|
||||||
|
password: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosProxyConfig {
|
||||||
|
host: string;
|
||||||
|
port: number;
|
||||||
|
auth?: {
|
||||||
|
username: string;
|
||||||
|
password: string;
|
||||||
|
};
|
||||||
|
protocol?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Method =
|
||||||
|
| 'get' | 'GET'
|
||||||
|
| 'delete' | 'DELETE'
|
||||||
|
| 'head' | 'HEAD'
|
||||||
|
| 'options' | 'OPTIONS'
|
||||||
|
| 'post' | 'POST'
|
||||||
|
| 'put' | 'PUT'
|
||||||
|
| 'patch' | 'PATCH'
|
||||||
|
| 'purge' | 'PURGE'
|
||||||
|
| 'link' | 'LINK'
|
||||||
|
| 'unlink' | 'UNLINK';
|
||||||
|
|
||||||
|
export type ResponseType =
|
||||||
|
| 'arraybuffer'
|
||||||
|
| 'blob'
|
||||||
|
| 'document'
|
||||||
|
| 'json'
|
||||||
|
| 'text'
|
||||||
|
| 'stream';
|
||||||
|
|
||||||
|
export type responseEncoding =
|
||||||
|
| 'ascii' | 'ASCII'
|
||||||
|
| 'ansi' | 'ANSI'
|
||||||
|
| 'binary' | 'BINARY'
|
||||||
|
| 'base64' | 'BASE64'
|
||||||
|
| 'base64url' | 'BASE64URL'
|
||||||
|
| 'hex' | 'HEX'
|
||||||
|
| 'latin1' | 'LATIN1'
|
||||||
|
| 'ucs-2' | 'UCS-2'
|
||||||
|
| 'ucs2' | 'UCS2'
|
||||||
|
| 'utf-8' | 'UTF-8'
|
||||||
|
| 'utf8' | 'UTF8'
|
||||||
|
| 'utf16le' | 'UTF16LE';
|
||||||
|
|
||||||
|
export interface TransitionalOptions {
|
||||||
|
silentJSONParsing?: boolean;
|
||||||
|
forcedJSONParsing?: boolean;
|
||||||
|
clarifyTimeoutError?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GenericAbortSignal {
|
||||||
|
aborted: boolean;
|
||||||
|
onabort: ((...args: any) => any) | null;
|
||||||
|
addEventListener: (...args: any) => any;
|
||||||
|
removeEventListener: (...args: any) => any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FormDataVisitorHelpers {
|
||||||
|
defaultVisitor: SerializerVisitor;
|
||||||
|
convertValue: (value: any) => any;
|
||||||
|
isVisitable: (value: any) => boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SerializerVisitor {
|
||||||
|
(
|
||||||
|
this: GenericFormData,
|
||||||
|
value: any,
|
||||||
|
key: string | number,
|
||||||
|
path: null | Array<string | number>,
|
||||||
|
helpers: FormDataVisitorHelpers
|
||||||
|
): boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SerializerOptions {
|
||||||
|
visitor?: SerializerVisitor;
|
||||||
|
dots?: boolean;
|
||||||
|
metaTokens?: boolean;
|
||||||
|
indexes?: boolean | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// tslint:disable-next-line
|
||||||
|
export interface FormSerializerOptions extends SerializerOptions {
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ParamEncoder {
|
||||||
|
(value: any, defaultEncoder: (value: any) => any): any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CustomParamsSerializer {
|
||||||
|
(params: Record<string, any>, options?: ParamsSerializerOptions): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ParamsSerializerOptions extends SerializerOptions {
|
||||||
|
encode?: ParamEncoder;
|
||||||
|
serialize?: CustomParamsSerializer;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosRequestConfig<D = any> {
|
||||||
|
url?: string;
|
||||||
|
method?: Method | string;
|
||||||
|
baseURL?: string;
|
||||||
|
transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[];
|
||||||
|
transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[];
|
||||||
|
headers?: AxiosRequestHeaders;
|
||||||
|
params?: any;
|
||||||
|
paramsSerializer?: ParamsSerializerOptions | CustomParamsSerializer;
|
||||||
|
data?: D;
|
||||||
|
timeout?: number;
|
||||||
|
timeoutErrorMessage?: string;
|
||||||
|
withCredentials?: boolean;
|
||||||
|
adapter?: AxiosAdapter;
|
||||||
|
auth?: AxiosBasicCredentials;
|
||||||
|
responseType?: ResponseType;
|
||||||
|
responseEncoding?: responseEncoding | string;
|
||||||
|
xsrfCookieName?: string;
|
||||||
|
xsrfHeaderName?: string;
|
||||||
|
onUploadProgress?: (progressEvent: ProgressEvent) => void;
|
||||||
|
onDownloadProgress?: (progressEvent: ProgressEvent) => void;
|
||||||
|
maxContentLength?: number;
|
||||||
|
validateStatus?: ((status: number) => boolean) | null;
|
||||||
|
maxBodyLength?: number;
|
||||||
|
maxRedirects?: number;
|
||||||
|
beforeRedirect?: (options: Record<string, any>, responseDetails: {headers: Record<string, string>}) => void;
|
||||||
|
socketPath?: string | null;
|
||||||
|
httpAgent?: any;
|
||||||
|
httpsAgent?: any;
|
||||||
|
proxy?: AxiosProxyConfig | false;
|
||||||
|
cancelToken?: CancelToken;
|
||||||
|
decompress?: boolean;
|
||||||
|
transitional?: TransitionalOptions;
|
||||||
|
signal?: GenericAbortSignal;
|
||||||
|
insecureHTTPParser?: boolean;
|
||||||
|
env?: {
|
||||||
|
FormData?: new (...args: any[]) => object;
|
||||||
|
};
|
||||||
|
formSerializer?: FormSerializerOptions;
|
||||||
|
withXSRFToken?: boolean | ((config: AxiosRequestConfig) => boolean | undefined);
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface HeadersDefaults {
|
||||||
|
common: AxiosRequestHeaders;
|
||||||
|
delete: AxiosRequestHeaders;
|
||||||
|
get: AxiosRequestHeaders;
|
||||||
|
head: AxiosRequestHeaders;
|
||||||
|
post: AxiosRequestHeaders;
|
||||||
|
put: AxiosRequestHeaders;
|
||||||
|
patch: AxiosRequestHeaders;
|
||||||
|
options?: AxiosRequestHeaders;
|
||||||
|
purge?: AxiosRequestHeaders;
|
||||||
|
link?: AxiosRequestHeaders;
|
||||||
|
unlink?: AxiosRequestHeaders;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>, 'headers'> {
|
||||||
|
headers: HeadersDefaults;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateAxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>, 'headers'> {
|
||||||
|
headers?: AxiosRequestHeaders | Partial<HeadersDefaults>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosResponse<T = any, D = any> {
|
||||||
|
data: T;
|
||||||
|
status: number;
|
||||||
|
statusText: string;
|
||||||
|
headers: AxiosResponseHeaders;
|
||||||
|
config: AxiosRequestConfig<D>;
|
||||||
|
request?: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class AxiosError<T = unknown, D = any> extends Error {
|
||||||
|
constructor(
|
||||||
|
message?: string,
|
||||||
|
code?: string,
|
||||||
|
config?: AxiosRequestConfig<D>,
|
||||||
|
request?: any,
|
||||||
|
response?: AxiosResponse<T, D>
|
||||||
|
);
|
||||||
|
|
||||||
|
config?: AxiosRequestConfig<D>;
|
||||||
|
code?: string;
|
||||||
|
request?: any;
|
||||||
|
response?: AxiosResponse<T, D>;
|
||||||
|
isAxiosError: boolean;
|
||||||
|
status?: number;
|
||||||
|
toJSON: () => object;
|
||||||
|
cause?: Error;
|
||||||
|
static readonly ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS";
|
||||||
|
static readonly ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE";
|
||||||
|
static readonly ERR_BAD_OPTION = "ERR_BAD_OPTION";
|
||||||
|
static readonly ERR_NETWORK = "ERR_NETWORK";
|
||||||
|
static readonly ERR_DEPRECATED = "ERR_DEPRECATED";
|
||||||
|
static readonly ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE";
|
||||||
|
static readonly ERR_BAD_REQUEST = "ERR_BAD_REQUEST";
|
||||||
|
static readonly ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
|
||||||
|
static readonly ERR_INVALID_URL = "ERR_INVALID_URL";
|
||||||
|
static readonly ERR_CANCELED = "ERR_CANCELED";
|
||||||
|
static readonly ECONNABORTED = "ECONNABORTED";
|
||||||
|
static readonly ETIMEDOUT = "ETIMEDOUT";
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CanceledError<T> extends AxiosError<T> {
|
||||||
|
}
|
||||||
|
|
||||||
|
export type AxiosPromise<T = any> = Promise<AxiosResponse<T>>;
|
||||||
|
|
||||||
|
export interface CancelStatic {
|
||||||
|
new (message?: string): Cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Cancel {
|
||||||
|
message: string | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Canceler {
|
||||||
|
(message?: string, config?: AxiosRequestConfig, request?: any): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CancelTokenStatic {
|
||||||
|
new (executor: (cancel: Canceler) => void): CancelToken;
|
||||||
|
source(): CancelTokenSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CancelToken {
|
||||||
|
promise: Promise<Cancel>;
|
||||||
|
reason?: Cancel;
|
||||||
|
throwIfRequested(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CancelTokenSource {
|
||||||
|
token: CancelToken;
|
||||||
|
cancel: Canceler;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosInterceptorOptions {
|
||||||
|
synchronous?: boolean;
|
||||||
|
runWhen?: (config: AxiosRequestConfig) => boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosInterceptorManager<V> {
|
||||||
|
use<T = V>(onFulfilled?: (value: V) => T | Promise<T>, onRejected?: (error: any) => any, options?: AxiosInterceptorOptions): number;
|
||||||
|
eject(id: number): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Axios {
|
||||||
|
constructor(config?: AxiosRequestConfig);
|
||||||
|
defaults: AxiosDefaults;
|
||||||
|
interceptors: {
|
||||||
|
request: AxiosInterceptorManager<AxiosRequestConfig>;
|
||||||
|
response: AxiosInterceptorManager<AxiosResponse>;
|
||||||
|
};
|
||||||
|
getUri(config?: AxiosRequestConfig): string;
|
||||||
|
request<T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D>): Promise<R>;
|
||||||
|
get<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
||||||
|
delete<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
||||||
|
head<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
||||||
|
options<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
||||||
|
post<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
||||||
|
put<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
||||||
|
patch<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
||||||
|
postForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
||||||
|
putForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
||||||
|
patchForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosInstance extends Axios {
|
||||||
|
<T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D>): AxiosPromise<R>;
|
||||||
|
<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): AxiosPromise<R>;
|
||||||
|
|
||||||
|
defaults: Omit<AxiosDefaults, 'headers'> & {
|
||||||
|
headers: HeadersDefaults & {
|
||||||
|
[key: string]: string | number | boolean | undefined
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GenericFormData {
|
||||||
|
append(name: string, value: any, options?: any): any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GenericHTMLFormElement {
|
||||||
|
name: string;
|
||||||
|
method: string;
|
||||||
|
submit(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosStatic extends AxiosInstance {
|
||||||
|
create(config?: CreateAxiosDefaults): AxiosInstance;
|
||||||
|
Cancel: CancelStatic;
|
||||||
|
CancelToken: CancelTokenStatic;
|
||||||
|
Axios: typeof Axios;
|
||||||
|
AxiosError: typeof AxiosError;
|
||||||
|
readonly VERSION: string;
|
||||||
|
isCancel(value: any): value is Cancel;
|
||||||
|
all<T>(values: Array<T | Promise<T>>): Promise<T[]>;
|
||||||
|
spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R;
|
||||||
|
isAxiosError<T = any, D = any>(payload: any): payload is AxiosError<T, D>;
|
||||||
|
toFormData(sourceObj: object, targetFormData?: GenericFormData, options?: FormSerializerOptions): GenericFormData;
|
||||||
|
formToJSON(form: GenericFormData|GenericHTMLFormElement): object;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare const axios: AxiosStatic;
|
||||||
|
|
||||||
|
export default axios;
|
||||||
1
node_modules/axios/index.js
generated
vendored
Normal file
1
node_modules/axios/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
module.exports = require('./lib/axios');
|
||||||
37
node_modules/axios/lib/adapters/README.md
generated
vendored
Normal file
37
node_modules/axios/lib/adapters/README.md
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
# axios // adapters
|
||||||
|
|
||||||
|
The modules under `adapters/` are modules that handle dispatching a request and settling a returned `Promise` once a response is received.
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```js
|
||||||
|
var settle = require('./../core/settle');
|
||||||
|
|
||||||
|
module.exports = function myAdapter(config) {
|
||||||
|
// At this point:
|
||||||
|
// - config has been merged with defaults
|
||||||
|
// - request transformers have already run
|
||||||
|
// - request interceptors have already run
|
||||||
|
|
||||||
|
// Make the request using config provided
|
||||||
|
// Upon response settle the Promise
|
||||||
|
|
||||||
|
return new Promise(function(resolve, reject) {
|
||||||
|
|
||||||
|
var response = {
|
||||||
|
data: responseData,
|
||||||
|
status: request.status,
|
||||||
|
statusText: request.statusText,
|
||||||
|
headers: responseHeaders,
|
||||||
|
config: config,
|
||||||
|
request: request
|
||||||
|
};
|
||||||
|
|
||||||
|
settle(resolve, reject, response);
|
||||||
|
|
||||||
|
// From here:
|
||||||
|
// - response transformers will run
|
||||||
|
// - response interceptors will run
|
||||||
|
});
|
||||||
|
}
|
||||||
|
```
|
||||||
463
node_modules/axios/lib/adapters/http.js
generated
vendored
Normal file
463
node_modules/axios/lib/adapters/http.js
generated
vendored
Normal file
@@ -0,0 +1,463 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./../utils');
|
||||||
|
var settle = require('./../core/settle');
|
||||||
|
var buildFullPath = require('../core/buildFullPath');
|
||||||
|
var buildURL = require('./../helpers/buildURL');
|
||||||
|
var getProxyForUrl = require('proxy-from-env').getProxyForUrl;
|
||||||
|
var http = require('http');
|
||||||
|
var https = require('https');
|
||||||
|
var httpFollow = require('follow-redirects/http');
|
||||||
|
var httpsFollow = require('follow-redirects/https');
|
||||||
|
var url = require('url');
|
||||||
|
var zlib = require('zlib');
|
||||||
|
var VERSION = require('./../env/data').version;
|
||||||
|
var transitionalDefaults = require('../defaults/transitional');
|
||||||
|
var AxiosError = require('../core/AxiosError');
|
||||||
|
var CanceledError = require('../cancel/CanceledError');
|
||||||
|
var platform = require('../platform');
|
||||||
|
var fromDataURI = require('../helpers/fromDataURI');
|
||||||
|
var stream = require('stream');
|
||||||
|
|
||||||
|
var isHttps = /https:?/;
|
||||||
|
|
||||||
|
var supportedProtocols = platform.protocols.map(function(protocol) {
|
||||||
|
return protocol + ':';
|
||||||
|
});
|
||||||
|
|
||||||
|
function dispatchBeforeRedirect(options) {
|
||||||
|
if (options.beforeRedirects.proxy) {
|
||||||
|
options.beforeRedirects.proxy(options);
|
||||||
|
}
|
||||||
|
if (options.beforeRedirects.config) {
|
||||||
|
options.beforeRedirects.config(options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {http.ClientRequestArgs} options
|
||||||
|
* @param {AxiosProxyConfig} configProxy
|
||||||
|
* @param {string} location
|
||||||
|
*/
|
||||||
|
function setProxy(options, configProxy, location) {
|
||||||
|
var proxy = configProxy;
|
||||||
|
if (!proxy && proxy !== false) {
|
||||||
|
var proxyUrl = getProxyForUrl(location);
|
||||||
|
if (proxyUrl) {
|
||||||
|
proxy = url.parse(proxyUrl);
|
||||||
|
// replace 'host' since the proxy object is not a URL object
|
||||||
|
proxy.host = proxy.hostname;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (proxy) {
|
||||||
|
// Basic proxy authorization
|
||||||
|
if (proxy.auth) {
|
||||||
|
// Support proxy auth object form
|
||||||
|
if (proxy.auth.username || proxy.auth.password) {
|
||||||
|
proxy.auth = (proxy.auth.username || '') + ':' + (proxy.auth.password || '');
|
||||||
|
}
|
||||||
|
var base64 = Buffer
|
||||||
|
.from(proxy.auth, 'utf8')
|
||||||
|
.toString('base64');
|
||||||
|
options.headers['Proxy-Authorization'] = 'Basic ' + base64;
|
||||||
|
}
|
||||||
|
|
||||||
|
options.headers.host = options.hostname + (options.port ? ':' + options.port : '');
|
||||||
|
options.hostname = proxy.host;
|
||||||
|
options.host = proxy.host;
|
||||||
|
options.port = proxy.port;
|
||||||
|
options.path = location;
|
||||||
|
if (proxy.protocol) {
|
||||||
|
options.protocol = proxy.protocol;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
options.beforeRedirects.proxy = function beforeRedirect(redirectOptions) {
|
||||||
|
// Configure proxy for redirected request, passing the original config proxy to apply
|
||||||
|
// the exact same logic as if the redirected request was performed by axios directly.
|
||||||
|
setProxy(redirectOptions, configProxy, redirectOptions.href);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/*eslint consistent-return:0*/
|
||||||
|
module.exports = function httpAdapter(config) {
|
||||||
|
return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) {
|
||||||
|
var onCanceled;
|
||||||
|
function done() {
|
||||||
|
if (config.cancelToken) {
|
||||||
|
config.cancelToken.unsubscribe(onCanceled);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.signal) {
|
||||||
|
config.signal.removeEventListener('abort', onCanceled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var resolve = function resolve(value) {
|
||||||
|
done();
|
||||||
|
resolvePromise(value);
|
||||||
|
};
|
||||||
|
var rejected = false;
|
||||||
|
var reject = function reject(value) {
|
||||||
|
done();
|
||||||
|
rejected = true;
|
||||||
|
rejectPromise(value);
|
||||||
|
};
|
||||||
|
var data = config.data;
|
||||||
|
var responseType = config.responseType;
|
||||||
|
var responseEncoding = config.responseEncoding;
|
||||||
|
var method = config.method.toUpperCase();
|
||||||
|
|
||||||
|
// Parse url
|
||||||
|
var fullPath = buildFullPath(config.baseURL, config.url);
|
||||||
|
var parsed = url.parse(fullPath);
|
||||||
|
var protocol = parsed.protocol || supportedProtocols[0];
|
||||||
|
|
||||||
|
if (protocol === 'data:') {
|
||||||
|
var convertedData;
|
||||||
|
|
||||||
|
if (method !== 'GET') {
|
||||||
|
return settle(resolve, reject, {
|
||||||
|
status: 405,
|
||||||
|
statusText: 'method not allowed',
|
||||||
|
headers: {},
|
||||||
|
config: config
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
convertedData = fromDataURI(config.url, responseType === 'blob', {
|
||||||
|
Blob: config.env && config.env.Blob
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (responseType === 'text') {
|
||||||
|
convertedData = convertedData.toString(responseEncoding);
|
||||||
|
|
||||||
|
if (!responseEncoding || responseEncoding === 'utf8') {
|
||||||
|
data = utils.stripBOM(convertedData);
|
||||||
|
}
|
||||||
|
} else if (responseType === 'stream') {
|
||||||
|
convertedData = stream.Readable.from(convertedData);
|
||||||
|
}
|
||||||
|
|
||||||
|
return settle(resolve, reject, {
|
||||||
|
data: convertedData,
|
||||||
|
status: 200,
|
||||||
|
statusText: 'OK',
|
||||||
|
headers: {},
|
||||||
|
config: config
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (supportedProtocols.indexOf(protocol) === -1) {
|
||||||
|
return reject(new AxiosError(
|
||||||
|
'Unsupported protocol ' + protocol,
|
||||||
|
AxiosError.ERR_BAD_REQUEST,
|
||||||
|
config
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
var headers = config.headers;
|
||||||
|
var headerNames = {};
|
||||||
|
|
||||||
|
Object.keys(headers).forEach(function storeLowerName(name) {
|
||||||
|
headerNames[name.toLowerCase()] = name;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Set User-Agent (required by some servers)
|
||||||
|
// See https://github.com/axios/axios/issues/69
|
||||||
|
if ('user-agent' in headerNames) {
|
||||||
|
// User-Agent is specified; handle case where no UA header is desired
|
||||||
|
if (!headers[headerNames['user-agent']]) {
|
||||||
|
delete headers[headerNames['user-agent']];
|
||||||
|
}
|
||||||
|
// Otherwise, use specified value
|
||||||
|
} else {
|
||||||
|
// Only set header if it hasn't been set in config
|
||||||
|
headers['User-Agent'] = 'axios/' + VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
// support for https://www.npmjs.com/package/form-data api
|
||||||
|
if (utils.isFormData(data) && utils.isFunction(data.getHeaders)) {
|
||||||
|
Object.assign(headers, data.getHeaders());
|
||||||
|
} else if (data && !utils.isStream(data)) {
|
||||||
|
if (Buffer.isBuffer(data)) {
|
||||||
|
// Nothing to do...
|
||||||
|
} else if (utils.isArrayBuffer(data)) {
|
||||||
|
data = Buffer.from(new Uint8Array(data));
|
||||||
|
} else if (utils.isString(data)) {
|
||||||
|
data = Buffer.from(data, 'utf-8');
|
||||||
|
} else {
|
||||||
|
return reject(new AxiosError(
|
||||||
|
'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',
|
||||||
|
AxiosError.ERR_BAD_REQUEST,
|
||||||
|
config
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {
|
||||||
|
return reject(new AxiosError(
|
||||||
|
'Request body larger than maxBodyLength limit',
|
||||||
|
AxiosError.ERR_BAD_REQUEST,
|
||||||
|
config
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add Content-Length header if data exists
|
||||||
|
if (!headerNames['content-length']) {
|
||||||
|
headers['Content-Length'] = data.length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// HTTP basic authentication
|
||||||
|
var auth = undefined;
|
||||||
|
if (config.auth) {
|
||||||
|
var username = config.auth.username || '';
|
||||||
|
var password = config.auth.password || '';
|
||||||
|
auth = username + ':' + password;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!auth && parsed.auth) {
|
||||||
|
var urlAuth = parsed.auth.split(':');
|
||||||
|
var urlUsername = urlAuth[0] || '';
|
||||||
|
var urlPassword = urlAuth[1] || '';
|
||||||
|
auth = urlUsername + ':' + urlPassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (auth && headerNames.authorization) {
|
||||||
|
delete headers[headerNames.authorization];
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, '');
|
||||||
|
} catch (err) {
|
||||||
|
var customErr = new Error(err.message);
|
||||||
|
customErr.config = config;
|
||||||
|
customErr.url = config.url;
|
||||||
|
customErr.exists = true;
|
||||||
|
reject(customErr);
|
||||||
|
}
|
||||||
|
|
||||||
|
var options = {
|
||||||
|
path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''),
|
||||||
|
method: method,
|
||||||
|
headers: headers,
|
||||||
|
agents: { http: config.httpAgent, https: config.httpsAgent },
|
||||||
|
auth: auth,
|
||||||
|
protocol: protocol,
|
||||||
|
beforeRedirect: dispatchBeforeRedirect,
|
||||||
|
beforeRedirects: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (config.socketPath) {
|
||||||
|
options.socketPath = config.socketPath;
|
||||||
|
} else {
|
||||||
|
options.hostname = parsed.hostname;
|
||||||
|
options.port = parsed.port;
|
||||||
|
setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
|
||||||
|
}
|
||||||
|
|
||||||
|
var transport;
|
||||||
|
var isHttpsRequest = isHttps.test(options.protocol);
|
||||||
|
options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
|
||||||
|
if (config.transport) {
|
||||||
|
transport = config.transport;
|
||||||
|
} else if (config.maxRedirects === 0) {
|
||||||
|
transport = isHttpsRequest ? https : http;
|
||||||
|
} else {
|
||||||
|
if (config.maxRedirects) {
|
||||||
|
options.maxRedirects = config.maxRedirects;
|
||||||
|
}
|
||||||
|
if (config.beforeRedirect) {
|
||||||
|
options.beforeRedirects.config = config.beforeRedirect;
|
||||||
|
}
|
||||||
|
transport = isHttpsRequest ? httpsFollow : httpFollow;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.maxBodyLength > -1) {
|
||||||
|
options.maxBodyLength = config.maxBodyLength;
|
||||||
|
} else {
|
||||||
|
// follow-redirects does not skip comparison, so it should always succeed for axios -1 unlimited
|
||||||
|
options.maxBodyLength = Infinity;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.insecureHTTPParser) {
|
||||||
|
options.insecureHTTPParser = config.insecureHTTPParser;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the request
|
||||||
|
var req = transport.request(options, function handleResponse(res) {
|
||||||
|
if (req.aborted) return;
|
||||||
|
|
||||||
|
// uncompress the response body transparently if required
|
||||||
|
var responseStream = res;
|
||||||
|
|
||||||
|
// return the last request in case of redirects
|
||||||
|
var lastRequest = res.req || req;
|
||||||
|
|
||||||
|
// if decompress disabled we should not decompress
|
||||||
|
if (config.decompress !== false) {
|
||||||
|
// if no content, but headers still say that it is encoded,
|
||||||
|
// remove the header not confuse downstream operations
|
||||||
|
if (data && data.length === 0 && res.headers['content-encoding']) {
|
||||||
|
delete res.headers['content-encoding'];
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (res.headers['content-encoding']) {
|
||||||
|
/*eslint default-case:0*/
|
||||||
|
case 'gzip':
|
||||||
|
case 'compress':
|
||||||
|
case 'deflate':
|
||||||
|
// add the unzipper to the body stream processing pipeline
|
||||||
|
responseStream = responseStream.pipe(zlib.createUnzip());
|
||||||
|
|
||||||
|
// remove the content-encoding in order to not confuse downstream operations
|
||||||
|
delete res.headers['content-encoding'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var response = {
|
||||||
|
status: res.statusCode,
|
||||||
|
statusText: res.statusMessage,
|
||||||
|
headers: res.headers,
|
||||||
|
config: config,
|
||||||
|
request: lastRequest
|
||||||
|
};
|
||||||
|
|
||||||
|
if (responseType === 'stream') {
|
||||||
|
response.data = responseStream;
|
||||||
|
settle(resolve, reject, response);
|
||||||
|
} else {
|
||||||
|
var responseBuffer = [];
|
||||||
|
var totalResponseBytes = 0;
|
||||||
|
responseStream.on('data', function handleStreamData(chunk) {
|
||||||
|
responseBuffer.push(chunk);
|
||||||
|
totalResponseBytes += chunk.length;
|
||||||
|
|
||||||
|
// make sure the content length is not over the maxContentLength if specified
|
||||||
|
if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) {
|
||||||
|
// stream.destroy() emit aborted event before calling reject() on Node.js v16
|
||||||
|
rejected = true;
|
||||||
|
responseStream.destroy();
|
||||||
|
reject(new AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded',
|
||||||
|
AxiosError.ERR_BAD_RESPONSE, config, lastRequest));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
responseStream.on('aborted', function handlerStreamAborted() {
|
||||||
|
if (rejected) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
responseStream.destroy();
|
||||||
|
reject(new AxiosError(
|
||||||
|
'maxContentLength size of ' + config.maxContentLength + ' exceeded',
|
||||||
|
AxiosError.ERR_BAD_RESPONSE,
|
||||||
|
config,
|
||||||
|
lastRequest
|
||||||
|
));
|
||||||
|
});
|
||||||
|
|
||||||
|
responseStream.on('error', function handleStreamError(err) {
|
||||||
|
if (req.aborted) return;
|
||||||
|
reject(AxiosError.from(err, null, config, lastRequest));
|
||||||
|
});
|
||||||
|
|
||||||
|
responseStream.on('end', function handleStreamEnd() {
|
||||||
|
try {
|
||||||
|
var responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer);
|
||||||
|
if (responseType !== 'arraybuffer') {
|
||||||
|
responseData = responseData.toString(responseEncoding);
|
||||||
|
if (!responseEncoding || responseEncoding === 'utf8') {
|
||||||
|
responseData = utils.stripBOM(responseData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
response.data = responseData;
|
||||||
|
} catch (err) {
|
||||||
|
reject(AxiosError.from(err, null, config, response.request, response));
|
||||||
|
}
|
||||||
|
settle(resolve, reject, response);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle errors
|
||||||
|
req.on('error', function handleRequestError(err) {
|
||||||
|
// @todo remove
|
||||||
|
// if (req.aborted && err.code !== AxiosError.ERR_FR_TOO_MANY_REDIRECTS) return;
|
||||||
|
reject(AxiosError.from(err, null, config, req));
|
||||||
|
});
|
||||||
|
|
||||||
|
// set tcp keep alive to prevent drop connection by peer
|
||||||
|
req.on('socket', function handleRequestSocket(socket) {
|
||||||
|
// default interval of sending ack packet is 1 minute
|
||||||
|
socket.setKeepAlive(true, 1000 * 60);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle request timeout
|
||||||
|
if (config.timeout) {
|
||||||
|
// This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types.
|
||||||
|
var timeout = parseInt(config.timeout, 10);
|
||||||
|
|
||||||
|
if (isNaN(timeout)) {
|
||||||
|
reject(new AxiosError(
|
||||||
|
'error trying to parse `config.timeout` to int',
|
||||||
|
AxiosError.ERR_BAD_OPTION_VALUE,
|
||||||
|
config,
|
||||||
|
req
|
||||||
|
));
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system.
|
||||||
|
// And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET.
|
||||||
|
// At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up.
|
||||||
|
// And then these socket which be hang up will devouring CPU little by little.
|
||||||
|
// ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect.
|
||||||
|
req.setTimeout(timeout, function handleRequestTimeout() {
|
||||||
|
req.abort();
|
||||||
|
var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
|
||||||
|
var transitional = config.transitional || transitionalDefaults;
|
||||||
|
if (config.timeoutErrorMessage) {
|
||||||
|
timeoutErrorMessage = config.timeoutErrorMessage;
|
||||||
|
}
|
||||||
|
reject(new AxiosError(
|
||||||
|
timeoutErrorMessage,
|
||||||
|
transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
||||||
|
config,
|
||||||
|
req
|
||||||
|
));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.cancelToken || config.signal) {
|
||||||
|
// Handle cancellation
|
||||||
|
// eslint-disable-next-line func-names
|
||||||
|
onCanceled = function(cancel) {
|
||||||
|
if (req.aborted) return;
|
||||||
|
|
||||||
|
req.abort();
|
||||||
|
reject(!cancel || cancel.type ? new CanceledError(null, config, req) : cancel);
|
||||||
|
};
|
||||||
|
|
||||||
|
config.cancelToken && config.cancelToken.subscribe(onCanceled);
|
||||||
|
if (config.signal) {
|
||||||
|
config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Send the request
|
||||||
|
if (utils.isStream(data)) {
|
||||||
|
data.on('error', function handleStreamError(err) {
|
||||||
|
reject(AxiosError.from(err, config, null, req));
|
||||||
|
}).pipe(req);
|
||||||
|
} else {
|
||||||
|
req.end(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
226
node_modules/axios/lib/adapters/xhr.js
generated
vendored
Normal file
226
node_modules/axios/lib/adapters/xhr.js
generated
vendored
Normal file
@@ -0,0 +1,226 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./../utils');
|
||||||
|
var settle = require('./../core/settle');
|
||||||
|
var cookies = require('./../helpers/cookies');
|
||||||
|
var buildURL = require('./../helpers/buildURL');
|
||||||
|
var buildFullPath = require('../core/buildFullPath');
|
||||||
|
var parseHeaders = require('./../helpers/parseHeaders');
|
||||||
|
var isURLSameOrigin = require('./../helpers/isURLSameOrigin');
|
||||||
|
var transitionalDefaults = require('../defaults/transitional');
|
||||||
|
var AxiosError = require('../core/AxiosError');
|
||||||
|
var CanceledError = require('../cancel/CanceledError');
|
||||||
|
var parseProtocol = require('../helpers/parseProtocol');
|
||||||
|
var platform = require('../platform');
|
||||||
|
|
||||||
|
module.exports = function xhrAdapter(config) {
|
||||||
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
||||||
|
var requestData = config.data;
|
||||||
|
var requestHeaders = config.headers;
|
||||||
|
var responseType = config.responseType;
|
||||||
|
var withXSRFToken = config.withXSRFToken;
|
||||||
|
var onCanceled;
|
||||||
|
function done() {
|
||||||
|
if (config.cancelToken) {
|
||||||
|
config.cancelToken.unsubscribe(onCanceled);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.signal) {
|
||||||
|
config.signal.removeEventListener('abort', onCanceled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (utils.isFormData(requestData) && utils.isStandardBrowserEnv()) {
|
||||||
|
delete requestHeaders['Content-Type']; // Let the browser set it
|
||||||
|
}
|
||||||
|
|
||||||
|
var request = new XMLHttpRequest();
|
||||||
|
|
||||||
|
// HTTP basic authentication
|
||||||
|
if (config.auth) {
|
||||||
|
var username = config.auth.username || '';
|
||||||
|
var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
|
||||||
|
requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
|
||||||
|
}
|
||||||
|
|
||||||
|
var fullPath = buildFullPath(config.baseURL, config.url);
|
||||||
|
|
||||||
|
request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
|
||||||
|
|
||||||
|
// Set the request timeout in MS
|
||||||
|
request.timeout = config.timeout;
|
||||||
|
|
||||||
|
function onloadend() {
|
||||||
|
if (!request) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Prepare the response
|
||||||
|
var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
|
||||||
|
var responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
||||||
|
request.responseText : request.response;
|
||||||
|
var response = {
|
||||||
|
data: responseData,
|
||||||
|
status: request.status,
|
||||||
|
statusText: request.statusText,
|
||||||
|
headers: responseHeaders,
|
||||||
|
config: config,
|
||||||
|
request: request
|
||||||
|
};
|
||||||
|
|
||||||
|
settle(function _resolve(value) {
|
||||||
|
resolve(value);
|
||||||
|
done();
|
||||||
|
}, function _reject(err) {
|
||||||
|
reject(err);
|
||||||
|
done();
|
||||||
|
}, response);
|
||||||
|
|
||||||
|
// Clean up request
|
||||||
|
request = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('onloadend' in request) {
|
||||||
|
// Use onloadend if available
|
||||||
|
request.onloadend = onloadend;
|
||||||
|
} else {
|
||||||
|
// Listen for ready state to emulate onloadend
|
||||||
|
request.onreadystatechange = function handleLoad() {
|
||||||
|
if (!request || request.readyState !== 4) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The request errored out and we didn't get a response, this will be
|
||||||
|
// handled by onerror instead
|
||||||
|
// With one exception: request that using file: protocol, most browsers
|
||||||
|
// will return status as 0 even though it's a successful request
|
||||||
|
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// readystate handler is calling before onerror or ontimeout handlers,
|
||||||
|
// so we should call onloadend on the next 'tick'
|
||||||
|
setTimeout(onloadend);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle browser request cancellation (as opposed to a manual cancellation)
|
||||||
|
request.onabort = function handleAbort() {
|
||||||
|
if (!request) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
|
||||||
|
|
||||||
|
// Clean up request
|
||||||
|
request = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Handle low level network errors
|
||||||
|
request.onerror = function handleError() {
|
||||||
|
// Real errors are hidden from us by the browser
|
||||||
|
// onerror should only fire if it's a network error
|
||||||
|
reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
|
||||||
|
|
||||||
|
// Clean up request
|
||||||
|
request = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Handle timeout
|
||||||
|
request.ontimeout = function handleTimeout() {
|
||||||
|
var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
|
||||||
|
var transitional = config.transitional || transitionalDefaults;
|
||||||
|
if (config.timeoutErrorMessage) {
|
||||||
|
timeoutErrorMessage = config.timeoutErrorMessage;
|
||||||
|
}
|
||||||
|
reject(new AxiosError(
|
||||||
|
timeoutErrorMessage,
|
||||||
|
transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
||||||
|
config,
|
||||||
|
request));
|
||||||
|
|
||||||
|
// Clean up request
|
||||||
|
request = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Add xsrf header
|
||||||
|
// This is only done if running in a standard browser environment.
|
||||||
|
// Specifically not if we're in a web worker, or react-native.
|
||||||
|
if (utils.isStandardBrowserEnv()) {
|
||||||
|
// Add xsrf header
|
||||||
|
withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
|
||||||
|
if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
|
||||||
|
// Add xsrf header
|
||||||
|
var xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
||||||
|
if (xsrfValue) {
|
||||||
|
requestHeaders[config.xsrfHeaderName] = xsrfValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add headers to the request
|
||||||
|
if ('setRequestHeader' in request) {
|
||||||
|
utils.forEach(requestHeaders, function setRequestHeader(val, key) {
|
||||||
|
if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
|
||||||
|
// Remove Content-Type if data is undefined
|
||||||
|
delete requestHeaders[key];
|
||||||
|
} else {
|
||||||
|
// Otherwise add header to the request
|
||||||
|
request.setRequestHeader(key, val);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add withCredentials to request if needed
|
||||||
|
if (!utils.isUndefined(config.withCredentials)) {
|
||||||
|
request.withCredentials = !!config.withCredentials;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add responseType to request if needed
|
||||||
|
if (responseType && responseType !== 'json') {
|
||||||
|
request.responseType = config.responseType;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle progress if needed
|
||||||
|
if (typeof config.onDownloadProgress === 'function') {
|
||||||
|
request.addEventListener('progress', config.onDownloadProgress);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not all browsers support upload events
|
||||||
|
if (typeof config.onUploadProgress === 'function' && request.upload) {
|
||||||
|
request.upload.addEventListener('progress', config.onUploadProgress);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.cancelToken || config.signal) {
|
||||||
|
// Handle cancellation
|
||||||
|
// eslint-disable-next-line func-names
|
||||||
|
onCanceled = function(cancel) {
|
||||||
|
if (!request) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
|
||||||
|
request.abort();
|
||||||
|
request = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
config.cancelToken && config.cancelToken.subscribe(onCanceled);
|
||||||
|
if (config.signal) {
|
||||||
|
config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// false, 0 (zero number), and '' (empty string) are valid JSON values
|
||||||
|
if (!requestData && requestData !== false && requestData !== 0 && requestData !== '') {
|
||||||
|
requestData = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var protocol = parseProtocol(fullPath);
|
||||||
|
|
||||||
|
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
||||||
|
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Send the request
|
||||||
|
request.send(requestData);
|
||||||
|
});
|
||||||
|
};
|
||||||
68
node_modules/axios/lib/axios.js
generated
vendored
Normal file
68
node_modules/axios/lib/axios.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./utils');
|
||||||
|
var bind = require('./helpers/bind');
|
||||||
|
var Axios = require('./core/Axios');
|
||||||
|
var mergeConfig = require('./core/mergeConfig');
|
||||||
|
var defaults = require('./defaults');
|
||||||
|
var formDataToJSON = require('./helpers/formDataToJSON');
|
||||||
|
/**
|
||||||
|
* Create an instance of Axios
|
||||||
|
*
|
||||||
|
* @param {Object} defaultConfig The default config for the instance
|
||||||
|
* @return {Axios} A new instance of Axios
|
||||||
|
*/
|
||||||
|
function createInstance(defaultConfig) {
|
||||||
|
var context = new Axios(defaultConfig);
|
||||||
|
var instance = bind(Axios.prototype.request, context);
|
||||||
|
|
||||||
|
// Copy axios.prototype to instance
|
||||||
|
utils.extend(instance, Axios.prototype, context);
|
||||||
|
|
||||||
|
// Copy context to instance
|
||||||
|
utils.extend(instance, context);
|
||||||
|
|
||||||
|
// Factory for creating new instances
|
||||||
|
instance.create = function create(instanceConfig) {
|
||||||
|
return createInstance(mergeConfig(defaultConfig, instanceConfig));
|
||||||
|
};
|
||||||
|
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the default instance to be exported
|
||||||
|
var axios = createInstance(defaults);
|
||||||
|
|
||||||
|
// Expose Axios class to allow class inheritance
|
||||||
|
axios.Axios = Axios;
|
||||||
|
|
||||||
|
// Expose Cancel & CancelToken
|
||||||
|
axios.CanceledError = require('./cancel/CanceledError');
|
||||||
|
axios.CancelToken = require('./cancel/CancelToken');
|
||||||
|
axios.isCancel = require('./cancel/isCancel');
|
||||||
|
axios.VERSION = require('./env/data').version;
|
||||||
|
axios.toFormData = require('./helpers/toFormData');
|
||||||
|
|
||||||
|
// Expose AxiosError class
|
||||||
|
axios.AxiosError = require('../lib/core/AxiosError');
|
||||||
|
|
||||||
|
// alias for CanceledError for backward compatibility
|
||||||
|
axios.Cancel = axios.CanceledError;
|
||||||
|
|
||||||
|
// Expose all/spread
|
||||||
|
axios.all = function all(promises) {
|
||||||
|
return Promise.all(promises);
|
||||||
|
};
|
||||||
|
axios.spread = require('./helpers/spread');
|
||||||
|
|
||||||
|
// Expose isAxiosError
|
||||||
|
axios.isAxiosError = require('./helpers/isAxiosError');
|
||||||
|
|
||||||
|
axios.formToJSON = function(thing) {
|
||||||
|
return formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = axios;
|
||||||
|
|
||||||
|
// Allow use of default import syntax in TypeScript
|
||||||
|
module.exports.default = axios;
|
||||||
118
node_modules/axios/lib/cancel/CancelToken.js
generated
vendored
Normal file
118
node_modules/axios/lib/cancel/CancelToken.js
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var CanceledError = require('./CanceledError');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
* @param {Function} executor The executor function.
|
||||||
|
*/
|
||||||
|
function CancelToken(executor) {
|
||||||
|
if (typeof executor !== 'function') {
|
||||||
|
throw new TypeError('executor must be a function.');
|
||||||
|
}
|
||||||
|
|
||||||
|
var resolvePromise;
|
||||||
|
|
||||||
|
this.promise = new Promise(function promiseExecutor(resolve) {
|
||||||
|
resolvePromise = resolve;
|
||||||
|
});
|
||||||
|
|
||||||
|
var token = this;
|
||||||
|
|
||||||
|
// eslint-disable-next-line func-names
|
||||||
|
this.promise.then(function(cancel) {
|
||||||
|
if (!token._listeners) return;
|
||||||
|
|
||||||
|
var i = token._listeners.length;
|
||||||
|
|
||||||
|
while (i-- > 0) {
|
||||||
|
token._listeners[i](cancel);
|
||||||
|
}
|
||||||
|
token._listeners = null;
|
||||||
|
});
|
||||||
|
|
||||||
|
// eslint-disable-next-line func-names
|
||||||
|
this.promise.then = function(onfulfilled) {
|
||||||
|
var _resolve;
|
||||||
|
// eslint-disable-next-line func-names
|
||||||
|
var promise = new Promise(function(resolve) {
|
||||||
|
token.subscribe(resolve);
|
||||||
|
_resolve = resolve;
|
||||||
|
}).then(onfulfilled);
|
||||||
|
|
||||||
|
promise.cancel = function reject() {
|
||||||
|
token.unsubscribe(_resolve);
|
||||||
|
};
|
||||||
|
|
||||||
|
return promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
executor(function cancel(message, config, request) {
|
||||||
|
if (token.reason) {
|
||||||
|
// Cancellation has already been requested
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
token.reason = new CanceledError(message, config, request);
|
||||||
|
resolvePromise(token.reason);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Throws a `CanceledError` if cancellation has been requested.
|
||||||
|
*/
|
||||||
|
CancelToken.prototype.throwIfRequested = function throwIfRequested() {
|
||||||
|
if (this.reason) {
|
||||||
|
throw this.reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subscribe to the cancel signal
|
||||||
|
*/
|
||||||
|
|
||||||
|
CancelToken.prototype.subscribe = function subscribe(listener) {
|
||||||
|
if (this.reason) {
|
||||||
|
listener(this.reason);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._listeners) {
|
||||||
|
this._listeners.push(listener);
|
||||||
|
} else {
|
||||||
|
this._listeners = [listener];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unsubscribe from the cancel signal
|
||||||
|
*/
|
||||||
|
|
||||||
|
CancelToken.prototype.unsubscribe = function unsubscribe(listener) {
|
||||||
|
if (!this._listeners) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var index = this._listeners.indexOf(listener);
|
||||||
|
if (index !== -1) {
|
||||||
|
this._listeners.splice(index, 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
||||||
|
* cancels the `CancelToken`.
|
||||||
|
*/
|
||||||
|
CancelToken.source = function source() {
|
||||||
|
var cancel;
|
||||||
|
var token = new CancelToken(function executor(c) {
|
||||||
|
cancel = c;
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
token: token,
|
||||||
|
cancel: cancel
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = CancelToken;
|
||||||
24
node_modules/axios/lib/cancel/CanceledError.js
generated
vendored
Normal file
24
node_modules/axios/lib/cancel/CanceledError.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var AxiosError = require('../core/AxiosError');
|
||||||
|
var utils = require('../utils');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
* @param {string=} message The message.
|
||||||
|
* @param {Object=} config The config.
|
||||||
|
* @param {Object=} request The request.
|
||||||
|
*/
|
||||||
|
function CanceledError(message, config, request) {
|
||||||
|
// eslint-disable-next-line no-eq-null,eqeqeq
|
||||||
|
AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
|
||||||
|
this.name = 'CanceledError';
|
||||||
|
}
|
||||||
|
|
||||||
|
utils.inherits(CanceledError, AxiosError, {
|
||||||
|
__CANCEL__: true
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = CanceledError;
|
||||||
5
node_modules/axios/lib/cancel/isCancel.js
generated
vendored
Normal file
5
node_modules/axios/lib/cancel/isCancel.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = function isCancel(value) {
|
||||||
|
return !!(value && value.__CANCEL__);
|
||||||
|
};
|
||||||
172
node_modules/axios/lib/core/Axios.js
generated
vendored
Normal file
172
node_modules/axios/lib/core/Axios.js
generated
vendored
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./../utils');
|
||||||
|
var buildURL = require('../helpers/buildURL');
|
||||||
|
var InterceptorManager = require('./InterceptorManager');
|
||||||
|
var dispatchRequest = require('./dispatchRequest');
|
||||||
|
var mergeConfig = require('./mergeConfig');
|
||||||
|
var buildFullPath = require('./buildFullPath');
|
||||||
|
var validator = require('../helpers/validator');
|
||||||
|
|
||||||
|
var validators = validator.validators;
|
||||||
|
/**
|
||||||
|
* Create a new instance of Axios
|
||||||
|
*
|
||||||
|
* @param {Object} instanceConfig The default config for the instance
|
||||||
|
*/
|
||||||
|
function Axios(instanceConfig) {
|
||||||
|
this.defaults = instanceConfig;
|
||||||
|
this.interceptors = {
|
||||||
|
request: new InterceptorManager(),
|
||||||
|
response: new InterceptorManager()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatch a request
|
||||||
|
*
|
||||||
|
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
|
||||||
|
* @param {?Object} config
|
||||||
|
*/
|
||||||
|
Axios.prototype.request = function request(configOrUrl, config) {
|
||||||
|
/*eslint no-param-reassign:0*/
|
||||||
|
// Allow for axios('example/url'[, config]) a la fetch API
|
||||||
|
if (typeof configOrUrl === 'string') {
|
||||||
|
config = config || {};
|
||||||
|
config.url = configOrUrl;
|
||||||
|
} else {
|
||||||
|
config = configOrUrl || {};
|
||||||
|
}
|
||||||
|
|
||||||
|
config = mergeConfig(this.defaults, config);
|
||||||
|
|
||||||
|
// Set config.method
|
||||||
|
if (config.method) {
|
||||||
|
config.method = config.method.toLowerCase();
|
||||||
|
} else if (this.defaults.method) {
|
||||||
|
config.method = this.defaults.method.toLowerCase();
|
||||||
|
} else {
|
||||||
|
config.method = 'get';
|
||||||
|
}
|
||||||
|
|
||||||
|
var transitional = config.transitional;
|
||||||
|
|
||||||
|
if (transitional !== undefined) {
|
||||||
|
validator.assertOptions(transitional, {
|
||||||
|
silentJSONParsing: validators.transitional(validators.boolean),
|
||||||
|
forcedJSONParsing: validators.transitional(validators.boolean),
|
||||||
|
clarifyTimeoutError: validators.transitional(validators.boolean)
|
||||||
|
}, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
var paramsSerializer = config.paramsSerializer;
|
||||||
|
|
||||||
|
if (paramsSerializer !== undefined) {
|
||||||
|
validator.assertOptions(paramsSerializer, {
|
||||||
|
encode: validators.function,
|
||||||
|
serialize: validators.function
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
utils.isFunction(paramsSerializer) && (config.paramsSerializer = {serialize: paramsSerializer});
|
||||||
|
|
||||||
|
// filter out skipped interceptors
|
||||||
|
var requestInterceptorChain = [];
|
||||||
|
var synchronousRequestInterceptors = true;
|
||||||
|
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
||||||
|
if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
||||||
|
|
||||||
|
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
||||||
|
});
|
||||||
|
|
||||||
|
var responseInterceptorChain = [];
|
||||||
|
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
||||||
|
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
||||||
|
});
|
||||||
|
|
||||||
|
var promise;
|
||||||
|
|
||||||
|
if (!synchronousRequestInterceptors) {
|
||||||
|
var chain = [dispatchRequest, undefined];
|
||||||
|
|
||||||
|
Array.prototype.unshift.apply(chain, requestInterceptorChain);
|
||||||
|
chain = chain.concat(responseInterceptorChain);
|
||||||
|
|
||||||
|
promise = Promise.resolve(config);
|
||||||
|
while (chain.length) {
|
||||||
|
promise = promise.then(chain.shift(), chain.shift());
|
||||||
|
}
|
||||||
|
|
||||||
|
return promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var newConfig = config;
|
||||||
|
while (requestInterceptorChain.length) {
|
||||||
|
var onFulfilled = requestInterceptorChain.shift();
|
||||||
|
var onRejected = requestInterceptorChain.shift();
|
||||||
|
try {
|
||||||
|
newConfig = onFulfilled(newConfig);
|
||||||
|
} catch (error) {
|
||||||
|
onRejected(error);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
promise = dispatchRequest(newConfig);
|
||||||
|
} catch (error) {
|
||||||
|
return Promise.reject(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (responseInterceptorChain.length) {
|
||||||
|
promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
|
||||||
|
}
|
||||||
|
|
||||||
|
return promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
Axios.prototype.getUri = function getUri(config) {
|
||||||
|
config = mergeConfig(this.defaults, config);
|
||||||
|
var fullPath = buildFullPath(config.baseURL, config.url);
|
||||||
|
return buildURL(fullPath, config.params, config.paramsSerializer);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Provide aliases for supported request methods
|
||||||
|
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
||||||
|
/*eslint func-names:0*/
|
||||||
|
Axios.prototype[method] = function(url, config) {
|
||||||
|
return this.request(mergeConfig(config || {}, {
|
||||||
|
method: method,
|
||||||
|
url: url,
|
||||||
|
data: (config || {}).data
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
||||||
|
/*eslint func-names:0*/
|
||||||
|
|
||||||
|
function generateHTTPMethod(isForm) {
|
||||||
|
return function httpMethod(url, data, config) {
|
||||||
|
return this.request(mergeConfig(config || {}, {
|
||||||
|
method: method,
|
||||||
|
headers: isForm ? {
|
||||||
|
'Content-Type': 'multipart/form-data'
|
||||||
|
} : {},
|
||||||
|
url: url,
|
||||||
|
data: data
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Axios.prototype[method] = generateHTTPMethod();
|
||||||
|
|
||||||
|
Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = Axios;
|
||||||
97
node_modules/axios/lib/core/AxiosError.js
generated
vendored
Normal file
97
node_modules/axios/lib/core/AxiosError.js
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('../utils');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an Error with the specified message, config, error code, request and response.
|
||||||
|
*
|
||||||
|
* @param {string} message The error message.
|
||||||
|
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
||||||
|
* @param {Object} [config] The config.
|
||||||
|
* @param {Object} [request] The request.
|
||||||
|
* @param {Object} [response] The response.
|
||||||
|
* @returns {Error} The created error.
|
||||||
|
*/
|
||||||
|
function AxiosError(message, code, config, request, response) {
|
||||||
|
Error.call(this);
|
||||||
|
|
||||||
|
if (Error.captureStackTrace) {
|
||||||
|
Error.captureStackTrace(this, this.constructor);
|
||||||
|
} else {
|
||||||
|
this.stack = (new Error()).stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.message = message;
|
||||||
|
this.name = 'AxiosError';
|
||||||
|
code && (this.code = code);
|
||||||
|
config && (this.config = config);
|
||||||
|
request && (this.request = request);
|
||||||
|
response && (this.response = response);
|
||||||
|
}
|
||||||
|
|
||||||
|
utils.inherits(AxiosError, Error, {
|
||||||
|
toJSON: function toJSON() {
|
||||||
|
return {
|
||||||
|
// Standard
|
||||||
|
message: this.message,
|
||||||
|
name: this.name,
|
||||||
|
// Microsoft
|
||||||
|
description: this.description,
|
||||||
|
number: this.number,
|
||||||
|
// Mozilla
|
||||||
|
fileName: this.fileName,
|
||||||
|
lineNumber: this.lineNumber,
|
||||||
|
columnNumber: this.columnNumber,
|
||||||
|
stack: this.stack,
|
||||||
|
// Axios
|
||||||
|
config: this.config,
|
||||||
|
code: this.code,
|
||||||
|
status: this.response && this.response.status ? this.response.status : null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var prototype = AxiosError.prototype;
|
||||||
|
var descriptors = {};
|
||||||
|
|
||||||
|
[
|
||||||
|
'ERR_BAD_OPTION_VALUE',
|
||||||
|
'ERR_BAD_OPTION',
|
||||||
|
'ECONNABORTED',
|
||||||
|
'ETIMEDOUT',
|
||||||
|
'ERR_NETWORK',
|
||||||
|
'ERR_FR_TOO_MANY_REDIRECTS',
|
||||||
|
'ERR_DEPRECATED',
|
||||||
|
'ERR_BAD_RESPONSE',
|
||||||
|
'ERR_BAD_REQUEST',
|
||||||
|
'ERR_CANCELED',
|
||||||
|
'ERR_NOT_SUPPORT',
|
||||||
|
'ERR_INVALID_URL'
|
||||||
|
// eslint-disable-next-line func-names
|
||||||
|
].forEach(function(code) {
|
||||||
|
descriptors[code] = {value: code};
|
||||||
|
});
|
||||||
|
|
||||||
|
Object.defineProperties(AxiosError, descriptors);
|
||||||
|
Object.defineProperty(prototype, 'isAxiosError', {value: true});
|
||||||
|
|
||||||
|
// eslint-disable-next-line func-names
|
||||||
|
AxiosError.from = function(error, code, config, request, response, customProps) {
|
||||||
|
var axiosError = Object.create(prototype);
|
||||||
|
|
||||||
|
utils.toFlatObject(error, axiosError, function filter(obj) {
|
||||||
|
return obj !== Error.prototype;
|
||||||
|
});
|
||||||
|
|
||||||
|
AxiosError.call(axiosError, error.message, code, config, request, response);
|
||||||
|
|
||||||
|
axiosError.cause = error;
|
||||||
|
|
||||||
|
axiosError.name = error.name;
|
||||||
|
|
||||||
|
customProps && Object.assign(axiosError, customProps);
|
||||||
|
|
||||||
|
return axiosError;
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = AxiosError;
|
||||||
63
node_modules/axios/lib/core/InterceptorManager.js
generated
vendored
Normal file
63
node_modules/axios/lib/core/InterceptorManager.js
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./../utils');
|
||||||
|
|
||||||
|
function InterceptorManager() {
|
||||||
|
this.handlers = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a new interceptor to the stack
|
||||||
|
*
|
||||||
|
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
||||||
|
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
||||||
|
*
|
||||||
|
* @return {Number} An ID used to remove interceptor later
|
||||||
|
*/
|
||||||
|
InterceptorManager.prototype.use = function use(fulfilled, rejected, options) {
|
||||||
|
this.handlers.push({
|
||||||
|
fulfilled: fulfilled,
|
||||||
|
rejected: rejected,
|
||||||
|
synchronous: options ? options.synchronous : false,
|
||||||
|
runWhen: options ? options.runWhen : null
|
||||||
|
});
|
||||||
|
return this.handlers.length - 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove an interceptor from the stack
|
||||||
|
*
|
||||||
|
* @param {Number} id The ID that was returned by `use`
|
||||||
|
*/
|
||||||
|
InterceptorManager.prototype.eject = function eject(id) {
|
||||||
|
if (this.handlers[id]) {
|
||||||
|
this.handlers[id] = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear all interceptors from the stack
|
||||||
|
*/
|
||||||
|
InterceptorManager.prototype.clear = function clear() {
|
||||||
|
if (this.handlers) {
|
||||||
|
this.handlers = [];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Iterate over all the registered interceptors
|
||||||
|
*
|
||||||
|
* This method is particularly useful for skipping over any
|
||||||
|
* interceptors that may have become `null` calling `eject`.
|
||||||
|
*
|
||||||
|
* @param {Function} fn The function to call for each interceptor
|
||||||
|
*/
|
||||||
|
InterceptorManager.prototype.forEach = function forEach(fn) {
|
||||||
|
utils.forEach(this.handlers, function forEachHandler(h) {
|
||||||
|
if (h !== null) {
|
||||||
|
fn(h);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = InterceptorManager;
|
||||||
8
node_modules/axios/lib/core/README.md
generated
vendored
Normal file
8
node_modules/axios/lib/core/README.md
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# axios // core
|
||||||
|
|
||||||
|
The modules found in `core/` should be modules that are specific to the domain logic of axios. These modules would most likely not make sense to be consumed outside of the axios module, as their logic is too specific. Some examples of core modules are:
|
||||||
|
|
||||||
|
- Dispatching requests
|
||||||
|
- Requests sent via `adapters/` (see lib/adapters/README.md)
|
||||||
|
- Managing interceptors
|
||||||
|
- Handling config
|
||||||
20
node_modules/axios/lib/core/buildFullPath.js
generated
vendored
Normal file
20
node_modules/axios/lib/core/buildFullPath.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var isAbsoluteURL = require('../helpers/isAbsoluteURL');
|
||||||
|
var combineURLs = require('../helpers/combineURLs');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new URL by combining the baseURL with the requestedURL,
|
||||||
|
* only when the requestedURL is not already an absolute URL.
|
||||||
|
* If the requestURL is absolute, this function returns the requestedURL untouched.
|
||||||
|
*
|
||||||
|
* @param {string} baseURL The base URL
|
||||||
|
* @param {string} requestedURL Absolute or relative URL to combine
|
||||||
|
* @returns {string} The combined full path
|
||||||
|
*/
|
||||||
|
module.exports = function buildFullPath(baseURL, requestedURL) {
|
||||||
|
if (baseURL && !isAbsoluteURL(requestedURL)) {
|
||||||
|
return combineURLs(baseURL, requestedURL);
|
||||||
|
}
|
||||||
|
return requestedURL;
|
||||||
|
};
|
||||||
94
node_modules/axios/lib/core/dispatchRequest.js
generated
vendored
Normal file
94
node_modules/axios/lib/core/dispatchRequest.js
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./../utils');
|
||||||
|
var transformData = require('./transformData');
|
||||||
|
var isCancel = require('../cancel/isCancel');
|
||||||
|
var defaults = require('../defaults');
|
||||||
|
var CanceledError = require('../cancel/CanceledError');
|
||||||
|
var normalizeHeaderName = require('../helpers/normalizeHeaderName');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Throws a `CanceledError` if cancellation has been requested.
|
||||||
|
*/
|
||||||
|
function throwIfCancellationRequested(config) {
|
||||||
|
if (config.cancelToken) {
|
||||||
|
config.cancelToken.throwIfRequested();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.signal && config.signal.aborted) {
|
||||||
|
throw new CanceledError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatch a request to the server using the configured adapter.
|
||||||
|
*
|
||||||
|
* @param {object} config The config that is to be used for the request
|
||||||
|
* @returns {Promise} The Promise to be fulfilled
|
||||||
|
*/
|
||||||
|
module.exports = function dispatchRequest(config) {
|
||||||
|
throwIfCancellationRequested(config);
|
||||||
|
|
||||||
|
// Ensure headers exist
|
||||||
|
config.headers = config.headers || {};
|
||||||
|
|
||||||
|
// Transform request data
|
||||||
|
config.data = transformData.call(
|
||||||
|
config,
|
||||||
|
config.data,
|
||||||
|
config.headers,
|
||||||
|
null,
|
||||||
|
config.transformRequest
|
||||||
|
);
|
||||||
|
|
||||||
|
normalizeHeaderName(config.headers, 'Accept');
|
||||||
|
normalizeHeaderName(config.headers, 'Content-Type');
|
||||||
|
|
||||||
|
// Flatten headers
|
||||||
|
config.headers = utils.merge(
|
||||||
|
config.headers.common || {},
|
||||||
|
config.headers[config.method] || {},
|
||||||
|
config.headers
|
||||||
|
);
|
||||||
|
|
||||||
|
utils.forEach(
|
||||||
|
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
||||||
|
function cleanHeaderConfig(method) {
|
||||||
|
delete config.headers[method];
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
var adapter = config.adapter || defaults.adapter;
|
||||||
|
|
||||||
|
return adapter(config).then(function onAdapterResolution(response) {
|
||||||
|
throwIfCancellationRequested(config);
|
||||||
|
|
||||||
|
// Transform response data
|
||||||
|
response.data = transformData.call(
|
||||||
|
config,
|
||||||
|
response.data,
|
||||||
|
response.headers,
|
||||||
|
response.status,
|
||||||
|
config.transformResponse
|
||||||
|
);
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}, function onAdapterRejection(reason) {
|
||||||
|
if (!isCancel(reason)) {
|
||||||
|
throwIfCancellationRequested(config);
|
||||||
|
|
||||||
|
// Transform response data
|
||||||
|
if (reason && reason.response) {
|
||||||
|
reason.response.data = transformData.call(
|
||||||
|
config,
|
||||||
|
reason.response.data,
|
||||||
|
reason.response.headers,
|
||||||
|
reason.response.status,
|
||||||
|
config.transformResponse
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Promise.reject(reason);
|
||||||
|
});
|
||||||
|
};
|
||||||
103
node_modules/axios/lib/core/mergeConfig.js
generated
vendored
Normal file
103
node_modules/axios/lib/core/mergeConfig.js
generated
vendored
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('../utils');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Config-specific merge-function which creates a new config-object
|
||||||
|
* by merging two configuration objects together.
|
||||||
|
*
|
||||||
|
* @param {Object} config1
|
||||||
|
* @param {Object} config2
|
||||||
|
* @returns {Object} New object resulting from merging config2 to config1
|
||||||
|
*/
|
||||||
|
module.exports = function mergeConfig(config1, config2) {
|
||||||
|
// eslint-disable-next-line no-param-reassign
|
||||||
|
config2 = config2 || {};
|
||||||
|
var config = {};
|
||||||
|
|
||||||
|
function getMergedValue(target, source) {
|
||||||
|
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
||||||
|
return utils.merge(target, source);
|
||||||
|
} else if (utils.isEmptyObject(source)) {
|
||||||
|
return utils.merge({}, target);
|
||||||
|
} else if (utils.isPlainObject(source)) {
|
||||||
|
return utils.merge({}, source);
|
||||||
|
} else if (utils.isArray(source)) {
|
||||||
|
return source.slice();
|
||||||
|
}
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line consistent-return
|
||||||
|
function mergeDeepProperties(prop) {
|
||||||
|
if (!utils.isUndefined(config2[prop])) {
|
||||||
|
return getMergedValue(config1[prop], config2[prop]);
|
||||||
|
} else if (!utils.isUndefined(config1[prop])) {
|
||||||
|
return getMergedValue(undefined, config1[prop]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line consistent-return
|
||||||
|
function valueFromConfig2(prop) {
|
||||||
|
if (!utils.isUndefined(config2[prop])) {
|
||||||
|
return getMergedValue(undefined, config2[prop]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line consistent-return
|
||||||
|
function defaultToConfig2(prop) {
|
||||||
|
if (!utils.isUndefined(config2[prop])) {
|
||||||
|
return getMergedValue(undefined, config2[prop]);
|
||||||
|
} else if (!utils.isUndefined(config1[prop])) {
|
||||||
|
return getMergedValue(undefined, config1[prop]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line consistent-return
|
||||||
|
function mergeDirectKeys(prop) {
|
||||||
|
if (prop in config2) {
|
||||||
|
return getMergedValue(config1[prop], config2[prop]);
|
||||||
|
} else if (prop in config1) {
|
||||||
|
return getMergedValue(undefined, config1[prop]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var mergeMap = {
|
||||||
|
'url': valueFromConfig2,
|
||||||
|
'method': valueFromConfig2,
|
||||||
|
'data': valueFromConfig2,
|
||||||
|
'baseURL': defaultToConfig2,
|
||||||
|
'transformRequest': defaultToConfig2,
|
||||||
|
'transformResponse': defaultToConfig2,
|
||||||
|
'paramsSerializer': defaultToConfig2,
|
||||||
|
'timeout': defaultToConfig2,
|
||||||
|
'timeoutMessage': defaultToConfig2,
|
||||||
|
'withCredentials': defaultToConfig2,
|
||||||
|
'withXSRFToken': defaultToConfig2,
|
||||||
|
'adapter': defaultToConfig2,
|
||||||
|
'responseType': defaultToConfig2,
|
||||||
|
'xsrfCookieName': defaultToConfig2,
|
||||||
|
'xsrfHeaderName': defaultToConfig2,
|
||||||
|
'onUploadProgress': defaultToConfig2,
|
||||||
|
'onDownloadProgress': defaultToConfig2,
|
||||||
|
'decompress': defaultToConfig2,
|
||||||
|
'maxContentLength': defaultToConfig2,
|
||||||
|
'maxBodyLength': defaultToConfig2,
|
||||||
|
'beforeRedirect': defaultToConfig2,
|
||||||
|
'transport': defaultToConfig2,
|
||||||
|
'httpAgent': defaultToConfig2,
|
||||||
|
'httpsAgent': defaultToConfig2,
|
||||||
|
'cancelToken': defaultToConfig2,
|
||||||
|
'socketPath': defaultToConfig2,
|
||||||
|
'responseEncoding': defaultToConfig2,
|
||||||
|
'validateStatus': mergeDirectKeys
|
||||||
|
};
|
||||||
|
|
||||||
|
utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
|
||||||
|
var merge = mergeMap[prop] || mergeDeepProperties;
|
||||||
|
var configValue = merge(prop);
|
||||||
|
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
||||||
|
});
|
||||||
|
|
||||||
|
return config;
|
||||||
|
};
|
||||||
25
node_modules/axios/lib/core/settle.js
generated
vendored
Normal file
25
node_modules/axios/lib/core/settle.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var AxiosError = require('./AxiosError');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolve or reject a Promise based on response status.
|
||||||
|
*
|
||||||
|
* @param {Function} resolve A function that resolves the promise.
|
||||||
|
* @param {Function} reject A function that rejects the promise.
|
||||||
|
* @param {object} response The response.
|
||||||
|
*/
|
||||||
|
module.exports = function settle(resolve, reject, response) {
|
||||||
|
var validateStatus = response.config.validateStatus;
|
||||||
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
||||||
|
resolve(response);
|
||||||
|
} else {
|
||||||
|
reject(new AxiosError(
|
||||||
|
'Request failed with status code ' + response.status,
|
||||||
|
[AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
||||||
|
response.config,
|
||||||
|
response.request,
|
||||||
|
response
|
||||||
|
));
|
||||||
|
}
|
||||||
|
};
|
||||||
23
node_modules/axios/lib/core/transformData.js
generated
vendored
Normal file
23
node_modules/axios/lib/core/transformData.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./../utils');
|
||||||
|
var defaults = require('../defaults');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transform the data for a request or a response
|
||||||
|
*
|
||||||
|
* @param {Object|String} data The data to be transformed
|
||||||
|
* @param {Array} headers The headers for the request or response
|
||||||
|
* @param {Number} status HTTP status code
|
||||||
|
* @param {Array|Function} fns A single function or Array of functions
|
||||||
|
* @returns {*} The resulting transformed data
|
||||||
|
*/
|
||||||
|
module.exports = function transformData(data, headers, status, fns) {
|
||||||
|
var context = this || defaults;
|
||||||
|
/*eslint no-param-reassign:0*/
|
||||||
|
utils.forEach(fns, function transform(fn) {
|
||||||
|
data = fn.call(context, data, headers, status);
|
||||||
|
});
|
||||||
|
|
||||||
|
return data;
|
||||||
|
};
|
||||||
175
node_modules/axios/lib/defaults/index.js
generated
vendored
Normal file
175
node_modules/axios/lib/defaults/index.js
generated
vendored
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('../utils');
|
||||||
|
var normalizeHeaderName = require('../helpers/normalizeHeaderName');
|
||||||
|
var AxiosError = require('../core/AxiosError');
|
||||||
|
var transitionalDefaults = require('./transitional');
|
||||||
|
var toFormData = require('../helpers/toFormData');
|
||||||
|
var toURLEncodedForm = require('../helpers/toURLEncodedForm');
|
||||||
|
var platform = require('../platform');
|
||||||
|
var formDataToJSON = require('../helpers/formDataToJSON');
|
||||||
|
|
||||||
|
var DEFAULT_CONTENT_TYPE = {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
|
};
|
||||||
|
|
||||||
|
function setContentTypeIfUnset(headers, value) {
|
||||||
|
if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
|
||||||
|
headers['Content-Type'] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDefaultAdapter() {
|
||||||
|
var adapter;
|
||||||
|
if (typeof XMLHttpRequest !== 'undefined') {
|
||||||
|
// For browsers use XHR adapter
|
||||||
|
adapter = require('../adapters/xhr');
|
||||||
|
} else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
|
||||||
|
// For node use HTTP adapter
|
||||||
|
adapter = require('../adapters/http');
|
||||||
|
}
|
||||||
|
return adapter;
|
||||||
|
}
|
||||||
|
|
||||||
|
function stringifySafely(rawValue, parser, encoder) {
|
||||||
|
if (utils.isString(rawValue)) {
|
||||||
|
try {
|
||||||
|
(parser || JSON.parse)(rawValue);
|
||||||
|
return utils.trim(rawValue);
|
||||||
|
} catch (e) {
|
||||||
|
if (e.name !== 'SyntaxError') {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (encoder || JSON.stringify)(rawValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
var defaults = {
|
||||||
|
|
||||||
|
transitional: transitionalDefaults,
|
||||||
|
|
||||||
|
adapter: getDefaultAdapter(),
|
||||||
|
|
||||||
|
transformRequest: [function transformRequest(data, headers) {
|
||||||
|
normalizeHeaderName(headers, 'Accept');
|
||||||
|
normalizeHeaderName(headers, 'Content-Type');
|
||||||
|
|
||||||
|
var contentType = headers && headers['Content-Type'] || '';
|
||||||
|
var hasJSONContentType = contentType.indexOf('application/json') > -1;
|
||||||
|
var isObjectPayload = utils.isObject(data);
|
||||||
|
|
||||||
|
if (isObjectPayload && utils.isHTMLForm(data)) {
|
||||||
|
data = new FormData(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
var isFormData = utils.isFormData(data);
|
||||||
|
|
||||||
|
if (isFormData) {
|
||||||
|
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (utils.isArrayBuffer(data) ||
|
||||||
|
utils.isBuffer(data) ||
|
||||||
|
utils.isStream(data) ||
|
||||||
|
utils.isFile(data) ||
|
||||||
|
utils.isBlob(data)
|
||||||
|
) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
if (utils.isArrayBufferView(data)) {
|
||||||
|
return data.buffer;
|
||||||
|
}
|
||||||
|
if (utils.isURLSearchParams(data)) {
|
||||||
|
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
|
||||||
|
return data.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
var isFileList;
|
||||||
|
|
||||||
|
if (isObjectPayload) {
|
||||||
|
if (contentType.indexOf('application/x-www-form-urlencoded') !== -1) {
|
||||||
|
return toURLEncodedForm(data, this.formSerializer).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
|
||||||
|
var _FormData = this.env && this.env.FormData;
|
||||||
|
|
||||||
|
return toFormData(
|
||||||
|
isFileList ? {'files[]': data} : data,
|
||||||
|
_FormData && new _FormData(),
|
||||||
|
this.formSerializer
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isObjectPayload || hasJSONContentType ) {
|
||||||
|
setContentTypeIfUnset(headers, 'application/json');
|
||||||
|
return stringifySafely(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}],
|
||||||
|
|
||||||
|
transformResponse: [function transformResponse(data) {
|
||||||
|
var transitional = this.transitional || defaults.transitional;
|
||||||
|
var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
||||||
|
var JSONRequested = this.responseType === 'json';
|
||||||
|
|
||||||
|
if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
||||||
|
var silentJSONParsing = transitional && transitional.silentJSONParsing;
|
||||||
|
var strictJSONParsing = !silentJSONParsing && JSONRequested;
|
||||||
|
|
||||||
|
try {
|
||||||
|
return JSON.parse(data);
|
||||||
|
} catch (e) {
|
||||||
|
if (strictJSONParsing) {
|
||||||
|
if (e.name === 'SyntaxError') {
|
||||||
|
throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
|
||||||
|
}
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
||||||
|
* timeout is not created.
|
||||||
|
*/
|
||||||
|
timeout: 0,
|
||||||
|
|
||||||
|
xsrfCookieName: 'XSRF-TOKEN',
|
||||||
|
xsrfHeaderName: 'X-XSRF-TOKEN',
|
||||||
|
|
||||||
|
maxContentLength: -1,
|
||||||
|
maxBodyLength: -1,
|
||||||
|
|
||||||
|
env: {
|
||||||
|
FormData: platform.classes.FormData,
|
||||||
|
Blob: platform.classes.Blob
|
||||||
|
},
|
||||||
|
|
||||||
|
validateStatus: function validateStatus(status) {
|
||||||
|
return status >= 200 && status < 300;
|
||||||
|
},
|
||||||
|
|
||||||
|
headers: {
|
||||||
|
common: {
|
||||||
|
'Accept': 'application/json, text/plain, */*'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
|
||||||
|
defaults.headers[method] = {};
|
||||||
|
});
|
||||||
|
|
||||||
|
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
||||||
|
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = defaults;
|
||||||
7
node_modules/axios/lib/defaults/transitional.js
generated
vendored
Normal file
7
node_modules/axios/lib/defaults/transitional.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
silentJSONParsing: true,
|
||||||
|
forcedJSONParsing: true,
|
||||||
|
clarifyTimeoutError: false
|
||||||
|
};
|
||||||
3
node_modules/axios/lib/env/README.md
generated
vendored
Normal file
3
node_modules/axios/lib/env/README.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# axios // env
|
||||||
|
|
||||||
|
The `data.js` file is updated automatically when the package version is upgrading. Please do not edit it manually.
|
||||||
2
node_modules/axios/lib/env/classes/FormData.js
generated
vendored
Normal file
2
node_modules/axios/lib/env/classes/FormData.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
// eslint-disable-next-line strict
|
||||||
|
module.exports = require('form-data');
|
||||||
3
node_modules/axios/lib/env/data.js
generated
vendored
Normal file
3
node_modules/axios/lib/env/data.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
module.exports = {
|
||||||
|
"version": "0.28.1"
|
||||||
|
};
|
||||||
42
node_modules/axios/lib/helpers/AxiosURLSearchParams.js
generated
vendored
Normal file
42
node_modules/axios/lib/helpers/AxiosURLSearchParams.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var toFormData = require('./toFormData');
|
||||||
|
|
||||||
|
function encode(str) {
|
||||||
|
var charMap = {
|
||||||
|
'!': '%21',
|
||||||
|
"'": '%27',
|
||||||
|
'(': '%28',
|
||||||
|
')': '%29',
|
||||||
|
'~': '%7E',
|
||||||
|
'%20': '+',
|
||||||
|
'%00': '\x00'
|
||||||
|
};
|
||||||
|
return encodeURIComponent(str).replace(/[!'\(\)~]|%20|%00/g, function replacer(match) {
|
||||||
|
return charMap[match];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function AxiosURLSearchParams(params, options) {
|
||||||
|
this._pairs = [];
|
||||||
|
|
||||||
|
params && toFormData(params, this, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
var prototype = AxiosURLSearchParams.prototype;
|
||||||
|
|
||||||
|
prototype.append = function append(name, value) {
|
||||||
|
this._pairs.push([name, value]);
|
||||||
|
};
|
||||||
|
|
||||||
|
prototype.toString = function toString(encoder) {
|
||||||
|
var _encode = encoder ? function(value) {
|
||||||
|
return encoder.call(this, value, encode);
|
||||||
|
} : encode;
|
||||||
|
|
||||||
|
return this._pairs.map(function each(pair) {
|
||||||
|
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
||||||
|
}, '').join('&');
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = AxiosURLSearchParams;
|
||||||
7
node_modules/axios/lib/helpers/README.md
generated
vendored
Normal file
7
node_modules/axios/lib/helpers/README.md
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# axios // helpers
|
||||||
|
|
||||||
|
The modules found in `helpers/` should be generic modules that are _not_ specific to the domain logic of axios. These modules could theoretically be published to npm on their own and consumed by other modules or apps. Some examples of generic modules are things like:
|
||||||
|
|
||||||
|
- Browser polyfills
|
||||||
|
- Managing cookies
|
||||||
|
- Parsing HTTP headers
|
||||||
7
node_modules/axios/lib/helpers/bind.js
generated
vendored
Normal file
7
node_modules/axios/lib/helpers/bind.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = function bind(fn, thisArg) {
|
||||||
|
return function wrap() {
|
||||||
|
return fn.apply(thisArg, arguments);
|
||||||
|
};
|
||||||
|
};
|
||||||
55
node_modules/axios/lib/helpers/buildURL.js
generated
vendored
Normal file
55
node_modules/axios/lib/helpers/buildURL.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('../utils');
|
||||||
|
var AxiosURLSearchParams = require('../helpers/AxiosURLSearchParams');
|
||||||
|
|
||||||
|
function encode(val) {
|
||||||
|
return encodeURIComponent(val).
|
||||||
|
replace(/%3A/gi, ':').
|
||||||
|
replace(/%24/g, '$').
|
||||||
|
replace(/%2C/gi, ',').
|
||||||
|
replace(/%20/g, '+').
|
||||||
|
replace(/%5B/gi, '[').
|
||||||
|
replace(/%5D/gi, ']');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build a URL by appending params to the end
|
||||||
|
*
|
||||||
|
* @param {string} url The base of the url (e.g., http://www.google.com)
|
||||||
|
* @param {object} [params] The params to be appended
|
||||||
|
* @param {?object} options
|
||||||
|
* @returns {string} The formatted url
|
||||||
|
*/
|
||||||
|
module.exports = function buildURL(url, params, options) {
|
||||||
|
/*eslint no-param-reassign:0*/
|
||||||
|
if (!params) {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
var hashmarkIndex = url.indexOf('#');
|
||||||
|
|
||||||
|
if (hashmarkIndex !== -1) {
|
||||||
|
url = url.slice(0, hashmarkIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
var _encode = options && options.encode || encode;
|
||||||
|
|
||||||
|
var serializeFn = options && options.serialize;
|
||||||
|
|
||||||
|
var serializedParams;
|
||||||
|
|
||||||
|
if (serializeFn) {
|
||||||
|
serializedParams = serializeFn(params, options);
|
||||||
|
} else {
|
||||||
|
serializedParams = utils.isURLSearchParams(params) ?
|
||||||
|
params.toString() :
|
||||||
|
new AxiosURLSearchParams(params, options).toString(_encode);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (serializedParams) {
|
||||||
|
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
||||||
|
}
|
||||||
|
|
||||||
|
return url;
|
||||||
|
};
|
||||||
14
node_modules/axios/lib/helpers/combineURLs.js
generated
vendored
Normal file
14
node_modules/axios/lib/helpers/combineURLs.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new URL by combining the specified URLs
|
||||||
|
*
|
||||||
|
* @param {string} baseURL The base URL
|
||||||
|
* @param {string} relativeURL The relative URL
|
||||||
|
* @returns {string} The combined URL
|
||||||
|
*/
|
||||||
|
module.exports = function combineURLs(baseURL, relativeURL) {
|
||||||
|
return relativeURL
|
||||||
|
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
||||||
|
: baseURL;
|
||||||
|
};
|
||||||
53
node_modules/axios/lib/helpers/cookies.js
generated
vendored
Normal file
53
node_modules/axios/lib/helpers/cookies.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./../utils');
|
||||||
|
|
||||||
|
module.exports = (
|
||||||
|
utils.isStandardBrowserEnv() ?
|
||||||
|
|
||||||
|
// Standard browser envs support document.cookie
|
||||||
|
(function standardBrowserEnv() {
|
||||||
|
return {
|
||||||
|
write: function write(name, value, expires, path, domain, secure) {
|
||||||
|
var cookie = [];
|
||||||
|
cookie.push(name + '=' + encodeURIComponent(value));
|
||||||
|
|
||||||
|
if (utils.isNumber(expires)) {
|
||||||
|
cookie.push('expires=' + new Date(expires).toGMTString());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (utils.isString(path)) {
|
||||||
|
cookie.push('path=' + path);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (utils.isString(domain)) {
|
||||||
|
cookie.push('domain=' + domain);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (secure === true) {
|
||||||
|
cookie.push('secure');
|
||||||
|
}
|
||||||
|
|
||||||
|
document.cookie = cookie.join('; ');
|
||||||
|
},
|
||||||
|
|
||||||
|
read: function read(name) {
|
||||||
|
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
||||||
|
return (match ? decodeURIComponent(match[3]) : null);
|
||||||
|
},
|
||||||
|
|
||||||
|
remove: function remove(name) {
|
||||||
|
this.write(name, '', Date.now() - 86400000);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})() :
|
||||||
|
|
||||||
|
// Non standard browser env (web workers, react-native) lack needed support.
|
||||||
|
(function nonStandardBrowserEnv() {
|
||||||
|
return {
|
||||||
|
write: function write() {},
|
||||||
|
read: function read() { return null; },
|
||||||
|
remove: function remove() {}
|
||||||
|
};
|
||||||
|
})()
|
||||||
|
);
|
||||||
24
node_modules/axios/lib/helpers/deprecatedMethod.js
generated
vendored
Normal file
24
node_modules/axios/lib/helpers/deprecatedMethod.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
/*eslint no-console:0*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Supply a warning to the developer that a method they are using
|
||||||
|
* has been deprecated.
|
||||||
|
*
|
||||||
|
* @param {string} method The name of the deprecated method
|
||||||
|
* @param {string} [instead] The alternate method to use if applicable
|
||||||
|
* @param {string} [docs] The documentation URL to get further details
|
||||||
|
*/
|
||||||
|
module.exports = function deprecatedMethod(method, instead, docs) {
|
||||||
|
try {
|
||||||
|
console.warn(
|
||||||
|
'DEPRECATED method `' + method + '`.' +
|
||||||
|
(instead ? ' Use `' + instead + '` instead.' : '') +
|
||||||
|
' This method will be removed in a future release.');
|
||||||
|
|
||||||
|
if (docs) {
|
||||||
|
console.warn('For more information about usage see ' + docs);
|
||||||
|
}
|
||||||
|
} catch (e) { /* Ignore */ }
|
||||||
|
};
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user