mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
node_modules
This commit is contained in:
parent
6fa46f4e34
commit
680eb33f0d
4375 changed files with 1042080 additions and 6 deletions
6
.github/workflows/docker-image.yml
vendored
6
.github/workflows/docker-image.yml
vendored
|
@ -10,9 +10,9 @@ on:
|
|||
# schedule:
|
||||
# - cron: '35 2 * * 1'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
6
.github/workflows/validate.yml
vendored
6
.github/workflows/validate.yml
vendored
|
@ -2,9 +2,9 @@ name: Validate/Lint
|
|||
|
||||
on: [push, pull_request]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
|
|
12
node_modules/.bin/cake
generated
vendored
Normal file
12
node_modules/.bin/cake
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../coffee-script/bin/cake" "$@"
|
||||
else
|
||||
exec node "$basedir/../coffee-script/bin/cake" "$@"
|
||||
fi
|
17
node_modules/.bin/cake.cmd
generated
vendored
Normal file
17
node_modules/.bin/cake.cmd
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\coffee-script\bin\cake" %*
|
28
node_modules/.bin/cake.ps1
generated
vendored
Normal file
28
node_modules/.bin/cake.ps1
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../coffee-script/bin/cake" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../coffee-script/bin/cake" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../coffee-script/bin/cake" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../coffee-script/bin/cake" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
12
node_modules/.bin/coffee
generated
vendored
Normal file
12
node_modules/.bin/coffee
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../coffee-script/bin/coffee" "$@"
|
||||
else
|
||||
exec node "$basedir/../coffee-script/bin/coffee" "$@"
|
||||
fi
|
17
node_modules/.bin/coffee.cmd
generated
vendored
Normal file
17
node_modules/.bin/coffee.cmd
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\coffee-script\bin\coffee" %*
|
28
node_modules/.bin/coffee.ps1
generated
vendored
Normal file
28
node_modules/.bin/coffee.ps1
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../coffee-script/bin/coffee" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../coffee-script/bin/coffee" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../coffee-script/bin/coffee" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../coffee-script/bin/coffee" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
12
node_modules/.bin/esparse
generated
vendored
Normal file
12
node_modules/.bin/esparse
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../esprima/bin/esparse.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../esprima/bin/esparse.js" "$@"
|
||||
fi
|
17
node_modules/.bin/esparse.cmd
generated
vendored
Normal file
17
node_modules/.bin/esparse.cmd
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\esprima\bin\esparse.js" %*
|
28
node_modules/.bin/esparse.ps1
generated
vendored
Normal file
28
node_modules/.bin/esparse.ps1
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../esprima/bin/esparse.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../esprima/bin/esparse.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../esprima/bin/esparse.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../esprima/bin/esparse.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
12
node_modules/.bin/esvalidate
generated
vendored
Normal file
12
node_modules/.bin/esvalidate
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../esprima/bin/esvalidate.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../esprima/bin/esvalidate.js" "$@"
|
||||
fi
|
17
node_modules/.bin/esvalidate.cmd
generated
vendored
Normal file
17
node_modules/.bin/esvalidate.cmd
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\esprima\bin\esvalidate.js" %*
|
28
node_modules/.bin/esvalidate.ps1
generated
vendored
Normal file
28
node_modules/.bin/esvalidate.ps1
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../esprima/bin/esvalidate.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../esprima/bin/esvalidate.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../esprima/bin/esvalidate.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../esprima/bin/esvalidate.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
12
node_modules/.bin/js-yaml
generated
vendored
Normal file
12
node_modules/.bin/js-yaml
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../js-yaml/bin/js-yaml.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../js-yaml/bin/js-yaml.js" "$@"
|
||||
fi
|
17
node_modules/.bin/js-yaml.cmd
generated
vendored
Normal file
17
node_modules/.bin/js-yaml.cmd
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\js-yaml\bin\js-yaml.js" %*
|
28
node_modules/.bin/js-yaml.ps1
generated
vendored
Normal file
28
node_modules/.bin/js-yaml.ps1
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../js-yaml/bin/js-yaml.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../js-yaml/bin/js-yaml.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../js-yaml/bin/js-yaml.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../js-yaml/bin/js-yaml.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
28
node_modules/.bin/mpd-to-m3u8-json.ps1
generated
vendored
Normal file
28
node_modules/.bin/mpd-to-m3u8-json.ps1
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../mpd-parser/bin/parse.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../mpd-parser/bin/parse.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../mpd-parser/bin/parse.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../mpd-parser/bin/parse.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
28
node_modules/.bin/muxjs-transmux.ps1
generated
vendored
Normal file
28
node_modules/.bin/muxjs-transmux.ps1
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../mux.js/bin/transmux.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../mux.js/bin/transmux.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../mux.js/bin/transmux.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../mux.js/bin/transmux.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
12
node_modules/.bin/nopt
generated
vendored
Normal file
12
node_modules/.bin/nopt
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../nopt/bin/nopt.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../nopt/bin/nopt.js" "$@"
|
||||
fi
|
17
node_modules/.bin/nopt.cmd
generated
vendored
Normal file
17
node_modules/.bin/nopt.cmd
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\nopt\bin\nopt.js" %*
|
28
node_modules/.bin/nopt.ps1
generated
vendored
Normal file
28
node_modules/.bin/nopt.ps1
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../nopt/bin/nopt.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../nopt/bin/nopt.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../nopt/bin/nopt.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../nopt/bin/nopt.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
28
node_modules/.bin/pkcs7.ps1
generated
vendored
Normal file
28
node_modules/.bin/pkcs7.ps1
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../pkcs7/bin/cli.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../pkcs7/bin/cli.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../pkcs7/bin/cli.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../pkcs7/bin/cli.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
12
node_modules/.bin/rimraf
generated
vendored
Normal file
12
node_modules/.bin/rimraf
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../rimraf/bin.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../rimraf/bin.js" "$@"
|
||||
fi
|
17
node_modules/.bin/rimraf.cmd
generated
vendored
Normal file
17
node_modules/.bin/rimraf.cmd
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\rimraf\bin.js" %*
|
28
node_modules/.bin/rimraf.ps1
generated
vendored
Normal file
28
node_modules/.bin/rimraf.ps1
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../rimraf/bin.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../rimraf/bin.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../rimraf/bin.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../rimraf/bin.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
12
node_modules/.bin/uglifyjs
generated
vendored
Normal file
12
node_modules/.bin/uglifyjs
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../uglify-js/bin/uglifyjs" "$@"
|
||||
else
|
||||
exec node "$basedir/../uglify-js/bin/uglifyjs" "$@"
|
||||
fi
|
17
node_modules/.bin/uglifyjs.cmd
generated
vendored
Normal file
17
node_modules/.bin/uglifyjs.cmd
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\uglify-js\bin\uglifyjs" %*
|
28
node_modules/.bin/uglifyjs.ps1
generated
vendored
Normal file
28
node_modules/.bin/uglifyjs.ps1
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../uglify-js/bin/uglifyjs" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../uglify-js/bin/uglifyjs" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../uglify-js/bin/uglifyjs" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../uglify-js/bin/uglifyjs" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
12
node_modules/.bin/which
generated
vendored
Normal file
12
node_modules/.bin/which
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../which/bin/which" "$@"
|
||||
else
|
||||
exec node "$basedir/../which/bin/which" "$@"
|
||||
fi
|
17
node_modules/.bin/which.cmd
generated
vendored
Normal file
17
node_modules/.bin/which.cmd
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\which\bin\which" %*
|
28
node_modules/.bin/which.ps1
generated
vendored
Normal file
28
node_modules/.bin/which.ps1
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../which/bin/which" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../which/bin/which" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../which/bin/which" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../which/bin/which" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
1009
node_modules/.package-lock.json
generated
vendored
Normal file
1009
node_modules/.package-lock.json
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
284
node_modules/@babel/runtime/helpers/applyDecs.js
generated
vendored
Normal file
284
node_modules/@babel/runtime/helpers/applyDecs.js
generated
vendored
Normal file
|
@ -0,0 +1,284 @@
|
|||
var _typeof = require("./typeof.js")["default"];
|
||||
|
||||
function createMetadataMethodsForProperty(metadataMap, kind, property, decoratorFinishedRef) {
|
||||
return {
|
||||
getMetadata: function getMetadata(key) {
|
||||
assertNotFinished(decoratorFinishedRef, "getMetadata"), assertMetadataKey(key);
|
||||
var metadataForKey = metadataMap[key];
|
||||
if (void 0 !== metadataForKey) if (1 === kind) {
|
||||
var pub = metadataForKey["public"];
|
||||
if (void 0 !== pub) return pub[property];
|
||||
} else if (2 === kind) {
|
||||
var priv = metadataForKey["private"];
|
||||
if (void 0 !== priv) return priv.get(property);
|
||||
} else if (Object.hasOwnProperty.call(metadataForKey, "constructor")) return metadataForKey.constructor;
|
||||
},
|
||||
setMetadata: function setMetadata(key, value) {
|
||||
assertNotFinished(decoratorFinishedRef, "setMetadata"), assertMetadataKey(key);
|
||||
var metadataForKey = metadataMap[key];
|
||||
|
||||
if (void 0 === metadataForKey && (metadataForKey = metadataMap[key] = {}), 1 === kind) {
|
||||
var pub = metadataForKey["public"];
|
||||
void 0 === pub && (pub = metadataForKey["public"] = {}), pub[property] = value;
|
||||
} else if (2 === kind) {
|
||||
var priv = metadataForKey.priv;
|
||||
void 0 === priv && (priv = metadataForKey["private"] = new Map()), priv.set(property, value);
|
||||
} else metadataForKey.constructor = value;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function convertMetadataMapToFinal(obj, metadataMap) {
|
||||
var parentMetadataMap = obj[Symbol.metadata || Symbol["for"]("Symbol.metadata")],
|
||||
metadataKeys = Object.getOwnPropertySymbols(metadataMap);
|
||||
|
||||
if (0 !== metadataKeys.length) {
|
||||
for (var i = 0; i < metadataKeys.length; i++) {
|
||||
var key = metadataKeys[i],
|
||||
metaForKey = metadataMap[key],
|
||||
parentMetaForKey = parentMetadataMap ? parentMetadataMap[key] : null,
|
||||
pub = metaForKey["public"],
|
||||
parentPub = parentMetaForKey ? parentMetaForKey["public"] : null;
|
||||
pub && parentPub && Object.setPrototypeOf(pub, parentPub);
|
||||
var priv = metaForKey["private"];
|
||||
|
||||
if (priv) {
|
||||
var privArr = Array.from(priv.values()),
|
||||
parentPriv = parentMetaForKey ? parentMetaForKey["private"] : null;
|
||||
parentPriv && (privArr = privArr.concat(parentPriv)), metaForKey["private"] = privArr;
|
||||
}
|
||||
|
||||
parentMetaForKey && Object.setPrototypeOf(metaForKey, parentMetaForKey);
|
||||
}
|
||||
|
||||
parentMetadataMap && Object.setPrototypeOf(metadataMap, parentMetadataMap), obj[Symbol.metadata || Symbol["for"]("Symbol.metadata")] = metadataMap;
|
||||
}
|
||||
}
|
||||
|
||||
function createAddInitializerMethod(initializers, decoratorFinishedRef) {
|
||||
return function (initializer) {
|
||||
assertNotFinished(decoratorFinishedRef, "addInitializer"), assertCallable(initializer, "An initializer"), initializers.push(initializer);
|
||||
};
|
||||
}
|
||||
|
||||
function memberDec(dec, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value) {
|
||||
var kindStr;
|
||||
|
||||
switch (kind) {
|
||||
case 1:
|
||||
kindStr = "accessor";
|
||||
break;
|
||||
|
||||
case 2:
|
||||
kindStr = "method";
|
||||
break;
|
||||
|
||||
case 3:
|
||||
kindStr = "getter";
|
||||
break;
|
||||
|
||||
case 4:
|
||||
kindStr = "setter";
|
||||
break;
|
||||
|
||||
default:
|
||||
kindStr = "field";
|
||||
}
|
||||
|
||||
var metadataKind,
|
||||
metadataName,
|
||||
ctx = {
|
||||
kind: kindStr,
|
||||
name: isPrivate ? "#" + name : name,
|
||||
isStatic: isStatic,
|
||||
isPrivate: isPrivate
|
||||
},
|
||||
decoratorFinishedRef = {
|
||||
v: !1
|
||||
};
|
||||
|
||||
if (0 !== kind && (ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef)), isPrivate) {
|
||||
metadataKind = 2, metadataName = Symbol(name);
|
||||
var access = {};
|
||||
0 === kind ? (access.get = desc.get, access.set = desc.set) : 2 === kind ? access.get = function () {
|
||||
return desc.value;
|
||||
} : (1 !== kind && 3 !== kind || (access.get = function () {
|
||||
return desc.get.call(this);
|
||||
}), 1 !== kind && 4 !== kind || (access.set = function (v) {
|
||||
desc.set.call(this, v);
|
||||
})), ctx.access = access;
|
||||
} else metadataKind = 1, metadataName = name;
|
||||
|
||||
try {
|
||||
return dec(value, Object.assign(ctx, createMetadataMethodsForProperty(metadataMap, metadataKind, metadataName, decoratorFinishedRef)));
|
||||
} finally {
|
||||
decoratorFinishedRef.v = !0;
|
||||
}
|
||||
}
|
||||
|
||||
function assertNotFinished(decoratorFinishedRef, fnName) {
|
||||
if (decoratorFinishedRef.v) throw new Error("attempted to call " + fnName + " after decoration was finished");
|
||||
}
|
||||
|
||||
function assertMetadataKey(key) {
|
||||
if ("symbol" != _typeof(key)) throw new TypeError("Metadata keys must be symbols, received: " + key);
|
||||
}
|
||||
|
||||
function assertCallable(fn, hint) {
|
||||
if ("function" != typeof fn) throw new TypeError(hint + " must be a function");
|
||||
}
|
||||
|
||||
function assertValidReturnValue(kind, value) {
|
||||
var type = _typeof(value);
|
||||
|
||||
if (1 === kind) {
|
||||
if ("object" !== type || null === value) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
||||
void 0 !== value.get && assertCallable(value.get, "accessor.get"), void 0 !== value.set && assertCallable(value.set, "accessor.set"), void 0 !== value.init && assertCallable(value.init, "accessor.init"), void 0 !== value.initializer && assertCallable(value.initializer, "accessor.initializer");
|
||||
} else if ("function" !== type) {
|
||||
var hint;
|
||||
throw hint = 0 === kind ? "field" : 10 === kind ? "class" : "method", new TypeError(hint + " decorators must return a function or void 0");
|
||||
}
|
||||
}
|
||||
|
||||
function getInit(desc) {
|
||||
var initializer;
|
||||
return null == (initializer = desc.init) && (initializer = desc.initializer) && "undefined" != typeof console && console.warn(".initializer has been renamed to .init as of March 2022"), initializer;
|
||||
}
|
||||
|
||||
function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, metadataMap, initializers) {
|
||||
var desc,
|
||||
initializer,
|
||||
value,
|
||||
newValue,
|
||||
get,
|
||||
set,
|
||||
decs = decInfo[0];
|
||||
if (isPrivate ? desc = 0 === kind || 1 === kind ? {
|
||||
get: decInfo[3],
|
||||
set: decInfo[4]
|
||||
} : 3 === kind ? {
|
||||
get: decInfo[3]
|
||||
} : 4 === kind ? {
|
||||
set: decInfo[3]
|
||||
} : {
|
||||
value: decInfo[3]
|
||||
} : 0 !== kind && (desc = Object.getOwnPropertyDescriptor(base, name)), 1 === kind ? value = {
|
||||
get: desc.get,
|
||||
set: desc.set
|
||||
} : 2 === kind ? value = desc.value : 3 === kind ? value = desc.get : 4 === kind && (value = desc.set), "function" == typeof decs) void 0 !== (newValue = memberDec(decs, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value)) && (assertValidReturnValue(kind, newValue), 0 === kind ? initializer = newValue : 1 === kind ? (initializer = getInit(newValue), get = newValue.get || value.get, set = newValue.set || value.set, value = {
|
||||
get: get,
|
||||
set: set
|
||||
}) : value = newValue);else for (var i = decs.length - 1; i >= 0; i--) {
|
||||
var newInit;
|
||||
if (void 0 !== (newValue = memberDec(decs[i], name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value))) assertValidReturnValue(kind, newValue), 0 === kind ? newInit = newValue : 1 === kind ? (newInit = getInit(newValue), get = newValue.get || value.get, set = newValue.set || value.set, value = {
|
||||
get: get,
|
||||
set: set
|
||||
}) : value = newValue, void 0 !== newInit && (void 0 === initializer ? initializer = newInit : "function" == typeof initializer ? initializer = [initializer, newInit] : initializer.push(newInit));
|
||||
}
|
||||
|
||||
if (0 === kind || 1 === kind) {
|
||||
if (void 0 === initializer) initializer = function initializer(instance, init) {
|
||||
return init;
|
||||
};else if ("function" != typeof initializer) {
|
||||
var ownInitializers = initializer;
|
||||
|
||||
initializer = function initializer(instance, init) {
|
||||
for (var value = init, i = 0; i < ownInitializers.length; i++) {
|
||||
value = ownInitializers[i].call(instance, value);
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
} else {
|
||||
var originalInitializer = initializer;
|
||||
|
||||
initializer = function initializer(instance, init) {
|
||||
return originalInitializer.call(instance, init);
|
||||
};
|
||||
}
|
||||
ret.push(initializer);
|
||||
}
|
||||
|
||||
0 !== kind && (1 === kind ? (desc.get = value.get, desc.set = value.set) : 2 === kind ? desc.value = value : 3 === kind ? desc.get = value : 4 === kind && (desc.set = value), isPrivate ? 1 === kind ? (ret.push(function (instance, args) {
|
||||
return value.get.call(instance, args);
|
||||
}), ret.push(function (instance, args) {
|
||||
return value.set.call(instance, args);
|
||||
})) : 2 === kind ? ret.push(value) : ret.push(function (instance, args) {
|
||||
return value.call(instance, args);
|
||||
}) : Object.defineProperty(base, name, desc));
|
||||
}
|
||||
|
||||
function applyMemberDecs(ret, Class, protoMetadataMap, staticMetadataMap, decInfos) {
|
||||
for (var protoInitializers, staticInitializers, existingProtoNonFields = new Map(), existingStaticNonFields = new Map(), i = 0; i < decInfos.length; i++) {
|
||||
var decInfo = decInfos[i];
|
||||
|
||||
if (Array.isArray(decInfo)) {
|
||||
var base,
|
||||
metadataMap,
|
||||
initializers,
|
||||
kind = decInfo[1],
|
||||
name = decInfo[2],
|
||||
isPrivate = decInfo.length > 3,
|
||||
isStatic = kind >= 5;
|
||||
|
||||
if (isStatic ? (base = Class, metadataMap = staticMetadataMap, 0 !== (kind -= 5) && (initializers = staticInitializers = staticInitializers || [])) : (base = Class.prototype, metadataMap = protoMetadataMap, 0 !== kind && (initializers = protoInitializers = protoInitializers || [])), 0 !== kind && !isPrivate) {
|
||||
var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields,
|
||||
existingKind = existingNonFields.get(name) || 0;
|
||||
if (!0 === existingKind || 3 === existingKind && 4 !== kind || 4 === existingKind && 3 !== kind) throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
|
||||
!existingKind && kind > 2 ? existingNonFields.set(name, kind) : existingNonFields.set(name, !0);
|
||||
}
|
||||
|
||||
applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, metadataMap, initializers);
|
||||
}
|
||||
}
|
||||
|
||||
pushInitializers(ret, protoInitializers), pushInitializers(ret, staticInitializers);
|
||||
}
|
||||
|
||||
function pushInitializers(ret, initializers) {
|
||||
initializers && ret.push(function (instance) {
|
||||
for (var i = 0; i < initializers.length; i++) {
|
||||
initializers[i].call(instance);
|
||||
}
|
||||
|
||||
return instance;
|
||||
});
|
||||
}
|
||||
|
||||
function applyClassDecs(ret, targetClass, metadataMap, classDecs) {
|
||||
if (classDecs.length > 0) {
|
||||
for (var initializers = [], newClass = targetClass, name = targetClass.name, i = classDecs.length - 1; i >= 0; i--) {
|
||||
var decoratorFinishedRef = {
|
||||
v: !1
|
||||
};
|
||||
|
||||
try {
|
||||
var ctx = Object.assign({
|
||||
kind: "class",
|
||||
name: name,
|
||||
addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef)
|
||||
}, createMetadataMethodsForProperty(metadataMap, 0, name, decoratorFinishedRef)),
|
||||
nextNewClass = classDecs[i](newClass, ctx);
|
||||
} finally {
|
||||
decoratorFinishedRef.v = !0;
|
||||
}
|
||||
|
||||
void 0 !== nextNewClass && (assertValidReturnValue(10, nextNewClass), newClass = nextNewClass);
|
||||
}
|
||||
|
||||
ret.push(newClass, function () {
|
||||
for (var i = 0; i < initializers.length; i++) {
|
||||
initializers[i].call(newClass);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function applyDecs(targetClass, memberDecs, classDecs) {
|
||||
var ret = [],
|
||||
staticMetadataMap = {},
|
||||
protoMetadataMap = {};
|
||||
return applyMemberDecs(ret, targetClass, protoMetadataMap, staticMetadataMap, memberDecs), convertMetadataMapToFinal(targetClass.prototype, protoMetadataMap), applyClassDecs(ret, targetClass, staticMetadataMap, classDecs), convertMetadataMapToFinal(targetClass, staticMetadataMap), ret;
|
||||
}
|
||||
|
||||
module.exports = applyDecs, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
282
node_modules/@babel/runtime/helpers/esm/applyDecs.js
generated
vendored
Normal file
282
node_modules/@babel/runtime/helpers/esm/applyDecs.js
generated
vendored
Normal file
|
@ -0,0 +1,282 @@
|
|||
import _typeof from "./typeof.js";
|
||||
|
||||
function createMetadataMethodsForProperty(metadataMap, kind, property, decoratorFinishedRef) {
|
||||
return {
|
||||
getMetadata: function getMetadata(key) {
|
||||
assertNotFinished(decoratorFinishedRef, "getMetadata"), assertMetadataKey(key);
|
||||
var metadataForKey = metadataMap[key];
|
||||
if (void 0 !== metadataForKey) if (1 === kind) {
|
||||
var pub = metadataForKey["public"];
|
||||
if (void 0 !== pub) return pub[property];
|
||||
} else if (2 === kind) {
|
||||
var priv = metadataForKey["private"];
|
||||
if (void 0 !== priv) return priv.get(property);
|
||||
} else if (Object.hasOwnProperty.call(metadataForKey, "constructor")) return metadataForKey.constructor;
|
||||
},
|
||||
setMetadata: function setMetadata(key, value) {
|
||||
assertNotFinished(decoratorFinishedRef, "setMetadata"), assertMetadataKey(key);
|
||||
var metadataForKey = metadataMap[key];
|
||||
|
||||
if (void 0 === metadataForKey && (metadataForKey = metadataMap[key] = {}), 1 === kind) {
|
||||
var pub = metadataForKey["public"];
|
||||
void 0 === pub && (pub = metadataForKey["public"] = {}), pub[property] = value;
|
||||
} else if (2 === kind) {
|
||||
var priv = metadataForKey.priv;
|
||||
void 0 === priv && (priv = metadataForKey["private"] = new Map()), priv.set(property, value);
|
||||
} else metadataForKey.constructor = value;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function convertMetadataMapToFinal(obj, metadataMap) {
|
||||
var parentMetadataMap = obj[Symbol.metadata || Symbol["for"]("Symbol.metadata")],
|
||||
metadataKeys = Object.getOwnPropertySymbols(metadataMap);
|
||||
|
||||
if (0 !== metadataKeys.length) {
|
||||
for (var i = 0; i < metadataKeys.length; i++) {
|
||||
var key = metadataKeys[i],
|
||||
metaForKey = metadataMap[key],
|
||||
parentMetaForKey = parentMetadataMap ? parentMetadataMap[key] : null,
|
||||
pub = metaForKey["public"],
|
||||
parentPub = parentMetaForKey ? parentMetaForKey["public"] : null;
|
||||
pub && parentPub && Object.setPrototypeOf(pub, parentPub);
|
||||
var priv = metaForKey["private"];
|
||||
|
||||
if (priv) {
|
||||
var privArr = Array.from(priv.values()),
|
||||
parentPriv = parentMetaForKey ? parentMetaForKey["private"] : null;
|
||||
parentPriv && (privArr = privArr.concat(parentPriv)), metaForKey["private"] = privArr;
|
||||
}
|
||||
|
||||
parentMetaForKey && Object.setPrototypeOf(metaForKey, parentMetaForKey);
|
||||
}
|
||||
|
||||
parentMetadataMap && Object.setPrototypeOf(metadataMap, parentMetadataMap), obj[Symbol.metadata || Symbol["for"]("Symbol.metadata")] = metadataMap;
|
||||
}
|
||||
}
|
||||
|
||||
function createAddInitializerMethod(initializers, decoratorFinishedRef) {
|
||||
return function (initializer) {
|
||||
assertNotFinished(decoratorFinishedRef, "addInitializer"), assertCallable(initializer, "An initializer"), initializers.push(initializer);
|
||||
};
|
||||
}
|
||||
|
||||
function memberDec(dec, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value) {
|
||||
var kindStr;
|
||||
|
||||
switch (kind) {
|
||||
case 1:
|
||||
kindStr = "accessor";
|
||||
break;
|
||||
|
||||
case 2:
|
||||
kindStr = "method";
|
||||
break;
|
||||
|
||||
case 3:
|
||||
kindStr = "getter";
|
||||
break;
|
||||
|
||||
case 4:
|
||||
kindStr = "setter";
|
||||
break;
|
||||
|
||||
default:
|
||||
kindStr = "field";
|
||||
}
|
||||
|
||||
var metadataKind,
|
||||
metadataName,
|
||||
ctx = {
|
||||
kind: kindStr,
|
||||
name: isPrivate ? "#" + name : name,
|
||||
isStatic: isStatic,
|
||||
isPrivate: isPrivate
|
||||
},
|
||||
decoratorFinishedRef = {
|
||||
v: !1
|
||||
};
|
||||
|
||||
if (0 !== kind && (ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef)), isPrivate) {
|
||||
metadataKind = 2, metadataName = Symbol(name);
|
||||
var access = {};
|
||||
0 === kind ? (access.get = desc.get, access.set = desc.set) : 2 === kind ? access.get = function () {
|
||||
return desc.value;
|
||||
} : (1 !== kind && 3 !== kind || (access.get = function () {
|
||||
return desc.get.call(this);
|
||||
}), 1 !== kind && 4 !== kind || (access.set = function (v) {
|
||||
desc.set.call(this, v);
|
||||
})), ctx.access = access;
|
||||
} else metadataKind = 1, metadataName = name;
|
||||
|
||||
try {
|
||||
return dec(value, Object.assign(ctx, createMetadataMethodsForProperty(metadataMap, metadataKind, metadataName, decoratorFinishedRef)));
|
||||
} finally {
|
||||
decoratorFinishedRef.v = !0;
|
||||
}
|
||||
}
|
||||
|
||||
function assertNotFinished(decoratorFinishedRef, fnName) {
|
||||
if (decoratorFinishedRef.v) throw new Error("attempted to call " + fnName + " after decoration was finished");
|
||||
}
|
||||
|
||||
function assertMetadataKey(key) {
|
||||
if ("symbol" != _typeof(key)) throw new TypeError("Metadata keys must be symbols, received: " + key);
|
||||
}
|
||||
|
||||
function assertCallable(fn, hint) {
|
||||
if ("function" != typeof fn) throw new TypeError(hint + " must be a function");
|
||||
}
|
||||
|
||||
function assertValidReturnValue(kind, value) {
|
||||
var type = _typeof(value);
|
||||
|
||||
if (1 === kind) {
|
||||
if ("object" !== type || null === value) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
||||
void 0 !== value.get && assertCallable(value.get, "accessor.get"), void 0 !== value.set && assertCallable(value.set, "accessor.set"), void 0 !== value.init && assertCallable(value.init, "accessor.init"), void 0 !== value.initializer && assertCallable(value.initializer, "accessor.initializer");
|
||||
} else if ("function" !== type) {
|
||||
var hint;
|
||||
throw hint = 0 === kind ? "field" : 10 === kind ? "class" : "method", new TypeError(hint + " decorators must return a function or void 0");
|
||||
}
|
||||
}
|
||||
|
||||
function getInit(desc) {
|
||||
var initializer;
|
||||
return null == (initializer = desc.init) && (initializer = desc.initializer) && "undefined" != typeof console && console.warn(".initializer has been renamed to .init as of March 2022"), initializer;
|
||||
}
|
||||
|
||||
function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, metadataMap, initializers) {
|
||||
var desc,
|
||||
initializer,
|
||||
value,
|
||||
newValue,
|
||||
get,
|
||||
set,
|
||||
decs = decInfo[0];
|
||||
if (isPrivate ? desc = 0 === kind || 1 === kind ? {
|
||||
get: decInfo[3],
|
||||
set: decInfo[4]
|
||||
} : 3 === kind ? {
|
||||
get: decInfo[3]
|
||||
} : 4 === kind ? {
|
||||
set: decInfo[3]
|
||||
} : {
|
||||
value: decInfo[3]
|
||||
} : 0 !== kind && (desc = Object.getOwnPropertyDescriptor(base, name)), 1 === kind ? value = {
|
||||
get: desc.get,
|
||||
set: desc.set
|
||||
} : 2 === kind ? value = desc.value : 3 === kind ? value = desc.get : 4 === kind && (value = desc.set), "function" == typeof decs) void 0 !== (newValue = memberDec(decs, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value)) && (assertValidReturnValue(kind, newValue), 0 === kind ? initializer = newValue : 1 === kind ? (initializer = getInit(newValue), get = newValue.get || value.get, set = newValue.set || value.set, value = {
|
||||
get: get,
|
||||
set: set
|
||||
}) : value = newValue);else for (var i = decs.length - 1; i >= 0; i--) {
|
||||
var newInit;
|
||||
if (void 0 !== (newValue = memberDec(decs[i], name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value))) assertValidReturnValue(kind, newValue), 0 === kind ? newInit = newValue : 1 === kind ? (newInit = getInit(newValue), get = newValue.get || value.get, set = newValue.set || value.set, value = {
|
||||
get: get,
|
||||
set: set
|
||||
}) : value = newValue, void 0 !== newInit && (void 0 === initializer ? initializer = newInit : "function" == typeof initializer ? initializer = [initializer, newInit] : initializer.push(newInit));
|
||||
}
|
||||
|
||||
if (0 === kind || 1 === kind) {
|
||||
if (void 0 === initializer) initializer = function initializer(instance, init) {
|
||||
return init;
|
||||
};else if ("function" != typeof initializer) {
|
||||
var ownInitializers = initializer;
|
||||
|
||||
initializer = function initializer(instance, init) {
|
||||
for (var value = init, i = 0; i < ownInitializers.length; i++) {
|
||||
value = ownInitializers[i].call(instance, value);
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
} else {
|
||||
var originalInitializer = initializer;
|
||||
|
||||
initializer = function initializer(instance, init) {
|
||||
return originalInitializer.call(instance, init);
|
||||
};
|
||||
}
|
||||
ret.push(initializer);
|
||||
}
|
||||
|
||||
0 !== kind && (1 === kind ? (desc.get = value.get, desc.set = value.set) : 2 === kind ? desc.value = value : 3 === kind ? desc.get = value : 4 === kind && (desc.set = value), isPrivate ? 1 === kind ? (ret.push(function (instance, args) {
|
||||
return value.get.call(instance, args);
|
||||
}), ret.push(function (instance, args) {
|
||||
return value.set.call(instance, args);
|
||||
})) : 2 === kind ? ret.push(value) : ret.push(function (instance, args) {
|
||||
return value.call(instance, args);
|
||||
}) : Object.defineProperty(base, name, desc));
|
||||
}
|
||||
|
||||
function applyMemberDecs(ret, Class, protoMetadataMap, staticMetadataMap, decInfos) {
|
||||
for (var protoInitializers, staticInitializers, existingProtoNonFields = new Map(), existingStaticNonFields = new Map(), i = 0; i < decInfos.length; i++) {
|
||||
var decInfo = decInfos[i];
|
||||
|
||||
if (Array.isArray(decInfo)) {
|
||||
var base,
|
||||
metadataMap,
|
||||
initializers,
|
||||
kind = decInfo[1],
|
||||
name = decInfo[2],
|
||||
isPrivate = decInfo.length > 3,
|
||||
isStatic = kind >= 5;
|
||||
|
||||
if (isStatic ? (base = Class, metadataMap = staticMetadataMap, 0 !== (kind -= 5) && (initializers = staticInitializers = staticInitializers || [])) : (base = Class.prototype, metadataMap = protoMetadataMap, 0 !== kind && (initializers = protoInitializers = protoInitializers || [])), 0 !== kind && !isPrivate) {
|
||||
var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields,
|
||||
existingKind = existingNonFields.get(name) || 0;
|
||||
if (!0 === existingKind || 3 === existingKind && 4 !== kind || 4 === existingKind && 3 !== kind) throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
|
||||
!existingKind && kind > 2 ? existingNonFields.set(name, kind) : existingNonFields.set(name, !0);
|
||||
}
|
||||
|
||||
applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, metadataMap, initializers);
|
||||
}
|
||||
}
|
||||
|
||||
pushInitializers(ret, protoInitializers), pushInitializers(ret, staticInitializers);
|
||||
}
|
||||
|
||||
function pushInitializers(ret, initializers) {
|
||||
initializers && ret.push(function (instance) {
|
||||
for (var i = 0; i < initializers.length; i++) {
|
||||
initializers[i].call(instance);
|
||||
}
|
||||
|
||||
return instance;
|
||||
});
|
||||
}
|
||||
|
||||
function applyClassDecs(ret, targetClass, metadataMap, classDecs) {
|
||||
if (classDecs.length > 0) {
|
||||
for (var initializers = [], newClass = targetClass, name = targetClass.name, i = classDecs.length - 1; i >= 0; i--) {
|
||||
var decoratorFinishedRef = {
|
||||
v: !1
|
||||
};
|
||||
|
||||
try {
|
||||
var ctx = Object.assign({
|
||||
kind: "class",
|
||||
name: name,
|
||||
addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef)
|
||||
}, createMetadataMethodsForProperty(metadataMap, 0, name, decoratorFinishedRef)),
|
||||
nextNewClass = classDecs[i](newClass, ctx);
|
||||
} finally {
|
||||
decoratorFinishedRef.v = !0;
|
||||
}
|
||||
|
||||
void 0 !== nextNewClass && (assertValidReturnValue(10, nextNewClass), newClass = nextNewClass);
|
||||
}
|
||||
|
||||
ret.push(newClass, function () {
|
||||
for (var i = 0; i < initializers.length; i++) {
|
||||
initializers[i].call(newClass);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default function applyDecs(targetClass, memberDecs, classDecs) {
|
||||
var ret = [],
|
||||
staticMetadataMap = {},
|
||||
protoMetadataMap = {};
|
||||
return applyMemberDecs(ret, targetClass, protoMetadataMap, staticMetadataMap, memberDecs), convertMetadataMapToFinal(targetClass.prototype, protoMetadataMap), applyClassDecs(ret, targetClass, staticMetadataMap, classDecs), convertMetadataMapToFinal(targetClass, staticMetadataMap), ret;
|
||||
}
|
3
node_modules/@babel/runtime/helpers/esm/identity.js
generated
vendored
Normal file
3
node_modules/@babel/runtime/helpers/esm/identity.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
export default function _identity(x) {
|
||||
return x;
|
||||
}
|
352
node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js
generated
vendored
Normal file
352
node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js
generated
vendored
Normal file
|
@ -0,0 +1,352 @@
|
|||
import _typeof from "./typeof.js";
|
||||
export default function _regeneratorRuntime() {
|
||||
"use strict";
|
||||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
||||
|
||||
_regeneratorRuntime = function _regeneratorRuntime() {
|
||||
return exports;
|
||||
};
|
||||
|
||||
var exports = {},
|
||||
Op = Object.prototype,
|
||||
hasOwn = Op.hasOwnProperty,
|
||||
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
||||
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
||||
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
||||
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
||||
|
||||
function define(obj, key, value) {
|
||||
return Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: !0,
|
||||
configurable: !0,
|
||||
writable: !0
|
||||
}), obj[key];
|
||||
}
|
||||
|
||||
try {
|
||||
define({}, "");
|
||||
} catch (err) {
|
||||
define = function define(obj, key, value) {
|
||||
return obj[key] = value;
|
||||
};
|
||||
}
|
||||
|
||||
function wrap(innerFn, outerFn, self, tryLocsList) {
|
||||
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
||||
generator = Object.create(protoGenerator.prototype),
|
||||
context = new Context(tryLocsList || []);
|
||||
return generator._invoke = function (innerFn, self, context) {
|
||||
var state = "suspendedStart";
|
||||
return function (method, arg) {
|
||||
if ("executing" === state) throw new Error("Generator is already running");
|
||||
|
||||
if ("completed" === state) {
|
||||
if ("throw" === method) throw arg;
|
||||
return doneResult();
|
||||
}
|
||||
|
||||
for (context.method = method, context.arg = arg;;) {
|
||||
var delegate = context.delegate;
|
||||
|
||||
if (delegate) {
|
||||
var delegateResult = maybeInvokeDelegate(delegate, context);
|
||||
|
||||
if (delegateResult) {
|
||||
if (delegateResult === ContinueSentinel) continue;
|
||||
return delegateResult;
|
||||
}
|
||||
}
|
||||
|
||||
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
||||
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
||||
context.dispatchException(context.arg);
|
||||
} else "return" === context.method && context.abrupt("return", context.arg);
|
||||
state = "executing";
|
||||
var record = tryCatch(innerFn, self, context);
|
||||
|
||||
if ("normal" === record.type) {
|
||||
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
||||
return {
|
||||
value: record.arg,
|
||||
done: context.done
|
||||
};
|
||||
}
|
||||
|
||||
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
||||
}
|
||||
};
|
||||
}(innerFn, self, context), generator;
|
||||
}
|
||||
|
||||
function tryCatch(fn, obj, arg) {
|
||||
try {
|
||||
return {
|
||||
type: "normal",
|
||||
arg: fn.call(obj, arg)
|
||||
};
|
||||
} catch (err) {
|
||||
return {
|
||||
type: "throw",
|
||||
arg: err
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
exports.wrap = wrap;
|
||||
var ContinueSentinel = {};
|
||||
|
||||
function Generator() {}
|
||||
|
||||
function GeneratorFunction() {}
|
||||
|
||||
function GeneratorFunctionPrototype() {}
|
||||
|
||||
var IteratorPrototype = {};
|
||||
define(IteratorPrototype, iteratorSymbol, function () {
|
||||
return this;
|
||||
});
|
||||
var getProto = Object.getPrototypeOf,
|
||||
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
||||
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
||||
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
||||
|
||||
function defineIteratorMethods(prototype) {
|
||||
["next", "throw", "return"].forEach(function (method) {
|
||||
define(prototype, method, function (arg) {
|
||||
return this._invoke(method, arg);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function AsyncIterator(generator, PromiseImpl) {
|
||||
function invoke(method, arg, resolve, reject) {
|
||||
var record = tryCatch(generator[method], generator, arg);
|
||||
|
||||
if ("throw" !== record.type) {
|
||||
var result = record.arg,
|
||||
value = result.value;
|
||||
return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
||||
invoke("next", value, resolve, reject);
|
||||
}, function (err) {
|
||||
invoke("throw", err, resolve, reject);
|
||||
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
||||
result.value = unwrapped, resolve(result);
|
||||
}, function (error) {
|
||||
return invoke("throw", error, resolve, reject);
|
||||
});
|
||||
}
|
||||
|
||||
reject(record.arg);
|
||||
}
|
||||
|
||||
var previousPromise;
|
||||
|
||||
this._invoke = function (method, arg) {
|
||||
function callInvokeWithMethodAndArg() {
|
||||
return new PromiseImpl(function (resolve, reject) {
|
||||
invoke(method, arg, resolve, reject);
|
||||
});
|
||||
}
|
||||
|
||||
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
||||
};
|
||||
}
|
||||
|
||||
function maybeInvokeDelegate(delegate, context) {
|
||||
var method = delegate.iterator[context.method];
|
||||
|
||||
if (undefined === method) {
|
||||
if (context.delegate = null, "throw" === context.method) {
|
||||
if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
||||
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
||||
}
|
||||
|
||||
return ContinueSentinel;
|
||||
}
|
||||
|
||||
var record = tryCatch(method, delegate.iterator, context.arg);
|
||||
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
||||
var info = record.arg;
|
||||
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
||||
}
|
||||
|
||||
function pushTryEntry(locs) {
|
||||
var entry = {
|
||||
tryLoc: locs[0]
|
||||
};
|
||||
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
||||
}
|
||||
|
||||
function resetTryEntry(entry) {
|
||||
var record = entry.completion || {};
|
||||
record.type = "normal", delete record.arg, entry.completion = record;
|
||||
}
|
||||
|
||||
function Context(tryLocsList) {
|
||||
this.tryEntries = [{
|
||||
tryLoc: "root"
|
||||
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
||||
}
|
||||
|
||||
function values(iterable) {
|
||||
if (iterable) {
|
||||
var iteratorMethod = iterable[iteratorSymbol];
|
||||
if (iteratorMethod) return iteratorMethod.call(iterable);
|
||||
if ("function" == typeof iterable.next) return iterable;
|
||||
|
||||
if (!isNaN(iterable.length)) {
|
||||
var i = -1,
|
||||
next = function next() {
|
||||
for (; ++i < iterable.length;) {
|
||||
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
||||
}
|
||||
|
||||
return next.value = undefined, next.done = !0, next;
|
||||
};
|
||||
|
||||
return next.next = next;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
next: doneResult
|
||||
};
|
||||
}
|
||||
|
||||
function doneResult() {
|
||||
return {
|
||||
value: undefined,
|
||||
done: !0
|
||||
};
|
||||
}
|
||||
|
||||
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
||||
var ctor = "function" == typeof genFun && genFun.constructor;
|
||||
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
||||
}, exports.mark = function (genFun) {
|
||||
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
||||
}, exports.awrap = function (arg) {
|
||||
return {
|
||||
__await: arg
|
||||
};
|
||||
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
||||
return this;
|
||||
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
||||
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
||||
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
||||
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
||||
return result.done ? result.value : iter.next();
|
||||
});
|
||||
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
||||
return this;
|
||||
}), define(Gp, "toString", function () {
|
||||
return "[object Generator]";
|
||||
}), exports.keys = function (object) {
|
||||
var keys = [];
|
||||
|
||||
for (var key in object) {
|
||||
keys.push(key);
|
||||
}
|
||||
|
||||
return keys.reverse(), function next() {
|
||||
for (; keys.length;) {
|
||||
var key = keys.pop();
|
||||
if (key in object) return next.value = key, next.done = !1, next;
|
||||
}
|
||||
|
||||
return next.done = !0, next;
|
||||
};
|
||||
}, exports.values = values, Context.prototype = {
|
||||
constructor: Context,
|
||||
reset: function reset(skipTempReset) {
|
||||
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) {
|
||||
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
||||
}
|
||||
},
|
||||
stop: function stop() {
|
||||
this.done = !0;
|
||||
var rootRecord = this.tryEntries[0].completion;
|
||||
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
||||
return this.rval;
|
||||
},
|
||||
dispatchException: function dispatchException(exception) {
|
||||
if (this.done) throw exception;
|
||||
var context = this;
|
||||
|
||||
function handle(loc, caught) {
|
||||
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
||||
}
|
||||
|
||||
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
||||
var entry = this.tryEntries[i],
|
||||
record = entry.completion;
|
||||
if ("root" === entry.tryLoc) return handle("end");
|
||||
|
||||
if (entry.tryLoc <= this.prev) {
|
||||
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
||||
hasFinally = hasOwn.call(entry, "finallyLoc");
|
||||
|
||||
if (hasCatch && hasFinally) {
|
||||
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
||||
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
||||
} else if (hasCatch) {
|
||||
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
||||
} else {
|
||||
if (!hasFinally) throw new Error("try statement without catch or finally");
|
||||
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
abrupt: function abrupt(type, arg) {
|
||||
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
||||
var entry = this.tryEntries[i];
|
||||
|
||||
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
||||
var finallyEntry = entry;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
||||
var record = finallyEntry ? finallyEntry.completion : {};
|
||||
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
||||
},
|
||||
complete: function complete(record, afterLoc) {
|
||||
if ("throw" === record.type) throw record.arg;
|
||||
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
||||
},
|
||||
finish: function finish(finallyLoc) {
|
||||
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
||||
var entry = this.tryEntries[i];
|
||||
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
||||
}
|
||||
},
|
||||
"catch": function _catch(tryLoc) {
|
||||
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
||||
var entry = this.tryEntries[i];
|
||||
|
||||
if (entry.tryLoc === tryLoc) {
|
||||
var record = entry.completion;
|
||||
|
||||
if ("throw" === record.type) {
|
||||
var thrown = record.arg;
|
||||
resetTryEntry(entry);
|
||||
}
|
||||
|
||||
return thrown;
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error("illegal catch attempt");
|
||||
},
|
||||
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
||||
return this.delegate = {
|
||||
iterator: values(iterable),
|
||||
resultName: resultName,
|
||||
nextLoc: nextLoc
|
||||
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
||||
}
|
||||
}, exports;
|
||||
}
|
5
node_modules/@babel/runtime/helpers/identity.js
generated
vendored
Normal file
5
node_modules/@babel/runtime/helpers/identity.js
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
function _identity(x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
module.exports = _identity, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
354
node_modules/@babel/runtime/helpers/regeneratorRuntime.js
generated
vendored
Normal file
354
node_modules/@babel/runtime/helpers/regeneratorRuntime.js
generated
vendored
Normal file
|
@ -0,0 +1,354 @@
|
|||
var _typeof = require("./typeof.js")["default"];
|
||||
|
||||
function _regeneratorRuntime() {
|
||||
"use strict";
|
||||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
||||
|
||||
module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
|
||||
return exports;
|
||||
}, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
var exports = {},
|
||||
Op = Object.prototype,
|
||||
hasOwn = Op.hasOwnProperty,
|
||||
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
||||
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
||||
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
||||
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
||||
|
||||
function define(obj, key, value) {
|
||||
return Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: !0,
|
||||
configurable: !0,
|
||||
writable: !0
|
||||
}), obj[key];
|
||||
}
|
||||
|
||||
try {
|
||||
define({}, "");
|
||||
} catch (err) {
|
||||
define = function define(obj, key, value) {
|
||||
return obj[key] = value;
|
||||
};
|
||||
}
|
||||
|
||||
function wrap(innerFn, outerFn, self, tryLocsList) {
|
||||
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
||||
generator = Object.create(protoGenerator.prototype),
|
||||
context = new Context(tryLocsList || []);
|
||||
return generator._invoke = function (innerFn, self, context) {
|
||||
var state = "suspendedStart";
|
||||
return function (method, arg) {
|
||||
if ("executing" === state) throw new Error("Generator is already running");
|
||||
|
||||
if ("completed" === state) {
|
||||
if ("throw" === method) throw arg;
|
||||
return doneResult();
|
||||
}
|
||||
|
||||
for (context.method = method, context.arg = arg;;) {
|
||||
var delegate = context.delegate;
|
||||
|
||||
if (delegate) {
|
||||
var delegateResult = maybeInvokeDelegate(delegate, context);
|
||||
|
||||
if (delegateResult) {
|
||||
if (delegateResult === ContinueSentinel) continue;
|
||||
return delegateResult;
|
||||
}
|
||||
}
|
||||
|
||||
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
||||
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
||||
context.dispatchException(context.arg);
|
||||
} else "return" === context.method && context.abrupt("return", context.arg);
|
||||
state = "executing";
|
||||
var record = tryCatch(innerFn, self, context);
|
||||
|
||||
if ("normal" === record.type) {
|
||||
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
||||
return {
|
||||
value: record.arg,
|
||||
done: context.done
|
||||
};
|
||||
}
|
||||
|
||||
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
||||
}
|
||||
};
|
||||
}(innerFn, self, context), generator;
|
||||
}
|
||||
|
||||
function tryCatch(fn, obj, arg) {
|
||||
try {
|
||||
return {
|
||||
type: "normal",
|
||||
arg: fn.call(obj, arg)
|
||||
};
|
||||
} catch (err) {
|
||||
return {
|
||||
type: "throw",
|
||||
arg: err
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
exports.wrap = wrap;
|
||||
var ContinueSentinel = {};
|
||||
|
||||
function Generator() {}
|
||||
|
||||
function GeneratorFunction() {}
|
||||
|
||||
function GeneratorFunctionPrototype() {}
|
||||
|
||||
var IteratorPrototype = {};
|
||||
define(IteratorPrototype, iteratorSymbol, function () {
|
||||
return this;
|
||||
});
|
||||
var getProto = Object.getPrototypeOf,
|
||||
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
||||
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
||||
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
||||
|
||||
function defineIteratorMethods(prototype) {
|
||||
["next", "throw", "return"].forEach(function (method) {
|
||||
define(prototype, method, function (arg) {
|
||||
return this._invoke(method, arg);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function AsyncIterator(generator, PromiseImpl) {
|
||||
function invoke(method, arg, resolve, reject) {
|
||||
var record = tryCatch(generator[method], generator, arg);
|
||||
|
||||
if ("throw" !== record.type) {
|
||||
var result = record.arg,
|
||||
value = result.value;
|
||||
return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
||||
invoke("next", value, resolve, reject);
|
||||
}, function (err) {
|
||||
invoke("throw", err, resolve, reject);
|
||||
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
||||
result.value = unwrapped, resolve(result);
|
||||
}, function (error) {
|
||||
return invoke("throw", error, resolve, reject);
|
||||
});
|
||||
}
|
||||
|
||||
reject(record.arg);
|
||||
}
|
||||
|
||||
var previousPromise;
|
||||
|
||||
this._invoke = function (method, arg) {
|
||||
function callInvokeWithMethodAndArg() {
|
||||
return new PromiseImpl(function (resolve, reject) {
|
||||
invoke(method, arg, resolve, reject);
|
||||
});
|
||||
}
|
||||
|
||||
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
||||
};
|
||||
}
|
||||
|
||||
function maybeInvokeDelegate(delegate, context) {
|
||||
var method = delegate.iterator[context.method];
|
||||
|
||||
if (undefined === method) {
|
||||
if (context.delegate = null, "throw" === context.method) {
|
||||
if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
||||
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
||||
}
|
||||
|
||||
return ContinueSentinel;
|
||||
}
|
||||
|
||||
var record = tryCatch(method, delegate.iterator, context.arg);
|
||||
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
||||
var info = record.arg;
|
||||
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
||||
}
|
||||
|
||||
function pushTryEntry(locs) {
|
||||
var entry = {
|
||||
tryLoc: locs[0]
|
||||
};
|
||||
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
||||
}
|
||||
|
||||
function resetTryEntry(entry) {
|
||||
var record = entry.completion || {};
|
||||
record.type = "normal", delete record.arg, entry.completion = record;
|
||||
}
|
||||
|
||||
function Context(tryLocsList) {
|
||||
this.tryEntries = [{
|
||||
tryLoc: "root"
|
||||
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
||||
}
|
||||
|
||||
function values(iterable) {
|
||||
if (iterable) {
|
||||
var iteratorMethod = iterable[iteratorSymbol];
|
||||
if (iteratorMethod) return iteratorMethod.call(iterable);
|
||||
if ("function" == typeof iterable.next) return iterable;
|
||||
|
||||
if (!isNaN(iterable.length)) {
|
||||
var i = -1,
|
||||
next = function next() {
|
||||
for (; ++i < iterable.length;) {
|
||||
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
||||
}
|
||||
|
||||
return next.value = undefined, next.done = !0, next;
|
||||
};
|
||||
|
||||
return next.next = next;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
next: doneResult
|
||||
};
|
||||
}
|
||||
|
||||
function doneResult() {
|
||||
return {
|
||||
value: undefined,
|
||||
done: !0
|
||||
};
|
||||
}
|
||||
|
||||
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
||||
var ctor = "function" == typeof genFun && genFun.constructor;
|
||||
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
||||
}, exports.mark = function (genFun) {
|
||||
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
||||
}, exports.awrap = function (arg) {
|
||||
return {
|
||||
__await: arg
|
||||
};
|
||||
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
||||
return this;
|
||||
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
||||
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
||||
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
||||
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
||||
return result.done ? result.value : iter.next();
|
||||
});
|
||||
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
||||
return this;
|
||||
}), define(Gp, "toString", function () {
|
||||
return "[object Generator]";
|
||||
}), exports.keys = function (object) {
|
||||
var keys = [];
|
||||
|
||||
for (var key in object) {
|
||||
keys.push(key);
|
||||
}
|
||||
|
||||
return keys.reverse(), function next() {
|
||||
for (; keys.length;) {
|
||||
var key = keys.pop();
|
||||
if (key in object) return next.value = key, next.done = !1, next;
|
||||
}
|
||||
|
||||
return next.done = !0, next;
|
||||
};
|
||||
}, exports.values = values, Context.prototype = {
|
||||
constructor: Context,
|
||||
reset: function reset(skipTempReset) {
|
||||
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) {
|
||||
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
||||
}
|
||||
},
|
||||
stop: function stop() {
|
||||
this.done = !0;
|
||||
var rootRecord = this.tryEntries[0].completion;
|
||||
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
||||
return this.rval;
|
||||
},
|
||||
dispatchException: function dispatchException(exception) {
|
||||
if (this.done) throw exception;
|
||||
var context = this;
|
||||
|
||||
function handle(loc, caught) {
|
||||
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
||||
}
|
||||
|
||||
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
||||
var entry = this.tryEntries[i],
|
||||
record = entry.completion;
|
||||
if ("root" === entry.tryLoc) return handle("end");
|
||||
|
||||
if (entry.tryLoc <= this.prev) {
|
||||
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
||||
hasFinally = hasOwn.call(entry, "finallyLoc");
|
||||
|
||||
if (hasCatch && hasFinally) {
|
||||
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
||||
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
||||
} else if (hasCatch) {
|
||||
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
||||
} else {
|
||||
if (!hasFinally) throw new Error("try statement without catch or finally");
|
||||
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
abrupt: function abrupt(type, arg) {
|
||||
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
||||
var entry = this.tryEntries[i];
|
||||
|
||||
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
||||
var finallyEntry = entry;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
||||
var record = finallyEntry ? finallyEntry.completion : {};
|
||||
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
||||
},
|
||||
complete: function complete(record, afterLoc) {
|
||||
if ("throw" === record.type) throw record.arg;
|
||||
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
||||
},
|
||||
finish: function finish(finallyLoc) {
|
||||
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
||||
var entry = this.tryEntries[i];
|
||||
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
||||
}
|
||||
},
|
||||
"catch": function _catch(tryLoc) {
|
||||
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
||||
var entry = this.tryEntries[i];
|
||||
|
||||
if (entry.tryLoc === tryLoc) {
|
||||
var record = entry.completion;
|
||||
|
||||
if ("throw" === record.type) {
|
||||
var thrown = record.arg;
|
||||
resetTryEntry(entry);
|
||||
}
|
||||
|
||||
return thrown;
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error("illegal catch attempt");
|
||||
},
|
||||
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
||||
return this.delegate = {
|
||||
iterator: values(iterable),
|
||||
resultName: resultName,
|
||||
nextLoc: nextLoc
|
||||
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
||||
}
|
||||
}, exports;
|
||||
}
|
||||
|
||||
module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
250
node_modules/@videojs/http-streaming/docs/a-walk-through-vhs.md
generated
vendored
Normal file
250
node_modules/@videojs/http-streaming/docs/a-walk-through-vhs.md
generated
vendored
Normal file
|
@ -0,0 +1,250 @@
|
|||
# A Walk Through VHS
|
||||
|
||||
Today we're going to take a walk through VHS. We'll start from a manifest URL and end with video playback.
|
||||
|
||||
The purpose of this walk is not to see every piece of code, or define every module. Instead it's about seeing the most important parts of VHS. The goal is to make VHS more approachable.
|
||||
|
||||
Lets start with a video tag:
|
||||
|
||||
```html
|
||||
<video>
|
||||
<source src="http://example.com/manifest.m3u8" type="application/x-mpegURL">
|
||||
</video>
|
||||
```
|
||||
|
||||
The source, `manifest.m3u8`, is an HLS manifest. You can tell from the `.m3u8` extension and the `type`.
|
||||
|
||||
Safari (and a few other browsers) will play that video natively, because Safari supports HLS content. However, other browsers don't support native playback of HLS and will fail to play the video.
|
||||
|
||||
VHS provides the ability to play HLS (and DASH) content in browsers that don't support native HLS (and DASH) playback.
|
||||
|
||||
Since VHS is a part of Video.js, let's set up a Video.js player for the `<video>`:
|
||||
|
||||
```html
|
||||
<link href="//vjs.zencdn.net/7.10.2/video-js.min.css" rel="stylesheet">
|
||||
<script src="//vjs.zencdn.net/7.10.2/video.min.js"></script>
|
||||
|
||||
<video-js id="myPlayer" class="video-js" data-setup='{}'>
|
||||
<source src="http://example.com/manifest.m3u8" type="application/x-mpegURL">
|
||||
</video-js>
|
||||
```
|
||||
|
||||
Video.js does a lot of things, but in the context of VHS, the important feature is a way to let VHS handle playback of the source. To do this, VHS is registered as a Video.js Source Handler. When a Video.js player is created and provided a `<source>`, Video.js goes through its list of registered Source Handlers, including VHS, to see if they're able to play that source.
|
||||
|
||||
In this case, because it's an HLS source, VHS will tell Video.js "I can handle that!" From there, VHS is given the URL and it begins its process.
|
||||
|
||||
## videojs-http-streaming.js
|
||||
|
||||
`VhsSourceHandler` is defined at the [bottom of src/videojs-http-streaming.js](https://github.com/videojs/http-streaming/blob/0964cb4827d9e80aa36f2fa29e35dad92ca84111/src/videojs-http-streaming.js#L1226-L1233).
|
||||
|
||||
The function which Video.js calls to see if the `VhsSourceHandler` can handle the source is aptly named `canHandleSource`.
|
||||
|
||||
Inside `canHandleSource`, VHS checks the source's `type`. In our case, it sees `application/x-mpegURL`, and, if we're running in a browser with MSE, then it says "I can handle it!" (It actually says "maybe," because in life there are few guarantees, and because the spec says to use "maybe.")
|
||||
|
||||
### VhsSourceHandler
|
||||
|
||||
Since VHS told Video.js that it can handle the source, Video.js passes the source to `VhsSourceHandler`'s `handleSource` function. That's where VHS really gets going. It creates a new `VhsHandler` object, merges some options, and performs initial setup. For instance, it creates listeners on some `tech` events.
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
VhsSourceHandler --> VhsHandler
|
||||
```
|
||||
|
||||
> :information_source: **What should be put in VhsHandler?**
|
||||
>
|
||||
> videojs-http-streaming.js is a good place for interfacing with Video.js and other plugins, isolating integrations from the rest of the code.
|
||||
>
|
||||
> Here are a couple of examples of what's done within videojs-http-streaming.js:
|
||||
> * most EME handling for DRM and setup of the [videojs-contrib-eme plugin](https://github.com/videojs/videojs-contrib-eme)
|
||||
> * mapping/handling of options passed down via Video.js
|
||||
|
||||
## MasterPlaylistController
|
||||
|
||||
One critical object that `VhsHandler`'s constructor creates is a new `MasterPlaylistController`.
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
VhsSourceHandler --> VhsHandler
|
||||
VhsHandler --> MasterPlaylistController
|
||||
```
|
||||
|
||||
`MasterPlaylistController` is not a great name, and has grown in size to be a bit unwieldy, but it's the hub of VHS. Eventually, it should be broken into smaller pieces, but for now, it handles the creation and management of most of the other VHS modules. Its code can be found in [src/master-playlist-controller.js](https://github.com/videojs/http-streaming/blob/0964cb4827d9e80aa36f2fa29e35dad92ca84111/src/master-playlist-controller.js).
|
||||
|
||||
The best way to think of `MasterPlaylistController` is as Tron's Master Control Program, though hopefully it isn't as evil.
|
||||
|
||||
`MasterPlaylistController` is a lot to say. So we often refer to it as MPC.
|
||||
|
||||
If you need to find a place where different modules communicate, you will probably end up in MPC. Just about all of `VhsHandler` that doesn't interface with Video.js or other plugins, interfaces with MPC.
|
||||
|
||||
MPC's [constructor](https://github.com/videojs/http-streaming/blob/0964cb4827d9e80aa36f2fa29e35dad92ca84111/src/master-playlist-controller.js#L148) does a lot. Instead of listing all of the things it does, let's go step-by-step through the main ones, passing the source we had above.
|
||||
|
||||
```html
|
||||
<video-js id="myPlayer" class="video-js" data-setup='{}'>
|
||||
<source src="http://example.com/manifest.m3u8" type="application/x-mpegURL">
|
||||
</video-js>
|
||||
```
|
||||
|
||||
Looking at the `<source>` tag, `VhsSourceHandler` already used the "type" to tell Video.js that it could handle the source. `VhsHandler` took the manifest URL, in this case "manifest.m3u8" and provided it to the constructor of MPC.
|
||||
|
||||
The first thing that MPC must do is download that source, but it doesn't make the request itself. Instead, it creates [this.masterPlaylistLoader_](https://github.com/videojs/http-streaming/blob/0964cb4827d9e80aa36f2fa29e35dad92ca84111/src/master-playlist-controller.js#L264-L266).
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
VhsSourceHandler --> VhsHandler
|
||||
VhsHandler --> MasterPlaylistController
|
||||
MasterPlaylistController --> PlaylistLoader
|
||||
```
|
||||
|
||||
`masterPlaylistLoader_` is an instance of either the [HLS PlaylistLoader](https://github.com/videojs/http-streaming/blob/0964cb4827d9e80aa36f2fa29e35dad92ca84111/src/playlist-loader.js#L379) or the [DashPlaylistLoader](https://github.com/videojs/http-streaming/blob/0964cb4827d9e80aa36f2fa29e35dad92ca84111/src/dash-playlist-loader.js#L259).
|
||||
|
||||
The names betray their use. They load the playlist. The URL ("manifest.m3u8" here) is given, and the manifest/playlist is downloaded and parsed. If the content is live, the playlist loader also handles refreshing the manifest. For HLS, where manifests point to other manifests, the playlist loader requests those as well.
|
||||
|
||||
As for parsing, for HLS, the manifest responses are parsed using [m3u8-parser](https://github.com/videojs/m3u8-parser). For DASH, the manifest response is parsed using [mpd-parser](https://github.com/videojs/mpd-parser). The output of these parsers is a JSON object that VHS understands. The main structure can be seen in the READMEs, e.g., [here](https://github.com/videojs/m3u8-parser#parsed-output).
|
||||
|
||||
So what was once a URL in a `<source>` tag was requested and parsed into a JSON object like the following:
|
||||
|
||||
```
|
||||
Manifest {
|
||||
playlists: [
|
||||
{
|
||||
attributes: {},
|
||||
Manifest
|
||||
}
|
||||
],
|
||||
mediaGroups: { ... },
|
||||
segments: [ ... ],
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
Many properties are removed for simplicity. This is a top level manifest (often referred to as a master or main manifest), and within it there are playlists, each playlist being a Manifest itself. Since the JSON "schema" for main and media playlists is the same, you will see irrelevant properties within any given manifest object. For instance, you might see a `targetDuration` property on the main manifest object, though a main manifest doesn't have a target duration. You can ignore irrelevant properties. Eventually they should be cleaned up, and a proper schema defined for manifest objects.
|
||||
|
||||
MPC will also use `masterPlaylistLoader_` to select which media playlist is active (e.g., the 720p rendition or the 480p rendition), so that `masterPlaylistLoader_` will only need to refresh that individual playlist if the stream is live.
|
||||
|
||||
> :information_source: **Future Work**
|
||||
>
|
||||
> The playlist loaders are not the clearest modules. Work has been started on improvements to the loaders and how we use them: https://github.com/videojs/http-streaming/pull/1208
|
||||
>
|
||||
> That work makes them much easier to read, but will require changes throughout the rest of the code before the old PlaylistLoader and DashPlaylistLoader code can be removed.
|
||||
|
||||
### Media Source Extensions
|
||||
|
||||
The next thing MPC needs to do is set up a media source for [Media Source Extensions](https://www.w3.org/TR/media-source/). Specifically, it needs to create [this.mediaSource](https://github.com/videojs/http-streaming/blob/0964cb4827d9e80aa36f2fa29e35dad92ca84111/src/master-playlist-controller.js#L210) and its associated [source buffers](https://github.com/videojs/http-streaming/blob/main/src/master-playlist-controller.js#L1818). These are where audio and video data will be appended, so that the browser has content to play. But those aren't used directly. Because source buffers can only handle one operation at a time, [this.sourceUpdater_](https://github.com/videojs/http-streaming/blob/0964cb4827d9e80aa36f2fa29e35dad92ca84111/src/master-playlist-controller.js#L234) is created. `sourceUpdater_` is a queue for operations performed on the source buffers. That's pretty much it. So all of the MSE pieces for appending get wrapped up in `sourceUpdater_`.
|
||||
|
||||
## Segment Loaders
|
||||
|
||||
The SourceUpdater created for MSE above is passed to the segment loaders.
|
||||
|
||||
[this.mainSegmentLoader_](https://github.com/videojs/http-streaming/blob/0964cb4827d9e80aa36f2fa29e35dad92ca84111/src/master-playlist-controller.js#L271-L275) is used for muxed content (audio and video in one segment) and for audio or video only streams.
|
||||
|
||||
[this.audioSegmentLoader_](https://github.com/videojs/http-streaming/blob/0964cb4827d9e80aa36f2fa29e35dad92ca84111/src/master-playlist-controller.js#L278-L281) is used when the content is demuxed (audio and video in separate playlists).
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
VhsSourceHandler --> VhsHandler
|
||||
VhsHandler --> MasterPlaylistController
|
||||
MasterPlaylistController --> PlaylistLoader
|
||||
MasterPlaylistController --> SourceUpdater
|
||||
MasterPlaylistController --> SegmentLoader
|
||||
```
|
||||
|
||||
Besides options and the `sourceUpdater_` from MPC, the segment loaders are given a [playlist](https://github.com/videojs/http-streaming/blob/0964cb4827d9e80aa36f2fa29e35dad92ca84111/src/segment-loader.js#L988). This playlist is a media playlist from the `masterPlaylistLoader_`. So looking back at our parsed manifest object:
|
||||
|
||||
```
|
||||
Manifest {
|
||||
playlists: [
|
||||
{
|
||||
attributes: {},
|
||||
Manifest
|
||||
}
|
||||
],
|
||||
mediaGroups: { ... },
|
||||
segments: [ ... ],
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
The media playlists were those objects found in the `playlists` array. Each segment loader is given one of those.
|
||||
|
||||
Segment Loader uses the provided media playlist to determine which segment to download next. It performs this check when [monitorBuffer_](https://github.com/videojs/http-streaming/blob/main/src/segment-loader.js#L1300) is called, which ultimately runs [chooseNextRequest_](https://github.com/videojs/http-streaming/blob/0964cb4827d9e80aa36f2fa29e35dad92ca84111/src/segment-loader.js#L1399). `chooseNextRequest_` looks at the buffer, the current time, and a few other properties to choose what segment to download from the `playlist`'s `segments` array.
|
||||
|
||||
### Choosing Segments to Download
|
||||
|
||||
VHS uses a strategy called `mediaIndex++` for choosing the next segment, see [here](https://github.com/videojs/http-streaming/blob/0964cb4827d9e80aa36f2fa29e35dad92ca84111/src/segment-loader.js#L1442). This means that, if segment 3 was previously requested, segment 4 should be requested next, and segment 5 after that. Those segment numbers are determined by the HLS [#EXT-X-MEDIA-SEQUENCE tag](https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-10#section-4.4.3.2).
|
||||
|
||||
If there are no seeks or rendition changes, `chooseNextRequest_` will rely on the `mediaIndex++` strategy.
|
||||
|
||||
If there are seeks or rendition changes, then `chooseNextRequest_` will look at segment timing values via the `SyncController` (created previously in MPC), the current time, and the buffer, to determine what the next segment should be, and what it's start time should be (to position it on the timeline).
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
VhsSourceHandler --> VhsHandler
|
||||
VhsHandler --> MasterPlaylistController
|
||||
MasterPlaylistController --> PlaylistLoader
|
||||
MasterPlaylistController --> SourceUpdater
|
||||
MasterPlaylistController --> SegmentLoader
|
||||
SegmentLoader --> SyncController
|
||||
```
|
||||
|
||||
The `SyncController` has various [strategies](https://github.com/videojs/http-streaming/blob/0964cb4827d9e80aa36f2fa29e35dad92ca84111/src/sync-controller.js#L16) for ensuring that different renditions, which can have different media sequence and segment timing values, can be positioned on the playback timeline successfully. (It is also be [used by MPC](https://github.com/videojs/http-streaming/blob/0964cb4827d9e80aa36f2fa29e35dad92ca84111/src/master-playlist-controller.js#L1477) to establish a `seekable` range.)
|
||||
|
||||
### Downloading and Appending Segments
|
||||
|
||||
If the buffer is not full, and a segment was chosen, then `SegmentLoader` will download and append it. It does this via a [mediaSegmentRequest](https://github.com/videojs/http-streaming/blob/0964cb4827d9e80aa36f2fa29e35dad92ca84111/src/segment-loader.js#L2489).
|
||||
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
VhsSourceHandler --> VhsHandler
|
||||
VhsHandler --> MasterPlaylistController
|
||||
MasterPlaylistController --> PlaylistLoader
|
||||
MasterPlaylistController --> SourceUpdater
|
||||
MasterPlaylistController --> SegmentLoader
|
||||
SegmentLoader --> SyncController
|
||||
SegmentLoader --> mediaSegmentRequest
|
||||
```
|
||||
|
||||
`mediaSegmentRequest` takes a lot of arguments. Most are callbacks. These callbacks provide the data that `SegmentLoader` needs to append the segment. It includes the timing information of the segment, captions, and the segment data.
|
||||
|
||||
When the `SegmentLoader` receives timing info events, it can update the source buffer's timestamp offset (via `SourceUpdater`).
|
||||
|
||||
When the `SegmentLoader` receives segment data events, it can append the data to the source buffer (via `SourceUpdater`).
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
VhsSourceHandler --> VhsHandler
|
||||
VhsHandler --> MasterPlaylistController
|
||||
MasterPlaylistController --> PlaylistLoader
|
||||
MasterPlaylistController --> SourceUpdater
|
||||
MasterPlaylistController --> SegmentLoader
|
||||
SegmentLoader --> SyncController
|
||||
SegmentLoader --> mediaSegmentRequest
|
||||
SegmentLoader --> SourceUpdater
|
||||
```
|
||||
|
||||
## mediaSegmentRequest
|
||||
|
||||
We talked a bit about how `SegmentLoader` uses `mediaSegmentRequest`, but what does [mediaSegmentRequest](https://github.com/videojs/http-streaming/blob/0964cb4827d9e80aa36f2fa29e35dad92ca84111/src/media-segment-request.js#L941) do?
|
||||
|
||||
Besides downloading segments, `mediaSegmentRequest` [decrypts](https://github.com/videojs/http-streaming/blob/0964cb4827d9e80aa36f2fa29e35dad92ca84111/src/media-segment-request.js#L621) AES encrypted segments, probes [MP4](https://github.com/videojs/http-streaming/blob/0964cb4827d9e80aa36f2fa29e35dad92ca84111/src/media-segment-request.js#L171) and [TS](https://github.com/videojs/http-streaming/blob/0964cb4827d9e80aa36f2fa29e35dad92ca84111/src/media-segment-request.js#L375) segments for timing info, and [transmuxes](https://github.com/videojs/http-streaming/blob/0964cb4827d9e80aa36f2fa29e35dad92ca84111/src/media-segment-request.js#L280) TS segments into MP4s using [mux.js](https://github.com/videojs/mux.js) so they can be appended to the source buffers.
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
VhsSourceHandler --> VhsHandler
|
||||
VhsHandler --> MasterPlaylistController
|
||||
MasterPlaylistController --> PlaylistLoader
|
||||
MasterPlaylistController --> SourceUpdater
|
||||
MasterPlaylistController --> SegmentLoader
|
||||
SegmentLoader --> SyncController
|
||||
SegmentLoader --> mediaSegmentRequest
|
||||
SegmentLoader --> SourceUpdater
|
||||
mediaSegmentRequest --> mux.js
|
||||
```
|
||||
|
||||
## Video playback begins
|
||||
|
||||
The video can start playing as soon as there's enough audio and video (for muxed streams) in the buffer to move the playhead forwards. So playback may begin before the `SegmentLoader` completes its full cycle.
|
||||
|
||||
But once `SegmentLoader` does finish, it starts the process again, looking for new content.
|
||||
|
||||
There are other modules, and other functions of the code (e.g., blacklisting logic, ABR, etc.), but this is the most critical path of VHS, the one that allows video to play in the browser.
|
46
node_modules/abbrev/LICENSE
generated
vendored
Normal file
46
node_modules/abbrev/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
This software is dual-licensed under the ISC and MIT licenses.
|
||||
You may use this software under EITHER of the following licenses.
|
||||
|
||||
----------
|
||||
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
----------
|
||||
|
||||
Copyright Isaac Z. Schlueter and Contributors
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
23
node_modules/abbrev/README.md
generated
vendored
Normal file
23
node_modules/abbrev/README.md
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
# abbrev-js
|
||||
|
||||
Just like [ruby's Abbrev](http://apidock.com/ruby/Abbrev).
|
||||
|
||||
Usage:
|
||||
|
||||
var abbrev = require("abbrev");
|
||||
abbrev("foo", "fool", "folding", "flop");
|
||||
|
||||
// returns:
|
||||
{ fl: 'flop'
|
||||
, flo: 'flop'
|
||||
, flop: 'flop'
|
||||
, fol: 'folding'
|
||||
, fold: 'folding'
|
||||
, foldi: 'folding'
|
||||
, foldin: 'folding'
|
||||
, folding: 'folding'
|
||||
, foo: 'foo'
|
||||
, fool: 'fool'
|
||||
}
|
||||
|
||||
This is handy for command-line scripts, or other cases where you want to be able to accept shorthands.
|
61
node_modules/abbrev/abbrev.js
generated
vendored
Normal file
61
node_modules/abbrev/abbrev.js
generated
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
module.exports = exports = abbrev.abbrev = abbrev
|
||||
|
||||
abbrev.monkeyPatch = monkeyPatch
|
||||
|
||||
function monkeyPatch () {
|
||||
Object.defineProperty(Array.prototype, 'abbrev', {
|
||||
value: function () { return abbrev(this) },
|
||||
enumerable: false, configurable: true, writable: true
|
||||
})
|
||||
|
||||
Object.defineProperty(Object.prototype, 'abbrev', {
|
||||
value: function () { return abbrev(Object.keys(this)) },
|
||||
enumerable: false, configurable: true, writable: true
|
||||
})
|
||||
}
|
||||
|
||||
function abbrev (list) {
|
||||
if (arguments.length !== 1 || !Array.isArray(list)) {
|
||||
list = Array.prototype.slice.call(arguments, 0)
|
||||
}
|
||||
for (var i = 0, l = list.length, args = [] ; i < l ; i ++) {
|
||||
args[i] = typeof list[i] === "string" ? list[i] : String(list[i])
|
||||
}
|
||||
|
||||
// sort them lexicographically, so that they're next to their nearest kin
|
||||
args = args.sort(lexSort)
|
||||
|
||||
// walk through each, seeing how much it has in common with the next and previous
|
||||
var abbrevs = {}
|
||||
, prev = ""
|
||||
for (var i = 0, l = args.length ; i < l ; i ++) {
|
||||
var current = args[i]
|
||||
, next = args[i + 1] || ""
|
||||
, nextMatches = true
|
||||
, prevMatches = true
|
||||
if (current === next) continue
|
||||
for (var j = 0, cl = current.length ; j < cl ; j ++) {
|
||||
var curChar = current.charAt(j)
|
||||
nextMatches = nextMatches && curChar === next.charAt(j)
|
||||
prevMatches = prevMatches && curChar === prev.charAt(j)
|
||||
if (!nextMatches && !prevMatches) {
|
||||
j ++
|
||||
break
|
||||
}
|
||||
}
|
||||
prev = current
|
||||
if (j === cl) {
|
||||
abbrevs[current] = current
|
||||
continue
|
||||
}
|
||||
for (var a = current.substr(0, j) ; j <= cl ; j ++) {
|
||||
abbrevs[a] = current
|
||||
a += current.charAt(j)
|
||||
}
|
||||
}
|
||||
return abbrevs
|
||||
}
|
||||
|
||||
function lexSort (a, b) {
|
||||
return a === b ? 0 : a > b ? 1 : -1
|
||||
}
|
21
node_modules/abbrev/package.json
generated
vendored
Normal file
21
node_modules/abbrev/package.json
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"name": "abbrev",
|
||||
"version": "1.1.1",
|
||||
"description": "Like ruby's abbrev module, but in js",
|
||||
"author": "Isaac Z. Schlueter <i@izs.me>",
|
||||
"main": "abbrev.js",
|
||||
"scripts": {
|
||||
"test": "tap test.js --100",
|
||||
"preversion": "npm test",
|
||||
"postversion": "npm publish",
|
||||
"postpublish": "git push origin --all; git push origin --tags"
|
||||
},
|
||||
"repository": "http://github.com/isaacs/abbrev-js",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"tap": "^10.1"
|
||||
},
|
||||
"files": [
|
||||
"abbrev.js"
|
||||
]
|
||||
}
|
58
node_modules/amdefine/LICENSE
generated
vendored
Normal file
58
node_modules/amdefine/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
amdefine is released under two licenses: new BSD, and MIT. You may pick the
|
||||
license that best suits your development needs. The text of both licenses are
|
||||
provided below.
|
||||
|
||||
|
||||
The "New" BSD License:
|
||||
----------------------
|
||||
|
||||
Copyright (c) 2011-2016, The Dojo Foundation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Dojo Foundation nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
|
||||
MIT License
|
||||
-----------
|
||||
|
||||
Copyright (c) 2011-2016, The Dojo Foundation
|
||||
|
||||
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.
|
171
node_modules/amdefine/README.md
generated
vendored
Normal file
171
node_modules/amdefine/README.md
generated
vendored
Normal file
|
@ -0,0 +1,171 @@
|
|||
# amdefine
|
||||
|
||||
A module that can be used to implement AMD's define() in Node. This allows you
|
||||
to code to the AMD API and have the module work in node programs without
|
||||
requiring those other programs to use AMD.
|
||||
|
||||
## Usage
|
||||
|
||||
**1)** Update your package.json to indicate amdefine as a dependency:
|
||||
|
||||
```javascript
|
||||
"dependencies": {
|
||||
"amdefine": ">=0.1.0"
|
||||
}
|
||||
```
|
||||
|
||||
Then run `npm install` to get amdefine into your project.
|
||||
|
||||
**2)** At the top of each module that uses define(), place this code:
|
||||
|
||||
```javascript
|
||||
if (typeof define !== 'function') { var define = require('amdefine')(module) }
|
||||
```
|
||||
|
||||
**Only use these snippets** when loading amdefine. If you preserve the basic structure,
|
||||
with the braces, it will be stripped out when using the [RequireJS optimizer](#optimizer).
|
||||
|
||||
You can add spaces, line breaks and even require amdefine with a local path, but
|
||||
keep the rest of the structure to get the stripping behavior.
|
||||
|
||||
As you may know, because `if` statements in JavaScript don't have their own scope, the var
|
||||
declaration in the above snippet is made whether the `if` expression is truthy or not. If
|
||||
RequireJS is loaded then the declaration is superfluous because `define` is already already
|
||||
declared in the same scope in RequireJS. Fortunately JavaScript handles multiple `var`
|
||||
declarations of the same variable in the same scope gracefully.
|
||||
|
||||
If you want to deliver amdefine.js with your code rather than specifying it as a dependency
|
||||
with npm, then just download the latest release and refer to it using a relative path:
|
||||
|
||||
[Latest Version](https://github.com/jrburke/amdefine/raw/latest/amdefine.js)
|
||||
|
||||
### amdefine/intercept
|
||||
|
||||
Consider this very experimental.
|
||||
|
||||
Instead of pasting the piece of text for the amdefine setup of a `define`
|
||||
variable in each module you create or consume, you can use `amdefine/intercept`
|
||||
instead. It will automatically insert the above snippet in each .js file loaded
|
||||
by Node.
|
||||
|
||||
**Warning**: you should only use this if you are creating an application that
|
||||
is consuming AMD style defined()'d modules that are distributed via npm and want
|
||||
to run that code in Node.
|
||||
|
||||
For library code where you are not sure if it will be used by others in Node or
|
||||
in the browser, then explicitly depending on amdefine and placing the code
|
||||
snippet above is suggested path, instead of using `amdefine/intercept`. The
|
||||
intercept module affects all .js files loaded in the Node app, and it is
|
||||
inconsiderate to modify global state like that unless you are also controlling
|
||||
the top level app.
|
||||
|
||||
#### Why distribute AMD-style modules via npm?
|
||||
|
||||
npm has a lot of weaknesses for front-end use (installed layout is not great,
|
||||
should have better support for the `baseUrl + moduleID + '.js' style of loading,
|
||||
single file JS installs), but some people want a JS package manager and are
|
||||
willing to live with those constraints. If that is you, but still want to author
|
||||
in AMD style modules to get dynamic require([]), better direct source usage and
|
||||
powerful loader plugin support in the browser, then this tool can help.
|
||||
|
||||
#### amdefine/intercept usage
|
||||
|
||||
Just require it in your top level app module (for example index.js, server.js):
|
||||
|
||||
```javascript
|
||||
require('amdefine/intercept');
|
||||
```
|
||||
|
||||
The module does not return a value, so no need to assign the result to a local
|
||||
variable.
|
||||
|
||||
Then just require() code as you normally would with Node's require(). Any .js
|
||||
loaded after the intercept require will have the amdefine check injected in
|
||||
the .js source as it is loaded. It does not modify the source on disk, just
|
||||
prepends some content to the text of the module as it is loaded by Node.
|
||||
|
||||
#### How amdefine/intercept works
|
||||
|
||||
It overrides the `Module._extensions['.js']` in Node to automatically prepend
|
||||
the amdefine snippet above. So, it will affect any .js file loaded by your
|
||||
app.
|
||||
|
||||
## define() usage
|
||||
|
||||
It is best if you use the anonymous forms of define() in your module:
|
||||
|
||||
```javascript
|
||||
define(function (require) {
|
||||
var dependency = require('dependency');
|
||||
});
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```javascript
|
||||
define(['dependency'], function (dependency) {
|
||||
|
||||
});
|
||||
```
|
||||
|
||||
## RequireJS optimizer integration. <a name="optimizer"></name>
|
||||
|
||||
Version 1.0.3 of the [RequireJS optimizer](http://requirejs.org/docs/optimization.html)
|
||||
will have support for stripping the `if (typeof define !== 'function')` check
|
||||
mentioned above, so you can include this snippet for code that runs in the
|
||||
browser, but avoid taking the cost of the if() statement once the code is
|
||||
optimized for deployment.
|
||||
|
||||
## Node 0.4 Support
|
||||
|
||||
If you want to support Node 0.4, then add `require` as the second parameter to amdefine:
|
||||
|
||||
```javascript
|
||||
//Only if you want Node 0.4. If using 0.5 or later, use the above snippet.
|
||||
if (typeof define !== 'function') { var define = require('amdefine')(module, require) }
|
||||
```
|
||||
|
||||
## Limitations
|
||||
|
||||
### Synchronous vs Asynchronous
|
||||
|
||||
amdefine creates a define() function that is callable by your code. It will
|
||||
execute and trace dependencies and call the factory function *synchronously*,
|
||||
to keep the behavior in line with Node's synchronous dependency tracing.
|
||||
|
||||
The exception: calling AMD's callback-style require() from inside a factory
|
||||
function. The require callback is called on process.nextTick():
|
||||
|
||||
```javascript
|
||||
define(function (require) {
|
||||
require(['a'], function(a) {
|
||||
//'a' is loaded synchronously, but
|
||||
//this callback is called on process.nextTick().
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
### Loader Plugins
|
||||
|
||||
Loader plugins are supported as long as they call their load() callbacks
|
||||
synchronously. So ones that do network requests will not work. However plugins
|
||||
like [text](http://requirejs.org/docs/api.html#text) can load text files locally.
|
||||
|
||||
The plugin API's `load.fromText()` is **not supported** in amdefine, so this means
|
||||
transpiler plugins like the [CoffeeScript loader plugin](https://github.com/jrburke/require-cs)
|
||||
will not work. This may be fixable, but it is a bit complex, and I do not have
|
||||
enough node-fu to figure it out yet. See the source for amdefine.js if you want
|
||||
to get an idea of the issues involved.
|
||||
|
||||
## Tests
|
||||
|
||||
To run the tests, cd to **tests** and run:
|
||||
|
||||
```
|
||||
node all.js
|
||||
node all-intercept.js
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
New BSD and MIT. Check the LICENSE file for all the details.
|
301
node_modules/amdefine/amdefine.js
generated
vendored
Normal file
301
node_modules/amdefine/amdefine.js
generated
vendored
Normal file
|
@ -0,0 +1,301 @@
|
|||
/** vim: et:ts=4:sw=4:sts=4
|
||||
* @license amdefine 1.0.1 Copyright (c) 2011-2016, The Dojo Foundation All Rights Reserved.
|
||||
* Available via the MIT or new BSD license.
|
||||
* see: http://github.com/jrburke/amdefine for details
|
||||
*/
|
||||
|
||||
/*jslint node: true */
|
||||
/*global module, process */
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Creates a define for node.
|
||||
* @param {Object} module the "module" object that is defined by Node for the
|
||||
* current module.
|
||||
* @param {Function} [requireFn]. Node's require function for the current module.
|
||||
* It only needs to be passed in Node versions before 0.5, when module.require
|
||||
* did not exist.
|
||||
* @returns {Function} a define function that is usable for the current node
|
||||
* module.
|
||||
*/
|
||||
function amdefine(module, requireFn) {
|
||||
'use strict';
|
||||
var defineCache = {},
|
||||
loaderCache = {},
|
||||
alreadyCalled = false,
|
||||
path = require('path'),
|
||||
makeRequire, stringRequire;
|
||||
|
||||
/**
|
||||
* Trims the . and .. from an array of path segments.
|
||||
* It will keep a leading path segment if a .. will become
|
||||
* the first path segment, to help with module name lookups,
|
||||
* which act like paths, but can be remapped. But the end result,
|
||||
* all paths that use this function should look normalized.
|
||||
* NOTE: this method MODIFIES the input array.
|
||||
* @param {Array} ary the array of path segments.
|
||||
*/
|
||||
function trimDots(ary) {
|
||||
var i, part;
|
||||
for (i = 0; ary[i]; i+= 1) {
|
||||
part = ary[i];
|
||||
if (part === '.') {
|
||||
ary.splice(i, 1);
|
||||
i -= 1;
|
||||
} else if (part === '..') {
|
||||
if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
|
||||
//End of the line. Keep at least one non-dot
|
||||
//path segment at the front so it can be mapped
|
||||
//correctly to disk. Otherwise, there is likely
|
||||
//no path mapping for a path starting with '..'.
|
||||
//This can still fail, but catches the most reasonable
|
||||
//uses of ..
|
||||
break;
|
||||
} else if (i > 0) {
|
||||
ary.splice(i - 1, 2);
|
||||
i -= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function normalize(name, baseName) {
|
||||
var baseParts;
|
||||
|
||||
//Adjust any relative paths.
|
||||
if (name && name.charAt(0) === '.') {
|
||||
//If have a base name, try to normalize against it,
|
||||
//otherwise, assume it is a top-level require that will
|
||||
//be relative to baseUrl in the end.
|
||||
if (baseName) {
|
||||
baseParts = baseName.split('/');
|
||||
baseParts = baseParts.slice(0, baseParts.length - 1);
|
||||
baseParts = baseParts.concat(name.split('/'));
|
||||
trimDots(baseParts);
|
||||
name = baseParts.join('/');
|
||||
}
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the normalize() function passed to a loader plugin's
|
||||
* normalize method.
|
||||
*/
|
||||
function makeNormalize(relName) {
|
||||
return function (name) {
|
||||
return normalize(name, relName);
|
||||
};
|
||||
}
|
||||
|
||||
function makeLoad(id) {
|
||||
function load(value) {
|
||||
loaderCache[id] = value;
|
||||
}
|
||||
|
||||
load.fromText = function (id, text) {
|
||||
//This one is difficult because the text can/probably uses
|
||||
//define, and any relative paths and requires should be relative
|
||||
//to that id was it would be found on disk. But this would require
|
||||
//bootstrapping a module/require fairly deeply from node core.
|
||||
//Not sure how best to go about that yet.
|
||||
throw new Error('amdefine does not implement load.fromText');
|
||||
};
|
||||
|
||||
return load;
|
||||
}
|
||||
|
||||
makeRequire = function (systemRequire, exports, module, relId) {
|
||||
function amdRequire(deps, callback) {
|
||||
if (typeof deps === 'string') {
|
||||
//Synchronous, single module require('')
|
||||
return stringRequire(systemRequire, exports, module, deps, relId);
|
||||
} else {
|
||||
//Array of dependencies with a callback.
|
||||
|
||||
//Convert the dependencies to modules.
|
||||
deps = deps.map(function (depName) {
|
||||
return stringRequire(systemRequire, exports, module, depName, relId);
|
||||
});
|
||||
|
||||
//Wait for next tick to call back the require call.
|
||||
if (callback) {
|
||||
process.nextTick(function () {
|
||||
callback.apply(null, deps);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
amdRequire.toUrl = function (filePath) {
|
||||
if (filePath.indexOf('.') === 0) {
|
||||
return normalize(filePath, path.dirname(module.filename));
|
||||
} else {
|
||||
return filePath;
|
||||
}
|
||||
};
|
||||
|
||||
return amdRequire;
|
||||
};
|
||||
|
||||
//Favor explicit value, passed in if the module wants to support Node 0.4.
|
||||
requireFn = requireFn || function req() {
|
||||
return module.require.apply(module, arguments);
|
||||
};
|
||||
|
||||
function runFactory(id, deps, factory) {
|
||||
var r, e, m, result;
|
||||
|
||||
if (id) {
|
||||
e = loaderCache[id] = {};
|
||||
m = {
|
||||
id: id,
|
||||
uri: __filename,
|
||||
exports: e
|
||||
};
|
||||
r = makeRequire(requireFn, e, m, id);
|
||||
} else {
|
||||
//Only support one define call per file
|
||||
if (alreadyCalled) {
|
||||
throw new Error('amdefine with no module ID cannot be called more than once per file.');
|
||||
}
|
||||
alreadyCalled = true;
|
||||
|
||||
//Use the real variables from node
|
||||
//Use module.exports for exports, since
|
||||
//the exports in here is amdefine exports.
|
||||
e = module.exports;
|
||||
m = module;
|
||||
r = makeRequire(requireFn, e, m, module.id);
|
||||
}
|
||||
|
||||
//If there are dependencies, they are strings, so need
|
||||
//to convert them to dependency values.
|
||||
if (deps) {
|
||||
deps = deps.map(function (depName) {
|
||||
return r(depName);
|
||||
});
|
||||
}
|
||||
|
||||
//Call the factory with the right dependencies.
|
||||
if (typeof factory === 'function') {
|
||||
result = factory.apply(m.exports, deps);
|
||||
} else {
|
||||
result = factory;
|
||||
}
|
||||
|
||||
if (result !== undefined) {
|
||||
m.exports = result;
|
||||
if (id) {
|
||||
loaderCache[id] = m.exports;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stringRequire = function (systemRequire, exports, module, id, relId) {
|
||||
//Split the ID by a ! so that
|
||||
var index = id.indexOf('!'),
|
||||
originalId = id,
|
||||
prefix, plugin;
|
||||
|
||||
if (index === -1) {
|
||||
id = normalize(id, relId);
|
||||
|
||||
//Straight module lookup. If it is one of the special dependencies,
|
||||
//deal with it, otherwise, delegate to node.
|
||||
if (id === 'require') {
|
||||
return makeRequire(systemRequire, exports, module, relId);
|
||||
} else if (id === 'exports') {
|
||||
return exports;
|
||||
} else if (id === 'module') {
|
||||
return module;
|
||||
} else if (loaderCache.hasOwnProperty(id)) {
|
||||
return loaderCache[id];
|
||||
} else if (defineCache[id]) {
|
||||
runFactory.apply(null, defineCache[id]);
|
||||
return loaderCache[id];
|
||||
} else {
|
||||
if(systemRequire) {
|
||||
return systemRequire(originalId);
|
||||
} else {
|
||||
throw new Error('No module with ID: ' + id);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//There is a plugin in play.
|
||||
prefix = id.substring(0, index);
|
||||
id = id.substring(index + 1, id.length);
|
||||
|
||||
plugin = stringRequire(systemRequire, exports, module, prefix, relId);
|
||||
|
||||
if (plugin.normalize) {
|
||||
id = plugin.normalize(id, makeNormalize(relId));
|
||||
} else {
|
||||
//Normalize the ID normally.
|
||||
id = normalize(id, relId);
|
||||
}
|
||||
|
||||
if (loaderCache[id]) {
|
||||
return loaderCache[id];
|
||||
} else {
|
||||
plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
|
||||
|
||||
return loaderCache[id];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//Create a define function specific to the module asking for amdefine.
|
||||
function define(id, deps, factory) {
|
||||
if (Array.isArray(id)) {
|
||||
factory = deps;
|
||||
deps = id;
|
||||
id = undefined;
|
||||
} else if (typeof id !== 'string') {
|
||||
factory = id;
|
||||
id = deps = undefined;
|
||||
}
|
||||
|
||||
if (deps && !Array.isArray(deps)) {
|
||||
factory = deps;
|
||||
deps = undefined;
|
||||
}
|
||||
|
||||
if (!deps) {
|
||||
deps = ['require', 'exports', 'module'];
|
||||
}
|
||||
|
||||
//Set up properties for this module. If an ID, then use
|
||||
//internal cache. If no ID, then use the external variables
|
||||
//for this node module.
|
||||
if (id) {
|
||||
//Put the module in deep freeze until there is a
|
||||
//require call for it.
|
||||
defineCache[id] = [id, deps, factory];
|
||||
} else {
|
||||
runFactory(id, deps, factory);
|
||||
}
|
||||
}
|
||||
|
||||
//define.require, which has access to all the values in the
|
||||
//cache. Useful for AMD modules that all have IDs in the file,
|
||||
//but need to finally export a value to node based on one of those
|
||||
//IDs.
|
||||
define.require = function (id) {
|
||||
if (loaderCache[id]) {
|
||||
return loaderCache[id];
|
||||
}
|
||||
|
||||
if (defineCache[id]) {
|
||||
runFactory.apply(null, defineCache[id]);
|
||||
return loaderCache[id];
|
||||
}
|
||||
};
|
||||
|
||||
define.amd = {};
|
||||
|
||||
return define;
|
||||
}
|
||||
|
||||
module.exports = amdefine;
|
36
node_modules/amdefine/intercept.js
generated
vendored
Normal file
36
node_modules/amdefine/intercept.js
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*jshint node: true */
|
||||
var inserted,
|
||||
Module = require('module'),
|
||||
fs = require('fs'),
|
||||
existingExtFn = Module._extensions['.js'],
|
||||
amdefineRegExp = /amdefine\.js/;
|
||||
|
||||
inserted = "if (typeof define !== 'function') {var define = require('amdefine')(module)}";
|
||||
|
||||
//From the node/lib/module.js source:
|
||||
function stripBOM(content) {
|
||||
// Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
|
||||
// because the buffer-to-string conversion in `fs.readFileSync()`
|
||||
// translates it to FEFF, the UTF-16 BOM.
|
||||
if (content.charCodeAt(0) === 0xFEFF) {
|
||||
content = content.slice(1);
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
//Also adapted from the node/lib/module.js source:
|
||||
function intercept(module, filename) {
|
||||
var content = stripBOM(fs.readFileSync(filename, 'utf8'));
|
||||
|
||||
if (!amdefineRegExp.test(module.id)) {
|
||||
content = inserted + content;
|
||||
}
|
||||
|
||||
module._compile(content, filename);
|
||||
}
|
||||
|
||||
intercept._id = 'amdefine/intercept';
|
||||
|
||||
if (!existingExtFn._id || existingExtFn._id !== intercept._id) {
|
||||
Module._extensions['.js'] = intercept;
|
||||
}
|
16
node_modules/amdefine/package.json
generated
vendored
Normal file
16
node_modules/amdefine/package.json
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"name": "amdefine",
|
||||
"description": "Provide AMD's define() API for declaring modules in the AMD format",
|
||||
"version": "1.0.1",
|
||||
"homepage": "http://github.com/jrburke/amdefine",
|
||||
"author": "James Burke <jrburke@gmail.com> (http://github.com/jrburke)",
|
||||
"license": "BSD-3-Clause OR MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jrburke/amdefine.git"
|
||||
},
|
||||
"main": "./amdefine.js",
|
||||
"engines": {
|
||||
"node": ">=0.4.2"
|
||||
}
|
||||
}
|
115
node_modules/argparse/HISTORY.md
generated
vendored
Normal file
115
node_modules/argparse/HISTORY.md
generated
vendored
Normal file
|
@ -0,0 +1,115 @@
|
|||
0.1.16 / 2013-12-01
|
||||
-------------------
|
||||
|
||||
* Maintenance release. Updated dependencies and docs.
|
||||
|
||||
|
||||
0.1.15 / 2013-05-13
|
||||
-------------------
|
||||
|
||||
* Fixed #55, @trebor89
|
||||
|
||||
|
||||
0.1.14 / 2013-05-12
|
||||
-------------------
|
||||
|
||||
* Fixed #62, @maxtaco
|
||||
|
||||
|
||||
0.1.13 / 2013-04-08
|
||||
-------------------
|
||||
|
||||
* Added `.npmignore` to reduce package size
|
||||
|
||||
|
||||
0.1.12 / 2013-02-10
|
||||
-------------------
|
||||
|
||||
* Fixed conflictHandler (#46), @hpaulj
|
||||
|
||||
|
||||
0.1.11 / 2013-02-07
|
||||
-------------------
|
||||
|
||||
* Multiple bugfixes, @hpaulj
|
||||
* Added 70+ tests (ported from python), @hpaulj
|
||||
* Added conflictHandler, @applepicke
|
||||
* Added fromfilePrefixChar, @hpaulj
|
||||
|
||||
|
||||
0.1.10 / 2012-12-30
|
||||
-------------------
|
||||
|
||||
* Added [mutual exclusion](http://docs.python.org/dev/library/argparse.html#mutual-exclusion)
|
||||
support, thanks to @hpaulj
|
||||
* Fixed options check for `storeConst` & `appendConst` actions, thanks to @hpaulj
|
||||
|
||||
|
||||
0.1.9 / 2012-12-27
|
||||
------------------
|
||||
|
||||
* Fixed option dest interferens with other options (issue #23), thanks to @hpaulj
|
||||
* Fixed default value behavior with `*` positionals, thanks to @hpaulj
|
||||
* Improve `getDefault()` behavior, thanks to @hpaulj
|
||||
* Imrove negative argument parsing, thanks to @hpaulj
|
||||
|
||||
|
||||
0.1.8 / 2012-12-01
|
||||
------------------
|
||||
|
||||
* Fixed parser parents (issue #19), thanks to @hpaulj
|
||||
* Fixed negative argument parse (issue #20), thanks to @hpaulj
|
||||
|
||||
|
||||
0.1.7 / 2012-10-14
|
||||
------------------
|
||||
|
||||
* Fixed 'choices' argument parse (issue #16)
|
||||
* Fixed stderr output (issue #15)
|
||||
|
||||
|
||||
0.1.6 / 2012-09-09
|
||||
------------------
|
||||
|
||||
* Fixed check for conflict of options (thanks to @tomxtobin)
|
||||
|
||||
|
||||
0.1.5 / 2012-09-03
|
||||
------------------
|
||||
|
||||
* Fix parser #setDefaults method (thanks to @tomxtobin)
|
||||
|
||||
|
||||
0.1.4 / 2012-07-30
|
||||
------------------
|
||||
|
||||
* Fixed pseudo-argument support (thanks to @CGamesPlay)
|
||||
* Fixed addHelp default (should be true), if not set (thanks to @benblank)
|
||||
|
||||
|
||||
0.1.3 / 2012-06-27
|
||||
------------------
|
||||
|
||||
* Fixed formatter api name: Formatter -> HelpFormatter
|
||||
|
||||
|
||||
0.1.2 / 2012-05-29
|
||||
------------------
|
||||
|
||||
* Added basic tests
|
||||
* Removed excess whitespace in help
|
||||
* Fixed error reporting, when parcer with subcommands
|
||||
called with empty arguments
|
||||
|
||||
|
||||
0.1.1 / 2012-05-23
|
||||
------------------
|
||||
|
||||
* Fixed line wrapping in help formatter
|
||||
* Added better error reporting on invalid arguments
|
||||
|
||||
|
||||
0.1.0 / 2012-05-16
|
||||
------------------
|
||||
|
||||
* First release.
|
21
node_modules/argparse/LICENSE
generated
vendored
Normal file
21
node_modules/argparse/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
(The MIT License)
|
||||
|
||||
Copyright (C) 2012 by Vitaly Puzrin
|
||||
|
||||
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.
|
239
node_modules/argparse/README.md
generated
vendored
Normal file
239
node_modules/argparse/README.md
generated
vendored
Normal file
|
@ -0,0 +1,239 @@
|
|||
argparse
|
||||
========
|
||||
|
||||
[](http://travis-ci.org/nodeca/argparse)
|
||||
|
||||
CLI arguments parser for node.js. Javascript port of python's
|
||||
[argparse](http://docs.python.org/dev/library/argparse.html) module
|
||||
(original version 3.2). That's a full port, except some very rare options,
|
||||
recorded in issue tracker.
|
||||
|
||||
**NB.** Method names changed to camelCase. See [generated docs](http://nodeca.github.com/argparse/).
|
||||
|
||||
|
||||
Example
|
||||
=======
|
||||
|
||||
test.js file:
|
||||
|
||||
```javascript
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
var ArgumentParser = require('../lib/argparse').ArgumentParser;
|
||||
var parser = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp:true,
|
||||
description: 'Argparse example'
|
||||
});
|
||||
parser.addArgument(
|
||||
[ '-f', '--foo' ],
|
||||
{
|
||||
help: 'foo bar'
|
||||
}
|
||||
);
|
||||
parser.addArgument(
|
||||
[ '-b', '--bar' ],
|
||||
{
|
||||
help: 'bar foo'
|
||||
}
|
||||
);
|
||||
var args = parser.parseArgs();
|
||||
console.dir(args);
|
||||
```
|
||||
|
||||
Display help:
|
||||
|
||||
```
|
||||
$ ./test.js -h
|
||||
usage: example.js [-h] [-v] [-f FOO] [-b BAR]
|
||||
|
||||
Argparse example
|
||||
|
||||
Optional arguments:
|
||||
-h, --help Show this help message and exit.
|
||||
-v, --version Show program's version number and exit.
|
||||
-f FOO, --foo FOO foo bar
|
||||
-b BAR, --bar BAR bar foo
|
||||
```
|
||||
|
||||
Parse arguments:
|
||||
|
||||
```
|
||||
$ ./test.js -f=3 --bar=4
|
||||
{ foo: '3', bar: '4' }
|
||||
```
|
||||
|
||||
More [examples](https://github.com/nodeca/argparse/tree/master/examples).
|
||||
|
||||
|
||||
ArgumentParser objects
|
||||
======================
|
||||
|
||||
```
|
||||
new ArgumentParser({paramters hash});
|
||||
```
|
||||
|
||||
Creates a new ArgumentParser object.
|
||||
|
||||
**Supported params:**
|
||||
|
||||
- ```description``` - Text to display before the argument help.
|
||||
- ```epilog``` - Text to display after the argument help.
|
||||
- ```addHelp``` - Add a -h/–help option to the parser. (default: true)
|
||||
- ```argumentDefault``` - Set the global default value for arguments. (default: null)
|
||||
- ```parents``` - A list of ArgumentParser objects whose arguments should also be included.
|
||||
- ```prefixChars``` - The set of characters that prefix optional arguments. (default: ‘-‘)
|
||||
- ```formatterClass``` - A class for customizing the help output.
|
||||
- ```prog``` - The name of the program (default: `path.basename(process.argv[1])`)
|
||||
- ```usage``` - The string describing the program usage (default: generated)
|
||||
- ```conflictHandler``` - Usually unnecessary, defines strategy for resolving conflicting optionals.
|
||||
|
||||
**Not supportied yet**
|
||||
|
||||
- ```fromfilePrefixChars``` - The set of characters that prefix files from which additional arguments should be read.
|
||||
|
||||
|
||||
Details in [original ArgumentParser guide](http://docs.python.org/dev/library/argparse.html#argumentparser-objects)
|
||||
|
||||
|
||||
addArgument() method
|
||||
====================
|
||||
|
||||
```
|
||||
ArgumentParser.addArgument([names or flags], {options})
|
||||
```
|
||||
|
||||
Defines how a single command-line argument should be parsed.
|
||||
|
||||
- ```name or flags``` - Either a name or a list of option strings, e.g. foo or -f, --foo.
|
||||
|
||||
Options:
|
||||
|
||||
- ```action``` - The basic type of action to be taken when this argument is encountered at the command line.
|
||||
- ```nargs```- The number of command-line arguments that should be consumed.
|
||||
- ```constant``` - A constant value required by some action and nargs selections.
|
||||
- ```defaultValue``` - The value produced if the argument is absent from the command line.
|
||||
- ```type``` - The type to which the command-line argument should be converted.
|
||||
- ```choices``` - A container of the allowable values for the argument.
|
||||
- ```required``` - Whether or not the command-line option may be omitted (optionals only).
|
||||
- ```help``` - A brief description of what the argument does.
|
||||
- ```metavar``` - A name for the argument in usage messages.
|
||||
- ```dest``` - The name of the attribute to be added to the object returned by parseArgs().
|
||||
|
||||
Details in [original add_argument guide](http://docs.python.org/dev/library/argparse.html#the-add-argument-method)
|
||||
|
||||
|
||||
Action (some details)
|
||||
================
|
||||
|
||||
ArgumentParser objects associate command-line arguments with actions.
|
||||
These actions can do just about anything with the command-line arguments associated
|
||||
with them, though most actions simply add an attribute to the object returned by
|
||||
parseArgs(). The action keyword argument specifies how the command-line arguments
|
||||
should be handled. The supported actions are:
|
||||
|
||||
- ```store``` - Just stores the argument’s value. This is the default action.
|
||||
- ```storeConst``` - Stores value, specified by the const keyword argument.
|
||||
(Note that the const keyword argument defaults to the rather unhelpful None.)
|
||||
The 'storeConst' action is most commonly used with optional arguments, that
|
||||
specify some sort of flag.
|
||||
- ```storeTrue``` and ```storeFalse``` - Stores values True and False
|
||||
respectively. These are special cases of 'storeConst'.
|
||||
- ```append``` - Stores a list, and appends each argument value to the list.
|
||||
This is useful to allow an option to be specified multiple times.
|
||||
- ```appendConst``` - Stores a list, and appends value, specified by the
|
||||
const keyword argument to the list. (Note, that the const keyword argument defaults
|
||||
is None.) The 'appendConst' action is typically used when multiple arguments need
|
||||
to store constants to the same list.
|
||||
- ```count``` - Counts the number of times a keyword argument occurs. For example,
|
||||
used for increasing verbosity levels.
|
||||
- ```help``` - Prints a complete help message for all the options in the current
|
||||
parser and then exits. By default a help action is automatically added to the parser.
|
||||
See ArgumentParser for details of how the output is created.
|
||||
- ```version``` - Prints version information and exit. Expects a `version=`
|
||||
keyword argument in the addArgument() call.
|
||||
|
||||
Details in [original action guide](http://docs.python.org/dev/library/argparse.html#action)
|
||||
|
||||
|
||||
Sub-commands
|
||||
============
|
||||
|
||||
ArgumentParser.addSubparsers()
|
||||
|
||||
Many programs split their functionality into a number of sub-commands, for
|
||||
example, the svn program can invoke sub-commands like `svn checkout`, `svn update`,
|
||||
and `svn commit`. Splitting up functionality this way can be a particularly good
|
||||
idea when a program performs several different functions which require different
|
||||
kinds of command-line arguments. `ArgumentParser` supports creation of such
|
||||
sub-commands with `addSubparsers()` method. The `addSubparsers()` method is
|
||||
normally called with no arguments and returns an special action object.
|
||||
This object has a single method `addParser()`, which takes a command name and
|
||||
any `ArgumentParser` constructor arguments, and returns an `ArgumentParser` object
|
||||
that can be modified as usual.
|
||||
|
||||
Example:
|
||||
|
||||
sub_commands.js
|
||||
```javascript
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
var ArgumentParser = require('../lib/argparse').ArgumentParser;
|
||||
var parser = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp:true,
|
||||
description: 'Argparse examples: sub-commands',
|
||||
});
|
||||
|
||||
var subparsers = parser.addSubparsers({
|
||||
title:'subcommands',
|
||||
dest:"subcommand_name"
|
||||
});
|
||||
|
||||
var bar = subparsers.addParser('c1', {addHelp:true});
|
||||
bar.addArgument(
|
||||
[ '-f', '--foo' ],
|
||||
{
|
||||
action: 'store',
|
||||
help: 'foo3 bar3'
|
||||
}
|
||||
);
|
||||
var bar = subparsers.addParser(
|
||||
'c2',
|
||||
{aliases:['co'], addHelp:true}
|
||||
);
|
||||
bar.addArgument(
|
||||
[ '-b', '--bar' ],
|
||||
{
|
||||
action: 'store',
|
||||
type: 'int',
|
||||
help: 'foo3 bar3'
|
||||
}
|
||||
);
|
||||
|
||||
var args = parser.parseArgs();
|
||||
console.dir(args);
|
||||
|
||||
```
|
||||
|
||||
Details in [original sub-commands guide](http://docs.python.org/dev/library/argparse.html#sub-commands)
|
||||
|
||||
|
||||
Contributors
|
||||
============
|
||||
|
||||
- [Eugene Shkuropat](https://github.com/shkuropat)
|
||||
- [Paul Jacobson](https://github.com/hpaulj)
|
||||
|
||||
[others](https://github.com/nodeca/argparse/graphs/contributors)
|
||||
|
||||
License
|
||||
=======
|
||||
|
||||
Copyright (c) 2012 [Vitaly Puzrin](https://github.com/puzrin).
|
||||
Released under the MIT license. See
|
||||
[LICENSE](https://github.com/nodeca/argparse/blob/master/LICENSE) for details.
|
||||
|
||||
|
36
node_modules/argparse/examples/arguments.js
generated
vendored
Normal file
36
node_modules/argparse/examples/arguments.js
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
var ArgumentParser = require('../lib/argparse').ArgumentParser;
|
||||
var parser = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp: true,
|
||||
description: 'Argparse examples: arguments'
|
||||
});
|
||||
parser.addArgument(
|
||||
[ '-f', '--foo' ],
|
||||
{
|
||||
help: 'foo bar'
|
||||
}
|
||||
);
|
||||
parser.addArgument(
|
||||
[ '-b', '--bar' ],
|
||||
{
|
||||
help: 'bar foo'
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
parser.printHelp();
|
||||
console.log('-----------');
|
||||
|
||||
var args;
|
||||
args = parser.parseArgs('-f 1 -b2'.split(' '));
|
||||
console.dir(args);
|
||||
console.log('-----------');
|
||||
args = parser.parseArgs('-f=3 --bar=4'.split(' '));
|
||||
console.dir(args);
|
||||
console.log('-----------');
|
||||
args = parser.parseArgs('--foo 5 --bar 6'.split(' '));
|
||||
console.dir(args);
|
||||
console.log('-----------');
|
22
node_modules/argparse/examples/choice.js
generated
vendored
Normal file
22
node_modules/argparse/examples/choice.js
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
var ArgumentParser = require('../lib/argparse').ArgumentParser;
|
||||
var parser = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp: true,
|
||||
description: 'Argparse examples: choice'
|
||||
});
|
||||
|
||||
parser.addArgument(['foo'], {choices: 'abc'});
|
||||
|
||||
parser.printHelp();
|
||||
console.log('-----------');
|
||||
|
||||
var args;
|
||||
args = parser.parseArgs(['c']);
|
||||
console.dir(args);
|
||||
console.log('-----------');
|
||||
parser.parseArgs(['X']);
|
||||
console.dir(args);
|
||||
|
59
node_modules/argparse/examples/constants.js
generated
vendored
Normal file
59
node_modules/argparse/examples/constants.js
generated
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
var ArgumentParser = require('../lib/argparse').ArgumentParser;
|
||||
var parser = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp: true,
|
||||
description: 'Argparse examples: constant'
|
||||
});
|
||||
|
||||
parser.addArgument(
|
||||
[ '-a'],
|
||||
{
|
||||
action: 'storeConst',
|
||||
dest: 'answer',
|
||||
help: 'store constant',
|
||||
constant: 42
|
||||
}
|
||||
);
|
||||
parser.addArgument(
|
||||
[ '--str' ],
|
||||
{
|
||||
action: 'appendConst',
|
||||
dest: 'types',
|
||||
help: 'append constant "str" to types',
|
||||
constant: 'str'
|
||||
}
|
||||
);
|
||||
parser.addArgument(
|
||||
[ '--int' ],
|
||||
{
|
||||
action: 'appendConst',
|
||||
dest: 'types',
|
||||
help: 'append constant "int" to types',
|
||||
constant: 'int'
|
||||
}
|
||||
);
|
||||
|
||||
parser.addArgument(
|
||||
[ '--true' ],
|
||||
{
|
||||
action: 'storeTrue',
|
||||
help: 'store true constant'
|
||||
}
|
||||
);
|
||||
parser.addArgument(
|
||||
[ '--false' ],
|
||||
{
|
||||
action: 'storeFalse',
|
||||
help: 'store false constant'
|
||||
}
|
||||
);
|
||||
|
||||
parser.printHelp();
|
||||
console.log('-----------');
|
||||
|
||||
var args;
|
||||
args = parser.parseArgs('-a --str --int --true'.split(' '));
|
||||
console.dir(args);
|
13
node_modules/argparse/examples/help.js
generated
vendored
Normal file
13
node_modules/argparse/examples/help.js
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
var ArgumentParser = require('../lib/argparse').ArgumentParser;
|
||||
var parser = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp: true,
|
||||
description: 'Argparse examples: help',
|
||||
epilog: 'help epilog',
|
||||
prog: 'help_example_prog',
|
||||
usage: 'Usage %(prog)s <agrs>'
|
||||
});
|
||||
parser.printHelp();
|
33
node_modules/argparse/examples/nargs.js
generated
vendored
Normal file
33
node_modules/argparse/examples/nargs.js
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
var ArgumentParser = require('../lib/argparse').ArgumentParser;
|
||||
var parser = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp: true,
|
||||
description: 'Argparse examples: nargs'
|
||||
});
|
||||
parser.addArgument(
|
||||
[ '-f', '--foo' ],
|
||||
{
|
||||
help: 'foo bar',
|
||||
nargs: 1
|
||||
}
|
||||
);
|
||||
parser.addArgument(
|
||||
[ '-b', '--bar' ],
|
||||
{
|
||||
help: 'bar foo',
|
||||
nargs: '*'
|
||||
}
|
||||
);
|
||||
|
||||
parser.printHelp();
|
||||
console.log('-----------');
|
||||
|
||||
var args;
|
||||
args = parser.parseArgs('--foo a --bar c d'.split(' '));
|
||||
console.dir(args);
|
||||
console.log('-----------');
|
||||
args = parser.parseArgs('--bar b c f --foo a'.split(' '));
|
||||
console.dir(args);
|
28
node_modules/argparse/examples/parents.js
generated
vendored
Normal file
28
node_modules/argparse/examples/parents.js
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
var ArgumentParser = require('../lib/argparse').ArgumentParser;
|
||||
|
||||
var args;
|
||||
var parent_parser = new ArgumentParser({ addHelp: false });
|
||||
// note addHelp:false to prevent duplication of the -h option
|
||||
parent_parser.addArgument(
|
||||
['--parent'],
|
||||
{ type: 'int', description: 'parent' }
|
||||
);
|
||||
|
||||
var foo_parser = new ArgumentParser({
|
||||
parents: [ parent_parser ],
|
||||
description: 'child1'
|
||||
});
|
||||
foo_parser.addArgument(['foo']);
|
||||
args = foo_parser.parseArgs(['--parent', '2', 'XXX']);
|
||||
console.log(args);
|
||||
|
||||
var bar_parser = new ArgumentParser({
|
||||
parents: [ parent_parser ],
|
||||
description: 'child2'
|
||||
});
|
||||
bar_parser.addArgument(['--bar']);
|
||||
args = bar_parser.parseArgs(['--bar', 'YYY']);
|
||||
console.log(args);
|
23
node_modules/argparse/examples/prefix_chars.js
generated
vendored
Normal file
23
node_modules/argparse/examples/prefix_chars.js
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
var ArgumentParser = require('../lib/argparse').ArgumentParser;
|
||||
var parser = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp: true,
|
||||
description: 'Argparse examples: prefix_chars',
|
||||
prefixChars: '-+'
|
||||
});
|
||||
parser.addArgument(['+f', '++foo']);
|
||||
parser.addArgument(['++bar'], {action: 'storeTrue'});
|
||||
|
||||
parser.printHelp();
|
||||
console.log('-----------');
|
||||
|
||||
var args;
|
||||
args = parser.parseArgs(['+f', '1']);
|
||||
console.dir(args);
|
||||
args = parser.parseArgs(['++bar']);
|
||||
console.dir(args);
|
||||
args = parser.parseArgs(['++foo', '2', '++bar']);
|
||||
console.dir(args);
|
49
node_modules/argparse/examples/sub_commands.js
generated
vendored
Normal file
49
node_modules/argparse/examples/sub_commands.js
generated
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
var ArgumentParser = require('../lib/argparse').ArgumentParser;
|
||||
var parser = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp: true,
|
||||
description: 'Argparse examples: sub-commands'
|
||||
});
|
||||
|
||||
var subparsers = parser.addSubparsers({
|
||||
title: 'subcommands',
|
||||
dest: "subcommand_name"
|
||||
});
|
||||
|
||||
var bar = subparsers.addParser('c1', {addHelp: true, help: 'c1 help'});
|
||||
bar.addArgument(
|
||||
[ '-f', '--foo' ],
|
||||
{
|
||||
action: 'store',
|
||||
help: 'foo3 bar3'
|
||||
}
|
||||
);
|
||||
var bar = subparsers.addParser(
|
||||
'c2',
|
||||
{aliases: ['co'], addHelp: true, help: 'c2 help'}
|
||||
);
|
||||
bar.addArgument(
|
||||
[ '-b', '--bar' ],
|
||||
{
|
||||
action: 'store',
|
||||
type: 'int',
|
||||
help: 'foo3 bar3'
|
||||
}
|
||||
);
|
||||
parser.printHelp();
|
||||
console.log('-----------');
|
||||
|
||||
var args;
|
||||
args = parser.parseArgs('c1 -f 2'.split(' '));
|
||||
console.dir(args);
|
||||
console.log('-----------');
|
||||
args = parser.parseArgs('c2 -b 1'.split(' '));
|
||||
console.dir(args);
|
||||
console.log('-----------');
|
||||
args = parser.parseArgs('co -b 1'.split(' '));
|
||||
console.dir(args);
|
||||
console.log('-----------');
|
||||
parser.parseArgs(['c1', '-h']);
|
35
node_modules/argparse/examples/sum.js
generated
vendored
Normal file
35
node_modules/argparse/examples/sum.js
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
var ArgumentParser = require('../lib/argparse').ArgumentParser;
|
||||
var parser = new ArgumentParser({ description: 'Process some integers.' });
|
||||
|
||||
|
||||
function sum(arr) {
|
||||
return arr.reduce(function (a, b) {
|
||||
return a + b;
|
||||
}, 0);
|
||||
}
|
||||
function max(arr) {
|
||||
return Math.max.apply(Math, arr);
|
||||
}
|
||||
|
||||
|
||||
parser.addArgument(['integers'], {
|
||||
metavar: 'N',
|
||||
type: 'int',
|
||||
nargs: '+',
|
||||
help: 'an integer for the accumulator'
|
||||
});
|
||||
parser.addArgument(['--sum'], {
|
||||
dest: 'accumulate',
|
||||
action: 'storeConst',
|
||||
constant: sum,
|
||||
defaultValue: max,
|
||||
help: 'sum the integers (default: find the max)'
|
||||
});
|
||||
|
||||
var args = parser.parseArgs('--sum 1 2 -1'.split(' '));
|
||||
console.log(args.accumulate(args.integers));
|
270
node_modules/argparse/examples/testformatters.js
generated
vendored
Normal file
270
node_modules/argparse/examples/testformatters.js
generated
vendored
Normal file
|
@ -0,0 +1,270 @@
|
|||
'use strict';
|
||||
|
||||
var a, group, parser, helptext;
|
||||
|
||||
var assert = require('assert');
|
||||
var _ = require('underscore');
|
||||
_.str = require('underscore.string');
|
||||
var print = function () {
|
||||
return console.log.apply(console, arguments);
|
||||
};
|
||||
// print = function () {};
|
||||
|
||||
var argparse = require('argparse');
|
||||
|
||||
print("TEST argparse.ArgumentDefaultsHelpFormatter");
|
||||
|
||||
parser = new argparse.ArgumentParser({
|
||||
debug: true,
|
||||
formatterClass: argparse.ArgumentDefaultsHelpFormatter,
|
||||
description: 'description'
|
||||
});
|
||||
|
||||
parser.addArgument(['--foo'], {
|
||||
help: 'foo help - oh and by the way, %(defaultValue)s'
|
||||
});
|
||||
|
||||
parser.addArgument(['--bar'], {
|
||||
action: 'storeTrue',
|
||||
help: 'bar help'
|
||||
});
|
||||
|
||||
parser.addArgument(['spam'], {
|
||||
help: 'spam help'
|
||||
});
|
||||
|
||||
parser.addArgument(['badger'], {
|
||||
nargs: '?',
|
||||
defaultValue: 'wooden',
|
||||
help: 'badger help'
|
||||
});
|
||||
|
||||
group = parser.addArgumentGroup({
|
||||
title: 'title',
|
||||
description: 'group description'
|
||||
});
|
||||
|
||||
group.addArgument(['--baz'], {
|
||||
type: 'int',
|
||||
defaultValue: 42,
|
||||
help: 'baz help'
|
||||
});
|
||||
|
||||
helptext = parser.formatHelp();
|
||||
print(helptext);
|
||||
// test selected clips
|
||||
assert(helptext.match(/badger help \(default: wooden\)/));
|
||||
assert(helptext.match(/foo help - oh and by the way, null/));
|
||||
assert(helptext.match(/bar help \(default: false\)/));
|
||||
assert(helptext.match(/title:\n {2}group description/)); // test indent
|
||||
assert(helptext.match(/baz help \(default: 42\)/im));
|
||||
|
||||
/*
|
||||
usage: PROG [-h] [--foo FOO] [--bar] [--baz BAZ] spam [badger]
|
||||
|
||||
description
|
||||
|
||||
positional arguments:
|
||||
spam spam help
|
||||
badger badger help (default: wooden)
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
--foo FOO foo help - oh and by the way, null
|
||||
--bar bar help (default: false)
|
||||
|
||||
title:
|
||||
group description
|
||||
|
||||
--baz BAZ baz help (default: 42)
|
||||
*/
|
||||
|
||||
print("TEST argparse.RawDescriptionHelpFormatter");
|
||||
|
||||
parser = new argparse.ArgumentParser({
|
||||
debug: true,
|
||||
prog: 'PROG',
|
||||
formatterClass: argparse.RawDescriptionHelpFormatter,
|
||||
description: 'Keep the formatting\n' +
|
||||
' exactly as it is written\n' +
|
||||
'\n' +
|
||||
'here\n'
|
||||
});
|
||||
|
||||
a = parser.addArgument(['--foo'], {
|
||||
help: ' foo help should not\n' +
|
||||
' retain this odd formatting'
|
||||
});
|
||||
|
||||
parser.addArgument(['spam'], {
|
||||
'help': 'spam help'
|
||||
});
|
||||
|
||||
group = parser.addArgumentGroup({
|
||||
title: 'title',
|
||||
description: ' This text\n' +
|
||||
' should be indented\n' +
|
||||
' exactly like it is here\n'
|
||||
});
|
||||
|
||||
group.addArgument(['--bar'], {
|
||||
help: 'bar help'
|
||||
});
|
||||
|
||||
helptext = parser.formatHelp();
|
||||
print(helptext);
|
||||
// test selected clips
|
||||
assert(helptext.match(parser.description));
|
||||
assert.equal(helptext.match(a.help), null);
|
||||
assert(helptext.match(/foo help should not retain this odd formatting/));
|
||||
|
||||
/*
|
||||
class TestHelpRawDescription(HelpTestCase):
|
||||
"""Test the RawTextHelpFormatter"""
|
||||
....
|
||||
|
||||
usage: PROG [-h] [--foo FOO] [--bar BAR] spam
|
||||
|
||||
Keep the formatting
|
||||
exactly as it is written
|
||||
|
||||
here
|
||||
|
||||
positional arguments:
|
||||
spam spam help
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
--foo FOO foo help should not retain this odd formatting
|
||||
|
||||
title:
|
||||
This text
|
||||
should be indented
|
||||
exactly like it is here
|
||||
|
||||
--bar BAR bar help
|
||||
*/
|
||||
|
||||
|
||||
print("TEST argparse.RawTextHelpFormatter");
|
||||
|
||||
parser = new argparse.ArgumentParser({
|
||||
debug: true,
|
||||
prog: 'PROG',
|
||||
formatterClass: argparse.RawTextHelpFormatter,
|
||||
description: 'Keep the formatting\n' +
|
||||
' exactly as it is written\n' +
|
||||
'\n' +
|
||||
'here\n'
|
||||
});
|
||||
|
||||
parser.addArgument(['--baz'], {
|
||||
help: ' baz help should also\n' +
|
||||
'appear as given here'
|
||||
});
|
||||
|
||||
a = parser.addArgument(['--foo'], {
|
||||
help: ' foo help should also\n' +
|
||||
'appear as given here'
|
||||
});
|
||||
|
||||
parser.addArgument(['spam'], {
|
||||
'help': 'spam help'
|
||||
});
|
||||
|
||||
group = parser.addArgumentGroup({
|
||||
title: 'title',
|
||||
description: ' This text\n' +
|
||||
' should be indented\n' +
|
||||
' exactly like it is here\n'
|
||||
});
|
||||
|
||||
group.addArgument(['--bar'], {
|
||||
help: 'bar help'
|
||||
});
|
||||
|
||||
helptext = parser.formatHelp();
|
||||
print(helptext);
|
||||
// test selected clips
|
||||
assert(helptext.match(parser.description));
|
||||
assert(helptext.match(/( {14})appear as given here/gm));
|
||||
|
||||
/*
|
||||
class TestHelpRawText(HelpTestCase):
|
||||
"""Test the RawTextHelpFormatter"""
|
||||
|
||||
usage: PROG [-h] [--foo FOO] [--bar BAR] spam
|
||||
|
||||
Keep the formatting
|
||||
exactly as it is written
|
||||
|
||||
here
|
||||
|
||||
positional arguments:
|
||||
spam spam help
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
--foo FOO foo help should also
|
||||
appear as given here
|
||||
|
||||
title:
|
||||
This text
|
||||
should be indented
|
||||
exactly like it is here
|
||||
|
||||
--bar BAR bar help
|
||||
*/
|
||||
|
||||
|
||||
print("TEST metavar as a tuple");
|
||||
|
||||
parser = new argparse.ArgumentParser({
|
||||
prog: 'PROG'
|
||||
});
|
||||
|
||||
parser.addArgument(['-w'], {
|
||||
help: 'w',
|
||||
nargs: '+',
|
||||
metavar: ['W1', 'W2']
|
||||
});
|
||||
|
||||
parser.addArgument(['-x'], {
|
||||
help: 'x',
|
||||
nargs: '*',
|
||||
metavar: ['X1', 'X2']
|
||||
});
|
||||
|
||||
parser.addArgument(['-y'], {
|
||||
help: 'y',
|
||||
nargs: 3,
|
||||
metavar: ['Y1', 'Y2', 'Y3']
|
||||
});
|
||||
|
||||
parser.addArgument(['-z'], {
|
||||
help: 'z',
|
||||
nargs: '?',
|
||||
metavar: ['Z1']
|
||||
});
|
||||
|
||||
helptext = parser.formatHelp();
|
||||
print(helptext);
|
||||
var ustring = 'PROG [-h] [-w W1 [W2 ...]] [-x [X1 [X2 ...]]] [-y Y1 Y2 Y3] [-z [Z1]]';
|
||||
ustring = ustring.replace(/\[/g, '\\[').replace(/\]/g, '\\]');
|
||||
// print(ustring)
|
||||
assert(helptext.match(new RegExp(ustring)));
|
||||
|
||||
/*
|
||||
class TestHelpTupleMetavar(HelpTestCase):
|
||||
"""Test specifying metavar as a tuple"""
|
||||
|
||||
usage: PROG [-h] [-w W1 [W2 ...]] [-x [X1 [X2 ...]]] [-y Y1 Y2 Y3] [-z [Z1]]
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
-w W1 [W2 ...] w
|
||||
-x [X1 [X2 ...]] x
|
||||
-y Y1 Y2 Y3 y
|
||||
-z [Z1] z
|
||||
*/
|
||||
|
1
node_modules/argparse/index.js
generated
vendored
Normal file
1
node_modules/argparse/index.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
module.exports = require('./lib/argparse');
|
146
node_modules/argparse/lib/action.js
generated
vendored
Normal file
146
node_modules/argparse/lib/action.js
generated
vendored
Normal file
|
@ -0,0 +1,146 @@
|
|||
/**
|
||||
* class Action
|
||||
*
|
||||
* Base class for all actions
|
||||
* Do not call in your code, use this class only for inherits your own action
|
||||
*
|
||||
* Information about how to convert command line strings to Javascript objects.
|
||||
* Action objects are used by an ArgumentParser to represent the information
|
||||
* needed to parse a single argument from one or more strings from the command
|
||||
* line. The keyword arguments to the Action constructor are also all attributes
|
||||
* of Action instances.
|
||||
*
|
||||
* #####Alowed keywords:
|
||||
*
|
||||
* - `store`
|
||||
* - `storeConstant`
|
||||
* - `storeTrue`
|
||||
* - `storeFalse`
|
||||
* - `append`
|
||||
* - `appendConstant`
|
||||
* - `count`
|
||||
* - `help`
|
||||
* - `version`
|
||||
*
|
||||
* Information about action options see [[Action.new]]
|
||||
*
|
||||
* See also [original guide](http://docs.python.org/dev/library/argparse.html#action)
|
||||
*
|
||||
**/
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
// Constants
|
||||
var $$ = require('./const');
|
||||
|
||||
|
||||
/**
|
||||
* new Action(options)
|
||||
*
|
||||
* Base class for all actions. Used only for inherits
|
||||
*
|
||||
*
|
||||
* ##### Options:
|
||||
*
|
||||
* - `optionStrings` A list of command-line option strings for the action.
|
||||
* - `dest` Attribute to hold the created object(s)
|
||||
* - `nargs` The number of command-line arguments that should be consumed.
|
||||
* By default, one argument will be consumed and a single value will be
|
||||
* produced.
|
||||
* - `constant` Default value for an action with no value.
|
||||
* - `defaultValue` The value to be produced if the option is not specified.
|
||||
* - `type` Cast to 'string'|'int'|'float'|'complex'|function (string). If
|
||||
* None, 'string'.
|
||||
* - `choices` The choices available.
|
||||
* - `required` True if the action must always be specified at the command
|
||||
* line.
|
||||
* - `help` The help describing the argument.
|
||||
* - `metavar` The name to be used for the option's argument with the help
|
||||
* string. If None, the 'dest' value will be used as the name.
|
||||
*
|
||||
* ##### nargs supported values:
|
||||
*
|
||||
* - `N` (an integer) consumes N arguments (and produces a list)
|
||||
* - `?` consumes zero or one arguments
|
||||
* - `*` consumes zero or more arguments (and produces a list)
|
||||
* - `+` consumes one or more arguments (and produces a list)
|
||||
*
|
||||
* Note: that the difference between the default and nargs=1 is that with the
|
||||
* default, a single value will be produced, while with nargs=1, a list
|
||||
* containing a single value will be produced.
|
||||
**/
|
||||
var Action = module.exports = function Action(options) {
|
||||
options = options || {};
|
||||
this.optionStrings = options.optionStrings || [];
|
||||
this.dest = options.dest;
|
||||
this.nargs = options.nargs !== undefined ? options.nargs : null;
|
||||
this.constant = options.constant !== undefined ? options.constant : null;
|
||||
this.defaultValue = options.defaultValue;
|
||||
this.type = options.type !== undefined ? options.type : null;
|
||||
this.choices = options.choices !== undefined ? options.choices : null;
|
||||
this.required = options.required !== undefined ? options.required: false;
|
||||
this.help = options.help !== undefined ? options.help : null;
|
||||
this.metavar = options.metavar !== undefined ? options.metavar : null;
|
||||
|
||||
if (!(this.optionStrings instanceof Array)) {
|
||||
throw new Error('optionStrings should be an array');
|
||||
}
|
||||
if (this.required !== undefined && typeof(this.required) !== 'boolean') {
|
||||
throw new Error('required should be a boolean');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Action#getName -> String
|
||||
*
|
||||
* Tells action name
|
||||
**/
|
||||
Action.prototype.getName = function () {
|
||||
if (this.optionStrings.length > 0) {
|
||||
return this.optionStrings.join('/');
|
||||
} else if (this.metavar !== null && this.metavar !== $$.SUPPRESS) {
|
||||
return this.metavar;
|
||||
} else if (this.dest !== undefined && this.dest !== $$.SUPPRESS) {
|
||||
return this.dest;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Action#isOptional -> Boolean
|
||||
*
|
||||
* Return true if optional
|
||||
**/
|
||||
Action.prototype.isOptional = function () {
|
||||
return !this.isPositional();
|
||||
};
|
||||
|
||||
/**
|
||||
* Action#isPositional -> Boolean
|
||||
*
|
||||
* Return true if positional
|
||||
**/
|
||||
Action.prototype.isPositional = function () {
|
||||
return (this.optionStrings.length === 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* Action#call(parser, namespace, values, optionString) -> Void
|
||||
* - parser (ArgumentParser): current parser
|
||||
* - namespace (Namespace): namespace for output data
|
||||
* - values (Array): parsed values
|
||||
* - optionString (Array): input option string(not parsed)
|
||||
*
|
||||
* Call the action. Should be implemented in inherited classes
|
||||
*
|
||||
* ##### Example
|
||||
*
|
||||
* ActionCount.prototype.call = function (parser, namespace, values, optionString) {
|
||||
* namespace.set(this.dest, (namespace[this.dest] || 0) + 1);
|
||||
* };
|
||||
*
|
||||
**/
|
||||
Action.prototype.call = function () {
|
||||
throw new Error('.call() not defined');// Not Implemented error
|
||||
};
|
55
node_modules/argparse/lib/action/append.js
generated
vendored
Normal file
55
node_modules/argparse/lib/action/append.js
generated
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*:nodoc:*
|
||||
* class ActionAppend
|
||||
*
|
||||
* This action stores a list, and appends each argument value to the list.
|
||||
* This is useful to allow an option to be specified multiple times.
|
||||
* This class inherided from [[Action]]
|
||||
*
|
||||
**/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
|
||||
var Action = require('../action');
|
||||
|
||||
// Constants
|
||||
var $$ = require('../const');
|
||||
|
||||
/*:nodoc:*
|
||||
* new ActionAppend(options)
|
||||
* - options (object): options hash see [[Action.new]]
|
||||
*
|
||||
* Note: options.nargs should be optional for constants
|
||||
* and more then zero for other
|
||||
**/
|
||||
var ActionAppend = module.exports = function ActionAppend(options) {
|
||||
options = options || {};
|
||||
if (this.nargs <= 0) {
|
||||
throw new Error('nargs for append actions must be > 0; if arg ' +
|
||||
'strings are not supplying the value to append, ' +
|
||||
'the append const action may be more appropriate');
|
||||
}
|
||||
if (!!this.constant && this.nargs !== $$.OPTIONAL) {
|
||||
throw new Error('nargs must be OPTIONAL to supply const');
|
||||
}
|
||||
Action.call(this, options);
|
||||
};
|
||||
util.inherits(ActionAppend, Action);
|
||||
|
||||
/*:nodoc:*
|
||||
* ActionAppend#call(parser, namespace, values, optionString) -> Void
|
||||
* - parser (ArgumentParser): current parser
|
||||
* - namespace (Namespace): namespace for output data
|
||||
* - values (Array): parsed values
|
||||
* - optionString (Array): input option string(not parsed)
|
||||
*
|
||||
* Call the action. Save result in namespace object
|
||||
**/
|
||||
ActionAppend.prototype.call = function (parser, namespace, values) {
|
||||
var items = [].concat(namespace[this.dest] || []); // or _.clone
|
||||
items.push(values);
|
||||
namespace.set(this.dest, items);
|
||||
};
|
||||
|
||||
|
47
node_modules/argparse/lib/action/append/constant.js
generated
vendored
Normal file
47
node_modules/argparse/lib/action/append/constant.js
generated
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
/*:nodoc:*
|
||||
* class ActionAppendConstant
|
||||
*
|
||||
* This stores a list, and appends the value specified by
|
||||
* the const keyword argument to the list.
|
||||
* (Note that the const keyword argument defaults to null.)
|
||||
* The 'appendConst' action is typically useful when multiple
|
||||
* arguments need to store constants to the same list.
|
||||
*
|
||||
* This class inherited from [[Action]]
|
||||
**/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
|
||||
var Action = require('../../action');
|
||||
|
||||
/*:nodoc:*
|
||||
* new ActionAppendConstant(options)
|
||||
* - options (object): options hash see [[Action.new]]
|
||||
*
|
||||
**/
|
||||
var ActionAppendConstant = module.exports = function ActionAppendConstant(options) {
|
||||
options = options || {};
|
||||
options.nargs = 0;
|
||||
if (options.constant === undefined) {
|
||||
throw new Error('constant option is required for appendAction');
|
||||
}
|
||||
Action.call(this, options);
|
||||
};
|
||||
util.inherits(ActionAppendConstant, Action);
|
||||
|
||||
/*:nodoc:*
|
||||
* ActionAppendConstant#call(parser, namespace, values, optionString) -> Void
|
||||
* - parser (ArgumentParser): current parser
|
||||
* - namespace (Namespace): namespace for output data
|
||||
* - values (Array): parsed values
|
||||
* - optionString (Array): input option string(not parsed)
|
||||
*
|
||||
* Call the action. Save result in namespace object
|
||||
**/
|
||||
ActionAppendConstant.prototype.call = function (parser, namespace) {
|
||||
var items = [].concat(namespace[this.dest] || []);
|
||||
items.push(this.constant);
|
||||
namespace.set(this.dest, items);
|
||||
};
|
40
node_modules/argparse/lib/action/count.js
generated
vendored
Normal file
40
node_modules/argparse/lib/action/count.js
generated
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*:nodoc:*
|
||||
* class ActionCount
|
||||
*
|
||||
* This counts the number of times a keyword argument occurs.
|
||||
* For example, this is useful for increasing verbosity levels
|
||||
*
|
||||
* This class inherided from [[Action]]
|
||||
*
|
||||
**/
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
|
||||
var Action = require('../action');
|
||||
|
||||
/*:nodoc:*
|
||||
* new ActionCount(options)
|
||||
* - options (object): options hash see [[Action.new]]
|
||||
*
|
||||
**/
|
||||
var ActionCount = module.exports = function ActionCount(options) {
|
||||
options = options || {};
|
||||
options.nargs = 0;
|
||||
|
||||
Action.call(this, options);
|
||||
};
|
||||
util.inherits(ActionCount, Action);
|
||||
|
||||
/*:nodoc:*
|
||||
* ActionCount#call(parser, namespace, values, optionString) -> Void
|
||||
* - parser (ArgumentParser): current parser
|
||||
* - namespace (Namespace): namespace for output data
|
||||
* - values (Array): parsed values
|
||||
* - optionString (Array): input option string(not parsed)
|
||||
*
|
||||
* Call the action. Save result in namespace object
|
||||
**/
|
||||
ActionCount.prototype.call = function (parser, namespace) {
|
||||
namespace.set(this.dest, (namespace[this.dest] || 0) + 1);
|
||||
};
|
48
node_modules/argparse/lib/action/help.js
generated
vendored
Normal file
48
node_modules/argparse/lib/action/help.js
generated
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*:nodoc:*
|
||||
* class ActionHelp
|
||||
*
|
||||
* Support action for printing help
|
||||
* This class inherided from [[Action]]
|
||||
**/
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
|
||||
var Action = require('../action');
|
||||
|
||||
// Constants
|
||||
var $$ = require('../const');
|
||||
|
||||
/*:nodoc:*
|
||||
* new ActionHelp(options)
|
||||
* - options (object): options hash see [[Action.new]]
|
||||
*
|
||||
**/
|
||||
var ActionHelp = module.exports = function ActionHelp(options) {
|
||||
options = options || {};
|
||||
if (options.defaultValue !== null) {
|
||||
options.defaultValue = options.defaultValue;
|
||||
}
|
||||
else {
|
||||
options.defaultValue = $$.SUPPRESS;
|
||||
}
|
||||
options.dest = (options.dest !== null ? options.dest: $$.SUPPRESS);
|
||||
options.nargs = 0;
|
||||
Action.call(this, options);
|
||||
|
||||
};
|
||||
util.inherits(ActionHelp, Action);
|
||||
|
||||
/*:nodoc:*
|
||||
* ActionHelp#call(parser, namespace, values, optionString)
|
||||
* - parser (ArgumentParser): current parser
|
||||
* - namespace (Namespace): namespace for output data
|
||||
* - values (Array): parsed values
|
||||
* - optionString (Array): input option string(not parsed)
|
||||
*
|
||||
* Print help and exit
|
||||
**/
|
||||
ActionHelp.prototype.call = function (parser) {
|
||||
parser.printHelp();
|
||||
parser.exit();
|
||||
};
|
50
node_modules/argparse/lib/action/store.js
generated
vendored
Normal file
50
node_modules/argparse/lib/action/store.js
generated
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*:nodoc:*
|
||||
* class ActionStore
|
||||
*
|
||||
* This action just stores the argument’s value. This is the default action.
|
||||
*
|
||||
* This class inherited from [[Action]]
|
||||
*
|
||||
**/
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
|
||||
var Action = require('../action');
|
||||
|
||||
// Constants
|
||||
var $$ = require('../const');
|
||||
|
||||
|
||||
/*:nodoc:*
|
||||
* new ActionStore(options)
|
||||
* - options (object): options hash see [[Action.new]]
|
||||
*
|
||||
**/
|
||||
var ActionStore = module.exports = function ActionStore(options) {
|
||||
options = options || {};
|
||||
if (this.nargs <= 0) {
|
||||
throw new Error('nargs for store actions must be > 0; if you ' +
|
||||
'have nothing to store, actions such as store ' +
|
||||
'true or store const may be more appropriate');
|
||||
|
||||
}
|
||||
if (this.constant !== undefined && this.nargs !== $$.OPTIONAL) {
|
||||
throw new Error('nargs must be OPTIONAL to supply const');
|
||||
}
|
||||
Action.call(this, options);
|
||||
};
|
||||
util.inherits(ActionStore, Action);
|
||||
|
||||
/*:nodoc:*
|
||||
* ActionStore#call(parser, namespace, values, optionString) -> Void
|
||||
* - parser (ArgumentParser): current parser
|
||||
* - namespace (Namespace): namespace for output data
|
||||
* - values (Array): parsed values
|
||||
* - optionString (Array): input option string(not parsed)
|
||||
*
|
||||
* Call the action. Save result in namespace object
|
||||
**/
|
||||
ActionStore.prototype.call = function (parser, namespace, values) {
|
||||
namespace.set(this.dest, values);
|
||||
};
|
43
node_modules/argparse/lib/action/store/constant.js
generated
vendored
Normal file
43
node_modules/argparse/lib/action/store/constant.js
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*:nodoc:*
|
||||
* class ActionStoreConstant
|
||||
*
|
||||
* This action stores the value specified by the const keyword argument.
|
||||
* (Note that the const keyword argument defaults to the rather unhelpful null.)
|
||||
* The 'store_const' action is most commonly used with optional
|
||||
* arguments that specify some sort of flag.
|
||||
*
|
||||
* This class inherited from [[Action]]
|
||||
**/
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
|
||||
var Action = require('../../action');
|
||||
|
||||
/*:nodoc:*
|
||||
* new ActionStoreConstant(options)
|
||||
* - options (object): options hash see [[Action.new]]
|
||||
*
|
||||
**/
|
||||
var ActionStoreConstant = module.exports = function ActionStoreConstant(options) {
|
||||
options = options || {};
|
||||
options.nargs = 0;
|
||||
if (options.constant === undefined) {
|
||||
throw new Error('constant option is required for storeAction');
|
||||
}
|
||||
Action.call(this, options);
|
||||
};
|
||||
util.inherits(ActionStoreConstant, Action);
|
||||
|
||||
/*:nodoc:*
|
||||
* ActionStoreConstant#call(parser, namespace, values, optionString) -> Void
|
||||
* - parser (ArgumentParser): current parser
|
||||
* - namespace (Namespace): namespace for output data
|
||||
* - values (Array): parsed values
|
||||
* - optionString (Array): input option string(not parsed)
|
||||
*
|
||||
* Call the action. Save result in namespace object
|
||||
**/
|
||||
ActionStoreConstant.prototype.call = function (parser, namespace) {
|
||||
namespace.set(this.dest, this.constant);
|
||||
};
|
27
node_modules/argparse/lib/action/store/false.js
generated
vendored
Normal file
27
node_modules/argparse/lib/action/store/false.js
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*:nodoc:*
|
||||
* class ActionStoreFalse
|
||||
*
|
||||
* This action store the values False respectively.
|
||||
* This is special cases of 'storeConst'
|
||||
*
|
||||
* This class inherited from [[Action]]
|
||||
**/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
|
||||
var ActionStoreConstant = require('./constant');
|
||||
|
||||
/*:nodoc:*
|
||||
* new ActionStoreFalse(options)
|
||||
* - options (object): hash of options see [[Action.new]]
|
||||
*
|
||||
**/
|
||||
var ActionStoreFalse = module.exports = function ActionStoreFalse(options) {
|
||||
options = options || {};
|
||||
options.constant = false;
|
||||
options.defaultValue = options.defaultValue !== null ? options.defaultValue: true;
|
||||
ActionStoreConstant.call(this, options);
|
||||
};
|
||||
util.inherits(ActionStoreFalse, ActionStoreConstant);
|
26
node_modules/argparse/lib/action/store/true.js
generated
vendored
Normal file
26
node_modules/argparse/lib/action/store/true.js
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*:nodoc:*
|
||||
* class ActionStoreTrue
|
||||
*
|
||||
* This action store the values True respectively.
|
||||
* This isspecial cases of 'storeConst'
|
||||
*
|
||||
* This class inherited from [[Action]]
|
||||
**/
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
|
||||
var ActionStoreConstant = require('./constant');
|
||||
|
||||
/*:nodoc:*
|
||||
* new ActionStoreTrue(options)
|
||||
* - options (object): options hash see [[Action.new]]
|
||||
*
|
||||
**/
|
||||
var ActionStoreTrue = module.exports = function ActionStoreTrue(options) {
|
||||
options = options || {};
|
||||
options.constant = true;
|
||||
options.defaultValue = options.defaultValue !== null ? options.defaultValue: false;
|
||||
ActionStoreConstant.call(this, options);
|
||||
};
|
||||
util.inherits(ActionStoreTrue, ActionStoreConstant);
|
148
node_modules/argparse/lib/action/subparsers.js
generated
vendored
Normal file
148
node_modules/argparse/lib/action/subparsers.js
generated
vendored
Normal file
|
@ -0,0 +1,148 @@
|
|||
/** internal
|
||||
* class ActionSubparsers
|
||||
*
|
||||
* Support the creation of such sub-commands with the addSubparsers()
|
||||
*
|
||||
* This class inherited from [[Action]]
|
||||
**/
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var format = require('util').format;
|
||||
var _ = require('underscore');
|
||||
|
||||
|
||||
var Action = require('../action');
|
||||
|
||||
// Constants
|
||||
var $$ = require('../const');
|
||||
|
||||
// Errors
|
||||
var argumentErrorHelper = require('../argument/error');
|
||||
|
||||
|
||||
/*:nodoc:*
|
||||
* new ChoicesPseudoAction(name, help)
|
||||
*
|
||||
* Create pseudo action for correct help text
|
||||
*
|
||||
**/
|
||||
var ChoicesPseudoAction = function (name, help) {
|
||||
var options = {
|
||||
optionStrings: [],
|
||||
dest: name,
|
||||
help: help
|
||||
};
|
||||
|
||||
Action.call(this, options);
|
||||
};
|
||||
util.inherits(ChoicesPseudoAction, Action);
|
||||
|
||||
/**
|
||||
* new ActionSubparsers(options)
|
||||
* - options (object): options hash see [[Action.new]]
|
||||
*
|
||||
**/
|
||||
var ActionSubparsers = module.exports = function ActionSubparsers(options) {
|
||||
options = options || {};
|
||||
options.dest = options.dest || $$.SUPPRESS;
|
||||
options.nargs = $$.PARSER;
|
||||
|
||||
this.debug = (options.debug === true);
|
||||
|
||||
this._progPrefix = options.prog;
|
||||
this._parserClass = options.parserClass;
|
||||
this._nameParserMap = {};
|
||||
this._choicesActions = [];
|
||||
|
||||
options.choices = this._nameParserMap;
|
||||
Action.call(this, options);
|
||||
};
|
||||
util.inherits(ActionSubparsers, Action);
|
||||
|
||||
/*:nodoc:*
|
||||
* ActionSubparsers#addParser(name, options) -> ArgumentParser
|
||||
* - name (string): sub-command name
|
||||
* - options (object): see [[ArgumentParser.new]]
|
||||
*
|
||||
* Note:
|
||||
* addParser supports an additional aliases option,
|
||||
* which allows multiple strings to refer to the same subparser.
|
||||
* This example, like svn, aliases co as a shorthand for checkout
|
||||
*
|
||||
**/
|
||||
ActionSubparsers.prototype.addParser = function (name, options) {
|
||||
var parser;
|
||||
|
||||
var self = this;
|
||||
|
||||
options = options || {};
|
||||
|
||||
options.debug = (this.debug === true);
|
||||
|
||||
// set program from the existing prefix
|
||||
if (!options.prog) {
|
||||
options.prog = this._progPrefix + ' ' + name;
|
||||
}
|
||||
|
||||
var aliases = options.aliases || [];
|
||||
|
||||
// create a pseudo-action to hold the choice help
|
||||
if (!!options.help || _.isString(options.help)) {
|
||||
var help = options.help;
|
||||
delete options.help;
|
||||
|
||||
var choiceAction = new ChoicesPseudoAction(name, help);
|
||||
this._choicesActions.push(choiceAction);
|
||||
}
|
||||
|
||||
// create the parser and add it to the map
|
||||
parser = new this._parserClass(options);
|
||||
this._nameParserMap[name] = parser;
|
||||
|
||||
// make parser available under aliases also
|
||||
aliases.forEach(function (alias) {
|
||||
self._nameParserMap[alias] = parser;
|
||||
});
|
||||
|
||||
return parser;
|
||||
};
|
||||
|
||||
ActionSubparsers.prototype._getSubactions = function () {
|
||||
return this._choicesActions;
|
||||
};
|
||||
|
||||
/*:nodoc:*
|
||||
* ActionSubparsers#call(parser, namespace, values, optionString) -> Void
|
||||
* - parser (ArgumentParser): current parser
|
||||
* - namespace (Namespace): namespace for output data
|
||||
* - values (Array): parsed values
|
||||
* - optionString (Array): input option string(not parsed)
|
||||
*
|
||||
* Call the action. Parse input aguments
|
||||
**/
|
||||
ActionSubparsers.prototype.call = function (parser, namespace, values) {
|
||||
var parserName = values[0];
|
||||
var argStrings = values.slice(1);
|
||||
|
||||
// set the parser name if requested
|
||||
if (this.dest !== $$.SUPPRESS) {
|
||||
namespace[this.dest] = parserName;
|
||||
}
|
||||
|
||||
// select the parser
|
||||
if (!!this._nameParserMap[parserName]) {
|
||||
parser = this._nameParserMap[parserName];
|
||||
} else {
|
||||
throw argumentErrorHelper(format(
|
||||
'Unknown parser "%s" (choices: [%s]).',
|
||||
parserName,
|
||||
_.keys(this._nameParserMap).join(', ')
|
||||
));
|
||||
}
|
||||
|
||||
// parse all the remaining options into the namespace
|
||||
parser.parseArgs(argStrings, namespace);
|
||||
};
|
||||
|
||||
|
50
node_modules/argparse/lib/action/version.js
generated
vendored
Normal file
50
node_modules/argparse/lib/action/version.js
generated
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*:nodoc:*
|
||||
* class ActionVersion
|
||||
*
|
||||
* Support action for printing program version
|
||||
* This class inherited from [[Action]]
|
||||
**/
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
|
||||
var Action = require('../action');
|
||||
|
||||
//
|
||||
// Constants
|
||||
//
|
||||
var $$ = require('../const');
|
||||
|
||||
/*:nodoc:*
|
||||
* new ActionVersion(options)
|
||||
* - options (object): options hash see [[Action.new]]
|
||||
*
|
||||
**/
|
||||
var ActionVersion = module.exports = function ActionVersion(options) {
|
||||
options = options || {};
|
||||
options.defaultValue = (!!options.defaultValue ? options.defaultValue: $$.SUPPRESS);
|
||||
options.dest = (options.dest || $$.SUPPRESS);
|
||||
options.nargs = 0;
|
||||
this.version = options.version;
|
||||
Action.call(this, options);
|
||||
};
|
||||
util.inherits(ActionVersion, Action);
|
||||
|
||||
/*:nodoc:*
|
||||
* ActionVersion#call(parser, namespace, values, optionString) -> Void
|
||||
* - parser (ArgumentParser): current parser
|
||||
* - namespace (Namespace): namespace for output data
|
||||
* - values (Array): parsed values
|
||||
* - optionString (Array): input option string(not parsed)
|
||||
*
|
||||
* Print version and exit
|
||||
**/
|
||||
ActionVersion.prototype.call = function (parser) {
|
||||
var version = this.version || parser.version;
|
||||
var formatter = parser._getFormatter();
|
||||
formatter.addText(version);
|
||||
parser.exit(0, formatter.formatHelp());
|
||||
};
|
||||
|
||||
|
||||
|
481
node_modules/argparse/lib/action_container.js
generated
vendored
Normal file
481
node_modules/argparse/lib/action_container.js
generated
vendored
Normal file
|
@ -0,0 +1,481 @@
|
|||
/** internal
|
||||
* class ActionContainer
|
||||
*
|
||||
* Action container. Parent for [[ArgumentParser]] and [[ArgumentGroup]]
|
||||
**/
|
||||
|
||||
'use strict';
|
||||
|
||||
var format = require('util').format;
|
||||
var _ = require('underscore');
|
||||
|
||||
_.str = require('underscore.string');
|
||||
|
||||
// Constants
|
||||
var $$ = require('./const');
|
||||
|
||||
//Actions
|
||||
var ActionHelp = require('./action/help');
|
||||
var ActionAppend = require('./action/append');
|
||||
var ActionAppendConstant = require('./action/append/constant');
|
||||
var ActionCount = require('./action/count');
|
||||
var ActionStore = require('./action/store');
|
||||
var ActionStoreConstant = require('./action/store/constant');
|
||||
var ActionStoreTrue = require('./action/store/true');
|
||||
var ActionStoreFalse = require('./action/store/false');
|
||||
var ActionVersion = require('./action/version');
|
||||
var ActionSubparsers = require('./action/subparsers');
|
||||
|
||||
// Errors
|
||||
var argumentErrorHelper = require('./argument/error');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* new ActionContainer(options)
|
||||
*
|
||||
* Action container. Parent for [[ArgumentParser]] and [[ArgumentGroup]]
|
||||
*
|
||||
* ##### Options:
|
||||
*
|
||||
* - `description` -- A description of what the program does
|
||||
* - `prefixChars` -- Characters that prefix optional arguments
|
||||
* - `argumentDefault` -- The default value for all arguments
|
||||
* - `conflictHandler` -- The conflict handler to use for duplicate arguments
|
||||
**/
|
||||
var ActionContainer = module.exports = function ActionContainer(options) {
|
||||
options = options || {};
|
||||
|
||||
this.description = options.description;
|
||||
this.argumentDefault = options.argumentDefault;
|
||||
this.prefixChars = options.prefixChars || '';
|
||||
this.conflictHandler = options.conflictHandler;
|
||||
|
||||
// set up registries
|
||||
this._registries = {};
|
||||
|
||||
// register actions
|
||||
this.register('action', null, ActionStore);
|
||||
this.register('action', 'store', ActionStore);
|
||||
this.register('action', 'storeConst', ActionStoreConstant);
|
||||
this.register('action', 'storeTrue', ActionStoreTrue);
|
||||
this.register('action', 'storeFalse', ActionStoreFalse);
|
||||
this.register('action', 'append', ActionAppend);
|
||||
this.register('action', 'appendConst', ActionAppendConstant);
|
||||
this.register('action', 'count', ActionCount);
|
||||
this.register('action', 'help', ActionHelp);
|
||||
this.register('action', 'version', ActionVersion);
|
||||
this.register('action', 'parsers', ActionSubparsers);
|
||||
|
||||
// raise an exception if the conflict handler is invalid
|
||||
this._getHandler();
|
||||
|
||||
// action storage
|
||||
this._actions = [];
|
||||
this._optionStringActions = {};
|
||||
|
||||
// groups
|
||||
this._actionGroups = [];
|
||||
this._mutuallyExclusiveGroups = [];
|
||||
|
||||
// defaults storage
|
||||
this._defaults = {};
|
||||
|
||||
// determines whether an "option" looks like a negative number
|
||||
// -1, -1.5 -5e+4
|
||||
this._regexpNegativeNumber = new RegExp('^[-]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$');
|
||||
|
||||
// whether or not there are any optionals that look like negative
|
||||
// numbers -- uses a list so it can be shared and edited
|
||||
this._hasNegativeNumberOptionals = [];
|
||||
};
|
||||
|
||||
// Groups must be required, then ActionContainer already defined
|
||||
var ArgumentGroup = require('./argument/group');
|
||||
var MutuallyExclusiveGroup = require('./argument/exclusive');
|
||||
|
||||
//
|
||||
// Registration methods
|
||||
//
|
||||
|
||||
/**
|
||||
* ActionContainer#register(registryName, value, object) -> Void
|
||||
* - registryName (String) : object type action|type
|
||||
* - value (string) : keyword
|
||||
* - object (Object|Function) : handler
|
||||
*
|
||||
* Register handlers
|
||||
**/
|
||||
ActionContainer.prototype.register = function (registryName, value, object) {
|
||||
this._registries[registryName] = this._registries[registryName] || {};
|
||||
this._registries[registryName][value] = object;
|
||||
};
|
||||
|
||||
ActionContainer.prototype._registryGet = function (registryName, value, defaultValue) {
|
||||
if (3 > arguments.length) {
|
||||
defaultValue = null;
|
||||
}
|
||||
return this._registries[registryName][value] || defaultValue;
|
||||
};
|
||||
|
||||
//
|
||||
// Namespace default accessor methods
|
||||
//
|
||||
|
||||
/**
|
||||
* ActionContainer#setDefaults(options) -> Void
|
||||
* - options (object):hash of options see [[Action.new]]
|
||||
*
|
||||
* Set defaults
|
||||
**/
|
||||
ActionContainer.prototype.setDefaults = function (options) {
|
||||
options = options || {};
|
||||
for (var property in options) {
|
||||
this._defaults[property] = options[property];
|
||||
}
|
||||
|
||||
// if these defaults match any existing arguments, replace the previous
|
||||
// default on the object with the new one
|
||||
this._actions.forEach(function (action) {
|
||||
if (action.dest in options) {
|
||||
action.defaultValue = options[action.dest];
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* ActionContainer#getDefault(dest) -> Mixed
|
||||
* - dest (string): action destination
|
||||
*
|
||||
* Return action default value
|
||||
**/
|
||||
ActionContainer.prototype.getDefault = function (dest) {
|
||||
var result = (_.has(this._defaults, dest)) ? this._defaults[dest] : null;
|
||||
|
||||
this._actions.forEach(function (action) {
|
||||
if (action.dest === dest && _.has(action, 'defaultValue')) {
|
||||
result = action.defaultValue;
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
};
|
||||
//
|
||||
// Adding argument actions
|
||||
//
|
||||
|
||||
/**
|
||||
* ActionContainer#addArgument(args, options) -> Object
|
||||
* - args (Array): array of argument keys
|
||||
* - options (Object): action objects see [[Action.new]]
|
||||
*
|
||||
* #### Examples
|
||||
* - addArgument([-f, --foo], {action:'store', defaultValue=1, ...})
|
||||
* - addArgument(['bar'], action: 'store', nargs:1, ...})
|
||||
**/
|
||||
ActionContainer.prototype.addArgument = function (args, options) {
|
||||
args = args;
|
||||
options = options || {};
|
||||
|
||||
if (!_.isArray(args)) {
|
||||
throw new TypeError('addArgument first argument should be an array');
|
||||
}
|
||||
if (!_.isObject(options) || _.isArray(options)) {
|
||||
throw new TypeError('addArgument second argument should be a hash');
|
||||
}
|
||||
|
||||
// if no positional args are supplied or only one is supplied and
|
||||
// it doesn't look like an option string, parse a positional argument
|
||||
if (!args || args.length === 1 && this.prefixChars.indexOf(args[0][0]) < 0) {
|
||||
if (args && !!options.dest) {
|
||||
throw new Error('dest supplied twice for positional argument');
|
||||
}
|
||||
options = this._getPositional(args, options);
|
||||
|
||||
// otherwise, we're adding an optional argument
|
||||
} else {
|
||||
options = this._getOptional(args, options);
|
||||
}
|
||||
|
||||
// if no default was supplied, use the parser-level default
|
||||
if (_.isUndefined(options.defaultValue)) {
|
||||
var dest = options.dest;
|
||||
if (_.has(this._defaults, dest)) {
|
||||
options.defaultValue = this._defaults[dest];
|
||||
} else if (!_.isUndefined(this.argumentDefault)) {
|
||||
options.defaultValue = this.argumentDefault;
|
||||
}
|
||||
}
|
||||
|
||||
// create the action object, and add it to the parser
|
||||
var ActionClass = this._popActionClass(options);
|
||||
if (! _.isFunction(ActionClass)) {
|
||||
throw new Error(format('Unknown action "%s".', ActionClass));
|
||||
}
|
||||
var action = new ActionClass(options);
|
||||
|
||||
// throw an error if the action type is not callable
|
||||
var typeFunction = this._registryGet('type', action.type, action.type);
|
||||
if (!_.isFunction(typeFunction)) {
|
||||
throw new Error(format('"%s" is not callable', typeFunction));
|
||||
}
|
||||
|
||||
return this._addAction(action);
|
||||
};
|
||||
|
||||
/**
|
||||
* ActionContainer#addArgumentGroup(options) -> ArgumentGroup
|
||||
* - options (Object): hash of options see [[ArgumentGroup.new]]
|
||||
*
|
||||
* Create new arguments groups
|
||||
**/
|
||||
ActionContainer.prototype.addArgumentGroup = function (options) {
|
||||
var group = new ArgumentGroup(this, options);
|
||||
this._actionGroups.push(group);
|
||||
return group;
|
||||
};
|
||||
|
||||
/**
|
||||
* ActionContainer#addMutuallyExclusiveGroup(options) -> ArgumentGroup
|
||||
* - options (Object): {required: false}
|
||||
*
|
||||
* Create new mutual exclusive groups
|
||||
**/
|
||||
ActionContainer.prototype.addMutuallyExclusiveGroup = function (options) {
|
||||
var group = new MutuallyExclusiveGroup(this, options);
|
||||
this._mutuallyExclusiveGroups.push(group);
|
||||
return group;
|
||||
};
|
||||
|
||||
ActionContainer.prototype._addAction = function (action) {
|
||||
var self = this;
|
||||
|
||||
// resolve any conflicts
|
||||
this._checkConflict(action);
|
||||
|
||||
// add to actions list
|
||||
this._actions.push(action);
|
||||
action.container = this;
|
||||
|
||||
// index the action by any option strings it has
|
||||
action.optionStrings.forEach(function (optionString) {
|
||||
self._optionStringActions[optionString] = action;
|
||||
});
|
||||
|
||||
// set the flag if any option strings look like negative numbers
|
||||
action.optionStrings.forEach(function (optionString) {
|
||||
if (optionString.match(self._regexpNegativeNumber)) {
|
||||
if (!_.any(self._hasNegativeNumberOptionals)) {
|
||||
self._hasNegativeNumberOptionals.push(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// return the created action
|
||||
return action;
|
||||
};
|
||||
|
||||
ActionContainer.prototype._removeAction = function (action) {
|
||||
var actionIndex = this._actions.indexOf(action);
|
||||
if (actionIndex >= 0) {
|
||||
this._actions.splice(actionIndex, 1);
|
||||
}
|
||||
};
|
||||
|
||||
ActionContainer.prototype._addContainerActions = function (container) {
|
||||
// collect groups by titles
|
||||
var titleGroupMap = {};
|
||||
this._actionGroups.forEach(function (group) {
|
||||
if (titleGroupMap[group.title]) {
|
||||
throw new Error(format('Cannot merge actions - two groups are named "%s".', group.title));
|
||||
}
|
||||
titleGroupMap[group.title] = group;
|
||||
});
|
||||
|
||||
// map each action to its group
|
||||
var groupMap = {};
|
||||
function actionHash(action) {
|
||||
// unique (hopefully?) string suitable as dictionary key
|
||||
return action.getName();
|
||||
}
|
||||
container._actionGroups.forEach(function (group) {
|
||||
// if a group with the title exists, use that, otherwise
|
||||
// create a new group matching the container's group
|
||||
if (!titleGroupMap[group.title]) {
|
||||
titleGroupMap[group.title] = this.addArgumentGroup({
|
||||
title: group.title,
|
||||
description: group.description
|
||||
});
|
||||
}
|
||||
|
||||
// map the actions to their new group
|
||||
group._groupActions.forEach(function (action) {
|
||||
groupMap[actionHash(action)] = titleGroupMap[group.title];
|
||||
});
|
||||
}, this);
|
||||
|
||||
// add container's mutually exclusive groups
|
||||
// NOTE: if add_mutually_exclusive_group ever gains title= and
|
||||
// description= then this code will need to be expanded as above
|
||||
var mutexGroup;
|
||||
container._mutuallyExclusiveGroups.forEach(function (group) {
|
||||
mutexGroup = this.addMutuallyExclusiveGroup({
|
||||
required: group.required
|
||||
});
|
||||
// map the actions to their new mutex group
|
||||
group._groupActions.forEach(function (action) {
|
||||
groupMap[actionHash(action)] = mutexGroup;
|
||||
});
|
||||
}, this); // forEach takes a 'this' argument
|
||||
|
||||
// add all actions to this container or their group
|
||||
container._actions.forEach(function (action) {
|
||||
var key = actionHash(action);
|
||||
if (!!groupMap[key]) {
|
||||
groupMap[key]._addAction(action);
|
||||
}
|
||||
else
|
||||
{
|
||||
this._addAction(action);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
ActionContainer.prototype._getPositional = function (dest, options) {
|
||||
if (_.isArray(dest)) {
|
||||
dest = _.first(dest);
|
||||
}
|
||||
// make sure required is not specified
|
||||
if (options.required) {
|
||||
throw new Error('"required" is an invalid argument for positionals.');
|
||||
}
|
||||
|
||||
// mark positional arguments as required if at least one is
|
||||
// always required
|
||||
if (options.nargs !== $$.OPTIONAL && options.nargs !== $$.ZERO_OR_MORE) {
|
||||
options.required = true;
|
||||
}
|
||||
if (options.nargs === $$.ZERO_OR_MORE && options.defaultValue === undefined) {
|
||||
options.required = true;
|
||||
}
|
||||
|
||||
// return the keyword arguments with no option strings
|
||||
options.dest = dest;
|
||||
options.optionStrings = [];
|
||||
return options;
|
||||
};
|
||||
|
||||
ActionContainer.prototype._getOptional = function (args, options) {
|
||||
var prefixChars = this.prefixChars;
|
||||
var optionStrings = [];
|
||||
var optionStringsLong = [];
|
||||
|
||||
// determine short and long option strings
|
||||
args.forEach(function (optionString) {
|
||||
// error on strings that don't start with an appropriate prefix
|
||||
if (prefixChars.indexOf(optionString[0]) < 0) {
|
||||
throw new Error(format('Invalid option string "%s": must start with a "%s".',
|
||||
optionString,
|
||||
prefixChars
|
||||
));
|
||||
}
|
||||
|
||||
// strings starting with two prefix characters are long options
|
||||
optionStrings.push(optionString);
|
||||
if (optionString.length > 1 && prefixChars.indexOf(optionString[1]) >= 0) {
|
||||
optionStringsLong.push(optionString);
|
||||
}
|
||||
});
|
||||
|
||||
// infer dest, '--foo-bar' -> 'foo_bar' and '-x' -> 'x'
|
||||
var dest = options.dest || null;
|
||||
delete options.dest;
|
||||
|
||||
if (!dest) {
|
||||
var optionStringDest = optionStringsLong.length ? optionStringsLong[0] :optionStrings[0];
|
||||
dest = _.str.strip(optionStringDest, this.prefixChars);
|
||||
|
||||
if (dest.length === 0) {
|
||||
throw new Error(
|
||||
format('dest= is required for options like "%s"', optionStrings.join(', '))
|
||||
);
|
||||
}
|
||||
dest = dest.replace(/-/g, '_');
|
||||
}
|
||||
|
||||
// return the updated keyword arguments
|
||||
options.dest = dest;
|
||||
options.optionStrings = optionStrings;
|
||||
|
||||
return options;
|
||||
};
|
||||
|
||||
ActionContainer.prototype._popActionClass = function (options, defaultValue) {
|
||||
defaultValue = defaultValue || null;
|
||||
|
||||
var action = (options.action || defaultValue);
|
||||
delete options.action;
|
||||
|
||||
var actionClass = this._registryGet('action', action, action);
|
||||
return actionClass;
|
||||
};
|
||||
|
||||
ActionContainer.prototype._getHandler = function () {
|
||||
var handlerString = this.conflictHandler;
|
||||
var handlerFuncName = "_handleConflict" + _.str.capitalize(handlerString);
|
||||
var func = this[handlerFuncName];
|
||||
if (typeof func === 'undefined') {
|
||||
var msg = "invalid conflict resolution value: " + handlerString;
|
||||
throw new Error(msg);
|
||||
} else {
|
||||
return func;
|
||||
}
|
||||
};
|
||||
|
||||
ActionContainer.prototype._checkConflict = function (action) {
|
||||
var optionStringActions = this._optionStringActions;
|
||||
var conflictOptionals = [];
|
||||
|
||||
// find all options that conflict with this option
|
||||
// collect pairs, the string, and an existing action that it conflicts with
|
||||
action.optionStrings.forEach(function (optionString) {
|
||||
var conflOptional = optionStringActions[optionString];
|
||||
if (typeof conflOptional !== 'undefined') {
|
||||
conflictOptionals.push([optionString, conflOptional]);
|
||||
}
|
||||
});
|
||||
|
||||
if (conflictOptionals.length > 0) {
|
||||
var conflictHandler = this._getHandler();
|
||||
conflictHandler.call(this, action, conflictOptionals);
|
||||
}
|
||||
};
|
||||
|
||||
ActionContainer.prototype._handleConflictError = function (action, conflOptionals) {
|
||||
var conflicts = _.map(conflOptionals, function (pair) {return pair[0]; });
|
||||
conflicts = conflicts.join(', ');
|
||||
throw argumentErrorHelper(
|
||||
action,
|
||||
format('Conflicting option string(s): %s', conflicts)
|
||||
);
|
||||
};
|
||||
|
||||
ActionContainer.prototype._handleConflictResolve = function (action, conflOptionals) {
|
||||
// remove all conflicting options
|
||||
var self = this;
|
||||
conflOptionals.forEach(function (pair) {
|
||||
var optionString = pair[0];
|
||||
var conflictingAction = pair[1];
|
||||
// remove the conflicting option string
|
||||
var i = conflictingAction.optionStrings.indexOf(optionString);
|
||||
if (i >= 0) {
|
||||
conflictingAction.optionStrings.splice(i, 1);
|
||||
}
|
||||
delete self._optionStringActions[optionString];
|
||||
// if the option now has no option string, remove it from the
|
||||
// container holding it
|
||||
if (conflictingAction.optionStrings.length === 0) {
|
||||
conflictingAction.container._removeAction(conflictingAction);
|
||||
}
|
||||
});
|
||||
};
|
14
node_modules/argparse/lib/argparse.js
generated
vendored
Normal file
14
node_modules/argparse/lib/argparse.js
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
'use strict';
|
||||
|
||||
module.exports.ArgumentParser = require('./argument_parser.js');
|
||||
module.exports.Namespace = require('./namespace');
|
||||
module.exports.Action = require('./action');
|
||||
module.exports.HelpFormatter = require('./help/formatter.js');
|
||||
module.exports.Const = require('./const.js');
|
||||
|
||||
module.exports.ArgumentDefaultsHelpFormatter =
|
||||
require('./help/added_formatters.js').ArgumentDefaultsHelpFormatter;
|
||||
module.exports.RawDescriptionHelpFormatter =
|
||||
require('./help/added_formatters.js').RawDescriptionHelpFormatter;
|
||||
module.exports.RawTextHelpFormatter =
|
||||
require('./help/added_formatters.js').RawTextHelpFormatter;
|
50
node_modules/argparse/lib/argument/error.js
generated
vendored
Normal file
50
node_modules/argparse/lib/argument/error.js
generated
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
'use strict';
|
||||
|
||||
|
||||
var format = require('util').format;
|
||||
|
||||
|
||||
var ERR_CODE = 'ARGError';
|
||||
|
||||
/*:nodoc:*
|
||||
* argumentError(argument, message) -> TypeError
|
||||
* - argument (Object): action with broken argument
|
||||
* - message (String): error message
|
||||
*
|
||||
* Error format helper. An error from creating or using an argument
|
||||
* (optional or positional). The string value of this exception
|
||||
* is the message, augmented with information
|
||||
* about the argument that caused it.
|
||||
*
|
||||
* #####Example
|
||||
*
|
||||
* var argumentErrorHelper = require('./argument/error');
|
||||
* if (conflictOptionals.length > 0) {
|
||||
* throw argumentErrorHelper(
|
||||
* action,
|
||||
* format('Conflicting option string(s): %s', conflictOptionals.join(', '))
|
||||
* );
|
||||
* }
|
||||
*
|
||||
**/
|
||||
module.exports = function (argument, message) {
|
||||
var argumentName = null;
|
||||
var errMessage;
|
||||
var err;
|
||||
|
||||
if (argument.getName) {
|
||||
argumentName = argument.getName();
|
||||
} else {
|
||||
argumentName = '' + argument;
|
||||
}
|
||||
|
||||
if (!argumentName) {
|
||||
errMessage = message;
|
||||
} else {
|
||||
errMessage = format('argument "%s": %s', argumentName, message);
|
||||
}
|
||||
|
||||
err = new TypeError(errMessage);
|
||||
err.code = ERR_CODE;
|
||||
return err;
|
||||
};
|
54
node_modules/argparse/lib/argument/exclusive.js
generated
vendored
Normal file
54
node_modules/argparse/lib/argument/exclusive.js
generated
vendored
Normal file
|
@ -0,0 +1,54 @@
|
|||
/** internal
|
||||
* class MutuallyExclusiveGroup
|
||||
*
|
||||
* Group arguments.
|
||||
* By default, ArgumentParser groups command-line arguments
|
||||
* into “positional arguments” and “optional arguments”
|
||||
* when displaying help messages. When there is a better
|
||||
* conceptual grouping of arguments than this default one,
|
||||
* appropriate groups can be created using the addArgumentGroup() method
|
||||
*
|
||||
* This class inherited from [[ArgumentContainer]]
|
||||
**/
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
|
||||
var ArgumentGroup = require('./group');
|
||||
|
||||
/**
|
||||
* new MutuallyExclusiveGroup(container, options)
|
||||
* - container (object): main container
|
||||
* - options (object): options.required -> true/false
|
||||
*
|
||||
* `required` could be an argument itself, but making it a property of
|
||||
* the options argument is more consistent with the JS adaptation of the Python)
|
||||
**/
|
||||
var MutuallyExclusiveGroup = module.exports = function MutuallyExclusiveGroup(container, options) {
|
||||
var required;
|
||||
options = options || {};
|
||||
required = options.required || false;
|
||||
ArgumentGroup.call(this, container);
|
||||
this.required = required;
|
||||
|
||||
};
|
||||
util.inherits(MutuallyExclusiveGroup, ArgumentGroup);
|
||||
|
||||
|
||||
MutuallyExclusiveGroup.prototype._addAction = function (action) {
|
||||
var msg;
|
||||
if (action.required) {
|
||||
msg = 'mutually exclusive arguments must be optional';
|
||||
throw new Error(msg);
|
||||
}
|
||||
action = this._container._addAction(action);
|
||||
this._groupActions.push(action);
|
||||
return action;
|
||||
};
|
||||
|
||||
|
||||
MutuallyExclusiveGroup.prototype._removeAction = function (action) {
|
||||
this._container._removeAction(action);
|
||||
this._groupActions.remove(action);
|
||||
};
|
||||
|
75
node_modules/argparse/lib/argument/group.js
generated
vendored
Normal file
75
node_modules/argparse/lib/argument/group.js
generated
vendored
Normal file
|
@ -0,0 +1,75 @@
|
|||
/** internal
|
||||
* class ArgumentGroup
|
||||
*
|
||||
* Group arguments.
|
||||
* By default, ArgumentParser groups command-line arguments
|
||||
* into “positional arguments” and “optional arguments”
|
||||
* when displaying help messages. When there is a better
|
||||
* conceptual grouping of arguments than this default one,
|
||||
* appropriate groups can be created using the addArgumentGroup() method
|
||||
*
|
||||
* This class inherited from [[ArgumentContainer]]
|
||||
**/
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
|
||||
var ActionContainer = require('../action_container');
|
||||
|
||||
|
||||
/**
|
||||
* new ArgumentGroup(container, options)
|
||||
* - container (object): main container
|
||||
* - options (object): hash of group options
|
||||
*
|
||||
* #### options
|
||||
* - **prefixChars** group name prefix
|
||||
* - **argumentDefault** default argument value
|
||||
* - **title** group title
|
||||
* - **description** group description
|
||||
*
|
||||
**/
|
||||
var ArgumentGroup = module.exports = function ArgumentGroup(container, options) {
|
||||
|
||||
options = options || {};
|
||||
|
||||
// add any missing keyword arguments by checking the container
|
||||
options.conflictHandler = (options.conflictHandler || container.conflictHandler);
|
||||
options.prefixChars = (options.prefixChars || container.prefixChars);
|
||||
options.argumentDefault = (options.argumentDefault || container.argumentDefault);
|
||||
|
||||
ActionContainer.call(this, options);
|
||||
|
||||
// group attributes
|
||||
this.title = options.title;
|
||||
this._groupActions = [];
|
||||
|
||||
// share most attributes with the container
|
||||
this._container = container;
|
||||
this._registries = container._registries;
|
||||
this._actions = container._actions;
|
||||
this._optionStringActions = container._optionStringActions;
|
||||
this._defaults = container._defaults;
|
||||
this._hasNegativeNumberOptionals = container._hasNegativeNumberOptionals;
|
||||
this._mutuallyExclusiveGroups = container._mutuallyExclusiveGroups;
|
||||
};
|
||||
util.inherits(ArgumentGroup, ActionContainer);
|
||||
|
||||
|
||||
ArgumentGroup.prototype._addAction = function (action) {
|
||||
// Parent add action
|
||||
action = ActionContainer.prototype._addAction.call(this, action);
|
||||
this._groupActions.push(action);
|
||||
return action;
|
||||
};
|
||||
|
||||
|
||||
ArgumentGroup.prototype._removeAction = function (action) {
|
||||
// Parent remove action
|
||||
ActionContainer.prototype._removeAction.call(this, action);
|
||||
var actionIndex = this._groupActions.indexOf(action);
|
||||
if (actionIndex >= 0) {
|
||||
this._groupActions.splice(actionIndex, 1);
|
||||
}
|
||||
};
|
||||
|
1168
node_modules/argparse/lib/argument_parser.js
generated
vendored
Normal file
1168
node_modules/argparse/lib/argument_parser.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
18
node_modules/argparse/lib/const.js
generated
vendored
Normal file
18
node_modules/argparse/lib/const.js
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
//
|
||||
// Constants
|
||||
//
|
||||
module.exports.EOL = '\n';
|
||||
|
||||
module.exports.SUPPRESS = '==SUPPRESS==';
|
||||
|
||||
module.exports.OPTIONAL = '?';
|
||||
|
||||
module.exports.ZERO_OR_MORE = '*';
|
||||
|
||||
module.exports.ONE_OR_MORE = '+';
|
||||
|
||||
module.exports.PARSER = 'A...';
|
||||
|
||||
module.exports.REMAINDER = '...';
|
||||
|
||||
module.exports._UNRECOGNIZED_ARGS_ATTR = '_unrecognized_args';
|
88
node_modules/argparse/lib/help/added_formatters.js
generated
vendored
Normal file
88
node_modules/argparse/lib/help/added_formatters.js
generated
vendored
Normal file
|
@ -0,0 +1,88 @@
|
|||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var _ = require('underscore');
|
||||
_.str = require('underscore.string');
|
||||
|
||||
// Constants
|
||||
var $$ = require('../const');
|
||||
|
||||
var HelpFormatter = require('./formatter.js');
|
||||
|
||||
/**
|
||||
* new RawDescriptionHelpFormatter(options)
|
||||
* new ArgumentParser({formatterClass: argparse.RawDescriptionHelpFormatter, ...})
|
||||
*
|
||||
* Help message formatter which adds default values to argument help.
|
||||
*
|
||||
* Only the name of this class is considered a public API. All the methods
|
||||
* provided by the class are considered an implementation detail.
|
||||
**/
|
||||
|
||||
var ArgumentDefaultsHelpFormatter = function ArgumentDefaultsHelpFormatter(options) {
|
||||
HelpFormatter.call(this, options);
|
||||
};
|
||||
|
||||
util.inherits(ArgumentDefaultsHelpFormatter, HelpFormatter);
|
||||
|
||||
ArgumentDefaultsHelpFormatter.prototype._getHelpString = function (action) {
|
||||
var help = action.help;
|
||||
if (action.help.indexOf('%(defaultValue)s') === -1) {
|
||||
if (action.defaultValue !== $$.SUPPRESS) {
|
||||
var defaulting_nargs = [$$.OPTIONAL, $$.ZERO_OR_MORE];
|
||||
if (action.isOptional() || (defaulting_nargs.indexOf(action.nargs) >= 0)) {
|
||||
help += ' (default: %(defaultValue)s)';
|
||||
}
|
||||
}
|
||||
}
|
||||
return help;
|
||||
};
|
||||
|
||||
module.exports.ArgumentDefaultsHelpFormatter = ArgumentDefaultsHelpFormatter;
|
||||
|
||||
/**
|
||||
* new RawDescriptionHelpFormatter(options)
|
||||
* new ArgumentParser({formatterClass: argparse.RawDescriptionHelpFormatter, ...})
|
||||
*
|
||||
* Help message formatter which retains any formatting in descriptions.
|
||||
*
|
||||
* Only the name of this class is considered a public API. All the methods
|
||||
* provided by the class are considered an implementation detail.
|
||||
**/
|
||||
|
||||
var RawDescriptionHelpFormatter = function RawDescriptionHelpFormatter(options) {
|
||||
HelpFormatter.call(this, options);
|
||||
};
|
||||
|
||||
util.inherits(RawDescriptionHelpFormatter, HelpFormatter);
|
||||
|
||||
RawDescriptionHelpFormatter.prototype._fillText = function (text, width, indent) {
|
||||
var lines = text.split('\n');
|
||||
lines = lines.map(function (line) {
|
||||
return _.str.rtrim(indent + line);
|
||||
});
|
||||
return lines.join('\n');
|
||||
};
|
||||
module.exports.RawDescriptionHelpFormatter = RawDescriptionHelpFormatter;
|
||||
|
||||
/**
|
||||
* new RawTextHelpFormatter(options)
|
||||
* new ArgumentParser({formatterClass: argparse.RawTextHelpFormatter, ...})
|
||||
*
|
||||
* Help message formatter which retains formatting of all help text.
|
||||
*
|
||||
* Only the name of this class is considered a public API. All the methods
|
||||
* provided by the class are considered an implementation detail.
|
||||
**/
|
||||
|
||||
var RawTextHelpFormatter = function RawTextHelpFormatter(options) {
|
||||
RawDescriptionHelpFormatter.call(this, options);
|
||||
};
|
||||
|
||||
util.inherits(RawTextHelpFormatter, RawDescriptionHelpFormatter);
|
||||
|
||||
RawTextHelpFormatter.prototype._splitLines = function (text) {
|
||||
return text.split('\n');
|
||||
};
|
||||
|
||||
module.exports.RawTextHelpFormatter = RawTextHelpFormatter;
|
798
node_modules/argparse/lib/help/formatter.js
generated
vendored
Normal file
798
node_modules/argparse/lib/help/formatter.js
generated
vendored
Normal file
|
@ -0,0 +1,798 @@
|
|||
/**
|
||||
* class HelpFormatter
|
||||
*
|
||||
* Formatter for generating usage messages and argument help strings. Only the
|
||||
* name of this class is considered a public API. All the methods provided by
|
||||
* the class are considered an implementation detail.
|
||||
*
|
||||
* Do not call in your code, use this class only for inherits your own forvatter
|
||||
*
|
||||
* ToDo add [additonal formatters][1]
|
||||
*
|
||||
* [1]:http://docs.python.org/dev/library/argparse.html#formatter-class
|
||||
**/
|
||||
'use strict';
|
||||
|
||||
var _ = require('underscore');
|
||||
_.str = require('underscore.string');
|
||||
|
||||
// Constants
|
||||
var $$ = require('../const');
|
||||
|
||||
|
||||
/*:nodoc:* internal
|
||||
* new Support(parent, heding)
|
||||
* - parent (object): parent section
|
||||
* - heading (string): header string
|
||||
*
|
||||
**/
|
||||
function Section(parent, heading) {
|
||||
this._parent = parent;
|
||||
this._heading = heading;
|
||||
this._items = [];
|
||||
}
|
||||
|
||||
/*:nodoc:* internal
|
||||
* Section#addItem(callback) -> Void
|
||||
* - callback (array): tuple with function and args
|
||||
*
|
||||
* Add function for single element
|
||||
**/
|
||||
Section.prototype.addItem = function (callback) {
|
||||
this._items.push(callback);
|
||||
};
|
||||
|
||||
/*:nodoc:* internal
|
||||
* Section#formatHelp(formatter) -> string
|
||||
* - formatter (HelpFormatter): current formatter
|
||||
*
|
||||
* Form help section string
|
||||
*
|
||||
**/
|
||||
Section.prototype.formatHelp = function (formatter) {
|
||||
var itemHelp, heading;
|
||||
|
||||
// format the indented section
|
||||
if (!!this._parent) {
|
||||
formatter._indent();
|
||||
}
|
||||
|
||||
itemHelp = this._items.map(function (item) {
|
||||
var obj, func, args;
|
||||
|
||||
obj = formatter;
|
||||
func = item[0];
|
||||
args = item[1];
|
||||
return func.apply(obj, args);
|
||||
});
|
||||
itemHelp = formatter._joinParts(itemHelp);
|
||||
|
||||
if (!!this._parent) {
|
||||
formatter._dedent();
|
||||
}
|
||||
|
||||
// return nothing if the section was empty
|
||||
if (!itemHelp) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// add the heading if the section was non-empty
|
||||
heading = '';
|
||||
if (!!this._heading && this._heading !== $$.SUPPRESS) {
|
||||
var currentIndent = formatter.currentIndent;
|
||||
heading = _.str.repeat(' ', currentIndent) + this._heading + ':' + $$.EOL;
|
||||
}
|
||||
|
||||
// join the section-initialize newline, the heading and the help
|
||||
return formatter._joinParts([$$.EOL, heading, itemHelp, $$.EOL]);
|
||||
};
|
||||
|
||||
/**
|
||||
* new HelpFormatter(options)
|
||||
*
|
||||
* #### Options:
|
||||
* - `prog`: program name
|
||||
* - `indentIncriment`: indent step, default value 2
|
||||
* - `maxHelpPosition`: max help position, default value = 24
|
||||
* - `width`: line width
|
||||
*
|
||||
**/
|
||||
var HelpFormatter = module.exports = function HelpFormatter(options) {
|
||||
options = options || {};
|
||||
|
||||
this._prog = options.prog;
|
||||
|
||||
this._maxHelpPosition = options.maxHelpPosition || 24;
|
||||
this._width = (options.width || ((process.env.COLUMNS || 80) - 2));
|
||||
|
||||
this._currentIndent = 0;
|
||||
this._indentIncriment = options.indentIncriment || 2;
|
||||
this._level = 0;
|
||||
this._actionMaxLength = 0;
|
||||
|
||||
this._rootSection = new Section(null);
|
||||
this._currentSection = this._rootSection;
|
||||
|
||||
this._whitespaceMatcher = new RegExp('\\s+', 'g');
|
||||
this._longBreakMatcher = new RegExp($$.EOL + $$.EOL + $$.EOL + '+', 'g');
|
||||
};
|
||||
|
||||
HelpFormatter.prototype._indent = function () {
|
||||
this._currentIndent += this._indentIncriment;
|
||||
this._level += 1;
|
||||
};
|
||||
|
||||
HelpFormatter.prototype._dedent = function () {
|
||||
this._currentIndent -= this._indentIncriment;
|
||||
this._level -= 1;
|
||||
if (this._currentIndent < 0) {
|
||||
throw new Error('Indent decreased below 0.');
|
||||
}
|
||||
};
|
||||
|
||||
HelpFormatter.prototype._addItem = function (func, args) {
|
||||
this._currentSection.addItem([func, args]);
|
||||
};
|
||||
|
||||
//
|
||||
// Message building methods
|
||||
//
|
||||
|
||||
/**
|
||||
* HelpFormatter#startSection(heading) -> Void
|
||||
* - heading (string): header string
|
||||
*
|
||||
* Start new help section
|
||||
*
|
||||
* See alse [code example][1]
|
||||
*
|
||||
* ##### Example
|
||||
*
|
||||
* formatter.startSection(actionGroup.title);
|
||||
* formatter.addText(actionGroup.description);
|
||||
* formatter.addArguments(actionGroup._groupActions);
|
||||
* formatter.endSection();
|
||||
*
|
||||
**/
|
||||
HelpFormatter.prototype.startSection = function (heading) {
|
||||
this._indent();
|
||||
var section = new Section(this._currentSection, heading);
|
||||
var func = section.formatHelp.bind(section);
|
||||
this._addItem(func, [this]);
|
||||
this._currentSection = section;
|
||||
};
|
||||
|
||||
/**
|
||||
* HelpFormatter#endSection -> Void
|
||||
*
|
||||
* End help section
|
||||
*
|
||||
* ##### Example
|
||||
*
|
||||
* formatter.startSection(actionGroup.title);
|
||||
* formatter.addText(actionGroup.description);
|
||||
* formatter.addArguments(actionGroup._groupActions);
|
||||
* formatter.endSection();
|
||||
**/
|
||||
HelpFormatter.prototype.endSection = function () {
|
||||
this._currentSection = this._currentSection._parent;
|
||||
this._dedent();
|
||||
};
|
||||
|
||||
/**
|
||||
* HelpFormatter#addText(text) -> Void
|
||||
* - text (string): plain text
|
||||
*
|
||||
* Add plain text into current section
|
||||
*
|
||||
* ##### Example
|
||||
*
|
||||
* formatter.startSection(actionGroup.title);
|
||||
* formatter.addText(actionGroup.description);
|
||||
* formatter.addArguments(actionGroup._groupActions);
|
||||
* formatter.endSection();
|
||||
*
|
||||
**/
|
||||
HelpFormatter.prototype.addText = function (text) {
|
||||
if (!!text && text !== $$.SUPPRESS) {
|
||||
this._addItem(this._formatText, [text]);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* HelpFormatter#addUsage(usage, actions, groups, prefix) -> Void
|
||||
* - usage (string): usage text
|
||||
* - actions (array): actions list
|
||||
* - groups (array): groups list
|
||||
* - prefix (string): usage prefix
|
||||
*
|
||||
* Add usage data into current section
|
||||
*
|
||||
* ##### Example
|
||||
*
|
||||
* formatter.addUsage(this.usage, this._actions, []);
|
||||
* return formatter.formatHelp();
|
||||
*
|
||||
**/
|
||||
HelpFormatter.prototype.addUsage = function (usage, actions, groups, prefix) {
|
||||
if (usage !== $$.SUPPRESS) {
|
||||
this._addItem(this._formatUsage, [usage, actions, groups, prefix]);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* HelpFormatter#addArgument(action) -> Void
|
||||
* - action (object): action
|
||||
*
|
||||
* Add argument into current section
|
||||
*
|
||||
* Single variant of [[HelpFormatter#addArguments]]
|
||||
**/
|
||||
HelpFormatter.prototype.addArgument = function (action) {
|
||||
if (action.help !== $$.SUPPRESS) {
|
||||
var self = this;
|
||||
|
||||
// find all invocations
|
||||
var invocations = [this._formatActionInvocation(action)];
|
||||
var invocationLength = invocations[0].length;
|
||||
|
||||
var actionLength;
|
||||
|
||||
if (!!action._getSubactions) {
|
||||
this._indent();
|
||||
action._getSubactions().forEach(function (subaction) {
|
||||
|
||||
var invocationNew = self._formatActionInvocation(subaction);
|
||||
invocations.push(invocationNew);
|
||||
invocationLength = Math.max(invocationLength, invocationNew.length);
|
||||
|
||||
});
|
||||
this._dedent();
|
||||
}
|
||||
|
||||
// update the maximum item length
|
||||
actionLength = invocationLength + this._currentIndent;
|
||||
this._actionMaxLength = Math.max(this._actionMaxLength, actionLength);
|
||||
|
||||
// add the item to the list
|
||||
this._addItem(this._formatAction, [action]);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* HelpFormatter#addArguments(actions) -> Void
|
||||
* - actions (array): actions list
|
||||
*
|
||||
* Mass add arguments into current section
|
||||
*
|
||||
* ##### Example
|
||||
*
|
||||
* formatter.startSection(actionGroup.title);
|
||||
* formatter.addText(actionGroup.description);
|
||||
* formatter.addArguments(actionGroup._groupActions);
|
||||
* formatter.endSection();
|
||||
*
|
||||
**/
|
||||
HelpFormatter.prototype.addArguments = function (actions) {
|
||||
var self = this;
|
||||
actions.forEach(function (action) {
|
||||
self.addArgument(action);
|
||||
});
|
||||
};
|
||||
|
||||
//
|
||||
// Help-formatting methods
|
||||
//
|
||||
|
||||
/**
|
||||
* HelpFormatter#formatHelp -> string
|
||||
*
|
||||
* Format help
|
||||
*
|
||||
* ##### Example
|
||||
*
|
||||
* formatter.addText(this.epilog);
|
||||
* return formatter.formatHelp();
|
||||
*
|
||||
**/
|
||||
HelpFormatter.prototype.formatHelp = function () {
|
||||
var help = this._rootSection.formatHelp(this);
|
||||
if (help) {
|
||||
help = help.replace(this._longBreakMatcher, $$.EOL + $$.EOL);
|
||||
help = _.str.strip(help, $$.EOL) + $$.EOL;
|
||||
}
|
||||
return help;
|
||||
};
|
||||
|
||||
HelpFormatter.prototype._joinParts = function (partStrings) {
|
||||
return partStrings.filter(function (part) {
|
||||
return (!!part && part !== $$.SUPPRESS);
|
||||
}).join('');
|
||||
};
|
||||
|
||||
HelpFormatter.prototype._formatUsage = function (usage, actions, groups, prefix) {
|
||||
if (!prefix && !_.isString(prefix)) {
|
||||
prefix = 'usage: ';
|
||||
}
|
||||
|
||||
actions = actions || [];
|
||||
groups = groups || [];
|
||||
|
||||
|
||||
// if usage is specified, use that
|
||||
if (usage) {
|
||||
usage = _.str.sprintf(usage, {prog: this._prog});
|
||||
|
||||
// if no optionals or positionals are available, usage is just prog
|
||||
} else if (!usage && actions.length === 0) {
|
||||
usage = this._prog;
|
||||
|
||||
// if optionals and positionals are available, calculate usage
|
||||
} else if (!usage) {
|
||||
var prog = this._prog;
|
||||
var optionals = [];
|
||||
var positionals = [];
|
||||
var actionUsage;
|
||||
var textWidth;
|
||||
|
||||
// split optionals from positionals
|
||||
actions.forEach(function (action) {
|
||||
if (action.isOptional()) {
|
||||
optionals.push(action);
|
||||
} else {
|
||||
positionals.push(action);
|
||||
}
|
||||
});
|
||||
|
||||
// build full usage string
|
||||
actionUsage = this._formatActionsUsage([].concat(optionals, positionals), groups);
|
||||
usage = [prog, actionUsage].join(' ');
|
||||
|
||||
// wrap the usage parts if it's too long
|
||||
textWidth = this._width - this._currentIndent;
|
||||
if ((prefix.length + usage.length) > textWidth) {
|
||||
|
||||
// break usage into wrappable parts
|
||||
var regexpPart = new RegExp('\\(.*?\\)+|\\[.*?\\]+|\\S+', 'g');
|
||||
var optionalUsage = this._formatActionsUsage(optionals, groups);
|
||||
var positionalUsage = this._formatActionsUsage(positionals, groups);
|
||||
|
||||
|
||||
var optionalParts = optionalUsage.match(regexpPart);
|
||||
var positionalParts = positionalUsage.match(regexpPart) || [];
|
||||
|
||||
if (optionalParts.join(' ') !== optionalUsage) {
|
||||
throw new Error('assert "optionalParts.join(\' \') === optionalUsage"');
|
||||
}
|
||||
if (positionalParts.join(' ') !== positionalUsage) {
|
||||
throw new Error('assert "positionalParts.join(\' \') === positionalUsage"');
|
||||
}
|
||||
|
||||
// helper for wrapping lines
|
||||
var _getLines = function (parts, indent, prefix) {
|
||||
var lines = [];
|
||||
var line = [];
|
||||
|
||||
var lineLength = !!prefix ? prefix.length - 1: indent.length - 1;
|
||||
|
||||
parts.forEach(function (part) {
|
||||
if (lineLength + 1 + part.length > textWidth) {
|
||||
lines.push(indent + line.join(' '));
|
||||
line = [];
|
||||
lineLength = indent.length - 1;
|
||||
}
|
||||
line.push(part);
|
||||
lineLength += part.length + 1;
|
||||
});
|
||||
|
||||
if (line) {
|
||||
lines.push(indent + line.join(' '));
|
||||
}
|
||||
if (prefix) {
|
||||
lines[0] = lines[0].substr(indent.length);
|
||||
}
|
||||
return lines;
|
||||
};
|
||||
|
||||
var lines, indent, parts;
|
||||
// if prog is short, follow it with optionals or positionals
|
||||
if (prefix.length + prog.length <= 0.75 * textWidth) {
|
||||
indent = _.str.repeat(' ', (prefix.length + prog.length + 1));
|
||||
if (optionalParts) {
|
||||
lines = [].concat(
|
||||
_getLines([prog].concat(optionalParts), indent, prefix),
|
||||
_getLines(positionalParts, indent)
|
||||
);
|
||||
} else if (positionalParts) {
|
||||
lines = _getLines([prog].concat(positionalParts), indent, prefix);
|
||||
} else {
|
||||
lines = [prog];
|
||||
}
|
||||
|
||||
// if prog is long, put it on its own line
|
||||
} else {
|
||||
indent = _.str.repeat(' ', prefix.length);
|
||||
parts = optionalParts + positionalParts;
|
||||
lines = _getLines(parts, indent);
|
||||
if (lines.length > 1) {
|
||||
lines = [].concat(
|
||||
_getLines(optionalParts, indent),
|
||||
_getLines(positionalParts, indent)
|
||||
);
|
||||
}
|
||||
lines = [prog] + lines;
|
||||
}
|
||||
// join lines into usage
|
||||
usage = lines.join($$.EOL);
|
||||
}
|
||||
}
|
||||
|
||||
// prefix with 'usage:'
|
||||
return prefix + usage + $$.EOL + $$.EOL;
|
||||
};
|
||||
|
||||
HelpFormatter.prototype._formatActionsUsage = function (actions, groups) {
|
||||
// find group indices and identify actions in groups
|
||||
var groupActions = [];
|
||||
var inserts = [];
|
||||
var self = this;
|
||||
|
||||
groups.forEach(function (group) {
|
||||
var end;
|
||||
var i;
|
||||
|
||||
var start = actions.indexOf(group._groupActions[0]);
|
||||
if (start >= 0) {
|
||||
end = start + group._groupActions.length;
|
||||
|
||||
//if (actions.slice(start, end) === group._groupActions) {
|
||||
if (_.isEqual(actions.slice(start, end), group._groupActions)) {
|
||||
group._groupActions.forEach(function (action) {
|
||||
groupActions.push(action);
|
||||
});
|
||||
|
||||
if (!group.required) {
|
||||
if (!!inserts[start]) {
|
||||
inserts[start] += ' [';
|
||||
}
|
||||
else {
|
||||
inserts[start] = '[';
|
||||
}
|
||||
inserts[end] = ']';
|
||||
} else {
|
||||
if (!!inserts[start]) {
|
||||
inserts[start] += ' (';
|
||||
}
|
||||
else {
|
||||
inserts[start] = '(';
|
||||
}
|
||||
inserts[end] = ')';
|
||||
}
|
||||
for (i = start + 1; i < end; i += 1) {
|
||||
inserts[i] = '|';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// collect all actions format strings
|
||||
var parts = [];
|
||||
|
||||
actions.forEach(function (action, actionIndex) {
|
||||
var part;
|
||||
var optionString;
|
||||
var argsDefault;
|
||||
var argsString;
|
||||
|
||||
// suppressed arguments are marked with None
|
||||
// remove | separators for suppressed arguments
|
||||
if (action.help === $$.SUPPRESS) {
|
||||
parts.push(null);
|
||||
if (inserts[actionIndex] === '|') {
|
||||
inserts.splice(actionIndex, actionIndex);
|
||||
} else if (inserts[actionIndex + 1] === '|') {
|
||||
inserts.splice(actionIndex + 1, actionIndex + 1);
|
||||
}
|
||||
|
||||
// produce all arg strings
|
||||
} else if (!action.isOptional()) {
|
||||
part = self._formatArgs(action, action.dest);
|
||||
|
||||
// if it's in a group, strip the outer []
|
||||
if (groupActions.indexOf(action) >= 0) {
|
||||
if (part[0] === '[' && part[part.length - 1] === ']') {
|
||||
part = part.slice(1, -1);
|
||||
}
|
||||
}
|
||||
// add the action string to the list
|
||||
parts.push(part);
|
||||
|
||||
// produce the first way to invoke the option in brackets
|
||||
} else {
|
||||
optionString = action.optionStrings[0];
|
||||
|
||||
// if the Optional doesn't take a value, format is: -s or --long
|
||||
if (action.nargs === 0) {
|
||||
part = '' + optionString;
|
||||
|
||||
// if the Optional takes a value, format is: -s ARGS or --long ARGS
|
||||
} else {
|
||||
argsDefault = action.dest.toUpperCase();
|
||||
argsString = self._formatArgs(action, argsDefault);
|
||||
part = optionString + ' ' + argsString;
|
||||
}
|
||||
// make it look optional if it's not required or in a group
|
||||
if (!action.required && groupActions.indexOf(action) < 0) {
|
||||
part = '[' + part + ']';
|
||||
}
|
||||
// add the action string to the list
|
||||
parts.push(part);
|
||||
}
|
||||
});
|
||||
|
||||
// insert things at the necessary indices
|
||||
for (var i = inserts.length - 1; i >= 0; --i) {
|
||||
if (inserts[i] !== null) {
|
||||
parts.splice(i, 0, inserts[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// join all the action items with spaces
|
||||
var text = parts.filter(function (part) {
|
||||
return !!part;
|
||||
}).join(' ');
|
||||
|
||||
// clean up separators for mutually exclusive groups
|
||||
text = text.replace(/([\[(]) /g, '$1'); // remove spaces
|
||||
text = text.replace(/ ([\])])/g, '$1');
|
||||
text = text.replace(/\[ *\]/g, ''); // remove empty groups
|
||||
text = text.replace(/\( *\)/g, '');
|
||||
text = text.replace(/\(([^|]*)\)/g, '$1'); // remove () from single action groups
|
||||
|
||||
text = _.str.strip(text);
|
||||
|
||||
// return the text
|
||||
return text;
|
||||
};
|
||||
|
||||
HelpFormatter.prototype._formatText = function (text) {
|
||||
text = _.str.sprintf(text, {prog: this._prog});
|
||||
var textWidth = this._width - this._currentIndent;
|
||||
var indentIncriment = _.str.repeat(' ', this._currentIndent);
|
||||
return this._fillText(text, textWidth, indentIncriment) + $$.EOL + $$.EOL;
|
||||
};
|
||||
|
||||
HelpFormatter.prototype._formatAction = function (action) {
|
||||
var self = this;
|
||||
|
||||
var helpText;
|
||||
var helpLines;
|
||||
var parts;
|
||||
var indentFirst;
|
||||
|
||||
// determine the required width and the entry label
|
||||
var helpPosition = Math.min(this._actionMaxLength + 2, this._maxHelpPosition);
|
||||
var helpWidth = this._width - helpPosition;
|
||||
var actionWidth = helpPosition - this._currentIndent - 2;
|
||||
var actionHeader = this._formatActionInvocation(action);
|
||||
|
||||
// no help; start on same line and add a final newline
|
||||
if (!action.help) {
|
||||
actionHeader = _.str.repeat(' ', this._currentIndent) + actionHeader + $$.EOL;
|
||||
|
||||
// short action name; start on the same line and pad two spaces
|
||||
} else if (actionHeader.length <= actionWidth) {
|
||||
actionHeader = _.str.repeat(' ', this._currentIndent) +
|
||||
actionHeader +
|
||||
' ' +
|
||||
_.str.repeat(' ', actionWidth - actionHeader.length);
|
||||
indentFirst = 0;
|
||||
|
||||
// long action name; start on the next line
|
||||
} else {
|
||||
actionHeader = _.str.repeat(' ', this._currentIndent) + actionHeader + $$.EOL;
|
||||
indentFirst = helpPosition;
|
||||
}
|
||||
|
||||
// collect the pieces of the action help
|
||||
parts = [actionHeader];
|
||||
|
||||
// if there was help for the action, add lines of help text
|
||||
if (!!action.help) {
|
||||
helpText = this._expandHelp(action);
|
||||
helpLines = this._splitLines(helpText, helpWidth);
|
||||
parts.push(_.str.repeat(' ', indentFirst) + helpLines[0] + $$.EOL);
|
||||
helpLines.slice(1).forEach(function (line) {
|
||||
parts.push(_.str.repeat(' ', helpPosition) + line + $$.EOL);
|
||||
});
|
||||
|
||||
// or add a newline if the description doesn't end with one
|
||||
} else if (actionHeader.charAt(actionHeader.length - 1) !== $$.EOL) {
|
||||
parts.push($$.EOL);
|
||||
}
|
||||
// if there are any sub-actions, add their help as well
|
||||
if (!!action._getSubactions) {
|
||||
this._indent();
|
||||
action._getSubactions().forEach(function (subaction) {
|
||||
parts.push(self._formatAction(subaction));
|
||||
});
|
||||
this._dedent();
|
||||
}
|
||||
// return a single string
|
||||
return this._joinParts(parts);
|
||||
};
|
||||
|
||||
HelpFormatter.prototype._formatActionInvocation = function (action) {
|
||||
if (!action.isOptional()) {
|
||||
var format_func = this._metavarFormatter(action, action.dest);
|
||||
var metavars = format_func(1);
|
||||
return metavars[0];
|
||||
} else {
|
||||
var parts = [];
|
||||
var argsDefault;
|
||||
var argsString;
|
||||
|
||||
// if the Optional doesn't take a value, format is: -s, --long
|
||||
if (action.nargs === 0) {
|
||||
parts = parts.concat(action.optionStrings);
|
||||
|
||||
// if the Optional takes a value, format is: -s ARGS, --long ARGS
|
||||
} else {
|
||||
argsDefault = action.dest.toUpperCase();
|
||||
argsString = this._formatArgs(action, argsDefault);
|
||||
action.optionStrings.forEach(function (optionString) {
|
||||
parts.push(optionString + ' ' + argsString);
|
||||
});
|
||||
}
|
||||
return parts.join(', ');
|
||||
}
|
||||
};
|
||||
|
||||
HelpFormatter.prototype._metavarFormatter = function (action, metavarDefault) {
|
||||
var result;
|
||||
|
||||
if (!!action.metavar || action.metavar === '') {
|
||||
result = action.metavar;
|
||||
} else if (!!action.choices) {
|
||||
var choices = action.choices;
|
||||
|
||||
if (_.isString(choices)) {
|
||||
choices = choices.split('').join(', ');
|
||||
} else if (_.isArray(choices)) {
|
||||
choices = choices.join(',');
|
||||
}
|
||||
else
|
||||
{
|
||||
choices = _.keys(choices).join(',');
|
||||
}
|
||||
result = '{' + choices + '}';
|
||||
} else {
|
||||
result = metavarDefault;
|
||||
}
|
||||
|
||||
return function (size) {
|
||||
if (Array.isArray(result)) {
|
||||
return result;
|
||||
} else {
|
||||
var metavars = [];
|
||||
for (var i = 0; i < size; i += 1) {
|
||||
metavars.push(result);
|
||||
}
|
||||
return metavars;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
HelpFormatter.prototype._formatArgs = function (action, metavarDefault) {
|
||||
var result;
|
||||
var metavars;
|
||||
|
||||
var buildMetavar = this._metavarFormatter(action, metavarDefault);
|
||||
|
||||
switch (action.nargs) {
|
||||
case undefined:
|
||||
case null:
|
||||
metavars = buildMetavar(1);
|
||||
result = '' + metavars[0];
|
||||
break;
|
||||
case $$.OPTIONAL:
|
||||
metavars = buildMetavar(1);
|
||||
result = '[' + metavars[0] + ']';
|
||||
break;
|
||||
case $$.ZERO_OR_MORE:
|
||||
metavars = buildMetavar(2);
|
||||
result = '[' + metavars[0] + ' [' + metavars[1] + ' ...]]';
|
||||
break;
|
||||
case $$.ONE_OR_MORE:
|
||||
metavars = buildMetavar(2);
|
||||
result = '' + metavars[0] + ' [' + metavars[1] + ' ...]';
|
||||
break;
|
||||
case $$.REMAINDER:
|
||||
result = '...';
|
||||
break;
|
||||
case $$.PARSER:
|
||||
metavars = buildMetavar(1);
|
||||
result = metavars[0] + ' ...';
|
||||
break;
|
||||
default:
|
||||
metavars = buildMetavar(action.nargs);
|
||||
result = metavars.join(' ');
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
HelpFormatter.prototype._expandHelp = function (action) {
|
||||
var params = { prog: this._prog };
|
||||
|
||||
Object.keys(action).forEach(function (actionProperty) {
|
||||
var actionValue = action[actionProperty];
|
||||
|
||||
if (actionValue !== $$.SUPPRESS) {
|
||||
params[actionProperty] = actionValue;
|
||||
}
|
||||
});
|
||||
|
||||
if (!!params.choices) {
|
||||
if (_.isString(params.choices)) {
|
||||
params.choices = params.choices.split('').join(', ');
|
||||
}
|
||||
else if (_.isArray(params.choices)) {
|
||||
params.choices = params.choices.join(', ');
|
||||
}
|
||||
else {
|
||||
params.choices = _.keys(params.choices).join(', ');
|
||||
}
|
||||
}
|
||||
|
||||
return _.str.sprintf(this._getHelpString(action), params);
|
||||
};
|
||||
|
||||
HelpFormatter.prototype._splitLines = function (text, width) {
|
||||
var lines = [];
|
||||
var delimiters = [" ", ".", ",", "!", "?"];
|
||||
var re = new RegExp('[' + delimiters.join('') + '][^' + delimiters.join('') + ']*$');
|
||||
|
||||
text = text.replace(/[\n\|\t]/g, ' ');
|
||||
|
||||
text = _.str.strip(text);
|
||||
text = text.replace(this._whitespaceMatcher, ' ');
|
||||
|
||||
// Wraps the single paragraph in text (a string) so every line
|
||||
// is at most width characters long.
|
||||
text.split($$.EOL).forEach(function (line) {
|
||||
if (width >= line.length) {
|
||||
lines.push(line);
|
||||
return;
|
||||
}
|
||||
|
||||
var wrapStart = 0;
|
||||
var wrapEnd = width;
|
||||
var delimiterIndex = 0;
|
||||
while (wrapEnd <= line.length) {
|
||||
if (wrapEnd !== line.length && delimiters.indexOf(line[wrapEnd] < -1)) {
|
||||
delimiterIndex = (re.exec(line.substring(wrapStart, wrapEnd)) || {}).index;
|
||||
wrapEnd = wrapStart + delimiterIndex + 1;
|
||||
}
|
||||
lines.push(line.substring(wrapStart, wrapEnd));
|
||||
wrapStart = wrapEnd;
|
||||
wrapEnd += width;
|
||||
}
|
||||
if (wrapStart < line.length) {
|
||||
lines.push(line.substring(wrapStart, wrapEnd));
|
||||
}
|
||||
});
|
||||
|
||||
return lines;
|
||||
};
|
||||
|
||||
HelpFormatter.prototype._fillText = function (text, width, indent) {
|
||||
var lines = this._splitLines(text, width);
|
||||
lines = lines.map(function (line) {
|
||||
return indent + line;
|
||||
});
|
||||
return lines.join($$.EOL);
|
||||
};
|
||||
|
||||
HelpFormatter.prototype._getHelpString = function (action) {
|
||||
return action.help;
|
||||
};
|
77
node_modules/argparse/lib/namespace.js
generated
vendored
Normal file
77
node_modules/argparse/lib/namespace.js
generated
vendored
Normal file
|
@ -0,0 +1,77 @@
|
|||
/**
|
||||
* class Namespace
|
||||
*
|
||||
* Simple object for storing attributes. Implements equality by attribute names
|
||||
* and values, and provides a simple string representation.
|
||||
*
|
||||
* See also [original guide][1]
|
||||
*
|
||||
* [1]:http://docs.python.org/dev/library/argparse.html#the-namespace-object
|
||||
**/
|
||||
'use strict';
|
||||
|
||||
var _ = require('underscore');
|
||||
|
||||
/**
|
||||
* new Namespace(options)
|
||||
* - options(object): predefined propertis for result object
|
||||
*
|
||||
**/
|
||||
var Namespace = module.exports = function Namespace(options) {
|
||||
_.extend(this, options);
|
||||
};
|
||||
|
||||
/**
|
||||
* Namespace#isset(key) -> Boolean
|
||||
* - key (string|number): property name
|
||||
*
|
||||
* Tells whenever `namespace` contains given `key` or not.
|
||||
**/
|
||||
Namespace.prototype.isset = function (key) {
|
||||
return _.has(this, key);
|
||||
};
|
||||
|
||||
/**
|
||||
* Namespace#set(key, value) -> self
|
||||
* -key (string|number|object): propery name
|
||||
* -value (mixed): new property value
|
||||
*
|
||||
* Set the property named key with value.
|
||||
* If key object then set all key properties to namespace object
|
||||
**/
|
||||
Namespace.prototype.set = function (key, value) {
|
||||
if (typeof (key) === 'object') {
|
||||
_.extend(this, key);
|
||||
} else {
|
||||
this[key] = value;
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Namespace#get(key, defaultValue) -> mixed
|
||||
* - key (string|number): property name
|
||||
* - defaultValue (mixed): default value
|
||||
*
|
||||
* Return the property key or defaulValue if not set
|
||||
**/
|
||||
Namespace.prototype.get = function (key, defaultValue) {
|
||||
return !this[key] ? defaultValue: this[key];
|
||||
};
|
||||
|
||||
/**
|
||||
* Namespace#unset(key, defaultValue) -> mixed
|
||||
* - key (string|number): property name
|
||||
* - defaultValue (mixed): default value
|
||||
*
|
||||
* Return data[key](and delete it) or defaultValue
|
||||
**/
|
||||
Namespace.prototype.unset = function (key, defaultValue) {
|
||||
var value = this[key];
|
||||
if (value !== null) {
|
||||
delete this[key];
|
||||
return value;
|
||||
} else {
|
||||
return defaultValue;
|
||||
}
|
||||
};
|
2
node_modules/argparse/node_modules/underscore.string/.npmignore
generated
vendored
Normal file
2
node_modules/argparse/node_modules/underscore.string/.npmignore
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
test
|
||||
dist
|
8
node_modules/argparse/node_modules/underscore.string/.travis.yml
generated
vendored
Normal file
8
node_modules/argparse/node_modules/underscore.string/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- "0.11"
|
||||
|
||||
before_script:
|
||||
- "export DISPLAY=:99.0"
|
||||
- "sh -e /etc/init.d/xvfb start"
|
||||
- sleep 2
|
825
node_modules/argparse/node_modules/underscore.string/README.markdown
generated
vendored
Normal file
825
node_modules/argparse/node_modules/underscore.string/README.markdown
generated
vendored
Normal file
|
@ -0,0 +1,825 @@
|
|||
# Underscore.string [](http://travis-ci.org/epeli/underscore.string) #
|
||||
|
||||
|
||||
|
||||
Javascript lacks complete string manipulation operations.
|
||||
This an attempt to fill that gap. List of build-in methods can be found
|
||||
for example from [Dive Into JavaScript][d].
|
||||
|
||||
[d]: http://www.diveintojavascript.com/core-javascript-reference/the-string-object
|
||||
|
||||
|
||||
As name states this an extension for [Underscore.js][u] (and [Lo-Dash](http://lodash.com/)), but it can be used
|
||||
independently from **_s**-global variable. But with Underscore.js you can
|
||||
use Object-Oriented style and chaining:
|
||||
|
||||
[u]: http://underscorejs.org/
|
||||
|
||||
```javascript
|
||||
_(" epeli ").chain().trim().capitalize().value()
|
||||
=> "Epeli"
|
||||
```
|
||||
|
||||
## Download ##
|
||||
|
||||
* [Development version](https://raw.github.com/epeli/underscore.string/master/lib/underscore.string.js) *Uncompressed with Comments 18kb*
|
||||
* [Production version](https://github.com/epeli/underscore.string/raw/master/dist/underscore.string.min.js) *Minified 7kb*
|
||||
|
||||
|
||||
## Node.js installation ##
|
||||
|
||||
**npm package**
|
||||
|
||||
npm install underscore.string
|
||||
|
||||
**Standalone usage**:
|
||||
|
||||
```javascript
|
||||
var _s = require('underscore.string');
|
||||
```
|
||||
|
||||
**Integrate with Underscore.js**:
|
||||
|
||||
```javascript
|
||||
var _ = require('underscore');
|
||||
|
||||
// Import Underscore.string to separate object, because there are conflict functions (include, reverse, contains)
|
||||
_.str = require('underscore.string');
|
||||
|
||||
// Mix in non-conflict functions to Underscore namespace if you want
|
||||
_.mixin(_.str.exports());
|
||||
|
||||
// All functions, include conflict, will be available through _.str object
|
||||
_.str.include('Underscore.string', 'string'); // => true
|
||||
```
|
||||
|
||||
**Or Integrate with Underscore.js without module loading**
|
||||
|
||||
Run the following expression after Underscore.js and Underscore.string are loaded
|
||||
```javascript
|
||||
// _.str becomes a global variable if no module loading is detected
|
||||
// Mix in non-conflict functions to Underscore namespace
|
||||
_.mixin(_.str.exports());
|
||||
```
|
||||
|
||||
## String Functions ##
|
||||
|
||||
For availability of functions in this way you need to mix in Underscore.string functions:
|
||||
|
||||
```javascript
|
||||
_.mixin(_.string.exports());
|
||||
```
|
||||
|
||||
otherwise functions from examples will be available through _.string or _.str objects:
|
||||
|
||||
```javascript
|
||||
_.str.capitalize('epeli')
|
||||
=> "Epeli"
|
||||
```
|
||||
|
||||
**numberFormat** _.numberFormat(number, [ decimals=0, decimalSeparator='.', orderSeparator=','])
|
||||
|
||||
Formats the numbers.
|
||||
|
||||
```javascript
|
||||
_.numberFormat(1000, 2)
|
||||
=> "1,000.00"
|
||||
|
||||
_.numberFormat(123456789.123, 5, '.', ',')
|
||||
=> "123,456,789.12300"
|
||||
```
|
||||
|
||||
|
||||
**levenshtein** _.levenshtein(string1, string2)
|
||||
|
||||
Calculates [Levenshtein distance][ld] between two strings.
|
||||
[ld]: http://en.wikipedia.org/wiki/Levenshtein_distance
|
||||
|
||||
```javascript
|
||||
_.levenshtein('kitten', 'kittah')
|
||||
=> 2
|
||||
```
|
||||
|
||||
**capitalize** _.capitalize(string)
|
||||
|
||||
Converts first letter of the string to uppercase.
|
||||
|
||||
```javascript
|
||||
_.capitalize("foo Bar")
|
||||
=> "Foo Bar"
|
||||
```
|
||||
|
||||
**chop** _.chop(string, step)
|
||||
|
||||
```javascript
|
||||
_.chop('whitespace', 3)
|
||||
=> ['whi','tes','pac','e']
|
||||
```
|
||||
|
||||
**clean** _.clean(str)
|
||||
|
||||
Compress some whitespaces to one.
|
||||
|
||||
```javascript
|
||||
_.clean(" foo bar ")
|
||||
=> 'foo bar'
|
||||
```
|
||||
|
||||
**chars** _.chars(str)
|
||||
|
||||
```javascript
|
||||
_.chars('Hello')
|
||||
=> ['H','e','l','l','o']
|
||||
```
|
||||
|
||||
**swapCase** _.swapCase(str)
|
||||
|
||||
Returns a copy of the string in which all the case-based characters have had their case swapped.
|
||||
|
||||
```javascript
|
||||
_.swapCase('hELLO')
|
||||
=> 'Hello'
|
||||
```
|
||||
|
||||
**include** available only through _.str object, because Underscore has function with the same name.
|
||||
|
||||
```javascript
|
||||
_.str.include("foobar", "ob")
|
||||
=> true
|
||||
```
|
||||
|
||||
(removed) **includes** _.includes(string, substring)
|
||||
|
||||
Tests if string contains a substring.
|
||||
|
||||
```javascript
|
||||
_.includes("foobar", "ob")
|
||||
=> true
|
||||
```
|
||||
|
||||
**includes** function was removed
|
||||
|
||||
But you can create it in this way, for compatibility with previous versions:
|
||||
|
||||
```javascript
|
||||
_.includes = _.str.include
|
||||
```
|
||||
|
||||
**count** _.count(string, substring)
|
||||
|
||||
```javascript
|
||||
_('Hello world').count('l')
|
||||
=> 3
|
||||
```
|
||||
|
||||
**escapeHTML** _.escapeHTML(string)
|
||||
|
||||
Converts HTML special characters to their entity equivalents.
|
||||
|
||||
```javascript
|
||||
_('<div>Blah blah blah</div>').escapeHTML();
|
||||
=> '<div>Blah blah blah</div>'
|
||||
```
|
||||
|
||||
**unescapeHTML** _.unescapeHTML(string)
|
||||
|
||||
Converts entity characters to HTML equivalents.
|
||||
|
||||
```javascript
|
||||
_('<div>Blah blah blah</div>').unescapeHTML();
|
||||
=> '<div>Blah blah blah</div>'
|
||||
```
|
||||
|
||||
**insert** _.insert(string, index, substing)
|
||||
|
||||
```javascript
|
||||
_('Hello ').insert(6, 'world')
|
||||
=> 'Hello world'
|
||||
```
|
||||
|
||||
**isBlank** _.isBlank(string)
|
||||
|
||||
```javascript
|
||||
_('').isBlank(); // => true
|
||||
_('\n').isBlank(); // => true
|
||||
_(' ').isBlank(); // => true
|
||||
_('a').isBlank(); // => false
|
||||
```
|
||||
|
||||
**join** _.join(separator, *strings)
|
||||
|
||||
Joins strings together with given separator
|
||||
|
||||
```javascript
|
||||
_.join(" ", "foo", "bar")
|
||||
=> "foo bar"
|
||||
```
|
||||
|
||||
**lines** _.lines(str)
|
||||
|
||||
```javascript
|
||||
_.lines("Hello\nWorld")
|
||||
=> ["Hello", "World"]
|
||||
```
|
||||
|
||||
**reverse** available only through _.str object, because Underscore has function with the same name.
|
||||
|
||||
Return reversed string:
|
||||
|
||||
```javascript
|
||||
_.str.reverse("foobar")
|
||||
=> 'raboof'
|
||||
```
|
||||
|
||||
**splice** _.splice(string, index, howmany, substring)
|
||||
|
||||
Like a array splice.
|
||||
|
||||
```javascript
|
||||
_('https://edtsech@bitbucket.org/edtsech/underscore.strings').splice(30, 7, 'epeli')
|
||||
=> 'https://edtsech@bitbucket.org/epeli/underscore.strings'
|
||||
```
|
||||
|
||||
**startsWith** _.startsWith(string, starts)
|
||||
|
||||
This method checks whether string starts with starts.
|
||||
|
||||
```javascript
|
||||
_("image.gif").startsWith("image")
|
||||
=> true
|
||||
```
|
||||
|
||||
**endsWith** _.endsWith(string, ends)
|
||||
|
||||
This method checks whether string ends with ends.
|
||||
|
||||
```javascript
|
||||
_("image.gif").endsWith("gif")
|
||||
=> true
|
||||
```
|
||||
|
||||
**succ** _.succ(str)
|
||||
|
||||
Returns the successor to str.
|
||||
|
||||
```javascript
|
||||
_('a').succ()
|
||||
=> 'b'
|
||||
|
||||
_('A').succ()
|
||||
=> 'B'
|
||||
```
|
||||
|
||||
**supplant**
|
||||
|
||||
Supplant function was removed, use Underscore.js [template function][p].
|
||||
|
||||
[p]: http://documentcloud.github.com/underscore/#template
|
||||
|
||||
**strip** alias for *trim*
|
||||
|
||||
**lstrip** alias for *ltrim*
|
||||
|
||||
**rstrip** alias for *rtrim*
|
||||
|
||||
**titleize** _.titleize(string)
|
||||
|
||||
```javascript
|
||||
_('my name is epeli').titleize()
|
||||
=> 'My Name Is Epeli'
|
||||
```
|
||||
|
||||
**camelize** _.camelize(string)
|
||||
|
||||
Converts underscored or dasherized string to a camelized one. Begins with
|
||||
a lower case letter unless it starts with an underscore or string
|
||||
|
||||
```javascript
|
||||
_('moz-transform').camelize()
|
||||
=> 'mozTransform'
|
||||
_('-moz-transform').camelize()
|
||||
=> 'MozTransform'
|
||||
```
|
||||
|
||||
**classify** _.classify(string)
|
||||
|
||||
Converts string to camelized class name. First letter is always upper case
|
||||
|
||||
```javascript
|
||||
_('some_class_name').classify()
|
||||
=> 'SomeClassName'
|
||||
```
|
||||
|
||||
**underscored** _.underscored(string)
|
||||
|
||||
Converts a camelized or dasherized string into an underscored one
|
||||
|
||||
```javascript
|
||||
_('MozTransform').underscored()
|
||||
=> 'moz_transform'
|
||||
```
|
||||
|
||||
**dasherize** _.dasherize(string)
|
||||
|
||||
Converts a underscored or camelized string into an dasherized one
|
||||
|
||||
```javascript
|
||||
_('MozTransform').dasherize()
|
||||
=> '-moz-transform'
|
||||
```
|
||||
|
||||
**humanize** _.humanize(string)
|
||||
|
||||
Converts an underscored, camelized, or dasherized string into a humanized one.
|
||||
Also removes beginning and ending whitespace, and removes the postfix '_id'.
|
||||
|
||||
```javascript
|
||||
_(' capitalize dash-CamelCase_underscore trim ').humanize()
|
||||
=> 'Capitalize dash camel case underscore trim'
|
||||
```
|
||||
|
||||
**trim** _.trim(string, [characters])
|
||||
|
||||
trims defined characters from begining and ending of the string.
|
||||
Defaults to whitespace characters.
|
||||
|
||||
```javascript
|
||||
_.trim(" foobar ")
|
||||
=> "foobar"
|
||||
|
||||
_.trim("_-foobar-_", "_-")
|
||||
=> "foobar"
|
||||
```
|
||||
|
||||
|
||||
**ltrim** _.ltrim(string, [characters])
|
||||
|
||||
Left trim. Similar to trim, but only for left side.
|
||||
|
||||
|
||||
**rtrim** _.rtrim(string, [characters])
|
||||
|
||||
Right trim. Similar to trim, but only for right side.
|
||||
|
||||
**truncate** _.truncate(string, length, truncateString)
|
||||
|
||||
```javascript
|
||||
_('Hello world').truncate(5)
|
||||
=> 'Hello...'
|
||||
|
||||
_('Hello').truncate(10)
|
||||
=> 'Hello'
|
||||
```
|
||||
|
||||
**prune** _.prune(string, length, pruneString)
|
||||
|
||||
Elegant version of truncate.
|
||||
Makes sure the pruned string does not exceed the original length.
|
||||
Avoid half-chopped words when truncating.
|
||||
|
||||
```javascript
|
||||
_('Hello, world').prune(5)
|
||||
=> 'Hello...'
|
||||
|
||||
_('Hello, world').prune(8)
|
||||
=> 'Hello...'
|
||||
|
||||
_('Hello, world').prune(5, ' (read a lot more)')
|
||||
=> 'Hello, world' (as adding "(read a lot more)" would be longer than the original string)
|
||||
|
||||
_('Hello, cruel world').prune(15)
|
||||
=> 'Hello, cruel...'
|
||||
|
||||
_('Hello').prune(10)
|
||||
=> 'Hello'
|
||||
```
|
||||
|
||||
**words** _.words(str, delimiter=/\s+/)
|
||||
|
||||
Split string by delimiter (String or RegExp), /\s+/ by default.
|
||||
|
||||
```javascript
|
||||
_.words(" I love you ")
|
||||
=> ["I","love","you"]
|
||||
|
||||
_.words("I_love_you", "_")
|
||||
=> ["I","love","you"]
|
||||
|
||||
_.words("I-love-you", /-/)
|
||||
=> ["I","love","you"]
|
||||
|
||||
_.words(" ")
|
||||
=> []
|
||||
```
|
||||
|
||||
**sprintf** _.sprintf(string format, *arguments)
|
||||
|
||||
C like string formatting.
|
||||
Credits goes to [Alexandru Marasteanu][o].
|
||||
For more detailed documentation, see the [original page][o].
|
||||
|
||||
[o]: http://www.diveintojavascript.com/projects/javascript-sprintf
|
||||
|
||||
```javascript
|
||||
_.sprintf("%.1f", 1.17)
|
||||
"1.2"
|
||||
```
|
||||
|
||||
**pad** _.pad(str, length, [padStr, type])
|
||||
|
||||
pads the `str` with characters until the total string length is equal to the passed `length` parameter. By default, pads on the **left** with the space char (`" "`). `padStr` is truncated to a single character if necessary.
|
||||
|
||||
```javascript
|
||||
_.pad("1", 8)
|
||||
-> " 1";
|
||||
|
||||
_.pad("1", 8, '0')
|
||||
-> "00000001";
|
||||
|
||||
_.pad("1", 8, '0', 'right')
|
||||
-> "10000000";
|
||||
|
||||
_.pad("1", 8, '0', 'both')
|
||||
-> "00001000";
|
||||
|
||||
_.pad("1", 8, 'bleepblorp', 'both')
|
||||
-> "bbbb1bbb";
|
||||
```
|
||||
|
||||
**lpad** _.lpad(str, length, [padStr])
|
||||
|
||||
left-pad a string. Alias for `pad(str, length, padStr, 'left')`
|
||||
|
||||
```javascript
|
||||
_.lpad("1", 8, '0')
|
||||
-> "00000001";
|
||||
```
|
||||
|
||||
**rpad** _.rpad(str, length, [padStr])
|
||||
|
||||
right-pad a string. Alias for `pad(str, length, padStr, 'right')`
|
||||
|
||||
```javascript
|
||||
_.rpad("1", 8, '0')
|
||||
-> "10000000";
|
||||
```
|
||||
|
||||
**lrpad** _.lrpad(str, length, [padStr])
|
||||
|
||||
left/right-pad a string. Alias for `pad(str, length, padStr, 'both')`
|
||||
|
||||
```javascript
|
||||
_.lrpad("1", 8, '0')
|
||||
-> "00001000";
|
||||
```
|
||||
|
||||
**center** alias for **lrpad**
|
||||
|
||||
**ljust** alias for *rpad*
|
||||
|
||||
**rjust** alias for *lpad*
|
||||
|
||||
**toNumber** _.toNumber(string, [decimals])
|
||||
|
||||
Parse string to number. Returns NaN if string can't be parsed to number.
|
||||
|
||||
```javascript
|
||||
_('2.556').toNumber()
|
||||
=> 3
|
||||
|
||||
_('2.556').toNumber(1)
|
||||
=> 2.6
|
||||
```
|
||||
|
||||
**strRight** _.strRight(string, pattern)
|
||||
|
||||
Searches a string from left to right for a pattern and returns a substring consisting of the characters in the string that are to the right of the pattern or all string if no match found.
|
||||
|
||||
```javascript
|
||||
_('This_is_a_test_string').strRight('_')
|
||||
=> "is_a_test_string";
|
||||
```
|
||||
|
||||
**strRightBack** _.strRightBack(string, pattern)
|
||||
|
||||
Searches a string from right to left for a pattern and returns a substring consisting of the characters in the string that are to the right of the pattern or all string if no match found.
|
||||
|
||||
```javascript
|
||||
_('This_is_a_test_string').strRightBack('_')
|
||||
=> "string";
|
||||
```
|
||||
|
||||
**strLeft** _.strLeft(string, pattern)
|
||||
|
||||
Searches a string from left to right for a pattern and returns a substring consisting of the characters in the string that are to the left of the pattern or all string if no match found.
|
||||
|
||||
```javascript
|
||||
_('This_is_a_test_string').strLeft('_')
|
||||
=> "This";
|
||||
```
|
||||
|
||||
**strLeftBack** _.strLeftBack(string, pattern)
|
||||
|
||||
Searches a string from right to left for a pattern and returns a substring consisting of the characters in the string that are to the left of the pattern or all string if no match found.
|
||||
|
||||
```javascript
|
||||
_('This_is_a_test_string').strLeftBack('_')
|
||||
=> "This_is_a_test";
|
||||
```
|
||||
|
||||
**stripTags**
|
||||
|
||||
Removes all html tags from string.
|
||||
|
||||
```javascript
|
||||
_('a <a href="#">link</a>').stripTags()
|
||||
=> 'a link'
|
||||
|
||||
_('a <a href="#">link</a><script>alert("hello world!")</script>').stripTags()
|
||||
=> 'a linkalert("hello world!")'
|
||||
```
|
||||
|
||||
**toSentence** _.toSentence(array, [delimiter, lastDelimiter])
|
||||
|
||||
Join an array into a human readable sentence.
|
||||
|
||||
```javascript
|
||||
_.toSentence(['jQuery', 'Mootools', 'Prototype'])
|
||||
=> 'jQuery, Mootools and Prototype';
|
||||
|
||||
_.toSentence(['jQuery', 'Mootools', 'Prototype'], ', ', ' unt ')
|
||||
=> 'jQuery, Mootools unt Prototype';
|
||||
```
|
||||
|
||||
**toSentenceSerial** _.toSentenceSerial(array, [delimiter, lastDelimiter])
|
||||
|
||||
The same as `toSentence`, but adjusts delimeters to use [Serial comma](http://en.wikipedia.org/wiki/Serial_comma).
|
||||
|
||||
```javascript
|
||||
_.toSentenceSerial(['jQuery', 'Mootools'])
|
||||
=> 'jQuery and Mootools';
|
||||
|
||||
_.toSentenceSerial(['jQuery', 'Mootools', 'Prototype'])
|
||||
=> 'jQuery, Mootools, and Prototype'
|
||||
|
||||
_.toSentenceSerial(['jQuery', 'Mootools', 'Prototype'], ', ', ' unt ');
|
||||
=> 'jQuery, Mootools, unt Prototype';
|
||||
```
|
||||
|
||||
**repeat** _.repeat(string, count, [separator])
|
||||
|
||||
Repeats a string count times.
|
||||
|
||||
```javascript
|
||||
_.repeat("foo", 3)
|
||||
=> 'foofoofoo';
|
||||
|
||||
_.repeat("foo", 3, "bar")
|
||||
=> 'foobarfoobarfoo'
|
||||
```
|
||||
|
||||
**surround** _.surround(string, wrap)
|
||||
|
||||
Surround a string with another string.
|
||||
|
||||
```javascript
|
||||
_.surround("foo", "ab")
|
||||
=> 'abfooab';
|
||||
```
|
||||
|
||||
**quote** _.quote(string, quoteChar) or _.q(string, quoteChar)
|
||||
|
||||
Quotes a string. `quoteChar` defaults to `"`.
|
||||
|
||||
```javascript
|
||||
_.quote('foo', quoteChar)
|
||||
=> '"foo"';
|
||||
```
|
||||
**unquote** _.unquote(string, quoteChar)
|
||||
|
||||
Unquotes a string. `quoteChar` defaults to `"`.
|
||||
|
||||
```javascript
|
||||
_.unquote('"foo"')
|
||||
=> 'foo';
|
||||
_.unquote("'foo'", "'")
|
||||
=> 'foo';
|
||||
```
|
||||
|
||||
|
||||
**slugify** _.slugify(string)
|
||||
|
||||
Transform text into a URL slug. Replaces whitespaces, accentuated, and special characters with a dash.
|
||||
|
||||
```javascript
|
||||
_.slugify("Un éléphant à l'orée du bois")
|
||||
=> 'un-elephant-a-loree-du-bois';
|
||||
```
|
||||
|
||||
***Caution: this function is charset dependent***
|
||||
|
||||
**naturalCmp** array.sort(_.naturalCmp)
|
||||
|
||||
Naturally sort strings like humans would do.
|
||||
|
||||
```javascript
|
||||
['foo20', 'foo5'].sort(_.naturalCmp)
|
||||
=> [ 'foo5', 'foo20' ]
|
||||
```
|
||||
|
||||
**toBoolean** _.toBoolean(string) or _.toBool(string)
|
||||
|
||||
Turn strings that can be commonly considered as booleas to real booleans. Such as "true", "false", "1" and "0". This function is case insensitive.
|
||||
|
||||
```javascript
|
||||
_.toBoolean("true")
|
||||
=> true
|
||||
_.toBoolean("FALSE")
|
||||
=> false
|
||||
_.toBoolean("random")
|
||||
=> undefined
|
||||
```
|
||||
|
||||
It can be customized by giving arrays of truth and falsy value matcher as parameters. Matchers can be also RegExp objects.
|
||||
|
||||
```javascript
|
||||
_.toBoolean("truthy", ["truthy"], ["falsy"])
|
||||
=> true
|
||||
_.toBoolean("true only at start", [/^true/])
|
||||
=> true
|
||||
```
|
||||
|
||||
## Roadmap ##
|
||||
|
||||
Any suggestions or bug reports are welcome. Just email me or more preferably open an issue.
|
||||
|
||||
#### Problems
|
||||
|
||||
We lose two things for `include` and `reverse` methods from `_.string`:
|
||||
|
||||
* Calls like `_('foobar').include('bar')` aren't available;
|
||||
* Chaining isn't available too.
|
||||
|
||||
But if you need this functionality you can create aliases for conflict functions which will be convenient for you:
|
||||
|
||||
```javascript
|
||||
_.mixin({
|
||||
includeString: _.str.include,
|
||||
reverseString: _.str.reverse
|
||||
})
|
||||
|
||||
// Now wrapper calls and chaining are available.
|
||||
_('foobar').chain().reverseString().includeString('rab').value()
|
||||
```
|
||||
|
||||
#### Standalone Usage
|
||||
|
||||
If you are using Underscore.string without Underscore. You also have `_.string` namespace for it and `_.str` alias
|
||||
But of course you can just reassign `_` variable with `_.string`
|
||||
|
||||
```javascript
|
||||
_ = _.string
|
||||
```
|
||||
|
||||
## Changelog ##
|
||||
|
||||
### 2.4.0 ###
|
||||
|
||||
* Move from rake to gulp
|
||||
* Add support form classify camelcase strings
|
||||
* Fix bower.json
|
||||
* [Full changelog](https://github.com/epeli/underscore.string/compare/v2.3.3...2.4.0)
|
||||
|
||||
### 2.3.3 ###
|
||||
|
||||
* Add `toBoolean`
|
||||
* Add `unquote`
|
||||
* Add quote char option to `quote`
|
||||
* Support dash-separated words in `titleize`
|
||||
* [Full changelog](https://github.com/epeli/underscore.string/compare/v2.3.2...2.3.3)
|
||||
|
||||
### 2.3.2 ###
|
||||
|
||||
* Add `naturalCmp`
|
||||
* Bug fix to `camelize`
|
||||
* Add ă, ș, ț and ś to `slugify`
|
||||
* Doc updates
|
||||
* Add support for [component](http://component.io/)
|
||||
* [Full changelog](https://github.com/epeli/underscore.string/compare/v2.3.1...v2.3.2)
|
||||
|
||||
### 2.3.1 ###
|
||||
|
||||
* Bug fixes to `escapeHTML`, `classify`, `substr`
|
||||
* Faster `count`
|
||||
* Documentation fixes
|
||||
* [Full changelog](https://github.com/epeli/underscore.string/compare/v2.3.0...v2.3.1)
|
||||
|
||||
### 2.3.0 ###
|
||||
|
||||
* Added `numberformat` method
|
||||
* Added `levenshtein` method (Levenshtein distance calculation)
|
||||
* Added `swapCase` method
|
||||
* Changed default behavior of `words` method
|
||||
* Added `toSentenceSerial` method
|
||||
* Added `surround` and `quote` methods
|
||||
|
||||
### 2.2.1 ###
|
||||
|
||||
* Same as 2.2.0 (2.2.0rc on npm) to fix some npm drama
|
||||
|
||||
### 2.2.0 ###
|
||||
|
||||
* Capitalize method behavior changed
|
||||
* Various perfomance tweaks
|
||||
|
||||
### 2.1.1###
|
||||
|
||||
* Fixed words method bug
|
||||
* Added classify method
|
||||
|
||||
### 2.1.0 ###
|
||||
|
||||
* AMD support
|
||||
* Added toSentence method
|
||||
* Added slugify method
|
||||
* Lots of speed optimizations
|
||||
|
||||
### 2.0.0 ###
|
||||
|
||||
* Added prune, humanize functions
|
||||
* Added _.string (_.str) namespace for Underscore.string library
|
||||
* Removed includes function
|
||||
|
||||
For upgrading to this version you need to mix in Underscore.string library to Underscore object:
|
||||
|
||||
```javascript
|
||||
_.mixin(_.string.exports());
|
||||
```
|
||||
|
||||
and all non-conflict Underscore.string functions will be available through Underscore object.
|
||||
Also function `includes` has been removed, you should replace this function by `_.str.include`
|
||||
or create alias `_.includes = _.str.include` and all your code will work fine.
|
||||
|
||||
### 1.1.6 ###
|
||||
|
||||
* Fixed reverse and truncate
|
||||
* Added isBlank, stripTags, inlude(alias for includes)
|
||||
* Added uglifier compression
|
||||
|
||||
### 1.1.5 ###
|
||||
|
||||
* Added strRight, strRightBack, strLeft, strLeftBack
|
||||
|
||||
### 1.1.4 ###
|
||||
|
||||
* Added pad, lpad, rpad, lrpad methods and aliases center, ljust, rjust
|
||||
* Integration with Underscore 1.1.6
|
||||
|
||||
### 1.1.3 ###
|
||||
|
||||
* Added methods: underscored, camelize, dasherize
|
||||
* Support newer version of npm
|
||||
|
||||
### 1.1.2 ###
|
||||
|
||||
* Created functions: lines, chars, words functions
|
||||
|
||||
### 1.0.2 ###
|
||||
|
||||
* Created integration test suite with underscore.js 1.1.4 (now it's absolutely compatible)
|
||||
* Removed 'reverse' function, because this function override underscore.js 'reverse'
|
||||
|
||||
## Contribute ##
|
||||
|
||||
* Fork & pull request. Don't forget about tests.
|
||||
* If you planning add some feature please create issue before.
|
||||
|
||||
Otherwise changes will be rejected.
|
||||
|
||||
## Contributors list ##
|
||||
[Can be found here](https://github.com/epeli/underscore.string/graphs/contributors).
|
||||
|
||||
|
||||
## Licence ##
|
||||
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2011 Esa-Matti Suuronen esa-matti@suuronen.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
33
node_modules/argparse/node_modules/underscore.string/bower.json
generated
vendored
Normal file
33
node_modules/argparse/node_modules/underscore.string/bower.json
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"name": "underscore.string",
|
||||
"version": "2.4.0",
|
||||
"description": "String manipulation extensions for Underscore.js javascript library.",
|
||||
"homepage": "http://epeli.github.com/underscore.string/",
|
||||
"contributors": [
|
||||
"Esa-Matti Suuronen <esa-matti@suuronen.org> (http://esa-matti.suuronen.org/)",
|
||||
"Edward Tsech <edtsech@gmail.com>",
|
||||
"Pavel Pravosud <pavel@pravosud.com> (<https://github.com/rwz>)",
|
||||
"Sasha Koss <kossnocorp@gmail.com> (http://koss.nocorp.me/)",
|
||||
"Vladimir Dronnikov <dronnikov@gmail.com>",
|
||||
"Pete Kruckenberg (<https://github.com/kruckenb>)",
|
||||
"Paul Chavard <paul@chavard.net> (<http://tchak.net>)",
|
||||
"Ed Finkler <coj@funkatron.com> (<http://funkatron.com>)"
|
||||
],
|
||||
"keywords": [
|
||||
"underscore",
|
||||
"string"
|
||||
],
|
||||
"main": "./lib/underscore.string.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/epeli/underscore.string.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/epeli/underscore.string/issues"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT"
|
||||
}
|
||||
]
|
||||
}
|
11
node_modules/argparse/node_modules/underscore.string/component.json
generated
vendored
Normal file
11
node_modules/argparse/node_modules/underscore.string/component.json
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"name": "underscore.string",
|
||||
"repo": "epeli/underscore.string",
|
||||
"description": "String manipulation extensions for Underscore.js javascript library",
|
||||
"version": "2.4.0",
|
||||
"keywords": ["underscore", "string"],
|
||||
"dependencies": {},
|
||||
"development": {},
|
||||
"main": "lib/underscore.string.js",
|
||||
"scripts": ["lib/underscore.string.js"]
|
||||
}
|
10
node_modules/argparse/node_modules/underscore.string/foo.js
generated
vendored
Normal file
10
node_modules/argparse/node_modules/underscore.string/foo.js
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
|
||||
function boolMatch(s, matchers) {
|
||||
var i, matcher, down = s.toLowerCase();
|
||||
matchers = [].concat(matchers);
|
||||
for (i = 0; i < matchers.length; i += 1) {
|
||||
matcher = matchers[i];
|
||||
if (matcher.test && matcher.test(s)) return true;
|
||||
if (matcher && matcher.toLowerCase() === down) return true;
|
||||
}
|
||||
}
|
26
node_modules/argparse/node_modules/underscore.string/gulpfile.js
generated
vendored
Normal file
26
node_modules/argparse/node_modules/underscore.string/gulpfile.js
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
var gulp = require('gulp'),
|
||||
qunit = require("gulp-qunit"),
|
||||
uglify = require('gulp-uglify'),
|
||||
clean = require('gulp-clean'),
|
||||
rename = require('gulp-rename'),
|
||||
SRC = 'lib/underscore.string.js',
|
||||
DEST = 'dist',
|
||||
MIN_FILE = 'underscore.string.min.js',
|
||||
TEST_SUITES = ['test/test.html', 'test/test_underscore/index.html'];
|
||||
|
||||
gulp.task('test', function() {
|
||||
return gulp.src(TEST_SUITES)
|
||||
.pipe(qunit());
|
||||
});
|
||||
|
||||
gulp.task('clean', function() {
|
||||
return gulp.src(DEST)
|
||||
.pipe(clean());
|
||||
});
|
||||
|
||||
gulp.task('build', ['test', 'clean'], function() {
|
||||
return gulp.src(SRC)
|
||||
.pipe(uglify())
|
||||
.pipe(rename(MIN_FILE))
|
||||
.pipe(gulp.dest(DEST));
|
||||
});
|
673
node_modules/argparse/node_modules/underscore.string/lib/underscore.string.js
generated
vendored
Normal file
673
node_modules/argparse/node_modules/underscore.string/lib/underscore.string.js
generated
vendored
Normal file
|
@ -0,0 +1,673 @@
|
|||
// Underscore.string
|
||||
// (c) 2010 Esa-Matti Suuronen <esa-matti aet suuronen dot org>
|
||||
// Underscore.string is freely distributable under the terms of the MIT license.
|
||||
// Documentation: https://github.com/epeli/underscore.string
|
||||
// Some code is borrowed from MooTools and Alexandru Marasteanu.
|
||||
// Version '2.4.0'
|
||||
|
||||
!function(root, String){
|
||||
'use strict';
|
||||
|
||||
// Defining helper functions.
|
||||
|
||||
var nativeTrim = String.prototype.trim;
|
||||
var nativeTrimRight = String.prototype.trimRight;
|
||||
var nativeTrimLeft = String.prototype.trimLeft;
|
||||
|
||||
var parseNumber = function(source) { return source * 1 || 0; };
|
||||
|
||||
var strRepeat = function(str, qty){
|
||||
if (qty < 1) return '';
|
||||
var result = '';
|
||||
while (qty > 0) {
|
||||
if (qty & 1) result += str;
|
||||
qty >>= 1, str += str;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
var slice = [].slice;
|
||||
|
||||
var defaultToWhiteSpace = function(characters) {
|
||||
if (characters == null)
|
||||
return '\\s';
|
||||
else if (characters.source)
|
||||
return characters.source;
|
||||
else
|
||||
return '[' + _s.escapeRegExp(characters) + ']';
|
||||
};
|
||||
|
||||
// Helper for toBoolean
|
||||
function boolMatch(s, matchers) {
|
||||
var i, matcher, down = s.toLowerCase();
|
||||
matchers = [].concat(matchers);
|
||||
for (i = 0; i < matchers.length; i += 1) {
|
||||
matcher = matchers[i];
|
||||
if (!matcher) continue;
|
||||
if (matcher.test && matcher.test(s)) return true;
|
||||
if (matcher.toLowerCase() === down) return true;
|
||||
}
|
||||
}
|
||||
|
||||
var escapeChars = {
|
||||
lt: '<',
|
||||
gt: '>',
|
||||
quot: '"',
|
||||
amp: '&',
|
||||
apos: "'"
|
||||
};
|
||||
|
||||
var reversedEscapeChars = {};
|
||||
for(var key in escapeChars) reversedEscapeChars[escapeChars[key]] = key;
|
||||
reversedEscapeChars["'"] = '#39';
|
||||
|
||||
// sprintf() for JavaScript 0.7-beta1
|
||||
// http://www.diveintojavascript.com/projects/javascript-sprintf
|
||||
//
|
||||
// Copyright (c) Alexandru Marasteanu <alexaholic [at) gmail (dot] com>
|
||||
// All rights reserved.
|
||||
|
||||
var sprintf = (function() {
|
||||
function get_type(variable) {
|
||||
return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase();
|
||||
}
|
||||
|
||||
var str_repeat = strRepeat;
|
||||
|
||||
var str_format = function() {
|
||||
if (!str_format.cache.hasOwnProperty(arguments[0])) {
|
||||
str_format.cache[arguments[0]] = str_format.parse(arguments[0]);
|
||||
}
|
||||
return str_format.format.call(null, str_format.cache[arguments[0]], arguments);
|
||||
};
|
||||
|
||||
str_format.format = function(parse_tree, argv) {
|
||||
var cursor = 1, tree_length = parse_tree.length, node_type = '', arg, output = [], i, k, match, pad, pad_character, pad_length;
|
||||
for (i = 0; i < tree_length; i++) {
|
||||
node_type = get_type(parse_tree[i]);
|
||||
if (node_type === 'string') {
|
||||
output.push(parse_tree[i]);
|
||||
}
|
||||
else if (node_type === 'array') {
|
||||
match = parse_tree[i]; // convenience purposes only
|
||||
if (match[2]) { // keyword argument
|
||||
arg = argv[cursor];
|
||||
for (k = 0; k < match[2].length; k++) {
|
||||
if (!arg.hasOwnProperty(match[2][k])) {
|
||||
throw new Error(sprintf('[_.sprintf] property "%s" does not exist', match[2][k]));
|
||||
}
|
||||
arg = arg[match[2][k]];
|
||||
}
|
||||
} else if (match[1]) { // positional argument (explicit)
|
||||
arg = argv[match[1]];
|
||||
}
|
||||
else { // positional argument (implicit)
|
||||
arg = argv[cursor++];
|
||||
}
|
||||
|
||||
if (/[^s]/.test(match[8]) && (get_type(arg) != 'number')) {
|
||||
throw new Error(sprintf('[_.sprintf] expecting number but found %s', get_type(arg)));
|
||||
}
|
||||
switch (match[8]) {
|
||||
case 'b': arg = arg.toString(2); break;
|
||||
case 'c': arg = String.fromCharCode(arg); break;
|
||||
case 'd': arg = parseInt(arg, 10); break;
|
||||
case 'e': arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential(); break;
|
||||
case 'f': arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg); break;
|
||||
case 'o': arg = arg.toString(8); break;
|
||||
case 's': arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg); break;
|
||||
case 'u': arg = Math.abs(arg); break;
|
||||
case 'x': arg = arg.toString(16); break;
|
||||
case 'X': arg = arg.toString(16).toUpperCase(); break;
|
||||
}
|
||||
arg = (/[def]/.test(match[8]) && match[3] && arg >= 0 ? '+'+ arg : arg);
|
||||
pad_character = match[4] ? match[4] == '0' ? '0' : match[4].charAt(1) : ' ';
|
||||
pad_length = match[6] - String(arg).length;
|
||||
pad = match[6] ? str_repeat(pad_character, pad_length) : '';
|
||||
output.push(match[5] ? arg + pad : pad + arg);
|
||||
}
|
||||
}
|
||||
return output.join('');
|
||||
};
|
||||
|
||||
str_format.cache = {};
|
||||
|
||||
str_format.parse = function(fmt) {
|
||||
var _fmt = fmt, match = [], parse_tree = [], arg_names = 0;
|
||||
while (_fmt) {
|
||||
if ((match = /^[^\x25]+/.exec(_fmt)) !== null) {
|
||||
parse_tree.push(match[0]);
|
||||
}
|
||||
else if ((match = /^\x25{2}/.exec(_fmt)) !== null) {
|
||||
parse_tree.push('%');
|
||||
}
|
||||
else if ((match = /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(_fmt)) !== null) {
|
||||
if (match[2]) {
|
||||
arg_names |= 1;
|
||||
var field_list = [], replacement_field = match[2], field_match = [];
|
||||
if ((field_match = /^([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) {
|
||||
field_list.push(field_match[1]);
|
||||
while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') {
|
||||
if ((field_match = /^\.([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) {
|
||||
field_list.push(field_match[1]);
|
||||
}
|
||||
else if ((field_match = /^\[(\d+)\]/.exec(replacement_field)) !== null) {
|
||||
field_list.push(field_match[1]);
|
||||
}
|
||||
else {
|
||||
throw new Error('[_.sprintf] huh?');
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new Error('[_.sprintf] huh?');
|
||||
}
|
||||
match[2] = field_list;
|
||||
}
|
||||
else {
|
||||
arg_names |= 2;
|
||||
}
|
||||
if (arg_names === 3) {
|
||||
throw new Error('[_.sprintf] mixing positional and named placeholders is not (yet) supported');
|
||||
}
|
||||
parse_tree.push(match);
|
||||
}
|
||||
else {
|
||||
throw new Error('[_.sprintf] huh?');
|
||||
}
|
||||
_fmt = _fmt.substring(match[0].length);
|
||||
}
|
||||
return parse_tree;
|
||||
};
|
||||
|
||||
return str_format;
|
||||
})();
|
||||
|
||||
|
||||
|
||||
// Defining underscore.string
|
||||
|
||||
var _s = {
|
||||
|
||||
VERSION: '2.4.0',
|
||||
|
||||
isBlank: function(str){
|
||||
if (str == null) str = '';
|
||||
return (/^\s*$/).test(str);
|
||||
},
|
||||
|
||||
stripTags: function(str){
|
||||
if (str == null) return '';
|
||||
return String(str).replace(/<\/?[^>]+>/g, '');
|
||||
},
|
||||
|
||||
capitalize : function(str){
|
||||
str = str == null ? '' : String(str);
|
||||
return str.charAt(0).toUpperCase() + str.slice(1);
|
||||
},
|
||||
|
||||
chop: function(str, step){
|
||||
if (str == null) return [];
|
||||
str = String(str);
|
||||
step = ~~step;
|
||||
return step > 0 ? str.match(new RegExp('.{1,' + step + '}', 'g')) : [str];
|
||||
},
|
||||
|
||||
clean: function(str){
|
||||
return _s.strip(str).replace(/\s+/g, ' ');
|
||||
},
|
||||
|
||||
count: function(str, substr){
|
||||
if (str == null || substr == null) return 0;
|
||||
|
||||
str = String(str);
|
||||
substr = String(substr);
|
||||
|
||||
var count = 0,
|
||||
pos = 0,
|
||||
length = substr.length;
|
||||
|
||||
while (true) {
|
||||
pos = str.indexOf(substr, pos);
|
||||
if (pos === -1) break;
|
||||
count++;
|
||||
pos += length;
|
||||
}
|
||||
|
||||
return count;
|
||||
},
|
||||
|
||||
chars: function(str) {
|
||||
if (str == null) return [];
|
||||
return String(str).split('');
|
||||
},
|
||||
|
||||
swapCase: function(str) {
|
||||
if (str == null) return '';
|
||||
return String(str).replace(/\S/g, function(c){
|
||||
return c === c.toUpperCase() ? c.toLowerCase() : c.toUpperCase();
|
||||
});
|
||||
},
|
||||
|
||||
escapeHTML: function(str) {
|
||||
if (str == null) return '';
|
||||
return String(str).replace(/[&<>"']/g, function(m){ return '&' + reversedEscapeChars[m] + ';'; });
|
||||
},
|
||||
|
||||
unescapeHTML: function(str) {
|
||||
if (str == null) return '';
|
||||
return String(str).replace(/\&([^;]+);/g, function(entity, entityCode){
|
||||
var match;
|
||||
|
||||
if (entityCode in escapeChars) {
|
||||
return escapeChars[entityCode];
|
||||
} else if (match = entityCode.match(/^#x([\da-fA-F]+)$/)) {
|
||||
return String.fromCharCode(parseInt(match[1], 16));
|
||||
} else if (match = entityCode.match(/^#(\d+)$/)) {
|
||||
return String.fromCharCode(~~match[1]);
|
||||
} else {
|
||||
return entity;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
escapeRegExp: function(str){
|
||||
if (str == null) return '';
|
||||
return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
|
||||
},
|
||||
|
||||
splice: function(str, i, howmany, substr){
|
||||
var arr = _s.chars(str);
|
||||
arr.splice(~~i, ~~howmany, substr);
|
||||
return arr.join('');
|
||||
},
|
||||
|
||||
insert: function(str, i, substr){
|
||||
return _s.splice(str, i, 0, substr);
|
||||
},
|
||||
|
||||
include: function(str, needle){
|
||||
if (needle === '') return true;
|
||||
if (str == null) return false;
|
||||
return String(str).indexOf(needle) !== -1;
|
||||
},
|
||||
|
||||
join: function() {
|
||||
var args = slice.call(arguments),
|
||||
separator = args.shift();
|
||||
|
||||
if (separator == null) separator = '';
|
||||
|
||||
return args.join(separator);
|
||||
},
|
||||
|
||||
lines: function(str) {
|
||||
if (str == null) return [];
|
||||
return String(str).split("\n");
|
||||
},
|
||||
|
||||
reverse: function(str){
|
||||
return _s.chars(str).reverse().join('');
|
||||
},
|
||||
|
||||
startsWith: function(str, starts){
|
||||
if (starts === '') return true;
|
||||
if (str == null || starts == null) return false;
|
||||
str = String(str); starts = String(starts);
|
||||
return str.length >= starts.length && str.slice(0, starts.length) === starts;
|
||||
},
|
||||
|
||||
endsWith: function(str, ends){
|
||||
if (ends === '') return true;
|
||||
if (str == null || ends == null) return false;
|
||||
str = String(str); ends = String(ends);
|
||||
return str.length >= ends.length && str.slice(str.length - ends.length) === ends;
|
||||
},
|
||||
|
||||
succ: function(str){
|
||||
if (str == null) return '';
|
||||
str = String(str);
|
||||
return str.slice(0, -1) + String.fromCharCode(str.charCodeAt(str.length-1) + 1);
|
||||
},
|
||||
|
||||
titleize: function(str){
|
||||
if (str == null) return '';
|
||||
str = String(str).toLowerCase();
|
||||
return str.replace(/(?:^|\s|-)\S/g, function(c){ return c.toUpperCase(); });
|
||||
},
|
||||
|
||||
camelize: function(str){
|
||||
return _s.trim(str).replace(/[-_\s]+(.)?/g, function(match, c){ return c ? c.toUpperCase() : ""; });
|
||||
},
|
||||
|
||||
underscored: function(str){
|
||||
return _s.trim(str).replace(/([a-z\d])([A-Z]+)/g, '$1_$2').replace(/[-\s]+/g, '_').toLowerCase();
|
||||
},
|
||||
|
||||
dasherize: function(str){
|
||||
return _s.trim(str).replace(/([A-Z])/g, '-$1').replace(/[-_\s]+/g, '-').toLowerCase();
|
||||
},
|
||||
|
||||
classify: function(str){
|
||||
return _s.capitalize(_s.camelize(String(str).replace(/[\W_]/g, ' ')).replace(/\s/g, ''));
|
||||
},
|
||||
|
||||
humanize: function(str){
|
||||
return _s.capitalize(_s.underscored(str).replace(/_id$/,'').replace(/_/g, ' '));
|
||||
},
|
||||
|
||||
trim: function(str, characters){
|
||||
if (str == null) return '';
|
||||
if (!characters && nativeTrim) return nativeTrim.call(str);
|
||||
characters = defaultToWhiteSpace(characters);
|
||||
return String(str).replace(new RegExp('^' + characters + '+|' + characters + '+$', 'g'), '');
|
||||
},
|
||||
|
||||
ltrim: function(str, characters){
|
||||
if (str == null) return '';
|
||||
if (!characters && nativeTrimLeft) return nativeTrimLeft.call(str);
|
||||
characters = defaultToWhiteSpace(characters);
|
||||
return String(str).replace(new RegExp('^' + characters + '+'), '');
|
||||
},
|
||||
|
||||
rtrim: function(str, characters){
|
||||
if (str == null) return '';
|
||||
if (!characters && nativeTrimRight) return nativeTrimRight.call(str);
|
||||
characters = defaultToWhiteSpace(characters);
|
||||
return String(str).replace(new RegExp(characters + '+$'), '');
|
||||
},
|
||||
|
||||
truncate: function(str, length, truncateStr){
|
||||
if (str == null) return '';
|
||||
str = String(str); truncateStr = truncateStr || '...';
|
||||
length = ~~length;
|
||||
return str.length > length ? str.slice(0, length) + truncateStr : str;
|
||||
},
|
||||
|
||||
/**
|
||||
* _s.prune: a more elegant version of truncate
|
||||
* prune extra chars, never leaving a half-chopped word.
|
||||
* @author github.com/rwz
|
||||
*/
|
||||
prune: function(str, length, pruneStr){
|
||||
if (str == null) return '';
|
||||
|
||||
str = String(str); length = ~~length;
|
||||
pruneStr = pruneStr != null ? String(pruneStr) : '...';
|
||||
|
||||
if (str.length <= length) return str;
|
||||
|
||||
var tmpl = function(c){ return c.toUpperCase() !== c.toLowerCase() ? 'A' : ' '; },
|
||||
template = str.slice(0, length+1).replace(/.(?=\W*\w*$)/g, tmpl); // 'Hello, world' -> 'HellAA AAAAA'
|
||||
|
||||
if (template.slice(template.length-2).match(/\w\w/))
|
||||
template = template.replace(/\s*\S+$/, '');
|
||||
else
|
||||
template = _s.rtrim(template.slice(0, template.length-1));
|
||||
|
||||
return (template+pruneStr).length > str.length ? str : str.slice(0, template.length)+pruneStr;
|
||||
},
|
||||
|
||||
words: function(str, delimiter) {
|
||||
if (_s.isBlank(str)) return [];
|
||||
return _s.trim(str, delimiter).split(delimiter || /\s+/);
|
||||
},
|
||||
|
||||
pad: function(str, length, padStr, type) {
|
||||
str = str == null ? '' : String(str);
|
||||
length = ~~length;
|
||||
|
||||
var padlen = 0;
|
||||
|
||||
if (!padStr)
|
||||
padStr = ' ';
|
||||
else if (padStr.length > 1)
|
||||
padStr = padStr.charAt(0);
|
||||
|
||||
switch(type) {
|
||||
case 'right':
|
||||
padlen = length - str.length;
|
||||
return str + strRepeat(padStr, padlen);
|
||||
case 'both':
|
||||
padlen = length - str.length;
|
||||
return strRepeat(padStr, Math.ceil(padlen/2)) + str
|
||||
+ strRepeat(padStr, Math.floor(padlen/2));
|
||||
default: // 'left'
|
||||
padlen = length - str.length;
|
||||
return strRepeat(padStr, padlen) + str;
|
||||
}
|
||||
},
|
||||
|
||||
lpad: function(str, length, padStr) {
|
||||
return _s.pad(str, length, padStr);
|
||||
},
|
||||
|
||||
rpad: function(str, length, padStr) {
|
||||
return _s.pad(str, length, padStr, 'right');
|
||||
},
|
||||
|
||||
lrpad: function(str, length, padStr) {
|
||||
return _s.pad(str, length, padStr, 'both');
|
||||
},
|
||||
|
||||
sprintf: sprintf,
|
||||
|
||||
vsprintf: function(fmt, argv){
|
||||
argv.unshift(fmt);
|
||||
return sprintf.apply(null, argv);
|
||||
},
|
||||
|
||||
toNumber: function(str, decimals) {
|
||||
if (!str) return 0;
|
||||
str = _s.trim(str);
|
||||
if (!str.match(/^-?\d+(?:\.\d+)?$/)) return NaN;
|
||||
return parseNumber(parseNumber(str).toFixed(~~decimals));
|
||||
},
|
||||
|
||||
numberFormat : function(number, dec, dsep, tsep) {
|
||||
if (isNaN(number) || number == null) return '';
|
||||
|
||||
number = number.toFixed(~~dec);
|
||||
tsep = typeof tsep == 'string' ? tsep : ',';
|
||||
|
||||
var parts = number.split('.'), fnums = parts[0],
|
||||
decimals = parts[1] ? (dsep || '.') + parts[1] : '';
|
||||
|
||||
return fnums.replace(/(\d)(?=(?:\d{3})+$)/g, '$1' + tsep) + decimals;
|
||||
},
|
||||
|
||||
strRight: function(str, sep){
|
||||
if (str == null) return '';
|
||||
str = String(str); sep = sep != null ? String(sep) : sep;
|
||||
var pos = !sep ? -1 : str.indexOf(sep);
|
||||
return ~pos ? str.slice(pos+sep.length, str.length) : str;
|
||||
},
|
||||
|
||||
strRightBack: function(str, sep){
|
||||
if (str == null) return '';
|
||||
str = String(str); sep = sep != null ? String(sep) : sep;
|
||||
var pos = !sep ? -1 : str.lastIndexOf(sep);
|
||||
return ~pos ? str.slice(pos+sep.length, str.length) : str;
|
||||
},
|
||||
|
||||
strLeft: function(str, sep){
|
||||
if (str == null) return '';
|
||||
str = String(str); sep = sep != null ? String(sep) : sep;
|
||||
var pos = !sep ? -1 : str.indexOf(sep);
|
||||
return ~pos ? str.slice(0, pos) : str;
|
||||
},
|
||||
|
||||
strLeftBack: function(str, sep){
|
||||
if (str == null) return '';
|
||||
str += ''; sep = sep != null ? ''+sep : sep;
|
||||
var pos = str.lastIndexOf(sep);
|
||||
return ~pos ? str.slice(0, pos) : str;
|
||||
},
|
||||
|
||||
toSentence: function(array, separator, lastSeparator, serial) {
|
||||
separator = separator || ', ';
|
||||
lastSeparator = lastSeparator || ' and ';
|
||||
var a = array.slice(), lastMember = a.pop();
|
||||
|
||||
if (array.length > 2 && serial) lastSeparator = _s.rtrim(separator) + lastSeparator;
|
||||
|
||||
return a.length ? a.join(separator) + lastSeparator + lastMember : lastMember;
|
||||
},
|
||||
|
||||
toSentenceSerial: function() {
|
||||
var args = slice.call(arguments);
|
||||
args[3] = true;
|
||||
return _s.toSentence.apply(_s, args);
|
||||
},
|
||||
|
||||
slugify: function(str) {
|
||||
if (str == null) return '';
|
||||
|
||||
var from = "ąàáäâãåæăćęèéëêìíïîłńòóöôõøśșțùúüûñçżź",
|
||||
to = "aaaaaaaaaceeeeeiiiilnoooooosstuuuunczz",
|
||||
regex = new RegExp(defaultToWhiteSpace(from), 'g');
|
||||
|
||||
str = String(str).toLowerCase().replace(regex, function(c){
|
||||
var index = from.indexOf(c);
|
||||
return to.charAt(index) || '-';
|
||||
});
|
||||
|
||||
return _s.dasherize(str.replace(/[^\w\s-]/g, ''));
|
||||
},
|
||||
|
||||
surround: function(str, wrapper) {
|
||||
return [wrapper, str, wrapper].join('');
|
||||
},
|
||||
|
||||
quote: function(str, quoteChar) {
|
||||
return _s.surround(str, quoteChar || '"');
|
||||
},
|
||||
|
||||
unquote: function(str, quoteChar) {
|
||||
quoteChar = quoteChar || '"';
|
||||
if (str[0] === quoteChar && str[str.length-1] === quoteChar)
|
||||
return str.slice(1,str.length-1);
|
||||
else return str;
|
||||
},
|
||||
|
||||
exports: function() {
|
||||
var result = {};
|
||||
|
||||
for (var prop in this) {
|
||||
if (!this.hasOwnProperty(prop) || prop.match(/^(?:include|contains|reverse)$/)) continue;
|
||||
result[prop] = this[prop];
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
repeat: function(str, qty, separator){
|
||||
if (str == null) return '';
|
||||
|
||||
qty = ~~qty;
|
||||
|
||||
// using faster implementation if separator is not needed;
|
||||
if (separator == null) return strRepeat(String(str), qty);
|
||||
|
||||
// this one is about 300x slower in Google Chrome
|
||||
for (var repeat = []; qty > 0; repeat[--qty] = str) {}
|
||||
return repeat.join(separator);
|
||||
},
|
||||
|
||||
naturalCmp: function(str1, str2){
|
||||
if (str1 == str2) return 0;
|
||||
if (!str1) return -1;
|
||||
if (!str2) return 1;
|
||||
|
||||
var cmpRegex = /(\.\d+)|(\d+)|(\D+)/g,
|
||||
tokens1 = String(str1).toLowerCase().match(cmpRegex),
|
||||
tokens2 = String(str2).toLowerCase().match(cmpRegex),
|
||||
count = Math.min(tokens1.length, tokens2.length);
|
||||
|
||||
for(var i = 0; i < count; i++) {
|
||||
var a = tokens1[i], b = tokens2[i];
|
||||
|
||||
if (a !== b){
|
||||
var num1 = parseInt(a, 10);
|
||||
if (!isNaN(num1)){
|
||||
var num2 = parseInt(b, 10);
|
||||
if (!isNaN(num2) && num1 - num2)
|
||||
return num1 - num2;
|
||||
}
|
||||
return a < b ? -1 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (tokens1.length === tokens2.length)
|
||||
return tokens1.length - tokens2.length;
|
||||
|
||||
return str1 < str2 ? -1 : 1;
|
||||
},
|
||||
|
||||
levenshtein: function(str1, str2) {
|
||||
if (str1 == null && str2 == null) return 0;
|
||||
if (str1 == null) return String(str2).length;
|
||||
if (str2 == null) return String(str1).length;
|
||||
|
||||
str1 = String(str1); str2 = String(str2);
|
||||
|
||||
var current = [], prev, value;
|
||||
|
||||
for (var i = 0; i <= str2.length; i++)
|
||||
for (var j = 0; j <= str1.length; j++) {
|
||||
if (i && j)
|
||||
if (str1.charAt(j - 1) === str2.charAt(i - 1))
|
||||
value = prev;
|
||||
else
|
||||
value = Math.min(current[j], current[j - 1], prev) + 1;
|
||||
else
|
||||
value = i + j;
|
||||
|
||||
prev = current[j];
|
||||
current[j] = value;
|
||||
}
|
||||
|
||||
return current.pop();
|
||||
},
|
||||
|
||||
toBoolean: function(str, trueValues, falseValues) {
|
||||
if (typeof str === "number") str = "" + str;
|
||||
if (typeof str !== "string") return !!str;
|
||||
str = _s.trim(str);
|
||||
if (boolMatch(str, trueValues || ["true", "1"])) return true;
|
||||
if (boolMatch(str, falseValues || ["false", "0"])) return false;
|
||||
}
|
||||
};
|
||||
|
||||
// Aliases
|
||||
|
||||
_s.strip = _s.trim;
|
||||
_s.lstrip = _s.ltrim;
|
||||
_s.rstrip = _s.rtrim;
|
||||
_s.center = _s.lrpad;
|
||||
_s.rjust = _s.lpad;
|
||||
_s.ljust = _s.rpad;
|
||||
_s.contains = _s.include;
|
||||
_s.q = _s.quote;
|
||||
_s.toBool = _s.toBoolean;
|
||||
|
||||
// Exporting
|
||||
|
||||
// CommonJS module is defined
|
||||
if (typeof exports !== 'undefined') {
|
||||
if (typeof module !== 'undefined' && module.exports)
|
||||
module.exports = _s;
|
||||
|
||||
exports._s = _s;
|
||||
}
|
||||
|
||||
// Register as a named module with AMD.
|
||||
if (typeof define === 'function' && define.amd)
|
||||
define('underscore.string', [], function(){ return _s; });
|
||||
|
||||
|
||||
// Integrate with Underscore.js if defined
|
||||
// or create our own underscore object.
|
||||
root._ = root._ || {};
|
||||
root._.string = root._.str = _s;
|
||||
}(this, String);
|
0
node_modules/argparse/node_modules/underscore.string/libpeerconnection.log
generated
vendored
Normal file
0
node_modules/argparse/node_modules/underscore.string/libpeerconnection.log
generated
vendored
Normal file
49
node_modules/argparse/node_modules/underscore.string/package.json
generated
vendored
Normal file
49
node_modules/argparse/node_modules/underscore.string/package.json
generated
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
"name": "underscore.string",
|
||||
"version": "2.4.0",
|
||||
"description": "String manipulation extensions for Underscore.js javascript library.",
|
||||
"homepage": "http://epeli.github.com/underscore.string/",
|
||||
"contributors": [
|
||||
"Esa-Matti Suuronen <esa-matti@suuronen.org> (http://esa-matti.suuronen.org/)",
|
||||
"Edward Tsech <edtsech@gmail.com>",
|
||||
"Pavel Pravosud <pavel@pravosud.com> (<https://github.com/rwz>)",
|
||||
"Sasha Koss <kossnocorp@gmail.com> (http://koss.nocorp.me/)",
|
||||
"Vladimir Dronnikov <dronnikov@gmail.com>",
|
||||
"Pete Kruckenberg (<https://github.com/kruckenb>)",
|
||||
"Paul Chavard <paul@chavard.net> (<http://tchak.net>)",
|
||||
"Ed Finkler <coj@funkatron.com> (<http://funkatron.com>)"
|
||||
],
|
||||
"keywords": [
|
||||
"underscore",
|
||||
"string"
|
||||
],
|
||||
"main": "./lib/underscore.string.js",
|
||||
"directories": {
|
||||
"lib": "./lib"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/epeli/underscore.string.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/epeli/underscore.string/issues"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT"
|
||||
}
|
||||
],
|
||||
"scripts": {
|
||||
"test": "gulp test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"gulp": "~3.8.10",
|
||||
"gulp-uglify": "~1.0.1",
|
||||
"gulp-qunit": "~1.0.0",
|
||||
"gulp-clean": "~0.3.1",
|
||||
"gulp-rename": "~1.2.0"
|
||||
}
|
||||
}
|
25
node_modules/argparse/package.json
generated
vendored
Normal file
25
node_modules/argparse/package.json
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"name" : "argparse",
|
||||
"description" : "Very powerful CLI arguments parser. Native port of argparse - python's options parsing library",
|
||||
"version" : "0.1.16",
|
||||
"keywords" : ["cli", "parser", "argparse", "option", "args"],
|
||||
"homepage" : "https://github.com/nodeca/argparse",
|
||||
|
||||
"contributors" : ["Eugene Shkuropat", "Paul Jacobson"],
|
||||
|
||||
"bugs" : { "url": "https://github.com/nodeca/argparse/issues" },
|
||||
"license" : "MIT",
|
||||
"repository" : { "type": "git", "url": "git://github.com/nodeca/argparse.git" },
|
||||
|
||||
"main" : "./index.js",
|
||||
|
||||
"scripts" : {
|
||||
"test": "make test"
|
||||
},
|
||||
|
||||
"dependencies" : {
|
||||
"underscore" : "~1.7.0",
|
||||
"underscore.string" : "~2.4.0"
|
||||
},
|
||||
"devDependencies" : { "mocha": "*" }
|
||||
}
|
9
node_modules/async/.gitmodules
generated
vendored
Normal file
9
node_modules/async/.gitmodules
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
[submodule "deps/nodeunit"]
|
||||
path = deps/nodeunit
|
||||
url = git://github.com/caolan/nodeunit.git
|
||||
[submodule "deps/UglifyJS"]
|
||||
path = deps/UglifyJS
|
||||
url = https://github.com/mishoo/UglifyJS.git
|
||||
[submodule "deps/nodelint"]
|
||||
path = deps/nodelint
|
||||
url = https://github.com/tav/nodelint.git
|
4
node_modules/async/.npmignore
generated
vendored
Normal file
4
node_modules/async/.npmignore
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
deps
|
||||
dist
|
||||
test
|
||||
nodelint.cfg
|
19
node_modules/async/LICENSE
generated
vendored
Normal file
19
node_modules/async/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
Copyright (c) 2010 Caolan McMahon
|
||||
|
||||
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.
|
25
node_modules/async/Makefile
generated
vendored
Normal file
25
node_modules/async/Makefile
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
PACKAGE = asyncjs
|
||||
NODEJS = $(if $(shell test -f /usr/bin/nodejs && echo "true"),nodejs,node)
|
||||
CWD := $(shell pwd)
|
||||
NODEUNIT = $(CWD)/node_modules/nodeunit/bin/nodeunit
|
||||
UGLIFY = $(CWD)/node_modules/uglify-js/bin/uglifyjs
|
||||
NODELINT = $(CWD)/node_modules/nodelint/nodelint
|
||||
|
||||
BUILDDIR = dist
|
||||
|
||||
all: clean test build
|
||||
|
||||
build: $(wildcard lib/*.js)
|
||||
mkdir -p $(BUILDDIR)
|
||||
$(UGLIFY) lib/async.js > $(BUILDDIR)/async.min.js
|
||||
|
||||
test:
|
||||
$(NODEUNIT) test
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILDDIR)
|
||||
|
||||
lint:
|
||||
$(NODELINT) --config nodelint.cfg lib/async.js
|
||||
|
||||
.PHONY: test build all
|
1021
node_modules/async/README.md
generated
vendored
Normal file
1021
node_modules/async/README.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue