Initial import from local backup (Documents-Playground/pakerpale)
This commit is contained in:
28
index.js
Normal file
28
index.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
const port = 20115
|
||||||
|
, express = require("express")
|
||||||
|
, expressLogging = require('express-logging')
|
||||||
|
, logger = require('logops')
|
||||||
|
, PinterestAPI = require('pinterest-node-api');
|
||||||
|
const pinterest = new PinterestAPI();
|
||||||
|
pinterest.setUserToken('AvEK_VvwiHZMPUHkt_3kfqp4pbILFdIAfhHDD0dGRD1sMOCmBAqvQDAAAmV1RkRCAEOgzHIAAAAA');
|
||||||
|
|
||||||
|
var app = express();
|
||||||
|
app.use(expressLogging(logger));
|
||||||
|
app.listen(port, () => {
|
||||||
|
logger.info({ port: port }, "Server started...");
|
||||||
|
});
|
||||||
|
|
||||||
|
app.get('/me', (req, res, next) => {
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
fields: 'id,note',
|
||||||
|
limit : 1
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
var response = pinterest.users.getUserPins(data);
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
res.json({ code: 200, data: response })
|
||||||
|
})
|
||||||
15
node_modules/.bin/_mocha
generated
vendored
Normal file
15
node_modules/.bin/_mocha
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
"$basedir/node" "$basedir/../mocha/bin/_mocha" "$@"
|
||||||
|
ret=$?
|
||||||
|
else
|
||||||
|
node "$basedir/../mocha/bin/_mocha" "$@"
|
||||||
|
ret=$?
|
||||||
|
fi
|
||||||
|
exit $ret
|
||||||
17
node_modules/.bin/_mocha.cmd
generated
vendored
Normal file
17
node_modules/.bin/_mocha.cmd
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
@ECHO off
|
||||||
|
SETLOCAL
|
||||||
|
CALL :find_dp0
|
||||||
|
|
||||||
|
IF EXIST "%dp0%\node.exe" (
|
||||||
|
SET "_prog=%dp0%\node.exe"
|
||||||
|
) ELSE (
|
||||||
|
SET "_prog=node"
|
||||||
|
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
|
)
|
||||||
|
|
||||||
|
"%_prog%" "%dp0%\..\mocha\bin\_mocha" %*
|
||||||
|
ENDLOCAL
|
||||||
|
EXIT /b %errorlevel%
|
||||||
|
:find_dp0
|
||||||
|
SET dp0=%~dp0
|
||||||
|
EXIT /b
|
||||||
18
node_modules/.bin/_mocha.ps1
generated
vendored
Normal file
18
node_modules/.bin/_mocha.ps1
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env pwsh
|
||||||
|
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||||
|
|
||||||
|
$exe=""
|
||||||
|
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||||
|
# Fix case when both the Windows and Linux builds of Node
|
||||||
|
# are installed in the same directory
|
||||||
|
$exe=".exe"
|
||||||
|
}
|
||||||
|
$ret=0
|
||||||
|
if (Test-Path "$basedir/node$exe") {
|
||||||
|
& "$basedir/node$exe" "$basedir/../mocha/bin/_mocha" $args
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../mocha/bin/_mocha" $args
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
exit $ret
|
||||||
15
node_modules/.bin/he
generated
vendored
Normal file
15
node_modules/.bin/he
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
"$basedir/node" "$basedir/../he/bin/he" "$@"
|
||||||
|
ret=$?
|
||||||
|
else
|
||||||
|
node "$basedir/../he/bin/he" "$@"
|
||||||
|
ret=$?
|
||||||
|
fi
|
||||||
|
exit $ret
|
||||||
17
node_modules/.bin/he.cmd
generated
vendored
Normal file
17
node_modules/.bin/he.cmd
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
@ECHO off
|
||||||
|
SETLOCAL
|
||||||
|
CALL :find_dp0
|
||||||
|
|
||||||
|
IF EXIST "%dp0%\node.exe" (
|
||||||
|
SET "_prog=%dp0%\node.exe"
|
||||||
|
) ELSE (
|
||||||
|
SET "_prog=node"
|
||||||
|
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
|
)
|
||||||
|
|
||||||
|
"%_prog%" "%dp0%\..\he\bin\he" %*
|
||||||
|
ENDLOCAL
|
||||||
|
EXIT /b %errorlevel%
|
||||||
|
:find_dp0
|
||||||
|
SET dp0=%~dp0
|
||||||
|
EXIT /b
|
||||||
18
node_modules/.bin/he.ps1
generated
vendored
Normal file
18
node_modules/.bin/he.ps1
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env pwsh
|
||||||
|
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||||
|
|
||||||
|
$exe=""
|
||||||
|
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||||
|
# Fix case when both the Windows and Linux builds of Node
|
||||||
|
# are installed in the same directory
|
||||||
|
$exe=".exe"
|
||||||
|
}
|
||||||
|
$ret=0
|
||||||
|
if (Test-Path "$basedir/node$exe") {
|
||||||
|
& "$basedir/node$exe" "$basedir/../he/bin/he" $args
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../he/bin/he" $args
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
exit $ret
|
||||||
15
node_modules/.bin/mime
generated
vendored
Normal file
15
node_modules/.bin/mime
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
"$basedir/node" "$basedir/../mime/cli.js" "$@"
|
||||||
|
ret=$?
|
||||||
|
else
|
||||||
|
node "$basedir/../mime/cli.js" "$@"
|
||||||
|
ret=$?
|
||||||
|
fi
|
||||||
|
exit $ret
|
||||||
17
node_modules/.bin/mime.cmd
generated
vendored
Normal file
17
node_modules/.bin/mime.cmd
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
@ECHO off
|
||||||
|
SETLOCAL
|
||||||
|
CALL :find_dp0
|
||||||
|
|
||||||
|
IF EXIST "%dp0%\node.exe" (
|
||||||
|
SET "_prog=%dp0%\node.exe"
|
||||||
|
) ELSE (
|
||||||
|
SET "_prog=node"
|
||||||
|
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
|
)
|
||||||
|
|
||||||
|
"%_prog%" "%dp0%\..\mime\cli.js" %*
|
||||||
|
ENDLOCAL
|
||||||
|
EXIT /b %errorlevel%
|
||||||
|
:find_dp0
|
||||||
|
SET dp0=%~dp0
|
||||||
|
EXIT /b
|
||||||
18
node_modules/.bin/mime.ps1
generated
vendored
Normal file
18
node_modules/.bin/mime.ps1
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env pwsh
|
||||||
|
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||||
|
|
||||||
|
$exe=""
|
||||||
|
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||||
|
# Fix case when both the Windows and Linux builds of Node
|
||||||
|
# are installed in the same directory
|
||||||
|
$exe=".exe"
|
||||||
|
}
|
||||||
|
$ret=0
|
||||||
|
if (Test-Path "$basedir/node$exe") {
|
||||||
|
& "$basedir/node$exe" "$basedir/../mime/cli.js" $args
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../mime/cli.js" $args
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
exit $ret
|
||||||
15
node_modules/.bin/mkdirp
generated
vendored
Normal file
15
node_modules/.bin/mkdirp
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
"$basedir/node" "$basedir/../mkdirp/bin/cmd.js" "$@"
|
||||||
|
ret=$?
|
||||||
|
else
|
||||||
|
node "$basedir/../mkdirp/bin/cmd.js" "$@"
|
||||||
|
ret=$?
|
||||||
|
fi
|
||||||
|
exit $ret
|
||||||
17
node_modules/.bin/mkdirp.cmd
generated
vendored
Normal file
17
node_modules/.bin/mkdirp.cmd
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
@ECHO off
|
||||||
|
SETLOCAL
|
||||||
|
CALL :find_dp0
|
||||||
|
|
||||||
|
IF EXIST "%dp0%\node.exe" (
|
||||||
|
SET "_prog=%dp0%\node.exe"
|
||||||
|
) ELSE (
|
||||||
|
SET "_prog=node"
|
||||||
|
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
|
)
|
||||||
|
|
||||||
|
"%_prog%" "%dp0%\..\mkdirp\bin\cmd.js" %*
|
||||||
|
ENDLOCAL
|
||||||
|
EXIT /b %errorlevel%
|
||||||
|
:find_dp0
|
||||||
|
SET dp0=%~dp0
|
||||||
|
EXIT /b
|
||||||
18
node_modules/.bin/mkdirp.ps1
generated
vendored
Normal file
18
node_modules/.bin/mkdirp.ps1
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env pwsh
|
||||||
|
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||||
|
|
||||||
|
$exe=""
|
||||||
|
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||||
|
# Fix case when both the Windows and Linux builds of Node
|
||||||
|
# are installed in the same directory
|
||||||
|
$exe=".exe"
|
||||||
|
}
|
||||||
|
$ret=0
|
||||||
|
if (Test-Path "$basedir/node$exe") {
|
||||||
|
& "$basedir/node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
exit $ret
|
||||||
15
node_modules/.bin/mocha
generated
vendored
Normal file
15
node_modules/.bin/mocha
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
"$basedir/node" "$basedir/../mocha/bin/mocha" "$@"
|
||||||
|
ret=$?
|
||||||
|
else
|
||||||
|
node "$basedir/../mocha/bin/mocha" "$@"
|
||||||
|
ret=$?
|
||||||
|
fi
|
||||||
|
exit $ret
|
||||||
17
node_modules/.bin/mocha.cmd
generated
vendored
Normal file
17
node_modules/.bin/mocha.cmd
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
@ECHO off
|
||||||
|
SETLOCAL
|
||||||
|
CALL :find_dp0
|
||||||
|
|
||||||
|
IF EXIST "%dp0%\node.exe" (
|
||||||
|
SET "_prog=%dp0%\node.exe"
|
||||||
|
) ELSE (
|
||||||
|
SET "_prog=node"
|
||||||
|
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
|
)
|
||||||
|
|
||||||
|
"%_prog%" "%dp0%\..\mocha\bin\mocha" %*
|
||||||
|
ENDLOCAL
|
||||||
|
EXIT /b %errorlevel%
|
||||||
|
:find_dp0
|
||||||
|
SET dp0=%~dp0
|
||||||
|
EXIT /b
|
||||||
18
node_modules/.bin/mocha.ps1
generated
vendored
Normal file
18
node_modules/.bin/mocha.ps1
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env pwsh
|
||||||
|
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||||
|
|
||||||
|
$exe=""
|
||||||
|
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||||
|
# Fix case when both the Windows and Linux builds of Node
|
||||||
|
# are installed in the same directory
|
||||||
|
$exe=".exe"
|
||||||
|
}
|
||||||
|
$ret=0
|
||||||
|
if (Test-Path "$basedir/node$exe") {
|
||||||
|
& "$basedir/node$exe" "$basedir/../mocha/bin/mocha" $args
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../mocha/bin/mocha" $args
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
exit $ret
|
||||||
236
node_modules/accepts/HISTORY.md
generated
vendored
Normal file
236
node_modules/accepts/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,236 @@
|
|||||||
|
1.3.7 / 2019-04-29
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: negotiator@0.6.2
|
||||||
|
- Fix sorting charset, encoding, and language with extra parameters
|
||||||
|
|
||||||
|
1.3.6 / 2019-04-28
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.24
|
||||||
|
- deps: mime-db@~1.40.0
|
||||||
|
|
||||||
|
1.3.5 / 2018-02-28
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.18
|
||||||
|
- deps: mime-db@~1.33.0
|
||||||
|
|
||||||
|
1.3.4 / 2017-08-22
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.16
|
||||||
|
- deps: mime-db@~1.29.0
|
||||||
|
|
||||||
|
1.3.3 / 2016-05-02
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.11
|
||||||
|
- deps: mime-db@~1.23.0
|
||||||
|
* deps: negotiator@0.6.1
|
||||||
|
- perf: improve `Accept` parsing speed
|
||||||
|
- perf: improve `Accept-Charset` parsing speed
|
||||||
|
- perf: improve `Accept-Encoding` parsing speed
|
||||||
|
- perf: improve `Accept-Language` parsing speed
|
||||||
|
|
||||||
|
1.3.2 / 2016-03-08
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.10
|
||||||
|
- Fix extension of `application/dash+xml`
|
||||||
|
- Update primary extension for `audio/mp4`
|
||||||
|
- deps: mime-db@~1.22.0
|
||||||
|
|
||||||
|
1.3.1 / 2016-01-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.9
|
||||||
|
- deps: mime-db@~1.21.0
|
||||||
|
|
||||||
|
1.3.0 / 2015-09-29
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.7
|
||||||
|
- deps: mime-db@~1.19.0
|
||||||
|
* deps: negotiator@0.6.0
|
||||||
|
- Fix including type extensions in parameters in `Accept` parsing
|
||||||
|
- Fix parsing `Accept` parameters with quoted equals
|
||||||
|
- Fix parsing `Accept` parameters with quoted semicolons
|
||||||
|
- Lazy-load modules from main entry point
|
||||||
|
- perf: delay type concatenation until needed
|
||||||
|
- perf: enable strict mode
|
||||||
|
- perf: hoist regular expressions
|
||||||
|
- perf: remove closures getting spec properties
|
||||||
|
- perf: remove a closure from media type parsing
|
||||||
|
- perf: remove property delete from media type parsing
|
||||||
|
|
||||||
|
1.2.13 / 2015-09-06
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.6
|
||||||
|
- deps: mime-db@~1.18.0
|
||||||
|
|
||||||
|
1.2.12 / 2015-07-30
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.4
|
||||||
|
- deps: mime-db@~1.16.0
|
||||||
|
|
||||||
|
1.2.11 / 2015-07-16
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.3
|
||||||
|
- deps: mime-db@~1.15.0
|
||||||
|
|
||||||
|
1.2.10 / 2015-07-01
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.2
|
||||||
|
- deps: mime-db@~1.14.0
|
||||||
|
|
||||||
|
1.2.9 / 2015-06-08
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.1
|
||||||
|
- perf: fix deopt during mapping
|
||||||
|
|
||||||
|
1.2.8 / 2015-06-07
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.0
|
||||||
|
- deps: mime-db@~1.13.0
|
||||||
|
* perf: avoid argument reassignment & argument slice
|
||||||
|
* perf: avoid negotiator recursive construction
|
||||||
|
* perf: enable strict mode
|
||||||
|
* perf: remove unnecessary bitwise operator
|
||||||
|
|
||||||
|
1.2.7 / 2015-05-10
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: negotiator@0.5.3
|
||||||
|
- Fix media type parameter matching to be case-insensitive
|
||||||
|
|
||||||
|
1.2.6 / 2015-05-07
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.11
|
||||||
|
- deps: mime-db@~1.9.1
|
||||||
|
* deps: negotiator@0.5.2
|
||||||
|
- Fix comparing media types with quoted values
|
||||||
|
- Fix splitting media types with quoted commas
|
||||||
|
|
||||||
|
1.2.5 / 2015-03-13
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.10
|
||||||
|
- deps: mime-db@~1.8.0
|
||||||
|
|
||||||
|
1.2.4 / 2015-02-14
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Support Node.js 0.6
|
||||||
|
* deps: mime-types@~2.0.9
|
||||||
|
- deps: mime-db@~1.7.0
|
||||||
|
* deps: negotiator@0.5.1
|
||||||
|
- Fix preference sorting to be stable for long acceptable lists
|
||||||
|
|
||||||
|
1.2.3 / 2015-01-31
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.8
|
||||||
|
- deps: mime-db@~1.6.0
|
||||||
|
|
||||||
|
1.2.2 / 2014-12-30
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.7
|
||||||
|
- deps: mime-db@~1.5.0
|
||||||
|
|
||||||
|
1.2.1 / 2014-12-30
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.5
|
||||||
|
- deps: mime-db@~1.3.1
|
||||||
|
|
||||||
|
1.2.0 / 2014-12-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: negotiator@0.5.0
|
||||||
|
- Fix list return order when large accepted list
|
||||||
|
- Fix missing identity encoding when q=0 exists
|
||||||
|
- Remove dynamic building of Negotiator class
|
||||||
|
|
||||||
|
1.1.4 / 2014-12-10
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.4
|
||||||
|
- deps: mime-db@~1.3.0
|
||||||
|
|
||||||
|
1.1.3 / 2014-11-09
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.3
|
||||||
|
- deps: mime-db@~1.2.0
|
||||||
|
|
||||||
|
1.1.2 / 2014-10-14
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: negotiator@0.4.9
|
||||||
|
- Fix error when media type has invalid parameter
|
||||||
|
|
||||||
|
1.1.1 / 2014-09-28
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.2
|
||||||
|
- deps: mime-db@~1.1.0
|
||||||
|
* deps: negotiator@0.4.8
|
||||||
|
- Fix all negotiations to be case-insensitive
|
||||||
|
- Stable sort preferences of same quality according to client order
|
||||||
|
|
||||||
|
1.1.0 / 2014-09-02
|
||||||
|
==================
|
||||||
|
|
||||||
|
* update `mime-types`
|
||||||
|
|
||||||
|
1.0.7 / 2014-07-04
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix wrong type returned from `type` when match after unknown extension
|
||||||
|
|
||||||
|
1.0.6 / 2014-06-24
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: negotiator@0.4.7
|
||||||
|
|
||||||
|
1.0.5 / 2014-06-20
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fix crash when unknown extension given
|
||||||
|
|
||||||
|
1.0.4 / 2014-06-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* use `mime-types`
|
||||||
|
|
||||||
|
1.0.3 / 2014-06-11
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: negotiator@0.4.6
|
||||||
|
- Order by specificity when quality is the same
|
||||||
|
|
||||||
|
1.0.2 / 2014-05-29
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix interpretation when header not in request
|
||||||
|
* deps: pin negotiator@0.4.5
|
||||||
|
|
||||||
|
1.0.1 / 2014-01-18
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Identity encoding isn't always acceptable
|
||||||
|
* deps: negotiator@~0.4.0
|
||||||
|
|
||||||
|
1.0.0 / 2013-12-27
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Genesis
|
||||||
23
node_modules/accepts/LICENSE
generated
vendored
Normal file
23
node_modules/accepts/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||||
|
Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
'Software'), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
142
node_modules/accepts/README.md
generated
vendored
Normal file
142
node_modules/accepts/README.md
generated
vendored
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
# accepts
|
||||||
|
|
||||||
|
[![NPM Version][npm-version-image]][npm-url]
|
||||||
|
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||||
|
[![Node.js Version][node-version-image]][node-version-url]
|
||||||
|
[![Build Status][travis-image]][travis-url]
|
||||||
|
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||||
|
|
||||||
|
Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator).
|
||||||
|
Extracted from [koa](https://www.npmjs.com/package/koa) for general use.
|
||||||
|
|
||||||
|
In addition to negotiator, it allows:
|
||||||
|
|
||||||
|
- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])`
|
||||||
|
as well as `('text/html', 'application/json')`.
|
||||||
|
- Allows type shorthands such as `json`.
|
||||||
|
- Returns `false` when no types match
|
||||||
|
- Treats non-existent headers as `*`
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
This is a [Node.js](https://nodejs.org/en/) module available through the
|
||||||
|
[npm registry](https://www.npmjs.com/). Installation is done using the
|
||||||
|
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ npm install accepts
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
<!-- eslint-disable no-unused-vars -->
|
||||||
|
|
||||||
|
```js
|
||||||
|
var accepts = require('accepts')
|
||||||
|
```
|
||||||
|
|
||||||
|
### accepts(req)
|
||||||
|
|
||||||
|
Create a new `Accepts` object for the given `req`.
|
||||||
|
|
||||||
|
#### .charset(charsets)
|
||||||
|
|
||||||
|
Return the first accepted charset. If nothing in `charsets` is accepted,
|
||||||
|
then `false` is returned.
|
||||||
|
|
||||||
|
#### .charsets()
|
||||||
|
|
||||||
|
Return the charsets that the request accepts, in the order of the client's
|
||||||
|
preference (most preferred first).
|
||||||
|
|
||||||
|
#### .encoding(encodings)
|
||||||
|
|
||||||
|
Return the first accepted encoding. If nothing in `encodings` is accepted,
|
||||||
|
then `false` is returned.
|
||||||
|
|
||||||
|
#### .encodings()
|
||||||
|
|
||||||
|
Return the encodings that the request accepts, in the order of the client's
|
||||||
|
preference (most preferred first).
|
||||||
|
|
||||||
|
#### .language(languages)
|
||||||
|
|
||||||
|
Return the first accepted language. If nothing in `languages` is accepted,
|
||||||
|
then `false` is returned.
|
||||||
|
|
||||||
|
#### .languages()
|
||||||
|
|
||||||
|
Return the languages that the request accepts, in the order of the client's
|
||||||
|
preference (most preferred first).
|
||||||
|
|
||||||
|
#### .type(types)
|
||||||
|
|
||||||
|
Return the first accepted type (and it is returned as the same text as what
|
||||||
|
appears in the `types` array). If nothing in `types` is accepted, then `false`
|
||||||
|
is returned.
|
||||||
|
|
||||||
|
The `types` array can contain full MIME types or file extensions. Any value
|
||||||
|
that is not a full MIME types is passed to `require('mime-types').lookup`.
|
||||||
|
|
||||||
|
#### .types()
|
||||||
|
|
||||||
|
Return the types that the request accepts, in the order of the client's
|
||||||
|
preference (most preferred first).
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
### Simple type negotiation
|
||||||
|
|
||||||
|
This simple example shows how to use `accepts` to return a different typed
|
||||||
|
respond body based on what the client wants to accept. The server lists it's
|
||||||
|
preferences in order and will get back the best match between the client and
|
||||||
|
server.
|
||||||
|
|
||||||
|
```js
|
||||||
|
var accepts = require('accepts')
|
||||||
|
var http = require('http')
|
||||||
|
|
||||||
|
function app (req, res) {
|
||||||
|
var accept = accepts(req)
|
||||||
|
|
||||||
|
// the order of this list is significant; should be server preferred order
|
||||||
|
switch (accept.type(['json', 'html'])) {
|
||||||
|
case 'json':
|
||||||
|
res.setHeader('Content-Type', 'application/json')
|
||||||
|
res.write('{"hello":"world!"}')
|
||||||
|
break
|
||||||
|
case 'html':
|
||||||
|
res.setHeader('Content-Type', 'text/html')
|
||||||
|
res.write('<b>hello, world!</b>')
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
// the fallback is text/plain, so no need to specify it above
|
||||||
|
res.setHeader('Content-Type', 'text/plain')
|
||||||
|
res.write('hello, world!')
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
res.end()
|
||||||
|
}
|
||||||
|
|
||||||
|
http.createServer(app).listen(3000)
|
||||||
|
```
|
||||||
|
|
||||||
|
You can test this out with the cURL program:
|
||||||
|
```sh
|
||||||
|
curl -I -H'Accept: text/html' http://localhost:3000/
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
[MIT](LICENSE)
|
||||||
|
|
||||||
|
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/accepts/master
|
||||||
|
[coveralls-url]: https://coveralls.io/r/jshttp/accepts?branch=master
|
||||||
|
[node-version-image]: https://badgen.net/npm/node/accepts
|
||||||
|
[node-version-url]: https://nodejs.org/en/download
|
||||||
|
[npm-downloads-image]: https://badgen.net/npm/dm/accepts
|
||||||
|
[npm-url]: https://npmjs.org/package/accepts
|
||||||
|
[npm-version-image]: https://badgen.net/npm/v/accepts
|
||||||
|
[travis-image]: https://badgen.net/travis/jshttp/accepts/master
|
||||||
|
[travis-url]: https://travis-ci.org/jshttp/accepts
|
||||||
238
node_modules/accepts/index.js
generated
vendored
Normal file
238
node_modules/accepts/index.js
generated
vendored
Normal file
@@ -0,0 +1,238 @@
|
|||||||
|
/*!
|
||||||
|
* accepts
|
||||||
|
* Copyright(c) 2014 Jonathan Ong
|
||||||
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
||||||
|
* MIT Licensed
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
var Negotiator = require('negotiator')
|
||||||
|
var mime = require('mime-types')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module exports.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = Accepts
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new Accepts object for the given req.
|
||||||
|
*
|
||||||
|
* @param {object} req
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function Accepts (req) {
|
||||||
|
if (!(this instanceof Accepts)) {
|
||||||
|
return new Accepts(req)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.headers = req.headers
|
||||||
|
this.negotiator = new Negotiator(req)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the given `type(s)` is acceptable, returning
|
||||||
|
* the best match when true, otherwise `undefined`, in which
|
||||||
|
* case you should respond with 406 "Not Acceptable".
|
||||||
|
*
|
||||||
|
* The `type` value may be a single mime type string
|
||||||
|
* such as "application/json", the extension name
|
||||||
|
* such as "json" or an array `["json", "html", "text/plain"]`. When a list
|
||||||
|
* or array is given the _best_ match, if any is returned.
|
||||||
|
*
|
||||||
|
* Examples:
|
||||||
|
*
|
||||||
|
* // Accept: text/html
|
||||||
|
* this.types('html');
|
||||||
|
* // => "html"
|
||||||
|
*
|
||||||
|
* // Accept: text/*, application/json
|
||||||
|
* this.types('html');
|
||||||
|
* // => "html"
|
||||||
|
* this.types('text/html');
|
||||||
|
* // => "text/html"
|
||||||
|
* this.types('json', 'text');
|
||||||
|
* // => "json"
|
||||||
|
* this.types('application/json');
|
||||||
|
* // => "application/json"
|
||||||
|
*
|
||||||
|
* // Accept: text/*, application/json
|
||||||
|
* this.types('image/png');
|
||||||
|
* this.types('png');
|
||||||
|
* // => undefined
|
||||||
|
*
|
||||||
|
* // Accept: text/*;q=.5, application/json
|
||||||
|
* this.types(['html', 'json']);
|
||||||
|
* this.types('html', 'json');
|
||||||
|
* // => "json"
|
||||||
|
*
|
||||||
|
* @param {String|Array} types...
|
||||||
|
* @return {String|Array|Boolean}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Accepts.prototype.type =
|
||||||
|
Accepts.prototype.types = function (types_) {
|
||||||
|
var types = types_
|
||||||
|
|
||||||
|
// support flattened arguments
|
||||||
|
if (types && !Array.isArray(types)) {
|
||||||
|
types = new Array(arguments.length)
|
||||||
|
for (var i = 0; i < types.length; i++) {
|
||||||
|
types[i] = arguments[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// no types, return all requested types
|
||||||
|
if (!types || types.length === 0) {
|
||||||
|
return this.negotiator.mediaTypes()
|
||||||
|
}
|
||||||
|
|
||||||
|
// no accept header, return first given type
|
||||||
|
if (!this.headers.accept) {
|
||||||
|
return types[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
var mimes = types.map(extToMime)
|
||||||
|
var accepts = this.negotiator.mediaTypes(mimes.filter(validMime))
|
||||||
|
var first = accepts[0]
|
||||||
|
|
||||||
|
return first
|
||||||
|
? types[mimes.indexOf(first)]
|
||||||
|
: false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return accepted encodings or best fit based on `encodings`.
|
||||||
|
*
|
||||||
|
* Given `Accept-Encoding: gzip, deflate`
|
||||||
|
* an array sorted by quality is returned:
|
||||||
|
*
|
||||||
|
* ['gzip', 'deflate']
|
||||||
|
*
|
||||||
|
* @param {String|Array} encodings...
|
||||||
|
* @return {String|Array}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Accepts.prototype.encoding =
|
||||||
|
Accepts.prototype.encodings = function (encodings_) {
|
||||||
|
var encodings = encodings_
|
||||||
|
|
||||||
|
// support flattened arguments
|
||||||
|
if (encodings && !Array.isArray(encodings)) {
|
||||||
|
encodings = new Array(arguments.length)
|
||||||
|
for (var i = 0; i < encodings.length; i++) {
|
||||||
|
encodings[i] = arguments[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// no encodings, return all requested encodings
|
||||||
|
if (!encodings || encodings.length === 0) {
|
||||||
|
return this.negotiator.encodings()
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.negotiator.encodings(encodings)[0] || false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return accepted charsets or best fit based on `charsets`.
|
||||||
|
*
|
||||||
|
* Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5`
|
||||||
|
* an array sorted by quality is returned:
|
||||||
|
*
|
||||||
|
* ['utf-8', 'utf-7', 'iso-8859-1']
|
||||||
|
*
|
||||||
|
* @param {String|Array} charsets...
|
||||||
|
* @return {String|Array}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Accepts.prototype.charset =
|
||||||
|
Accepts.prototype.charsets = function (charsets_) {
|
||||||
|
var charsets = charsets_
|
||||||
|
|
||||||
|
// support flattened arguments
|
||||||
|
if (charsets && !Array.isArray(charsets)) {
|
||||||
|
charsets = new Array(arguments.length)
|
||||||
|
for (var i = 0; i < charsets.length; i++) {
|
||||||
|
charsets[i] = arguments[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// no charsets, return all requested charsets
|
||||||
|
if (!charsets || charsets.length === 0) {
|
||||||
|
return this.negotiator.charsets()
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.negotiator.charsets(charsets)[0] || false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return accepted languages or best fit based on `langs`.
|
||||||
|
*
|
||||||
|
* Given `Accept-Language: en;q=0.8, es, pt`
|
||||||
|
* an array sorted by quality is returned:
|
||||||
|
*
|
||||||
|
* ['es', 'pt', 'en']
|
||||||
|
*
|
||||||
|
* @param {String|Array} langs...
|
||||||
|
* @return {Array|String}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Accepts.prototype.lang =
|
||||||
|
Accepts.prototype.langs =
|
||||||
|
Accepts.prototype.language =
|
||||||
|
Accepts.prototype.languages = function (languages_) {
|
||||||
|
var languages = languages_
|
||||||
|
|
||||||
|
// support flattened arguments
|
||||||
|
if (languages && !Array.isArray(languages)) {
|
||||||
|
languages = new Array(arguments.length)
|
||||||
|
for (var i = 0; i < languages.length; i++) {
|
||||||
|
languages[i] = arguments[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// no languages, return all requested languages
|
||||||
|
if (!languages || languages.length === 0) {
|
||||||
|
return this.negotiator.languages()
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.negotiator.languages(languages)[0] || false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert extnames to mime.
|
||||||
|
*
|
||||||
|
* @param {String} type
|
||||||
|
* @return {String}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function extToMime (type) {
|
||||||
|
return type.indexOf('/') === -1
|
||||||
|
? mime.lookup(type)
|
||||||
|
: type
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if mime is valid.
|
||||||
|
*
|
||||||
|
* @param {String} type
|
||||||
|
* @return {String}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function validMime (type) {
|
||||||
|
return typeof type === 'string'
|
||||||
|
}
|
||||||
86
node_modules/accepts/package.json
generated
vendored
Normal file
86
node_modules/accepts/package.json
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
{
|
||||||
|
"_from": "accepts@~1.3.7",
|
||||||
|
"_id": "accepts@1.3.7",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
|
||||||
|
"_location": "/accepts",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "accepts@~1.3.7",
|
||||||
|
"name": "accepts",
|
||||||
|
"escapedName": "accepts",
|
||||||
|
"rawSpec": "~1.3.7",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "~1.3.7"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/express"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
|
||||||
|
"_shasum": "531bc726517a3b2b41f850021c6cc15eaab507cd",
|
||||||
|
"_spec": "accepts@~1.3.7",
|
||||||
|
"_where": "D:\\dev\\crossmap\\backend-services\\cm-app-pinterestapiclient\\node_modules\\express",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/jshttp/accepts/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Douglas Christopher Wilson",
|
||||||
|
"email": "doug@somethingdoug.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Jonathan Ong",
|
||||||
|
"email": "me@jongleberry.com",
|
||||||
|
"url": "http://jongleberry.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"mime-types": "~2.1.24",
|
||||||
|
"negotiator": "0.6.2"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Higher-level content negotiation",
|
||||||
|
"devDependencies": {
|
||||||
|
"deep-equal": "1.0.1",
|
||||||
|
"eslint": "5.16.0",
|
||||||
|
"eslint-config-standard": "12.0.0",
|
||||||
|
"eslint-plugin-import": "2.17.2",
|
||||||
|
"eslint-plugin-markdown": "1.0.0",
|
||||||
|
"eslint-plugin-node": "8.0.1",
|
||||||
|
"eslint-plugin-promise": "4.1.1",
|
||||||
|
"eslint-plugin-standard": "4.0.0",
|
||||||
|
"mocha": "6.1.4",
|
||||||
|
"nyc": "14.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"LICENSE",
|
||||||
|
"HISTORY.md",
|
||||||
|
"index.js"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/jshttp/accepts#readme",
|
||||||
|
"keywords": [
|
||||||
|
"content",
|
||||||
|
"negotiation",
|
||||||
|
"accept",
|
||||||
|
"accepts"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"name": "accepts",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/jshttp/accepts.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"lint": "eslint --plugin markdown --ext js,md .",
|
||||||
|
"test": "mocha --reporter spec --check-leaks --bail test/",
|
||||||
|
"test-cov": "nyc --reporter=html --reporter=text npm test",
|
||||||
|
"test-travis": "nyc --reporter=text npm test"
|
||||||
|
},
|
||||||
|
"version": "1.3.7"
|
||||||
|
}
|
||||||
21
node_modules/array-flatten/LICENSE
generated
vendored
Normal file
21
node_modules/array-flatten/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
43
node_modules/array-flatten/README.md
generated
vendored
Normal file
43
node_modules/array-flatten/README.md
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# Array Flatten
|
||||||
|
|
||||||
|
[![NPM version][npm-image]][npm-url]
|
||||||
|
[![NPM downloads][downloads-image]][downloads-url]
|
||||||
|
[![Build status][travis-image]][travis-url]
|
||||||
|
[![Test coverage][coveralls-image]][coveralls-url]
|
||||||
|
|
||||||
|
> Flatten an array of nested arrays into a single flat array. Accepts an optional depth.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```
|
||||||
|
npm install array-flatten --save
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var flatten = require('array-flatten')
|
||||||
|
|
||||||
|
flatten([1, [2, [3, [4, [5], 6], 7], 8], 9])
|
||||||
|
//=> [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||||
|
|
||||||
|
flatten([1, [2, [3, [4, [5], 6], 7], 8], 9], 2)
|
||||||
|
//=> [1, 2, 3, [4, [5], 6], 7, 8, 9]
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
flatten(arguments) //=> [1, 2, 3]
|
||||||
|
})(1, [2, 3])
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT
|
||||||
|
|
||||||
|
[npm-image]: https://img.shields.io/npm/v/array-flatten.svg?style=flat
|
||||||
|
[npm-url]: https://npmjs.org/package/array-flatten
|
||||||
|
[downloads-image]: https://img.shields.io/npm/dm/array-flatten.svg?style=flat
|
||||||
|
[downloads-url]: https://npmjs.org/package/array-flatten
|
||||||
|
[travis-image]: https://img.shields.io/travis/blakeembrey/array-flatten.svg?style=flat
|
||||||
|
[travis-url]: https://travis-ci.org/blakeembrey/array-flatten
|
||||||
|
[coveralls-image]: https://img.shields.io/coveralls/blakeembrey/array-flatten.svg?style=flat
|
||||||
|
[coveralls-url]: https://coveralls.io/r/blakeembrey/array-flatten?branch=master
|
||||||
64
node_modules/array-flatten/array-flatten.js
generated
vendored
Normal file
64
node_modules/array-flatten/array-flatten.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
'use strict'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Expose `arrayFlatten`.
|
||||||
|
*/
|
||||||
|
module.exports = arrayFlatten
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursive flatten function with depth.
|
||||||
|
*
|
||||||
|
* @param {Array} array
|
||||||
|
* @param {Array} result
|
||||||
|
* @param {Number} depth
|
||||||
|
* @return {Array}
|
||||||
|
*/
|
||||||
|
function flattenWithDepth (array, result, depth) {
|
||||||
|
for (var i = 0; i < array.length; i++) {
|
||||||
|
var value = array[i]
|
||||||
|
|
||||||
|
if (depth > 0 && Array.isArray(value)) {
|
||||||
|
flattenWithDepth(value, result, depth - 1)
|
||||||
|
} else {
|
||||||
|
result.push(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursive flatten function. Omitting depth is slightly faster.
|
||||||
|
*
|
||||||
|
* @param {Array} array
|
||||||
|
* @param {Array} result
|
||||||
|
* @return {Array}
|
||||||
|
*/
|
||||||
|
function flattenForever (array, result) {
|
||||||
|
for (var i = 0; i < array.length; i++) {
|
||||||
|
var value = array[i]
|
||||||
|
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
flattenForever(value, result)
|
||||||
|
} else {
|
||||||
|
result.push(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flatten an array, with the ability to define a depth.
|
||||||
|
*
|
||||||
|
* @param {Array} array
|
||||||
|
* @param {Number} depth
|
||||||
|
* @return {Array}
|
||||||
|
*/
|
||||||
|
function arrayFlatten (array, depth) {
|
||||||
|
if (depth == null) {
|
||||||
|
return flattenForever(array, [])
|
||||||
|
}
|
||||||
|
|
||||||
|
return flattenWithDepth(array, [], depth)
|
||||||
|
}
|
||||||
64
node_modules/array-flatten/package.json
generated
vendored
Normal file
64
node_modules/array-flatten/package.json
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
{
|
||||||
|
"_from": "array-flatten@1.1.1",
|
||||||
|
"_id": "array-flatten@1.1.1",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=",
|
||||||
|
"_location": "/array-flatten",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "array-flatten@1.1.1",
|
||||||
|
"name": "array-flatten",
|
||||||
|
"escapedName": "array-flatten",
|
||||||
|
"rawSpec": "1.1.1",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "1.1.1"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/express"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
||||||
|
"_shasum": "9a5f699051b1e7073328f2a008968b64ea2955d2",
|
||||||
|
"_spec": "array-flatten@1.1.1",
|
||||||
|
"_where": "D:\\dev\\crossmap\\backend-services\\cm-app-pinterestapiclient\\node_modules\\express",
|
||||||
|
"author": {
|
||||||
|
"name": "Blake Embrey",
|
||||||
|
"email": "hello@blakeembrey.com",
|
||||||
|
"url": "http://blakeembrey.me"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/blakeembrey/array-flatten/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Flatten an array of nested arrays into a single flat array",
|
||||||
|
"devDependencies": {
|
||||||
|
"istanbul": "^0.3.13",
|
||||||
|
"mocha": "^2.2.4",
|
||||||
|
"pre-commit": "^1.0.7",
|
||||||
|
"standard": "^3.7.3"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"array-flatten.js",
|
||||||
|
"LICENSE"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/blakeembrey/array-flatten",
|
||||||
|
"keywords": [
|
||||||
|
"array",
|
||||||
|
"flatten",
|
||||||
|
"arguments",
|
||||||
|
"depth"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "array-flatten.js",
|
||||||
|
"name": "array-flatten",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/blakeembrey/array-flatten.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "istanbul cover _mocha -- -R spec"
|
||||||
|
},
|
||||||
|
"version": "1.1.1"
|
||||||
|
}
|
||||||
24
node_modules/assertion-error/History.md
generated
vendored
Normal file
24
node_modules/assertion-error/History.md
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
1.1.0 / 2018-01-02
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Add type definitions ([#11](https://github.com/chaijs/assertion-error/pull/11))
|
||||||
|
|
||||||
|
1.0.1 / 2015-03-04
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Merge pull request #2 from simonzack/master
|
||||||
|
* fixes `.stack` on firefox
|
||||||
|
|
||||||
|
1.0.0 / 2013-06-08
|
||||||
|
==================
|
||||||
|
|
||||||
|
* readme: change travis and component urls
|
||||||
|
* refactor: [*] prepare for move to chaijs gh org
|
||||||
|
|
||||||
|
0.1.0 / 2013-04-07
|
||||||
|
==================
|
||||||
|
|
||||||
|
* test: use vanilla test runner/assert
|
||||||
|
* pgk: remove unused deps
|
||||||
|
* lib: implement
|
||||||
|
* "Initial commit"
|
||||||
41
node_modules/assertion-error/README.md
generated
vendored
Normal file
41
node_modules/assertion-error/README.md
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
# AssertionError [](https://travis-ci.org/chaijs/assertion-error)
|
||||||
|
|
||||||
|
> Error constructor for test and validation frameworks that implements standardized AssertionError specification.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### Node.js
|
||||||
|
|
||||||
|
`assertion-error` is available on [npm](http://npmjs.org).
|
||||||
|
|
||||||
|
$ npm install assertion-error
|
||||||
|
|
||||||
|
### Component
|
||||||
|
|
||||||
|
`assertion-error` is available as a [component](https://github.com/component/component).
|
||||||
|
|
||||||
|
$ component install chaijs/assertion-error
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2013 Jake Luer <jake@qualiancy.com> (http://qualiancy.com)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
11
node_modules/assertion-error/index.d.ts
generated
vendored
Normal file
11
node_modules/assertion-error/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
type AssertionError<T = {}> = Error & T & {
|
||||||
|
showDiff: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
interface AssertionErrorConstructor {
|
||||||
|
new<T = {}>(message: string, props?: T, ssf?: Function): AssertionError<T>;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare const AssertionError: AssertionErrorConstructor;
|
||||||
|
|
||||||
|
export = AssertionError;
|
||||||
116
node_modules/assertion-error/index.js
generated
vendored
Normal file
116
node_modules/assertion-error/index.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
/*!
|
||||||
|
* assertion-error
|
||||||
|
* Copyright(c) 2013 Jake Luer <jake@qualiancy.com>
|
||||||
|
* MIT Licensed
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Return a function that will copy properties from
|
||||||
|
* one object to another excluding any originally
|
||||||
|
* listed. Returned function will create a new `{}`.
|
||||||
|
*
|
||||||
|
* @param {String} excluded properties ...
|
||||||
|
* @return {Function}
|
||||||
|
*/
|
||||||
|
|
||||||
|
function exclude () {
|
||||||
|
var excludes = [].slice.call(arguments);
|
||||||
|
|
||||||
|
function excludeProps (res, obj) {
|
||||||
|
Object.keys(obj).forEach(function (key) {
|
||||||
|
if (!~excludes.indexOf(key)) res[key] = obj[key];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return function extendExclude () {
|
||||||
|
var args = [].slice.call(arguments)
|
||||||
|
, i = 0
|
||||||
|
, res = {};
|
||||||
|
|
||||||
|
for (; i < args.length; i++) {
|
||||||
|
excludeProps(res, args[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Primary Exports
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = AssertionError;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ### AssertionError
|
||||||
|
*
|
||||||
|
* An extension of the JavaScript `Error` constructor for
|
||||||
|
* assertion and validation scenarios.
|
||||||
|
*
|
||||||
|
* @param {String} message
|
||||||
|
* @param {Object} properties to include (optional)
|
||||||
|
* @param {callee} start stack function (optional)
|
||||||
|
*/
|
||||||
|
|
||||||
|
function AssertionError (message, _props, ssf) {
|
||||||
|
var extend = exclude('name', 'message', 'stack', 'constructor', 'toJSON')
|
||||||
|
, props = extend(_props || {});
|
||||||
|
|
||||||
|
// default values
|
||||||
|
this.message = message || 'Unspecified AssertionError';
|
||||||
|
this.showDiff = false;
|
||||||
|
|
||||||
|
// copy from properties
|
||||||
|
for (var key in props) {
|
||||||
|
this[key] = props[key];
|
||||||
|
}
|
||||||
|
|
||||||
|
// capture stack trace
|
||||||
|
ssf = ssf || AssertionError;
|
||||||
|
if (Error.captureStackTrace) {
|
||||||
|
Error.captureStackTrace(this, ssf);
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
throw new Error();
|
||||||
|
} catch(e) {
|
||||||
|
this.stack = e.stack;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Inherit from Error.prototype
|
||||||
|
*/
|
||||||
|
|
||||||
|
AssertionError.prototype = Object.create(Error.prototype);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Statically set name
|
||||||
|
*/
|
||||||
|
|
||||||
|
AssertionError.prototype.name = 'AssertionError';
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Ensure correct constructor
|
||||||
|
*/
|
||||||
|
|
||||||
|
AssertionError.prototype.constructor = AssertionError;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allow errors to be converted to JSON for static transfer.
|
||||||
|
*
|
||||||
|
* @param {Boolean} include stack (default: `true`)
|
||||||
|
* @return {Object} object that can be `JSON.stringify`
|
||||||
|
*/
|
||||||
|
|
||||||
|
AssertionError.prototype.toJSON = function (stack) {
|
||||||
|
var extend = exclude('constructor', 'toJSON', 'stack')
|
||||||
|
, props = extend({ name: this.name }, this);
|
||||||
|
|
||||||
|
// include stack if exists and not turned off
|
||||||
|
if (false !== stack && this.stack) {
|
||||||
|
props.stack = this.stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
return props;
|
||||||
|
};
|
||||||
62
node_modules/assertion-error/package.json
generated
vendored
Normal file
62
node_modules/assertion-error/package.json
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
{
|
||||||
|
"_from": "assertion-error@^1.1.0",
|
||||||
|
"_id": "assertion-error@1.1.0",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==",
|
||||||
|
"_location": "/assertion-error",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "assertion-error@^1.1.0",
|
||||||
|
"name": "assertion-error",
|
||||||
|
"escapedName": "assertion-error",
|
||||||
|
"rawSpec": "^1.1.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^1.1.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/chai"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz",
|
||||||
|
"_shasum": "e60b6b0e8f301bd97e5375215bda406c85118c0b",
|
||||||
|
"_spec": "assertion-error@^1.1.0",
|
||||||
|
"_where": "D:\\dev\\crossmap\\backend-services\\cm-app-pinterestapiclient\\node_modules\\chai",
|
||||||
|
"author": {
|
||||||
|
"name": "Jake Luer",
|
||||||
|
"email": "jake@qualiancy.com",
|
||||||
|
"url": "http://qualiancy.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/chaijs/assertion-error/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Error constructor for test and validation frameworks that implements standardized AssertionError specification.",
|
||||||
|
"devDependencies": {
|
||||||
|
"component": "*",
|
||||||
|
"typescript": "^2.6.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/chaijs/assertion-error#readme",
|
||||||
|
"keywords": [
|
||||||
|
"test",
|
||||||
|
"assertion",
|
||||||
|
"assertion-error"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "./index",
|
||||||
|
"name": "assertion-error",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+ssh://git@github.com/chaijs/assertion-error.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "make test"
|
||||||
|
},
|
||||||
|
"types": "./index.d.ts",
|
||||||
|
"version": "1.1.0"
|
||||||
|
}
|
||||||
5
node_modules/balanced-match/.npmignore
generated
vendored
Normal file
5
node_modules/balanced-match/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
test
|
||||||
|
.gitignore
|
||||||
|
.travis.yml
|
||||||
|
Makefile
|
||||||
|
example.js
|
||||||
21
node_modules/balanced-match/LICENSE.md
generated
vendored
Normal file
21
node_modules/balanced-match/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
(MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
of the Software, and to permit persons to whom the Software is furnished to do
|
||||||
|
so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
91
node_modules/balanced-match/README.md
generated
vendored
Normal file
91
node_modules/balanced-match/README.md
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
# balanced-match
|
||||||
|
|
||||||
|
Match balanced string pairs, like `{` and `}` or `<b>` and `</b>`. Supports regular expressions as well!
|
||||||
|
|
||||||
|
[](http://travis-ci.org/juliangruber/balanced-match)
|
||||||
|
[](https://www.npmjs.org/package/balanced-match)
|
||||||
|
|
||||||
|
[](https://ci.testling.com/juliangruber/balanced-match)
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
Get the first matching pair of braces:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var balanced = require('balanced-match');
|
||||||
|
|
||||||
|
console.log(balanced('{', '}', 'pre{in{nested}}post'));
|
||||||
|
console.log(balanced('{', '}', 'pre{first}between{second}post'));
|
||||||
|
console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post'));
|
||||||
|
```
|
||||||
|
|
||||||
|
The matches are:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ node example.js
|
||||||
|
{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' }
|
||||||
|
{ start: 3,
|
||||||
|
end: 9,
|
||||||
|
pre: 'pre',
|
||||||
|
body: 'first',
|
||||||
|
post: 'between{second}post' }
|
||||||
|
{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' }
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### var m = balanced(a, b, str)
|
||||||
|
|
||||||
|
For the first non-nested matching pair of `a` and `b` in `str`, return an
|
||||||
|
object with those keys:
|
||||||
|
|
||||||
|
* **start** the index of the first match of `a`
|
||||||
|
* **end** the index of the matching `b`
|
||||||
|
* **pre** the preamble, `a` and `b` not included
|
||||||
|
* **body** the match, `a` and `b` not included
|
||||||
|
* **post** the postscript, `a` and `b` not included
|
||||||
|
|
||||||
|
If there's no match, `undefined` will be returned.
|
||||||
|
|
||||||
|
If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`.
|
||||||
|
|
||||||
|
### var r = balanced.range(a, b, str)
|
||||||
|
|
||||||
|
For the first non-nested matching pair of `a` and `b` in `str`, return an
|
||||||
|
array with indexes: `[ <a index>, <b index> ]`.
|
||||||
|
|
||||||
|
If there's no match, `undefined` will be returned.
|
||||||
|
|
||||||
|
If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
With [npm](https://npmjs.org) do:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install balanced-match
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
(MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
of the Software, and to permit persons to whom the Software is furnished to do
|
||||||
|
so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
59
node_modules/balanced-match/index.js
generated
vendored
Normal file
59
node_modules/balanced-match/index.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
'use strict';
|
||||||
|
module.exports = balanced;
|
||||||
|
function balanced(a, b, str) {
|
||||||
|
if (a instanceof RegExp) a = maybeMatch(a, str);
|
||||||
|
if (b instanceof RegExp) b = maybeMatch(b, str);
|
||||||
|
|
||||||
|
var r = range(a, b, str);
|
||||||
|
|
||||||
|
return r && {
|
||||||
|
start: r[0],
|
||||||
|
end: r[1],
|
||||||
|
pre: str.slice(0, r[0]),
|
||||||
|
body: str.slice(r[0] + a.length, r[1]),
|
||||||
|
post: str.slice(r[1] + b.length)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function maybeMatch(reg, str) {
|
||||||
|
var m = str.match(reg);
|
||||||
|
return m ? m[0] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
balanced.range = range;
|
||||||
|
function range(a, b, str) {
|
||||||
|
var begs, beg, left, right, result;
|
||||||
|
var ai = str.indexOf(a);
|
||||||
|
var bi = str.indexOf(b, ai + 1);
|
||||||
|
var i = ai;
|
||||||
|
|
||||||
|
if (ai >= 0 && bi > 0) {
|
||||||
|
begs = [];
|
||||||
|
left = str.length;
|
||||||
|
|
||||||
|
while (i >= 0 && !result) {
|
||||||
|
if (i == ai) {
|
||||||
|
begs.push(i);
|
||||||
|
ai = str.indexOf(a, i + 1);
|
||||||
|
} else if (begs.length == 1) {
|
||||||
|
result = [ begs.pop(), bi ];
|
||||||
|
} else {
|
||||||
|
beg = begs.pop();
|
||||||
|
if (beg < left) {
|
||||||
|
left = beg;
|
||||||
|
right = bi;
|
||||||
|
}
|
||||||
|
|
||||||
|
bi = str.indexOf(b, i + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
i = ai < bi && ai >= 0 ? ai : bi;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (begs.length) {
|
||||||
|
result = [ left, right ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
77
node_modules/balanced-match/package.json
generated
vendored
Normal file
77
node_modules/balanced-match/package.json
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
{
|
||||||
|
"_from": "balanced-match@^1.0.0",
|
||||||
|
"_id": "balanced-match@1.0.0",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
|
||||||
|
"_location": "/balanced-match",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "balanced-match@^1.0.0",
|
||||||
|
"name": "balanced-match",
|
||||||
|
"escapedName": "balanced-match",
|
||||||
|
"rawSpec": "^1.0.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^1.0.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/brace-expansion"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||||
|
"_shasum": "89b4d199ab2bee49de164ea02b89ce462d71b767",
|
||||||
|
"_spec": "balanced-match@^1.0.0",
|
||||||
|
"_where": "D:\\dev\\crossmap\\backend-services\\cm-app-pinterestapiclient\\node_modules\\brace-expansion",
|
||||||
|
"author": {
|
||||||
|
"name": "Julian Gruber",
|
||||||
|
"email": "mail@juliangruber.com",
|
||||||
|
"url": "http://juliangruber.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/juliangruber/balanced-match/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Match balanced character pairs, like \"{\" and \"}\"",
|
||||||
|
"devDependencies": {
|
||||||
|
"matcha": "^0.7.0",
|
||||||
|
"tape": "^4.6.0"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/juliangruber/balanced-match",
|
||||||
|
"keywords": [
|
||||||
|
"match",
|
||||||
|
"regexp",
|
||||||
|
"test",
|
||||||
|
"balanced",
|
||||||
|
"parse"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "index.js",
|
||||||
|
"name": "balanced-match",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/juliangruber/balanced-match.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"bench": "make bench",
|
||||||
|
"test": "make test"
|
||||||
|
},
|
||||||
|
"testling": {
|
||||||
|
"files": "test/*.js",
|
||||||
|
"browsers": [
|
||||||
|
"ie/8..latest",
|
||||||
|
"firefox/20..latest",
|
||||||
|
"firefox/nightly",
|
||||||
|
"chrome/25..latest",
|
||||||
|
"chrome/canary",
|
||||||
|
"opera/12..latest",
|
||||||
|
"opera/next",
|
||||||
|
"safari/5.1..latest",
|
||||||
|
"ipad/6.0..latest",
|
||||||
|
"iphone/6.0..latest",
|
||||||
|
"android-browser/4.2..latest"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"version": "1.0.0"
|
||||||
|
}
|
||||||
21
node_modules/bluebird/LICENSE
generated
vendored
Normal file
21
node_modules/bluebird/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2013-2018 Petka Antonov
|
||||||
|
|
||||||
|
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.
|
||||||
57
node_modules/bluebird/README.md
generated
vendored
Normal file
57
node_modules/bluebird/README.md
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<a href="http://promisesaplus.com/">
|
||||||
|
<img src="http://promisesaplus.com/assets/logo-small.png" alt="Promises/A+ logo"
|
||||||
|
title="Promises/A+ 1.1 compliant" align="right" />
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
[](https://travis-ci.org/petkaantonov/bluebird)
|
||||||
|
[](http://petkaantonov.github.io/bluebird/coverage/debug/index.html)
|
||||||
|
|
||||||
|
**Got a question?** Join us on [stackoverflow](http://stackoverflow.com/questions/tagged/bluebird), the [mailing list](https://groups.google.com/forum/#!forum/bluebird-js) or chat on [IRC](https://webchat.freenode.net/?channels=#promises)
|
||||||
|
|
||||||
|
# Introduction
|
||||||
|
|
||||||
|
Bluebird is a fully featured promise library with focus on innovative features and performance
|
||||||
|
|
||||||
|
See the [**bluebird website**](http://bluebirdjs.com/docs/getting-started.html) for further documentation, references and instructions. See the [**API reference**](http://bluebirdjs.com/docs/api-reference.html) here.
|
||||||
|
|
||||||
|
For bluebird 2.x documentation and files, see the [2.x tree](https://github.com/petkaantonov/bluebird/tree/2.x).
|
||||||
|
|
||||||
|
### Note
|
||||||
|
|
||||||
|
Promises in Node.js 10 are significantly faster than before. Bluebird still includes a lot of features like cancellation, iteration methods and warnings that native promises don't. If you are using Bluebird for performance rather than for those - please consider giving native promises a shot and running the benchmarks yourself.
|
||||||
|
|
||||||
|
# Questions and issues
|
||||||
|
|
||||||
|
The [github issue tracker](https://github.com/petkaantonov/bluebird/issues) is **_only_** for bug reports and feature requests. Anything else, such as questions for help in using the library, should be posted in [StackOverflow](http://stackoverflow.com/questions/tagged/bluebird) under tags `promise` and `bluebird`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Thanks
|
||||||
|
|
||||||
|
Thanks to BrowserStack for providing us with a free account which lets us support old browsers like IE8.
|
||||||
|
|
||||||
|
# License
|
||||||
|
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2013-2019 Petka Antonov
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
1
node_modules/bluebird/changelog.md
generated
vendored
Normal file
1
node_modules/bluebird/changelog.md
generated
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[http://bluebirdjs.com/docs/changelog.html](http://bluebirdjs.com/docs/changelog.html)
|
||||||
3941
node_modules/bluebird/js/browser/bluebird.core.js
generated
vendored
Normal file
3941
node_modules/bluebird/js/browser/bluebird.core.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
31
node_modules/bluebird/js/browser/bluebird.core.min.js
generated
vendored
Normal file
31
node_modules/bluebird/js/browser/bluebird.core.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
5805
node_modules/bluebird/js/browser/bluebird.js
generated
vendored
Normal file
5805
node_modules/bluebird/js/browser/bluebird.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
31
node_modules/bluebird/js/browser/bluebird.min.js
generated
vendored
Normal file
31
node_modules/bluebird/js/browser/bluebird.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
21
node_modules/bluebird/js/release/any.js
generated
vendored
Normal file
21
node_modules/bluebird/js/release/any.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
"use strict";
|
||||||
|
module.exports = function(Promise) {
|
||||||
|
var SomePromiseArray = Promise._SomePromiseArray;
|
||||||
|
function any(promises) {
|
||||||
|
var ret = new SomePromiseArray(promises);
|
||||||
|
var promise = ret.promise();
|
||||||
|
ret.setHowMany(1);
|
||||||
|
ret.setUnwrap();
|
||||||
|
ret.init();
|
||||||
|
return promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
Promise.any = function (promises) {
|
||||||
|
return any(promises);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.any = function () {
|
||||||
|
return any(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
55
node_modules/bluebird/js/release/assert.js
generated
vendored
Normal file
55
node_modules/bluebird/js/release/assert.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
"use strict";
|
||||||
|
module.exports = (function(){
|
||||||
|
var AssertionError = (function() {
|
||||||
|
function AssertionError(a) {
|
||||||
|
this.constructor$(a);
|
||||||
|
this.message = a;
|
||||||
|
this.name = "AssertionError";
|
||||||
|
}
|
||||||
|
AssertionError.prototype = new Error();
|
||||||
|
AssertionError.prototype.constructor = AssertionError;
|
||||||
|
AssertionError.prototype.constructor$ = Error;
|
||||||
|
return AssertionError;
|
||||||
|
})();
|
||||||
|
|
||||||
|
function getParams(args) {
|
||||||
|
var params = [];
|
||||||
|
for (var i = 0; i < args.length; ++i) params.push("arg" + i);
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
function nativeAssert(callName, args, expect) {
|
||||||
|
try {
|
||||||
|
var params = getParams(args);
|
||||||
|
var constructorArgs = params;
|
||||||
|
constructorArgs.push("return " +
|
||||||
|
callName + "("+ params.join(",") + ");");
|
||||||
|
var fn = Function.apply(null, constructorArgs);
|
||||||
|
return fn.apply(null, args);
|
||||||
|
} catch (e) {
|
||||||
|
if (!(e instanceof SyntaxError)) {
|
||||||
|
throw e;
|
||||||
|
} else {
|
||||||
|
return expect;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return function assert(boolExpr, message) {
|
||||||
|
if (boolExpr === true) return;
|
||||||
|
|
||||||
|
if (typeof boolExpr === "string" &&
|
||||||
|
boolExpr.charAt(0) === "%") {
|
||||||
|
var nativeCallName = boolExpr;
|
||||||
|
var $_len = arguments.length;var args = new Array(Math.max($_len - 2, 0)); for(var $_i = 2; $_i < $_len; ++$_i) {args[$_i - 2] = arguments[$_i];};
|
||||||
|
if (nativeAssert(nativeCallName, args, message) === message) return;
|
||||||
|
message = (nativeCallName + " !== " + message);
|
||||||
|
}
|
||||||
|
|
||||||
|
var ret = new AssertionError(message);
|
||||||
|
if (Error.captureStackTrace) {
|
||||||
|
Error.captureStackTrace(ret, assert);
|
||||||
|
}
|
||||||
|
throw ret;
|
||||||
|
};
|
||||||
|
})();
|
||||||
120
node_modules/bluebird/js/release/async.js
generated
vendored
Normal file
120
node_modules/bluebird/js/release/async.js
generated
vendored
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
"use strict";
|
||||||
|
var firstLineError;
|
||||||
|
try {throw new Error(); } catch (e) {firstLineError = e;}
|
||||||
|
var schedule = require("./schedule");
|
||||||
|
var Queue = require("./queue");
|
||||||
|
|
||||||
|
function Async() {
|
||||||
|
this._customScheduler = false;
|
||||||
|
this._isTickUsed = false;
|
||||||
|
this._lateQueue = new Queue(16);
|
||||||
|
this._normalQueue = new Queue(16);
|
||||||
|
this._haveDrainedQueues = false;
|
||||||
|
var self = this;
|
||||||
|
this.drainQueues = function () {
|
||||||
|
self._drainQueues();
|
||||||
|
};
|
||||||
|
this._schedule = schedule;
|
||||||
|
}
|
||||||
|
|
||||||
|
Async.prototype.setScheduler = function(fn) {
|
||||||
|
var prev = this._schedule;
|
||||||
|
this._schedule = fn;
|
||||||
|
this._customScheduler = true;
|
||||||
|
return prev;
|
||||||
|
};
|
||||||
|
|
||||||
|
Async.prototype.hasCustomScheduler = function() {
|
||||||
|
return this._customScheduler;
|
||||||
|
};
|
||||||
|
|
||||||
|
Async.prototype.haveItemsQueued = function () {
|
||||||
|
return this._isTickUsed || this._haveDrainedQueues;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Async.prototype.fatalError = function(e, isNode) {
|
||||||
|
if (isNode) {
|
||||||
|
process.stderr.write("Fatal " + (e instanceof Error ? e.stack : e) +
|
||||||
|
"\n");
|
||||||
|
process.exit(2);
|
||||||
|
} else {
|
||||||
|
this.throwLater(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Async.prototype.throwLater = function(fn, arg) {
|
||||||
|
if (arguments.length === 1) {
|
||||||
|
arg = fn;
|
||||||
|
fn = function () { throw arg; };
|
||||||
|
}
|
||||||
|
if (typeof setTimeout !== "undefined") {
|
||||||
|
setTimeout(function() {
|
||||||
|
fn(arg);
|
||||||
|
}, 0);
|
||||||
|
} else try {
|
||||||
|
this._schedule(function() {
|
||||||
|
fn(arg);
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function AsyncInvokeLater(fn, receiver, arg) {
|
||||||
|
this._lateQueue.push(fn, receiver, arg);
|
||||||
|
this._queueTick();
|
||||||
|
}
|
||||||
|
|
||||||
|
function AsyncInvoke(fn, receiver, arg) {
|
||||||
|
this._normalQueue.push(fn, receiver, arg);
|
||||||
|
this._queueTick();
|
||||||
|
}
|
||||||
|
|
||||||
|
function AsyncSettlePromises(promise) {
|
||||||
|
this._normalQueue._pushOne(promise);
|
||||||
|
this._queueTick();
|
||||||
|
}
|
||||||
|
|
||||||
|
Async.prototype.invokeLater = AsyncInvokeLater;
|
||||||
|
Async.prototype.invoke = AsyncInvoke;
|
||||||
|
Async.prototype.settlePromises = AsyncSettlePromises;
|
||||||
|
|
||||||
|
|
||||||
|
function _drainQueue(queue) {
|
||||||
|
while (queue.length() > 0) {
|
||||||
|
_drainQueueStep(queue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _drainQueueStep(queue) {
|
||||||
|
var fn = queue.shift();
|
||||||
|
if (typeof fn !== "function") {
|
||||||
|
fn._settlePromises();
|
||||||
|
} else {
|
||||||
|
var receiver = queue.shift();
|
||||||
|
var arg = queue.shift();
|
||||||
|
fn.call(receiver, arg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Async.prototype._drainQueues = function () {
|
||||||
|
_drainQueue(this._normalQueue);
|
||||||
|
this._reset();
|
||||||
|
this._haveDrainedQueues = true;
|
||||||
|
_drainQueue(this._lateQueue);
|
||||||
|
};
|
||||||
|
|
||||||
|
Async.prototype._queueTick = function () {
|
||||||
|
if (!this._isTickUsed) {
|
||||||
|
this._isTickUsed = true;
|
||||||
|
this._schedule(this.drainQueues);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Async.prototype._reset = function () {
|
||||||
|
this._isTickUsed = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = Async;
|
||||||
|
module.exports.firstLineError = firstLineError;
|
||||||
67
node_modules/bluebird/js/release/bind.js
generated
vendored
Normal file
67
node_modules/bluebird/js/release/bind.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
"use strict";
|
||||||
|
module.exports = function(Promise, INTERNAL, tryConvertToPromise, debug) {
|
||||||
|
var calledBind = false;
|
||||||
|
var rejectThis = function(_, e) {
|
||||||
|
this._reject(e);
|
||||||
|
};
|
||||||
|
|
||||||
|
var targetRejected = function(e, context) {
|
||||||
|
context.promiseRejectionQueued = true;
|
||||||
|
context.bindingPromise._then(rejectThis, rejectThis, null, this, e);
|
||||||
|
};
|
||||||
|
|
||||||
|
var bindingResolved = function(thisArg, context) {
|
||||||
|
if (((this._bitField & 50397184) === 0)) {
|
||||||
|
this._resolveCallback(context.target);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var bindingRejected = function(e, context) {
|
||||||
|
if (!context.promiseRejectionQueued) this._reject(e);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.bind = function (thisArg) {
|
||||||
|
if (!calledBind) {
|
||||||
|
calledBind = true;
|
||||||
|
Promise.prototype._propagateFrom = debug.propagateFromFunction();
|
||||||
|
Promise.prototype._boundValue = debug.boundValueFunction();
|
||||||
|
}
|
||||||
|
var maybePromise = tryConvertToPromise(thisArg);
|
||||||
|
var ret = new Promise(INTERNAL);
|
||||||
|
ret._propagateFrom(this, 1);
|
||||||
|
var target = this._target();
|
||||||
|
ret._setBoundTo(maybePromise);
|
||||||
|
if (maybePromise instanceof Promise) {
|
||||||
|
var context = {
|
||||||
|
promiseRejectionQueued: false,
|
||||||
|
promise: ret,
|
||||||
|
target: target,
|
||||||
|
bindingPromise: maybePromise
|
||||||
|
};
|
||||||
|
target._then(INTERNAL, targetRejected, undefined, ret, context);
|
||||||
|
maybePromise._then(
|
||||||
|
bindingResolved, bindingRejected, undefined, ret, context);
|
||||||
|
ret._setOnCancel(maybePromise);
|
||||||
|
} else {
|
||||||
|
ret._resolveCallback(target);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._setBoundTo = function (obj) {
|
||||||
|
if (obj !== undefined) {
|
||||||
|
this._bitField = this._bitField | 2097152;
|
||||||
|
this._boundTo = obj;
|
||||||
|
} else {
|
||||||
|
this._bitField = this._bitField & (~2097152);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._isBound = function () {
|
||||||
|
return (this._bitField & 2097152) === 2097152;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.bind = function (thisArg, value) {
|
||||||
|
return Promise.resolve(value).bind(thisArg);
|
||||||
|
};
|
||||||
|
};
|
||||||
11
node_modules/bluebird/js/release/bluebird.js
generated
vendored
Normal file
11
node_modules/bluebird/js/release/bluebird.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
"use strict";
|
||||||
|
var old;
|
||||||
|
if (typeof Promise !== "undefined") old = Promise;
|
||||||
|
function noConflict() {
|
||||||
|
try { if (Promise === bluebird) Promise = old; }
|
||||||
|
catch (e) {}
|
||||||
|
return bluebird;
|
||||||
|
}
|
||||||
|
var bluebird = require("./promise")();
|
||||||
|
bluebird.noConflict = noConflict;
|
||||||
|
module.exports = bluebird;
|
||||||
123
node_modules/bluebird/js/release/call_get.js
generated
vendored
Normal file
123
node_modules/bluebird/js/release/call_get.js
generated
vendored
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
"use strict";
|
||||||
|
var cr = Object.create;
|
||||||
|
if (cr) {
|
||||||
|
var callerCache = cr(null);
|
||||||
|
var getterCache = cr(null);
|
||||||
|
callerCache[" size"] = getterCache[" size"] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = function(Promise) {
|
||||||
|
var util = require("./util");
|
||||||
|
var canEvaluate = util.canEvaluate;
|
||||||
|
var isIdentifier = util.isIdentifier;
|
||||||
|
|
||||||
|
var getMethodCaller;
|
||||||
|
var getGetter;
|
||||||
|
if (!false) {
|
||||||
|
var makeMethodCaller = function (methodName) {
|
||||||
|
return new Function("ensureMethod", " \n\
|
||||||
|
return function(obj) { \n\
|
||||||
|
'use strict' \n\
|
||||||
|
var len = this.length; \n\
|
||||||
|
ensureMethod(obj, 'methodName'); \n\
|
||||||
|
switch(len) { \n\
|
||||||
|
case 1: return obj.methodName(this[0]); \n\
|
||||||
|
case 2: return obj.methodName(this[0], this[1]); \n\
|
||||||
|
case 3: return obj.methodName(this[0], this[1], this[2]); \n\
|
||||||
|
case 0: return obj.methodName(); \n\
|
||||||
|
default: \n\
|
||||||
|
return obj.methodName.apply(obj, this); \n\
|
||||||
|
} \n\
|
||||||
|
}; \n\
|
||||||
|
".replace(/methodName/g, methodName))(ensureMethod);
|
||||||
|
};
|
||||||
|
|
||||||
|
var makeGetter = function (propertyName) {
|
||||||
|
return new Function("obj", " \n\
|
||||||
|
'use strict'; \n\
|
||||||
|
return obj.propertyName; \n\
|
||||||
|
".replace("propertyName", propertyName));
|
||||||
|
};
|
||||||
|
|
||||||
|
var getCompiled = function(name, compiler, cache) {
|
||||||
|
var ret = cache[name];
|
||||||
|
if (typeof ret !== "function") {
|
||||||
|
if (!isIdentifier(name)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
ret = compiler(name);
|
||||||
|
cache[name] = ret;
|
||||||
|
cache[" size"]++;
|
||||||
|
if (cache[" size"] > 512) {
|
||||||
|
var keys = Object.keys(cache);
|
||||||
|
for (var i = 0; i < 256; ++i) delete cache[keys[i]];
|
||||||
|
cache[" size"] = keys.length - 256;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
|
getMethodCaller = function(name) {
|
||||||
|
return getCompiled(name, makeMethodCaller, callerCache);
|
||||||
|
};
|
||||||
|
|
||||||
|
getGetter = function(name) {
|
||||||
|
return getCompiled(name, makeGetter, getterCache);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function ensureMethod(obj, methodName) {
|
||||||
|
var fn;
|
||||||
|
if (obj != null) fn = obj[methodName];
|
||||||
|
if (typeof fn !== "function") {
|
||||||
|
var message = "Object " + util.classString(obj) + " has no method '" +
|
||||||
|
util.toString(methodName) + "'";
|
||||||
|
throw new Promise.TypeError(message);
|
||||||
|
}
|
||||||
|
return fn;
|
||||||
|
}
|
||||||
|
|
||||||
|
function caller(obj) {
|
||||||
|
var methodName = this.pop();
|
||||||
|
var fn = ensureMethod(obj, methodName);
|
||||||
|
return fn.apply(obj, this);
|
||||||
|
}
|
||||||
|
Promise.prototype.call = function (methodName) {
|
||||||
|
var $_len = arguments.length;var args = new Array(Math.max($_len - 1, 0)); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];};
|
||||||
|
if (!false) {
|
||||||
|
if (canEvaluate) {
|
||||||
|
var maybeCaller = getMethodCaller(methodName);
|
||||||
|
if (maybeCaller !== null) {
|
||||||
|
return this._then(
|
||||||
|
maybeCaller, undefined, undefined, args, undefined);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args.push(methodName);
|
||||||
|
return this._then(caller, undefined, undefined, args, undefined);
|
||||||
|
};
|
||||||
|
|
||||||
|
function namedGetter(obj) {
|
||||||
|
return obj[this];
|
||||||
|
}
|
||||||
|
function indexedGetter(obj) {
|
||||||
|
var index = +this;
|
||||||
|
if (index < 0) index = Math.max(0, index + obj.length);
|
||||||
|
return obj[index];
|
||||||
|
}
|
||||||
|
Promise.prototype.get = function (propertyName) {
|
||||||
|
var isIndex = (typeof propertyName === "number");
|
||||||
|
var getter;
|
||||||
|
if (!isIndex) {
|
||||||
|
if (canEvaluate) {
|
||||||
|
var maybeGetter = getGetter(propertyName);
|
||||||
|
getter = maybeGetter !== null ? maybeGetter : namedGetter;
|
||||||
|
} else {
|
||||||
|
getter = namedGetter;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
getter = indexedGetter;
|
||||||
|
}
|
||||||
|
return this._then(getter, undefined, undefined, propertyName, undefined);
|
||||||
|
};
|
||||||
|
};
|
||||||
129
node_modules/bluebird/js/release/cancel.js
generated
vendored
Normal file
129
node_modules/bluebird/js/release/cancel.js
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
"use strict";
|
||||||
|
module.exports = function(Promise, PromiseArray, apiRejection, debug) {
|
||||||
|
var util = require("./util");
|
||||||
|
var tryCatch = util.tryCatch;
|
||||||
|
var errorObj = util.errorObj;
|
||||||
|
var async = Promise._async;
|
||||||
|
|
||||||
|
Promise.prototype["break"] = Promise.prototype.cancel = function() {
|
||||||
|
if (!debug.cancellation()) return this._warn("cancellation is disabled");
|
||||||
|
|
||||||
|
var promise = this;
|
||||||
|
var child = promise;
|
||||||
|
while (promise._isCancellable()) {
|
||||||
|
if (!promise._cancelBy(child)) {
|
||||||
|
if (child._isFollowing()) {
|
||||||
|
child._followee().cancel();
|
||||||
|
} else {
|
||||||
|
child._cancelBranched();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
var parent = promise._cancellationParent;
|
||||||
|
if (parent == null || !parent._isCancellable()) {
|
||||||
|
if (promise._isFollowing()) {
|
||||||
|
promise._followee().cancel();
|
||||||
|
} else {
|
||||||
|
promise._cancelBranched();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
if (promise._isFollowing()) promise._followee().cancel();
|
||||||
|
promise._setWillBeCancelled();
|
||||||
|
child = promise;
|
||||||
|
promise = parent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._branchHasCancelled = function() {
|
||||||
|
this._branchesRemainingToCancel--;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._enoughBranchesHaveCancelled = function() {
|
||||||
|
return this._branchesRemainingToCancel === undefined ||
|
||||||
|
this._branchesRemainingToCancel <= 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._cancelBy = function(canceller) {
|
||||||
|
if (canceller === this) {
|
||||||
|
this._branchesRemainingToCancel = 0;
|
||||||
|
this._invokeOnCancel();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
this._branchHasCancelled();
|
||||||
|
if (this._enoughBranchesHaveCancelled()) {
|
||||||
|
this._invokeOnCancel();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._cancelBranched = function() {
|
||||||
|
if (this._enoughBranchesHaveCancelled()) {
|
||||||
|
this._cancel();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._cancel = function() {
|
||||||
|
if (!this._isCancellable()) return;
|
||||||
|
this._setCancelled();
|
||||||
|
async.invoke(this._cancelPromises, this, undefined);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._cancelPromises = function() {
|
||||||
|
if (this._length() > 0) this._settlePromises();
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._unsetOnCancel = function() {
|
||||||
|
this._onCancelField = undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._isCancellable = function() {
|
||||||
|
return this.isPending() && !this._isCancelled();
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.isCancellable = function() {
|
||||||
|
return this.isPending() && !this.isCancelled();
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._doInvokeOnCancel = function(onCancelCallback, internalOnly) {
|
||||||
|
if (util.isArray(onCancelCallback)) {
|
||||||
|
for (var i = 0; i < onCancelCallback.length; ++i) {
|
||||||
|
this._doInvokeOnCancel(onCancelCallback[i], internalOnly);
|
||||||
|
}
|
||||||
|
} else if (onCancelCallback !== undefined) {
|
||||||
|
if (typeof onCancelCallback === "function") {
|
||||||
|
if (!internalOnly) {
|
||||||
|
var e = tryCatch(onCancelCallback).call(this._boundValue());
|
||||||
|
if (e === errorObj) {
|
||||||
|
this._attachExtraTrace(e.e);
|
||||||
|
async.throwLater(e.e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
onCancelCallback._resultCancelled(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._invokeOnCancel = function() {
|
||||||
|
var onCancelCallback = this._onCancel();
|
||||||
|
this._unsetOnCancel();
|
||||||
|
async.invoke(this._doInvokeOnCancel, this, onCancelCallback);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._invokeInternalOnCancel = function() {
|
||||||
|
if (this._isCancellable()) {
|
||||||
|
this._doInvokeOnCancel(this._onCancel(), true);
|
||||||
|
this._unsetOnCancel();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._resultCancelled = function() {
|
||||||
|
this.cancel();
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
42
node_modules/bluebird/js/release/catch_filter.js
generated
vendored
Normal file
42
node_modules/bluebird/js/release/catch_filter.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
"use strict";
|
||||||
|
module.exports = function(NEXT_FILTER) {
|
||||||
|
var util = require("./util");
|
||||||
|
var getKeys = require("./es5").keys;
|
||||||
|
var tryCatch = util.tryCatch;
|
||||||
|
var errorObj = util.errorObj;
|
||||||
|
|
||||||
|
function catchFilter(instances, cb, promise) {
|
||||||
|
return function(e) {
|
||||||
|
var boundTo = promise._boundValue();
|
||||||
|
predicateLoop: for (var i = 0; i < instances.length; ++i) {
|
||||||
|
var item = instances[i];
|
||||||
|
|
||||||
|
if (item === Error ||
|
||||||
|
(item != null && item.prototype instanceof Error)) {
|
||||||
|
if (e instanceof item) {
|
||||||
|
return tryCatch(cb).call(boundTo, e);
|
||||||
|
}
|
||||||
|
} else if (typeof item === "function") {
|
||||||
|
var matchesPredicate = tryCatch(item).call(boundTo, e);
|
||||||
|
if (matchesPredicate === errorObj) {
|
||||||
|
return matchesPredicate;
|
||||||
|
} else if (matchesPredicate) {
|
||||||
|
return tryCatch(cb).call(boundTo, e);
|
||||||
|
}
|
||||||
|
} else if (util.isObject(e)) {
|
||||||
|
var keys = getKeys(item);
|
||||||
|
for (var j = 0; j < keys.length; ++j) {
|
||||||
|
var key = keys[j];
|
||||||
|
if (item[key] != e[key]) {
|
||||||
|
continue predicateLoop;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tryCatch(cb).call(boundTo, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NEXT_FILTER;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return catchFilter;
|
||||||
|
};
|
||||||
69
node_modules/bluebird/js/release/context.js
generated
vendored
Normal file
69
node_modules/bluebird/js/release/context.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
"use strict";
|
||||||
|
module.exports = function(Promise) {
|
||||||
|
var longStackTraces = false;
|
||||||
|
var contextStack = [];
|
||||||
|
|
||||||
|
Promise.prototype._promiseCreated = function() {};
|
||||||
|
Promise.prototype._pushContext = function() {};
|
||||||
|
Promise.prototype._popContext = function() {return null;};
|
||||||
|
Promise._peekContext = Promise.prototype._peekContext = function() {};
|
||||||
|
|
||||||
|
function Context() {
|
||||||
|
this._trace = new Context.CapturedTrace(peekContext());
|
||||||
|
}
|
||||||
|
Context.prototype._pushContext = function () {
|
||||||
|
if (this._trace !== undefined) {
|
||||||
|
this._trace._promiseCreated = null;
|
||||||
|
contextStack.push(this._trace);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Context.prototype._popContext = function () {
|
||||||
|
if (this._trace !== undefined) {
|
||||||
|
var trace = contextStack.pop();
|
||||||
|
var ret = trace._promiseCreated;
|
||||||
|
trace._promiseCreated = null;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
function createContext() {
|
||||||
|
if (longStackTraces) return new Context();
|
||||||
|
}
|
||||||
|
|
||||||
|
function peekContext() {
|
||||||
|
var lastIndex = contextStack.length - 1;
|
||||||
|
if (lastIndex >= 0) {
|
||||||
|
return contextStack[lastIndex];
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
Context.CapturedTrace = null;
|
||||||
|
Context.create = createContext;
|
||||||
|
Context.deactivateLongStackTraces = function() {};
|
||||||
|
Context.activateLongStackTraces = function() {
|
||||||
|
var Promise_pushContext = Promise.prototype._pushContext;
|
||||||
|
var Promise_popContext = Promise.prototype._popContext;
|
||||||
|
var Promise_PeekContext = Promise._peekContext;
|
||||||
|
var Promise_peekContext = Promise.prototype._peekContext;
|
||||||
|
var Promise_promiseCreated = Promise.prototype._promiseCreated;
|
||||||
|
Context.deactivateLongStackTraces = function() {
|
||||||
|
Promise.prototype._pushContext = Promise_pushContext;
|
||||||
|
Promise.prototype._popContext = Promise_popContext;
|
||||||
|
Promise._peekContext = Promise_PeekContext;
|
||||||
|
Promise.prototype._peekContext = Promise_peekContext;
|
||||||
|
Promise.prototype._promiseCreated = Promise_promiseCreated;
|
||||||
|
longStackTraces = false;
|
||||||
|
};
|
||||||
|
longStackTraces = true;
|
||||||
|
Promise.prototype._pushContext = Context.prototype._pushContext;
|
||||||
|
Promise.prototype._popContext = Context.prototype._popContext;
|
||||||
|
Promise._peekContext = Promise.prototype._peekContext = peekContext;
|
||||||
|
Promise.prototype._promiseCreated = function() {
|
||||||
|
var ctx = this._peekContext();
|
||||||
|
if (ctx && ctx._promiseCreated == null) ctx._promiseCreated = this;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
return Context;
|
||||||
|
};
|
||||||
1036
node_modules/bluebird/js/release/debuggability.js
generated
vendored
Normal file
1036
node_modules/bluebird/js/release/debuggability.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
46
node_modules/bluebird/js/release/direct_resolve.js
generated
vendored
Normal file
46
node_modules/bluebird/js/release/direct_resolve.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
"use strict";
|
||||||
|
module.exports = function(Promise) {
|
||||||
|
function returner() {
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
function thrower() {
|
||||||
|
throw this.reason;
|
||||||
|
}
|
||||||
|
|
||||||
|
Promise.prototype["return"] =
|
||||||
|
Promise.prototype.thenReturn = function (value) {
|
||||||
|
if (value instanceof Promise) value.suppressUnhandledRejections();
|
||||||
|
return this._then(
|
||||||
|
returner, undefined, undefined, {value: value}, undefined);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype["throw"] =
|
||||||
|
Promise.prototype.thenThrow = function (reason) {
|
||||||
|
return this._then(
|
||||||
|
thrower, undefined, undefined, {reason: reason}, undefined);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.catchThrow = function (reason) {
|
||||||
|
if (arguments.length <= 1) {
|
||||||
|
return this._then(
|
||||||
|
undefined, thrower, undefined, {reason: reason}, undefined);
|
||||||
|
} else {
|
||||||
|
var _reason = arguments[1];
|
||||||
|
var handler = function() {throw _reason;};
|
||||||
|
return this.caught(reason, handler);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.catchReturn = function (value) {
|
||||||
|
if (arguments.length <= 1) {
|
||||||
|
if (value instanceof Promise) value.suppressUnhandledRejections();
|
||||||
|
return this._then(
|
||||||
|
undefined, returner, undefined, {value: value}, undefined);
|
||||||
|
} else {
|
||||||
|
var _value = arguments[1];
|
||||||
|
if (_value instanceof Promise) _value.suppressUnhandledRejections();
|
||||||
|
var handler = function() {return _value;};
|
||||||
|
return this.caught(value, handler);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
30
node_modules/bluebird/js/release/each.js
generated
vendored
Normal file
30
node_modules/bluebird/js/release/each.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
"use strict";
|
||||||
|
module.exports = function(Promise, INTERNAL) {
|
||||||
|
var PromiseReduce = Promise.reduce;
|
||||||
|
var PromiseAll = Promise.all;
|
||||||
|
|
||||||
|
function promiseAllThis() {
|
||||||
|
return PromiseAll(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
function PromiseMapSeries(promises, fn) {
|
||||||
|
return PromiseReduce(promises, fn, INTERNAL, INTERNAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
Promise.prototype.each = function (fn) {
|
||||||
|
return PromiseReduce(this, fn, INTERNAL, 0)
|
||||||
|
._then(promiseAllThis, undefined, undefined, this, undefined);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.mapSeries = function (fn) {
|
||||||
|
return PromiseReduce(this, fn, INTERNAL, INTERNAL);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.each = function (promises, fn) {
|
||||||
|
return PromiseReduce(promises, fn, INTERNAL, 0)
|
||||||
|
._then(promiseAllThis, undefined, undefined, promises, undefined);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.mapSeries = PromiseMapSeries;
|
||||||
|
};
|
||||||
|
|
||||||
116
node_modules/bluebird/js/release/errors.js
generated
vendored
Normal file
116
node_modules/bluebird/js/release/errors.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
"use strict";
|
||||||
|
var es5 = require("./es5");
|
||||||
|
var Objectfreeze = es5.freeze;
|
||||||
|
var util = require("./util");
|
||||||
|
var inherits = util.inherits;
|
||||||
|
var notEnumerableProp = util.notEnumerableProp;
|
||||||
|
|
||||||
|
function subError(nameProperty, defaultMessage) {
|
||||||
|
function SubError(message) {
|
||||||
|
if (!(this instanceof SubError)) return new SubError(message);
|
||||||
|
notEnumerableProp(this, "message",
|
||||||
|
typeof message === "string" ? message : defaultMessage);
|
||||||
|
notEnumerableProp(this, "name", nameProperty);
|
||||||
|
if (Error.captureStackTrace) {
|
||||||
|
Error.captureStackTrace(this, this.constructor);
|
||||||
|
} else {
|
||||||
|
Error.call(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inherits(SubError, Error);
|
||||||
|
return SubError;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _TypeError, _RangeError;
|
||||||
|
var Warning = subError("Warning", "warning");
|
||||||
|
var CancellationError = subError("CancellationError", "cancellation error");
|
||||||
|
var TimeoutError = subError("TimeoutError", "timeout error");
|
||||||
|
var AggregateError = subError("AggregateError", "aggregate error");
|
||||||
|
try {
|
||||||
|
_TypeError = TypeError;
|
||||||
|
_RangeError = RangeError;
|
||||||
|
} catch(e) {
|
||||||
|
_TypeError = subError("TypeError", "type error");
|
||||||
|
_RangeError = subError("RangeError", "range error");
|
||||||
|
}
|
||||||
|
|
||||||
|
var methods = ("join pop push shift unshift slice filter forEach some " +
|
||||||
|
"every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" ");
|
||||||
|
|
||||||
|
for (var i = 0; i < methods.length; ++i) {
|
||||||
|
if (typeof Array.prototype[methods[i]] === "function") {
|
||||||
|
AggregateError.prototype[methods[i]] = Array.prototype[methods[i]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
es5.defineProperty(AggregateError.prototype, "length", {
|
||||||
|
value: 0,
|
||||||
|
configurable: false,
|
||||||
|
writable: true,
|
||||||
|
enumerable: true
|
||||||
|
});
|
||||||
|
AggregateError.prototype["isOperational"] = true;
|
||||||
|
var level = 0;
|
||||||
|
AggregateError.prototype.toString = function() {
|
||||||
|
var indent = Array(level * 4 + 1).join(" ");
|
||||||
|
var ret = "\n" + indent + "AggregateError of:" + "\n";
|
||||||
|
level++;
|
||||||
|
indent = Array(level * 4 + 1).join(" ");
|
||||||
|
for (var i = 0; i < this.length; ++i) {
|
||||||
|
var str = this[i] === this ? "[Circular AggregateError]" : this[i] + "";
|
||||||
|
var lines = str.split("\n");
|
||||||
|
for (var j = 0; j < lines.length; ++j) {
|
||||||
|
lines[j] = indent + lines[j];
|
||||||
|
}
|
||||||
|
str = lines.join("\n");
|
||||||
|
ret += str + "\n";
|
||||||
|
}
|
||||||
|
level--;
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
|
function OperationalError(message) {
|
||||||
|
if (!(this instanceof OperationalError))
|
||||||
|
return new OperationalError(message);
|
||||||
|
notEnumerableProp(this, "name", "OperationalError");
|
||||||
|
notEnumerableProp(this, "message", message);
|
||||||
|
this.cause = message;
|
||||||
|
this["isOperational"] = true;
|
||||||
|
|
||||||
|
if (message instanceof Error) {
|
||||||
|
notEnumerableProp(this, "message", message.message);
|
||||||
|
notEnumerableProp(this, "stack", message.stack);
|
||||||
|
} else if (Error.captureStackTrace) {
|
||||||
|
Error.captureStackTrace(this, this.constructor);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
inherits(OperationalError, Error);
|
||||||
|
|
||||||
|
var errorTypes = Error["__BluebirdErrorTypes__"];
|
||||||
|
if (!errorTypes) {
|
||||||
|
errorTypes = Objectfreeze({
|
||||||
|
CancellationError: CancellationError,
|
||||||
|
TimeoutError: TimeoutError,
|
||||||
|
OperationalError: OperationalError,
|
||||||
|
RejectionError: OperationalError,
|
||||||
|
AggregateError: AggregateError
|
||||||
|
});
|
||||||
|
es5.defineProperty(Error, "__BluebirdErrorTypes__", {
|
||||||
|
value: errorTypes,
|
||||||
|
writable: false,
|
||||||
|
enumerable: false,
|
||||||
|
configurable: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
Error: Error,
|
||||||
|
TypeError: _TypeError,
|
||||||
|
RangeError: _RangeError,
|
||||||
|
CancellationError: errorTypes.CancellationError,
|
||||||
|
OperationalError: errorTypes.OperationalError,
|
||||||
|
TimeoutError: errorTypes.TimeoutError,
|
||||||
|
AggregateError: errorTypes.AggregateError,
|
||||||
|
Warning: Warning
|
||||||
|
};
|
||||||
80
node_modules/bluebird/js/release/es5.js
generated
vendored
Normal file
80
node_modules/bluebird/js/release/es5.js
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
var isES5 = (function(){
|
||||||
|
"use strict";
|
||||||
|
return this === undefined;
|
||||||
|
})();
|
||||||
|
|
||||||
|
if (isES5) {
|
||||||
|
module.exports = {
|
||||||
|
freeze: Object.freeze,
|
||||||
|
defineProperty: Object.defineProperty,
|
||||||
|
getDescriptor: Object.getOwnPropertyDescriptor,
|
||||||
|
keys: Object.keys,
|
||||||
|
names: Object.getOwnPropertyNames,
|
||||||
|
getPrototypeOf: Object.getPrototypeOf,
|
||||||
|
isArray: Array.isArray,
|
||||||
|
isES5: isES5,
|
||||||
|
propertyIsWritable: function(obj, prop) {
|
||||||
|
var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
|
||||||
|
return !!(!descriptor || descriptor.writable || descriptor.set);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
var has = {}.hasOwnProperty;
|
||||||
|
var str = {}.toString;
|
||||||
|
var proto = {}.constructor.prototype;
|
||||||
|
|
||||||
|
var ObjectKeys = function (o) {
|
||||||
|
var ret = [];
|
||||||
|
for (var key in o) {
|
||||||
|
if (has.call(o, key)) {
|
||||||
|
ret.push(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
|
var ObjectGetDescriptor = function(o, key) {
|
||||||
|
return {value: o[key]};
|
||||||
|
};
|
||||||
|
|
||||||
|
var ObjectDefineProperty = function (o, key, desc) {
|
||||||
|
o[key] = desc.value;
|
||||||
|
return o;
|
||||||
|
};
|
||||||
|
|
||||||
|
var ObjectFreeze = function (obj) {
|
||||||
|
return obj;
|
||||||
|
};
|
||||||
|
|
||||||
|
var ObjectGetPrototypeOf = function (obj) {
|
||||||
|
try {
|
||||||
|
return Object(obj).constructor.prototype;
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
return proto;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var ArrayIsArray = function (obj) {
|
||||||
|
try {
|
||||||
|
return str.call(obj) === "[object Array]";
|
||||||
|
}
|
||||||
|
catch(e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
isArray: ArrayIsArray,
|
||||||
|
keys: ObjectKeys,
|
||||||
|
names: ObjectKeys,
|
||||||
|
defineProperty: ObjectDefineProperty,
|
||||||
|
getDescriptor: ObjectGetDescriptor,
|
||||||
|
freeze: ObjectFreeze,
|
||||||
|
getPrototypeOf: ObjectGetPrototypeOf,
|
||||||
|
isES5: isES5,
|
||||||
|
propertyIsWritable: function() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
12
node_modules/bluebird/js/release/filter.js
generated
vendored
Normal file
12
node_modules/bluebird/js/release/filter.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
"use strict";
|
||||||
|
module.exports = function(Promise, INTERNAL) {
|
||||||
|
var PromiseMap = Promise.map;
|
||||||
|
|
||||||
|
Promise.prototype.filter = function (fn, options) {
|
||||||
|
return PromiseMap(this, fn, options, INTERNAL);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.filter = function (promises, fn, options) {
|
||||||
|
return PromiseMap(promises, fn, options, INTERNAL);
|
||||||
|
};
|
||||||
|
};
|
||||||
146
node_modules/bluebird/js/release/finally.js
generated
vendored
Normal file
146
node_modules/bluebird/js/release/finally.js
generated
vendored
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
"use strict";
|
||||||
|
module.exports = function(Promise, tryConvertToPromise, NEXT_FILTER) {
|
||||||
|
var util = require("./util");
|
||||||
|
var CancellationError = Promise.CancellationError;
|
||||||
|
var errorObj = util.errorObj;
|
||||||
|
var catchFilter = require("./catch_filter")(NEXT_FILTER);
|
||||||
|
|
||||||
|
function PassThroughHandlerContext(promise, type, handler) {
|
||||||
|
this.promise = promise;
|
||||||
|
this.type = type;
|
||||||
|
this.handler = handler;
|
||||||
|
this.called = false;
|
||||||
|
this.cancelPromise = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
PassThroughHandlerContext.prototype.isFinallyHandler = function() {
|
||||||
|
return this.type === 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
function FinallyHandlerCancelReaction(finallyHandler) {
|
||||||
|
this.finallyHandler = finallyHandler;
|
||||||
|
}
|
||||||
|
|
||||||
|
FinallyHandlerCancelReaction.prototype._resultCancelled = function() {
|
||||||
|
checkCancel(this.finallyHandler);
|
||||||
|
};
|
||||||
|
|
||||||
|
function checkCancel(ctx, reason) {
|
||||||
|
if (ctx.cancelPromise != null) {
|
||||||
|
if (arguments.length > 1) {
|
||||||
|
ctx.cancelPromise._reject(reason);
|
||||||
|
} else {
|
||||||
|
ctx.cancelPromise._cancel();
|
||||||
|
}
|
||||||
|
ctx.cancelPromise = null;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function succeed() {
|
||||||
|
return finallyHandler.call(this, this.promise._target()._settledValue());
|
||||||
|
}
|
||||||
|
function fail(reason) {
|
||||||
|
if (checkCancel(this, reason)) return;
|
||||||
|
errorObj.e = reason;
|
||||||
|
return errorObj;
|
||||||
|
}
|
||||||
|
function finallyHandler(reasonOrValue) {
|
||||||
|
var promise = this.promise;
|
||||||
|
var handler = this.handler;
|
||||||
|
|
||||||
|
if (!this.called) {
|
||||||
|
this.called = true;
|
||||||
|
var ret = this.isFinallyHandler()
|
||||||
|
? handler.call(promise._boundValue())
|
||||||
|
: handler.call(promise._boundValue(), reasonOrValue);
|
||||||
|
if (ret === NEXT_FILTER) {
|
||||||
|
return ret;
|
||||||
|
} else if (ret !== undefined) {
|
||||||
|
promise._setReturnedNonUndefined();
|
||||||
|
var maybePromise = tryConvertToPromise(ret, promise);
|
||||||
|
if (maybePromise instanceof Promise) {
|
||||||
|
if (this.cancelPromise != null) {
|
||||||
|
if (maybePromise._isCancelled()) {
|
||||||
|
var reason =
|
||||||
|
new CancellationError("late cancellation observer");
|
||||||
|
promise._attachExtraTrace(reason);
|
||||||
|
errorObj.e = reason;
|
||||||
|
return errorObj;
|
||||||
|
} else if (maybePromise.isPending()) {
|
||||||
|
maybePromise._attachCancellationCallback(
|
||||||
|
new FinallyHandlerCancelReaction(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return maybePromise._then(
|
||||||
|
succeed, fail, undefined, this, undefined);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (promise.isRejected()) {
|
||||||
|
checkCancel(this);
|
||||||
|
errorObj.e = reasonOrValue;
|
||||||
|
return errorObj;
|
||||||
|
} else {
|
||||||
|
checkCancel(this);
|
||||||
|
return reasonOrValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Promise.prototype._passThrough = function(handler, type, success, fail) {
|
||||||
|
if (typeof handler !== "function") return this.then();
|
||||||
|
return this._then(success,
|
||||||
|
fail,
|
||||||
|
undefined,
|
||||||
|
new PassThroughHandlerContext(this, type, handler),
|
||||||
|
undefined);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.lastly =
|
||||||
|
Promise.prototype["finally"] = function (handler) {
|
||||||
|
return this._passThrough(handler,
|
||||||
|
0,
|
||||||
|
finallyHandler,
|
||||||
|
finallyHandler);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Promise.prototype.tap = function (handler) {
|
||||||
|
return this._passThrough(handler, 1, finallyHandler);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.tapCatch = function (handlerOrPredicate) {
|
||||||
|
var len = arguments.length;
|
||||||
|
if(len === 1) {
|
||||||
|
return this._passThrough(handlerOrPredicate,
|
||||||
|
1,
|
||||||
|
undefined,
|
||||||
|
finallyHandler);
|
||||||
|
} else {
|
||||||
|
var catchInstances = new Array(len - 1),
|
||||||
|
j = 0, i;
|
||||||
|
for (i = 0; i < len - 1; ++i) {
|
||||||
|
var item = arguments[i];
|
||||||
|
if (util.isObject(item)) {
|
||||||
|
catchInstances[j++] = item;
|
||||||
|
} else {
|
||||||
|
return Promise.reject(new TypeError(
|
||||||
|
"tapCatch statement predicate: "
|
||||||
|
+ "expecting an object but got " + util.classString(item)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catchInstances.length = j;
|
||||||
|
var handler = arguments[i];
|
||||||
|
return this._passThrough(catchFilter(catchInstances, handler, this),
|
||||||
|
1,
|
||||||
|
undefined,
|
||||||
|
finallyHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
return PassThroughHandlerContext;
|
||||||
|
};
|
||||||
223
node_modules/bluebird/js/release/generators.js
generated
vendored
Normal file
223
node_modules/bluebird/js/release/generators.js
generated
vendored
Normal file
@@ -0,0 +1,223 @@
|
|||||||
|
"use strict";
|
||||||
|
module.exports = function(Promise,
|
||||||
|
apiRejection,
|
||||||
|
INTERNAL,
|
||||||
|
tryConvertToPromise,
|
||||||
|
Proxyable,
|
||||||
|
debug) {
|
||||||
|
var errors = require("./errors");
|
||||||
|
var TypeError = errors.TypeError;
|
||||||
|
var util = require("./util");
|
||||||
|
var errorObj = util.errorObj;
|
||||||
|
var tryCatch = util.tryCatch;
|
||||||
|
var yieldHandlers = [];
|
||||||
|
|
||||||
|
function promiseFromYieldHandler(value, yieldHandlers, traceParent) {
|
||||||
|
for (var i = 0; i < yieldHandlers.length; ++i) {
|
||||||
|
traceParent._pushContext();
|
||||||
|
var result = tryCatch(yieldHandlers[i])(value);
|
||||||
|
traceParent._popContext();
|
||||||
|
if (result === errorObj) {
|
||||||
|
traceParent._pushContext();
|
||||||
|
var ret = Promise.reject(errorObj.e);
|
||||||
|
traceParent._popContext();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
var maybePromise = tryConvertToPromise(result, traceParent);
|
||||||
|
if (maybePromise instanceof Promise) return maybePromise;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) {
|
||||||
|
if (debug.cancellation()) {
|
||||||
|
var internal = new Promise(INTERNAL);
|
||||||
|
var _finallyPromise = this._finallyPromise = new Promise(INTERNAL);
|
||||||
|
this._promise = internal.lastly(function() {
|
||||||
|
return _finallyPromise;
|
||||||
|
});
|
||||||
|
internal._captureStackTrace();
|
||||||
|
internal._setOnCancel(this);
|
||||||
|
} else {
|
||||||
|
var promise = this._promise = new Promise(INTERNAL);
|
||||||
|
promise._captureStackTrace();
|
||||||
|
}
|
||||||
|
this._stack = stack;
|
||||||
|
this._generatorFunction = generatorFunction;
|
||||||
|
this._receiver = receiver;
|
||||||
|
this._generator = undefined;
|
||||||
|
this._yieldHandlers = typeof yieldHandler === "function"
|
||||||
|
? [yieldHandler].concat(yieldHandlers)
|
||||||
|
: yieldHandlers;
|
||||||
|
this._yieldedPromise = null;
|
||||||
|
this._cancellationPhase = false;
|
||||||
|
}
|
||||||
|
util.inherits(PromiseSpawn, Proxyable);
|
||||||
|
|
||||||
|
PromiseSpawn.prototype._isResolved = function() {
|
||||||
|
return this._promise === null;
|
||||||
|
};
|
||||||
|
|
||||||
|
PromiseSpawn.prototype._cleanup = function() {
|
||||||
|
this._promise = this._generator = null;
|
||||||
|
if (debug.cancellation() && this._finallyPromise !== null) {
|
||||||
|
this._finallyPromise._fulfill();
|
||||||
|
this._finallyPromise = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
PromiseSpawn.prototype._promiseCancelled = function() {
|
||||||
|
if (this._isResolved()) return;
|
||||||
|
var implementsReturn = typeof this._generator["return"] !== "undefined";
|
||||||
|
|
||||||
|
var result;
|
||||||
|
if (!implementsReturn) {
|
||||||
|
var reason = new Promise.CancellationError(
|
||||||
|
"generator .return() sentinel");
|
||||||
|
Promise.coroutine.returnSentinel = reason;
|
||||||
|
this._promise._attachExtraTrace(reason);
|
||||||
|
this._promise._pushContext();
|
||||||
|
result = tryCatch(this._generator["throw"]).call(this._generator,
|
||||||
|
reason);
|
||||||
|
this._promise._popContext();
|
||||||
|
} else {
|
||||||
|
this._promise._pushContext();
|
||||||
|
result = tryCatch(this._generator["return"]).call(this._generator,
|
||||||
|
undefined);
|
||||||
|
this._promise._popContext();
|
||||||
|
}
|
||||||
|
this._cancellationPhase = true;
|
||||||
|
this._yieldedPromise = null;
|
||||||
|
this._continue(result);
|
||||||
|
};
|
||||||
|
|
||||||
|
PromiseSpawn.prototype._promiseFulfilled = function(value) {
|
||||||
|
this._yieldedPromise = null;
|
||||||
|
this._promise._pushContext();
|
||||||
|
var result = tryCatch(this._generator.next).call(this._generator, value);
|
||||||
|
this._promise._popContext();
|
||||||
|
this._continue(result);
|
||||||
|
};
|
||||||
|
|
||||||
|
PromiseSpawn.prototype._promiseRejected = function(reason) {
|
||||||
|
this._yieldedPromise = null;
|
||||||
|
this._promise._attachExtraTrace(reason);
|
||||||
|
this._promise._pushContext();
|
||||||
|
var result = tryCatch(this._generator["throw"])
|
||||||
|
.call(this._generator, reason);
|
||||||
|
this._promise._popContext();
|
||||||
|
this._continue(result);
|
||||||
|
};
|
||||||
|
|
||||||
|
PromiseSpawn.prototype._resultCancelled = function() {
|
||||||
|
if (this._yieldedPromise instanceof Promise) {
|
||||||
|
var promise = this._yieldedPromise;
|
||||||
|
this._yieldedPromise = null;
|
||||||
|
promise.cancel();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
PromiseSpawn.prototype.promise = function () {
|
||||||
|
return this._promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
PromiseSpawn.prototype._run = function () {
|
||||||
|
this._generator = this._generatorFunction.call(this._receiver);
|
||||||
|
this._receiver =
|
||||||
|
this._generatorFunction = undefined;
|
||||||
|
this._promiseFulfilled(undefined);
|
||||||
|
};
|
||||||
|
|
||||||
|
PromiseSpawn.prototype._continue = function (result) {
|
||||||
|
var promise = this._promise;
|
||||||
|
if (result === errorObj) {
|
||||||
|
this._cleanup();
|
||||||
|
if (this._cancellationPhase) {
|
||||||
|
return promise.cancel();
|
||||||
|
} else {
|
||||||
|
return promise._rejectCallback(result.e, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var value = result.value;
|
||||||
|
if (result.done === true) {
|
||||||
|
this._cleanup();
|
||||||
|
if (this._cancellationPhase) {
|
||||||
|
return promise.cancel();
|
||||||
|
} else {
|
||||||
|
return promise._resolveCallback(value);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var maybePromise = tryConvertToPromise(value, this._promise);
|
||||||
|
if (!(maybePromise instanceof Promise)) {
|
||||||
|
maybePromise =
|
||||||
|
promiseFromYieldHandler(maybePromise,
|
||||||
|
this._yieldHandlers,
|
||||||
|
this._promise);
|
||||||
|
if (maybePromise === null) {
|
||||||
|
this._promiseRejected(
|
||||||
|
new TypeError(
|
||||||
|
"A value %s was yielded that could not be treated as a promise\u000a\u000a See http://goo.gl/MqrFmX\u000a\u000a".replace("%s", String(value)) +
|
||||||
|
"From coroutine:\u000a" +
|
||||||
|
this._stack.split("\n").slice(1, -7).join("\n")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
maybePromise = maybePromise._target();
|
||||||
|
var bitField = maybePromise._bitField;
|
||||||
|
;
|
||||||
|
if (((bitField & 50397184) === 0)) {
|
||||||
|
this._yieldedPromise = maybePromise;
|
||||||
|
maybePromise._proxy(this, null);
|
||||||
|
} else if (((bitField & 33554432) !== 0)) {
|
||||||
|
Promise._async.invoke(
|
||||||
|
this._promiseFulfilled, this, maybePromise._value()
|
||||||
|
);
|
||||||
|
} else if (((bitField & 16777216) !== 0)) {
|
||||||
|
Promise._async.invoke(
|
||||||
|
this._promiseRejected, this, maybePromise._reason()
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this._promiseCancelled();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.coroutine = function (generatorFunction, options) {
|
||||||
|
if (typeof generatorFunction !== "function") {
|
||||||
|
throw new TypeError("generatorFunction must be a function\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
||||||
|
}
|
||||||
|
var yieldHandler = Object(options).yieldHandler;
|
||||||
|
var PromiseSpawn$ = PromiseSpawn;
|
||||||
|
var stack = new Error().stack;
|
||||||
|
return function () {
|
||||||
|
var generator = generatorFunction.apply(this, arguments);
|
||||||
|
var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler,
|
||||||
|
stack);
|
||||||
|
var ret = spawn.promise();
|
||||||
|
spawn._generator = generator;
|
||||||
|
spawn._promiseFulfilled(undefined);
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.coroutine.addYieldHandler = function(fn) {
|
||||||
|
if (typeof fn !== "function") {
|
||||||
|
throw new TypeError("expecting a function but got " + util.classString(fn));
|
||||||
|
}
|
||||||
|
yieldHandlers.push(fn);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.spawn = function (generatorFunction) {
|
||||||
|
debug.deprecated("Promise.spawn()", "Promise.coroutine()");
|
||||||
|
if (typeof generatorFunction !== "function") {
|
||||||
|
return apiRejection("generatorFunction must be a function\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
||||||
|
}
|
||||||
|
var spawn = new PromiseSpawn(generatorFunction, this);
|
||||||
|
var ret = spawn.promise();
|
||||||
|
spawn._run(Promise.spawn);
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
};
|
||||||
165
node_modules/bluebird/js/release/join.js
generated
vendored
Normal file
165
node_modules/bluebird/js/release/join.js
generated
vendored
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
"use strict";
|
||||||
|
module.exports =
|
||||||
|
function(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async) {
|
||||||
|
var util = require("./util");
|
||||||
|
var canEvaluate = util.canEvaluate;
|
||||||
|
var tryCatch = util.tryCatch;
|
||||||
|
var errorObj = util.errorObj;
|
||||||
|
var reject;
|
||||||
|
|
||||||
|
if (!false) {
|
||||||
|
if (canEvaluate) {
|
||||||
|
var thenCallback = function(i) {
|
||||||
|
return new Function("value", "holder", " \n\
|
||||||
|
'use strict'; \n\
|
||||||
|
holder.pIndex = value; \n\
|
||||||
|
holder.checkFulfillment(this); \n\
|
||||||
|
".replace(/Index/g, i));
|
||||||
|
};
|
||||||
|
|
||||||
|
var promiseSetter = function(i) {
|
||||||
|
return new Function("promise", "holder", " \n\
|
||||||
|
'use strict'; \n\
|
||||||
|
holder.pIndex = promise; \n\
|
||||||
|
".replace(/Index/g, i));
|
||||||
|
};
|
||||||
|
|
||||||
|
var generateHolderClass = function(total) {
|
||||||
|
var props = new Array(total);
|
||||||
|
for (var i = 0; i < props.length; ++i) {
|
||||||
|
props[i] = "this.p" + (i+1);
|
||||||
|
}
|
||||||
|
var assignment = props.join(" = ") + " = null;";
|
||||||
|
var cancellationCode= "var promise;\n" + props.map(function(prop) {
|
||||||
|
return " \n\
|
||||||
|
promise = " + prop + "; \n\
|
||||||
|
if (promise instanceof Promise) { \n\
|
||||||
|
promise.cancel(); \n\
|
||||||
|
} \n\
|
||||||
|
";
|
||||||
|
}).join("\n");
|
||||||
|
var passedArguments = props.join(", ");
|
||||||
|
var name = "Holder$" + total;
|
||||||
|
|
||||||
|
|
||||||
|
var code = "return function(tryCatch, errorObj, Promise, async) { \n\
|
||||||
|
'use strict'; \n\
|
||||||
|
function [TheName](fn) { \n\
|
||||||
|
[TheProperties] \n\
|
||||||
|
this.fn = fn; \n\
|
||||||
|
this.asyncNeeded = true; \n\
|
||||||
|
this.now = 0; \n\
|
||||||
|
} \n\
|
||||||
|
\n\
|
||||||
|
[TheName].prototype._callFunction = function(promise) { \n\
|
||||||
|
promise._pushContext(); \n\
|
||||||
|
var ret = tryCatch(this.fn)([ThePassedArguments]); \n\
|
||||||
|
promise._popContext(); \n\
|
||||||
|
if (ret === errorObj) { \n\
|
||||||
|
promise._rejectCallback(ret.e, false); \n\
|
||||||
|
} else { \n\
|
||||||
|
promise._resolveCallback(ret); \n\
|
||||||
|
} \n\
|
||||||
|
}; \n\
|
||||||
|
\n\
|
||||||
|
[TheName].prototype.checkFulfillment = function(promise) { \n\
|
||||||
|
var now = ++this.now; \n\
|
||||||
|
if (now === [TheTotal]) { \n\
|
||||||
|
if (this.asyncNeeded) { \n\
|
||||||
|
async.invoke(this._callFunction, this, promise); \n\
|
||||||
|
} else { \n\
|
||||||
|
this._callFunction(promise); \n\
|
||||||
|
} \n\
|
||||||
|
\n\
|
||||||
|
} \n\
|
||||||
|
}; \n\
|
||||||
|
\n\
|
||||||
|
[TheName].prototype._resultCancelled = function() { \n\
|
||||||
|
[CancellationCode] \n\
|
||||||
|
}; \n\
|
||||||
|
\n\
|
||||||
|
return [TheName]; \n\
|
||||||
|
}(tryCatch, errorObj, Promise, async); \n\
|
||||||
|
";
|
||||||
|
|
||||||
|
code = code.replace(/\[TheName\]/g, name)
|
||||||
|
.replace(/\[TheTotal\]/g, total)
|
||||||
|
.replace(/\[ThePassedArguments\]/g, passedArguments)
|
||||||
|
.replace(/\[TheProperties\]/g, assignment)
|
||||||
|
.replace(/\[CancellationCode\]/g, cancellationCode);
|
||||||
|
|
||||||
|
return new Function("tryCatch", "errorObj", "Promise", "async", code)
|
||||||
|
(tryCatch, errorObj, Promise, async);
|
||||||
|
};
|
||||||
|
|
||||||
|
var holderClasses = [];
|
||||||
|
var thenCallbacks = [];
|
||||||
|
var promiseSetters = [];
|
||||||
|
|
||||||
|
for (var i = 0; i < 8; ++i) {
|
||||||
|
holderClasses.push(generateHolderClass(i + 1));
|
||||||
|
thenCallbacks.push(thenCallback(i + 1));
|
||||||
|
promiseSetters.push(promiseSetter(i + 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
reject = function (reason) {
|
||||||
|
this._reject(reason);
|
||||||
|
};
|
||||||
|
}}
|
||||||
|
|
||||||
|
Promise.join = function () {
|
||||||
|
var last = arguments.length - 1;
|
||||||
|
var fn;
|
||||||
|
if (last > 0 && typeof arguments[last] === "function") {
|
||||||
|
fn = arguments[last];
|
||||||
|
if (!false) {
|
||||||
|
if (last <= 8 && canEvaluate) {
|
||||||
|
var ret = new Promise(INTERNAL);
|
||||||
|
ret._captureStackTrace();
|
||||||
|
var HolderClass = holderClasses[last - 1];
|
||||||
|
var holder = new HolderClass(fn);
|
||||||
|
var callbacks = thenCallbacks;
|
||||||
|
|
||||||
|
for (var i = 0; i < last; ++i) {
|
||||||
|
var maybePromise = tryConvertToPromise(arguments[i], ret);
|
||||||
|
if (maybePromise instanceof Promise) {
|
||||||
|
maybePromise = maybePromise._target();
|
||||||
|
var bitField = maybePromise._bitField;
|
||||||
|
;
|
||||||
|
if (((bitField & 50397184) === 0)) {
|
||||||
|
maybePromise._then(callbacks[i], reject,
|
||||||
|
undefined, ret, holder);
|
||||||
|
promiseSetters[i](maybePromise, holder);
|
||||||
|
holder.asyncNeeded = false;
|
||||||
|
} else if (((bitField & 33554432) !== 0)) {
|
||||||
|
callbacks[i].call(ret,
|
||||||
|
maybePromise._value(), holder);
|
||||||
|
} else if (((bitField & 16777216) !== 0)) {
|
||||||
|
ret._reject(maybePromise._reason());
|
||||||
|
} else {
|
||||||
|
ret._cancel();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
callbacks[i].call(ret, maybePromise, holder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret._isFateSealed()) {
|
||||||
|
if (holder.asyncNeeded) {
|
||||||
|
var context = Promise._getContext();
|
||||||
|
holder.fn = util.contextBind(context, holder.fn);
|
||||||
|
}
|
||||||
|
ret._setAsyncGuaranteed();
|
||||||
|
ret._setOnCancel(holder);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var $_len = arguments.length;var args = new Array($_len); for(var $_i = 0; $_i < $_len ; ++$_i) {args[$_i] = arguments[$_i ];};
|
||||||
|
if (fn) args.pop();
|
||||||
|
var ret = new PromiseArray(args).promise();
|
||||||
|
return fn !== undefined ? ret.spread(fn) : ret;
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
175
node_modules/bluebird/js/release/map.js
generated
vendored
Normal file
175
node_modules/bluebird/js/release/map.js
generated
vendored
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
"use strict";
|
||||||
|
module.exports = function(Promise,
|
||||||
|
PromiseArray,
|
||||||
|
apiRejection,
|
||||||
|
tryConvertToPromise,
|
||||||
|
INTERNAL,
|
||||||
|
debug) {
|
||||||
|
var util = require("./util");
|
||||||
|
var tryCatch = util.tryCatch;
|
||||||
|
var errorObj = util.errorObj;
|
||||||
|
var async = Promise._async;
|
||||||
|
|
||||||
|
function MappingPromiseArray(promises, fn, limit, _filter) {
|
||||||
|
this.constructor$(promises);
|
||||||
|
this._promise._captureStackTrace();
|
||||||
|
var context = Promise._getContext();
|
||||||
|
this._callback = util.contextBind(context, fn);
|
||||||
|
this._preservedValues = _filter === INTERNAL
|
||||||
|
? new Array(this.length())
|
||||||
|
: null;
|
||||||
|
this._limit = limit;
|
||||||
|
this._inFlight = 0;
|
||||||
|
this._queue = [];
|
||||||
|
async.invoke(this._asyncInit, this, undefined);
|
||||||
|
if (util.isArray(promises)) {
|
||||||
|
for (var i = 0; i < promises.length; ++i) {
|
||||||
|
var maybePromise = promises[i];
|
||||||
|
if (maybePromise instanceof Promise) {
|
||||||
|
maybePromise.suppressUnhandledRejections();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
util.inherits(MappingPromiseArray, PromiseArray);
|
||||||
|
|
||||||
|
MappingPromiseArray.prototype._asyncInit = function() {
|
||||||
|
this._init$(undefined, -2);
|
||||||
|
};
|
||||||
|
|
||||||
|
MappingPromiseArray.prototype._init = function () {};
|
||||||
|
|
||||||
|
MappingPromiseArray.prototype._promiseFulfilled = function (value, index) {
|
||||||
|
var values = this._values;
|
||||||
|
var length = this.length();
|
||||||
|
var preservedValues = this._preservedValues;
|
||||||
|
var limit = this._limit;
|
||||||
|
|
||||||
|
if (index < 0) {
|
||||||
|
index = (index * -1) - 1;
|
||||||
|
values[index] = value;
|
||||||
|
if (limit >= 1) {
|
||||||
|
this._inFlight--;
|
||||||
|
this._drainQueue();
|
||||||
|
if (this._isResolved()) return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (limit >= 1 && this._inFlight >= limit) {
|
||||||
|
values[index] = value;
|
||||||
|
this._queue.push(index);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (preservedValues !== null) preservedValues[index] = value;
|
||||||
|
|
||||||
|
var promise = this._promise;
|
||||||
|
var callback = this._callback;
|
||||||
|
var receiver = promise._boundValue();
|
||||||
|
promise._pushContext();
|
||||||
|
var ret = tryCatch(callback).call(receiver, value, index, length);
|
||||||
|
var promiseCreated = promise._popContext();
|
||||||
|
debug.checkForgottenReturns(
|
||||||
|
ret,
|
||||||
|
promiseCreated,
|
||||||
|
preservedValues !== null ? "Promise.filter" : "Promise.map",
|
||||||
|
promise
|
||||||
|
);
|
||||||
|
if (ret === errorObj) {
|
||||||
|
this._reject(ret.e);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var maybePromise = tryConvertToPromise(ret, this._promise);
|
||||||
|
if (maybePromise instanceof Promise) {
|
||||||
|
maybePromise = maybePromise._target();
|
||||||
|
var bitField = maybePromise._bitField;
|
||||||
|
;
|
||||||
|
if (((bitField & 50397184) === 0)) {
|
||||||
|
if (limit >= 1) this._inFlight++;
|
||||||
|
values[index] = maybePromise;
|
||||||
|
maybePromise._proxy(this, (index + 1) * -1);
|
||||||
|
return false;
|
||||||
|
} else if (((bitField & 33554432) !== 0)) {
|
||||||
|
ret = maybePromise._value();
|
||||||
|
} else if (((bitField & 16777216) !== 0)) {
|
||||||
|
this._reject(maybePromise._reason());
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
this._cancel();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
values[index] = ret;
|
||||||
|
}
|
||||||
|
var totalResolved = ++this._totalResolved;
|
||||||
|
if (totalResolved >= length) {
|
||||||
|
if (preservedValues !== null) {
|
||||||
|
this._filter(values, preservedValues);
|
||||||
|
} else {
|
||||||
|
this._resolve(values);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
MappingPromiseArray.prototype._drainQueue = function () {
|
||||||
|
var queue = this._queue;
|
||||||
|
var limit = this._limit;
|
||||||
|
var values = this._values;
|
||||||
|
while (queue.length > 0 && this._inFlight < limit) {
|
||||||
|
if (this._isResolved()) return;
|
||||||
|
var index = queue.pop();
|
||||||
|
this._promiseFulfilled(values[index], index);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
MappingPromiseArray.prototype._filter = function (booleans, values) {
|
||||||
|
var len = values.length;
|
||||||
|
var ret = new Array(len);
|
||||||
|
var j = 0;
|
||||||
|
for (var i = 0; i < len; ++i) {
|
||||||
|
if (booleans[i]) ret[j++] = values[i];
|
||||||
|
}
|
||||||
|
ret.length = j;
|
||||||
|
this._resolve(ret);
|
||||||
|
};
|
||||||
|
|
||||||
|
MappingPromiseArray.prototype.preservedValues = function () {
|
||||||
|
return this._preservedValues;
|
||||||
|
};
|
||||||
|
|
||||||
|
function map(promises, fn, options, _filter) {
|
||||||
|
if (typeof fn !== "function") {
|
||||||
|
return apiRejection("expecting a function but got " + util.classString(fn));
|
||||||
|
}
|
||||||
|
|
||||||
|
var limit = 0;
|
||||||
|
if (options !== undefined) {
|
||||||
|
if (typeof options === "object" && options !== null) {
|
||||||
|
if (typeof options.concurrency !== "number") {
|
||||||
|
return Promise.reject(
|
||||||
|
new TypeError("'concurrency' must be a number but it is " +
|
||||||
|
util.classString(options.concurrency)));
|
||||||
|
}
|
||||||
|
limit = options.concurrency;
|
||||||
|
} else {
|
||||||
|
return Promise.reject(new TypeError(
|
||||||
|
"options argument must be an object but it is " +
|
||||||
|
util.classString(options)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
limit = typeof limit === "number" &&
|
||||||
|
isFinite(limit) && limit >= 1 ? limit : 0;
|
||||||
|
return new MappingPromiseArray(promises, fn, limit, _filter).promise();
|
||||||
|
}
|
||||||
|
|
||||||
|
Promise.prototype.map = function (fn, options) {
|
||||||
|
return map(this, fn, options, null);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.map = function (promises, fn, options, _filter) {
|
||||||
|
return map(promises, fn, options, _filter);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
55
node_modules/bluebird/js/release/method.js
generated
vendored
Normal file
55
node_modules/bluebird/js/release/method.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
"use strict";
|
||||||
|
module.exports =
|
||||||
|
function(Promise, INTERNAL, tryConvertToPromise, apiRejection, debug) {
|
||||||
|
var util = require("./util");
|
||||||
|
var tryCatch = util.tryCatch;
|
||||||
|
|
||||||
|
Promise.method = function (fn) {
|
||||||
|
if (typeof fn !== "function") {
|
||||||
|
throw new Promise.TypeError("expecting a function but got " + util.classString(fn));
|
||||||
|
}
|
||||||
|
return function () {
|
||||||
|
var ret = new Promise(INTERNAL);
|
||||||
|
ret._captureStackTrace();
|
||||||
|
ret._pushContext();
|
||||||
|
var value = tryCatch(fn).apply(this, arguments);
|
||||||
|
var promiseCreated = ret._popContext();
|
||||||
|
debug.checkForgottenReturns(
|
||||||
|
value, promiseCreated, "Promise.method", ret);
|
||||||
|
ret._resolveFromSyncValue(value);
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.attempt = Promise["try"] = function (fn) {
|
||||||
|
if (typeof fn !== "function") {
|
||||||
|
return apiRejection("expecting a function but got " + util.classString(fn));
|
||||||
|
}
|
||||||
|
var ret = new Promise(INTERNAL);
|
||||||
|
ret._captureStackTrace();
|
||||||
|
ret._pushContext();
|
||||||
|
var value;
|
||||||
|
if (arguments.length > 1) {
|
||||||
|
debug.deprecated("calling Promise.try with more than 1 argument");
|
||||||
|
var arg = arguments[1];
|
||||||
|
var ctx = arguments[2];
|
||||||
|
value = util.isArray(arg) ? tryCatch(fn).apply(ctx, arg)
|
||||||
|
: tryCatch(fn).call(ctx, arg);
|
||||||
|
} else {
|
||||||
|
value = tryCatch(fn)();
|
||||||
|
}
|
||||||
|
var promiseCreated = ret._popContext();
|
||||||
|
debug.checkForgottenReturns(
|
||||||
|
value, promiseCreated, "Promise.try", ret);
|
||||||
|
ret._resolveFromSyncValue(value);
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._resolveFromSyncValue = function (value) {
|
||||||
|
if (value === util.errorObj) {
|
||||||
|
this._rejectCallback(value.e, false);
|
||||||
|
} else {
|
||||||
|
this._resolveCallback(value, true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
51
node_modules/bluebird/js/release/nodeback.js
generated
vendored
Normal file
51
node_modules/bluebird/js/release/nodeback.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
"use strict";
|
||||||
|
var util = require("./util");
|
||||||
|
var maybeWrapAsError = util.maybeWrapAsError;
|
||||||
|
var errors = require("./errors");
|
||||||
|
var OperationalError = errors.OperationalError;
|
||||||
|
var es5 = require("./es5");
|
||||||
|
|
||||||
|
function isUntypedError(obj) {
|
||||||
|
return obj instanceof Error &&
|
||||||
|
es5.getPrototypeOf(obj) === Error.prototype;
|
||||||
|
}
|
||||||
|
|
||||||
|
var rErrorKey = /^(?:name|message|stack|cause)$/;
|
||||||
|
function wrapAsOperationalError(obj) {
|
||||||
|
var ret;
|
||||||
|
if (isUntypedError(obj)) {
|
||||||
|
ret = new OperationalError(obj);
|
||||||
|
ret.name = obj.name;
|
||||||
|
ret.message = obj.message;
|
||||||
|
ret.stack = obj.stack;
|
||||||
|
var keys = es5.keys(obj);
|
||||||
|
for (var i = 0; i < keys.length; ++i) {
|
||||||
|
var key = keys[i];
|
||||||
|
if (!rErrorKey.test(key)) {
|
||||||
|
ret[key] = obj[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
util.markAsOriginatingFromRejection(obj);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
function nodebackForPromise(promise, multiArgs) {
|
||||||
|
return function(err, value) {
|
||||||
|
if (promise === null) return;
|
||||||
|
if (err) {
|
||||||
|
var wrapped = wrapAsOperationalError(maybeWrapAsError(err));
|
||||||
|
promise._attachExtraTrace(wrapped);
|
||||||
|
promise._reject(wrapped);
|
||||||
|
} else if (!multiArgs) {
|
||||||
|
promise._fulfill(value);
|
||||||
|
} else {
|
||||||
|
var $_len = arguments.length;var args = new Array(Math.max($_len - 1, 0)); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];};
|
||||||
|
promise._fulfill(args);
|
||||||
|
}
|
||||||
|
promise = null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = nodebackForPromise;
|
||||||
58
node_modules/bluebird/js/release/nodeify.js
generated
vendored
Normal file
58
node_modules/bluebird/js/release/nodeify.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
"use strict";
|
||||||
|
module.exports = function(Promise) {
|
||||||
|
var util = require("./util");
|
||||||
|
var async = Promise._async;
|
||||||
|
var tryCatch = util.tryCatch;
|
||||||
|
var errorObj = util.errorObj;
|
||||||
|
|
||||||
|
function spreadAdapter(val, nodeback) {
|
||||||
|
var promise = this;
|
||||||
|
if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback);
|
||||||
|
var ret =
|
||||||
|
tryCatch(nodeback).apply(promise._boundValue(), [null].concat(val));
|
||||||
|
if (ret === errorObj) {
|
||||||
|
async.throwLater(ret.e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function successAdapter(val, nodeback) {
|
||||||
|
var promise = this;
|
||||||
|
var receiver = promise._boundValue();
|
||||||
|
var ret = val === undefined
|
||||||
|
? tryCatch(nodeback).call(receiver, null)
|
||||||
|
: tryCatch(nodeback).call(receiver, null, val);
|
||||||
|
if (ret === errorObj) {
|
||||||
|
async.throwLater(ret.e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function errorAdapter(reason, nodeback) {
|
||||||
|
var promise = this;
|
||||||
|
if (!reason) {
|
||||||
|
var newReason = new Error(reason + "");
|
||||||
|
newReason.cause = reason;
|
||||||
|
reason = newReason;
|
||||||
|
}
|
||||||
|
var ret = tryCatch(nodeback).call(promise._boundValue(), reason);
|
||||||
|
if (ret === errorObj) {
|
||||||
|
async.throwLater(ret.e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Promise.prototype.asCallback = Promise.prototype.nodeify = function (nodeback,
|
||||||
|
options) {
|
||||||
|
if (typeof nodeback == "function") {
|
||||||
|
var adapter = successAdapter;
|
||||||
|
if (options !== undefined && Object(options).spread) {
|
||||||
|
adapter = spreadAdapter;
|
||||||
|
}
|
||||||
|
this._then(
|
||||||
|
adapter,
|
||||||
|
errorAdapter,
|
||||||
|
undefined,
|
||||||
|
this,
|
||||||
|
nodeback
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
};
|
||||||
819
node_modules/bluebird/js/release/promise.js
generated
vendored
Normal file
819
node_modules/bluebird/js/release/promise.js
generated
vendored
Normal file
@@ -0,0 +1,819 @@
|
|||||||
|
"use strict";
|
||||||
|
module.exports = function() {
|
||||||
|
var makeSelfResolutionError = function () {
|
||||||
|
return new TypeError("circular promise resolution chain\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
||||||
|
};
|
||||||
|
var reflectHandler = function() {
|
||||||
|
return new Promise.PromiseInspection(this._target());
|
||||||
|
};
|
||||||
|
var apiRejection = function(msg) {
|
||||||
|
return Promise.reject(new TypeError(msg));
|
||||||
|
};
|
||||||
|
function Proxyable() {}
|
||||||
|
var UNDEFINED_BINDING = {};
|
||||||
|
var util = require("./util");
|
||||||
|
util.setReflectHandler(reflectHandler);
|
||||||
|
|
||||||
|
var getDomain = function() {
|
||||||
|
var domain = process.domain;
|
||||||
|
if (domain === undefined) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return domain;
|
||||||
|
};
|
||||||
|
var getContextDefault = function() {
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
var getContextDomain = function() {
|
||||||
|
return {
|
||||||
|
domain: getDomain(),
|
||||||
|
async: null
|
||||||
|
};
|
||||||
|
};
|
||||||
|
var AsyncResource = util.isNode && util.nodeSupportsAsyncResource ?
|
||||||
|
require("async_hooks").AsyncResource : null;
|
||||||
|
var getContextAsyncHooks = function() {
|
||||||
|
return {
|
||||||
|
domain: getDomain(),
|
||||||
|
async: new AsyncResource("Bluebird::Promise")
|
||||||
|
};
|
||||||
|
};
|
||||||
|
var getContext = util.isNode ? getContextDomain : getContextDefault;
|
||||||
|
util.notEnumerableProp(Promise, "_getContext", getContext);
|
||||||
|
var enableAsyncHooks = function() {
|
||||||
|
getContext = getContextAsyncHooks;
|
||||||
|
util.notEnumerableProp(Promise, "_getContext", getContextAsyncHooks);
|
||||||
|
};
|
||||||
|
var disableAsyncHooks = function() {
|
||||||
|
getContext = getContextDomain;
|
||||||
|
util.notEnumerableProp(Promise, "_getContext", getContextDomain);
|
||||||
|
};
|
||||||
|
|
||||||
|
var es5 = require("./es5");
|
||||||
|
var Async = require("./async");
|
||||||
|
var async = new Async();
|
||||||
|
es5.defineProperty(Promise, "_async", {value: async});
|
||||||
|
var errors = require("./errors");
|
||||||
|
var TypeError = Promise.TypeError = errors.TypeError;
|
||||||
|
Promise.RangeError = errors.RangeError;
|
||||||
|
var CancellationError = Promise.CancellationError = errors.CancellationError;
|
||||||
|
Promise.TimeoutError = errors.TimeoutError;
|
||||||
|
Promise.OperationalError = errors.OperationalError;
|
||||||
|
Promise.RejectionError = errors.OperationalError;
|
||||||
|
Promise.AggregateError = errors.AggregateError;
|
||||||
|
var INTERNAL = function(){};
|
||||||
|
var APPLY = {};
|
||||||
|
var NEXT_FILTER = {};
|
||||||
|
var tryConvertToPromise = require("./thenables")(Promise, INTERNAL);
|
||||||
|
var PromiseArray =
|
||||||
|
require("./promise_array")(Promise, INTERNAL,
|
||||||
|
tryConvertToPromise, apiRejection, Proxyable);
|
||||||
|
var Context = require("./context")(Promise);
|
||||||
|
/*jshint unused:false*/
|
||||||
|
var createContext = Context.create;
|
||||||
|
|
||||||
|
var debug = require("./debuggability")(Promise, Context,
|
||||||
|
enableAsyncHooks, disableAsyncHooks);
|
||||||
|
var CapturedTrace = debug.CapturedTrace;
|
||||||
|
var PassThroughHandlerContext =
|
||||||
|
require("./finally")(Promise, tryConvertToPromise, NEXT_FILTER);
|
||||||
|
var catchFilter = require("./catch_filter")(NEXT_FILTER);
|
||||||
|
var nodebackForPromise = require("./nodeback");
|
||||||
|
var errorObj = util.errorObj;
|
||||||
|
var tryCatch = util.tryCatch;
|
||||||
|
function check(self, executor) {
|
||||||
|
if (self == null || self.constructor !== Promise) {
|
||||||
|
throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
||||||
|
}
|
||||||
|
if (typeof executor !== "function") {
|
||||||
|
throw new TypeError("expecting a function but got " + util.classString(executor));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function Promise(executor) {
|
||||||
|
if (executor !== INTERNAL) {
|
||||||
|
check(this, executor);
|
||||||
|
}
|
||||||
|
this._bitField = 0;
|
||||||
|
this._fulfillmentHandler0 = undefined;
|
||||||
|
this._rejectionHandler0 = undefined;
|
||||||
|
this._promise0 = undefined;
|
||||||
|
this._receiver0 = undefined;
|
||||||
|
this._resolveFromExecutor(executor);
|
||||||
|
this._promiseCreated();
|
||||||
|
this._fireEvent("promiseCreated", this);
|
||||||
|
}
|
||||||
|
|
||||||
|
Promise.prototype.toString = function () {
|
||||||
|
return "[object Promise]";
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.caught = Promise.prototype["catch"] = function (fn) {
|
||||||
|
var len = arguments.length;
|
||||||
|
if (len > 1) {
|
||||||
|
var catchInstances = new Array(len - 1),
|
||||||
|
j = 0, i;
|
||||||
|
for (i = 0; i < len - 1; ++i) {
|
||||||
|
var item = arguments[i];
|
||||||
|
if (util.isObject(item)) {
|
||||||
|
catchInstances[j++] = item;
|
||||||
|
} else {
|
||||||
|
return apiRejection("Catch statement predicate: " +
|
||||||
|
"expecting an object but got " + util.classString(item));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catchInstances.length = j;
|
||||||
|
fn = arguments[i];
|
||||||
|
|
||||||
|
if (typeof fn !== "function") {
|
||||||
|
throw new TypeError("The last argument to .catch() " +
|
||||||
|
"must be a function, got " + util.toString(fn));
|
||||||
|
}
|
||||||
|
return this.then(undefined, catchFilter(catchInstances, fn, this));
|
||||||
|
}
|
||||||
|
return this.then(undefined, fn);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.reflect = function () {
|
||||||
|
return this._then(reflectHandler,
|
||||||
|
reflectHandler, undefined, this, undefined);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.then = function (didFulfill, didReject) {
|
||||||
|
if (debug.warnings() && arguments.length > 0 &&
|
||||||
|
typeof didFulfill !== "function" &&
|
||||||
|
typeof didReject !== "function") {
|
||||||
|
var msg = ".then() only accepts functions but was passed: " +
|
||||||
|
util.classString(didFulfill);
|
||||||
|
if (arguments.length > 1) {
|
||||||
|
msg += ", " + util.classString(didReject);
|
||||||
|
}
|
||||||
|
this._warn(msg);
|
||||||
|
}
|
||||||
|
return this._then(didFulfill, didReject, undefined, undefined, undefined);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.done = function (didFulfill, didReject) {
|
||||||
|
var promise =
|
||||||
|
this._then(didFulfill, didReject, undefined, undefined, undefined);
|
||||||
|
promise._setIsFinal();
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.spread = function (fn) {
|
||||||
|
if (typeof fn !== "function") {
|
||||||
|
return apiRejection("expecting a function but got " + util.classString(fn));
|
||||||
|
}
|
||||||
|
return this.all()._then(fn, undefined, undefined, APPLY, undefined);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.toJSON = function () {
|
||||||
|
var ret = {
|
||||||
|
isFulfilled: false,
|
||||||
|
isRejected: false,
|
||||||
|
fulfillmentValue: undefined,
|
||||||
|
rejectionReason: undefined
|
||||||
|
};
|
||||||
|
if (this.isFulfilled()) {
|
||||||
|
ret.fulfillmentValue = this.value();
|
||||||
|
ret.isFulfilled = true;
|
||||||
|
} else if (this.isRejected()) {
|
||||||
|
ret.rejectionReason = this.reason();
|
||||||
|
ret.isRejected = true;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.all = function () {
|
||||||
|
if (arguments.length > 0) {
|
||||||
|
this._warn(".all() was passed arguments but it does not take any");
|
||||||
|
}
|
||||||
|
return new PromiseArray(this).promise();
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.error = function (fn) {
|
||||||
|
return this.caught(util.originatesFromRejection, fn);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.getNewLibraryCopy = module.exports;
|
||||||
|
|
||||||
|
Promise.is = function (val) {
|
||||||
|
return val instanceof Promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.fromNode = Promise.fromCallback = function(fn) {
|
||||||
|
var ret = new Promise(INTERNAL);
|
||||||
|
ret._captureStackTrace();
|
||||||
|
var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs
|
||||||
|
: false;
|
||||||
|
var result = tryCatch(fn)(nodebackForPromise(ret, multiArgs));
|
||||||
|
if (result === errorObj) {
|
||||||
|
ret._rejectCallback(result.e, true);
|
||||||
|
}
|
||||||
|
if (!ret._isFateSealed()) ret._setAsyncGuaranteed();
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.all = function (promises) {
|
||||||
|
return new PromiseArray(promises).promise();
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.cast = function (obj) {
|
||||||
|
var ret = tryConvertToPromise(obj);
|
||||||
|
if (!(ret instanceof Promise)) {
|
||||||
|
ret = new Promise(INTERNAL);
|
||||||
|
ret._captureStackTrace();
|
||||||
|
ret._setFulfilled();
|
||||||
|
ret._rejectionHandler0 = obj;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.resolve = Promise.fulfilled = Promise.cast;
|
||||||
|
|
||||||
|
Promise.reject = Promise.rejected = function (reason) {
|
||||||
|
var ret = new Promise(INTERNAL);
|
||||||
|
ret._captureStackTrace();
|
||||||
|
ret._rejectCallback(reason, true);
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.setScheduler = function(fn) {
|
||||||
|
if (typeof fn !== "function") {
|
||||||
|
throw new TypeError("expecting a function but got " + util.classString(fn));
|
||||||
|
}
|
||||||
|
return async.setScheduler(fn);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._then = function (
|
||||||
|
didFulfill,
|
||||||
|
didReject,
|
||||||
|
_, receiver,
|
||||||
|
internalData
|
||||||
|
) {
|
||||||
|
var haveInternalData = internalData !== undefined;
|
||||||
|
var promise = haveInternalData ? internalData : new Promise(INTERNAL);
|
||||||
|
var target = this._target();
|
||||||
|
var bitField = target._bitField;
|
||||||
|
|
||||||
|
if (!haveInternalData) {
|
||||||
|
promise._propagateFrom(this, 3);
|
||||||
|
promise._captureStackTrace();
|
||||||
|
if (receiver === undefined &&
|
||||||
|
((this._bitField & 2097152) !== 0)) {
|
||||||
|
if (!((bitField & 50397184) === 0)) {
|
||||||
|
receiver = this._boundValue();
|
||||||
|
} else {
|
||||||
|
receiver = target === this ? undefined : this._boundTo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this._fireEvent("promiseChained", this, promise);
|
||||||
|
}
|
||||||
|
|
||||||
|
var context = getContext();
|
||||||
|
if (!((bitField & 50397184) === 0)) {
|
||||||
|
var handler, value, settler = target._settlePromiseCtx;
|
||||||
|
if (((bitField & 33554432) !== 0)) {
|
||||||
|
value = target._rejectionHandler0;
|
||||||
|
handler = didFulfill;
|
||||||
|
} else if (((bitField & 16777216) !== 0)) {
|
||||||
|
value = target._fulfillmentHandler0;
|
||||||
|
handler = didReject;
|
||||||
|
target._unsetRejectionIsUnhandled();
|
||||||
|
} else {
|
||||||
|
settler = target._settlePromiseLateCancellationObserver;
|
||||||
|
value = new CancellationError("late cancellation observer");
|
||||||
|
target._attachExtraTrace(value);
|
||||||
|
handler = didReject;
|
||||||
|
}
|
||||||
|
|
||||||
|
async.invoke(settler, target, {
|
||||||
|
handler: util.contextBind(context, handler),
|
||||||
|
promise: promise,
|
||||||
|
receiver: receiver,
|
||||||
|
value: value
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
target._addCallbacks(didFulfill, didReject, promise,
|
||||||
|
receiver, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
return promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._length = function () {
|
||||||
|
return this._bitField & 65535;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._isFateSealed = function () {
|
||||||
|
return (this._bitField & 117506048) !== 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._isFollowing = function () {
|
||||||
|
return (this._bitField & 67108864) === 67108864;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._setLength = function (len) {
|
||||||
|
this._bitField = (this._bitField & -65536) |
|
||||||
|
(len & 65535);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._setFulfilled = function () {
|
||||||
|
this._bitField = this._bitField | 33554432;
|
||||||
|
this._fireEvent("promiseFulfilled", this);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._setRejected = function () {
|
||||||
|
this._bitField = this._bitField | 16777216;
|
||||||
|
this._fireEvent("promiseRejected", this);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._setFollowing = function () {
|
||||||
|
this._bitField = this._bitField | 67108864;
|
||||||
|
this._fireEvent("promiseResolved", this);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._setIsFinal = function () {
|
||||||
|
this._bitField = this._bitField | 4194304;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._isFinal = function () {
|
||||||
|
return (this._bitField & 4194304) > 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._unsetCancelled = function() {
|
||||||
|
this._bitField = this._bitField & (~65536);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._setCancelled = function() {
|
||||||
|
this._bitField = this._bitField | 65536;
|
||||||
|
this._fireEvent("promiseCancelled", this);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._setWillBeCancelled = function() {
|
||||||
|
this._bitField = this._bitField | 8388608;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._setAsyncGuaranteed = function() {
|
||||||
|
if (async.hasCustomScheduler()) return;
|
||||||
|
var bitField = this._bitField;
|
||||||
|
this._bitField = bitField |
|
||||||
|
(((bitField & 536870912) >> 2) ^
|
||||||
|
134217728);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._setNoAsyncGuarantee = function() {
|
||||||
|
this._bitField = (this._bitField | 536870912) &
|
||||||
|
(~134217728);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._receiverAt = function (index) {
|
||||||
|
var ret = index === 0 ? this._receiver0 : this[
|
||||||
|
index * 4 - 4 + 3];
|
||||||
|
if (ret === UNDEFINED_BINDING) {
|
||||||
|
return undefined;
|
||||||
|
} else if (ret === undefined && this._isBound()) {
|
||||||
|
return this._boundValue();
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._promiseAt = function (index) {
|
||||||
|
return this[
|
||||||
|
index * 4 - 4 + 2];
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._fulfillmentHandlerAt = function (index) {
|
||||||
|
return this[
|
||||||
|
index * 4 - 4 + 0];
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._rejectionHandlerAt = function (index) {
|
||||||
|
return this[
|
||||||
|
index * 4 - 4 + 1];
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._boundValue = function() {};
|
||||||
|
|
||||||
|
Promise.prototype._migrateCallback0 = function (follower) {
|
||||||
|
var bitField = follower._bitField;
|
||||||
|
var fulfill = follower._fulfillmentHandler0;
|
||||||
|
var reject = follower._rejectionHandler0;
|
||||||
|
var promise = follower._promise0;
|
||||||
|
var receiver = follower._receiverAt(0);
|
||||||
|
if (receiver === undefined) receiver = UNDEFINED_BINDING;
|
||||||
|
this._addCallbacks(fulfill, reject, promise, receiver, null);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._migrateCallbackAt = function (follower, index) {
|
||||||
|
var fulfill = follower._fulfillmentHandlerAt(index);
|
||||||
|
var reject = follower._rejectionHandlerAt(index);
|
||||||
|
var promise = follower._promiseAt(index);
|
||||||
|
var receiver = follower._receiverAt(index);
|
||||||
|
if (receiver === undefined) receiver = UNDEFINED_BINDING;
|
||||||
|
this._addCallbacks(fulfill, reject, promise, receiver, null);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._addCallbacks = function (
|
||||||
|
fulfill,
|
||||||
|
reject,
|
||||||
|
promise,
|
||||||
|
receiver,
|
||||||
|
context
|
||||||
|
) {
|
||||||
|
var index = this._length();
|
||||||
|
|
||||||
|
if (index >= 65535 - 4) {
|
||||||
|
index = 0;
|
||||||
|
this._setLength(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index === 0) {
|
||||||
|
this._promise0 = promise;
|
||||||
|
this._receiver0 = receiver;
|
||||||
|
if (typeof fulfill === "function") {
|
||||||
|
this._fulfillmentHandler0 = util.contextBind(context, fulfill);
|
||||||
|
}
|
||||||
|
if (typeof reject === "function") {
|
||||||
|
this._rejectionHandler0 = util.contextBind(context, reject);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var base = index * 4 - 4;
|
||||||
|
this[base + 2] = promise;
|
||||||
|
this[base + 3] = receiver;
|
||||||
|
if (typeof fulfill === "function") {
|
||||||
|
this[base + 0] =
|
||||||
|
util.contextBind(context, fulfill);
|
||||||
|
}
|
||||||
|
if (typeof reject === "function") {
|
||||||
|
this[base + 1] =
|
||||||
|
util.contextBind(context, reject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this._setLength(index + 1);
|
||||||
|
return index;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._proxy = function (proxyable, arg) {
|
||||||
|
this._addCallbacks(undefined, undefined, arg, proxyable, null);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._resolveCallback = function(value, shouldBind) {
|
||||||
|
if (((this._bitField & 117506048) !== 0)) return;
|
||||||
|
if (value === this)
|
||||||
|
return this._rejectCallback(makeSelfResolutionError(), false);
|
||||||
|
var maybePromise = tryConvertToPromise(value, this);
|
||||||
|
if (!(maybePromise instanceof Promise)) return this._fulfill(value);
|
||||||
|
|
||||||
|
if (shouldBind) this._propagateFrom(maybePromise, 2);
|
||||||
|
|
||||||
|
|
||||||
|
var promise = maybePromise._target();
|
||||||
|
|
||||||
|
if (promise === this) {
|
||||||
|
this._reject(makeSelfResolutionError());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var bitField = promise._bitField;
|
||||||
|
if (((bitField & 50397184) === 0)) {
|
||||||
|
var len = this._length();
|
||||||
|
if (len > 0) promise._migrateCallback0(this);
|
||||||
|
for (var i = 1; i < len; ++i) {
|
||||||
|
promise._migrateCallbackAt(this, i);
|
||||||
|
}
|
||||||
|
this._setFollowing();
|
||||||
|
this._setLength(0);
|
||||||
|
this._setFollowee(maybePromise);
|
||||||
|
} else if (((bitField & 33554432) !== 0)) {
|
||||||
|
this._fulfill(promise._value());
|
||||||
|
} else if (((bitField & 16777216) !== 0)) {
|
||||||
|
this._reject(promise._reason());
|
||||||
|
} else {
|
||||||
|
var reason = new CancellationError("late cancellation observer");
|
||||||
|
promise._attachExtraTrace(reason);
|
||||||
|
this._reject(reason);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._rejectCallback =
|
||||||
|
function(reason, synchronous, ignoreNonErrorWarnings) {
|
||||||
|
var trace = util.ensureErrorObject(reason);
|
||||||
|
var hasStack = trace === reason;
|
||||||
|
if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) {
|
||||||
|
var message = "a promise was rejected with a non-error: " +
|
||||||
|
util.classString(reason);
|
||||||
|
this._warn(message, true);
|
||||||
|
}
|
||||||
|
this._attachExtraTrace(trace, synchronous ? hasStack : false);
|
||||||
|
this._reject(reason);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._resolveFromExecutor = function (executor) {
|
||||||
|
if (executor === INTERNAL) return;
|
||||||
|
var promise = this;
|
||||||
|
this._captureStackTrace();
|
||||||
|
this._pushContext();
|
||||||
|
var synchronous = true;
|
||||||
|
var r = this._execute(executor, function(value) {
|
||||||
|
promise._resolveCallback(value);
|
||||||
|
}, function (reason) {
|
||||||
|
promise._rejectCallback(reason, synchronous);
|
||||||
|
});
|
||||||
|
synchronous = false;
|
||||||
|
this._popContext();
|
||||||
|
|
||||||
|
if (r !== undefined) {
|
||||||
|
promise._rejectCallback(r, true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._settlePromiseFromHandler = function (
|
||||||
|
handler, receiver, value, promise
|
||||||
|
) {
|
||||||
|
var bitField = promise._bitField;
|
||||||
|
if (((bitField & 65536) !== 0)) return;
|
||||||
|
promise._pushContext();
|
||||||
|
var x;
|
||||||
|
if (receiver === APPLY) {
|
||||||
|
if (!value || typeof value.length !== "number") {
|
||||||
|
x = errorObj;
|
||||||
|
x.e = new TypeError("cannot .spread() a non-array: " +
|
||||||
|
util.classString(value));
|
||||||
|
} else {
|
||||||
|
x = tryCatch(handler).apply(this._boundValue(), value);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
x = tryCatch(handler).call(receiver, value);
|
||||||
|
}
|
||||||
|
var promiseCreated = promise._popContext();
|
||||||
|
bitField = promise._bitField;
|
||||||
|
if (((bitField & 65536) !== 0)) return;
|
||||||
|
|
||||||
|
if (x === NEXT_FILTER) {
|
||||||
|
promise._reject(value);
|
||||||
|
} else if (x === errorObj) {
|
||||||
|
promise._rejectCallback(x.e, false);
|
||||||
|
} else {
|
||||||
|
debug.checkForgottenReturns(x, promiseCreated, "", promise, this);
|
||||||
|
promise._resolveCallback(x);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._target = function() {
|
||||||
|
var ret = this;
|
||||||
|
while (ret._isFollowing()) ret = ret._followee();
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._followee = function() {
|
||||||
|
return this._rejectionHandler0;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._setFollowee = function(promise) {
|
||||||
|
this._rejectionHandler0 = promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._settlePromise = function(promise, handler, receiver, value) {
|
||||||
|
var isPromise = promise instanceof Promise;
|
||||||
|
var bitField = this._bitField;
|
||||||
|
var asyncGuaranteed = ((bitField & 134217728) !== 0);
|
||||||
|
if (((bitField & 65536) !== 0)) {
|
||||||
|
if (isPromise) promise._invokeInternalOnCancel();
|
||||||
|
|
||||||
|
if (receiver instanceof PassThroughHandlerContext &&
|
||||||
|
receiver.isFinallyHandler()) {
|
||||||
|
receiver.cancelPromise = promise;
|
||||||
|
if (tryCatch(handler).call(receiver, value) === errorObj) {
|
||||||
|
promise._reject(errorObj.e);
|
||||||
|
}
|
||||||
|
} else if (handler === reflectHandler) {
|
||||||
|
promise._fulfill(reflectHandler.call(receiver));
|
||||||
|
} else if (receiver instanceof Proxyable) {
|
||||||
|
receiver._promiseCancelled(promise);
|
||||||
|
} else if (isPromise || promise instanceof PromiseArray) {
|
||||||
|
promise._cancel();
|
||||||
|
} else {
|
||||||
|
receiver.cancel();
|
||||||
|
}
|
||||||
|
} else if (typeof handler === "function") {
|
||||||
|
if (!isPromise) {
|
||||||
|
handler.call(receiver, value, promise);
|
||||||
|
} else {
|
||||||
|
if (asyncGuaranteed) promise._setAsyncGuaranteed();
|
||||||
|
this._settlePromiseFromHandler(handler, receiver, value, promise);
|
||||||
|
}
|
||||||
|
} else if (receiver instanceof Proxyable) {
|
||||||
|
if (!receiver._isResolved()) {
|
||||||
|
if (((bitField & 33554432) !== 0)) {
|
||||||
|
receiver._promiseFulfilled(value, promise);
|
||||||
|
} else {
|
||||||
|
receiver._promiseRejected(value, promise);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (isPromise) {
|
||||||
|
if (asyncGuaranteed) promise._setAsyncGuaranteed();
|
||||||
|
if (((bitField & 33554432) !== 0)) {
|
||||||
|
promise._fulfill(value);
|
||||||
|
} else {
|
||||||
|
promise._reject(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._settlePromiseLateCancellationObserver = function(ctx) {
|
||||||
|
var handler = ctx.handler;
|
||||||
|
var promise = ctx.promise;
|
||||||
|
var receiver = ctx.receiver;
|
||||||
|
var value = ctx.value;
|
||||||
|
if (typeof handler === "function") {
|
||||||
|
if (!(promise instanceof Promise)) {
|
||||||
|
handler.call(receiver, value, promise);
|
||||||
|
} else {
|
||||||
|
this._settlePromiseFromHandler(handler, receiver, value, promise);
|
||||||
|
}
|
||||||
|
} else if (promise instanceof Promise) {
|
||||||
|
promise._reject(value);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._settlePromiseCtx = function(ctx) {
|
||||||
|
this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._settlePromise0 = function(handler, value, bitField) {
|
||||||
|
var promise = this._promise0;
|
||||||
|
var receiver = this._receiverAt(0);
|
||||||
|
this._promise0 = undefined;
|
||||||
|
this._receiver0 = undefined;
|
||||||
|
this._settlePromise(promise, handler, receiver, value);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._clearCallbackDataAtIndex = function(index) {
|
||||||
|
var base = index * 4 - 4;
|
||||||
|
this[base + 2] =
|
||||||
|
this[base + 3] =
|
||||||
|
this[base + 0] =
|
||||||
|
this[base + 1] = undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._fulfill = function (value) {
|
||||||
|
var bitField = this._bitField;
|
||||||
|
if (((bitField & 117506048) >>> 16)) return;
|
||||||
|
if (value === this) {
|
||||||
|
var err = makeSelfResolutionError();
|
||||||
|
this._attachExtraTrace(err);
|
||||||
|
return this._reject(err);
|
||||||
|
}
|
||||||
|
this._setFulfilled();
|
||||||
|
this._rejectionHandler0 = value;
|
||||||
|
|
||||||
|
if ((bitField & 65535) > 0) {
|
||||||
|
if (((bitField & 134217728) !== 0)) {
|
||||||
|
this._settlePromises();
|
||||||
|
} else {
|
||||||
|
async.settlePromises(this);
|
||||||
|
}
|
||||||
|
this._dereferenceTrace();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._reject = function (reason) {
|
||||||
|
var bitField = this._bitField;
|
||||||
|
if (((bitField & 117506048) >>> 16)) return;
|
||||||
|
this._setRejected();
|
||||||
|
this._fulfillmentHandler0 = reason;
|
||||||
|
|
||||||
|
if (this._isFinal()) {
|
||||||
|
return async.fatalError(reason, util.isNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((bitField & 65535) > 0) {
|
||||||
|
async.settlePromises(this);
|
||||||
|
} else {
|
||||||
|
this._ensurePossibleRejectionHandled();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._fulfillPromises = function (len, value) {
|
||||||
|
for (var i = 1; i < len; i++) {
|
||||||
|
var handler = this._fulfillmentHandlerAt(i);
|
||||||
|
var promise = this._promiseAt(i);
|
||||||
|
var receiver = this._receiverAt(i);
|
||||||
|
this._clearCallbackDataAtIndex(i);
|
||||||
|
this._settlePromise(promise, handler, receiver, value);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._rejectPromises = function (len, reason) {
|
||||||
|
for (var i = 1; i < len; i++) {
|
||||||
|
var handler = this._rejectionHandlerAt(i);
|
||||||
|
var promise = this._promiseAt(i);
|
||||||
|
var receiver = this._receiverAt(i);
|
||||||
|
this._clearCallbackDataAtIndex(i);
|
||||||
|
this._settlePromise(promise, handler, receiver, reason);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._settlePromises = function () {
|
||||||
|
var bitField = this._bitField;
|
||||||
|
var len = (bitField & 65535);
|
||||||
|
|
||||||
|
if (len > 0) {
|
||||||
|
if (((bitField & 16842752) !== 0)) {
|
||||||
|
var reason = this._fulfillmentHandler0;
|
||||||
|
this._settlePromise0(this._rejectionHandler0, reason, bitField);
|
||||||
|
this._rejectPromises(len, reason);
|
||||||
|
} else {
|
||||||
|
var value = this._rejectionHandler0;
|
||||||
|
this._settlePromise0(this._fulfillmentHandler0, value, bitField);
|
||||||
|
this._fulfillPromises(len, value);
|
||||||
|
}
|
||||||
|
this._setLength(0);
|
||||||
|
}
|
||||||
|
this._clearCancellationData();
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._settledValue = function() {
|
||||||
|
var bitField = this._bitField;
|
||||||
|
if (((bitField & 33554432) !== 0)) {
|
||||||
|
return this._rejectionHandler0;
|
||||||
|
} else if (((bitField & 16777216) !== 0)) {
|
||||||
|
return this._fulfillmentHandler0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
|
||||||
|
es5.defineProperty(Promise.prototype, Symbol.toStringTag, {
|
||||||
|
get: function () {
|
||||||
|
return "Object";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function deferResolve(v) {this.promise._resolveCallback(v);}
|
||||||
|
function deferReject(v) {this.promise._rejectCallback(v, false);}
|
||||||
|
|
||||||
|
Promise.defer = Promise.pending = function() {
|
||||||
|
debug.deprecated("Promise.defer", "new Promise");
|
||||||
|
var promise = new Promise(INTERNAL);
|
||||||
|
return {
|
||||||
|
promise: promise,
|
||||||
|
resolve: deferResolve,
|
||||||
|
reject: deferReject
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
util.notEnumerableProp(Promise,
|
||||||
|
"_makeSelfResolutionError",
|
||||||
|
makeSelfResolutionError);
|
||||||
|
|
||||||
|
require("./method")(Promise, INTERNAL, tryConvertToPromise, apiRejection,
|
||||||
|
debug);
|
||||||
|
require("./bind")(Promise, INTERNAL, tryConvertToPromise, debug);
|
||||||
|
require("./cancel")(Promise, PromiseArray, apiRejection, debug);
|
||||||
|
require("./direct_resolve")(Promise);
|
||||||
|
require("./synchronous_inspection")(Promise);
|
||||||
|
require("./join")(
|
||||||
|
Promise, PromiseArray, tryConvertToPromise, INTERNAL, async);
|
||||||
|
Promise.Promise = Promise;
|
||||||
|
Promise.version = "3.7.1";
|
||||||
|
require('./call_get.js')(Promise);
|
||||||
|
require('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug);
|
||||||
|
require('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
|
||||||
|
require('./nodeify.js')(Promise);
|
||||||
|
require('./promisify.js')(Promise, INTERNAL);
|
||||||
|
require('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection);
|
||||||
|
require('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection);
|
||||||
|
require('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
|
||||||
|
require('./settle.js')(Promise, PromiseArray, debug);
|
||||||
|
require('./some.js')(Promise, PromiseArray, apiRejection);
|
||||||
|
require('./timers.js')(Promise, INTERNAL, debug);
|
||||||
|
require('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug);
|
||||||
|
require('./any.js')(Promise);
|
||||||
|
require('./each.js')(Promise, INTERNAL);
|
||||||
|
require('./filter.js')(Promise, INTERNAL);
|
||||||
|
|
||||||
|
util.toFastProperties(Promise);
|
||||||
|
util.toFastProperties(Promise.prototype);
|
||||||
|
function fillTypes(value) {
|
||||||
|
var p = new Promise(INTERNAL);
|
||||||
|
p._fulfillmentHandler0 = value;
|
||||||
|
p._rejectionHandler0 = value;
|
||||||
|
p._promise0 = value;
|
||||||
|
p._receiver0 = value;
|
||||||
|
}
|
||||||
|
// Complete slack tracking, opt out of field-type tracking and
|
||||||
|
// stabilize map
|
||||||
|
fillTypes({a: 1});
|
||||||
|
fillTypes({b: 2});
|
||||||
|
fillTypes({c: 3});
|
||||||
|
fillTypes(1);
|
||||||
|
fillTypes(function(){});
|
||||||
|
fillTypes(undefined);
|
||||||
|
fillTypes(false);
|
||||||
|
fillTypes(new Promise(INTERNAL));
|
||||||
|
debug.setBounds(Async.firstLineError, util.lastLineError);
|
||||||
|
return Promise;
|
||||||
|
|
||||||
|
};
|
||||||
186
node_modules/bluebird/js/release/promise_array.js
generated
vendored
Normal file
186
node_modules/bluebird/js/release/promise_array.js
generated
vendored
Normal file
@@ -0,0 +1,186 @@
|
|||||||
|
"use strict";
|
||||||
|
module.exports = function(Promise, INTERNAL, tryConvertToPromise,
|
||||||
|
apiRejection, Proxyable) {
|
||||||
|
var util = require("./util");
|
||||||
|
var isArray = util.isArray;
|
||||||
|
|
||||||
|
function toResolutionValue(val) {
|
||||||
|
switch(val) {
|
||||||
|
case -2: return [];
|
||||||
|
case -3: return {};
|
||||||
|
case -6: return new Map();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function PromiseArray(values) {
|
||||||
|
var promise = this._promise = new Promise(INTERNAL);
|
||||||
|
if (values instanceof Promise) {
|
||||||
|
promise._propagateFrom(values, 3);
|
||||||
|
values.suppressUnhandledRejections();
|
||||||
|
}
|
||||||
|
promise._setOnCancel(this);
|
||||||
|
this._values = values;
|
||||||
|
this._length = 0;
|
||||||
|
this._totalResolved = 0;
|
||||||
|
this._init(undefined, -2);
|
||||||
|
}
|
||||||
|
util.inherits(PromiseArray, Proxyable);
|
||||||
|
|
||||||
|
PromiseArray.prototype.length = function () {
|
||||||
|
return this._length;
|
||||||
|
};
|
||||||
|
|
||||||
|
PromiseArray.prototype.promise = function () {
|
||||||
|
return this._promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) {
|
||||||
|
var values = tryConvertToPromise(this._values, this._promise);
|
||||||
|
if (values instanceof Promise) {
|
||||||
|
values = values._target();
|
||||||
|
var bitField = values._bitField;
|
||||||
|
;
|
||||||
|
this._values = values;
|
||||||
|
|
||||||
|
if (((bitField & 50397184) === 0)) {
|
||||||
|
this._promise._setAsyncGuaranteed();
|
||||||
|
return values._then(
|
||||||
|
init,
|
||||||
|
this._reject,
|
||||||
|
undefined,
|
||||||
|
this,
|
||||||
|
resolveValueIfEmpty
|
||||||
|
);
|
||||||
|
} else if (((bitField & 33554432) !== 0)) {
|
||||||
|
values = values._value();
|
||||||
|
} else if (((bitField & 16777216) !== 0)) {
|
||||||
|
return this._reject(values._reason());
|
||||||
|
} else {
|
||||||
|
return this._cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
values = util.asArray(values);
|
||||||
|
if (values === null) {
|
||||||
|
var err = apiRejection(
|
||||||
|
"expecting an array or an iterable object but got " + util.classString(values)).reason();
|
||||||
|
this._promise._rejectCallback(err, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (values.length === 0) {
|
||||||
|
if (resolveValueIfEmpty === -5) {
|
||||||
|
this._resolveEmptyArray();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this._resolve(toResolutionValue(resolveValueIfEmpty));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this._iterate(values);
|
||||||
|
};
|
||||||
|
|
||||||
|
PromiseArray.prototype._iterate = function(values) {
|
||||||
|
var len = this.getActualLength(values.length);
|
||||||
|
this._length = len;
|
||||||
|
this._values = this.shouldCopyValues() ? new Array(len) : this._values;
|
||||||
|
var result = this._promise;
|
||||||
|
var isResolved = false;
|
||||||
|
var bitField = null;
|
||||||
|
for (var i = 0; i < len; ++i) {
|
||||||
|
var maybePromise = tryConvertToPromise(values[i], result);
|
||||||
|
|
||||||
|
if (maybePromise instanceof Promise) {
|
||||||
|
maybePromise = maybePromise._target();
|
||||||
|
bitField = maybePromise._bitField;
|
||||||
|
} else {
|
||||||
|
bitField = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isResolved) {
|
||||||
|
if (bitField !== null) {
|
||||||
|
maybePromise.suppressUnhandledRejections();
|
||||||
|
}
|
||||||
|
} else if (bitField !== null) {
|
||||||
|
if (((bitField & 50397184) === 0)) {
|
||||||
|
maybePromise._proxy(this, i);
|
||||||
|
this._values[i] = maybePromise;
|
||||||
|
} else if (((bitField & 33554432) !== 0)) {
|
||||||
|
isResolved = this._promiseFulfilled(maybePromise._value(), i);
|
||||||
|
} else if (((bitField & 16777216) !== 0)) {
|
||||||
|
isResolved = this._promiseRejected(maybePromise._reason(), i);
|
||||||
|
} else {
|
||||||
|
isResolved = this._promiseCancelled(i);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
isResolved = this._promiseFulfilled(maybePromise, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!isResolved) result._setAsyncGuaranteed();
|
||||||
|
};
|
||||||
|
|
||||||
|
PromiseArray.prototype._isResolved = function () {
|
||||||
|
return this._values === null;
|
||||||
|
};
|
||||||
|
|
||||||
|
PromiseArray.prototype._resolve = function (value) {
|
||||||
|
this._values = null;
|
||||||
|
this._promise._fulfill(value);
|
||||||
|
};
|
||||||
|
|
||||||
|
PromiseArray.prototype._cancel = function() {
|
||||||
|
if (this._isResolved() || !this._promise._isCancellable()) return;
|
||||||
|
this._values = null;
|
||||||
|
this._promise._cancel();
|
||||||
|
};
|
||||||
|
|
||||||
|
PromiseArray.prototype._reject = function (reason) {
|
||||||
|
this._values = null;
|
||||||
|
this._promise._rejectCallback(reason, false);
|
||||||
|
};
|
||||||
|
|
||||||
|
PromiseArray.prototype._promiseFulfilled = function (value, index) {
|
||||||
|
this._values[index] = value;
|
||||||
|
var totalResolved = ++this._totalResolved;
|
||||||
|
if (totalResolved >= this._length) {
|
||||||
|
this._resolve(this._values);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
PromiseArray.prototype._promiseCancelled = function() {
|
||||||
|
this._cancel();
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
PromiseArray.prototype._promiseRejected = function (reason) {
|
||||||
|
this._totalResolved++;
|
||||||
|
this._reject(reason);
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
PromiseArray.prototype._resultCancelled = function() {
|
||||||
|
if (this._isResolved()) return;
|
||||||
|
var values = this._values;
|
||||||
|
this._cancel();
|
||||||
|
if (values instanceof Promise) {
|
||||||
|
values.cancel();
|
||||||
|
} else {
|
||||||
|
for (var i = 0; i < values.length; ++i) {
|
||||||
|
if (values[i] instanceof Promise) {
|
||||||
|
values[i].cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
PromiseArray.prototype.shouldCopyValues = function () {
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
PromiseArray.prototype.getActualLength = function (len) {
|
||||||
|
return len;
|
||||||
|
};
|
||||||
|
|
||||||
|
return PromiseArray;
|
||||||
|
};
|
||||||
314
node_modules/bluebird/js/release/promisify.js
generated
vendored
Normal file
314
node_modules/bluebird/js/release/promisify.js
generated
vendored
Normal file
@@ -0,0 +1,314 @@
|
|||||||
|
"use strict";
|
||||||
|
module.exports = function(Promise, INTERNAL) {
|
||||||
|
var THIS = {};
|
||||||
|
var util = require("./util");
|
||||||
|
var nodebackForPromise = require("./nodeback");
|
||||||
|
var withAppended = util.withAppended;
|
||||||
|
var maybeWrapAsError = util.maybeWrapAsError;
|
||||||
|
var canEvaluate = util.canEvaluate;
|
||||||
|
var TypeError = require("./errors").TypeError;
|
||||||
|
var defaultSuffix = "Async";
|
||||||
|
var defaultPromisified = {__isPromisified__: true};
|
||||||
|
var noCopyProps = [
|
||||||
|
"arity", "length",
|
||||||
|
"name",
|
||||||
|
"arguments",
|
||||||
|
"caller",
|
||||||
|
"callee",
|
||||||
|
"prototype",
|
||||||
|
"__isPromisified__"
|
||||||
|
];
|
||||||
|
var noCopyPropsPattern = new RegExp("^(?:" + noCopyProps.join("|") + ")$");
|
||||||
|
|
||||||
|
var defaultFilter = function(name) {
|
||||||
|
return util.isIdentifier(name) &&
|
||||||
|
name.charAt(0) !== "_" &&
|
||||||
|
name !== "constructor";
|
||||||
|
};
|
||||||
|
|
||||||
|
function propsFilter(key) {
|
||||||
|
return !noCopyPropsPattern.test(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isPromisified(fn) {
|
||||||
|
try {
|
||||||
|
return fn.__isPromisified__ === true;
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function hasPromisified(obj, key, suffix) {
|
||||||
|
var val = util.getDataPropertyOrDefault(obj, key + suffix,
|
||||||
|
defaultPromisified);
|
||||||
|
return val ? isPromisified(val) : false;
|
||||||
|
}
|
||||||
|
function checkValid(ret, suffix, suffixRegexp) {
|
||||||
|
for (var i = 0; i < ret.length; i += 2) {
|
||||||
|
var key = ret[i];
|
||||||
|
if (suffixRegexp.test(key)) {
|
||||||
|
var keyWithoutAsyncSuffix = key.replace(suffixRegexp, "");
|
||||||
|
for (var j = 0; j < ret.length; j += 2) {
|
||||||
|
if (ret[j] === keyWithoutAsyncSuffix) {
|
||||||
|
throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\u000a\u000a See http://goo.gl/MqrFmX\u000a"
|
||||||
|
.replace("%s", suffix));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function promisifiableMethods(obj, suffix, suffixRegexp, filter) {
|
||||||
|
var keys = util.inheritedDataKeys(obj);
|
||||||
|
var ret = [];
|
||||||
|
for (var i = 0; i < keys.length; ++i) {
|
||||||
|
var key = keys[i];
|
||||||
|
var value = obj[key];
|
||||||
|
var passesDefaultFilter = filter === defaultFilter
|
||||||
|
? true : defaultFilter(key, value, obj);
|
||||||
|
if (typeof value === "function" &&
|
||||||
|
!isPromisified(value) &&
|
||||||
|
!hasPromisified(obj, key, suffix) &&
|
||||||
|
filter(key, value, obj, passesDefaultFilter)) {
|
||||||
|
ret.push(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
checkValid(ret, suffix, suffixRegexp);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
var escapeIdentRegex = function(str) {
|
||||||
|
return str.replace(/([$])/, "\\$");
|
||||||
|
};
|
||||||
|
|
||||||
|
var makeNodePromisifiedEval;
|
||||||
|
if (!false) {
|
||||||
|
var switchCaseArgumentOrder = function(likelyArgumentCount) {
|
||||||
|
var ret = [likelyArgumentCount];
|
||||||
|
var min = Math.max(0, likelyArgumentCount - 1 - 3);
|
||||||
|
for(var i = likelyArgumentCount - 1; i >= min; --i) {
|
||||||
|
ret.push(i);
|
||||||
|
}
|
||||||
|
for(var i = likelyArgumentCount + 1; i <= 3; ++i) {
|
||||||
|
ret.push(i);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
|
var argumentSequence = function(argumentCount) {
|
||||||
|
return util.filledRange(argumentCount, "_arg", "");
|
||||||
|
};
|
||||||
|
|
||||||
|
var parameterDeclaration = function(parameterCount) {
|
||||||
|
return util.filledRange(
|
||||||
|
Math.max(parameterCount, 3), "_arg", "");
|
||||||
|
};
|
||||||
|
|
||||||
|
var parameterCount = function(fn) {
|
||||||
|
if (typeof fn.length === "number") {
|
||||||
|
return Math.max(Math.min(fn.length, 1023 + 1), 0);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
makeNodePromisifiedEval =
|
||||||
|
function(callback, receiver, originalName, fn, _, multiArgs) {
|
||||||
|
var newParameterCount = Math.max(0, parameterCount(fn) - 1);
|
||||||
|
var argumentOrder = switchCaseArgumentOrder(newParameterCount);
|
||||||
|
var shouldProxyThis = typeof callback === "string" || receiver === THIS;
|
||||||
|
|
||||||
|
function generateCallForArgumentCount(count) {
|
||||||
|
var args = argumentSequence(count).join(", ");
|
||||||
|
var comma = count > 0 ? ", " : "";
|
||||||
|
var ret;
|
||||||
|
if (shouldProxyThis) {
|
||||||
|
ret = "ret = callback.call(this, {{args}}, nodeback); break;\n";
|
||||||
|
} else {
|
||||||
|
ret = receiver === undefined
|
||||||
|
? "ret = callback({{args}}, nodeback); break;\n"
|
||||||
|
: "ret = callback.call(receiver, {{args}}, nodeback); break;\n";
|
||||||
|
}
|
||||||
|
return ret.replace("{{args}}", args).replace(", ", comma);
|
||||||
|
}
|
||||||
|
|
||||||
|
function generateArgumentSwitchCase() {
|
||||||
|
var ret = "";
|
||||||
|
for (var i = 0; i < argumentOrder.length; ++i) {
|
||||||
|
ret += "case " + argumentOrder[i] +":" +
|
||||||
|
generateCallForArgumentCount(argumentOrder[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
ret += " \n\
|
||||||
|
default: \n\
|
||||||
|
var args = new Array(len + 1); \n\
|
||||||
|
var i = 0; \n\
|
||||||
|
for (var i = 0; i < len; ++i) { \n\
|
||||||
|
args[i] = arguments[i]; \n\
|
||||||
|
} \n\
|
||||||
|
args[i] = nodeback; \n\
|
||||||
|
[CodeForCall] \n\
|
||||||
|
break; \n\
|
||||||
|
".replace("[CodeForCall]", (shouldProxyThis
|
||||||
|
? "ret = callback.apply(this, args);\n"
|
||||||
|
: "ret = callback.apply(receiver, args);\n"));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
var getFunctionCode = typeof callback === "string"
|
||||||
|
? ("this != null ? this['"+callback+"'] : fn")
|
||||||
|
: "fn";
|
||||||
|
var body = "'use strict'; \n\
|
||||||
|
var ret = function (Parameters) { \n\
|
||||||
|
'use strict'; \n\
|
||||||
|
var len = arguments.length; \n\
|
||||||
|
var promise = new Promise(INTERNAL); \n\
|
||||||
|
promise._captureStackTrace(); \n\
|
||||||
|
var nodeback = nodebackForPromise(promise, " + multiArgs + "); \n\
|
||||||
|
var ret; \n\
|
||||||
|
var callback = tryCatch([GetFunctionCode]); \n\
|
||||||
|
switch(len) { \n\
|
||||||
|
[CodeForSwitchCase] \n\
|
||||||
|
} \n\
|
||||||
|
if (ret === errorObj) { \n\
|
||||||
|
promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n\
|
||||||
|
} \n\
|
||||||
|
if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); \n\
|
||||||
|
return promise; \n\
|
||||||
|
}; \n\
|
||||||
|
notEnumerableProp(ret, '__isPromisified__', true); \n\
|
||||||
|
return ret; \n\
|
||||||
|
".replace("[CodeForSwitchCase]", generateArgumentSwitchCase())
|
||||||
|
.replace("[GetFunctionCode]", getFunctionCode);
|
||||||
|
body = body.replace("Parameters", parameterDeclaration(newParameterCount));
|
||||||
|
return new Function("Promise",
|
||||||
|
"fn",
|
||||||
|
"receiver",
|
||||||
|
"withAppended",
|
||||||
|
"maybeWrapAsError",
|
||||||
|
"nodebackForPromise",
|
||||||
|
"tryCatch",
|
||||||
|
"errorObj",
|
||||||
|
"notEnumerableProp",
|
||||||
|
"INTERNAL",
|
||||||
|
body)(
|
||||||
|
Promise,
|
||||||
|
fn,
|
||||||
|
receiver,
|
||||||
|
withAppended,
|
||||||
|
maybeWrapAsError,
|
||||||
|
nodebackForPromise,
|
||||||
|
util.tryCatch,
|
||||||
|
util.errorObj,
|
||||||
|
util.notEnumerableProp,
|
||||||
|
INTERNAL);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeNodePromisifiedClosure(callback, receiver, _, fn, __, multiArgs) {
|
||||||
|
var defaultThis = (function() {return this;})();
|
||||||
|
var method = callback;
|
||||||
|
if (typeof method === "string") {
|
||||||
|
callback = fn;
|
||||||
|
}
|
||||||
|
function promisified() {
|
||||||
|
var _receiver = receiver;
|
||||||
|
if (receiver === THIS) _receiver = this;
|
||||||
|
var promise = new Promise(INTERNAL);
|
||||||
|
promise._captureStackTrace();
|
||||||
|
var cb = typeof method === "string" && this !== defaultThis
|
||||||
|
? this[method] : callback;
|
||||||
|
var fn = nodebackForPromise(promise, multiArgs);
|
||||||
|
try {
|
||||||
|
cb.apply(_receiver, withAppended(arguments, fn));
|
||||||
|
} catch(e) {
|
||||||
|
promise._rejectCallback(maybeWrapAsError(e), true, true);
|
||||||
|
}
|
||||||
|
if (!promise._isFateSealed()) promise._setAsyncGuaranteed();
|
||||||
|
return promise;
|
||||||
|
}
|
||||||
|
util.notEnumerableProp(promisified, "__isPromisified__", true);
|
||||||
|
return promisified;
|
||||||
|
}
|
||||||
|
|
||||||
|
var makeNodePromisified = canEvaluate
|
||||||
|
? makeNodePromisifiedEval
|
||||||
|
: makeNodePromisifiedClosure;
|
||||||
|
|
||||||
|
function promisifyAll(obj, suffix, filter, promisifier, multiArgs) {
|
||||||
|
var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$");
|
||||||
|
var methods =
|
||||||
|
promisifiableMethods(obj, suffix, suffixRegexp, filter);
|
||||||
|
|
||||||
|
for (var i = 0, len = methods.length; i < len; i+= 2) {
|
||||||
|
var key = methods[i];
|
||||||
|
var fn = methods[i+1];
|
||||||
|
var promisifiedKey = key + suffix;
|
||||||
|
if (promisifier === makeNodePromisified) {
|
||||||
|
obj[promisifiedKey] =
|
||||||
|
makeNodePromisified(key, THIS, key, fn, suffix, multiArgs);
|
||||||
|
} else {
|
||||||
|
var promisified = promisifier(fn, function() {
|
||||||
|
return makeNodePromisified(key, THIS, key,
|
||||||
|
fn, suffix, multiArgs);
|
||||||
|
});
|
||||||
|
util.notEnumerableProp(promisified, "__isPromisified__", true);
|
||||||
|
obj[promisifiedKey] = promisified;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
util.toFastProperties(obj);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
function promisify(callback, receiver, multiArgs) {
|
||||||
|
return makeNodePromisified(callback, receiver, undefined,
|
||||||
|
callback, null, multiArgs);
|
||||||
|
}
|
||||||
|
|
||||||
|
Promise.promisify = function (fn, options) {
|
||||||
|
if (typeof fn !== "function") {
|
||||||
|
throw new TypeError("expecting a function but got " + util.classString(fn));
|
||||||
|
}
|
||||||
|
if (isPromisified(fn)) {
|
||||||
|
return fn;
|
||||||
|
}
|
||||||
|
options = Object(options);
|
||||||
|
var receiver = options.context === undefined ? THIS : options.context;
|
||||||
|
var multiArgs = !!options.multiArgs;
|
||||||
|
var ret = promisify(fn, receiver, multiArgs);
|
||||||
|
util.copyDescriptors(fn, ret, propsFilter);
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.promisifyAll = function (target, options) {
|
||||||
|
if (typeof target !== "function" && typeof target !== "object") {
|
||||||
|
throw new TypeError("the target of promisifyAll must be an object or a function\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
||||||
|
}
|
||||||
|
options = Object(options);
|
||||||
|
var multiArgs = !!options.multiArgs;
|
||||||
|
var suffix = options.suffix;
|
||||||
|
if (typeof suffix !== "string") suffix = defaultSuffix;
|
||||||
|
var filter = options.filter;
|
||||||
|
if (typeof filter !== "function") filter = defaultFilter;
|
||||||
|
var promisifier = options.promisifier;
|
||||||
|
if (typeof promisifier !== "function") promisifier = makeNodePromisified;
|
||||||
|
|
||||||
|
if (!util.isIdentifier(suffix)) {
|
||||||
|
throw new RangeError("suffix must be a valid identifier\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
||||||
|
}
|
||||||
|
|
||||||
|
var keys = util.inheritedDataKeys(target);
|
||||||
|
for (var i = 0; i < keys.length; ++i) {
|
||||||
|
var value = target[keys[i]];
|
||||||
|
if (keys[i] !== "constructor" &&
|
||||||
|
util.isClass(value)) {
|
||||||
|
promisifyAll(value.prototype, suffix, filter, promisifier,
|
||||||
|
multiArgs);
|
||||||
|
promisifyAll(value, suffix, filter, promisifier, multiArgs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return promisifyAll(target, suffix, filter, promisifier, multiArgs);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
118
node_modules/bluebird/js/release/props.js
generated
vendored
Normal file
118
node_modules/bluebird/js/release/props.js
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
"use strict";
|
||||||
|
module.exports = function(
|
||||||
|
Promise, PromiseArray, tryConvertToPromise, apiRejection) {
|
||||||
|
var util = require("./util");
|
||||||
|
var isObject = util.isObject;
|
||||||
|
var es5 = require("./es5");
|
||||||
|
var Es6Map;
|
||||||
|
if (typeof Map === "function") Es6Map = Map;
|
||||||
|
|
||||||
|
var mapToEntries = (function() {
|
||||||
|
var index = 0;
|
||||||
|
var size = 0;
|
||||||
|
|
||||||
|
function extractEntry(value, key) {
|
||||||
|
this[index] = value;
|
||||||
|
this[index + size] = key;
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return function mapToEntries(map) {
|
||||||
|
size = map.size;
|
||||||
|
index = 0;
|
||||||
|
var ret = new Array(map.size * 2);
|
||||||
|
map.forEach(extractEntry, ret);
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
|
var entriesToMap = function(entries) {
|
||||||
|
var ret = new Es6Map();
|
||||||
|
var length = entries.length / 2 | 0;
|
||||||
|
for (var i = 0; i < length; ++i) {
|
||||||
|
var key = entries[length + i];
|
||||||
|
var value = entries[i];
|
||||||
|
ret.set(key, value);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
|
function PropertiesPromiseArray(obj) {
|
||||||
|
var isMap = false;
|
||||||
|
var entries;
|
||||||
|
if (Es6Map !== undefined && obj instanceof Es6Map) {
|
||||||
|
entries = mapToEntries(obj);
|
||||||
|
isMap = true;
|
||||||
|
} else {
|
||||||
|
var keys = es5.keys(obj);
|
||||||
|
var len = keys.length;
|
||||||
|
entries = new Array(len * 2);
|
||||||
|
for (var i = 0; i < len; ++i) {
|
||||||
|
var key = keys[i];
|
||||||
|
entries[i] = obj[key];
|
||||||
|
entries[i + len] = key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.constructor$(entries);
|
||||||
|
this._isMap = isMap;
|
||||||
|
this._init$(undefined, isMap ? -6 : -3);
|
||||||
|
}
|
||||||
|
util.inherits(PropertiesPromiseArray, PromiseArray);
|
||||||
|
|
||||||
|
PropertiesPromiseArray.prototype._init = function () {};
|
||||||
|
|
||||||
|
PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) {
|
||||||
|
this._values[index] = value;
|
||||||
|
var totalResolved = ++this._totalResolved;
|
||||||
|
if (totalResolved >= this._length) {
|
||||||
|
var val;
|
||||||
|
if (this._isMap) {
|
||||||
|
val = entriesToMap(this._values);
|
||||||
|
} else {
|
||||||
|
val = {};
|
||||||
|
var keyOffset = this.length();
|
||||||
|
for (var i = 0, len = this.length(); i < len; ++i) {
|
||||||
|
val[this._values[i + keyOffset]] = this._values[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this._resolve(val);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
PropertiesPromiseArray.prototype.shouldCopyValues = function () {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
PropertiesPromiseArray.prototype.getActualLength = function (len) {
|
||||||
|
return len >> 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
function props(promises) {
|
||||||
|
var ret;
|
||||||
|
var castValue = tryConvertToPromise(promises);
|
||||||
|
|
||||||
|
if (!isObject(castValue)) {
|
||||||
|
return apiRejection("cannot await properties of a non-object\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
||||||
|
} else if (castValue instanceof Promise) {
|
||||||
|
ret = castValue._then(
|
||||||
|
Promise.props, undefined, undefined, undefined, undefined);
|
||||||
|
} else {
|
||||||
|
ret = new PropertiesPromiseArray(castValue).promise();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (castValue instanceof Promise) {
|
||||||
|
ret._propagateFrom(castValue, 2);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
Promise.prototype.props = function () {
|
||||||
|
return props(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.props = function (promises) {
|
||||||
|
return props(promises);
|
||||||
|
};
|
||||||
|
};
|
||||||
73
node_modules/bluebird/js/release/queue.js
generated
vendored
Normal file
73
node_modules/bluebird/js/release/queue.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
"use strict";
|
||||||
|
function arrayMove(src, srcIndex, dst, dstIndex, len) {
|
||||||
|
for (var j = 0; j < len; ++j) {
|
||||||
|
dst[j + dstIndex] = src[j + srcIndex];
|
||||||
|
src[j + srcIndex] = void 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Queue(capacity) {
|
||||||
|
this._capacity = capacity;
|
||||||
|
this._length = 0;
|
||||||
|
this._front = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Queue.prototype._willBeOverCapacity = function (size) {
|
||||||
|
return this._capacity < size;
|
||||||
|
};
|
||||||
|
|
||||||
|
Queue.prototype._pushOne = function (arg) {
|
||||||
|
var length = this.length();
|
||||||
|
this._checkCapacity(length + 1);
|
||||||
|
var i = (this._front + length) & (this._capacity - 1);
|
||||||
|
this[i] = arg;
|
||||||
|
this._length = length + 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
Queue.prototype.push = function (fn, receiver, arg) {
|
||||||
|
var length = this.length() + 3;
|
||||||
|
if (this._willBeOverCapacity(length)) {
|
||||||
|
this._pushOne(fn);
|
||||||
|
this._pushOne(receiver);
|
||||||
|
this._pushOne(arg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var j = this._front + length - 3;
|
||||||
|
this._checkCapacity(length);
|
||||||
|
var wrapMask = this._capacity - 1;
|
||||||
|
this[(j + 0) & wrapMask] = fn;
|
||||||
|
this[(j + 1) & wrapMask] = receiver;
|
||||||
|
this[(j + 2) & wrapMask] = arg;
|
||||||
|
this._length = length;
|
||||||
|
};
|
||||||
|
|
||||||
|
Queue.prototype.shift = function () {
|
||||||
|
var front = this._front,
|
||||||
|
ret = this[front];
|
||||||
|
|
||||||
|
this[front] = undefined;
|
||||||
|
this._front = (front + 1) & (this._capacity - 1);
|
||||||
|
this._length--;
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
|
Queue.prototype.length = function () {
|
||||||
|
return this._length;
|
||||||
|
};
|
||||||
|
|
||||||
|
Queue.prototype._checkCapacity = function (size) {
|
||||||
|
if (this._capacity < size) {
|
||||||
|
this._resizeTo(this._capacity << 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Queue.prototype._resizeTo = function (capacity) {
|
||||||
|
var oldCapacity = this._capacity;
|
||||||
|
this._capacity = capacity;
|
||||||
|
var front = this._front;
|
||||||
|
var length = this._length;
|
||||||
|
var moveItemsCount = (front + length) & (oldCapacity - 1);
|
||||||
|
arrayMove(this, 0, this, oldCapacity, moveItemsCount);
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = Queue;
|
||||||
49
node_modules/bluebird/js/release/race.js
generated
vendored
Normal file
49
node_modules/bluebird/js/release/race.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
"use strict";
|
||||||
|
module.exports = function(
|
||||||
|
Promise, INTERNAL, tryConvertToPromise, apiRejection) {
|
||||||
|
var util = require("./util");
|
||||||
|
|
||||||
|
var raceLater = function (promise) {
|
||||||
|
return promise.then(function(array) {
|
||||||
|
return race(array, promise);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
function race(promises, parent) {
|
||||||
|
var maybePromise = tryConvertToPromise(promises);
|
||||||
|
|
||||||
|
if (maybePromise instanceof Promise) {
|
||||||
|
return raceLater(maybePromise);
|
||||||
|
} else {
|
||||||
|
promises = util.asArray(promises);
|
||||||
|
if (promises === null)
|
||||||
|
return apiRejection("expecting an array or an iterable object but got " + util.classString(promises));
|
||||||
|
}
|
||||||
|
|
||||||
|
var ret = new Promise(INTERNAL);
|
||||||
|
if (parent !== undefined) {
|
||||||
|
ret._propagateFrom(parent, 3);
|
||||||
|
}
|
||||||
|
var fulfill = ret._fulfill;
|
||||||
|
var reject = ret._reject;
|
||||||
|
for (var i = 0, len = promises.length; i < len; ++i) {
|
||||||
|
var val = promises[i];
|
||||||
|
|
||||||
|
if (val === undefined && !(i in promises)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Promise.cast(val)._then(fulfill, reject, undefined, ret, null);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
Promise.race = function (promises) {
|
||||||
|
return race(promises, undefined);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.race = function () {
|
||||||
|
return race(this, undefined);
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
183
node_modules/bluebird/js/release/reduce.js
generated
vendored
Normal file
183
node_modules/bluebird/js/release/reduce.js
generated
vendored
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
"use strict";
|
||||||
|
module.exports = function(Promise,
|
||||||
|
PromiseArray,
|
||||||
|
apiRejection,
|
||||||
|
tryConvertToPromise,
|
||||||
|
INTERNAL,
|
||||||
|
debug) {
|
||||||
|
var util = require("./util");
|
||||||
|
var tryCatch = util.tryCatch;
|
||||||
|
|
||||||
|
function ReductionPromiseArray(promises, fn, initialValue, _each) {
|
||||||
|
this.constructor$(promises);
|
||||||
|
var context = Promise._getContext();
|
||||||
|
this._fn = util.contextBind(context, fn);
|
||||||
|
if (initialValue !== undefined) {
|
||||||
|
initialValue = Promise.resolve(initialValue);
|
||||||
|
initialValue._attachCancellationCallback(this);
|
||||||
|
}
|
||||||
|
this._initialValue = initialValue;
|
||||||
|
this._currentCancellable = null;
|
||||||
|
if(_each === INTERNAL) {
|
||||||
|
this._eachValues = Array(this._length);
|
||||||
|
} else if (_each === 0) {
|
||||||
|
this._eachValues = null;
|
||||||
|
} else {
|
||||||
|
this._eachValues = undefined;
|
||||||
|
}
|
||||||
|
this._promise._captureStackTrace();
|
||||||
|
this._init$(undefined, -5);
|
||||||
|
}
|
||||||
|
util.inherits(ReductionPromiseArray, PromiseArray);
|
||||||
|
|
||||||
|
ReductionPromiseArray.prototype._gotAccum = function(accum) {
|
||||||
|
if (this._eachValues !== undefined &&
|
||||||
|
this._eachValues !== null &&
|
||||||
|
accum !== INTERNAL) {
|
||||||
|
this._eachValues.push(accum);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ReductionPromiseArray.prototype._eachComplete = function(value) {
|
||||||
|
if (this._eachValues !== null) {
|
||||||
|
this._eachValues.push(value);
|
||||||
|
}
|
||||||
|
return this._eachValues;
|
||||||
|
};
|
||||||
|
|
||||||
|
ReductionPromiseArray.prototype._init = function() {};
|
||||||
|
|
||||||
|
ReductionPromiseArray.prototype._resolveEmptyArray = function() {
|
||||||
|
this._resolve(this._eachValues !== undefined ? this._eachValues
|
||||||
|
: this._initialValue);
|
||||||
|
};
|
||||||
|
|
||||||
|
ReductionPromiseArray.prototype.shouldCopyValues = function () {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
ReductionPromiseArray.prototype._resolve = function(value) {
|
||||||
|
this._promise._resolveCallback(value);
|
||||||
|
this._values = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
ReductionPromiseArray.prototype._resultCancelled = function(sender) {
|
||||||
|
if (sender === this._initialValue) return this._cancel();
|
||||||
|
if (this._isResolved()) return;
|
||||||
|
this._resultCancelled$();
|
||||||
|
if (this._currentCancellable instanceof Promise) {
|
||||||
|
this._currentCancellable.cancel();
|
||||||
|
}
|
||||||
|
if (this._initialValue instanceof Promise) {
|
||||||
|
this._initialValue.cancel();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ReductionPromiseArray.prototype._iterate = function (values) {
|
||||||
|
this._values = values;
|
||||||
|
var value;
|
||||||
|
var i;
|
||||||
|
var length = values.length;
|
||||||
|
if (this._initialValue !== undefined) {
|
||||||
|
value = this._initialValue;
|
||||||
|
i = 0;
|
||||||
|
} else {
|
||||||
|
value = Promise.resolve(values[0]);
|
||||||
|
i = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._currentCancellable = value;
|
||||||
|
|
||||||
|
for (var j = i; j < length; ++j) {
|
||||||
|
var maybePromise = values[j];
|
||||||
|
if (maybePromise instanceof Promise) {
|
||||||
|
maybePromise.suppressUnhandledRejections();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!value.isRejected()) {
|
||||||
|
for (; i < length; ++i) {
|
||||||
|
var ctx = {
|
||||||
|
accum: null,
|
||||||
|
value: values[i],
|
||||||
|
index: i,
|
||||||
|
length: length,
|
||||||
|
array: this
|
||||||
|
};
|
||||||
|
|
||||||
|
value = value._then(gotAccum, undefined, undefined, ctx, undefined);
|
||||||
|
|
||||||
|
if ((i & 127) === 0) {
|
||||||
|
value._setNoAsyncGuarantee();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._eachValues !== undefined) {
|
||||||
|
value = value
|
||||||
|
._then(this._eachComplete, undefined, undefined, this, undefined);
|
||||||
|
}
|
||||||
|
value._then(completed, completed, undefined, value, this);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.reduce = function (fn, initialValue) {
|
||||||
|
return reduce(this, fn, initialValue, null);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.reduce = function (promises, fn, initialValue, _each) {
|
||||||
|
return reduce(promises, fn, initialValue, _each);
|
||||||
|
};
|
||||||
|
|
||||||
|
function completed(valueOrReason, array) {
|
||||||
|
if (this.isFulfilled()) {
|
||||||
|
array._resolve(valueOrReason);
|
||||||
|
} else {
|
||||||
|
array._reject(valueOrReason);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function reduce(promises, fn, initialValue, _each) {
|
||||||
|
if (typeof fn !== "function") {
|
||||||
|
return apiRejection("expecting a function but got " + util.classString(fn));
|
||||||
|
}
|
||||||
|
var array = new ReductionPromiseArray(promises, fn, initialValue, _each);
|
||||||
|
return array.promise();
|
||||||
|
}
|
||||||
|
|
||||||
|
function gotAccum(accum) {
|
||||||
|
this.accum = accum;
|
||||||
|
this.array._gotAccum(accum);
|
||||||
|
var value = tryConvertToPromise(this.value, this.array._promise);
|
||||||
|
if (value instanceof Promise) {
|
||||||
|
this.array._currentCancellable = value;
|
||||||
|
return value._then(gotValue, undefined, undefined, this, undefined);
|
||||||
|
} else {
|
||||||
|
return gotValue.call(this, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function gotValue(value) {
|
||||||
|
var array = this.array;
|
||||||
|
var promise = array._promise;
|
||||||
|
var fn = tryCatch(array._fn);
|
||||||
|
promise._pushContext();
|
||||||
|
var ret;
|
||||||
|
if (array._eachValues !== undefined) {
|
||||||
|
ret = fn.call(promise._boundValue(), value, this.index, this.length);
|
||||||
|
} else {
|
||||||
|
ret = fn.call(promise._boundValue(),
|
||||||
|
this.accum, value, this.index, this.length);
|
||||||
|
}
|
||||||
|
if (ret instanceof Promise) {
|
||||||
|
array._currentCancellable = ret;
|
||||||
|
}
|
||||||
|
var promiseCreated = promise._popContext();
|
||||||
|
debug.checkForgottenReturns(
|
||||||
|
ret,
|
||||||
|
promiseCreated,
|
||||||
|
array._eachValues !== undefined ? "Promise.each" : "Promise.reduce",
|
||||||
|
promise
|
||||||
|
);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
};
|
||||||
62
node_modules/bluebird/js/release/schedule.js
generated
vendored
Normal file
62
node_modules/bluebird/js/release/schedule.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
"use strict";
|
||||||
|
var util = require("./util");
|
||||||
|
var schedule;
|
||||||
|
var noAsyncScheduler = function() {
|
||||||
|
throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
||||||
|
};
|
||||||
|
var NativePromise = util.getNativePromise();
|
||||||
|
if (util.isNode && typeof MutationObserver === "undefined") {
|
||||||
|
var GlobalSetImmediate = global.setImmediate;
|
||||||
|
var ProcessNextTick = process.nextTick;
|
||||||
|
schedule = util.isRecentNode
|
||||||
|
? function(fn) { GlobalSetImmediate.call(global, fn); }
|
||||||
|
: function(fn) { ProcessNextTick.call(process, fn); };
|
||||||
|
} else if (typeof NativePromise === "function" &&
|
||||||
|
typeof NativePromise.resolve === "function") {
|
||||||
|
var nativePromise = NativePromise.resolve();
|
||||||
|
schedule = function(fn) {
|
||||||
|
nativePromise.then(fn);
|
||||||
|
};
|
||||||
|
} else if ((typeof MutationObserver !== "undefined") &&
|
||||||
|
!(typeof window !== "undefined" &&
|
||||||
|
window.navigator &&
|
||||||
|
(window.navigator.standalone || window.cordova)) &&
|
||||||
|
("classList" in document.documentElement)) {
|
||||||
|
schedule = (function() {
|
||||||
|
var div = document.createElement("div");
|
||||||
|
var opts = {attributes: true};
|
||||||
|
var toggleScheduled = false;
|
||||||
|
var div2 = document.createElement("div");
|
||||||
|
var o2 = new MutationObserver(function() {
|
||||||
|
div.classList.toggle("foo");
|
||||||
|
toggleScheduled = false;
|
||||||
|
});
|
||||||
|
o2.observe(div2, opts);
|
||||||
|
|
||||||
|
var scheduleToggle = function() {
|
||||||
|
if (toggleScheduled) return;
|
||||||
|
toggleScheduled = true;
|
||||||
|
div2.classList.toggle("foo");
|
||||||
|
};
|
||||||
|
|
||||||
|
return function schedule(fn) {
|
||||||
|
var o = new MutationObserver(function() {
|
||||||
|
o.disconnect();
|
||||||
|
fn();
|
||||||
|
});
|
||||||
|
o.observe(div, opts);
|
||||||
|
scheduleToggle();
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
} else if (typeof setImmediate !== "undefined") {
|
||||||
|
schedule = function (fn) {
|
||||||
|
setImmediate(fn);
|
||||||
|
};
|
||||||
|
} else if (typeof setTimeout !== "undefined") {
|
||||||
|
schedule = function (fn) {
|
||||||
|
setTimeout(fn, 0);
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
schedule = noAsyncScheduler;
|
||||||
|
}
|
||||||
|
module.exports = schedule;
|
||||||
47
node_modules/bluebird/js/release/settle.js
generated
vendored
Normal file
47
node_modules/bluebird/js/release/settle.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
"use strict";
|
||||||
|
module.exports =
|
||||||
|
function(Promise, PromiseArray, debug) {
|
||||||
|
var PromiseInspection = Promise.PromiseInspection;
|
||||||
|
var util = require("./util");
|
||||||
|
|
||||||
|
function SettledPromiseArray(values) {
|
||||||
|
this.constructor$(values);
|
||||||
|
}
|
||||||
|
util.inherits(SettledPromiseArray, PromiseArray);
|
||||||
|
|
||||||
|
SettledPromiseArray.prototype._promiseResolved = function (index, inspection) {
|
||||||
|
this._values[index] = inspection;
|
||||||
|
var totalResolved = ++this._totalResolved;
|
||||||
|
if (totalResolved >= this._length) {
|
||||||
|
this._resolve(this._values);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
SettledPromiseArray.prototype._promiseFulfilled = function (value, index) {
|
||||||
|
var ret = new PromiseInspection();
|
||||||
|
ret._bitField = 33554432;
|
||||||
|
ret._settledValueField = value;
|
||||||
|
return this._promiseResolved(index, ret);
|
||||||
|
};
|
||||||
|
SettledPromiseArray.prototype._promiseRejected = function (reason, index) {
|
||||||
|
var ret = new PromiseInspection();
|
||||||
|
ret._bitField = 16777216;
|
||||||
|
ret._settledValueField = reason;
|
||||||
|
return this._promiseResolved(index, ret);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.settle = function (promises) {
|
||||||
|
debug.deprecated(".settle()", ".reflect()");
|
||||||
|
return new SettledPromiseArray(promises).promise();
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.allSettled = function (promises) {
|
||||||
|
return new SettledPromiseArray(promises).promise();
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.settle = function () {
|
||||||
|
return Promise.settle(this);
|
||||||
|
};
|
||||||
|
};
|
||||||
148
node_modules/bluebird/js/release/some.js
generated
vendored
Normal file
148
node_modules/bluebird/js/release/some.js
generated
vendored
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
"use strict";
|
||||||
|
module.exports =
|
||||||
|
function(Promise, PromiseArray, apiRejection) {
|
||||||
|
var util = require("./util");
|
||||||
|
var RangeError = require("./errors").RangeError;
|
||||||
|
var AggregateError = require("./errors").AggregateError;
|
||||||
|
var isArray = util.isArray;
|
||||||
|
var CANCELLATION = {};
|
||||||
|
|
||||||
|
|
||||||
|
function SomePromiseArray(values) {
|
||||||
|
this.constructor$(values);
|
||||||
|
this._howMany = 0;
|
||||||
|
this._unwrap = false;
|
||||||
|
this._initialized = false;
|
||||||
|
}
|
||||||
|
util.inherits(SomePromiseArray, PromiseArray);
|
||||||
|
|
||||||
|
SomePromiseArray.prototype._init = function () {
|
||||||
|
if (!this._initialized) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this._howMany === 0) {
|
||||||
|
this._resolve([]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this._init$(undefined, -5);
|
||||||
|
var isArrayResolved = isArray(this._values);
|
||||||
|
if (!this._isResolved() &&
|
||||||
|
isArrayResolved &&
|
||||||
|
this._howMany > this._canPossiblyFulfill()) {
|
||||||
|
this._reject(this._getRangeError(this.length()));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
SomePromiseArray.prototype.init = function () {
|
||||||
|
this._initialized = true;
|
||||||
|
this._init();
|
||||||
|
};
|
||||||
|
|
||||||
|
SomePromiseArray.prototype.setUnwrap = function () {
|
||||||
|
this._unwrap = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
SomePromiseArray.prototype.howMany = function () {
|
||||||
|
return this._howMany;
|
||||||
|
};
|
||||||
|
|
||||||
|
SomePromiseArray.prototype.setHowMany = function (count) {
|
||||||
|
this._howMany = count;
|
||||||
|
};
|
||||||
|
|
||||||
|
SomePromiseArray.prototype._promiseFulfilled = function (value) {
|
||||||
|
this._addFulfilled(value);
|
||||||
|
if (this._fulfilled() === this.howMany()) {
|
||||||
|
this._values.length = this.howMany();
|
||||||
|
if (this.howMany() === 1 && this._unwrap) {
|
||||||
|
this._resolve(this._values[0]);
|
||||||
|
} else {
|
||||||
|
this._resolve(this._values);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
};
|
||||||
|
SomePromiseArray.prototype._promiseRejected = function (reason) {
|
||||||
|
this._addRejected(reason);
|
||||||
|
return this._checkOutcome();
|
||||||
|
};
|
||||||
|
|
||||||
|
SomePromiseArray.prototype._promiseCancelled = function () {
|
||||||
|
if (this._values instanceof Promise || this._values == null) {
|
||||||
|
return this._cancel();
|
||||||
|
}
|
||||||
|
this._addRejected(CANCELLATION);
|
||||||
|
return this._checkOutcome();
|
||||||
|
};
|
||||||
|
|
||||||
|
SomePromiseArray.prototype._checkOutcome = function() {
|
||||||
|
if (this.howMany() > this._canPossiblyFulfill()) {
|
||||||
|
var e = new AggregateError();
|
||||||
|
for (var i = this.length(); i < this._values.length; ++i) {
|
||||||
|
if (this._values[i] !== CANCELLATION) {
|
||||||
|
e.push(this._values[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (e.length > 0) {
|
||||||
|
this._reject(e);
|
||||||
|
} else {
|
||||||
|
this._cancel();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
SomePromiseArray.prototype._fulfilled = function () {
|
||||||
|
return this._totalResolved;
|
||||||
|
};
|
||||||
|
|
||||||
|
SomePromiseArray.prototype._rejected = function () {
|
||||||
|
return this._values.length - this.length();
|
||||||
|
};
|
||||||
|
|
||||||
|
SomePromiseArray.prototype._addRejected = function (reason) {
|
||||||
|
this._values.push(reason);
|
||||||
|
};
|
||||||
|
|
||||||
|
SomePromiseArray.prototype._addFulfilled = function (value) {
|
||||||
|
this._values[this._totalResolved++] = value;
|
||||||
|
};
|
||||||
|
|
||||||
|
SomePromiseArray.prototype._canPossiblyFulfill = function () {
|
||||||
|
return this.length() - this._rejected();
|
||||||
|
};
|
||||||
|
|
||||||
|
SomePromiseArray.prototype._getRangeError = function (count) {
|
||||||
|
var message = "Input array must contain at least " +
|
||||||
|
this._howMany + " items but contains only " + count + " items";
|
||||||
|
return new RangeError(message);
|
||||||
|
};
|
||||||
|
|
||||||
|
SomePromiseArray.prototype._resolveEmptyArray = function () {
|
||||||
|
this._reject(this._getRangeError(0));
|
||||||
|
};
|
||||||
|
|
||||||
|
function some(promises, howMany) {
|
||||||
|
if ((howMany | 0) !== howMany || howMany < 0) {
|
||||||
|
return apiRejection("expecting a positive integer\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
||||||
|
}
|
||||||
|
var ret = new SomePromiseArray(promises);
|
||||||
|
var promise = ret.promise();
|
||||||
|
ret.setHowMany(howMany);
|
||||||
|
ret.init();
|
||||||
|
return promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
Promise.some = function (promises, howMany) {
|
||||||
|
return some(promises, howMany);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.some = function (howMany) {
|
||||||
|
return some(this, howMany);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise._SomePromiseArray = SomePromiseArray;
|
||||||
|
};
|
||||||
103
node_modules/bluebird/js/release/synchronous_inspection.js
generated
vendored
Normal file
103
node_modules/bluebird/js/release/synchronous_inspection.js
generated
vendored
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
"use strict";
|
||||||
|
module.exports = function(Promise) {
|
||||||
|
function PromiseInspection(promise) {
|
||||||
|
if (promise !== undefined) {
|
||||||
|
promise = promise._target();
|
||||||
|
this._bitField = promise._bitField;
|
||||||
|
this._settledValueField = promise._isFateSealed()
|
||||||
|
? promise._settledValue() : undefined;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this._bitField = 0;
|
||||||
|
this._settledValueField = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PromiseInspection.prototype._settledValue = function() {
|
||||||
|
return this._settledValueField;
|
||||||
|
};
|
||||||
|
|
||||||
|
var value = PromiseInspection.prototype.value = function () {
|
||||||
|
if (!this.isFulfilled()) {
|
||||||
|
throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
||||||
|
}
|
||||||
|
return this._settledValue();
|
||||||
|
};
|
||||||
|
|
||||||
|
var reason = PromiseInspection.prototype.error =
|
||||||
|
PromiseInspection.prototype.reason = function () {
|
||||||
|
if (!this.isRejected()) {
|
||||||
|
throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
||||||
|
}
|
||||||
|
return this._settledValue();
|
||||||
|
};
|
||||||
|
|
||||||
|
var isFulfilled = PromiseInspection.prototype.isFulfilled = function() {
|
||||||
|
return (this._bitField & 33554432) !== 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
var isRejected = PromiseInspection.prototype.isRejected = function () {
|
||||||
|
return (this._bitField & 16777216) !== 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
var isPending = PromiseInspection.prototype.isPending = function () {
|
||||||
|
return (this._bitField & 50397184) === 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
var isResolved = PromiseInspection.prototype.isResolved = function () {
|
||||||
|
return (this._bitField & 50331648) !== 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
PromiseInspection.prototype.isCancelled = function() {
|
||||||
|
return (this._bitField & 8454144) !== 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.__isCancelled = function() {
|
||||||
|
return (this._bitField & 65536) === 65536;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._isCancelled = function() {
|
||||||
|
return this._target().__isCancelled();
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.isCancelled = function() {
|
||||||
|
return (this._target()._bitField & 8454144) !== 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.isPending = function() {
|
||||||
|
return isPending.call(this._target());
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.isRejected = function() {
|
||||||
|
return isRejected.call(this._target());
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.isFulfilled = function() {
|
||||||
|
return isFulfilled.call(this._target());
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.isResolved = function() {
|
||||||
|
return isResolved.call(this._target());
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.value = function() {
|
||||||
|
return value.call(this._target());
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.reason = function() {
|
||||||
|
var target = this._target();
|
||||||
|
target._unsetRejectionIsUnhandled();
|
||||||
|
return reason.call(target);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._value = function() {
|
||||||
|
return this._settledValue();
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._reason = function() {
|
||||||
|
this._unsetRejectionIsUnhandled();
|
||||||
|
return this._settledValue();
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.PromiseInspection = PromiseInspection;
|
||||||
|
};
|
||||||
86
node_modules/bluebird/js/release/thenables.js
generated
vendored
Normal file
86
node_modules/bluebird/js/release/thenables.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
"use strict";
|
||||||
|
module.exports = function(Promise, INTERNAL) {
|
||||||
|
var util = require("./util");
|
||||||
|
var errorObj = util.errorObj;
|
||||||
|
var isObject = util.isObject;
|
||||||
|
|
||||||
|
function tryConvertToPromise(obj, context) {
|
||||||
|
if (isObject(obj)) {
|
||||||
|
if (obj instanceof Promise) return obj;
|
||||||
|
var then = getThen(obj);
|
||||||
|
if (then === errorObj) {
|
||||||
|
if (context) context._pushContext();
|
||||||
|
var ret = Promise.reject(then.e);
|
||||||
|
if (context) context._popContext();
|
||||||
|
return ret;
|
||||||
|
} else if (typeof then === "function") {
|
||||||
|
if (isAnyBluebirdPromise(obj)) {
|
||||||
|
var ret = new Promise(INTERNAL);
|
||||||
|
obj._then(
|
||||||
|
ret._fulfill,
|
||||||
|
ret._reject,
|
||||||
|
undefined,
|
||||||
|
ret,
|
||||||
|
null
|
||||||
|
);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
return doThenable(obj, then, context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
function doGetThen(obj) {
|
||||||
|
return obj.then;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getThen(obj) {
|
||||||
|
try {
|
||||||
|
return doGetThen(obj);
|
||||||
|
} catch (e) {
|
||||||
|
errorObj.e = e;
|
||||||
|
return errorObj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var hasProp = {}.hasOwnProperty;
|
||||||
|
function isAnyBluebirdPromise(obj) {
|
||||||
|
try {
|
||||||
|
return hasProp.call(obj, "_promise0");
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function doThenable(x, then, context) {
|
||||||
|
var promise = new Promise(INTERNAL);
|
||||||
|
var ret = promise;
|
||||||
|
if (context) context._pushContext();
|
||||||
|
promise._captureStackTrace();
|
||||||
|
if (context) context._popContext();
|
||||||
|
var synchronous = true;
|
||||||
|
var result = util.tryCatch(then).call(x, resolve, reject);
|
||||||
|
synchronous = false;
|
||||||
|
|
||||||
|
if (promise && result === errorObj) {
|
||||||
|
promise._rejectCallback(result.e, true, true);
|
||||||
|
promise = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolve(value) {
|
||||||
|
if (!promise) return;
|
||||||
|
promise._resolveCallback(value);
|
||||||
|
promise = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function reject(reason) {
|
||||||
|
if (!promise) return;
|
||||||
|
promise._rejectCallback(reason, synchronous, true);
|
||||||
|
promise = null;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
return tryConvertToPromise;
|
||||||
|
};
|
||||||
93
node_modules/bluebird/js/release/timers.js
generated
vendored
Normal file
93
node_modules/bluebird/js/release/timers.js
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
"use strict";
|
||||||
|
module.exports = function(Promise, INTERNAL, debug) {
|
||||||
|
var util = require("./util");
|
||||||
|
var TimeoutError = Promise.TimeoutError;
|
||||||
|
|
||||||
|
function HandleWrapper(handle) {
|
||||||
|
this.handle = handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
HandleWrapper.prototype._resultCancelled = function() {
|
||||||
|
clearTimeout(this.handle);
|
||||||
|
};
|
||||||
|
|
||||||
|
var afterValue = function(value) { return delay(+this).thenReturn(value); };
|
||||||
|
var delay = Promise.delay = function (ms, value) {
|
||||||
|
var ret;
|
||||||
|
var handle;
|
||||||
|
if (value !== undefined) {
|
||||||
|
ret = Promise.resolve(value)
|
||||||
|
._then(afterValue, null, null, ms, undefined);
|
||||||
|
if (debug.cancellation() && value instanceof Promise) {
|
||||||
|
ret._setOnCancel(value);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ret = new Promise(INTERNAL);
|
||||||
|
handle = setTimeout(function() { ret._fulfill(); }, +ms);
|
||||||
|
if (debug.cancellation()) {
|
||||||
|
ret._setOnCancel(new HandleWrapper(handle));
|
||||||
|
}
|
||||||
|
ret._captureStackTrace();
|
||||||
|
}
|
||||||
|
ret._setAsyncGuaranteed();
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.delay = function (ms) {
|
||||||
|
return delay(ms, this);
|
||||||
|
};
|
||||||
|
|
||||||
|
var afterTimeout = function (promise, message, parent) {
|
||||||
|
var err;
|
||||||
|
if (typeof message !== "string") {
|
||||||
|
if (message instanceof Error) {
|
||||||
|
err = message;
|
||||||
|
} else {
|
||||||
|
err = new TimeoutError("operation timed out");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
err = new TimeoutError(message);
|
||||||
|
}
|
||||||
|
util.markAsOriginatingFromRejection(err);
|
||||||
|
promise._attachExtraTrace(err);
|
||||||
|
promise._reject(err);
|
||||||
|
|
||||||
|
if (parent != null) {
|
||||||
|
parent.cancel();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function successClear(value) {
|
||||||
|
clearTimeout(this.handle);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function failureClear(reason) {
|
||||||
|
clearTimeout(this.handle);
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
|
||||||
|
Promise.prototype.timeout = function (ms, message) {
|
||||||
|
ms = +ms;
|
||||||
|
var ret, parent;
|
||||||
|
|
||||||
|
var handleWrapper = new HandleWrapper(setTimeout(function timeoutTimeout() {
|
||||||
|
if (ret.isPending()) {
|
||||||
|
afterTimeout(ret, message, parent);
|
||||||
|
}
|
||||||
|
}, ms));
|
||||||
|
|
||||||
|
if (debug.cancellation()) {
|
||||||
|
parent = this.then();
|
||||||
|
ret = parent._then(successClear, failureClear,
|
||||||
|
undefined, handleWrapper, undefined);
|
||||||
|
ret._setOnCancel(handleWrapper);
|
||||||
|
} else {
|
||||||
|
ret = this._then(successClear, failureClear,
|
||||||
|
undefined, handleWrapper, undefined);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
226
node_modules/bluebird/js/release/using.js
generated
vendored
Normal file
226
node_modules/bluebird/js/release/using.js
generated
vendored
Normal file
@@ -0,0 +1,226 @@
|
|||||||
|
"use strict";
|
||||||
|
module.exports = function (Promise, apiRejection, tryConvertToPromise,
|
||||||
|
createContext, INTERNAL, debug) {
|
||||||
|
var util = require("./util");
|
||||||
|
var TypeError = require("./errors").TypeError;
|
||||||
|
var inherits = require("./util").inherits;
|
||||||
|
var errorObj = util.errorObj;
|
||||||
|
var tryCatch = util.tryCatch;
|
||||||
|
var NULL = {};
|
||||||
|
|
||||||
|
function thrower(e) {
|
||||||
|
setTimeout(function(){throw e;}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function castPreservingDisposable(thenable) {
|
||||||
|
var maybePromise = tryConvertToPromise(thenable);
|
||||||
|
if (maybePromise !== thenable &&
|
||||||
|
typeof thenable._isDisposable === "function" &&
|
||||||
|
typeof thenable._getDisposer === "function" &&
|
||||||
|
thenable._isDisposable()) {
|
||||||
|
maybePromise._setDisposable(thenable._getDisposer());
|
||||||
|
}
|
||||||
|
return maybePromise;
|
||||||
|
}
|
||||||
|
function dispose(resources, inspection) {
|
||||||
|
var i = 0;
|
||||||
|
var len = resources.length;
|
||||||
|
var ret = new Promise(INTERNAL);
|
||||||
|
function iterator() {
|
||||||
|
if (i >= len) return ret._fulfill();
|
||||||
|
var maybePromise = castPreservingDisposable(resources[i++]);
|
||||||
|
if (maybePromise instanceof Promise &&
|
||||||
|
maybePromise._isDisposable()) {
|
||||||
|
try {
|
||||||
|
maybePromise = tryConvertToPromise(
|
||||||
|
maybePromise._getDisposer().tryDispose(inspection),
|
||||||
|
resources.promise);
|
||||||
|
} catch (e) {
|
||||||
|
return thrower(e);
|
||||||
|
}
|
||||||
|
if (maybePromise instanceof Promise) {
|
||||||
|
return maybePromise._then(iterator, thrower,
|
||||||
|
null, null, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
iterator();
|
||||||
|
}
|
||||||
|
iterator();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Disposer(data, promise, context) {
|
||||||
|
this._data = data;
|
||||||
|
this._promise = promise;
|
||||||
|
this._context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
Disposer.prototype.data = function () {
|
||||||
|
return this._data;
|
||||||
|
};
|
||||||
|
|
||||||
|
Disposer.prototype.promise = function () {
|
||||||
|
return this._promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
Disposer.prototype.resource = function () {
|
||||||
|
if (this.promise().isFulfilled()) {
|
||||||
|
return this.promise().value();
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
};
|
||||||
|
|
||||||
|
Disposer.prototype.tryDispose = function(inspection) {
|
||||||
|
var resource = this.resource();
|
||||||
|
var context = this._context;
|
||||||
|
if (context !== undefined) context._pushContext();
|
||||||
|
var ret = resource !== NULL
|
||||||
|
? this.doDispose(resource, inspection) : null;
|
||||||
|
if (context !== undefined) context._popContext();
|
||||||
|
this._promise._unsetDisposable();
|
||||||
|
this._data = null;
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
|
Disposer.isDisposer = function (d) {
|
||||||
|
return (d != null &&
|
||||||
|
typeof d.resource === "function" &&
|
||||||
|
typeof d.tryDispose === "function");
|
||||||
|
};
|
||||||
|
|
||||||
|
function FunctionDisposer(fn, promise, context) {
|
||||||
|
this.constructor$(fn, promise, context);
|
||||||
|
}
|
||||||
|
inherits(FunctionDisposer, Disposer);
|
||||||
|
|
||||||
|
FunctionDisposer.prototype.doDispose = function (resource, inspection) {
|
||||||
|
var fn = this.data();
|
||||||
|
return fn.call(resource, resource, inspection);
|
||||||
|
};
|
||||||
|
|
||||||
|
function maybeUnwrapDisposer(value) {
|
||||||
|
if (Disposer.isDisposer(value)) {
|
||||||
|
this.resources[this.index]._setDisposable(value);
|
||||||
|
return value.promise();
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ResourceList(length) {
|
||||||
|
this.length = length;
|
||||||
|
this.promise = null;
|
||||||
|
this[length-1] = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
ResourceList.prototype._resultCancelled = function() {
|
||||||
|
var len = this.length;
|
||||||
|
for (var i = 0; i < len; ++i) {
|
||||||
|
var item = this[i];
|
||||||
|
if (item instanceof Promise) {
|
||||||
|
item.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.using = function () {
|
||||||
|
var len = arguments.length;
|
||||||
|
if (len < 2) return apiRejection(
|
||||||
|
"you must pass at least 2 arguments to Promise.using");
|
||||||
|
var fn = arguments[len - 1];
|
||||||
|
if (typeof fn !== "function") {
|
||||||
|
return apiRejection("expecting a function but got " + util.classString(fn));
|
||||||
|
}
|
||||||
|
var input;
|
||||||
|
var spreadArgs = true;
|
||||||
|
if (len === 2 && Array.isArray(arguments[0])) {
|
||||||
|
input = arguments[0];
|
||||||
|
len = input.length;
|
||||||
|
spreadArgs = false;
|
||||||
|
} else {
|
||||||
|
input = arguments;
|
||||||
|
len--;
|
||||||
|
}
|
||||||
|
var resources = new ResourceList(len);
|
||||||
|
for (var i = 0; i < len; ++i) {
|
||||||
|
var resource = input[i];
|
||||||
|
if (Disposer.isDisposer(resource)) {
|
||||||
|
var disposer = resource;
|
||||||
|
resource = resource.promise();
|
||||||
|
resource._setDisposable(disposer);
|
||||||
|
} else {
|
||||||
|
var maybePromise = tryConvertToPromise(resource);
|
||||||
|
if (maybePromise instanceof Promise) {
|
||||||
|
resource =
|
||||||
|
maybePromise._then(maybeUnwrapDisposer, null, null, {
|
||||||
|
resources: resources,
|
||||||
|
index: i
|
||||||
|
}, undefined);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
resources[i] = resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
var reflectedResources = new Array(resources.length);
|
||||||
|
for (var i = 0; i < reflectedResources.length; ++i) {
|
||||||
|
reflectedResources[i] = Promise.resolve(resources[i]).reflect();
|
||||||
|
}
|
||||||
|
|
||||||
|
var resultPromise = Promise.all(reflectedResources)
|
||||||
|
.then(function(inspections) {
|
||||||
|
for (var i = 0; i < inspections.length; ++i) {
|
||||||
|
var inspection = inspections[i];
|
||||||
|
if (inspection.isRejected()) {
|
||||||
|
errorObj.e = inspection.error();
|
||||||
|
return errorObj;
|
||||||
|
} else if (!inspection.isFulfilled()) {
|
||||||
|
resultPromise.cancel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
inspections[i] = inspection.value();
|
||||||
|
}
|
||||||
|
promise._pushContext();
|
||||||
|
|
||||||
|
fn = tryCatch(fn);
|
||||||
|
var ret = spreadArgs
|
||||||
|
? fn.apply(undefined, inspections) : fn(inspections);
|
||||||
|
var promiseCreated = promise._popContext();
|
||||||
|
debug.checkForgottenReturns(
|
||||||
|
ret, promiseCreated, "Promise.using", promise);
|
||||||
|
return ret;
|
||||||
|
});
|
||||||
|
|
||||||
|
var promise = resultPromise.lastly(function() {
|
||||||
|
var inspection = new Promise.PromiseInspection(resultPromise);
|
||||||
|
return dispose(resources, inspection);
|
||||||
|
});
|
||||||
|
resources.promise = promise;
|
||||||
|
promise._setOnCancel(resources);
|
||||||
|
return promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._setDisposable = function (disposer) {
|
||||||
|
this._bitField = this._bitField | 131072;
|
||||||
|
this._disposer = disposer;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._isDisposable = function () {
|
||||||
|
return (this._bitField & 131072) > 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._getDisposer = function () {
|
||||||
|
return this._disposer;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype._unsetDisposable = function () {
|
||||||
|
this._bitField = this._bitField & (~131072);
|
||||||
|
this._disposer = undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.disposer = function (fn) {
|
||||||
|
if (typeof fn === "function") {
|
||||||
|
return new FunctionDisposer(fn, this, createContext());
|
||||||
|
}
|
||||||
|
throw new TypeError();
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
421
node_modules/bluebird/js/release/util.js
generated
vendored
Normal file
421
node_modules/bluebird/js/release/util.js
generated
vendored
Normal file
@@ -0,0 +1,421 @@
|
|||||||
|
"use strict";
|
||||||
|
var es5 = require("./es5");
|
||||||
|
var canEvaluate = typeof navigator == "undefined";
|
||||||
|
|
||||||
|
var errorObj = {e: {}};
|
||||||
|
var tryCatchTarget;
|
||||||
|
var globalObject = typeof self !== "undefined" ? self :
|
||||||
|
typeof window !== "undefined" ? window :
|
||||||
|
typeof global !== "undefined" ? global :
|
||||||
|
this !== undefined ? this : null;
|
||||||
|
|
||||||
|
function tryCatcher() {
|
||||||
|
try {
|
||||||
|
var target = tryCatchTarget;
|
||||||
|
tryCatchTarget = null;
|
||||||
|
return target.apply(this, arguments);
|
||||||
|
} catch (e) {
|
||||||
|
errorObj.e = e;
|
||||||
|
return errorObj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function tryCatch(fn) {
|
||||||
|
tryCatchTarget = fn;
|
||||||
|
return tryCatcher;
|
||||||
|
}
|
||||||
|
|
||||||
|
var inherits = function(Child, Parent) {
|
||||||
|
var hasProp = {}.hasOwnProperty;
|
||||||
|
|
||||||
|
function T() {
|
||||||
|
this.constructor = Child;
|
||||||
|
this.constructor$ = Parent;
|
||||||
|
for (var propertyName in Parent.prototype) {
|
||||||
|
if (hasProp.call(Parent.prototype, propertyName) &&
|
||||||
|
propertyName.charAt(propertyName.length-1) !== "$"
|
||||||
|
) {
|
||||||
|
this[propertyName + "$"] = Parent.prototype[propertyName];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
T.prototype = Parent.prototype;
|
||||||
|
Child.prototype = new T();
|
||||||
|
return Child.prototype;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
function isPrimitive(val) {
|
||||||
|
return val == null || val === true || val === false ||
|
||||||
|
typeof val === "string" || typeof val === "number";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function isObject(value) {
|
||||||
|
return typeof value === "function" ||
|
||||||
|
typeof value === "object" && value !== null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function maybeWrapAsError(maybeError) {
|
||||||
|
if (!isPrimitive(maybeError)) return maybeError;
|
||||||
|
|
||||||
|
return new Error(safeToString(maybeError));
|
||||||
|
}
|
||||||
|
|
||||||
|
function withAppended(target, appendee) {
|
||||||
|
var len = target.length;
|
||||||
|
var ret = new Array(len + 1);
|
||||||
|
var i;
|
||||||
|
for (i = 0; i < len; ++i) {
|
||||||
|
ret[i] = target[i];
|
||||||
|
}
|
||||||
|
ret[i] = appendee;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDataPropertyOrDefault(obj, key, defaultValue) {
|
||||||
|
if (es5.isES5) {
|
||||||
|
var desc = Object.getOwnPropertyDescriptor(obj, key);
|
||||||
|
|
||||||
|
if (desc != null) {
|
||||||
|
return desc.get == null && desc.set == null
|
||||||
|
? desc.value
|
||||||
|
: defaultValue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function notEnumerableProp(obj, name, value) {
|
||||||
|
if (isPrimitive(obj)) return obj;
|
||||||
|
var descriptor = {
|
||||||
|
value: value,
|
||||||
|
configurable: true,
|
||||||
|
enumerable: false,
|
||||||
|
writable: true
|
||||||
|
};
|
||||||
|
es5.defineProperty(obj, name, descriptor);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
function thrower(r) {
|
||||||
|
throw r;
|
||||||
|
}
|
||||||
|
|
||||||
|
var inheritedDataKeys = (function() {
|
||||||
|
var excludedPrototypes = [
|
||||||
|
Array.prototype,
|
||||||
|
Object.prototype,
|
||||||
|
Function.prototype
|
||||||
|
];
|
||||||
|
|
||||||
|
var isExcludedProto = function(val) {
|
||||||
|
for (var i = 0; i < excludedPrototypes.length; ++i) {
|
||||||
|
if (excludedPrototypes[i] === val) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (es5.isES5) {
|
||||||
|
var getKeys = Object.getOwnPropertyNames;
|
||||||
|
return function(obj) {
|
||||||
|
var ret = [];
|
||||||
|
var visitedKeys = Object.create(null);
|
||||||
|
while (obj != null && !isExcludedProto(obj)) {
|
||||||
|
var keys;
|
||||||
|
try {
|
||||||
|
keys = getKeys(obj);
|
||||||
|
} catch (e) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
for (var i = 0; i < keys.length; ++i) {
|
||||||
|
var key = keys[i];
|
||||||
|
if (visitedKeys[key]) continue;
|
||||||
|
visitedKeys[key] = true;
|
||||||
|
var desc = Object.getOwnPropertyDescriptor(obj, key);
|
||||||
|
if (desc != null && desc.get == null && desc.set == null) {
|
||||||
|
ret.push(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
obj = es5.getPrototypeOf(obj);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
var hasProp = {}.hasOwnProperty;
|
||||||
|
return function(obj) {
|
||||||
|
if (isExcludedProto(obj)) return [];
|
||||||
|
var ret = [];
|
||||||
|
|
||||||
|
/*jshint forin:false */
|
||||||
|
enumeration: for (var key in obj) {
|
||||||
|
if (hasProp.call(obj, key)) {
|
||||||
|
ret.push(key);
|
||||||
|
} else {
|
||||||
|
for (var i = 0; i < excludedPrototypes.length; ++i) {
|
||||||
|
if (hasProp.call(excludedPrototypes[i], key)) {
|
||||||
|
continue enumeration;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ret.push(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
||||||
|
var thisAssignmentPattern = /this\s*\.\s*\S+\s*=/;
|
||||||
|
function isClass(fn) {
|
||||||
|
try {
|
||||||
|
if (typeof fn === "function") {
|
||||||
|
var keys = es5.names(fn.prototype);
|
||||||
|
|
||||||
|
var hasMethods = es5.isES5 && keys.length > 1;
|
||||||
|
var hasMethodsOtherThanConstructor = keys.length > 0 &&
|
||||||
|
!(keys.length === 1 && keys[0] === "constructor");
|
||||||
|
var hasThisAssignmentAndStaticMethods =
|
||||||
|
thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0;
|
||||||
|
|
||||||
|
if (hasMethods || hasMethodsOtherThanConstructor ||
|
||||||
|
hasThisAssignmentAndStaticMethods) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function toFastProperties(obj) {
|
||||||
|
/*jshint -W027,-W055,-W031*/
|
||||||
|
function FakeConstructor() {}
|
||||||
|
FakeConstructor.prototype = obj;
|
||||||
|
var receiver = new FakeConstructor();
|
||||||
|
function ic() {
|
||||||
|
return typeof receiver.foo;
|
||||||
|
}
|
||||||
|
ic();
|
||||||
|
ic();
|
||||||
|
return obj;
|
||||||
|
eval(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
var rident = /^[a-z$_][a-z$_0-9]*$/i;
|
||||||
|
function isIdentifier(str) {
|
||||||
|
return rident.test(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
function filledRange(count, prefix, suffix) {
|
||||||
|
var ret = new Array(count);
|
||||||
|
for(var i = 0; i < count; ++i) {
|
||||||
|
ret[i] = prefix + i + suffix;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
function safeToString(obj) {
|
||||||
|
try {
|
||||||
|
return obj + "";
|
||||||
|
} catch (e) {
|
||||||
|
return "[no string representation]";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function isError(obj) {
|
||||||
|
return obj instanceof Error ||
|
||||||
|
(obj !== null &&
|
||||||
|
typeof obj === "object" &&
|
||||||
|
typeof obj.message === "string" &&
|
||||||
|
typeof obj.name === "string");
|
||||||
|
}
|
||||||
|
|
||||||
|
function markAsOriginatingFromRejection(e) {
|
||||||
|
try {
|
||||||
|
notEnumerableProp(e, "isOperational", true);
|
||||||
|
}
|
||||||
|
catch(ignore) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
function originatesFromRejection(e) {
|
||||||
|
if (e == null) return false;
|
||||||
|
return ((e instanceof Error["__BluebirdErrorTypes__"].OperationalError) ||
|
||||||
|
e["isOperational"] === true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function canAttachTrace(obj) {
|
||||||
|
return isError(obj) && es5.propertyIsWritable(obj, "stack");
|
||||||
|
}
|
||||||
|
|
||||||
|
var ensureErrorObject = (function() {
|
||||||
|
if (!("stack" in new Error())) {
|
||||||
|
return function(value) {
|
||||||
|
if (canAttachTrace(value)) return value;
|
||||||
|
try {throw new Error(safeToString(value));}
|
||||||
|
catch(err) {return err;}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return function(value) {
|
||||||
|
if (canAttachTrace(value)) return value;
|
||||||
|
return new Error(safeToString(value));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
function classString(obj) {
|
||||||
|
return {}.toString.call(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyDescriptors(from, to, filter) {
|
||||||
|
var keys = es5.names(from);
|
||||||
|
for (var i = 0; i < keys.length; ++i) {
|
||||||
|
var key = keys[i];
|
||||||
|
if (filter(key)) {
|
||||||
|
try {
|
||||||
|
es5.defineProperty(to, key, es5.getDescriptor(from, key));
|
||||||
|
} catch (ignore) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var asArray = function(v) {
|
||||||
|
if (es5.isArray(v)) {
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (typeof Symbol !== "undefined" && Symbol.iterator) {
|
||||||
|
var ArrayFrom = typeof Array.from === "function" ? function(v) {
|
||||||
|
return Array.from(v);
|
||||||
|
} : function(v) {
|
||||||
|
var ret = [];
|
||||||
|
var it = v[Symbol.iterator]();
|
||||||
|
var itResult;
|
||||||
|
while (!((itResult = it.next()).done)) {
|
||||||
|
ret.push(itResult.value);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
|
asArray = function(v) {
|
||||||
|
if (es5.isArray(v)) {
|
||||||
|
return v;
|
||||||
|
} else if (v != null && typeof v[Symbol.iterator] === "function") {
|
||||||
|
return ArrayFrom(v);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var isNode = typeof process !== "undefined" &&
|
||||||
|
classString(process).toLowerCase() === "[object process]";
|
||||||
|
|
||||||
|
var hasEnvVariables = typeof process !== "undefined" &&
|
||||||
|
typeof process.env !== "undefined";
|
||||||
|
|
||||||
|
function env(key) {
|
||||||
|
return hasEnvVariables ? process.env[key] : undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getNativePromise() {
|
||||||
|
if (typeof Promise === "function") {
|
||||||
|
try {
|
||||||
|
var promise = new Promise(function(){});
|
||||||
|
if (classString(promise) === "[object Promise]") {
|
||||||
|
return Promise;
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var reflectHandler;
|
||||||
|
function contextBind(ctx, cb) {
|
||||||
|
if (ctx === null ||
|
||||||
|
typeof cb !== "function" ||
|
||||||
|
cb === reflectHandler) {
|
||||||
|
return cb;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctx.domain !== null) {
|
||||||
|
cb = ctx.domain.bind(cb);
|
||||||
|
}
|
||||||
|
|
||||||
|
var async = ctx.async;
|
||||||
|
if (async !== null) {
|
||||||
|
var old = cb;
|
||||||
|
cb = function() {
|
||||||
|
var $_len = arguments.length + 2;var args = new Array($_len); for(var $_i = 2; $_i < $_len ; ++$_i) {args[$_i] = arguments[$_i - 2];};
|
||||||
|
args[0] = old;
|
||||||
|
args[1] = this;
|
||||||
|
return async.runInAsyncScope.apply(async, args);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return cb;
|
||||||
|
}
|
||||||
|
|
||||||
|
var ret = {
|
||||||
|
setReflectHandler: function(fn) {
|
||||||
|
reflectHandler = fn;
|
||||||
|
},
|
||||||
|
isClass: isClass,
|
||||||
|
isIdentifier: isIdentifier,
|
||||||
|
inheritedDataKeys: inheritedDataKeys,
|
||||||
|
getDataPropertyOrDefault: getDataPropertyOrDefault,
|
||||||
|
thrower: thrower,
|
||||||
|
isArray: es5.isArray,
|
||||||
|
asArray: asArray,
|
||||||
|
notEnumerableProp: notEnumerableProp,
|
||||||
|
isPrimitive: isPrimitive,
|
||||||
|
isObject: isObject,
|
||||||
|
isError: isError,
|
||||||
|
canEvaluate: canEvaluate,
|
||||||
|
errorObj: errorObj,
|
||||||
|
tryCatch: tryCatch,
|
||||||
|
inherits: inherits,
|
||||||
|
withAppended: withAppended,
|
||||||
|
maybeWrapAsError: maybeWrapAsError,
|
||||||
|
toFastProperties: toFastProperties,
|
||||||
|
filledRange: filledRange,
|
||||||
|
toString: safeToString,
|
||||||
|
canAttachTrace: canAttachTrace,
|
||||||
|
ensureErrorObject: ensureErrorObject,
|
||||||
|
originatesFromRejection: originatesFromRejection,
|
||||||
|
markAsOriginatingFromRejection: markAsOriginatingFromRejection,
|
||||||
|
classString: classString,
|
||||||
|
copyDescriptors: copyDescriptors,
|
||||||
|
isNode: isNode,
|
||||||
|
hasEnvVariables: hasEnvVariables,
|
||||||
|
env: env,
|
||||||
|
global: globalObject,
|
||||||
|
getNativePromise: getNativePromise,
|
||||||
|
contextBind: contextBind
|
||||||
|
};
|
||||||
|
ret.isRecentNode = ret.isNode && (function() {
|
||||||
|
var version;
|
||||||
|
if (process.versions && process.versions.node) {
|
||||||
|
version = process.versions.node.split(".").map(Number);
|
||||||
|
} else if (process.version) {
|
||||||
|
version = process.version.split(".").map(Number);
|
||||||
|
}
|
||||||
|
return (version[0] === 0 && version[1] > 10) || (version[0] > 0);
|
||||||
|
})();
|
||||||
|
ret.nodeSupportsAsyncResource = ret.isNode && (function() {
|
||||||
|
var supportsAsync = false;
|
||||||
|
try {
|
||||||
|
var res = require("async_hooks").AsyncResource;
|
||||||
|
supportsAsync = typeof res.prototype.runInAsyncScope === "function";
|
||||||
|
} catch (e) {
|
||||||
|
supportsAsync = false;
|
||||||
|
}
|
||||||
|
return supportsAsync;
|
||||||
|
})();
|
||||||
|
|
||||||
|
if (ret.isNode) ret.toFastProperties(process);
|
||||||
|
|
||||||
|
try {throw new Error(); } catch (e) {ret.lastLineError = e;}
|
||||||
|
module.exports = ret;
|
||||||
102
node_modules/bluebird/package.json
generated
vendored
Normal file
102
node_modules/bluebird/package.json
generated
vendored
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
{
|
||||||
|
"_from": "bluebird@^3.5.3",
|
||||||
|
"_id": "bluebird@3.7.1",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-DdmyoGCleJnkbp3nkbxTLJ18rjDsE4yCggEwKNXkeV123sPNfOCYeDoeuOY+F2FrSjO1YXcTU+dsy96KMy+gcg==",
|
||||||
|
"_location": "/bluebird",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "bluebird@^3.5.3",
|
||||||
|
"name": "bluebird",
|
||||||
|
"escapedName": "bluebird",
|
||||||
|
"rawSpec": "^3.5.3",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^3.5.3"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/pinterest-node-api"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.1.tgz",
|
||||||
|
"_shasum": "df70e302b471d7473489acf26a93d63b53f874de",
|
||||||
|
"_spec": "bluebird@^3.5.3",
|
||||||
|
"_where": "D:\\dev\\crossmap\\backend-services\\cm-app-pinterestapiclient\\node_modules\\pinterest-node-api",
|
||||||
|
"author": {
|
||||||
|
"name": "Petka Antonov",
|
||||||
|
"email": "petka_antonov@hotmail.com",
|
||||||
|
"url": "http://github.com/petkaantonov/"
|
||||||
|
},
|
||||||
|
"browser": "./js/browser/bluebird.js",
|
||||||
|
"bugs": {
|
||||||
|
"url": "http://github.com/petkaantonov/bluebird/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Full featured Promises/A+ implementation with exceptionally good performance",
|
||||||
|
"devDependencies": {
|
||||||
|
"acorn": "^6.0.2",
|
||||||
|
"acorn-walk": "^6.1.0",
|
||||||
|
"baconjs": "^0.7.43",
|
||||||
|
"bluebird": "^2.9.2",
|
||||||
|
"body-parser": "^1.10.2",
|
||||||
|
"browserify": "^8.1.1",
|
||||||
|
"cli-table": "~0.3.1",
|
||||||
|
"co": "^4.2.0",
|
||||||
|
"cross-spawn": "^0.2.3",
|
||||||
|
"glob": "^4.3.2",
|
||||||
|
"grunt-saucelabs": "~8.4.1",
|
||||||
|
"highland": "^2.3.0",
|
||||||
|
"istanbul": "^0.3.5",
|
||||||
|
"jshint": "^2.6.0",
|
||||||
|
"jshint-stylish": "~0.2.0",
|
||||||
|
"kefir": "^2.4.1",
|
||||||
|
"mkdirp": "~0.5.0",
|
||||||
|
"mocha": "~2.1",
|
||||||
|
"open": "~0.0.5",
|
||||||
|
"optimist": "~0.6.1",
|
||||||
|
"rimraf": "~2.2.6",
|
||||||
|
"rx": "^2.3.25",
|
||||||
|
"serve-static": "^1.7.1",
|
||||||
|
"sinon": "~1.7.3",
|
||||||
|
"uglify-js": "~2.4.16"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"js/browser",
|
||||||
|
"js/release",
|
||||||
|
"LICENSE"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/petkaantonov/bluebird",
|
||||||
|
"keywords": [
|
||||||
|
"promise",
|
||||||
|
"performance",
|
||||||
|
"promises",
|
||||||
|
"promises-a",
|
||||||
|
"promises-aplus",
|
||||||
|
"async",
|
||||||
|
"await",
|
||||||
|
"deferred",
|
||||||
|
"deferreds",
|
||||||
|
"future",
|
||||||
|
"flow control",
|
||||||
|
"dsl",
|
||||||
|
"fluent interface"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "./js/release/bluebird.js",
|
||||||
|
"name": "bluebird",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/petkaantonov/bluebird.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"generate-browser-core": "node tools/build.js --features=core --no-debug --release --zalgo --browser --minify && mv js/browser/bluebird.js js/browser/bluebird.core.js && mv js/browser/bluebird.min.js js/browser/bluebird.core.min.js",
|
||||||
|
"generate-browser-full": "node tools/build.js --no-clean --no-debug --release --browser --minify",
|
||||||
|
"istanbul": "istanbul",
|
||||||
|
"lint": "node scripts/jshint.js",
|
||||||
|
"prepublish": "npm run generate-browser-core && npm run generate-browser-full",
|
||||||
|
"test": "node --expose-gc tools/test.js"
|
||||||
|
},
|
||||||
|
"version": "3.7.1",
|
||||||
|
"webpack": "./js/release/bluebird.js"
|
||||||
|
}
|
||||||
609
node_modules/body-parser/HISTORY.md
generated
vendored
Normal file
609
node_modules/body-parser/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,609 @@
|
|||||||
|
1.19.0 / 2019-04-25
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: bytes@3.1.0
|
||||||
|
- Add petabyte (`pb`) support
|
||||||
|
* deps: http-errors@1.7.2
|
||||||
|
- Set constructor name when possible
|
||||||
|
- deps: setprototypeof@1.1.1
|
||||||
|
- deps: statuses@'>= 1.5.0 < 2'
|
||||||
|
* deps: iconv-lite@0.4.24
|
||||||
|
- Added encoding MIK
|
||||||
|
* deps: qs@6.7.0
|
||||||
|
- Fix parsing array brackets after index
|
||||||
|
* deps: raw-body@2.4.0
|
||||||
|
- deps: bytes@3.1.0
|
||||||
|
- deps: http-errors@1.7.2
|
||||||
|
- deps: iconv-lite@0.4.24
|
||||||
|
* deps: type-is@~1.6.17
|
||||||
|
- deps: mime-types@~2.1.24
|
||||||
|
- perf: prevent internal `throw` on invalid type
|
||||||
|
|
||||||
|
1.18.3 / 2018-05-14
|
||||||
|
===================
|
||||||
|
|
||||||
|
* Fix stack trace for strict json parse error
|
||||||
|
* deps: depd@~1.1.2
|
||||||
|
- perf: remove argument reassignment
|
||||||
|
* deps: http-errors@~1.6.3
|
||||||
|
- deps: depd@~1.1.2
|
||||||
|
- deps: setprototypeof@1.1.0
|
||||||
|
- deps: statuses@'>= 1.3.1 < 2'
|
||||||
|
* deps: iconv-lite@0.4.23
|
||||||
|
- Fix loading encoding with year appended
|
||||||
|
- Fix deprecation warnings on Node.js 10+
|
||||||
|
* deps: qs@6.5.2
|
||||||
|
* deps: raw-body@2.3.3
|
||||||
|
- deps: http-errors@1.6.3
|
||||||
|
- deps: iconv-lite@0.4.23
|
||||||
|
* deps: type-is@~1.6.16
|
||||||
|
- deps: mime-types@~2.1.18
|
||||||
|
|
||||||
|
1.18.2 / 2017-09-22
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: debug@2.6.9
|
||||||
|
* perf: remove argument reassignment
|
||||||
|
|
||||||
|
1.18.1 / 2017-09-12
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: content-type@~1.0.4
|
||||||
|
- perf: remove argument reassignment
|
||||||
|
- perf: skip parameter parsing when no parameters
|
||||||
|
* deps: iconv-lite@0.4.19
|
||||||
|
- Fix ISO-8859-1 regression
|
||||||
|
- Update Windows-1255
|
||||||
|
* deps: qs@6.5.1
|
||||||
|
- Fix parsing & compacting very deep objects
|
||||||
|
* deps: raw-body@2.3.2
|
||||||
|
- deps: iconv-lite@0.4.19
|
||||||
|
|
||||||
|
1.18.0 / 2017-09-08
|
||||||
|
===================
|
||||||
|
|
||||||
|
* Fix JSON strict violation error to match native parse error
|
||||||
|
* Include the `body` property on verify errors
|
||||||
|
* Include the `type` property on all generated errors
|
||||||
|
* Use `http-errors` to set status code on errors
|
||||||
|
* deps: bytes@3.0.0
|
||||||
|
* deps: debug@2.6.8
|
||||||
|
* deps: depd@~1.1.1
|
||||||
|
- Remove unnecessary `Buffer` loading
|
||||||
|
* deps: http-errors@~1.6.2
|
||||||
|
- deps: depd@1.1.1
|
||||||
|
* deps: iconv-lite@0.4.18
|
||||||
|
- Add support for React Native
|
||||||
|
- Add a warning if not loaded as utf-8
|
||||||
|
- Fix CESU-8 decoding in Node.js 8
|
||||||
|
- Improve speed of ISO-8859-1 encoding
|
||||||
|
* deps: qs@6.5.0
|
||||||
|
* deps: raw-body@2.3.1
|
||||||
|
- Use `http-errors` for standard emitted errors
|
||||||
|
- deps: bytes@3.0.0
|
||||||
|
- deps: iconv-lite@0.4.18
|
||||||
|
- perf: skip buffer decoding on overage chunk
|
||||||
|
* perf: prevent internal `throw` when missing charset
|
||||||
|
|
||||||
|
1.17.2 / 2017-05-17
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: debug@2.6.7
|
||||||
|
- Fix `DEBUG_MAX_ARRAY_LENGTH`
|
||||||
|
- deps: ms@2.0.0
|
||||||
|
* deps: type-is@~1.6.15
|
||||||
|
- deps: mime-types@~2.1.15
|
||||||
|
|
||||||
|
1.17.1 / 2017-03-06
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: qs@6.4.0
|
||||||
|
- Fix regression parsing keys starting with `[`
|
||||||
|
|
||||||
|
1.17.0 / 2017-03-01
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: http-errors@~1.6.1
|
||||||
|
- Make `message` property enumerable for `HttpError`s
|
||||||
|
- deps: setprototypeof@1.0.3
|
||||||
|
* deps: qs@6.3.1
|
||||||
|
- Fix compacting nested arrays
|
||||||
|
|
||||||
|
1.16.1 / 2017-02-10
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: debug@2.6.1
|
||||||
|
- Fix deprecation messages in WebStorm and other editors
|
||||||
|
- Undeprecate `DEBUG_FD` set to `1` or `2`
|
||||||
|
|
||||||
|
1.16.0 / 2017-01-17
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: debug@2.6.0
|
||||||
|
- Allow colors in workers
|
||||||
|
- Deprecated `DEBUG_FD` environment variable
|
||||||
|
- Fix error when running under React Native
|
||||||
|
- Use same color for same namespace
|
||||||
|
- deps: ms@0.7.2
|
||||||
|
* deps: http-errors@~1.5.1
|
||||||
|
- deps: inherits@2.0.3
|
||||||
|
- deps: setprototypeof@1.0.2
|
||||||
|
- deps: statuses@'>= 1.3.1 < 2'
|
||||||
|
* deps: iconv-lite@0.4.15
|
||||||
|
- Added encoding MS-31J
|
||||||
|
- Added encoding MS-932
|
||||||
|
- Added encoding MS-936
|
||||||
|
- Added encoding MS-949
|
||||||
|
- Added encoding MS-950
|
||||||
|
- Fix GBK/GB18030 handling of Euro character
|
||||||
|
* deps: qs@6.2.1
|
||||||
|
- Fix array parsing from skipping empty values
|
||||||
|
* deps: raw-body@~2.2.0
|
||||||
|
- deps: iconv-lite@0.4.15
|
||||||
|
* deps: type-is@~1.6.14
|
||||||
|
- deps: mime-types@~2.1.13
|
||||||
|
|
||||||
|
1.15.2 / 2016-06-19
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: bytes@2.4.0
|
||||||
|
* deps: content-type@~1.0.2
|
||||||
|
- perf: enable strict mode
|
||||||
|
* deps: http-errors@~1.5.0
|
||||||
|
- Use `setprototypeof` module to replace `__proto__` setting
|
||||||
|
- deps: statuses@'>= 1.3.0 < 2'
|
||||||
|
- perf: enable strict mode
|
||||||
|
* deps: qs@6.2.0
|
||||||
|
* deps: raw-body@~2.1.7
|
||||||
|
- deps: bytes@2.4.0
|
||||||
|
- perf: remove double-cleanup on happy path
|
||||||
|
* deps: type-is@~1.6.13
|
||||||
|
- deps: mime-types@~2.1.11
|
||||||
|
|
||||||
|
1.15.1 / 2016-05-05
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: bytes@2.3.0
|
||||||
|
- Drop partial bytes on all parsed units
|
||||||
|
- Fix parsing byte string that looks like hex
|
||||||
|
* deps: raw-body@~2.1.6
|
||||||
|
- deps: bytes@2.3.0
|
||||||
|
* deps: type-is@~1.6.12
|
||||||
|
- deps: mime-types@~2.1.10
|
||||||
|
|
||||||
|
1.15.0 / 2016-02-10
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: http-errors@~1.4.0
|
||||||
|
- Add `HttpError` export, for `err instanceof createError.HttpError`
|
||||||
|
- deps: inherits@2.0.1
|
||||||
|
- deps: statuses@'>= 1.2.1 < 2'
|
||||||
|
* deps: qs@6.1.0
|
||||||
|
* deps: type-is@~1.6.11
|
||||||
|
- deps: mime-types@~2.1.9
|
||||||
|
|
||||||
|
1.14.2 / 2015-12-16
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: bytes@2.2.0
|
||||||
|
* deps: iconv-lite@0.4.13
|
||||||
|
* deps: qs@5.2.0
|
||||||
|
* deps: raw-body@~2.1.5
|
||||||
|
- deps: bytes@2.2.0
|
||||||
|
- deps: iconv-lite@0.4.13
|
||||||
|
* deps: type-is@~1.6.10
|
||||||
|
- deps: mime-types@~2.1.8
|
||||||
|
|
||||||
|
1.14.1 / 2015-09-27
|
||||||
|
===================
|
||||||
|
|
||||||
|
* Fix issue where invalid charset results in 400 when `verify` used
|
||||||
|
* deps: iconv-lite@0.4.12
|
||||||
|
- Fix CESU-8 decoding in Node.js 4.x
|
||||||
|
* deps: raw-body@~2.1.4
|
||||||
|
- Fix masking critical errors from `iconv-lite`
|
||||||
|
- deps: iconv-lite@0.4.12
|
||||||
|
* deps: type-is@~1.6.9
|
||||||
|
- deps: mime-types@~2.1.7
|
||||||
|
|
||||||
|
1.14.0 / 2015-09-16
|
||||||
|
===================
|
||||||
|
|
||||||
|
* Fix JSON strict parse error to match syntax errors
|
||||||
|
* Provide static `require` analysis in `urlencoded` parser
|
||||||
|
* deps: depd@~1.1.0
|
||||||
|
- Support web browser loading
|
||||||
|
* deps: qs@5.1.0
|
||||||
|
* deps: raw-body@~2.1.3
|
||||||
|
- Fix sync callback when attaching data listener causes sync read
|
||||||
|
* deps: type-is@~1.6.8
|
||||||
|
- Fix type error when given invalid type to match against
|
||||||
|
- deps: mime-types@~2.1.6
|
||||||
|
|
||||||
|
1.13.3 / 2015-07-31
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: type-is@~1.6.6
|
||||||
|
- deps: mime-types@~2.1.4
|
||||||
|
|
||||||
|
1.13.2 / 2015-07-05
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: iconv-lite@0.4.11
|
||||||
|
* deps: qs@4.0.0
|
||||||
|
- Fix dropping parameters like `hasOwnProperty`
|
||||||
|
- Fix user-visible incompatibilities from 3.1.0
|
||||||
|
- Fix various parsing edge cases
|
||||||
|
* deps: raw-body@~2.1.2
|
||||||
|
- Fix error stack traces to skip `makeError`
|
||||||
|
- deps: iconv-lite@0.4.11
|
||||||
|
* deps: type-is@~1.6.4
|
||||||
|
- deps: mime-types@~2.1.2
|
||||||
|
- perf: enable strict mode
|
||||||
|
- perf: remove argument reassignment
|
||||||
|
|
||||||
|
1.13.1 / 2015-06-16
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: qs@2.4.2
|
||||||
|
- Downgraded from 3.1.0 because of user-visible incompatibilities
|
||||||
|
|
||||||
|
1.13.0 / 2015-06-14
|
||||||
|
===================
|
||||||
|
|
||||||
|
* Add `statusCode` property on `Error`s, in addition to `status`
|
||||||
|
* Change `type` default to `application/json` for JSON parser
|
||||||
|
* Change `type` default to `application/x-www-form-urlencoded` for urlencoded parser
|
||||||
|
* Provide static `require` analysis
|
||||||
|
* Use the `http-errors` module to generate errors
|
||||||
|
* deps: bytes@2.1.0
|
||||||
|
- Slight optimizations
|
||||||
|
* deps: iconv-lite@0.4.10
|
||||||
|
- The encoding UTF-16 without BOM now defaults to UTF-16LE when detection fails
|
||||||
|
- Leading BOM is now removed when decoding
|
||||||
|
* deps: on-finished@~2.3.0
|
||||||
|
- Add defined behavior for HTTP `CONNECT` requests
|
||||||
|
- Add defined behavior for HTTP `Upgrade` requests
|
||||||
|
- deps: ee-first@1.1.1
|
||||||
|
* deps: qs@3.1.0
|
||||||
|
- Fix dropping parameters like `hasOwnProperty`
|
||||||
|
- Fix various parsing edge cases
|
||||||
|
- Parsed object now has `null` prototype
|
||||||
|
* deps: raw-body@~2.1.1
|
||||||
|
- Use `unpipe` module for unpiping requests
|
||||||
|
- deps: iconv-lite@0.4.10
|
||||||
|
* deps: type-is@~1.6.3
|
||||||
|
- deps: mime-types@~2.1.1
|
||||||
|
- perf: reduce try block size
|
||||||
|
- perf: remove bitwise operations
|
||||||
|
* perf: enable strict mode
|
||||||
|
* perf: remove argument reassignment
|
||||||
|
* perf: remove delete call
|
||||||
|
|
||||||
|
1.12.4 / 2015-05-10
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: debug@~2.2.0
|
||||||
|
* deps: qs@2.4.2
|
||||||
|
- Fix allowing parameters like `constructor`
|
||||||
|
* deps: on-finished@~2.2.1
|
||||||
|
* deps: raw-body@~2.0.1
|
||||||
|
- Fix a false-positive when unpiping in Node.js 0.8
|
||||||
|
- deps: bytes@2.0.1
|
||||||
|
* deps: type-is@~1.6.2
|
||||||
|
- deps: mime-types@~2.0.11
|
||||||
|
|
||||||
|
1.12.3 / 2015-04-15
|
||||||
|
===================
|
||||||
|
|
||||||
|
* Slight efficiency improvement when not debugging
|
||||||
|
* deps: depd@~1.0.1
|
||||||
|
* deps: iconv-lite@0.4.8
|
||||||
|
- Add encoding alias UNICODE-1-1-UTF-7
|
||||||
|
* deps: raw-body@1.3.4
|
||||||
|
- Fix hanging callback if request aborts during read
|
||||||
|
- deps: iconv-lite@0.4.8
|
||||||
|
|
||||||
|
1.12.2 / 2015-03-16
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: qs@2.4.1
|
||||||
|
- Fix error when parameter `hasOwnProperty` is present
|
||||||
|
|
||||||
|
1.12.1 / 2015-03-15
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: debug@~2.1.3
|
||||||
|
- Fix high intensity foreground color for bold
|
||||||
|
- deps: ms@0.7.0
|
||||||
|
* deps: type-is@~1.6.1
|
||||||
|
- deps: mime-types@~2.0.10
|
||||||
|
|
||||||
|
1.12.0 / 2015-02-13
|
||||||
|
===================
|
||||||
|
|
||||||
|
* add `debug` messages
|
||||||
|
* accept a function for the `type` option
|
||||||
|
* use `content-type` to parse `Content-Type` headers
|
||||||
|
* deps: iconv-lite@0.4.7
|
||||||
|
- Gracefully support enumerables on `Object.prototype`
|
||||||
|
* deps: raw-body@1.3.3
|
||||||
|
- deps: iconv-lite@0.4.7
|
||||||
|
* deps: type-is@~1.6.0
|
||||||
|
- fix argument reassignment
|
||||||
|
- fix false-positives in `hasBody` `Transfer-Encoding` check
|
||||||
|
- support wildcard for both type and subtype (`*/*`)
|
||||||
|
- deps: mime-types@~2.0.9
|
||||||
|
|
||||||
|
1.11.0 / 2015-01-30
|
||||||
|
===================
|
||||||
|
|
||||||
|
* make internal `extended: true` depth limit infinity
|
||||||
|
* deps: type-is@~1.5.6
|
||||||
|
- deps: mime-types@~2.0.8
|
||||||
|
|
||||||
|
1.10.2 / 2015-01-20
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: iconv-lite@0.4.6
|
||||||
|
- Fix rare aliases of single-byte encodings
|
||||||
|
* deps: raw-body@1.3.2
|
||||||
|
- deps: iconv-lite@0.4.6
|
||||||
|
|
||||||
|
1.10.1 / 2015-01-01
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: on-finished@~2.2.0
|
||||||
|
* deps: type-is@~1.5.5
|
||||||
|
- deps: mime-types@~2.0.7
|
||||||
|
|
||||||
|
1.10.0 / 2014-12-02
|
||||||
|
===================
|
||||||
|
|
||||||
|
* make internal `extended: true` array limit dynamic
|
||||||
|
|
||||||
|
1.9.3 / 2014-11-21
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: iconv-lite@0.4.5
|
||||||
|
- Fix Windows-31J and X-SJIS encoding support
|
||||||
|
* deps: qs@2.3.3
|
||||||
|
- Fix `arrayLimit` behavior
|
||||||
|
* deps: raw-body@1.3.1
|
||||||
|
- deps: iconv-lite@0.4.5
|
||||||
|
* deps: type-is@~1.5.3
|
||||||
|
- deps: mime-types@~2.0.3
|
||||||
|
|
||||||
|
1.9.2 / 2014-10-27
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: qs@2.3.2
|
||||||
|
- Fix parsing of mixed objects and values
|
||||||
|
|
||||||
|
1.9.1 / 2014-10-22
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: on-finished@~2.1.1
|
||||||
|
- Fix handling of pipelined requests
|
||||||
|
* deps: qs@2.3.0
|
||||||
|
- Fix parsing of mixed implicit and explicit arrays
|
||||||
|
* deps: type-is@~1.5.2
|
||||||
|
- deps: mime-types@~2.0.2
|
||||||
|
|
||||||
|
1.9.0 / 2014-09-24
|
||||||
|
==================
|
||||||
|
|
||||||
|
* include the charset in "unsupported charset" error message
|
||||||
|
* include the encoding in "unsupported content encoding" error message
|
||||||
|
* deps: depd@~1.0.0
|
||||||
|
|
||||||
|
1.8.4 / 2014-09-23
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fix content encoding to be case-insensitive
|
||||||
|
|
||||||
|
1.8.3 / 2014-09-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: qs@2.2.4
|
||||||
|
- Fix issue with object keys starting with numbers truncated
|
||||||
|
|
||||||
|
1.8.2 / 2014-09-15
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: depd@0.4.5
|
||||||
|
|
||||||
|
1.8.1 / 2014-09-07
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: media-typer@0.3.0
|
||||||
|
* deps: type-is@~1.5.1
|
||||||
|
|
||||||
|
1.8.0 / 2014-09-05
|
||||||
|
==================
|
||||||
|
|
||||||
|
* make empty-body-handling consistent between chunked requests
|
||||||
|
- empty `json` produces `{}`
|
||||||
|
- empty `raw` produces `new Buffer(0)`
|
||||||
|
- empty `text` produces `''`
|
||||||
|
- empty `urlencoded` produces `{}`
|
||||||
|
* deps: qs@2.2.3
|
||||||
|
- Fix issue where first empty value in array is discarded
|
||||||
|
* deps: type-is@~1.5.0
|
||||||
|
- fix `hasbody` to be true for `content-length: 0`
|
||||||
|
|
||||||
|
1.7.0 / 2014-09-01
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add `parameterLimit` option to `urlencoded` parser
|
||||||
|
* change `urlencoded` extended array limit to 100
|
||||||
|
* respond with 413 when over `parameterLimit` in `urlencoded`
|
||||||
|
|
||||||
|
1.6.7 / 2014-08-29
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: qs@2.2.2
|
||||||
|
- Remove unnecessary cloning
|
||||||
|
|
||||||
|
1.6.6 / 2014-08-27
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: qs@2.2.0
|
||||||
|
- Array parsing fix
|
||||||
|
- Performance improvements
|
||||||
|
|
||||||
|
1.6.5 / 2014-08-16
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: on-finished@2.1.0
|
||||||
|
|
||||||
|
1.6.4 / 2014-08-14
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: qs@1.2.2
|
||||||
|
|
||||||
|
1.6.3 / 2014-08-10
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: qs@1.2.1
|
||||||
|
|
||||||
|
1.6.2 / 2014-08-07
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: qs@1.2.0
|
||||||
|
- Fix parsing array of objects
|
||||||
|
|
||||||
|
1.6.1 / 2014-08-06
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: qs@1.1.0
|
||||||
|
- Accept urlencoded square brackets
|
||||||
|
- Accept empty values in implicit array notation
|
||||||
|
|
||||||
|
1.6.0 / 2014-08-05
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: qs@1.0.2
|
||||||
|
- Complete rewrite
|
||||||
|
- Limits array length to 20
|
||||||
|
- Limits object depth to 5
|
||||||
|
- Limits parameters to 1,000
|
||||||
|
|
||||||
|
1.5.2 / 2014-07-27
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: depd@0.4.4
|
||||||
|
- Work-around v8 generating empty stack traces
|
||||||
|
|
||||||
|
1.5.1 / 2014-07-26
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: depd@0.4.3
|
||||||
|
- Fix exception when global `Error.stackTraceLimit` is too low
|
||||||
|
|
||||||
|
1.5.0 / 2014-07-20
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: depd@0.4.2
|
||||||
|
- Add `TRACE_DEPRECATION` environment variable
|
||||||
|
- Remove non-standard grey color from color output
|
||||||
|
- Support `--no-deprecation` argument
|
||||||
|
- Support `--trace-deprecation` argument
|
||||||
|
* deps: iconv-lite@0.4.4
|
||||||
|
- Added encoding UTF-7
|
||||||
|
* deps: raw-body@1.3.0
|
||||||
|
- deps: iconv-lite@0.4.4
|
||||||
|
- Added encoding UTF-7
|
||||||
|
- Fix `Cannot switch to old mode now` error on Node.js 0.10+
|
||||||
|
* deps: type-is@~1.3.2
|
||||||
|
|
||||||
|
1.4.3 / 2014-06-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: type-is@1.3.1
|
||||||
|
- fix global variable leak
|
||||||
|
|
||||||
|
1.4.2 / 2014-06-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: type-is@1.3.0
|
||||||
|
- improve type parsing
|
||||||
|
|
||||||
|
1.4.1 / 2014-06-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fix urlencoded extended deprecation message
|
||||||
|
|
||||||
|
1.4.0 / 2014-06-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add `text` parser
|
||||||
|
* add `raw` parser
|
||||||
|
* check accepted charset in content-type (accepts utf-8)
|
||||||
|
* check accepted encoding in content-encoding (accepts identity)
|
||||||
|
* deprecate `bodyParser()` middleware; use `.json()` and `.urlencoded()` as needed
|
||||||
|
* deprecate `urlencoded()` without provided `extended` option
|
||||||
|
* lazy-load urlencoded parsers
|
||||||
|
* parsers split into files for reduced mem usage
|
||||||
|
* support gzip and deflate bodies
|
||||||
|
- set `inflate: false` to turn off
|
||||||
|
* deps: raw-body@1.2.2
|
||||||
|
- Support all encodings from `iconv-lite`
|
||||||
|
|
||||||
|
1.3.1 / 2014-06-11
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: type-is@1.2.1
|
||||||
|
- Switch dependency from mime to mime-types@1.0.0
|
||||||
|
|
||||||
|
1.3.0 / 2014-05-31
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add `extended` option to urlencoded parser
|
||||||
|
|
||||||
|
1.2.2 / 2014-05-27
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: raw-body@1.1.6
|
||||||
|
- assert stream encoding on node.js 0.8
|
||||||
|
- assert stream encoding on node.js < 0.10.6
|
||||||
|
- deps: bytes@1
|
||||||
|
|
||||||
|
1.2.1 / 2014-05-26
|
||||||
|
==================
|
||||||
|
|
||||||
|
* invoke `next(err)` after request fully read
|
||||||
|
- prevents hung responses and socket hang ups
|
||||||
|
|
||||||
|
1.2.0 / 2014-05-11
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add `verify` option
|
||||||
|
* deps: type-is@1.2.0
|
||||||
|
- support suffix matching
|
||||||
|
|
||||||
|
1.1.2 / 2014-05-11
|
||||||
|
==================
|
||||||
|
|
||||||
|
* improve json parser speed
|
||||||
|
|
||||||
|
1.1.1 / 2014-05-11
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fix repeated limit parsing with every request
|
||||||
|
|
||||||
|
1.1.0 / 2014-05-10
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add `type` option
|
||||||
|
* deps: pin for safety and consistency
|
||||||
|
|
||||||
|
1.0.2 / 2014-04-14
|
||||||
|
==================
|
||||||
|
|
||||||
|
* use `type-is` module
|
||||||
|
|
||||||
|
1.0.1 / 2014-03-20
|
||||||
|
==================
|
||||||
|
|
||||||
|
* lower default limits to 100kb
|
||||||
23
node_modules/body-parser/LICENSE
generated
vendored
Normal file
23
node_modules/body-parser/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||||
|
Copyright (c) 2014-2015 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
'Software'), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
443
node_modules/body-parser/README.md
generated
vendored
Normal file
443
node_modules/body-parser/README.md
generated
vendored
Normal file
@@ -0,0 +1,443 @@
|
|||||||
|
# body-parser
|
||||||
|
|
||||||
|
[![NPM Version][npm-image]][npm-url]
|
||||||
|
[![NPM Downloads][downloads-image]][downloads-url]
|
||||||
|
[![Build Status][travis-image]][travis-url]
|
||||||
|
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||||
|
|
||||||
|
Node.js body parsing middleware.
|
||||||
|
|
||||||
|
Parse incoming request bodies in a middleware before your handlers, available
|
||||||
|
under the `req.body` property.
|
||||||
|
|
||||||
|
**Note** As `req.body`'s shape is based on user-controlled input, all
|
||||||
|
properties and values in this object are untrusted and should be validated
|
||||||
|
before trusting. For example, `req.body.foo.toString()` may fail in multiple
|
||||||
|
ways, for example the `foo` property may not be there or may not be a string,
|
||||||
|
and `toString` may not be a function and instead a string or other user input.
|
||||||
|
|
||||||
|
[Learn about the anatomy of an HTTP transaction in Node.js](https://nodejs.org/en/docs/guides/anatomy-of-an-http-transaction/).
|
||||||
|
|
||||||
|
_This does not handle multipart bodies_, due to their complex and typically
|
||||||
|
large nature. For multipart bodies, you may be interested in the following
|
||||||
|
modules:
|
||||||
|
|
||||||
|
* [busboy](https://www.npmjs.org/package/busboy#readme) and
|
||||||
|
[connect-busboy](https://www.npmjs.org/package/connect-busboy#readme)
|
||||||
|
* [multiparty](https://www.npmjs.org/package/multiparty#readme) and
|
||||||
|
[connect-multiparty](https://www.npmjs.org/package/connect-multiparty#readme)
|
||||||
|
* [formidable](https://www.npmjs.org/package/formidable#readme)
|
||||||
|
* [multer](https://www.npmjs.org/package/multer#readme)
|
||||||
|
|
||||||
|
This module provides the following parsers:
|
||||||
|
|
||||||
|
* [JSON body parser](#bodyparserjsonoptions)
|
||||||
|
* [Raw body parser](#bodyparserrawoptions)
|
||||||
|
* [Text body parser](#bodyparsertextoptions)
|
||||||
|
* [URL-encoded form body parser](#bodyparserurlencodedoptions)
|
||||||
|
|
||||||
|
Other body parsers you might be interested in:
|
||||||
|
|
||||||
|
- [body](https://www.npmjs.org/package/body#readme)
|
||||||
|
- [co-body](https://www.npmjs.org/package/co-body#readme)
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ npm install body-parser
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
<!-- eslint-disable no-unused-vars -->
|
||||||
|
|
||||||
|
```js
|
||||||
|
var bodyParser = require('body-parser')
|
||||||
|
```
|
||||||
|
|
||||||
|
The `bodyParser` object exposes various factories to create middlewares. All
|
||||||
|
middlewares will populate the `req.body` property with the parsed body when
|
||||||
|
the `Content-Type` request header matches the `type` option, or an empty
|
||||||
|
object (`{}`) if there was no body to parse, the `Content-Type` was not matched,
|
||||||
|
or an error occurred.
|
||||||
|
|
||||||
|
The various errors returned by this module are described in the
|
||||||
|
[errors section](#errors).
|
||||||
|
|
||||||
|
### bodyParser.json([options])
|
||||||
|
|
||||||
|
Returns middleware that only parses `json` and only looks at requests where
|
||||||
|
the `Content-Type` header matches the `type` option. This parser accepts any
|
||||||
|
Unicode encoding of the body and supports automatic inflation of `gzip` and
|
||||||
|
`deflate` encodings.
|
||||||
|
|
||||||
|
A new `body` object containing the parsed data is populated on the `request`
|
||||||
|
object after the middleware (i.e. `req.body`).
|
||||||
|
|
||||||
|
#### Options
|
||||||
|
|
||||||
|
The `json` function takes an optional `options` object that may contain any of
|
||||||
|
the following keys:
|
||||||
|
|
||||||
|
##### inflate
|
||||||
|
|
||||||
|
When set to `true`, then deflated (compressed) bodies will be inflated; when
|
||||||
|
`false`, deflated bodies are rejected. Defaults to `true`.
|
||||||
|
|
||||||
|
##### limit
|
||||||
|
|
||||||
|
Controls the maximum request body size. If this is a number, then the value
|
||||||
|
specifies the number of bytes; if it is a string, the value is passed to the
|
||||||
|
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
||||||
|
to `'100kb'`.
|
||||||
|
|
||||||
|
##### reviver
|
||||||
|
|
||||||
|
The `reviver` option is passed directly to `JSON.parse` as the second
|
||||||
|
argument. You can find more information on this argument
|
||||||
|
[in the MDN documentation about JSON.parse](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Example.3A_Using_the_reviver_parameter).
|
||||||
|
|
||||||
|
##### strict
|
||||||
|
|
||||||
|
When set to `true`, will only accept arrays and objects; when `false` will
|
||||||
|
accept anything `JSON.parse` accepts. Defaults to `true`.
|
||||||
|
|
||||||
|
##### type
|
||||||
|
|
||||||
|
The `type` option is used to determine what media type the middleware will
|
||||||
|
parse. This option can be a string, array of strings, or a function. If not a
|
||||||
|
function, `type` option is passed directly to the
|
||||||
|
[type-is](https://www.npmjs.org/package/type-is#readme) library and this can
|
||||||
|
be an extension name (like `json`), a mime type (like `application/json`), or
|
||||||
|
a mime type with a wildcard (like `*/*` or `*/json`). If a function, the `type`
|
||||||
|
option is called as `fn(req)` and the request is parsed if it returns a truthy
|
||||||
|
value. Defaults to `application/json`.
|
||||||
|
|
||||||
|
##### verify
|
||||||
|
|
||||||
|
The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`,
|
||||||
|
where `buf` is a `Buffer` of the raw request body and `encoding` is the
|
||||||
|
encoding of the request. The parsing can be aborted by throwing an error.
|
||||||
|
|
||||||
|
### bodyParser.raw([options])
|
||||||
|
|
||||||
|
Returns middleware that parses all bodies as a `Buffer` and only looks at
|
||||||
|
requests where the `Content-Type` header matches the `type` option. This
|
||||||
|
parser supports automatic inflation of `gzip` and `deflate` encodings.
|
||||||
|
|
||||||
|
A new `body` object containing the parsed data is populated on the `request`
|
||||||
|
object after the middleware (i.e. `req.body`). This will be a `Buffer` object
|
||||||
|
of the body.
|
||||||
|
|
||||||
|
#### Options
|
||||||
|
|
||||||
|
The `raw` function takes an optional `options` object that may contain any of
|
||||||
|
the following keys:
|
||||||
|
|
||||||
|
##### inflate
|
||||||
|
|
||||||
|
When set to `true`, then deflated (compressed) bodies will be inflated; when
|
||||||
|
`false`, deflated bodies are rejected. Defaults to `true`.
|
||||||
|
|
||||||
|
##### limit
|
||||||
|
|
||||||
|
Controls the maximum request body size. If this is a number, then the value
|
||||||
|
specifies the number of bytes; if it is a string, the value is passed to the
|
||||||
|
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
||||||
|
to `'100kb'`.
|
||||||
|
|
||||||
|
##### type
|
||||||
|
|
||||||
|
The `type` option is used to determine what media type the middleware will
|
||||||
|
parse. This option can be a string, array of strings, or a function.
|
||||||
|
If not a function, `type` option is passed directly to the
|
||||||
|
[type-is](https://www.npmjs.org/package/type-is#readme) library and this
|
||||||
|
can be an extension name (like `bin`), a mime type (like
|
||||||
|
`application/octet-stream`), or a mime type with a wildcard (like `*/*` or
|
||||||
|
`application/*`). If a function, the `type` option is called as `fn(req)`
|
||||||
|
and the request is parsed if it returns a truthy value. Defaults to
|
||||||
|
`application/octet-stream`.
|
||||||
|
|
||||||
|
##### verify
|
||||||
|
|
||||||
|
The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`,
|
||||||
|
where `buf` is a `Buffer` of the raw request body and `encoding` is the
|
||||||
|
encoding of the request. The parsing can be aborted by throwing an error.
|
||||||
|
|
||||||
|
### bodyParser.text([options])
|
||||||
|
|
||||||
|
Returns middleware that parses all bodies as a string and only looks at
|
||||||
|
requests where the `Content-Type` header matches the `type` option. This
|
||||||
|
parser supports automatic inflation of `gzip` and `deflate` encodings.
|
||||||
|
|
||||||
|
A new `body` string containing the parsed data is populated on the `request`
|
||||||
|
object after the middleware (i.e. `req.body`). This will be a string of the
|
||||||
|
body.
|
||||||
|
|
||||||
|
#### Options
|
||||||
|
|
||||||
|
The `text` function takes an optional `options` object that may contain any of
|
||||||
|
the following keys:
|
||||||
|
|
||||||
|
##### defaultCharset
|
||||||
|
|
||||||
|
Specify the default character set for the text content if the charset is not
|
||||||
|
specified in the `Content-Type` header of the request. Defaults to `utf-8`.
|
||||||
|
|
||||||
|
##### inflate
|
||||||
|
|
||||||
|
When set to `true`, then deflated (compressed) bodies will be inflated; when
|
||||||
|
`false`, deflated bodies are rejected. Defaults to `true`.
|
||||||
|
|
||||||
|
##### limit
|
||||||
|
|
||||||
|
Controls the maximum request body size. If this is a number, then the value
|
||||||
|
specifies the number of bytes; if it is a string, the value is passed to the
|
||||||
|
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
||||||
|
to `'100kb'`.
|
||||||
|
|
||||||
|
##### type
|
||||||
|
|
||||||
|
The `type` option is used to determine what media type the middleware will
|
||||||
|
parse. This option can be a string, array of strings, or a function. If not
|
||||||
|
a function, `type` option is passed directly to the
|
||||||
|
[type-is](https://www.npmjs.org/package/type-is#readme) library and this can
|
||||||
|
be an extension name (like `txt`), a mime type (like `text/plain`), or a mime
|
||||||
|
type with a wildcard (like `*/*` or `text/*`). If a function, the `type`
|
||||||
|
option is called as `fn(req)` and the request is parsed if it returns a
|
||||||
|
truthy value. Defaults to `text/plain`.
|
||||||
|
|
||||||
|
##### verify
|
||||||
|
|
||||||
|
The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`,
|
||||||
|
where `buf` is a `Buffer` of the raw request body and `encoding` is the
|
||||||
|
encoding of the request. The parsing can be aborted by throwing an error.
|
||||||
|
|
||||||
|
### bodyParser.urlencoded([options])
|
||||||
|
|
||||||
|
Returns middleware that only parses `urlencoded` bodies and only looks at
|
||||||
|
requests where the `Content-Type` header matches the `type` option. This
|
||||||
|
parser accepts only UTF-8 encoding of the body and supports automatic
|
||||||
|
inflation of `gzip` and `deflate` encodings.
|
||||||
|
|
||||||
|
A new `body` object containing the parsed data is populated on the `request`
|
||||||
|
object after the middleware (i.e. `req.body`). This object will contain
|
||||||
|
key-value pairs, where the value can be a string or array (when `extended` is
|
||||||
|
`false`), or any type (when `extended` is `true`).
|
||||||
|
|
||||||
|
#### Options
|
||||||
|
|
||||||
|
The `urlencoded` function takes an optional `options` object that may contain
|
||||||
|
any of the following keys:
|
||||||
|
|
||||||
|
##### extended
|
||||||
|
|
||||||
|
The `extended` option allows to choose between parsing the URL-encoded data
|
||||||
|
with the `querystring` library (when `false`) or the `qs` library (when
|
||||||
|
`true`). The "extended" syntax allows for rich objects and arrays to be
|
||||||
|
encoded into the URL-encoded format, allowing for a JSON-like experience
|
||||||
|
with URL-encoded. For more information, please
|
||||||
|
[see the qs library](https://www.npmjs.org/package/qs#readme).
|
||||||
|
|
||||||
|
Defaults to `true`, but using the default has been deprecated. Please
|
||||||
|
research into the difference between `qs` and `querystring` and choose the
|
||||||
|
appropriate setting.
|
||||||
|
|
||||||
|
##### inflate
|
||||||
|
|
||||||
|
When set to `true`, then deflated (compressed) bodies will be inflated; when
|
||||||
|
`false`, deflated bodies are rejected. Defaults to `true`.
|
||||||
|
|
||||||
|
##### limit
|
||||||
|
|
||||||
|
Controls the maximum request body size. If this is a number, then the value
|
||||||
|
specifies the number of bytes; if it is a string, the value is passed to the
|
||||||
|
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
||||||
|
to `'100kb'`.
|
||||||
|
|
||||||
|
##### parameterLimit
|
||||||
|
|
||||||
|
The `parameterLimit` option controls the maximum number of parameters that
|
||||||
|
are allowed in the URL-encoded data. If a request contains more parameters
|
||||||
|
than this value, a 413 will be returned to the client. Defaults to `1000`.
|
||||||
|
|
||||||
|
##### type
|
||||||
|
|
||||||
|
The `type` option is used to determine what media type the middleware will
|
||||||
|
parse. This option can be a string, array of strings, or a function. If not
|
||||||
|
a function, `type` option is passed directly to the
|
||||||
|
[type-is](https://www.npmjs.org/package/type-is#readme) library and this can
|
||||||
|
be an extension name (like `urlencoded`), a mime type (like
|
||||||
|
`application/x-www-form-urlencoded`), or a mime type with a wildcard (like
|
||||||
|
`*/x-www-form-urlencoded`). If a function, the `type` option is called as
|
||||||
|
`fn(req)` and the request is parsed if it returns a truthy value. Defaults
|
||||||
|
to `application/x-www-form-urlencoded`.
|
||||||
|
|
||||||
|
##### verify
|
||||||
|
|
||||||
|
The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`,
|
||||||
|
where `buf` is a `Buffer` of the raw request body and `encoding` is the
|
||||||
|
encoding of the request. The parsing can be aborted by throwing an error.
|
||||||
|
|
||||||
|
## Errors
|
||||||
|
|
||||||
|
The middlewares provided by this module create errors depending on the error
|
||||||
|
condition during parsing. The errors will typically have a `status`/`statusCode`
|
||||||
|
property that contains the suggested HTTP response code, an `expose` property
|
||||||
|
to determine if the `message` property should be displayed to the client, a
|
||||||
|
`type` property to determine the type of error without matching against the
|
||||||
|
`message`, and a `body` property containing the read body, if available.
|
||||||
|
|
||||||
|
The following are the common errors emitted, though any error can come through
|
||||||
|
for various reasons.
|
||||||
|
|
||||||
|
### content encoding unsupported
|
||||||
|
|
||||||
|
This error will occur when the request had a `Content-Encoding` header that
|
||||||
|
contained an encoding but the "inflation" option was set to `false`. The
|
||||||
|
`status` property is set to `415`, the `type` property is set to
|
||||||
|
`'encoding.unsupported'`, and the `charset` property will be set to the
|
||||||
|
encoding that is unsupported.
|
||||||
|
|
||||||
|
### request aborted
|
||||||
|
|
||||||
|
This error will occur when the request is aborted by the client before reading
|
||||||
|
the body has finished. The `received` property will be set to the number of
|
||||||
|
bytes received before the request was aborted and the `expected` property is
|
||||||
|
set to the number of expected bytes. The `status` property is set to `400`
|
||||||
|
and `type` property is set to `'request.aborted'`.
|
||||||
|
|
||||||
|
### request entity too large
|
||||||
|
|
||||||
|
This error will occur when the request body's size is larger than the "limit"
|
||||||
|
option. The `limit` property will be set to the byte limit and the `length`
|
||||||
|
property will be set to the request body's length. The `status` property is
|
||||||
|
set to `413` and the `type` property is set to `'entity.too.large'`.
|
||||||
|
|
||||||
|
### request size did not match content length
|
||||||
|
|
||||||
|
This error will occur when the request's length did not match the length from
|
||||||
|
the `Content-Length` header. This typically occurs when the request is malformed,
|
||||||
|
typically when the `Content-Length` header was calculated based on characters
|
||||||
|
instead of bytes. The `status` property is set to `400` and the `type` property
|
||||||
|
is set to `'request.size.invalid'`.
|
||||||
|
|
||||||
|
### stream encoding should not be set
|
||||||
|
|
||||||
|
This error will occur when something called the `req.setEncoding` method prior
|
||||||
|
to this middleware. This module operates directly on bytes only and you cannot
|
||||||
|
call `req.setEncoding` when using this module. The `status` property is set to
|
||||||
|
`500` and the `type` property is set to `'stream.encoding.set'`.
|
||||||
|
|
||||||
|
### too many parameters
|
||||||
|
|
||||||
|
This error will occur when the content of the request exceeds the configured
|
||||||
|
`parameterLimit` for the `urlencoded` parser. The `status` property is set to
|
||||||
|
`413` and the `type` property is set to `'parameters.too.many'`.
|
||||||
|
|
||||||
|
### unsupported charset "BOGUS"
|
||||||
|
|
||||||
|
This error will occur when the request had a charset parameter in the
|
||||||
|
`Content-Type` header, but the `iconv-lite` module does not support it OR the
|
||||||
|
parser does not support it. The charset is contained in the message as well
|
||||||
|
as in the `charset` property. The `status` property is set to `415`, the
|
||||||
|
`type` property is set to `'charset.unsupported'`, and the `charset` property
|
||||||
|
is set to the charset that is unsupported.
|
||||||
|
|
||||||
|
### unsupported content encoding "bogus"
|
||||||
|
|
||||||
|
This error will occur when the request had a `Content-Encoding` header that
|
||||||
|
contained an unsupported encoding. The encoding is contained in the message
|
||||||
|
as well as in the `encoding` property. The `status` property is set to `415`,
|
||||||
|
the `type` property is set to `'encoding.unsupported'`, and the `encoding`
|
||||||
|
property is set to the encoding that is unsupported.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
### Express/Connect top-level generic
|
||||||
|
|
||||||
|
This example demonstrates adding a generic JSON and URL-encoded parser as a
|
||||||
|
top-level middleware, which will parse the bodies of all incoming requests.
|
||||||
|
This is the simplest setup.
|
||||||
|
|
||||||
|
```js
|
||||||
|
var express = require('express')
|
||||||
|
var bodyParser = require('body-parser')
|
||||||
|
|
||||||
|
var app = express()
|
||||||
|
|
||||||
|
// parse application/x-www-form-urlencoded
|
||||||
|
app.use(bodyParser.urlencoded({ extended: false }))
|
||||||
|
|
||||||
|
// parse application/json
|
||||||
|
app.use(bodyParser.json())
|
||||||
|
|
||||||
|
app.use(function (req, res) {
|
||||||
|
res.setHeader('Content-Type', 'text/plain')
|
||||||
|
res.write('you posted:\n')
|
||||||
|
res.end(JSON.stringify(req.body, null, 2))
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
### Express route-specific
|
||||||
|
|
||||||
|
This example demonstrates adding body parsers specifically to the routes that
|
||||||
|
need them. In general, this is the most recommended way to use body-parser with
|
||||||
|
Express.
|
||||||
|
|
||||||
|
```js
|
||||||
|
var express = require('express')
|
||||||
|
var bodyParser = require('body-parser')
|
||||||
|
|
||||||
|
var app = express()
|
||||||
|
|
||||||
|
// create application/json parser
|
||||||
|
var jsonParser = bodyParser.json()
|
||||||
|
|
||||||
|
// create application/x-www-form-urlencoded parser
|
||||||
|
var urlencodedParser = bodyParser.urlencoded({ extended: false })
|
||||||
|
|
||||||
|
// POST /login gets urlencoded bodies
|
||||||
|
app.post('/login', urlencodedParser, function (req, res) {
|
||||||
|
res.send('welcome, ' + req.body.username)
|
||||||
|
})
|
||||||
|
|
||||||
|
// POST /api/users gets JSON bodies
|
||||||
|
app.post('/api/users', jsonParser, function (req, res) {
|
||||||
|
// create user in req.body
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
### Change accepted type for parsers
|
||||||
|
|
||||||
|
All the parsers accept a `type` option which allows you to change the
|
||||||
|
`Content-Type` that the middleware will parse.
|
||||||
|
|
||||||
|
```js
|
||||||
|
var express = require('express')
|
||||||
|
var bodyParser = require('body-parser')
|
||||||
|
|
||||||
|
var app = express()
|
||||||
|
|
||||||
|
// parse various different custom JSON types as JSON
|
||||||
|
app.use(bodyParser.json({ type: 'application/*+json' }))
|
||||||
|
|
||||||
|
// parse some custom thing into a Buffer
|
||||||
|
app.use(bodyParser.raw({ type: 'application/vnd.custom-type' }))
|
||||||
|
|
||||||
|
// parse an HTML body into a string
|
||||||
|
app.use(bodyParser.text({ type: 'text/html' }))
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
[MIT](LICENSE)
|
||||||
|
|
||||||
|
[npm-image]: https://img.shields.io/npm/v/body-parser.svg
|
||||||
|
[npm-url]: https://npmjs.org/package/body-parser
|
||||||
|
[travis-image]: https://img.shields.io/travis/expressjs/body-parser/master.svg
|
||||||
|
[travis-url]: https://travis-ci.org/expressjs/body-parser
|
||||||
|
[coveralls-image]: https://img.shields.io/coveralls/expressjs/body-parser/master.svg
|
||||||
|
[coveralls-url]: https://coveralls.io/r/expressjs/body-parser?branch=master
|
||||||
|
[downloads-image]: https://img.shields.io/npm/dm/body-parser.svg
|
||||||
|
[downloads-url]: https://npmjs.org/package/body-parser
|
||||||
157
node_modules/body-parser/index.js
generated
vendored
Normal file
157
node_modules/body-parser/index.js
generated
vendored
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
/*!
|
||||||
|
* body-parser
|
||||||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||||
|
* MIT Licensed
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
var deprecate = require('depd')('body-parser')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache of loaded parsers.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
var parsers = Object.create(null)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef Parsers
|
||||||
|
* @type {function}
|
||||||
|
* @property {function} json
|
||||||
|
* @property {function} raw
|
||||||
|
* @property {function} text
|
||||||
|
* @property {function} urlencoded
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module exports.
|
||||||
|
* @type {Parsers}
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports = module.exports = deprecate.function(bodyParser,
|
||||||
|
'bodyParser: use individual json/urlencoded middlewares')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JSON parser.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Object.defineProperty(exports, 'json', {
|
||||||
|
configurable: true,
|
||||||
|
enumerable: true,
|
||||||
|
get: createParserGetter('json')
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Raw parser.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Object.defineProperty(exports, 'raw', {
|
||||||
|
configurable: true,
|
||||||
|
enumerable: true,
|
||||||
|
get: createParserGetter('raw')
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Text parser.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Object.defineProperty(exports, 'text', {
|
||||||
|
configurable: true,
|
||||||
|
enumerable: true,
|
||||||
|
get: createParserGetter('text')
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URL-encoded parser.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Object.defineProperty(exports, 'urlencoded', {
|
||||||
|
configurable: true,
|
||||||
|
enumerable: true,
|
||||||
|
get: createParserGetter('urlencoded')
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a middleware to parse json and urlencoded bodies.
|
||||||
|
*
|
||||||
|
* @param {object} [options]
|
||||||
|
* @return {function}
|
||||||
|
* @deprecated
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function bodyParser (options) {
|
||||||
|
var opts = {}
|
||||||
|
|
||||||
|
// exclude type option
|
||||||
|
if (options) {
|
||||||
|
for (var prop in options) {
|
||||||
|
if (prop !== 'type') {
|
||||||
|
opts[prop] = options[prop]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var _urlencoded = exports.urlencoded(opts)
|
||||||
|
var _json = exports.json(opts)
|
||||||
|
|
||||||
|
return function bodyParser (req, res, next) {
|
||||||
|
_json(req, res, function (err) {
|
||||||
|
if (err) return next(err)
|
||||||
|
_urlencoded(req, res, next)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a getter for loading a parser.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function createParserGetter (name) {
|
||||||
|
return function get () {
|
||||||
|
return loadParser(name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load a parser module.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function loadParser (parserName) {
|
||||||
|
var parser = parsers[parserName]
|
||||||
|
|
||||||
|
if (parser !== undefined) {
|
||||||
|
return parser
|
||||||
|
}
|
||||||
|
|
||||||
|
// this uses a switch for static require analysis
|
||||||
|
switch (parserName) {
|
||||||
|
case 'json':
|
||||||
|
parser = require('./lib/types/json')
|
||||||
|
break
|
||||||
|
case 'raw':
|
||||||
|
parser = require('./lib/types/raw')
|
||||||
|
break
|
||||||
|
case 'text':
|
||||||
|
parser = require('./lib/types/text')
|
||||||
|
break
|
||||||
|
case 'urlencoded':
|
||||||
|
parser = require('./lib/types/urlencoded')
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
// store to prevent invoking require()
|
||||||
|
return (parsers[parserName] = parser)
|
||||||
|
}
|
||||||
181
node_modules/body-parser/lib/read.js
generated
vendored
Normal file
181
node_modules/body-parser/lib/read.js
generated
vendored
Normal file
@@ -0,0 +1,181 @@
|
|||||||
|
/*!
|
||||||
|
* body-parser
|
||||||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||||
|
* MIT Licensed
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
var createError = require('http-errors')
|
||||||
|
var getBody = require('raw-body')
|
||||||
|
var iconv = require('iconv-lite')
|
||||||
|
var onFinished = require('on-finished')
|
||||||
|
var zlib = require('zlib')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module exports.
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = read
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read a request into a buffer and parse.
|
||||||
|
*
|
||||||
|
* @param {object} req
|
||||||
|
* @param {object} res
|
||||||
|
* @param {function} next
|
||||||
|
* @param {function} parse
|
||||||
|
* @param {function} debug
|
||||||
|
* @param {object} options
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function read (req, res, next, parse, debug, options) {
|
||||||
|
var length
|
||||||
|
var opts = options
|
||||||
|
var stream
|
||||||
|
|
||||||
|
// flag as parsed
|
||||||
|
req._body = true
|
||||||
|
|
||||||
|
// read options
|
||||||
|
var encoding = opts.encoding !== null
|
||||||
|
? opts.encoding
|
||||||
|
: null
|
||||||
|
var verify = opts.verify
|
||||||
|
|
||||||
|
try {
|
||||||
|
// get the content stream
|
||||||
|
stream = contentstream(req, debug, opts.inflate)
|
||||||
|
length = stream.length
|
||||||
|
stream.length = undefined
|
||||||
|
} catch (err) {
|
||||||
|
return next(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// set raw-body options
|
||||||
|
opts.length = length
|
||||||
|
opts.encoding = verify
|
||||||
|
? null
|
||||||
|
: encoding
|
||||||
|
|
||||||
|
// assert charset is supported
|
||||||
|
if (opts.encoding === null && encoding !== null && !iconv.encodingExists(encoding)) {
|
||||||
|
return next(createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
|
||||||
|
charset: encoding.toLowerCase(),
|
||||||
|
type: 'charset.unsupported'
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
// read body
|
||||||
|
debug('read body')
|
||||||
|
getBody(stream, opts, function (error, body) {
|
||||||
|
if (error) {
|
||||||
|
var _error
|
||||||
|
|
||||||
|
if (error.type === 'encoding.unsupported') {
|
||||||
|
// echo back charset
|
||||||
|
_error = createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
|
||||||
|
charset: encoding.toLowerCase(),
|
||||||
|
type: 'charset.unsupported'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
// set status code on error
|
||||||
|
_error = createError(400, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
// read off entire request
|
||||||
|
stream.resume()
|
||||||
|
onFinished(req, function onfinished () {
|
||||||
|
next(createError(400, _error))
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// verify
|
||||||
|
if (verify) {
|
||||||
|
try {
|
||||||
|
debug('verify body')
|
||||||
|
verify(req, res, body, encoding)
|
||||||
|
} catch (err) {
|
||||||
|
next(createError(403, err, {
|
||||||
|
body: body,
|
||||||
|
type: err.type || 'entity.verify.failed'
|
||||||
|
}))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// parse
|
||||||
|
var str = body
|
||||||
|
try {
|
||||||
|
debug('parse body')
|
||||||
|
str = typeof body !== 'string' && encoding !== null
|
||||||
|
? iconv.decode(body, encoding)
|
||||||
|
: body
|
||||||
|
req.body = parse(str)
|
||||||
|
} catch (err) {
|
||||||
|
next(createError(400, err, {
|
||||||
|
body: str,
|
||||||
|
type: err.type || 'entity.parse.failed'
|
||||||
|
}))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
next()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the content stream of the request.
|
||||||
|
*
|
||||||
|
* @param {object} req
|
||||||
|
* @param {function} debug
|
||||||
|
* @param {boolean} [inflate=true]
|
||||||
|
* @return {object}
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function contentstream (req, debug, inflate) {
|
||||||
|
var encoding = (req.headers['content-encoding'] || 'identity').toLowerCase()
|
||||||
|
var length = req.headers['content-length']
|
||||||
|
var stream
|
||||||
|
|
||||||
|
debug('content-encoding "%s"', encoding)
|
||||||
|
|
||||||
|
if (inflate === false && encoding !== 'identity') {
|
||||||
|
throw createError(415, 'content encoding unsupported', {
|
||||||
|
encoding: encoding,
|
||||||
|
type: 'encoding.unsupported'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (encoding) {
|
||||||
|
case 'deflate':
|
||||||
|
stream = zlib.createInflate()
|
||||||
|
debug('inflate body')
|
||||||
|
req.pipe(stream)
|
||||||
|
break
|
||||||
|
case 'gzip':
|
||||||
|
stream = zlib.createGunzip()
|
||||||
|
debug('gunzip body')
|
||||||
|
req.pipe(stream)
|
||||||
|
break
|
||||||
|
case 'identity':
|
||||||
|
stream = req
|
||||||
|
stream.length = length
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
throw createError(415, 'unsupported content encoding "' + encoding + '"', {
|
||||||
|
encoding: encoding,
|
||||||
|
type: 'encoding.unsupported'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return stream
|
||||||
|
}
|
||||||
230
node_modules/body-parser/lib/types/json.js
generated
vendored
Normal file
230
node_modules/body-parser/lib/types/json.js
generated
vendored
Normal file
@@ -0,0 +1,230 @@
|
|||||||
|
/*!
|
||||||
|
* body-parser
|
||||||
|
* Copyright(c) 2014 Jonathan Ong
|
||||||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||||
|
* MIT Licensed
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
var bytes = require('bytes')
|
||||||
|
var contentType = require('content-type')
|
||||||
|
var createError = require('http-errors')
|
||||||
|
var debug = require('debug')('body-parser:json')
|
||||||
|
var read = require('../read')
|
||||||
|
var typeis = require('type-is')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module exports.
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = json
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RegExp to match the first non-space in a string.
|
||||||
|
*
|
||||||
|
* Allowed whitespace is defined in RFC 7159:
|
||||||
|
*
|
||||||
|
* ws = *(
|
||||||
|
* %x20 / ; Space
|
||||||
|
* %x09 / ; Horizontal tab
|
||||||
|
* %x0A / ; Line feed or New line
|
||||||
|
* %x0D ) ; Carriage return
|
||||||
|
*/
|
||||||
|
|
||||||
|
var FIRST_CHAR_REGEXP = /^[\x20\x09\x0a\x0d]*(.)/ // eslint-disable-line no-control-regex
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a middleware to parse JSON bodies.
|
||||||
|
*
|
||||||
|
* @param {object} [options]
|
||||||
|
* @return {function}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function json (options) {
|
||||||
|
var opts = options || {}
|
||||||
|
|
||||||
|
var limit = typeof opts.limit !== 'number'
|
||||||
|
? bytes.parse(opts.limit || '100kb')
|
||||||
|
: opts.limit
|
||||||
|
var inflate = opts.inflate !== false
|
||||||
|
var reviver = opts.reviver
|
||||||
|
var strict = opts.strict !== false
|
||||||
|
var type = opts.type || 'application/json'
|
||||||
|
var verify = opts.verify || false
|
||||||
|
|
||||||
|
if (verify !== false && typeof verify !== 'function') {
|
||||||
|
throw new TypeError('option verify must be function')
|
||||||
|
}
|
||||||
|
|
||||||
|
// create the appropriate type checking function
|
||||||
|
var shouldParse = typeof type !== 'function'
|
||||||
|
? typeChecker(type)
|
||||||
|
: type
|
||||||
|
|
||||||
|
function parse (body) {
|
||||||
|
if (body.length === 0) {
|
||||||
|
// special-case empty json body, as it's a common client-side mistake
|
||||||
|
// TODO: maybe make this configurable or part of "strict" option
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strict) {
|
||||||
|
var first = firstchar(body)
|
||||||
|
|
||||||
|
if (first !== '{' && first !== '[') {
|
||||||
|
debug('strict violation')
|
||||||
|
throw createStrictSyntaxError(body, first)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
debug('parse json')
|
||||||
|
return JSON.parse(body, reviver)
|
||||||
|
} catch (e) {
|
||||||
|
throw normalizeJsonSyntaxError(e, {
|
||||||
|
message: e.message,
|
||||||
|
stack: e.stack
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return function jsonParser (req, res, next) {
|
||||||
|
if (req._body) {
|
||||||
|
debug('body already parsed')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
req.body = req.body || {}
|
||||||
|
|
||||||
|
// skip requests without bodies
|
||||||
|
if (!typeis.hasBody(req)) {
|
||||||
|
debug('skip empty body')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
debug('content-type %j', req.headers['content-type'])
|
||||||
|
|
||||||
|
// determine if request should be parsed
|
||||||
|
if (!shouldParse(req)) {
|
||||||
|
debug('skip parsing')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// assert charset per RFC 7159 sec 8.1
|
||||||
|
var charset = getCharset(req) || 'utf-8'
|
||||||
|
if (charset.substr(0, 4) !== 'utf-') {
|
||||||
|
debug('invalid charset')
|
||||||
|
next(createError(415, 'unsupported charset "' + charset.toUpperCase() + '"', {
|
||||||
|
charset: charset,
|
||||||
|
type: 'charset.unsupported'
|
||||||
|
}))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// read
|
||||||
|
read(req, res, next, parse, debug, {
|
||||||
|
encoding: charset,
|
||||||
|
inflate: inflate,
|
||||||
|
limit: limit,
|
||||||
|
verify: verify
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create strict violation syntax error matching native error.
|
||||||
|
*
|
||||||
|
* @param {string} str
|
||||||
|
* @param {string} char
|
||||||
|
* @return {Error}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function createStrictSyntaxError (str, char) {
|
||||||
|
var index = str.indexOf(char)
|
||||||
|
var partial = str.substring(0, index) + '#'
|
||||||
|
|
||||||
|
try {
|
||||||
|
JSON.parse(partial); /* istanbul ignore next */ throw new SyntaxError('strict violation')
|
||||||
|
} catch (e) {
|
||||||
|
return normalizeJsonSyntaxError(e, {
|
||||||
|
message: e.message.replace('#', char),
|
||||||
|
stack: e.stack
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the first non-whitespace character in a string.
|
||||||
|
*
|
||||||
|
* @param {string} str
|
||||||
|
* @return {function}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function firstchar (str) {
|
||||||
|
return FIRST_CHAR_REGEXP.exec(str)[1]
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the charset of a request.
|
||||||
|
*
|
||||||
|
* @param {object} req
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getCharset (req) {
|
||||||
|
try {
|
||||||
|
return (contentType.parse(req).parameters.charset || '').toLowerCase()
|
||||||
|
} catch (e) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalize a SyntaxError for JSON.parse.
|
||||||
|
*
|
||||||
|
* @param {SyntaxError} error
|
||||||
|
* @param {object} obj
|
||||||
|
* @return {SyntaxError}
|
||||||
|
*/
|
||||||
|
|
||||||
|
function normalizeJsonSyntaxError (error, obj) {
|
||||||
|
var keys = Object.getOwnPropertyNames(error)
|
||||||
|
|
||||||
|
for (var i = 0; i < keys.length; i++) {
|
||||||
|
var key = keys[i]
|
||||||
|
if (key !== 'stack' && key !== 'message') {
|
||||||
|
delete error[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// replace stack before message for Node.js 0.10 and below
|
||||||
|
error.stack = obj.stack.replace(error.message, obj.message)
|
||||||
|
error.message = obj.message
|
||||||
|
|
||||||
|
return error
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the simple type checker.
|
||||||
|
*
|
||||||
|
* @param {string} type
|
||||||
|
* @return {function}
|
||||||
|
*/
|
||||||
|
|
||||||
|
function typeChecker (type) {
|
||||||
|
return function checkType (req) {
|
||||||
|
return Boolean(typeis(req, type))
|
||||||
|
}
|
||||||
|
}
|
||||||
101
node_modules/body-parser/lib/types/raw.js
generated
vendored
Normal file
101
node_modules/body-parser/lib/types/raw.js
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
/*!
|
||||||
|
* body-parser
|
||||||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||||
|
* MIT Licensed
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var bytes = require('bytes')
|
||||||
|
var debug = require('debug')('body-parser:raw')
|
||||||
|
var read = require('../read')
|
||||||
|
var typeis = require('type-is')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module exports.
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = raw
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a middleware to parse raw bodies.
|
||||||
|
*
|
||||||
|
* @param {object} [options]
|
||||||
|
* @return {function}
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function raw (options) {
|
||||||
|
var opts = options || {}
|
||||||
|
|
||||||
|
var inflate = opts.inflate !== false
|
||||||
|
var limit = typeof opts.limit !== 'number'
|
||||||
|
? bytes.parse(opts.limit || '100kb')
|
||||||
|
: opts.limit
|
||||||
|
var type = opts.type || 'application/octet-stream'
|
||||||
|
var verify = opts.verify || false
|
||||||
|
|
||||||
|
if (verify !== false && typeof verify !== 'function') {
|
||||||
|
throw new TypeError('option verify must be function')
|
||||||
|
}
|
||||||
|
|
||||||
|
// create the appropriate type checking function
|
||||||
|
var shouldParse = typeof type !== 'function'
|
||||||
|
? typeChecker(type)
|
||||||
|
: type
|
||||||
|
|
||||||
|
function parse (buf) {
|
||||||
|
return buf
|
||||||
|
}
|
||||||
|
|
||||||
|
return function rawParser (req, res, next) {
|
||||||
|
if (req._body) {
|
||||||
|
debug('body already parsed')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
req.body = req.body || {}
|
||||||
|
|
||||||
|
// skip requests without bodies
|
||||||
|
if (!typeis.hasBody(req)) {
|
||||||
|
debug('skip empty body')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
debug('content-type %j', req.headers['content-type'])
|
||||||
|
|
||||||
|
// determine if request should be parsed
|
||||||
|
if (!shouldParse(req)) {
|
||||||
|
debug('skip parsing')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// read
|
||||||
|
read(req, res, next, parse, debug, {
|
||||||
|
encoding: null,
|
||||||
|
inflate: inflate,
|
||||||
|
limit: limit,
|
||||||
|
verify: verify
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the simple type checker.
|
||||||
|
*
|
||||||
|
* @param {string} type
|
||||||
|
* @return {function}
|
||||||
|
*/
|
||||||
|
|
||||||
|
function typeChecker (type) {
|
||||||
|
return function checkType (req) {
|
||||||
|
return Boolean(typeis(req, type))
|
||||||
|
}
|
||||||
|
}
|
||||||
121
node_modules/body-parser/lib/types/text.js
generated
vendored
Normal file
121
node_modules/body-parser/lib/types/text.js
generated
vendored
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
/*!
|
||||||
|
* body-parser
|
||||||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||||
|
* MIT Licensed
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var bytes = require('bytes')
|
||||||
|
var contentType = require('content-type')
|
||||||
|
var debug = require('debug')('body-parser:text')
|
||||||
|
var read = require('../read')
|
||||||
|
var typeis = require('type-is')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module exports.
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = text
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a middleware to parse text bodies.
|
||||||
|
*
|
||||||
|
* @param {object} [options]
|
||||||
|
* @return {function}
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function text (options) {
|
||||||
|
var opts = options || {}
|
||||||
|
|
||||||
|
var defaultCharset = opts.defaultCharset || 'utf-8'
|
||||||
|
var inflate = opts.inflate !== false
|
||||||
|
var limit = typeof opts.limit !== 'number'
|
||||||
|
? bytes.parse(opts.limit || '100kb')
|
||||||
|
: opts.limit
|
||||||
|
var type = opts.type || 'text/plain'
|
||||||
|
var verify = opts.verify || false
|
||||||
|
|
||||||
|
if (verify !== false && typeof verify !== 'function') {
|
||||||
|
throw new TypeError('option verify must be function')
|
||||||
|
}
|
||||||
|
|
||||||
|
// create the appropriate type checking function
|
||||||
|
var shouldParse = typeof type !== 'function'
|
||||||
|
? typeChecker(type)
|
||||||
|
: type
|
||||||
|
|
||||||
|
function parse (buf) {
|
||||||
|
return buf
|
||||||
|
}
|
||||||
|
|
||||||
|
return function textParser (req, res, next) {
|
||||||
|
if (req._body) {
|
||||||
|
debug('body already parsed')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
req.body = req.body || {}
|
||||||
|
|
||||||
|
// skip requests without bodies
|
||||||
|
if (!typeis.hasBody(req)) {
|
||||||
|
debug('skip empty body')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
debug('content-type %j', req.headers['content-type'])
|
||||||
|
|
||||||
|
// determine if request should be parsed
|
||||||
|
if (!shouldParse(req)) {
|
||||||
|
debug('skip parsing')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// get charset
|
||||||
|
var charset = getCharset(req) || defaultCharset
|
||||||
|
|
||||||
|
// read
|
||||||
|
read(req, res, next, parse, debug, {
|
||||||
|
encoding: charset,
|
||||||
|
inflate: inflate,
|
||||||
|
limit: limit,
|
||||||
|
verify: verify
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the charset of a request.
|
||||||
|
*
|
||||||
|
* @param {object} req
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getCharset (req) {
|
||||||
|
try {
|
||||||
|
return (contentType.parse(req).parameters.charset || '').toLowerCase()
|
||||||
|
} catch (e) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the simple type checker.
|
||||||
|
*
|
||||||
|
* @param {string} type
|
||||||
|
* @return {function}
|
||||||
|
*/
|
||||||
|
|
||||||
|
function typeChecker (type) {
|
||||||
|
return function checkType (req) {
|
||||||
|
return Boolean(typeis(req, type))
|
||||||
|
}
|
||||||
|
}
|
||||||
284
node_modules/body-parser/lib/types/urlencoded.js
generated
vendored
Normal file
284
node_modules/body-parser/lib/types/urlencoded.js
generated
vendored
Normal file
@@ -0,0 +1,284 @@
|
|||||||
|
/*!
|
||||||
|
* body-parser
|
||||||
|
* Copyright(c) 2014 Jonathan Ong
|
||||||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||||
|
* MIT Licensed
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
var bytes = require('bytes')
|
||||||
|
var contentType = require('content-type')
|
||||||
|
var createError = require('http-errors')
|
||||||
|
var debug = require('debug')('body-parser:urlencoded')
|
||||||
|
var deprecate = require('depd')('body-parser')
|
||||||
|
var read = require('../read')
|
||||||
|
var typeis = require('type-is')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module exports.
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = urlencoded
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache of parser modules.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var parsers = Object.create(null)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a middleware to parse urlencoded bodies.
|
||||||
|
*
|
||||||
|
* @param {object} [options]
|
||||||
|
* @return {function}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function urlencoded (options) {
|
||||||
|
var opts = options || {}
|
||||||
|
|
||||||
|
// notice because option default will flip in next major
|
||||||
|
if (opts.extended === undefined) {
|
||||||
|
deprecate('undefined extended: provide extended option')
|
||||||
|
}
|
||||||
|
|
||||||
|
var extended = opts.extended !== false
|
||||||
|
var inflate = opts.inflate !== false
|
||||||
|
var limit = typeof opts.limit !== 'number'
|
||||||
|
? bytes.parse(opts.limit || '100kb')
|
||||||
|
: opts.limit
|
||||||
|
var type = opts.type || 'application/x-www-form-urlencoded'
|
||||||
|
var verify = opts.verify || false
|
||||||
|
|
||||||
|
if (verify !== false && typeof verify !== 'function') {
|
||||||
|
throw new TypeError('option verify must be function')
|
||||||
|
}
|
||||||
|
|
||||||
|
// create the appropriate query parser
|
||||||
|
var queryparse = extended
|
||||||
|
? extendedparser(opts)
|
||||||
|
: simpleparser(opts)
|
||||||
|
|
||||||
|
// create the appropriate type checking function
|
||||||
|
var shouldParse = typeof type !== 'function'
|
||||||
|
? typeChecker(type)
|
||||||
|
: type
|
||||||
|
|
||||||
|
function parse (body) {
|
||||||
|
return body.length
|
||||||
|
? queryparse(body)
|
||||||
|
: {}
|
||||||
|
}
|
||||||
|
|
||||||
|
return function urlencodedParser (req, res, next) {
|
||||||
|
if (req._body) {
|
||||||
|
debug('body already parsed')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
req.body = req.body || {}
|
||||||
|
|
||||||
|
// skip requests without bodies
|
||||||
|
if (!typeis.hasBody(req)) {
|
||||||
|
debug('skip empty body')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
debug('content-type %j', req.headers['content-type'])
|
||||||
|
|
||||||
|
// determine if request should be parsed
|
||||||
|
if (!shouldParse(req)) {
|
||||||
|
debug('skip parsing')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// assert charset
|
||||||
|
var charset = getCharset(req) || 'utf-8'
|
||||||
|
if (charset !== 'utf-8') {
|
||||||
|
debug('invalid charset')
|
||||||
|
next(createError(415, 'unsupported charset "' + charset.toUpperCase() + '"', {
|
||||||
|
charset: charset,
|
||||||
|
type: 'charset.unsupported'
|
||||||
|
}))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// read
|
||||||
|
read(req, res, next, parse, debug, {
|
||||||
|
debug: debug,
|
||||||
|
encoding: charset,
|
||||||
|
inflate: inflate,
|
||||||
|
limit: limit,
|
||||||
|
verify: verify
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the extended query parser.
|
||||||
|
*
|
||||||
|
* @param {object} options
|
||||||
|
*/
|
||||||
|
|
||||||
|
function extendedparser (options) {
|
||||||
|
var parameterLimit = options.parameterLimit !== undefined
|
||||||
|
? options.parameterLimit
|
||||||
|
: 1000
|
||||||
|
var parse = parser('qs')
|
||||||
|
|
||||||
|
if (isNaN(parameterLimit) || parameterLimit < 1) {
|
||||||
|
throw new TypeError('option parameterLimit must be a positive number')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isFinite(parameterLimit)) {
|
||||||
|
parameterLimit = parameterLimit | 0
|
||||||
|
}
|
||||||
|
|
||||||
|
return function queryparse (body) {
|
||||||
|
var paramCount = parameterCount(body, parameterLimit)
|
||||||
|
|
||||||
|
if (paramCount === undefined) {
|
||||||
|
debug('too many parameters')
|
||||||
|
throw createError(413, 'too many parameters', {
|
||||||
|
type: 'parameters.too.many'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
var arrayLimit = Math.max(100, paramCount)
|
||||||
|
|
||||||
|
debug('parse extended urlencoding')
|
||||||
|
return parse(body, {
|
||||||
|
allowPrototypes: true,
|
||||||
|
arrayLimit: arrayLimit,
|
||||||
|
depth: Infinity,
|
||||||
|
parameterLimit: parameterLimit
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the charset of a request.
|
||||||
|
*
|
||||||
|
* @param {object} req
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getCharset (req) {
|
||||||
|
try {
|
||||||
|
return (contentType.parse(req).parameters.charset || '').toLowerCase()
|
||||||
|
} catch (e) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Count the number of parameters, stopping once limit reached
|
||||||
|
*
|
||||||
|
* @param {string} body
|
||||||
|
* @param {number} limit
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function parameterCount (body, limit) {
|
||||||
|
var count = 0
|
||||||
|
var index = 0
|
||||||
|
|
||||||
|
while ((index = body.indexOf('&', index)) !== -1) {
|
||||||
|
count++
|
||||||
|
index++
|
||||||
|
|
||||||
|
if (count === limit) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return count
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get parser for module name dynamically.
|
||||||
|
*
|
||||||
|
* @param {string} name
|
||||||
|
* @return {function}
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function parser (name) {
|
||||||
|
var mod = parsers[name]
|
||||||
|
|
||||||
|
if (mod !== undefined) {
|
||||||
|
return mod.parse
|
||||||
|
}
|
||||||
|
|
||||||
|
// this uses a switch for static require analysis
|
||||||
|
switch (name) {
|
||||||
|
case 'qs':
|
||||||
|
mod = require('qs')
|
||||||
|
break
|
||||||
|
case 'querystring':
|
||||||
|
mod = require('querystring')
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
// store to prevent invoking require()
|
||||||
|
parsers[name] = mod
|
||||||
|
|
||||||
|
return mod.parse
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the simple query parser.
|
||||||
|
*
|
||||||
|
* @param {object} options
|
||||||
|
*/
|
||||||
|
|
||||||
|
function simpleparser (options) {
|
||||||
|
var parameterLimit = options.parameterLimit !== undefined
|
||||||
|
? options.parameterLimit
|
||||||
|
: 1000
|
||||||
|
var parse = parser('querystring')
|
||||||
|
|
||||||
|
if (isNaN(parameterLimit) || parameterLimit < 1) {
|
||||||
|
throw new TypeError('option parameterLimit must be a positive number')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isFinite(parameterLimit)) {
|
||||||
|
parameterLimit = parameterLimit | 0
|
||||||
|
}
|
||||||
|
|
||||||
|
return function queryparse (body) {
|
||||||
|
var paramCount = parameterCount(body, parameterLimit)
|
||||||
|
|
||||||
|
if (paramCount === undefined) {
|
||||||
|
debug('too many parameters')
|
||||||
|
throw createError(413, 'too many parameters', {
|
||||||
|
type: 'parameters.too.many'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
debug('parse urlencoding')
|
||||||
|
return parse(body, undefined, undefined, { maxKeys: parameterLimit })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the simple type checker.
|
||||||
|
*
|
||||||
|
* @param {string} type
|
||||||
|
* @return {function}
|
||||||
|
*/
|
||||||
|
|
||||||
|
function typeChecker (type) {
|
||||||
|
return function checkType (req) {
|
||||||
|
return Boolean(typeis(req, type))
|
||||||
|
}
|
||||||
|
}
|
||||||
1
node_modules/body-parser/node_modules/debug/.coveralls.yml
generated
vendored
Normal file
1
node_modules/body-parser/node_modules/debug/.coveralls.yml
generated
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
repo_token: SIAeZjKYlHK74rbcFvNHMUzjRiMpflxve
|
||||||
11
node_modules/body-parser/node_modules/debug/.eslintrc
generated
vendored
Normal file
11
node_modules/body-parser/node_modules/debug/.eslintrc
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"no-console": 0,
|
||||||
|
"no-empty": [1, { "allowEmptyCatch": true }]
|
||||||
|
},
|
||||||
|
"extends": "eslint:recommended"
|
||||||
|
}
|
||||||
9
node_modules/body-parser/node_modules/debug/.npmignore
generated
vendored
Normal file
9
node_modules/body-parser/node_modules/debug/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
support
|
||||||
|
test
|
||||||
|
examples
|
||||||
|
example
|
||||||
|
*.sock
|
||||||
|
dist
|
||||||
|
yarn.lock
|
||||||
|
coverage
|
||||||
|
bower.json
|
||||||
14
node_modules/body-parser/node_modules/debug/.travis.yml
generated
vendored
Normal file
14
node_modules/body-parser/node_modules/debug/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
language: node_js
|
||||||
|
node_js:
|
||||||
|
- "6"
|
||||||
|
- "5"
|
||||||
|
- "4"
|
||||||
|
|
||||||
|
install:
|
||||||
|
- make node_modules
|
||||||
|
|
||||||
|
script:
|
||||||
|
- make lint
|
||||||
|
- make test
|
||||||
|
- make coveralls
|
||||||
362
node_modules/body-parser/node_modules/debug/CHANGELOG.md
generated
vendored
Normal file
362
node_modules/body-parser/node_modules/debug/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,362 @@
|
|||||||
|
|
||||||
|
2.6.9 / 2017-09-22
|
||||||
|
==================
|
||||||
|
|
||||||
|
* remove ReDoS regexp in %o formatter (#504)
|
||||||
|
|
||||||
|
2.6.8 / 2017-05-18
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: Check for undefined on browser globals (#462, @marbemac)
|
||||||
|
|
||||||
|
2.6.7 / 2017-05-16
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom)
|
||||||
|
* Fix: Inline extend function in node implementation (#452, @dougwilson)
|
||||||
|
* Docs: Fix typo (#455, @msasad)
|
||||||
|
|
||||||
|
2.6.5 / 2017-04-27
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek)
|
||||||
|
* Misc: clean up browser reference checks (#447, @thebigredgeek)
|
||||||
|
* Misc: add npm-debug.log to .gitignore (@thebigredgeek)
|
||||||
|
|
||||||
|
|
||||||
|
2.6.4 / 2017-04-20
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: bug that would occure if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo)
|
||||||
|
* Chore: ignore bower.json in npm installations. (#437, @joaovieira)
|
||||||
|
* Misc: update "ms" to v0.7.3 (@tootallnate)
|
||||||
|
|
||||||
|
2.6.3 / 2017-03-13
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts)
|
||||||
|
* Docs: Changelog fix (@thebigredgeek)
|
||||||
|
|
||||||
|
2.6.2 / 2017-03-10
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin)
|
||||||
|
* Docs: Add backers and sponsors from Open Collective (#422, @piamancini)
|
||||||
|
* Docs: Add Slackin invite badge (@tootallnate)
|
||||||
|
|
||||||
|
2.6.1 / 2017-02-10
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error
|
||||||
|
* Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0)
|
||||||
|
* Fix: IE8 "Expected identifier" error (#414, @vgoma)
|
||||||
|
* Fix: Namespaces would not disable once enabled (#409, @musikov)
|
||||||
|
|
||||||
|
2.6.0 / 2016-12-28
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: added better null pointer checks for browser useColors (@thebigredgeek)
|
||||||
|
* Improvement: removed explicit `window.debug` export (#404, @tootallnate)
|
||||||
|
* Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate)
|
||||||
|
|
||||||
|
2.5.2 / 2016-12-25
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: reference error on window within webworkers (#393, @KlausTrainer)
|
||||||
|
* Docs: fixed README typo (#391, @lurch)
|
||||||
|
* Docs: added notice about v3 api discussion (@thebigredgeek)
|
||||||
|
|
||||||
|
2.5.1 / 2016-12-20
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: babel-core compatibility
|
||||||
|
|
||||||
|
2.5.0 / 2016-12-20
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: wrong reference in bower file (@thebigredgeek)
|
||||||
|
* Fix: webworker compatibility (@thebigredgeek)
|
||||||
|
* Fix: output formatting issue (#388, @kribblo)
|
||||||
|
* Fix: babel-loader compatibility (#383, @escwald)
|
||||||
|
* Misc: removed built asset from repo and publications (@thebigredgeek)
|
||||||
|
* Misc: moved source files to /src (#378, @yamikuronue)
|
||||||
|
* Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue)
|
||||||
|
* Test: coveralls integration (#378, @yamikuronue)
|
||||||
|
* Docs: simplified language in the opening paragraph (#373, @yamikuronue)
|
||||||
|
|
||||||
|
2.4.5 / 2016-12-17
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: `navigator` undefined in Rhino (#376, @jochenberger)
|
||||||
|
* Fix: custom log function (#379, @hsiliev)
|
||||||
|
* Improvement: bit of cleanup + linting fixes (@thebigredgeek)
|
||||||
|
* Improvement: rm non-maintainted `dist/` dir (#375, @freewil)
|
||||||
|
* Docs: simplified language in the opening paragraph. (#373, @yamikuronue)
|
||||||
|
|
||||||
|
2.4.4 / 2016-12-14
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts)
|
||||||
|
|
||||||
|
2.4.3 / 2016-12-14
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: navigation.userAgent error for react native (#364, @escwald)
|
||||||
|
|
||||||
|
2.4.2 / 2016-12-14
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: browser colors (#367, @tootallnate)
|
||||||
|
* Misc: travis ci integration (@thebigredgeek)
|
||||||
|
* Misc: added linting and testing boilerplate with sanity check (@thebigredgeek)
|
||||||
|
|
||||||
|
2.4.1 / 2016-12-13
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: typo that broke the package (#356)
|
||||||
|
|
||||||
|
2.4.0 / 2016-12-13
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: bower.json references unbuilt src entry point (#342, @justmatt)
|
||||||
|
* Fix: revert "handle regex special characters" (@tootallnate)
|
||||||
|
* Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate)
|
||||||
|
* Feature: %O`(big O) pretty-prints objects (#322, @tootallnate)
|
||||||
|
* Improvement: allow colors in workers (#335, @botverse)
|
||||||
|
* Improvement: use same color for same namespace. (#338, @lchenay)
|
||||||
|
|
||||||
|
2.3.3 / 2016-11-09
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne)
|
||||||
|
* Fix: Returning `localStorage` saved values (#331, Levi Thomason)
|
||||||
|
* Improvement: Don't create an empty object when no `process` (Nathan Rajlich)
|
||||||
|
|
||||||
|
2.3.2 / 2016-11-09
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: be super-safe in index.js as well (@TooTallNate)
|
||||||
|
* Fix: should check whether process exists (Tom Newby)
|
||||||
|
|
||||||
|
2.3.1 / 2016-11-09
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: Added electron compatibility (#324, @paulcbetts)
|
||||||
|
* Improvement: Added performance optimizations (@tootallnate)
|
||||||
|
* Readme: Corrected PowerShell environment variable example (#252, @gimre)
|
||||||
|
* Misc: Removed yarn lock file from source control (#321, @fengmk2)
|
||||||
|
|
||||||
|
2.3.0 / 2016-11-07
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: Consistent placement of ms diff at end of output (#215, @gorangajic)
|
||||||
|
* Fix: Escaping of regex special characters in namespace strings (#250, @zacronos)
|
||||||
|
* Fix: Fixed bug causing crash on react-native (#282, @vkarpov15)
|
||||||
|
* Feature: Enabled ES6+ compatible import via default export (#212 @bucaran)
|
||||||
|
* Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom)
|
||||||
|
* Package: Update "ms" to 0.7.2 (#315, @DevSide)
|
||||||
|
* Package: removed superfluous version property from bower.json (#207 @kkirsche)
|
||||||
|
* Readme: fix USE_COLORS to DEBUG_COLORS
|
||||||
|
* Readme: Doc fixes for format string sugar (#269, @mlucool)
|
||||||
|
* Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0)
|
||||||
|
* Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable)
|
||||||
|
* Readme: better docs for browser support (#224, @matthewmueller)
|
||||||
|
* Tooling: Added yarn integration for development (#317, @thebigredgeek)
|
||||||
|
* Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek)
|
||||||
|
* Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman)
|
||||||
|
* Misc: Updated contributors (@thebigredgeek)
|
||||||
|
|
||||||
|
2.2.0 / 2015-05-09
|
||||||
|
==================
|
||||||
|
|
||||||
|
* package: update "ms" to v0.7.1 (#202, @dougwilson)
|
||||||
|
* README: add logging to file example (#193, @DanielOchoa)
|
||||||
|
* README: fixed a typo (#191, @amir-s)
|
||||||
|
* browser: expose `storage` (#190, @stephenmathieson)
|
||||||
|
* Makefile: add a `distclean` target (#189, @stephenmathieson)
|
||||||
|
|
||||||
|
2.1.3 / 2015-03-13
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Updated stdout/stderr example (#186)
|
||||||
|
* Updated example/stdout.js to match debug current behaviour
|
||||||
|
* Renamed example/stderr.js to stdout.js
|
||||||
|
* Update Readme.md (#184)
|
||||||
|
* replace high intensity foreground color for bold (#182, #183)
|
||||||
|
|
||||||
|
2.1.2 / 2015-03-01
|
||||||
|
==================
|
||||||
|
|
||||||
|
* dist: recompile
|
||||||
|
* update "ms" to v0.7.0
|
||||||
|
* package: update "browserify" to v9.0.3
|
||||||
|
* component: fix "ms.js" repo location
|
||||||
|
* changed bower package name
|
||||||
|
* updated documentation about using debug in a browser
|
||||||
|
* fix: security error on safari (#167, #168, @yields)
|
||||||
|
|
||||||
|
2.1.1 / 2014-12-29
|
||||||
|
==================
|
||||||
|
|
||||||
|
* browser: use `typeof` to check for `console` existence
|
||||||
|
* browser: check for `console.log` truthiness (fix IE 8/9)
|
||||||
|
* browser: add support for Chrome apps
|
||||||
|
* Readme: added Windows usage remarks
|
||||||
|
* Add `bower.json` to properly support bower install
|
||||||
|
|
||||||
|
2.1.0 / 2014-10-15
|
||||||
|
==================
|
||||||
|
|
||||||
|
* node: implement `DEBUG_FD` env variable support
|
||||||
|
* package: update "browserify" to v6.1.0
|
||||||
|
* package: add "license" field to package.json (#135, @panuhorsmalahti)
|
||||||
|
|
||||||
|
2.0.0 / 2014-09-01
|
||||||
|
==================
|
||||||
|
|
||||||
|
* package: update "browserify" to v5.11.0
|
||||||
|
* node: use stderr rather than stdout for logging (#29, @stephenmathieson)
|
||||||
|
|
||||||
|
1.0.4 / 2014-07-15
|
||||||
|
==================
|
||||||
|
|
||||||
|
* dist: recompile
|
||||||
|
* example: remove `console.info()` log usage
|
||||||
|
* example: add "Content-Type" UTF-8 header to browser example
|
||||||
|
* browser: place %c marker after the space character
|
||||||
|
* browser: reset the "content" color via `color: inherit`
|
||||||
|
* browser: add colors support for Firefox >= v31
|
||||||
|
* debug: prefer an instance `log()` function over the global one (#119)
|
||||||
|
* Readme: update documentation about styled console logs for FF v31 (#116, @wryk)
|
||||||
|
|
||||||
|
1.0.3 / 2014-07-09
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Add support for multiple wildcards in namespaces (#122, @seegno)
|
||||||
|
* browser: fix lint
|
||||||
|
|
||||||
|
1.0.2 / 2014-06-10
|
||||||
|
==================
|
||||||
|
|
||||||
|
* browser: update color palette (#113, @gscottolson)
|
||||||
|
* common: make console logging function configurable (#108, @timoxley)
|
||||||
|
* node: fix %o colors on old node <= 0.8.x
|
||||||
|
* Makefile: find node path using shell/which (#109, @timoxley)
|
||||||
|
|
||||||
|
1.0.1 / 2014-06-06
|
||||||
|
==================
|
||||||
|
|
||||||
|
* browser: use `removeItem()` to clear localStorage
|
||||||
|
* browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777)
|
||||||
|
* package: add "contributors" section
|
||||||
|
* node: fix comment typo
|
||||||
|
* README: list authors
|
||||||
|
|
||||||
|
1.0.0 / 2014-06-04
|
||||||
|
==================
|
||||||
|
|
||||||
|
* make ms diff be global, not be scope
|
||||||
|
* debug: ignore empty strings in enable()
|
||||||
|
* node: make DEBUG_COLORS able to disable coloring
|
||||||
|
* *: export the `colors` array
|
||||||
|
* npmignore: don't publish the `dist` dir
|
||||||
|
* Makefile: refactor to use browserify
|
||||||
|
* package: add "browserify" as a dev dependency
|
||||||
|
* Readme: add Web Inspector Colors section
|
||||||
|
* node: reset terminal color for the debug content
|
||||||
|
* node: map "%o" to `util.inspect()`
|
||||||
|
* browser: map "%j" to `JSON.stringify()`
|
||||||
|
* debug: add custom "formatters"
|
||||||
|
* debug: use "ms" module for humanizing the diff
|
||||||
|
* Readme: add "bash" syntax highlighting
|
||||||
|
* browser: add Firebug color support
|
||||||
|
* browser: add colors for WebKit browsers
|
||||||
|
* node: apply log to `console`
|
||||||
|
* rewrite: abstract common logic for Node & browsers
|
||||||
|
* add .jshintrc file
|
||||||
|
|
||||||
|
0.8.1 / 2014-04-14
|
||||||
|
==================
|
||||||
|
|
||||||
|
* package: re-add the "component" section
|
||||||
|
|
||||||
|
0.8.0 / 2014-03-30
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add `enable()` method for nodejs. Closes #27
|
||||||
|
* change from stderr to stdout
|
||||||
|
* remove unnecessary index.js file
|
||||||
|
|
||||||
|
0.7.4 / 2013-11-13
|
||||||
|
==================
|
||||||
|
|
||||||
|
* remove "browserify" key from package.json (fixes something in browserify)
|
||||||
|
|
||||||
|
0.7.3 / 2013-10-30
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fix: catch localStorage security error when cookies are blocked (Chrome)
|
||||||
|
* add debug(err) support. Closes #46
|
||||||
|
* add .browser prop to package.json. Closes #42
|
||||||
|
|
||||||
|
0.7.2 / 2013-02-06
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fix package.json
|
||||||
|
* fix: Mobile Safari (private mode) is broken with debug
|
||||||
|
* fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript
|
||||||
|
|
||||||
|
0.7.1 / 2013-02-05
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add repository URL to package.json
|
||||||
|
* add DEBUG_COLORED to force colored output
|
||||||
|
* add browserify support
|
||||||
|
* fix component. Closes #24
|
||||||
|
|
||||||
|
0.7.0 / 2012-05-04
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added .component to package.json
|
||||||
|
* Added debug.component.js build
|
||||||
|
|
||||||
|
0.6.0 / 2012-03-16
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added support for "-" prefix in DEBUG [Vinay Pulim]
|
||||||
|
* Added `.enabled` flag to the node version [TooTallNate]
|
||||||
|
|
||||||
|
0.5.0 / 2012-02-02
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added: humanize diffs. Closes #8
|
||||||
|
* Added `debug.disable()` to the CS variant
|
||||||
|
* Removed padding. Closes #10
|
||||||
|
* Fixed: persist client-side variant again. Closes #9
|
||||||
|
|
||||||
|
0.4.0 / 2012-02-01
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added browser variant support for older browsers [TooTallNate]
|
||||||
|
* Added `debug.enable('project:*')` to browser variant [TooTallNate]
|
||||||
|
* Added padding to diff (moved it to the right)
|
||||||
|
|
||||||
|
0.3.0 / 2012-01-26
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added millisecond diff when isatty, otherwise UTC string
|
||||||
|
|
||||||
|
0.2.0 / 2012-01-22
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added wildcard support
|
||||||
|
|
||||||
|
0.1.0 / 2011-12-02
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added: remove colors unless stderr isatty [TooTallNate]
|
||||||
|
|
||||||
|
0.0.1 / 2010-01-03
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Initial release
|
||||||
19
node_modules/body-parser/node_modules/debug/LICENSE
generated
vendored
Normal file
19
node_modules/body-parser/node_modules/debug/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca>
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
50
node_modules/body-parser/node_modules/debug/Makefile
generated
vendored
Normal file
50
node_modules/body-parser/node_modules/debug/Makefile
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
# get Makefile directory name: http://stackoverflow.com/a/5982798/376773
|
||||||
|
THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||||
|
THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
|
||||||
|
|
||||||
|
# BIN directory
|
||||||
|
BIN := $(THIS_DIR)/node_modules/.bin
|
||||||
|
|
||||||
|
# Path
|
||||||
|
PATH := node_modules/.bin:$(PATH)
|
||||||
|
SHELL := /bin/bash
|
||||||
|
|
||||||
|
# applications
|
||||||
|
NODE ?= $(shell which node)
|
||||||
|
YARN ?= $(shell which yarn)
|
||||||
|
PKG ?= $(if $(YARN),$(YARN),$(NODE) $(shell which npm))
|
||||||
|
BROWSERIFY ?= $(NODE) $(BIN)/browserify
|
||||||
|
|
||||||
|
.FORCE:
|
||||||
|
|
||||||
|
install: node_modules
|
||||||
|
|
||||||
|
node_modules: package.json
|
||||||
|
@NODE_ENV= $(PKG) install
|
||||||
|
@touch node_modules
|
||||||
|
|
||||||
|
lint: .FORCE
|
||||||
|
eslint browser.js debug.js index.js node.js
|
||||||
|
|
||||||
|
test-node: .FORCE
|
||||||
|
istanbul cover node_modules/mocha/bin/_mocha -- test/**.js
|
||||||
|
|
||||||
|
test-browser: .FORCE
|
||||||
|
mkdir -p dist
|
||||||
|
|
||||||
|
@$(BROWSERIFY) \
|
||||||
|
--standalone debug \
|
||||||
|
. > dist/debug.js
|
||||||
|
|
||||||
|
karma start --single-run
|
||||||
|
rimraf dist
|
||||||
|
|
||||||
|
test: .FORCE
|
||||||
|
concurrently \
|
||||||
|
"make test-node" \
|
||||||
|
"make test-browser"
|
||||||
|
|
||||||
|
coveralls:
|
||||||
|
cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
|
||||||
|
|
||||||
|
.PHONY: all install clean distclean
|
||||||
312
node_modules/body-parser/node_modules/debug/README.md
generated
vendored
Normal file
312
node_modules/body-parser/node_modules/debug/README.md
generated
vendored
Normal file
@@ -0,0 +1,312 @@
|
|||||||
|
# debug
|
||||||
|
[](https://travis-ci.org/visionmedia/debug) [](https://coveralls.io/github/visionmedia/debug?branch=master) [](https://visionmedia-community-slackin.now.sh/) [](#backers)
|
||||||
|
[](#sponsors)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
A tiny node.js debugging utility modelled after node core's debugging technique.
|
||||||
|
|
||||||
|
**Discussion around the V3 API is under way [here](https://github.com/visionmedia/debug/issues/370)**
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm install debug
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole.
|
||||||
|
|
||||||
|
Example _app.js_:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var debug = require('debug')('http')
|
||||||
|
, http = require('http')
|
||||||
|
, name = 'My App';
|
||||||
|
|
||||||
|
// fake app
|
||||||
|
|
||||||
|
debug('booting %s', name);
|
||||||
|
|
||||||
|
http.createServer(function(req, res){
|
||||||
|
debug(req.method + ' ' + req.url);
|
||||||
|
res.end('hello\n');
|
||||||
|
}).listen(3000, function(){
|
||||||
|
debug('listening');
|
||||||
|
});
|
||||||
|
|
||||||
|
// fake worker of some kind
|
||||||
|
|
||||||
|
require('./worker');
|
||||||
|
```
|
||||||
|
|
||||||
|
Example _worker.js_:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var debug = require('debug')('worker');
|
||||||
|
|
||||||
|
setInterval(function(){
|
||||||
|
debug('doing some work');
|
||||||
|
}, 1000);
|
||||||
|
```
|
||||||
|
|
||||||
|
The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
#### Windows note
|
||||||
|
|
||||||
|
On Windows the environment variable is set using the `set` command.
|
||||||
|
|
||||||
|
```cmd
|
||||||
|
set DEBUG=*,-not_this
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that PowerShell uses different syntax to set environment variables.
|
||||||
|
|
||||||
|
```cmd
|
||||||
|
$env:DEBUG = "*,-not_this"
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, run the program to be debugged as usual.
|
||||||
|
|
||||||
|
## Millisecond diff
|
||||||
|
|
||||||
|
When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Conventions
|
||||||
|
|
||||||
|
If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser".
|
||||||
|
|
||||||
|
## Wildcards
|
||||||
|
|
||||||
|
The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
|
||||||
|
|
||||||
|
You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:".
|
||||||
|
|
||||||
|
## Environment Variables
|
||||||
|
|
||||||
|
When running through Node.js, you can set a few environment variables that will
|
||||||
|
change the behavior of the debug logging:
|
||||||
|
|
||||||
|
| Name | Purpose |
|
||||||
|
|-----------|-------------------------------------------------|
|
||||||
|
| `DEBUG` | Enables/disables specific debugging namespaces. |
|
||||||
|
| `DEBUG_COLORS`| Whether or not to use colors in the debug output. |
|
||||||
|
| `DEBUG_DEPTH` | Object inspection depth. |
|
||||||
|
| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |
|
||||||
|
|
||||||
|
|
||||||
|
__Note:__ The environment variables beginning with `DEBUG_` end up being
|
||||||
|
converted into an Options object that gets used with `%o`/`%O` formatters.
|
||||||
|
See the Node.js documentation for
|
||||||
|
[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)
|
||||||
|
for the complete list.
|
||||||
|
|
||||||
|
## Formatters
|
||||||
|
|
||||||
|
|
||||||
|
Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. Below are the officially supported formatters:
|
||||||
|
|
||||||
|
| Formatter | Representation |
|
||||||
|
|-----------|----------------|
|
||||||
|
| `%O` | Pretty-print an Object on multiple lines. |
|
||||||
|
| `%o` | Pretty-print an Object all on a single line. |
|
||||||
|
| `%s` | String. |
|
||||||
|
| `%d` | Number (both integer and float). |
|
||||||
|
| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. |
|
||||||
|
| `%%` | Single percent sign ('%'). This does not consume an argument. |
|
||||||
|
|
||||||
|
### Custom formatters
|
||||||
|
|
||||||
|
You can add custom formatters by extending the `debug.formatters` object. For example, if you wanted to add support for rendering a Buffer as hex with `%h`, you could do something like:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const createDebug = require('debug')
|
||||||
|
createDebug.formatters.h = (v) => {
|
||||||
|
return v.toString('hex')
|
||||||
|
}
|
||||||
|
|
||||||
|
// …elsewhere
|
||||||
|
const debug = createDebug('foo')
|
||||||
|
debug('this is hex: %h', new Buffer('hello world'))
|
||||||
|
// foo this is hex: 68656c6c6f20776f726c6421 +0ms
|
||||||
|
```
|
||||||
|
|
||||||
|
## Browser support
|
||||||
|
You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),
|
||||||
|
or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest),
|
||||||
|
if you don't want to build it yourself.
|
||||||
|
|
||||||
|
Debug's enable state is currently persisted by `localStorage`.
|
||||||
|
Consider the situation shown below where you have `worker:a` and `worker:b`,
|
||||||
|
and wish to debug both. You can enable this using `localStorage.debug`:
|
||||||
|
|
||||||
|
```js
|
||||||
|
localStorage.debug = 'worker:*'
|
||||||
|
```
|
||||||
|
|
||||||
|
And then refresh the page.
|
||||||
|
|
||||||
|
```js
|
||||||
|
a = debug('worker:a');
|
||||||
|
b = debug('worker:b');
|
||||||
|
|
||||||
|
setInterval(function(){
|
||||||
|
a('doing some work');
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
setInterval(function(){
|
||||||
|
b('doing some work');
|
||||||
|
}, 1200);
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Web Inspector Colors
|
||||||
|
|
||||||
|
Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
|
||||||
|
option. These are WebKit web inspectors, Firefox ([since version
|
||||||
|
31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))
|
||||||
|
and the Firebug plugin for Firefox (any version).
|
||||||
|
|
||||||
|
Colored output looks something like:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
## Output streams
|
||||||
|
|
||||||
|
By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method:
|
||||||
|
|
||||||
|
Example _stdout.js_:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var debug = require('debug');
|
||||||
|
var error = debug('app:error');
|
||||||
|
|
||||||
|
// by default stderr is used
|
||||||
|
error('goes to stderr!');
|
||||||
|
|
||||||
|
var log = debug('app:log');
|
||||||
|
// set this namespace to log via console.log
|
||||||
|
log.log = console.log.bind(console); // don't forget to bind to console!
|
||||||
|
log('goes to stdout');
|
||||||
|
error('still goes to stderr!');
|
||||||
|
|
||||||
|
// set all output to go via console.info
|
||||||
|
// overrides all per-namespace log settings
|
||||||
|
debug.log = console.info.bind(console);
|
||||||
|
error('now goes to stdout via console.info');
|
||||||
|
log('still goes to stdout, but via console.info now');
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Authors
|
||||||
|
|
||||||
|
- TJ Holowaychuk
|
||||||
|
- Nathan Rajlich
|
||||||
|
- Andrew Rhyne
|
||||||
|
|
||||||
|
## Backers
|
||||||
|
|
||||||
|
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)]
|
||||||
|
|
||||||
|
<a href="https://opencollective.com/debug/backer/0/website" target="_blank"><img src="https://opencollective.com/debug/backer/0/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/1/website" target="_blank"><img src="https://opencollective.com/debug/backer/1/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/2/website" target="_blank"><img src="https://opencollective.com/debug/backer/2/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/3/website" target="_blank"><img src="https://opencollective.com/debug/backer/3/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/4/website" target="_blank"><img src="https://opencollective.com/debug/backer/4/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/5/website" target="_blank"><img src="https://opencollective.com/debug/backer/5/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/6/website" target="_blank"><img src="https://opencollective.com/debug/backer/6/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/7/website" target="_blank"><img src="https://opencollective.com/debug/backer/7/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/8/website" target="_blank"><img src="https://opencollective.com/debug/backer/8/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/9/website" target="_blank"><img src="https://opencollective.com/debug/backer/9/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/10/website" target="_blank"><img src="https://opencollective.com/debug/backer/10/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/11/website" target="_blank"><img src="https://opencollective.com/debug/backer/11/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/12/website" target="_blank"><img src="https://opencollective.com/debug/backer/12/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/13/website" target="_blank"><img src="https://opencollective.com/debug/backer/13/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/14/website" target="_blank"><img src="https://opencollective.com/debug/backer/14/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/15/website" target="_blank"><img src="https://opencollective.com/debug/backer/15/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/16/website" target="_blank"><img src="https://opencollective.com/debug/backer/16/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/17/website" target="_blank"><img src="https://opencollective.com/debug/backer/17/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/18/website" target="_blank"><img src="https://opencollective.com/debug/backer/18/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/19/website" target="_blank"><img src="https://opencollective.com/debug/backer/19/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/20/website" target="_blank"><img src="https://opencollective.com/debug/backer/20/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/21/website" target="_blank"><img src="https://opencollective.com/debug/backer/21/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/22/website" target="_blank"><img src="https://opencollective.com/debug/backer/22/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/23/website" target="_blank"><img src="https://opencollective.com/debug/backer/23/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/24/website" target="_blank"><img src="https://opencollective.com/debug/backer/24/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/25/website" target="_blank"><img src="https://opencollective.com/debug/backer/25/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/26/website" target="_blank"><img src="https://opencollective.com/debug/backer/26/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/27/website" target="_blank"><img src="https://opencollective.com/debug/backer/27/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/28/website" target="_blank"><img src="https://opencollective.com/debug/backer/28/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/29/website" target="_blank"><img src="https://opencollective.com/debug/backer/29/avatar.svg"></a>
|
||||||
|
|
||||||
|
|
||||||
|
## Sponsors
|
||||||
|
|
||||||
|
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)]
|
||||||
|
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/0/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/0/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/1/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/1/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/2/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/2/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/3/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/3/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/4/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/4/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/5/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/5/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/6/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/6/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/7/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/7/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/8/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/8/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/9/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/9/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/10/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/10/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/11/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/11/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/12/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/12/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/13/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/13/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/14/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/14/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/15/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/15/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/16/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/16/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/17/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/17/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/18/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/18/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/19/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/19/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/20/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/20/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/21/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/21/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/22/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/22/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/23/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/23/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/24/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/24/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/25/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/25/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/26/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/26/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/27/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/27/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/28/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/28/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/29/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/29/avatar.svg"></a>
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2014-2016 TJ Holowaychuk <tj@vision-media.ca>
|
||||||
|
|
||||||
|
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.
|
||||||
19
node_modules/body-parser/node_modules/debug/component.json
generated
vendored
Normal file
19
node_modules/body-parser/node_modules/debug/component.json
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"name": "debug",
|
||||||
|
"repo": "visionmedia/debug",
|
||||||
|
"description": "small debugging utility",
|
||||||
|
"version": "2.6.9",
|
||||||
|
"keywords": [
|
||||||
|
"debug",
|
||||||
|
"log",
|
||||||
|
"debugger"
|
||||||
|
],
|
||||||
|
"main": "src/browser.js",
|
||||||
|
"scripts": [
|
||||||
|
"src/browser.js",
|
||||||
|
"src/debug.js"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"rauchg/ms.js": "0.7.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
70
node_modules/body-parser/node_modules/debug/karma.conf.js
generated
vendored
Normal file
70
node_modules/body-parser/node_modules/debug/karma.conf.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
// Karma configuration
|
||||||
|
// Generated on Fri Dec 16 2016 13:09:51 GMT+0000 (UTC)
|
||||||
|
|
||||||
|
module.exports = function(config) {
|
||||||
|
config.set({
|
||||||
|
|
||||||
|
// base path that will be used to resolve all patterns (eg. files, exclude)
|
||||||
|
basePath: '',
|
||||||
|
|
||||||
|
|
||||||
|
// frameworks to use
|
||||||
|
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
||||||
|
frameworks: ['mocha', 'chai', 'sinon'],
|
||||||
|
|
||||||
|
|
||||||
|
// list of files / patterns to load in the browser
|
||||||
|
files: [
|
||||||
|
'dist/debug.js',
|
||||||
|
'test/*spec.js'
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
// list of files to exclude
|
||||||
|
exclude: [
|
||||||
|
'src/node.js'
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
// preprocess matching files before serving them to the browser
|
||||||
|
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
||||||
|
preprocessors: {
|
||||||
|
},
|
||||||
|
|
||||||
|
// test results reporter to use
|
||||||
|
// possible values: 'dots', 'progress'
|
||||||
|
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
||||||
|
reporters: ['progress'],
|
||||||
|
|
||||||
|
|
||||||
|
// web server port
|
||||||
|
port: 9876,
|
||||||
|
|
||||||
|
|
||||||
|
// enable / disable colors in the output (reporters and logs)
|
||||||
|
colors: true,
|
||||||
|
|
||||||
|
|
||||||
|
// level of logging
|
||||||
|
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||||
|
logLevel: config.LOG_INFO,
|
||||||
|
|
||||||
|
|
||||||
|
// enable / disable watching file and executing tests whenever any file changes
|
||||||
|
autoWatch: true,
|
||||||
|
|
||||||
|
|
||||||
|
// start these browsers
|
||||||
|
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
||||||
|
browsers: ['PhantomJS'],
|
||||||
|
|
||||||
|
|
||||||
|
// Continuous Integration mode
|
||||||
|
// if true, Karma captures browsers, runs the tests and exits
|
||||||
|
singleRun: false,
|
||||||
|
|
||||||
|
// Concurrency level
|
||||||
|
// how many browser should be started simultaneous
|
||||||
|
concurrency: Infinity
|
||||||
|
})
|
||||||
|
}
|
||||||
1
node_modules/body-parser/node_modules/debug/node.js
generated
vendored
Normal file
1
node_modules/body-parser/node_modules/debug/node.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
module.exports = require('./src/node');
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user